Always pass "const std::string&" instead of "const std::string"
This commit is contained in:
parent
94f85db5c5
commit
f4d35e4bd7
7 changed files with 38 additions and 38 deletions
|
|
@ -58,7 +58,7 @@ public:
|
|||
s << "<!--" << comment << "-->" << std::endl;
|
||||
}
|
||||
|
||||
inline void XML_open(std::ostream& s, const std::string& tag, const std::string p = "") {
|
||||
inline void XML_open(std::ostream& s, const std::string& tag, const std::string& p = "") {
|
||||
for (int n = 0; n < _level; n++) {
|
||||
s << _indent;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,8 +73,8 @@ extern std::string INT_Format;
|
|||
* typeString should be codified as to its usage.
|
||||
*/
|
||||
void addInteger(Cantera::XML_Node& node, const std::string& titleString,
|
||||
const int value, const std::string unitsString="",
|
||||
const std::string typeString="");
|
||||
const int value, const std::string& unitsString="",
|
||||
const std::string& typeString="");
|
||||
|
||||
//! This function adds a child node with the name, "float", with a value
|
||||
//! consisting of a single floating point number
|
||||
|
|
@ -125,8 +125,8 @@ void addInteger(Cantera::XML_Node& node, const std::string& titleString,
|
|||
* typeString should be codified as to its usage.
|
||||
*/
|
||||
void addFloat(Cantera::XML_Node& node, const std::string& titleString,
|
||||
const doublereal value, const std::string unitsString="",
|
||||
const std::string typeString="", const doublereal minval = Cantera::Undef,
|
||||
const doublereal value, const std::string& unitsString="",
|
||||
const std::string& typeString="", const doublereal minval = Cantera::Undef,
|
||||
const doublereal maxval = Cantera::Undef);
|
||||
|
||||
//! This function adds a child node with the name, "floatArray", with a value
|
||||
|
|
@ -183,7 +183,7 @@ void addFloat(Cantera::XML_Node& node, const std::string& titleString,
|
|||
*/
|
||||
void addFloatArray(Cantera::XML_Node& node, const std::string& titleString,
|
||||
const size_t n, const doublereal* const values,
|
||||
const std::string unitsString="", const std::string typeString="",
|
||||
const std::string& unitsString="", const std::string& typeString="",
|
||||
const doublereal minval = Cantera::Undef,
|
||||
const doublereal maxval = Cantera::Undef);
|
||||
|
||||
|
|
@ -216,7 +216,7 @@ void addFloatArray(Cantera::XML_Node& node, const std::string& titleString,
|
|||
* @param typeString String type. This is an optional parameter.
|
||||
*/
|
||||
void addString(Cantera::XML_Node& node, const std::string& titleString,
|
||||
const std::string& valueString, const std::string typeString="");
|
||||
const std::string& valueString, const std::string& typeString="");
|
||||
|
||||
|
||||
//! This function reads the current node or a child node of the current node
|
||||
|
|
@ -276,8 +276,8 @@ void addString(Cantera::XML_Node& node, const std::string& titleString,
|
|||
* @return Returns the number of floats read into v.
|
||||
*/
|
||||
size_t getFloatArray(const Cantera::XML_Node& node, std::vector<doublereal> & v,
|
||||
const bool convert=true, const std::string unitsString="",
|
||||
const std::string nodeName = "floatArray");
|
||||
const bool convert=true, const std::string& unitsString="",
|
||||
const std::string& nodeName = "floatArray");
|
||||
|
||||
//! This function interprets the value portion of an XML element
|
||||
//! as a string. It then separates the string up into tokens
|
||||
|
|
@ -472,7 +472,7 @@ void getIntegers(const Cantera::XML_Node& node, std::map<std::string,int>& v);
|
|||
* which implies that no conversion is allowed.
|
||||
*/
|
||||
doublereal getFloat(const Cantera::XML_Node& parent, const std::string& name,
|
||||
const std::string type="");
|
||||
const std::string& type="");
|
||||
|
||||
//! Get a floating-point value from the current XML element
|
||||
/*!
|
||||
|
|
@ -506,7 +506,7 @@ doublereal getFloat(const Cantera::XML_Node& parent, const std::string& name,
|
|||
* and "" , for no conversion. The default value is "",
|
||||
* which implies that no conversion is allowed.
|
||||
*/
|
||||
doublereal getFloatCurrent(const Cantera::XML_Node& currXML, const std::string type="");
|
||||
doublereal getFloatCurrent(const Cantera::XML_Node& currXML, const std::string& type="");
|
||||
|
||||
//! Get an optional floating-point value from a child element.
|
||||
/*!
|
||||
|
|
@ -545,7 +545,7 @@ doublereal getFloatCurrent(const Cantera::XML_Node& currXML, const std::string t
|
|||
* @return returns true if the child element named "name" exists
|
||||
*/
|
||||
bool getOptionalFloat(const Cantera::XML_Node& parent, const std::string& name,
|
||||
doublereal& fltRtn, const std::string type="");
|
||||
doublereal& fltRtn, const std::string& type="");
|
||||
|
||||
|
||||
//! Get a vector of floating-point values from a child element.
|
||||
|
|
@ -689,7 +689,7 @@ doublereal getFloatDefaultUnits(const Cantera::XML_Node& parent,
|
|||
*
|
||||
* @return True if the nodeName XML node exists. False otherwise.
|
||||
*/
|
||||
bool getOptionalModel(const Cantera::XML_Node& parent, const std::string nodeName,
|
||||
bool getOptionalModel(const Cantera::XML_Node& parent, const std::string& nodeName,
|
||||
std::string& modelName);
|
||||
|
||||
//! Search the child nodes of the current node for an XML Node with a Title
|
||||
|
|
@ -789,13 +789,13 @@ std::string getChildValue(const Cantera::XML_Node& parent,
|
|||
* @param file Name of the file
|
||||
* @param debug Turn on debugging printing
|
||||
*/
|
||||
void get_CTML_Tree(Cantera::XML_Node* node, const std::string file,
|
||||
void get_CTML_Tree(Cantera::XML_Node* node, const std::string& file,
|
||||
const int debug = 0);
|
||||
|
||||
//! Read an ctml file from a file and fill up an XML tree.
|
||||
//! @param file Name of the file
|
||||
//! @return Root of the tree
|
||||
Cantera::XML_Node getCtmlTree(const std::string file);
|
||||
Cantera::XML_Node getCtmlTree(const std::string& file);
|
||||
|
||||
//! Convert a cti file into a ctml file
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ public:
|
|||
* @param parent Pointer to the parent for this node in the tree.
|
||||
* A value of 0 indicates this is the top of the tree.
|
||||
*/
|
||||
XML_Node(const std::string nm, XML_Node* const parent);
|
||||
XML_Node(const std::string& nm, XML_Node* const parent);
|
||||
|
||||
//! Copy constructor
|
||||
/*!
|
||||
|
|
@ -247,7 +247,7 @@ public:
|
|||
* @return Returns a reference to the created child XML_Node object
|
||||
*/
|
||||
XML_Node& addChild(const std::string& name, const doublereal value,
|
||||
const std::string fmt="%g");
|
||||
const std::string& fmt="%g");
|
||||
|
||||
//! Remove a child from this node's list of children
|
||||
/*!
|
||||
|
|
@ -275,7 +275,7 @@ public:
|
|||
* @param fmt Format of the printf string conversion of the double.
|
||||
* Default is "%g". Must be less than 63 chars
|
||||
*/
|
||||
void addValue(const doublereal val, const std::string fmt="%g");
|
||||
void addValue(const doublereal val, const std::string& fmt="%g");
|
||||
|
||||
//! Return the value of an XML node as a string
|
||||
/*!
|
||||
|
|
@ -339,7 +339,7 @@ public:
|
|||
* Default is "%g".
|
||||
*/
|
||||
void addAttribute(const std::string& attrib, const doublereal value,
|
||||
const std::string fmt="%g");
|
||||
const std::string& fmt="%g");
|
||||
|
||||
//! The operator[] is overloaded to provide a lookup capability
|
||||
//! on attributes for the current XML element.
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ void ck2cti(const std::string& in_file, const std::string& thermo_file,
|
|||
* @param file Name of the file
|
||||
* @param debug Turn on debugging printing
|
||||
*/
|
||||
void get_CTML_Tree(Cantera::XML_Node* rootPtr, const std::string file, const int debug)
|
||||
void get_CTML_Tree(Cantera::XML_Node* rootPtr, const std::string& file, const int debug)
|
||||
{
|
||||
std::string ff, ext = "";
|
||||
|
||||
|
|
@ -280,7 +280,7 @@ void get_CTML_Tree(Cantera::XML_Node* rootPtr, const std::string file, const int
|
|||
fin.close();
|
||||
}
|
||||
|
||||
Cantera::XML_Node getCtmlTree(const std::string file)
|
||||
Cantera::XML_Node getCtmlTree(const std::string& file)
|
||||
{
|
||||
Cantera::XML_Node root;
|
||||
get_CTML_Tree(&root, file);
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ static doublereal fpValue(std::string val)
|
|||
* is to have an empty string.
|
||||
*/
|
||||
void addInteger(Cantera::XML_Node& node, const std::string& title, const int val,
|
||||
const std::string units, const std::string type)
|
||||
const std::string& units, const std::string& type)
|
||||
{
|
||||
#ifdef CTML_VERSION_1_4
|
||||
XML_Node& f = node.addChild("integer", val);
|
||||
|
|
@ -138,8 +138,8 @@ void addInteger(Cantera::XML_Node& node, const std::string& title, const int val
|
|||
* as to its usage.
|
||||
*/
|
||||
void addFloat(Cantera::XML_Node& node, const std::string& title,
|
||||
const doublereal val, const std::string units,
|
||||
const std::string type, const doublereal minval,
|
||||
const doublereal val, const std::string& units,
|
||||
const std::string& type, const doublereal minval,
|
||||
const doublereal maxval)
|
||||
{
|
||||
#ifdef CTML_VERSION_1_4
|
||||
|
|
@ -214,8 +214,8 @@ void addFloat(Cantera::XML_Node& node, const std::string& title,
|
|||
* @todo typeString should be codified as to its usage.
|
||||
*/
|
||||
void addFloatArray(Cantera::XML_Node& node, const std::string& title, const size_t n,
|
||||
const doublereal* const vals, const std::string units,
|
||||
const std::string type,
|
||||
const doublereal* const vals, const std::string& units,
|
||||
const std::string& type,
|
||||
const doublereal minval, const doublereal maxval)
|
||||
{
|
||||
size_t i;
|
||||
|
|
@ -278,7 +278,7 @@ void addFloatArray(Cantera::XML_Node& node, const std::string& title, const size
|
|||
*/
|
||||
void addString(Cantera::XML_Node& node, const std::string& titleString,
|
||||
const std::string& valueString,
|
||||
const std::string typeString)
|
||||
const std::string& typeString)
|
||||
{
|
||||
XML_Node& f = node.addChild("string", valueString);
|
||||
f.addAttribute("title", titleString);
|
||||
|
|
@ -511,7 +511,7 @@ void getFloats(const Cantera::XML_Node& node, std::map<std::string, double>& v,
|
|||
*/
|
||||
doublereal getFloat(const Cantera::XML_Node& parent,
|
||||
const std::string& name,
|
||||
const std::string type)
|
||||
const std::string& type)
|
||||
{
|
||||
if (!parent.hasChild(name))
|
||||
throw CanteraError("getFloat (called from XML Node \"" +
|
||||
|
|
@ -555,7 +555,7 @@ doublereal getFloat(const Cantera::XML_Node& parent,
|
|||
* which implies that no conversion is allowed.
|
||||
*/
|
||||
doublereal getFloatCurrent(const Cantera::XML_Node& node,
|
||||
const std::string type)
|
||||
const std::string& type)
|
||||
{
|
||||
doublereal x, x0, x1, fctr = 1.0;
|
||||
string units, vmin, vmax;
|
||||
|
|
@ -614,7 +614,7 @@ doublereal getFloatCurrent(const Cantera::XML_Node& node,
|
|||
bool getOptionalFloat(const Cantera::XML_Node& parent,
|
||||
const std::string& name,
|
||||
doublereal& fltRtn,
|
||||
const std::string type)
|
||||
const std::string& type)
|
||||
{
|
||||
if (parent.hasChild(name)) {
|
||||
fltRtn= getFloat(parent, name, type);
|
||||
|
|
@ -719,7 +719,7 @@ doublereal getFloatDefaultUnits(const Cantera::XML_Node& parent,
|
|||
*
|
||||
* @return True if the nodeName XML node exists. False otherwise.
|
||||
*/
|
||||
bool getOptionalModel(const Cantera::XML_Node& parent, const std::string nodeName,
|
||||
bool getOptionalModel(const Cantera::XML_Node& parent, const std::string& nodeName,
|
||||
std::string& modelName)
|
||||
{
|
||||
if (parent.hasChild(nodeName)) {
|
||||
|
|
@ -849,8 +849,8 @@ int getInteger(const Cantera::XML_Node& parent, const std::string& name)
|
|||
* @note change the v to a std::vector to eliminate a doxygen error. No idea why doxygen needs this.
|
||||
*/
|
||||
size_t getFloatArray(const Cantera::XML_Node& node, std::vector<doublereal> & v,
|
||||
const bool convert, const std::string unitsString,
|
||||
const std::string nodeName)
|
||||
const bool convert, const std::string& unitsString,
|
||||
const std::string& nodeName)
|
||||
{
|
||||
std::string::size_type icom;
|
||||
string numstr;
|
||||
|
|
|
|||
|
|
@ -368,7 +368,7 @@ XML_Node::XML_Node(const char* cnm) :
|
|||
* @param parent Pointer to the parent for this node in the tree.
|
||||
* A value of zero 0 indicates this is the top of the tree.
|
||||
*/
|
||||
XML_Node::XML_Node(const std::string nm, XML_Node* const parent) :
|
||||
XML_Node::XML_Node(const std::string& nm, XML_Node* const parent) :
|
||||
m_name(nm),
|
||||
m_value(""),
|
||||
m_parent(parent),
|
||||
|
|
@ -577,7 +577,7 @@ XML_Node& XML_Node::addChild(const std::string& name, const std::string& value)
|
|||
* @return Returns a reference to the created child XML_Node object
|
||||
*/
|
||||
XML_Node& XML_Node::addChild(const std::string& name, const doublereal value,
|
||||
const std::string fmt)
|
||||
const std::string& fmt)
|
||||
{
|
||||
XML_Node& c = addChild(name);
|
||||
c.addValue(value, fmt);
|
||||
|
|
@ -631,7 +631,7 @@ void XML_Node::addValue(const std::string& val)
|
|||
* @param fmt Format of the printf string conversion of the double.
|
||||
* Default is "%g" Must be less than 63 chars
|
||||
*/
|
||||
void XML_Node::addValue(const doublereal val, const std::string fmt)
|
||||
void XML_Node::addValue(const doublereal val, const std::string& fmt)
|
||||
{
|
||||
m_value = stripws(fp2str(val, fmt));
|
||||
}
|
||||
|
|
@ -719,7 +719,7 @@ void XML_Node::addAttribute(const std::string& attrib, const std::string& value)
|
|||
* Default is "%g".
|
||||
*/
|
||||
void XML_Node::addAttribute(const std::string& attrib,
|
||||
const doublereal value, const std::string fmt)
|
||||
const doublereal value, const std::string& fmt)
|
||||
{
|
||||
m_attribs[attrib] = fp2str(value, fmt);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
namespace Cantera
|
||||
{
|
||||
//====================================================================================================================
|
||||
static void err(const std::string r)
|
||||
static void err(const std::string& r)
|
||||
{
|
||||
throw Cantera::CanteraError("TortuosityBase", "Error calling base class " + r);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue