8 #define SCARAB_API_EXPORTS 12 using std::stringstream;
49 f_value_type( k_invalid ),
196 if( &rhs ==
this )
return *
this;
221 return string(
"invalid" );
224 return string(
"bool" );
227 return string(
"uint" );
230 return string(
"int" );
233 return string(
"double" );
236 return string(
"string" );
239 return string(
"unknown" );
252 std::string t_str_val;
253 bool t_is_numeric =
true;
256 t_is_numeric = t_is_numeric && ::isdigit( *t_val_it );
257 t_str_val.push_back( ::tolower( *t_val_it ) );
260 if( t_is_numeric )
return std::stoi( t_str_val );
262 std::istringstream t_iss_val( t_str_val );
264 t_iss_val >> std::boolalpha >> t_bool_val;
278 std::stringstream t_conv;
294 std::stringstream t_conv;
310 std::stringstream t_conv;
322 std::stringstream t_conv;
350 if( ! a_subset.
is_value() )
return false;
369 for(
unsigned ind = 0; ind <
f_contents.size(); ++ind )
383 for(
unsigned ind = 0; ind <
f_contents.size(); ++ind )
392 if( ! a_subset.
is_array() )
return false;
397 while( t_that_it != t_subset_array.
end() )
399 if( ! (*t_this_it)->has_subset( **t_that_it ) )
return false;
409 for(
unsigned ind = a_size; ind < curr_size; ++ind )
423 out <<
'\n' << indentation <<
"[\n";
424 param::s_indent_level++;
427 out << indentation <<
" " << **it <<
'\n';
429 param::s_indent_level--;
430 out << indentation <<
"]\n";
452 add( it->first, it->second->clone() );
466 this->
replace( it->first, *it->second );
473 if( ! a_subset.
is_node() )
return false;
476 for(
const_iterator t_subset_it = t_subset_node.
begin(); t_subset_it != t_subset_node.
end(); ++t_subset_it )
478 if( !
has( t_subset_it->first ) )
return false;
479 if( !
f_contents.at( t_subset_it->first )->has_subset( *t_subset_it->second ) )
return false;
489 if( !
has( it->first ) )
492 add( it->first, *it->second );
495 param& t_param = (*this)[ it->first ];
499 replace( it->first, *it->second );
502 if( t_param.
is_node() && it->second->is_node() )
508 if( t_param.
is_array() && it->second->is_array() )
515 this->
replace( it->first, *it->second );
525 out <<
'\n' << indentation <<
"{\n";
526 param::s_indent_level++;
529 out << indentation <<
" " << it->first <<
" : " << *(it->second) <<
'\n';
531 param::s_indent_level--;
532 out << indentation <<
"}\n";
virtual bool is_node() const
void replace(const std::string &a_name, const param &a_value)
creates a copy of a_value
void merge(const param_node &a_object)
virtual bool has_subset(const param &a_subset) const
virtual bool has_subset(const param &a_subset) const
virtual bool has_subset(const param &a_subset) const
virtual bool has_subset(const param &a_subset) const
param_array & operator=(const param_array &rhs)
virtual std::string to_string() const
virtual bool is_value() const
virtual std::string to_string() const
SCARAB_API std::ostream & operator<<(std::ostream &out, const param &a_value)
virtual param * clone() const
static unsigned s_indent_level
union scarab::param_value::Values f_value
enum scarab::param_value::ValueTypes f_value_type
bool has(const std::string &a_name) const
contents::const_iterator const_iterator
param_node & operator=(const param_node &rhs)
void append(const param_array &an_array)
virtual std::string to_string() const
const std::string & as_string() const
void assign(unsigned a_index, const param &a_value)
contents::const_iterator const_iterator
bool add(const std::string &a_name, const param &a_value)
creates a copy of a_value
virtual bool is_array() const
param_value & operator=(const param_value &rhs)
void resize(unsigned a_size)