Skip to content

Commit

Permalink
Const correctness corrections. Refs #7866.
Browse files Browse the repository at this point in the history
  • Loading branch information
jawrainey committed Oct 10, 2013
1 parent ad8f0c4 commit 3fa4725
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/ICat/src/CatalogDownloadDataFiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ namespace Mantid
std::ifstream isisfile(fileLocation.c_str());
if(isisfile)
{
g_log.information() << "File(" << *fileName << ") located in archives. Preparing to download..." << std::endl;
g_log.information() << "File (" << *fileName << ") located in archives." << std::endl;

fileLocations.push_back(fileLocation);
}
else
{
g_log.information() << "Unable to open file(" << *fileName << ") from archive. Beginning to download over Internet." << std::endl;
g_log.information() << "Unable to open file (" << *fileName << ") from archive. Beginning to download over Internet." << std::endl;

progress(prog/2,"getting the url ....");

Expand Down
18 changes: 9 additions & 9 deletions Code/Mantid/Framework/Kernel/inc/MantidKernel/CatalogInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace Mantid
namespace Kernel
{

/** A class that holds information about a catalogs.
/** A class that holds information about catalogs.
Copyright &copy; 2007-2013 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
Expand Down Expand Up @@ -54,23 +54,23 @@ namespace Mantid
/// Obtain catalog name from the facility file.
const std::string catalogName() const;
/// Obtain soap end point from the facility file.
std::string soapEndPoint();
const std::string soapEndPoint() const;
/// Obtain the regex prefix from the facility file.
std::string catalogPrefix();
const std::string catalogPrefix() const;
/// Obtain Windows prefix from the facility file.
std::string windowsPrefix();
const std::string windowsPrefix() const;
/// Obtain Macintosh prefix from facility file.
std::string macPrefix();
const std::string macPrefix() const;
/// Obtain Linux prefix from facility file.
std::string linuxPrefix();
const std::string linuxPrefix() const;
/// Transform's the archive path based on operating system used.
std::string transformArchivePath(std::string path);
std::string transformArchivePath(std::string &path);

private:
/// Replace the content of a string using regex.
std::string replacePrefix(std::string path, std::string regex, std::string prefix);
std::string replacePrefix(std::string &path, const std::string &regex, const std::string &prefix);
/// Replace all occurrences of the search string in the input with the format string.
std::string replaceAllOccurences(std::string path, std::string search, std::string format);
std::string replaceAllOccurences(std::string &path, const std::string &search, const std::string &format);
/// Obtain the attribute from a given element tag and attribute name.
std::string getAttribute(const Poco::XML::Element* element, const std::string &tagName, const std::string &attributeName);

Expand Down
16 changes: 8 additions & 8 deletions Code/Mantid/Framework/Kernel/src/CatalogInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,39 +38,39 @@ namespace Mantid
/**
* Obtain soap end point from the facility file.
*/
std::string CatalogInfo::soapEndPoint()
const std::string CatalogInfo::soapEndPoint() const
{
return (m_soapEndPoint);
}

/**
* Obtain the regex prefix for default archive path.
*/
std::string CatalogInfo::catalogPrefix()
const std::string CatalogInfo::catalogPrefix() const
{
return (m_catalogPrefix);
}

/**
* Obtain Windows prefix from the facility file.
*/
std::string CatalogInfo::windowsPrefix()
const std::string CatalogInfo::windowsPrefix() const
{
return (m_windowsPrefix);
}

/**
* Obtain Macintosh prefix from facility file.
*/
std::string CatalogInfo::macPrefix()
const std::string CatalogInfo::macPrefix() const
{
return (m_macPrefix);
}

/**
* Obtain Linux prefix from facility file.
*/
std::string CatalogInfo::linuxPrefix()
const std::string CatalogInfo::linuxPrefix() const
{
return (m_linuxPrefix);
}
Expand All @@ -80,7 +80,7 @@ namespace Mantid
* @param path :: The archive path from ICAT to perform the transform on.
* @return The path to the archive for the user's OS.
*/
std::string CatalogInfo::transformArchivePath(std::string path)
std::string CatalogInfo::transformArchivePath(std::string &path)
{
#ifdef __linux__
path = replacePrefix(path,catalogPrefix(),linuxPrefix());
Expand Down Expand Up @@ -118,7 +118,7 @@ namespace Mantid
* @param prefix :: Replace result of regex with this prefix.
* @return A string containing the replacement.
*/
std::string CatalogInfo::replacePrefix(std::string path, std::string regex, std::string prefix)
std::string CatalogInfo::replacePrefix(std::string &path, const std::string &regex, const std::string &prefix)
{
boost::regex re(regex);
// Assign the result of the replacement back to path and return it.
Expand All @@ -133,7 +133,7 @@ namespace Mantid
* @param format :: A substitute string.
* @return A string containing the replacement.
*/
std::string CatalogInfo::replaceAllOccurences(std::string path, std::string search, std::string format)
std::string CatalogInfo::replaceAllOccurences(std::string &path, const std::string &search, const std::string &format)
{
boost::replace_all(path, search, format);
return (path);
Expand Down

0 comments on commit 3fa4725

Please sign in to comment.