54 std::string cmp_name = a.first;
55 size_t prefix_pos = cmp_name.find(
":");
56 if ( prefix_pos != string::npos ) {
58 cmp_name = cmp_name.substr( prefix_pos+1 );
60 return name == cmp_name;
72 return name == config->getName();
78 static void trim(
string& str,
char const* delims =
"\t\r\n ") {
80 string::size_type index = str.find_last_not_of(delims);
81 if( index != string::npos )
84 index = str.find_first_not_of( delims );
85 if( index != string::npos )
93 int returnValue = defaultValue;
94 sscanf( str.c_str(),
"%d", &returnValue);
100 double returnValue = defaultValue;
101 sscanf( str.c_str(),
"%lf", &returnValue );
107 stringstream ss( str, ios::in );
140 size_t prefix_pos =
name.find(
":");
142 if ( prefix_pos != string::npos ) {
145 return name.substr( prefix_pos+1 );
167 Configuration::subsection_list::const_iterator c = find_if(
subsections.begin(),
subsections.end(), tester );
214 Configuration::attribute_list::const_iterator nv = find_if(
attributes.begin(),
attributes.end(), tester );
228 Configuration::attribute_list::const_iterator nv = find_if(
attributes.begin(),
attributes.end(), tester );
244 stringstream ss( val, ios::in );
248 istream_iterator<T> end;
249 for ( istream_iterator<T> is_it(ss); is_it != end; is_it ++ ) {
251 v.push_back( *is_it );
262 int returnValue = defaultvalue;
264 sscanf( val.c_str(),
"%d", &returnValue );
273 double returnValue = defaultvalue;
275 sscanf( val.c_str(),
"%lf", &returnValue );
285 stringstream ss( val, ios::in );
289 istream_iterator<double> end;
290 for ( istream_iterator<double> is_it(ss);
294 v.push_back( *is_it );
312 int end = vec.size();
314 *arry =
new double[ end ];
316 for (
int i=0; i<end; i++ ) {
327 stringstream ss( val, ios::in );
331 istream_iterator<int> end;
332 for ( istream_iterator<int> is_it(ss); is_it != end; is_it ++ ) {
334 v.push_back( *is_it );
352 int end = vec.size();
354 *arry =
new int[ end ];
356 for (
int i=0; i<end; i++ ) {
368 stringstream is(v, ios::in );
380 vector<int> vec = getAttributeAsVec<int>(
name );
389 int end = vec.size();
391 *arry =
new unsigned char[ end ];
393 for (
int i=0; i<end; i++ ) {
395 (*arry)[i] = (
unsigned char) (vec[i] & 0x00FF) ;
403 string theval =
value;
406 attributes.push_back( make_pair( name, theval ) );
412 string sval( (value)? value:
"");
420 stringstream ss(ios::out);
430 stringstream ss(ios::out);
431 ss.precision(precision);
441 stringstream ss(ios::out);
442 ss.precision(precision);
444 for (
int i=0; i<count; i++ ) {
445 ss << *values++ <<
" ";
454 stringstream ss(ios::out);
456 for (
int i=0; i<count; i++ ) {
457 ss << *values++ <<
" ";
466 stringstream ss(ios::out);
476 stringstream ss(ios::out);
478 for (
int i=0; i<count; i++ ) {
480 ss << (int)*values++ <<
" ";
static double getDouble(const std::string &str, double defaultValue)
double getAttributeAsDouble(const std::string &name, double defaultValue) const
void getAttributeAsIntArray(const std::string &name, int **, int *) const
ReferenceCountedPointer< const ConfigurationImpl > ConstConfigurationPtr
void getAttributeAsDoubleArray(const std::string &name, double **, int *) const
void getAttributeAsByteArray(const std::string &name, unsigned char **, int *) const
bool operator()(const Configuration::attribute &a)
std::string getValue() const
int getAttributeAsInt(const std::string &name, int defaultValue) const
std::vector< T > getAttributeAsVec(const std::string &name) const
static Sample getSample(const std::string &str)
AttributeNameTest(const string &name)
Configuration::subsection_list subsections
std::string getName() const
std::vector< int > getAttributeAsVecInt(const std::string &name) const
std::string getAttribute(const std::string &name) const
ConfigurationNameTest(const string &name)
std::vector< double > getAttributeAsVecDouble(const std::string &name) const
void setValue(const std::string &)
void addNameValue(const std::string &name, const std::string &value)
static int getInt(const std::string &str, int defaultValue)
std::pair< std::string, std::string > attribute
Sample getAttributeAsSample(const std::string &name) const
Configuration::attribute_list attributes
bool operator()(const ConfigurationPtr &config)
static void trim(string &str, char const *delims="\t\r\n ")
ConstConfigurationPtr getSubsection(const std::string &name, bool throws=true) const
void addSubsection(const ConfigurationPtr &config)