$extrastylesheet
Public Member Functions | |
| variable () | |
| variable (const variable &) | |
| variable (const char *Name, const char *Value, const char *FieldSeparator) | |
| ~variable () | |
| variable & | operator= (const variable &Other) |
| void | take (const char *Value, const char *FieldSeparator) |
| const std::string * | get_element (unsigned Idx) const |
Public Attributes | |
| std::string | name |
| STRING_VECTOR | value |
| std::string | original |
Variable to be specified on the command line or in input files. (i.e. of the form var='12 312 341')
| GETPOT_NAMESPACE::GetPot::variable::variable | ( | ) | [inline] |
| GETPOT_NAMESPACE::GetPot::variable::variable | ( | const variable & | Other | ) | [inline] |
Definition at line 3748 of file getpot.h.
References GETPOT_NAMESPACE::GetPot::operator=().
{
#ifdef WIN32
operator=(Other);
#else
GetPot::variable::operator=(Other);
#endif
}
| GETPOT_NAMESPACE::GetPot::variable::variable | ( | const char * | Name, |
| const char * | Value, | ||
| const char * | FieldSeparator | ||
| ) | [inline] |
| GETPOT_NAMESPACE::GetPot::variable::~variable | ( | ) | [inline] |
| const std::string * GETPOT_NAMESPACE::GetPot::variable::get_element | ( | unsigned | Idx | ) | const [inline] |
get a specific element in the string vector (return 0 if not present)
Definition at line 3770 of file getpot.h.
Referenced by GETPOT_NAMESPACE::GetPot::get_value_no_default(), and GETPOT_NAMESPACE::GetPot::operator()().
| GetPot::variable & GETPOT_NAMESPACE::GetPot::variable::operator= | ( | const variable & | Other | ) | [inline] |
| void GETPOT_NAMESPACE::GetPot::variable::take | ( | const char * | Value, |
| const char * | FieldSeparator | ||
| ) | [inline] |
Definition at line 3781 of file getpot.h.
Referenced by variable().
{
original = std::string(Value); // string member var
value.clear(); // vector<string> member var
/*
// separate string by white space delimiters using 'strtok'
// thread safe usage of strtok (no static members)
char* spt = 0;
// make a copy of the 'Value'
char* copy = new char[strlen(Value)+1];
strcpy(copy, Value);
char* follow_token = strtok_r(copy, FieldSeparator, &spt);
while (follow_token != 0)
{
value.push_back(std::string(follow_token));
follow_token = strtok_r(NULL, FieldSeparator, &spt);
}
delete [] copy;
*/
// Don't use strtok, instead tokenize the input char "Value" using std::string operations so
// that the results end up in the local "value" member
// Construct std::string objects from the input char*s. I think the only
// FieldSeparator recognized by GetPot is whitespace?
std::string Value_str = std::string(Value);
std::string delimiters = std::string(FieldSeparator);
// Skip delimiters at beginning.
std::string::size_type lastPos = Value_str.find_first_not_of(delimiters, 0);
// Find first "non-delimiter".
std::string::size_type pos = Value_str.find_first_of(delimiters, lastPos);
// Loop over the input string until all the tokens have been pushed back
// into the local "value" member.
while (std::string::npos != pos || std::string::npos != lastPos)
{
// Found a token, add it to the vector.
value.push_back(Value_str.substr(lastPos, pos - lastPos));
// Skip delimiters. Note the "not_of"
lastPos = Value_str.find_first_not_of(delimiters, pos);
// Find next "non-delimiter"
pos = Value_str.find_first_of(delimiters, lastPos);
}
// We're done, all the tokens should now be in the vector<string>
}
| std::string GETPOT_NAMESPACE::GetPot::variable::name |
data memebers
Definition at line 437 of file getpot.h.
Referenced by GETPOT_NAMESPACE::GetPot::_DBE_expand(), and operator=().
| std::string GETPOT_NAMESPACE::GetPot::variable::original |
Definition at line 439 of file getpot.h.
Referenced by GETPOT_NAMESPACE::GetPot::_DBE_expand(), GETPOT_NAMESPACE::GetPot::_DBE_get_variable(), GETPOT_NAMESPACE::GetPot::get_value_no_default(), GETPOT_NAMESPACE::GetPot::operator()(), and operator=().
Definition at line 438 of file getpot.h.
Referenced by operator=(), and GETPOT_NAMESPACE::GetPot::vector_variable_size().