commit ffad30d12f6bbf82b52a8a884c4158dc3eee38b9
parent e7671496d39881cf6fab5f4e20b14c584d461b0a
Author: fundamental <[email protected]>
Date: Fri, 18 Sep 2009 11:32:47 -0400
XMLwrapper: Added std::string retreval
Diffstat:
3 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -908,3 +908,4 @@
18 Sep 2009 (Mark McCurry)
- Started to use versioning information in XMLwrapper
- Remove last of stack helper functions in XMLwrapper
+ - Added std::string retreval to XMLwrapper
diff --git a/src/Misc/XMLwrapper.cpp b/src/Misc/XMLwrapper.cpp
@@ -443,6 +443,16 @@ void XMLwrapper::getparstr(const string &name,char *par,int maxstrlen) const
};
+string XMLwrapper::getparstr(const string &name,const std::string &defaultpar) const
+{
+ const mxml_node_t * tmp = mxmlFindElement(node, node, "string", "name", name.c_str(), MXML_DESCEND_FIRST);
+
+ if (tmp==NULL||tmp->child==NULL||tmp->child->type!=MXML_OPAQUE)
+ return defaultpar;
+
+ return tmp->child->value.element.name;
+}
+
REALTYPE XMLwrapper::getparreal(const char *name,REALTYPE defaultpar) const
{
const mxml_node_t * tmp = mxmlFindElement(node,node,"par_real","name",name,MXML_DESCEND_FIRST);
diff --git a/src/Misc/XMLwrapper.h b/src/Misc/XMLwrapper.h
@@ -182,6 +182,13 @@ public:
void getparstr(const std::string &name,char *par,int maxstrlen) const;
/**
+ * Get the string value stored in the node.
+ * @param name The parameter name.
+ * @param defaultpar The default value if the real value is not found.
+ */
+ std::string getparstr(const std::string &name,const std::string &defaultpar) const;
+
+ /**
* Returns the real value stored in the node.
* @param name The parameter name.
* @param defaultpar The default value if the real value is not found.