Core: Xmlize now does not change variables if correspoinding tag is missing

git-svn-id: svn://ultimatepp.org/upp/trunk@11090 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2017-05-15 18:37:16 +00:00
parent be1870e4f4
commit decfea7cdc
2 changed files with 11 additions and 3 deletions

View file

@ -82,12 +82,16 @@ void Xmlize(XmlIO& xml, const char* itemtag, T& var)
template <class T> XmlIO XmlIO::operator()(const char *tag, T& var) {
XmlIO n(*this, tag);
if(IsLoading() && n.Node().GetCount() == 0 && n.Node().GetAttrCount() == 0)
return *this;
Xmlize(n, var);
return *this;
}
template <class T> XmlIO XmlIO::List(const char *tag, const char *itemtag, T& var) {
XmlIO n(*this, tag);
if(IsLoading() && n.Node().GetCount() == 0 && n.Node().GetAttrCount() == 0)
return *this;
Xmlize(n, itemtag, var);
return *this;
}

View file

@ -67,8 +67,9 @@ function that calls [* Xmlize ]method for [%-*@3 var] with new XmlIO
as parameter `- that way the [* Xmlize ]can be defined either as
global template function specializastion for [%-*@4 T] or as method
of [%-*@4 T] (usually easier, but not always possible). [%-*@3 def]
parameter can be used to provide default value when retrieving
data from XML fails.&]
parameter can be used to provide default value when there is
no corresponding tag on loading. Variant without [%-*@3 def] leaves
[%-*@3 var] unchanged in this case.&]
[s3;%% &]
[s4; &]
[s5;:Upp`:`:XmlIO`:`:List`(const char`*`,const char`*`,T`&`,const D`&`): [@(0.0.255) te
@ -88,7 +89,10 @@ the [* Xmlize ]can be defined either as global template function
specializastion for [%-*@4 T] or as method of [%-*@4 T] (usually
easier, but not always possible). [%-*@3 itemtag] is additional
parameter that can be used as name of embeded tags when collections
of items are Xmlized. &]
of items are Xmlized. [%-*@3 def] parameter can be used to provide
default value when there is no corresponding tag on loading.
Variant without [%-*@3 def] leaves [%-*@3 var] unchanged in this
case.&]
[s3;%% &]
[s4;%% &]
[s5;:XmlIO`:`:Attr`(const char`*`,T`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T]>