node macros added (usefule but unfinished)

This commit is contained in:
Marc Wäckerlin
2009-04-23 06:41:50 +00:00
parent 94f5fd4970
commit a9ad45ad4d
5 changed files with 193 additions and 20 deletions

View File

@@ -5,7 +5,7 @@
// 1 2 3 4 5 6 7 8
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
// g++ -I../src ../src/xml.cxx address.cxx
// g++ -I../../src ../../src/xml.cxx address.cxx
#include <xml-cxx/xml.hxx>
#include <iostream>

View File

@@ -0,0 +1,32 @@
/*! @file
@id $Id$
*/
// 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>
XML_NODE(base);
XML_NODE(child);
XML_STRING(element);
int main(int, char**) {
xml::Factory test(*xml::node::base.clone()
<<(*xml::node::child.clone()
<<*xml::string::element.clone()));
std::stringstream ss("<base>\n"
" <child>\n"
" <element>Hello</element>\n"
" </child>\n"
"</base>");
std::auto_ptr<xml::Node> file(test.read(ss));
std::cout<<"The text in element is: "
<<(*file)[xml::name::child][xml::name::element].text()
<<std::endl;
return 0;
}

View File

@@ -0,0 +1,50 @@
/*! @file
@id $Id$
*/
// 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>
/*
template<class STREAM> class Stream: public STREAM {
public:
virtual ~Stream() {}
template<typename T> virtual Stream& operator%(T& o);
};
template<class STREAM> class IStream: public Stream<STREAM> {
public:
virtual template<typename T> IStream& operator%(T& o) {
operator>>(o);
return *this;
}
};
template<class STREAM> class OStream: public Stream<STREAM> {
public:
virtual template<typename T> OStream& operator%(T& o) {
operator<<(o);
return *this;
}
};
*/
template<class STREAM, typename TYPE>
STREAM& operator%(STREAM& s, TYPE& o);
template<class STREAM, typename TYPE>
STREAM& operator%(STREAM& s, TYPE& o);
class A {
public:
int a;
std::string txt;
};
int main(int, char**) {
return 0;
}