Skip to content

Commit

Permalink
Correct use of std::to_string re #7617
Browse files Browse the repository at this point in the history
and some other string usage improvements

Signed-off-by: Karl Palmen <karl.palmen@stfc.ac.uk>
  • Loading branch information
KarlPalmen committed Sep 18, 2013
1 parent 5980698 commit af76a9a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ namespace DataHandling
void loadFile(std::string filename, std::vector<std::string>& lines);

/// Add an ALFBE parameter
void addALFBEparameter(const API::ITableWorkspace_sptr & tablews, Poco::XML::Document* mDoc, Poco::XML::Element* parent, const std::string paramName);
void addALFBEparameter(const API::ITableWorkspace_sptr & tablews, Poco::XML::Document* mDoc, Poco::XML::Element* parent, const std::string& paramName);

/// Get value for XML eq attribute for parameter
std::string ConvertFullprofToXML::getXMLEqValue( const API::ITableWorkspace_sptr & tablews, const std::string name, size_t columnIndex);
std::string ConvertFullprofToXML::getXMLEqValue( const API::ITableWorkspace_sptr & tablews, const std::string& name, size_t columnIndex);

// Translate a parameter name from as it appears in the table workspace to its name in the XML file
std::string getXMLParameterName( const std::string name );
std::string getXMLParameterName( const std::string& name );

/// Get row numbers of the parameters in the table workspace
void getTableRowNumbers(const API::ITableWorkspace_sptr & tablews, std::map<std::string, size_t>& parammap);
Expand Down
10 changes: 6 additions & 4 deletions Code/Mantid/Framework/DataHandling/src/ConvertFullprofToXML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Convert the initial fitting parameters in a Fullprof file to XML format in an [[
#include <Poco/DOM/NodeIterator.h>
#include <Poco/DOM/NodeFilter.h>

#include <boost/lexical_cast.hpp>


namespace Mantid
{
Expand Down Expand Up @@ -161,7 +163,7 @@ namespace DataHandling
*
* paramName is the name of the parameter as it appears in the table workspace
*/
void ConvertFullprofToXML::addALFBEparameter(const API::ITableWorkspace_sptr & tablews, Poco::XML::Document* mDoc, Element* parent, const std::string paramName)
void ConvertFullprofToXML::addALFBEparameter(const API::ITableWorkspace_sptr & tablews, Poco::XML::Document* mDoc, Element* parent, const std::string& paramName)
{
Element* parameterElem = mDoc->createElement("parameter");
parameterElem->setAttribute("name", getXMLParameterName(paramName));
Expand All @@ -182,7 +184,7 @@ namespace DataHandling
/*
* Get the XML name of a parameter given its Table Workspace name
*/
std::string ConvertFullprofToXML::getXMLParameterName( const std::string name )
std::string ConvertFullprofToXML::getXMLParameterName( const std::string& name )
{
std::string prefix = "IkedaCarpenterPV:";
if(name == "Alph0") return prefix+"Alpha0";
Expand All @@ -196,12 +198,12 @@ namespace DataHandling
* Get the value string to put in the XML eq attribute of the formula element of the paramenter element
* given the name of the parameter in the table workspace.
*/
std::string ConvertFullprofToXML::getXMLEqValue( const API::ITableWorkspace_sptr & tablews, const std::string name, size_t columnIndex)
std::string ConvertFullprofToXML::getXMLEqValue( const API::ITableWorkspace_sptr & tablews, const std::string& name, size_t columnIndex)
{
size_t paramNumber = m_rowNumbers[name];
API::Column_const_sptr column = tablews->getColumn( columnIndex );
double eqValue = column->cell<double>(paramNumber);
return std::to_string(eqValue);
return boost::lexical_cast<std::string>(eqValue);
}

/* This function fills in a list of the row numbers starting 0 of the parameters
Expand Down

0 comments on commit af76a9a

Please sign in to comment.