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");
103bool XMLObject::getRequired<bool>(
const std::string& name)
const
110int XMLObject::getRequired<int>(
const std::string& name)
const
117double XMLObject::getRequired<double>(
const std::string& name)
const
124std::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")
155void 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);
A std::string utilities class for Teuchos.
An object representation of a subset of XML data.
Thrown when attempting to parse an empty XML std::string.
static std::string allCaps(const std::string &str)
Converts a std::string to all upper case.
The XMLObjectImplem class takes care of the low-level implementation details of XMLObject.
Representation of an XML data tree. XMLObject is a ref-counted handle to a XMLObjectImplem object,...
double getRequiredDouble(const std::string &name) const
Get a required attribute, returning it as a double.
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 addChild(const XMLObject &child)
Add a child node to the node.
const std::string & getRequired(const std::string &name) const
Get an attribute, throwing an std::exception if it is not found.
const std::string & getTag() const
Return the tag of the current node.
const std::string & getAttribute(const std::string &name) const
Return the value of the attribute with the specified name.
std::string toString() const
Represent this node and its children as a std::string.
void checkTag(const std::string &expected) const
Check that a tag is equal to an expected std::string.
int numContentLines() const
Return the number of lines of character content stored in this node.
int getRequiredInt(const std::string &name) const
Get a required attribute, returning it as an int.
void addContent(const std::string &contentLine)
Add a line of character content.
std::string footer() const
Write the footer for this object to a std::string.
XMLObject deepCopy() const
Make a deep copy of this object.
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.
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 std::string & getContentLine(int i) const
Return the i-th line of character content stored in this node.
XMLObject()
Empty constructor.
std::string terminatedHeader() const
Write the header for this object to a std::string.
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.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
bool is_null(const std::shared_ptr< T > &p)
Returns true if p.get()==NULL.
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.