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");
71bool XMLObject::getRequired<bool>(
const std::string& name)
const
78int XMLObject::getRequired<int>(
const std::string& name)
const
85double XMLObject::getRequired<double>(
const std::string& name)
const
92std::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")
123void 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 <"
226 "XMLObject::addChild: XMLObject is empty");
227 ptr_->addChild(
child);
234 "XMLObject::addContent: XMLObject is empty");
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.
Smart reference counting pointer class for automatic garbage collection.
static std::string allCaps(const std::string &str)
Converts a std::string to all upper case.
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.
The XMLObjectImplem class takes care of the low-level implementation details of XMLObject.
#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.