38#include "../include/STK_IPage.h"
49static void removeComments(
String & str,
Char c )
51 String::size_type pos = str.find(c);
59static void createKeyWord(
String & str,
int const& level )
62 str.erase( std::remove( str.begin(), str.end(), CHAR_OPENBRACKET ), str.end() );
64 str.erase( std::remove( str.begin(), str.end(), CHAR_CLOSEBRACKET ), str.end() );
66 str.insert(0, level, CHAR_OPENBRACKET).append(level, CHAR_CLOSEBRACKET);
73 : isOptional_(isOptional)
105 createKeyWord(
page.keyword_,
page.level_);
126 istream::pos_type pos =
is.tellg();
130 while (std::getline(
is,
line))
133 removeComments(
line, CHAR_COMMENT);
137 if (
line.empty())
continue;
139 if (
line.at(0) == CHAR_OPENBRACKET)
break;
141 if (
line.find_first_of(CHAR_EQUAL) !=
line.npos)
149 +
". Incorrect line.\n";
233 while (std::getline(
is,
line))
236 removeComments(
line, CHAR_COMMENT);
253 String::size_type pos =
line.find_first_of(CHAR_EQUAL);
#define STKRUNTIME_ERROR_NO_ARG(Where, Error)
#define _T(x)
Let x unmodified.
This file include all the other header files of the project Sdk.
A IPage is an interface base class for reading and/or writing a page of option in a file.
void write(ostream &os) const
write out options in a stream
String const & name() const
name of the IPage.
virtual bool validate()
validate the page.
String keyword_
keyword of the page of options.
void addPage(IPage const &page)
add a sub-page as an option to the page
String msg_error_
Contain the last error message.
bool findKeyword(istream &is) const
process the input stream until the keyword is encountered.
ContOption options_
array of the options
Option & option(String const &name)
bookkeeping function.
void addOption(Option const &opt)
add an option to the page
virtual ~IPage()
Destructor.
int level_
level of the Page.
bool processLine(String const &line)
process the input line and set the value of the option.
String name_
name of the page of options
IPage(String const &name, int const &level, bool isOptional)
Constructor.
void read(istream &is)
read in options from an input steam stream
bool isOptional_
true if the Page is optinal, false otherwise
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
the Option class allow to store the value of an option from a IPage.
String const & toUpperString(String &s)
convert the characters of the String to upper case
void removeCharBeforeAndAfter(String &str, Char c)
remove all occurrences of the char c at the beginning and the end of the string str.
char Char
STK fundamental type of a Char.
std::basic_string< Char > String
STK fundamental type of a String.
std::basic_ostream< Char > ostream
ostream for Char
std::basic_istream< Char > istream
istream for Char
The namespace STK is the main domain space of the Statistical ToolKit project.