40 "XMLObject::getTag: XMLObject is empty");
41 return ptr_->getTag();
48 "XMLObject::hasAttribute: XMLObject is empty");
49 return ptr_->hasAttribute(name);
56 "XMLObject::getAttribute: XMLObject is empty");
57 return ptr_->getAttribute(name);
64 "XMLObject::getRequired: key "
65 << name <<
" not found");
71 bool XMLObject::getRequired<bool>(
const std::string& name)
const
73 return getRequiredBool(name);
78 int XMLObject::getRequired<int>(
const std::string& name)
const
80 return getRequiredInt(name);
85 double XMLObject::getRequired<double>(
const std::string& name)
const
87 return getRequiredDouble(name);
92 std::string XMLObject::getRequired<std::string>(
const std::string& name)
const
94 return getRequired(name);
101 "XMLObject::getRequired: key "
102 << name <<
" not found");
106 && val!=
"FALSE" && val!=
"NO" && val!=
"0",
108 "XMLObject::getRequiredBool value [" << val
109 <<
"] should have been {TRUE|FALSE|YES|NO|0|1}");
111 if (val==
"TRUE" || val==
"YES" || val==
"1")
123 void XMLObject::addAttribute<const std::string&>(
124 const std::string& name,
const std::string& value)
127 "XMLObject::addAttribute: XMLObject is empty");
128 ptr_->addAttribute(name, value);
135 "XMLObject::numChildren: XMLObject is empty");
136 return ptr_->numChildren();
143 "XMLObject::getChild: XMLObject is empty");
144 return ptr_->getChild(i);
149 "XMLObject::getChild: XMLObject is empty");
161 "XMLObject::numContentLines: XMLObject is empty");
162 return ptr_->numContentLines();
169 "XMLObject::getContentLine: XMLObject is empty");
170 return ptr_->getContentLine(i);
177 "XMLObject::toString: XMLObject is empty");
178 return ptr_->toString();
185 "XMLObject::print: XMLObject is empty");
186 ptr_->print(os, indent);
193 "XMLObject::header: XMLObject is empty");
194 return ptr_->header();
201 "XMLObject::terminatedHeader: XMLObject is empty");
202 return ptr_->terminatedHeader();
209 "XMLObject::footer: XMLObject is empty");
210 return ptr_->footer();
217 "XMLObject::checkTag error: expected <"
218 << expected <<
">, found <"
226 "XMLObject::addChild: XMLObject is empty");
227 ptr_->addChild(child);
234 "XMLObject::addContent: XMLObject is empty");
235 ptr_->addContent(contentLine);
const std::string & getTag() const
Return the tag of the current node.
std::string footer() const
Write the footer for this object to a std::string.
static std::string allCaps(const std::string &str)
Converts a std::string to all upper case.
bool is_null(const std::shared_ptr< T > &p)
Returns true if p.get()==NULL.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
void addChild(const XMLObject &child)
Add a child node to the node.
XMLObject deepCopy() const
Make a deep copy of this object.
XMLObject()
Empty constructor.
A std::string utilities class for Teuchos.
Thrown when attempting to parse an empty XML std::string.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
std::string toString() const
Represent this node and its children as a std::string.
Representation of an XML data tree. XMLObject is a ref-counted handle to a XMLObjectImplem object...
std::string terminatedHeader() const
Write the header for this object to a std::string.
std::string header() const
Write the header for this object to a std::string.
bool getRequiredBool(const std::string &name) const
Get a required attribute, returning it as a bool.
void print(std::ostream &os, int indent) const
Print this node and its children to stream with the given indentation.
int numChildren() const
Return the number of child nodes owned by this node.
void addContent(const std::string &contentLine)
Add a line of character content.
const std::string & getAttribute(const std::string &name) const
Return the value of the attribute with the specified name.
int numContentLines() const
Return the number of lines of character content stored in this node.
void checkTag(const std::string &expected) const
Check that a tag is equal to an expected std::string.
The XMLObjectImplem class takes care of the low-level implementation details of XMLObject.
int findFirstChild(std::string tagName) const
Returns the index of the first child found with the given tag name. Returns -1 if no child is found...
const XMLObject & getChild(int i) const
Return the i-th child node.
bool hasAttribute(const std::string &name) const
Find out if the current node has an attribute of the specified name.
const std::string & getContentLine(int i) const
Return the i-th line of character content stored in this node.
const std::string & getRequired(const std::string &name) const
Get an attribute, throwing an std::exception if it is not found.
An object representation of a subset of XML data.