-
Serialize and DeSerialize of CObArray
Need help in the Serializing and DeSerializing of an CObArray.
I know to Serialize I just do this:
CObArray testList;
testList.Serialize(ar);
so how to I take out the CObArray and assign it to another CObArray object test2List?
thanks in advance.
-
You need to be more precise in what you are trying to say/do.
From posted code I would say CObArray is a user defined class. The the CObArray class has a method called Serialize() that takes a single argument. You declare testlist as a CObArray object. Then you pass ar, whatever that is, to the Serialize() method of that object.
Now to the crux of the problem: Are you trying to "copy" one CObArray object to another (a process accomplished by an overloaded assignment operator, and/or a copy constructor) or do you wish to transfer data in a member variable of one object into a member variable, method of another object?
-
CObArray is an array of Objects.
-
Do you mean that CObArray is an array of objects like
objectType CObArray[numberOfObjects];
or
objectType * CObArray = new objectType[numberOFObjects];
and the line
CObArray testlist;
is gibberish. Or do you mean something like a class that has an array of objects in it. Like this:
class CObArray
{
public:
int array[numberOfObjects];
void Serialize(int);
}
in which case the line:
CObArray testline;
makes sense.
-
CObArray is something MS wrote, Kinda like CString.It works like so
CObArray coMyArray;
Then you have a whole bunch of methods to maniulate this array ex
coMyArray.Add(),,,,,
coMyArray.RemoveAll()....
coMyArray[2],,,,,
It stored a pointer to the object and the size is dynamicly allocated.
http://msdn.microsoft.com/library/de...ss_members.asp
It works really well
-
Ermm let me be more precise.
I declared a CObArray Object called tempList.
code:
CObArray tempList;
Than lets say I added stuff to it.
So the should be like this:
void CModule1Doc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
// Serialize tempList
tempList.Serialize(ar)
}
else
{
// TODO: add loading code here
}
}
Now the problem I have is how to DeSerialize my tempList out.
Popular pages
Recent additions