|
|
|
@ -306,7 +306,7 @@ class MethodTrace { |
|
|
|
|
" <element>Hello</element>\n" |
|
|
|
|
" </child>\n" |
|
|
|
|
"</base>"); |
|
|
|
|
std::auto_ptr<xml::Node> file(test.read(ss)); |
|
|
|
|
std::unique_ptr<xml::Node> file(test.read(ss)); |
|
|
|
|
std::cout<<"The element is: " |
|
|
|
|
<<(*file)["child"]["element"] |
|
|
|
|
<<std::endl; |
|
|
|
@ -432,7 +432,7 @@ class MethodTrace { |
|
|
|
|
.attr("id", xml::mandatory))))); |
|
|
|
|
[...] |
|
|
|
|
try { |
|
|
|
|
std::auto_ptr<xml::Node> persons(test.read(std::ifstream("file.xml))); |
|
|
|
|
std::unique_ptr<xml::Node> persons(test.read(std::ifstream("file.xml))); |
|
|
|
|
// Here we can be sure, that our structure is valid,
|
|
|
|
|
// but we must check optional elements before access, otherwise
|
|
|
|
|
// we get an exception.
|
|
|
|
@ -784,7 +784,7 @@ namespace xml { |
|
|
|
|
Node(const Node& o) throw(); |
|
|
|
|
virtual ~Node() throw(); |
|
|
|
|
virtual Node& operator=(const Node& o) throw(); |
|
|
|
|
virtual std::auto_ptr<Node> clone() const throw(); |
|
|
|
|
virtual std::unique_ptr<Node> clone() const throw(); |
|
|
|
|
virtual std::ostream& out(std::ostream& o, unsigned int level=0) const |
|
|
|
|
throw(); |
|
|
|
|
virtual std::string text() const throw(); |
|
|
|
@ -836,7 +836,7 @@ namespace xml { |
|
|
|
|
Attributes _attributes; |
|
|
|
|
private: |
|
|
|
|
Node* find(const std::string& child) const throw(); |
|
|
|
|
virtual std::auto_ptr<Node> clone(Node* p) const throw(); |
|
|
|
|
virtual std::unique_ptr<Node> clone(Node* p) const throw(); |
|
|
|
|
Node(); // not implemented
|
|
|
|
|
Contents _contents; |
|
|
|
|
std::string _name; |
|
|
|
@ -854,7 +854,7 @@ namespace xml { |
|
|
|
|
String(std::string name, const std::string& text, |
|
|
|
|
Node::size_type min=0, Node::size_type max=0) throw(); |
|
|
|
|
virtual ~String() throw() {} |
|
|
|
|
virtual std::auto_ptr<Node> clone() const throw(); |
|
|
|
|
virtual std::unique_ptr<Node> clone() const throw(); |
|
|
|
|
virtual std::string text() const throw(); |
|
|
|
|
virtual String& text(const std::string& txt) throw(tag_expected, |
|
|
|
|
type_mismatch); |
|
|
|
@ -885,7 +885,7 @@ namespace xml { |
|
|
|
|
public: |
|
|
|
|
UnsignedInteger(std::string name, unsigned long i=0, |
|
|
|
|
size_type min=0, size_type max=0) throw(); |
|
|
|
|
virtual std::auto_ptr<Node> clone() const throw(); |
|
|
|
|
virtual std::unique_ptr<Node> clone() const throw(); |
|
|
|
|
virtual ~UnsignedInteger() throw() {} |
|
|
|
|
virtual UnsignedInteger& text(const std::string& txt) |
|
|
|
|
throw(tag_expected, type_mismatch); |
|
|
|
@ -954,7 +954,7 @@ namespace xml { |
|
|
|
|
throw(factory_not_valid); |
|
|
|
|
static std::ostream& print(std::ostream& os, const Node& node, |
|
|
|
|
unsigned int level=0) throw(); |
|
|
|
|
std::auto_ptr<Node> read(std::istream& is) |
|
|
|
|
std::unique_ptr<Node> read(std::istream& is) |
|
|
|
|
throw(wrong_end_tag, wrong_start_tag, tag_expected, type_mismatch, |
|
|
|
|
second_slash_in_tag, character_after_slash, |
|
|
|
|
missing_end_tag, attribute_value_not_quoted, access_error, |
|
|
|
@ -972,7 +972,7 @@ namespace xml { |
|
|
|
|
Node& operator*() throw(factory_not_valid); |
|
|
|
|
Node*const operator->() throw(factory_not_valid); |
|
|
|
|
bool ws(char c) throw(); |
|
|
|
|
std::auto_ptr<Node> read(std::istream& is, const Node& position) |
|
|
|
|
std::unique_ptr<Node> read(std::istream& is, const Node& position) |
|
|
|
|
throw(wrong_end_tag, wrong_start_tag, tag_expected, type_mismatch, |
|
|
|
|
second_slash_in_tag, character_after_slash, |
|
|
|
|
missing_end_tag, |
|
|
|
@ -980,9 +980,9 @@ namespace xml { |
|
|
|
|
attributes_in_end_tag, |
|
|
|
|
illegal_attribute, mandatory_attribute_missing, |
|
|
|
|
wrong_node_number); |
|
|
|
|
std::auto_ptr<Node> checkChildren(const xml::Node& tpl, |
|
|
|
|
std::auto_ptr<Node> node, |
|
|
|
|
std::istream& is) const |
|
|
|
|
std::unique_ptr<Node> checkChildren(const xml::Node& tpl, |
|
|
|
|
std::unique_ptr<Node> node, |
|
|
|
|
std::istream& is) const |
|
|
|
|
throw(wrong_node_number); |
|
|
|
|
Tag tag(std::istream& is, const Node& position) |
|
|
|
|
throw(second_slash_in_tag, wrong_start_tag, character_after_slash, |
|
|
|
@ -1302,7 +1302,7 @@ namespace xml { |
|
|
|
|
checkInit(); |
|
|
|
|
xml::Factory factory(_xmlFactory); |
|
|
|
|
if (name.size()) factory->name(name); |
|
|
|
|
std::auto_ptr<xml::Node> node(factory.read(is)); |
|
|
|
|
std::unique_ptr<xml::Node> node(factory.read(is)); |
|
|
|
|
CONTAINER_TYPE::clear(); |
|
|
|
|
for (xml::Node::size_type i(0); i<node->children(); ++i) { |
|
|
|
|
typename CONTAINER_TYPE::value_type tmp; |
|
|
|
@ -1317,13 +1317,13 @@ namespace xml { |
|
|
|
|
checkInit(); |
|
|
|
|
xml::Node node(*_xmlFactory); |
|
|
|
|
if (name.size()) node.name(name); |
|
|
|
|
std::auto_ptr<xml::Node> tpl(node[0].clone()); |
|
|
|
|
std::unique_ptr<xml::Node> tpl(node[0].clone()); |
|
|
|
|
node.clear(); |
|
|
|
|
for (typename Container::const_iterator it = this->begin(); |
|
|
|
|
it!=this->end(); ++it) { |
|
|
|
|
typename CONTAINER_TYPE::value_type tmp; |
|
|
|
|
tmp = *it; |
|
|
|
|
std::auto_ptr<xml::Node> item(tpl->clone()); |
|
|
|
|
std::unique_ptr<xml::Node> item(tpl->clone()); |
|
|
|
|
Serialize::toNode(&tmp, *item); |
|
|
|
|
node<<*item; |
|
|
|
|
} |
|
|
|
@ -1366,7 +1366,7 @@ namespace xml { |
|
|
|
|
checkInit(); |
|
|
|
|
xml::Factory factory(_xmlFactory); |
|
|
|
|
if (name.size()) factory->name(name); |
|
|
|
|
std::auto_ptr<xml::Node> node(factory.read(is)); |
|
|
|
|
std::unique_ptr<xml::Node> node(factory.read(is)); |
|
|
|
|
CONTAINER_TYPE::clear(); |
|
|
|
|
for (xml::Node::size_type i(0); i<node->children(); ++i) { |
|
|
|
|
typename CONTAINER_TYPE::value_type tmp; |
|
|
|
@ -1381,13 +1381,13 @@ namespace xml { |
|
|
|
|
checkInit(); |
|
|
|
|
xml::Node node(*_xmlFactory); |
|
|
|
|
if (name.size()) node.name(name); |
|
|
|
|
std::auto_ptr<xml::Node> tpl(node[0].clone()); |
|
|
|
|
std::unique_ptr<xml::Node> tpl(node[0].clone()); |
|
|
|
|
node.clear(); |
|
|
|
|
for (typename CONTAINER_TYPE::const_iterator it = this->begin(); |
|
|
|
|
it!=this->end(); ++it) { |
|
|
|
|
typename CONTAINER_TYPE::value_type tmp; |
|
|
|
|
tmp = *it; |
|
|
|
|
std::auto_ptr<xml::Node> item(tpl->clone()); |
|
|
|
|
std::unique_ptr<xml::Node> item(tpl->clone()); |
|
|
|
|
Serialize::toNode(&tmp, *item); |
|
|
|
|
node<<*item; |
|
|
|
|
} |
|
|
|
@ -1433,7 +1433,7 @@ namespace xml { |
|
|
|
|
checkInit(); |
|
|
|
|
xml::Factory factory(_xmlFactory); |
|
|
|
|
if (name.size()) factory->name(name); |
|
|
|
|
std::auto_ptr<xml::Node> node(factory.read(is)); |
|
|
|
|
std::unique_ptr<xml::Node> node(factory.read(is)); |
|
|
|
|
CONTAINER_TYPE::clear(); |
|
|
|
|
for (xml::Node::size_type i(0); i<node->children(); ++i) { |
|
|
|
|
typename CONTAINER_TYPE::key_type key; |
|
|
|
@ -1450,8 +1450,8 @@ namespace xml { |
|
|
|
|
checkInit(); |
|
|
|
|
xml::Node node(*_xmlFactory); |
|
|
|
|
if (name.size()) node.name(name); |
|
|
|
|
std::auto_ptr<xml::Node> tpl1(node[0].clone()); |
|
|
|
|
std::auto_ptr<xml::Node> tpl2(node[1].clone()); |
|
|
|
|
std::unique_ptr<xml::Node> tpl1(node[0].clone()); |
|
|
|
|
std::unique_ptr<xml::Node> tpl2(node[1].clone()); |
|
|
|
|
node.clear(); // "node" is now invalid
|
|
|
|
|
for (typename AssociativeMap::const_iterator it = this->begin(); |
|
|
|
|
it!=this->end(); ++it) { |
|
|
|
@ -1459,9 +1459,9 @@ namespace xml { |
|
|
|
|
typename CONTAINER_TYPE::mapped_type data; |
|
|
|
|
key = it->first; |
|
|
|
|
data = it->second; |
|
|
|
|
std::auto_ptr<xml::Node> item1(tpl1->clone()); |
|
|
|
|
std::unique_ptr<xml::Node> item1(tpl1->clone()); |
|
|
|
|
Serialize::toNode(&key, *item1); |
|
|
|
|
std::auto_ptr<xml::Node> item2(tpl2->clone()); |
|
|
|
|
std::unique_ptr<xml::Node> item2(tpl2->clone()); |
|
|
|
|
Serialize::toNode(&data, *item2); |
|
|
|
|
node<<*item1<<*item2; |
|
|
|
|
} |
|
|
|
|