|
void Serialize(CArchive &ar)
{
if (ar.IsStoring()) {
} else {
}
}
Any easy way to do this?
|
|
|
|
|
Short answer: Depends.
The CArchive represents only one file - it doesn't even have to represent a file, it could be a stream, etc.
Do you have one document, but the data in it should be saved into multiple files? Then don;t use the CDocument::Serialize method (I never do!), override the CDocument::OnOpenDocument method instead (and its corresponding save method).
You can then save / load however you like!
"Easy" will depend on just what you want to achieve.
Iain.
Iain Clarke appears because CPallini still cares.
|
|
|
|
|
If you really need to store multiple file into yor unique one, you have to copy every file content (possibly each one prefixed by its length).
You may wrap this behaviour into a serializable class (you may call it CFile , oops, no, wait a moment...).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
I'm getting a strange error...
if I write:
if (uType == ANNEAL)
{
CAnneal * pOrigAnn = dynamic_cast<CAnneal *> (pOrigItem) ;
if(pOrigAnn != NULL)
{
CAnneal * pAnneal = new CAnneal();
}
...
Everything's fine. But, if I want to use a case instead of an if
switch (uType)
{
case ANNEAL:
CAnneal * pOrigAnn = dynamic_cast<CAnneal *> (pOrigItem) ;
if(pOrigAnn != NULL)
{
CAnneal * pAnneal = new CAnneal();
}
break;
case WHATEVER:
...
I get an error that says "initialization of 'pOrigAnn' is skipped by 'default' label" ... "See declaration of pOrigAnn"
|
|
|
|
|
Beacause you've not included your code inside a block and pOriginAnn is the whole switch block (while its assignment happens only in ANNEAL case.
You may change it to
switch (uType)
{
case ANNEAL:
{
CAnneal * pOrigAnn = dynamic_cast<CAnneal *> (pOrigItem) ;
if(pOrigAnn != NULL)
{
CAnneal * pAnneal = new CAnneal();
}
}
break;
case WHATEVER:
...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Interesting...
Thank you!!
|
|
|
|
|
Hi,
So you got the problem..
Thanks,
Suman
|
|
|
|
|
Hi,
Is there any other access of "pOrigAnn" outside of "case ANNEAL" like:
piul wrote:
switch (uType){
case ANNEAL:
CAnneal * pOrigAnn = dynamic_cast<CAnneal *> (pOrigItem);
if(pOrigAnn != NULL){
CAnneal * pAnneal = new CAnneal();
}
break;
case WHATEVER:...
...
break;
default:
...
}
//access pOrigAnn
or somewhere else?
Thanks,
Suman
|
|
|
|
|
Hello everyone,
A little confused after reading C++ FAQ, "Why doesn't delete zero out its operand?"
http://www.research.att.com/~bs/bs_faq2.html#delete-zero
I think the reason why delete can not zero out its operand is because delete can be operate on rvalue, like
delete f(x);
And we can not assign zero to the rvalue (i.e. delete's operand). My understanding correct?
thanks in advance,
George
|
|
|
|
|
Yes, Bjarne states that clearly.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Thanks CPallini,
I think you agree with my understanding.
regards,
George
|
|
|
|
|
Hi,
I am looking for algorithm which will find the given point is inside of a given polygon(a triangle) or not.
Which will work for coordinate in -ve and +ve direction.
Best Regards,
Suman
|
|
|
|
|
If you can walk over the lines polygon you should find the point always on the same side either left or right.
Otherwise check out this page[^]
codito ergo sum
|
|
|
|
|
You don't like PtInRegion and CreatePolyRegion functions, do you?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
|
|
Hi,
Thanks for help..
How to create the region when the points are not in order and we need to fill the complete region by connecting outermost points using CreatePolyRegion() ?
Thanks,
Suman
|
|
|
|
|
Aren't you able to order the points? Is the polygon convex?
Try also the Graphics forum [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
CPallini wrote: Is the polygon convex?
The polygon can be of any type.
The points may not be in order most of the time.
I will post in Graphics section
Thanks for help!!
Best Regards,
Suman
|
|
|
|
|
You need Convex Hull of points to find a polygon including all points.
-Saurabh
|
|
|
|
|
Saurabh.Garg wrote: You need Convex Hull of points to find a polygon including all points.
Hi,
Thanks for the help.
Is there function to get convex hull of points from set of polygon points which is not in order.
Thanks,
Suman
--
"Programming is an art that fights back!"
|
|
|
|
|
hi guys. just started with visual c++ mfc. im currently making an SDI app with two splitters. 1 vertical and 1 horizontal. i used the SDI (windows explorer) wizard but added one horizontal splitter. leftview is a treeview control, lower right is listview control. for the upper right, the msflexgrid control. i used the "add to project-components and controls-registered activex comps" for the flexgrid. how can i obtain a pointer to my flexgrid (for manipulation)? like when i'll click on a tree node, i want to do something with my flexgrid.
any help will much be appreciated. and sorry for my english...thanks.
|
|
|
|
|
|
thanks Suman. but i think its only applicable to dialog based apps, im not sure. i dont have a form where i could put/draw/drag the flexgrid control to, since its SDI.
regards,
_chew
|
|
|
|
|
Hi,
How you are creating flxgrid in your application?
Are you creating in runtime?
Depending on that method we will try to get pointer.
Thanks,
Suman
|
|
|
|