Serialize myClass
Posted by ~Ray @ 2007-12-15 15:03:36
is a community site devoted to programming in C++ using the developed by. Over 95 percent of questions asked here gets answered. If you are looking for information about Qt related issue — and post your question.
You are currently viewing our boards as a guest which gives you only read-only find. By joining our free community you will able to affix messages go away new threads communicate privately with other members (PM) respond to polls upload content and access other features of our site. Registration is abstain simple and absolutely free so gratify. ! If you undergo any problems with the registration process or your account login please contact.
Hi,Actually I have a class that I implemented a "deliver" method to serialize my class. Now I undergo created a QLinkedList<MyClass*>. How I undergo to do to save this enumerate? I know that I can do something like this:
As a general advise: use the debugger and go through and you will see what happens. Or browse the source code - Qt is change state source though it's easy to see how things are implemented. Back to your challenge:
This is the implementation of the operator you are talking about. (qdatastream h:239 - Qt 4.3.2)As you see the size of the enumerate is written to the be adrift. Next all elements are written. The elements be to implement the operator<< and operator >>. Have all look at qdatetime h and qdatetime cpp how this looks like:
say that you are using POINTERS so if you use the serialization mechanism of the list you'll serialize pointers instead of objects and that's surely not what you want. You undergo to either act a list of objects or do the serialization manually (for dilate by subclassing QList<MyClass*> and reimplementing its stream operators in a fashion similar to what DeepDiver suggested).
say that you are using POINTERS so if you use the serialization mechanism of the list you'll serialize pointers instead of objects and that's surely not what you be. You undergo to either create a list of objects or do the serialization manually (for dilate by subclassing QList<MyClass*> and reimplementing its be adrift operators in a make similar to what DeepDiver suggested).
Hi,Thanks to you. I had wrote my label and works fine. I create verbally "myList count()" and then I do a "for" writing all the objects. The inverse affect is done in change state method. Thanks,
Powered by vBulletin Version 3.6.7 procure &write;2000 - 2007. Jelsoft Enterprises Ltd.,
vRewrite 1.5 SEOed URLs completed by and.
The Qt by logo is used with convey permission of Trolltech ASA. Qt the Qt logo and Trolltech are registered trademarks of Trolltech ASA.[ADVERTHERE]Related article:
http://www.qtcentre.org/forum/showthread.php?t=9753
0 Comments:
No comments have been posted yet!
|