Skip to content
Snippets Groups Projects
Column.cpp 1.32 KiB
Newer Older
#include "MantidKernel/Logger.h"
namespace
{
  /// static logger object
  Kernel::Logger g_log("Column");
}

template<>
bool Column::isType<bool>()const
{
    return isBool();
/// Set plot type where
/// None = 0 (means it has specifically been set to 'no plot type')
/// NotSet = -1000 (this is the default and means plot style has not been set)
/// X = 1, Y = 2, Z = 3, xErr = 4, yErr = 5, Label = 6
/// @param t plot type as defined above
void Column::setPlotType(int t)
{
  if ( t == -1000 || t == 0 || t == 1 || t == 2 || t == 3 || t == 4 ||
       t == 5 || t == 6 )
    m_plotType = t;
  else
  {
    g_log.error() << "Cannot set plot of column to " << t
      << " . Ignore this attempt." << std::endl;
  }
}


std::ostream& operator<<(std::ostream& s,const API::Boolean& b)
{
    s << (b.value?"true":"false");
    return s;
}

/**
 * Translate text into a Boolean.
 */
std::istream& operator>>(std::istream& istr, API::Boolean& b)
{
  std::string buff;
  istr >> buff;
  std::transform(buff.begin(),buff.end(),buff.begin(),toupper);
  if (buff == "TRUE" || buff == "1" || buff == "OK" || buff == "YES" || buff == "ON")
  {
    b = true;
  }
  else
  {
    b = false;
  }
  return istr;
}