mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core: Xmlize now able to define tag names for container items
git-svn-id: svn://ultimatepp.org/upp/trunk@3454 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
bf935388be
commit
d2692fdb14
1 changed files with 25 additions and 0 deletions
|
|
@ -30,6 +30,7 @@ public:
|
|||
void SetAttr(const char *id, const String& val) { node.SetAttr(id, val); }
|
||||
|
||||
template <class T> XmlIO operator()(const char *tag, T& var);
|
||||
template <class T> XmlIO operator()(const char *tag, const char *itemtag, T& var);
|
||||
|
||||
template <class T> XmlIO Attr(const char *id, T& var) {
|
||||
if(IsLoading())
|
||||
|
|
@ -70,12 +71,24 @@ void Xmlize(XmlIO xml, T& var)
|
|||
var.Xmlize(xml);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void Xmlize(XmlIO xml, const char* itemtag, T& var)
|
||||
{
|
||||
var.Xmlize(xml);
|
||||
}
|
||||
|
||||
template <class T> XmlIO XmlIO::operator()(const char *tag, T& var) {
|
||||
XmlIO n(*this, tag);
|
||||
Xmlize(n, var);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T> XmlIO XmlIO::operator()(const char *tag, const char *itemtag, T& var) {
|
||||
XmlIO n(*this, tag);
|
||||
Xmlize(n, itemtag, var);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<> inline void XmlAttrLoad(String& var, const String& text) { var = text; }
|
||||
template<> inline String XmlAttrStore(const String& var) { return var; }
|
||||
|
||||
|
|
@ -157,12 +170,24 @@ void Xmlize(XmlIO xml, Vector<T>& data)
|
|||
XmlizeContainer(xml, "item", data);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void Xmlize(XmlIO xml, const char* itemtag, Vector<T>& data)
|
||||
{
|
||||
XmlizeContainer(xml, itemtag, data);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void Xmlize(XmlIO xml, Array<T>& data)
|
||||
{
|
||||
XmlizeContainer(xml, "item", data);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void Xmlize(XmlIO xml, const char* itemtag, Array<T>& data)
|
||||
{
|
||||
XmlizeContainer(xml, itemtag, data);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void XmlizeStore(XmlIO xml, const T& data)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue