topic "WithPolyXML";
[2 $$0,0#00000000000000000000000000000000:Default]
[i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class]
[l288;2 $$2,2#27521748481378242620020725143825:desc]
[0 $$3,0#96390100711032703541132217272105:end]
[H6;0 $$4,0#05600065144404261032431302351956:begin]
[i448;a25;kKO9;2 $$5,0#37138531426314131252341829483370:item]
[l288;a4;*@5;1 $$6,6#70004532496200323422659154056402:requirement]
[l288;i1121;b17;O9;~~~.1408;2 $$7,0#10431211400427159095818037425705:param]
[i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam]
[b42;2 $$9,9#13035079074754324216151401829390:normal]
[{_} 
[ {{10000@(113.42.0) [s0;%% [*@7;4 WithPolyXML]]}}&]
[s1;@(0.0.255)3 &]
[s1;:noref: [@(0.0.255)3 template][3 _<][@(0.0.255)3 class][3 _][*@4;3 T][3 >]&]
[s1;:WithPolyXML`:`:class: [@(0.0.255) class]_[* WithPolyXML]_:_[@(0.0.255) public]_[*@3 WithF
actory]<[*@4 T]>_&]
[s8;%% [*C@4 T]-|Type of base class of polymorphic hierarchy.&]
[s0;%% This template class implements the base behaviour of polymorphic 
classes that needs to be streamed in XML format.&]
[s3;%% &]
[s1;@(0.0.255)3 &]
[s1;:noref: [@(0.0.255)3 template][3 _<][@(0.0.255)3 class][3 _][*@4;3 T][3 >]&]
[s1;:PolyXMLArray`:`:class: [@(0.0.255) class]_[* PolyXMLArray]_:_[@(0.0.255) public]_[*@3 Arr
ay]<[*@4 T]>_&]
[s8;%% [*C@4 T]-|Type of base class of polymorphic hierarchy.&]
[s0;%% This template class implements the base behaviour of an XML`-streamable 
polymorphic Array container.&]
[s2;%% &]
[s3; &]
[s1;:noref: [@(0.0.255)3 template][3 _<][@(0.0.255)3 class ][*@4;3 K][@(0.0.255)3 , 
class][3 _][*@4;3 T][3 >]&]
[s1;:PolyXMLArrayMap`:`:class: [@(0.0.255) class]_[* PolyXMLArrayMap]_:_[@(0.0.255) public]_
[*@3 ArrayMap]<[*@4 K ][* , ][*@4 T]>_&]
[s8;%% [*C@4 T]-|Type of base class of polymorphic hierarchy.&]
[s0;%% This template class implements the base behaviour of an XML`-streamable 
polymorphic ArrayMap container.&]
[s2;%% &]
[s3; &]
[s1;:noref: [@(0.0.255)3 template][3 _<][@(0.0.255)3 class ][*@4;3 K][@(0.0.255)3 , 
class][3 _][*@4;3 T][3 >]&]
[s1;:PolyXMLArrayMapOne`:`:class: [@(0.0.255) class]_[* PolyXMLArrayMapOne]_:_[@(0.0.255) pu
blic]_[*@3 ArrayMap]<[*@4 K ][* , One<][*@4 T]> >_&]
[s8;%% [*C@4 T]-|Type of base class of polymorphic hierarchy.&]
[s0;%% This template class implements the base behaviour of an XML`-streamable 
polymorphic ArrayMap container, where Value type is of type [%-* One<][%-*@4 T][%- >].&]
[s2;%% &]
[s3; &]
[s0;%% &]
[ {{10000F(128)G(128)@1 [s0;%% [* Basic usage]]}}&]
[s3; &]
[s9;%% To implement the polymorphic XML behaviour in your base class, 
just derive from [* WithPolyXML ]template :&]
[s0;%% &]
[s2;%% [* class MyBaseClass : public WithPolyXML<MyBaseClass>]&]
[s2;%% [* `{]&]
[s2;%% [* -|-|public:]&]
[s2;%% [* -|-|-|virtual void Xmlize(XmlIO xml);]&]
[s2;%% [* `};]&]
[s9;%% Then you can derive your class hyerarchy from base, as usual 
:&]
[s0;%% &]
[s2;%% [* class MyDerivedClass : public MyBaseClass]&]
[s2;%% [* `{]&]
[s2;%% [* -|-|public:]&]
[s2;%% [* -|-|-|virtual void Xmlize(XmlIO xml);]&]
[s2;%% [* `};]&]
[s9;%% &]
[s9;%% The [* Xmlize()] virtual member function must be defined in 
each class in the hierarchy; its purpose is to XML`-ize [* ONLY 
]the direct members of the class. Because of that, in each derived 
class you must call [* AT FIRST] the parent`'s class [* Xmlize()] 
from inside it; here an example:&]
[s0;%% &]
[s2;%% [* void MyBaseClass`::Xmlize(XmlIO xml)]&]
[s2;%% [* `{]&]
[s2;%% [* -|-|xml]&]
[s2;%% [* -|-|-|(`"FirstBaseMember`", FirstBaseMember)]&]
[s2;%% [* -|-|-|(`"SecondBaseMember`", SecondBaseMember)]&]
[s2;%% [* -|-|;]&]
[s2;%% [* `}]&]
[s2;*%% &]
[s2;%% [* void MyDerivedClass`::Xmlize(XmlIO xml)]&]
[s2;%% [* `{]&]
[s2;%% [* -|-|MyBaseClass`::Xmlize(XmlIO xml);]&]
[s2;%% [* -|-|xml]&]
[s2;%% [* -|-|-|(`"FirstDerivedMember`", FirstDerivedMember)]&]
[s2;%% [* -|-|-|(`"SecondDerivedMember`", SeconDeriveddMember)]&]
[s2;%% [* -|-|;]&]
[s2;%% [* `}]&]
[s9;%% Don`'t forget to register your classes by [* REGISTERCLASS] 
macro, see [* WithFactory ]help topic about it.&]
[s9;%% Then, you must declare the class container :&]
[s0;%% &]
[s2;%% [* class MyXMLContainer : public PolyXMLArray<MyXMLContainer>]&]
[s2;%% [* `{]&]
[s2;%% [* `}];&]
[s0;%% &]
[s0;%% That`'s all. Now you can construct your classes, add them 
to container which behaviour is identical to Array`'s one, and 
stream the container in XML format :&]
[s0;%% &]
[s0;%% Create classes and container :&]
[s2;%% [* MyBaseClass `* baseClass `= new MyBaseClass;]&]
[s2;%% [* MyBaseClass `* derivedClass `= MyBaseClass`::CreatePtr(`"MyDerivedClass`");]&]
[s2;%% [* MyXMLContainer myContainer;]&]
[s2;%% [* myContainer.Add(baseClass);]&]
[s2;%% [* myContainer.Add(derivedClass);]&]
[s0;%% &]
[s0;%% Stream container into a string :&]
[s2;%% [* String s `= StoreAsXML(myContainer, `"aTagName`");]&]
[s0;%% &]
[s0;%% Reload container from a string :&]
[s2;%% [* myContainer.Clear();]&]
[s2;%% [* bool  res `= LoadFromXML(myContainer, s);]&]
[s0;%% &]
[s0;%% Store container into an xml file :&]
[s2;%% [* bool res `= StoreAsXMLFile(myContainer, `"aTagName`", `"a/file/path.xml`");]&]
[s0;%% &]
[s0;%% Reload container from an xml file :&]
[s2;%% [* myContainer.Clear();]&]
[s2;%% [* bool res `= LoadFromXMLFile(myContainer, `"a/file/path.xml`")]&]
[s0;%% ]