72 "XMLObject::getTag: XMLObject is empty");
73 return ptr_->getTag();
80 "XMLObject::hasAttribute: XMLObject is empty");
81 return ptr_->hasAttribute(name);
88 "XMLObject::getAttribute: XMLObject is empty");
89 return ptr_->getAttribute(name);
96 "XMLObject::getRequired: key "
97 << name <<
" not found");
103 bool XMLObject::getRequired<bool>(
const std::string& name)
const
105 return getRequiredBool(name);
110 int XMLObject::getRequired<int>(
const std::string& name)
const
112 return getRequiredInt(name);
117 double XMLObject::getRequired<double>(
const std::string& name)
const
119 return getRequiredDouble(name);
124 std::string XMLObject::getRequired<std::string>(
const std::string& name)
const
126 return getRequired(name);
133 "XMLObject::getRequired: key "
134 << name <<
" not found");
138 && val!=
"FALSE" && val!=
"NO" && val!=
"0",
140 "XMLObject::getRequiredBool value [" << val
141 <<
"] should have been {TRUE|FALSE|YES|NO|0|1}");
143 if (val==
"TRUE" || val==
"YES" || val==
"1")
155 void XMLObject::addAttribute<const std::string&>(
156 const std::string& name,
const std::string& value)
159 "XMLObject::addAttribute: XMLObject is empty");
160 ptr_->addAttribute(name, value);
167 "XMLObject::numChildren: XMLObject is empty");
168 return ptr_->numChildren();
175 "XMLObject::getChild: XMLObject is empty");
176 return ptr_->getChild(i);
181 "XMLObject::getChild: XMLObject is empty");
193 "XMLObject::numContentLines: XMLObject is empty");
194 return ptr_->numContentLines();
201 "XMLObject::getContentLine: XMLObject is empty");
202 return ptr_->getContentLine(i);
209 "XMLObject::toString: XMLObject is empty");
210 return ptr_->toString();
217 "XMLObject::print: XMLObject is empty");
218 ptr_->print(os, indent);
225 "XMLObject::header: XMLObject is empty");
226 return ptr_->header();
233 "XMLObject::terminatedHeader: XMLObject is empty");
234 return ptr_->terminatedHeader();
241 "XMLObject::footer: XMLObject is empty");
242 return ptr_->footer();
249 "XMLObject::checkTag error: expected <"
250 << expected <<
">, found <"
258 "XMLObject::addChild: XMLObject is empty");
259 ptr_->addChild(child);
266 "XMLObject::addContent: XMLObject is empty");
267 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.