diff --git a/doc/doxyfile.in b/doc/doxyfile.in index c403593..2559acd 100644 --- a/doc/doxyfile.in +++ b/doc/doxyfile.in @@ -639,13 +639,13 @@ SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. -INLINE_SOURCES = YES +INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. -STRIP_CODE_COMMENTS = YES +STRIP_CODE_COMMENTS = NO # If the REFERENCED_BY_RELATION tag is set to YES (the default) # then for each documented function all documented diff --git a/src/xml-cxx/xml.hxx b/src/xml-cxx/xml.hxx index 32d5a71..10b5702 100644 --- a/src/xml-cxx/xml.hxx +++ b/src/xml-cxx/xml.hxx @@ -424,9 +424,10 @@ namespace xml { //---------------------------------------------------------------------------- class String: public Node { public: - String(std::string name, size_type min=0, size_type max=0) throw(); + String(std::string name, + Node::size_type min=0, Node::size_type max=0) throw(); String(std::string name, const std::string& text, - size_type min=0, size_type max=0) throw(); + Node::size_type min=0, Node::size_type max=0) throw(); virtual std::auto_ptr clone() const throw(); virtual ~String() throw() {} virtual std::string text() const throw(); diff --git a/src/xml.cxx b/src/xml.cxx index b4c3bf2..9f52bb6 100644 --- a/src/xml.cxx +++ b/src/xml.cxx @@ -170,9 +170,9 @@ namespace xml { return second; } //! Convert the attribute to a boolean. + /*! @return @c true if the value is set and not equal to one of: + @c false @c no @c 0. */ Attributes::Value::operator bool() const throw() { - /*! @return @c true if the value is set and not equal to one of: - @c false @c no @c 0. */ return !(second.size()||second=="false"||second=="no"||second=="0"); } //! Convert the attribute to a number. @@ -186,7 +186,8 @@ namespace xml { Attributes::Value::operator List() const throw() { return toList(); } - //! Convert the attribute to a space separated list. + //! Convert the attribute to list. + /*! @param separators a string containing a list of valid separators */ Attributes::List Attributes::Value::toList(const std::string& separators) const throw() { List l; @@ -200,6 +201,8 @@ namespace xml { l.push_back(second.substr(it, pos-it)); return l; } + //! Get the first value of an attribute containing a list of values. + /*! @copydoc xml::Attributes::Value::toList */ std::string Attributes::Value::front(const std::string& separators) const throw(empty_attribute_list) { List l(toList(separators)); @@ -231,11 +234,15 @@ namespace xml { //---------------------------------------------------------------------------- //! Nodes must be given a name. /*! Unnamed nodes are not allowed, therefore there's no default - constructor. */ + constructor. + @copydoc xml::Node::limits */ Node::Node(std::string name, Node::size_type min, Node::size_type max) throw(): _name(name), _parent(0), _min(min), _max(max) { } + //! Copy node, reset parent. + /*! The parent is reset, the node does not belong to the same parent + as the source of the copy. */ Node::Node(const Node& o) throw(): _attributes(o._attributes), _name(o.name()), _parent(0), _min(o._min), _max(o._max) { @@ -243,10 +250,12 @@ namespace xml { it!=o._contents.end(); ++it) _contents.push_back((*it)->clone(this).release()); } + //! Assign new node, keep parent. + /*! The parent remains unchanged, the node does not belong to the + same parent as the source of the copy. */ Node& Node::operator=(const Node& o) throw() { _attributes=o._attributes; _name = o.name(); - _parent = 0; _min = o._min; _max = o._max; for (Contents::const_iterator it(o._contents.begin()); @@ -257,11 +266,17 @@ namespace xml { clear(); } //! Clones But clears the parent. + /*! You get a new instance of the node, but detached from the + parent. It is then ready to be inserted below a new parent. */ std::auto_ptr Node::clone() const throw() { std::auto_ptr res(new Node(*this)); res->_parent = 0; return res; } + //! Stream XML. + /*! Streams the node including all attributes and children. It is + formatted with new-lines and tabulator indentation for human + readability. */ std::ostream& Node::out(std::ostream& o, unsigned int level) const throw() { if (_contents.size()) { o<second; return std::string(); } + //! Get an attribute. + /*! Returns the attribute's value (empty if the attribute is not set) */ std::string& Node::attr(const std::string& name) throw() { return _attributes[name]; } + //! Get an attribute. + /*! Returns an attribute class or throws an exception if the + attribute is not set. This method is useful when you need + conversions or other methods as specified in + xml::Attributes::Value. */ const Attributes::Value Node::attribute(const std::string& name) const throw(attribute_not_available) { Attributes::const_iterator it(_attributes.find(name)); if (it!=_attributes.end()) return *it; throw attribute_not_available(*this, name); } + //! Get the list of attributes. const Attributes& Node::attributes() const throw() { return _attributes; } + //! Get the list of attributes. Attributes& Node::attributes() throw() { return _attributes; } + //! Pass a minimal and maximal number for this node in a xml file. + /*! Minimal and maximal values are verified when you use the node as + a template in a xml::Factory. When the factory reads a stucture + from a stream through xml::Factory::read, then all the limits + are verified. + + There are several ways to declare the limits. + - in the constructor xml::Node::Node + - minimum and maximum using method xml::Node::limits + - using methods xml::Node::min and xml::Node::max separately + + It is recommended not to use the constructor, but the methods + xml::Node::limits, xml::Node::min and xml::Node::max, simply for + code readability. + + The number @c 0 means unlimited: xml::Node::min(0) means the + value is optional and xml::Node::max(0) means that there is no + upper limit. The only exception for this rule is the root + element of a structure passed to a xml::Factory which must exist + exactly once. + + Default is no limits: 0..n, + which means that the node is optional and may be instatiated + multiple (infinite, unlimited) times. */ Node& Node::limits(size_type min, size_type max) throw() { _min = min; _max = max; return *this; } + //! Get all children of a given node name Node::List Node::list(const std::string& name) const throw() { List res; for (Contents::const_iterator it(_contents.begin());