start of xml::Optional
This commit is contained in:
@@ -5,8 +5,6 @@
|
||||
// 1 2 3 4 5 6 7 8
|
||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
|
||||
// g++ -I../../src ../../src/xml.cxx address.cxx
|
||||
|
||||
#include <xml-cxx/xml.hxx>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
@@ -5,8 +5,6 @@
|
||||
// 1 2 3 4 5 6 7 8
|
||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
|
||||
// g++ -I../../src ../../src/xml.cxx contain_serialization.cxx
|
||||
|
||||
#include <xml-cxx/xml.hxx>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
@@ -5,8 +5,6 @@
|
||||
// 1 2 3 4 5 6 7 8
|
||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
|
||||
// g++ -I../../src ../../src/xml.cxx inherit_serialization.cxx
|
||||
|
||||
#include <xml-cxx/xml.hxx>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
@@ -23,12 +21,12 @@ class A: public xml::Serialize {
|
||||
}
|
||||
};
|
||||
|
||||
class B: public A {
|
||||
class B: public A { // A inherits xml::Serialize, B inherits A
|
||||
public:
|
||||
int b;
|
||||
protected:
|
||||
void initXmlMembers() {
|
||||
A::initXmlMembers();
|
||||
A::initXmlMembers(); // <- Here is the important difference
|
||||
className("B");
|
||||
persist(b, "b");
|
||||
}
|
||||
|
@@ -5,8 +5,6 @@
|
||||
// 1 2 3 4 5 6 7 8
|
||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
|
||||
// g++ -I../../src ../../src/xml.cxx list_serialization.cxx
|
||||
|
||||
#include <xml-cxx/xml.hxx>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
@@ -37,26 +35,57 @@ class B: public xml::Serialize {
|
||||
};
|
||||
|
||||
int main(int, char**) {
|
||||
std::stringstream ss("<B>\n"
|
||||
"<b>1234</b>"
|
||||
"<a><list><item>guguseli</item></list></a>"
|
||||
"<As>"
|
||||
"<A>\n"
|
||||
"\t<list>\n"
|
||||
"\t\t<item>Hello</item>\n"
|
||||
"\t\t<item>World</item>\n"
|
||||
"\t\t<item>how</item>\n"
|
||||
"\t\t<item>are</item>\n"
|
||||
"\t\t<item>you</item>\n"
|
||||
"\t</list>\n"
|
||||
"</A>"
|
||||
"</As>"
|
||||
std::stringstream ss("<B>"
|
||||
" <b>1234</b>"
|
||||
" <a>"
|
||||
" <list>"
|
||||
" <item>guguseli</item>"
|
||||
" </list>"
|
||||
" </a>"
|
||||
" <As>"
|
||||
" <A>"
|
||||
" <list>"
|
||||
" <item>Hello</item>"
|
||||
" <item>World</item>"
|
||||
" <item>how</item>"
|
||||
" <item>are</item>"
|
||||
" <item>you</item>"
|
||||
" </list>"
|
||||
" </A>"
|
||||
" <A>"
|
||||
" <list>"
|
||||
" <item>a</item>"
|
||||
" <item>b</item>"
|
||||
" <item>c</item>"
|
||||
" <item>d</item>"
|
||||
" <item>e</item>"
|
||||
" </list>"
|
||||
" </A>"
|
||||
" <A>"
|
||||
" <list>"
|
||||
" <item>f</item>"
|
||||
" <item>g</item>"
|
||||
" <item>h</item>"
|
||||
" <item>i</item>"
|
||||
" <item>j</item>"
|
||||
" </list>"
|
||||
" </A>"
|
||||
" <A>"
|
||||
" <list>"
|
||||
" <item>k</item>"
|
||||
" <item>l</item>"
|
||||
" <item>m</item>"
|
||||
" <item>n</item>"
|
||||
" <item>o</item>"
|
||||
" </list>"
|
||||
" </A>"
|
||||
" </As>"
|
||||
"</B>");
|
||||
B b;
|
||||
std::cout<<"SCHEMA:"<<std::endl<<b.schema()<<std::endl;
|
||||
b.loadXml(ss);
|
||||
// if (a.list.front()=="Hello") a.list.front()="Good Bye";
|
||||
// if (a.list.back()=="you") a.list.back()="we";
|
||||
if (b.as.front().list.front()=="Hello") b.as.front().list.front()="Good Bye";
|
||||
if (b.as.front().list.back()=="you") b.as.front().list.back()="we";
|
||||
b.saveXml(std::cout)<<std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
@@ -5,8 +5,6 @@
|
||||
// 1 2 3 4 5 6 7 8
|
||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
|
||||
// g++ -I../../src ../../src/xml.cxx node_macros.cxx
|
||||
|
||||
#include <xml-cxx/xml.hxx>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
@@ -5,8 +5,6 @@
|
||||
// 1 2 3 4 5 6 7 8
|
||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
|
||||
// g++ -I../../src ../../src/xml.cxx serialization.cxx
|
||||
|
||||
#include <xml-cxx/xml.hxx>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
Reference in New Issue
Block a user