UnsingedInteger

This commit is contained in:
Marc Wäckerlin
2009-04-03 14:02:22 +00:00
parent 6393bf7b03
commit 2f533e99b8
2 changed files with 46 additions and 48 deletions

View File

@@ -5,8 +5,8 @@
// 1 2 3 4 5 6 7 8
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
#ifndef XML_HXX
#define XML_HXX
#ifndef LIB_XML_CXX_HXX
#define LIB_XML_CXX_HXX
#include <istream>
#include <string>
@@ -85,9 +85,10 @@ namespace xml {
//----------------------------------------------------------------------------
class type_mismatch: public exception {
public:
type_mismatch(const Node& t, const std::string& txt) throw():
exception("wrong type, text contains mismatching character\ntext: "
+txt, t) {}
type_mismatch(const Node& t, const std::string& txt,
const std::string& comment) throw():
exception("wrong type, text contains mismatching character\n"+comment
+"\ntext: "+txt, t) {}
};
//----------------------------------------------------------------------------
class access_error: public exception {
@@ -266,25 +267,20 @@ namespace xml {
throw();
virtual String& append(const Node& o) throw(cannot_have_children);
Node& operator=(const std::string& contents) throw();
private:
protected:
std::string _text;
};
//----------------------------------------------------------------------------
class UnsignedInteger: public Node {
class UnsignedInteger: public String {
public:
String(std::string name, const std::string& text = std::string()) throw();
UnsignedInteger(std::string name, unsigned long i = 0) throw();
virtual std::auto_ptr<Node> clone() const throw();
virtual ~String() throw() {}
virtual std::string text() const throw();
virtual String& text(const std::string& txt) throw(tag_expected,
type_mismatch);
virtual std::ostream& out(std::ostream& o, unsigned int level=0) const
throw();
virtual String& append(const Node& o) throw(cannot_have_children);
Node& operator=(const std::string& contents) throw();
private:
std::string _text;
virtual ~UnsignedInteger() throw() {}
virtual UnsignedInteger& text(const std::string& txt)
throw(tag_expected, type_mismatch);
unsigned long number() const throw();
static unsigned long number(const Node& node) throw();
};
//----------------------------------------------------------------------------