raw
experimental-genesis    1 //  /****************************\
experimental-genesis 2 // * EXPERIMENTAL BRANCH. *
experimental-genesis 3 // * FOR LABORATORY USE ONLY. *
experimental-genesis 4 // ********************************
experimental-genesis 5 // ************
experimental-genesis 6 // **************
experimental-genesis 7 // ****************
experimental-genesis 8 // **** **** ****
experimental-genesis 9 // *** *** ***
experimental-genesis 10 // *** *** ***
experimental-genesis 11 // *** * * **
experimental-genesis 12 // ******** ********
experimental-genesis 13 // ******* ******
experimental-genesis 14 // *** **
experimental-genesis 15 // * ******* **
experimental-genesis 16 // ** * * * * *
experimental-genesis 17 // ** * * ***
experimental-genesis 18 // **** * * * * ****
experimental-genesis 19 // **** *** * * ** ***
experimental-genesis 20 // **** ********* ******
experimental-genesis 21 // ******* ***** *******
experimental-genesis 22 // ********* ****** **
experimental-genesis 23 // ** ****** ******
experimental-genesis 24 // ** ******* **
experimental-genesis 25 // ** ******* ***
experimental-genesis 26 // **** ******** ************
experimental-genesis 27 // ************ ************
experimental-genesis 28 // ******** *******
experimental-genesis 29 // ****** ****
experimental-genesis 30 // *** ***
experimental-genesis 31 // ********************************
experimental-genesis 32 #ifndef JSON_SPIRIT_VALUE
experimental-genesis 33 #define JSON_SPIRIT_VALUE
experimental-genesis 34
experimental-genesis 35 // Copyright John W. Wilkinson 2007 - 2009.
experimental-genesis 36 // Distributed under the MIT License, see accompanying file LICENSE.txt
experimental-genesis 37
experimental-genesis 38 // json spirit version 4.03
experimental-genesis 39
experimental-genesis 40 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
experimental-genesis 41 # pragma once
experimental-genesis 42 #endif
experimental-genesis 43
experimental-genesis 44 #include <vector>
experimental-genesis 45 #include <map>
experimental-genesis 46 #include <string>
experimental-genesis 47 #include <cassert>
experimental-genesis 48 #include <sstream>
experimental-genesis 49 #include <stdexcept>
experimental-genesis 50 #include <boost/config.hpp>
experimental-genesis 51 #include <boost/cstdint.hpp>
experimental-genesis 52 #include <boost/shared_ptr.hpp>
experimental-genesis 53 #include <boost/variant.hpp>
experimental-genesis 54
experimental-genesis 55 namespace json_spirit
experimental-genesis 56 {
experimental-genesis 57 enum Value_type{ obj_type, array_type, str_type, bool_type, int_type, real_type, null_type };
experimental-genesis 58 static const char* Value_type_name[]={"obj", "array", "str", "bool", "int", "real", "null"};
experimental-genesis 59
experimental-genesis 60 template< class Config > // Config determines whether the value uses std::string or std::wstring and
experimental-genesis 61 // whether JSON Objects are represented as vectors or maps
experimental-genesis 62 class Value_impl
experimental-genesis 63 {
experimental-genesis 64 public:
experimental-genesis 65
experimental-genesis 66 typedef Config Config_type;
experimental-genesis 67 typedef typename Config::String_type String_type;
experimental-genesis 68 typedef typename Config::Object_type Object;
experimental-genesis 69 typedef typename Config::Array_type Array;
experimental-genesis 70 typedef typename String_type::const_pointer Const_str_ptr; // eg const char*
experimental-genesis 71
experimental-genesis 72 Value_impl(); // creates null value
experimental-genesis 73 Value_impl( Const_str_ptr value );
experimental-genesis 74 Value_impl( const String_type& value );
experimental-genesis 75 Value_impl( const Object& value );
experimental-genesis 76 Value_impl( const Array& value );
experimental-genesis 77 Value_impl( bool value );
experimental-genesis 78 Value_impl( int value );
experimental-genesis 79 Value_impl( boost::int64_t value );
experimental-genesis 80 Value_impl( boost::uint64_t value );
experimental-genesis 81 Value_impl( double value );
experimental-genesis 82
experimental-genesis 83 Value_impl( const Value_impl& other );
experimental-genesis 84
experimental-genesis 85 bool operator==( const Value_impl& lhs ) const;
experimental-genesis 86
experimental-genesis 87 Value_impl& operator=( const Value_impl& lhs );
experimental-genesis 88
experimental-genesis 89 Value_type type() const;
experimental-genesis 90
experimental-genesis 91 bool is_uint64() const;
experimental-genesis 92 bool is_null() const;
experimental-genesis 93
experimental-genesis 94 const String_type& get_str() const;
experimental-genesis 95 const Object& get_obj() const;
experimental-genesis 96 const Array& get_array() const;
experimental-genesis 97 bool get_bool() const;
experimental-genesis 98 int get_int() const;
experimental-genesis 99 boost::int64_t get_int64() const;
experimental-genesis 100 boost::uint64_t get_uint64() const;
experimental-genesis 101 double get_real() const;
experimental-genesis 102
experimental-genesis 103 Object& get_obj();
experimental-genesis 104 Array& get_array();
experimental-genesis 105
experimental-genesis 106 template< typename T > T get_value() const; // example usage: int i = value.get_value< int >();
experimental-genesis 107 // or double d = value.get_value< double >();
experimental-genesis 108
experimental-genesis 109 static const Value_impl null;
experimental-genesis 110
experimental-genesis 111 private:
experimental-genesis 112
experimental-genesis 113 void check_type( const Value_type vtype ) const;
experimental-genesis 114
experimental-genesis 115 typedef boost::variant< String_type,
experimental-genesis 116 boost::recursive_wrapper< Object >, boost::recursive_wrapper< Array >,
experimental-genesis 117 bool, boost::int64_t, double > Variant;
experimental-genesis 118
experimental-genesis 119 Value_type type_;
experimental-genesis 120 Variant v_;
experimental-genesis 121 bool is_uint64_;
experimental-genesis 122 };
experimental-genesis 123
experimental-genesis 124 // vector objects
experimental-genesis 125
experimental-genesis 126 template< class Config >
experimental-genesis 127 struct Pair_impl
experimental-genesis 128 {
experimental-genesis 129 typedef typename Config::String_type String_type;
experimental-genesis 130 typedef typename Config::Value_type Value_type;
experimental-genesis 131
experimental-genesis 132 Pair_impl( const String_type& name, const Value_type& value );
experimental-genesis 133
experimental-genesis 134 bool operator==( const Pair_impl& lhs ) const;
experimental-genesis 135
experimental-genesis 136 String_type name_;
experimental-genesis 137 Value_type value_;
experimental-genesis 138 };
experimental-genesis 139
experimental-genesis 140 template< class String >
experimental-genesis 141 struct Config_vector
experimental-genesis 142 {
experimental-genesis 143 typedef String String_type;
experimental-genesis 144 typedef Value_impl< Config_vector > Value_type;
experimental-genesis 145 typedef Pair_impl < Config_vector > Pair_type;
experimental-genesis 146 typedef std::vector< Value_type > Array_type;
experimental-genesis 147 typedef std::vector< Pair_type > Object_type;
experimental-genesis 148
experimental-genesis 149 static Value_type& add( Object_type& obj, const String_type& name, const Value_type& value )
experimental-genesis 150 {
experimental-genesis 151 obj.push_back( Pair_type( name , value ) );
experimental-genesis 152
experimental-genesis 153 return obj.back().value_;
experimental-genesis 154 }
experimental-genesis 155
experimental-genesis 156 static String_type get_name( const Pair_type& pair )
experimental-genesis 157 {
experimental-genesis 158 return pair.name_;
experimental-genesis 159 }
experimental-genesis 160
experimental-genesis 161 static Value_type get_value( const Pair_type& pair )
experimental-genesis 162 {
experimental-genesis 163 return pair.value_;
experimental-genesis 164 }
experimental-genesis 165 };
experimental-genesis 166
experimental-genesis 167 // typedefs for ASCII
experimental-genesis 168
experimental-genesis 169 typedef Config_vector< std::string > Config;
experimental-genesis 170
experimental-genesis 171 typedef Config::Value_type Value;
experimental-genesis 172 typedef Config::Pair_type Pair;
experimental-genesis 173 typedef Config::Object_type Object;
experimental-genesis 174 typedef Config::Array_type Array;
experimental-genesis 175
experimental-genesis 176 // typedefs for Unicode
experimental-genesis 177
experimental-genesis 178 #ifndef BOOST_NO_STD_WSTRING
experimental-genesis 179
experimental-genesis 180 typedef Config_vector< std::wstring > wConfig;
experimental-genesis 181
experimental-genesis 182 typedef wConfig::Value_type wValue;
experimental-genesis 183 typedef wConfig::Pair_type wPair;
experimental-genesis 184 typedef wConfig::Object_type wObject;
experimental-genesis 185 typedef wConfig::Array_type wArray;
experimental-genesis 186 #endif
experimental-genesis 187
experimental-genesis 188 // map objects
experimental-genesis 189
experimental-genesis 190 template< class String >
experimental-genesis 191 struct Config_map
experimental-genesis 192 {
experimental-genesis 193 typedef String String_type;
experimental-genesis 194 typedef Value_impl< Config_map > Value_type;
experimental-genesis 195 typedef std::vector< Value_type > Array_type;
experimental-genesis 196 typedef std::map< String_type, Value_type > Object_type;
experimental-genesis 197 typedef typename Object_type::value_type Pair_type;
experimental-genesis 198
experimental-genesis 199 static Value_type& add( Object_type& obj, const String_type& name, const Value_type& value )
experimental-genesis 200 {
experimental-genesis 201 return obj[ name ] = value;
experimental-genesis 202 }
experimental-genesis 203
experimental-genesis 204 static String_type get_name( const Pair_type& pair )
experimental-genesis 205 {
experimental-genesis 206 return pair.first;
experimental-genesis 207 }
experimental-genesis 208
experimental-genesis 209 static Value_type get_value( const Pair_type& pair )
experimental-genesis 210 {
experimental-genesis 211 return pair.second;
experimental-genesis 212 }
experimental-genesis 213 };
experimental-genesis 214
experimental-genesis 215 // typedefs for ASCII
experimental-genesis 216
experimental-genesis 217 typedef Config_map< std::string > mConfig;
experimental-genesis 218
experimental-genesis 219 typedef mConfig::Value_type mValue;
experimental-genesis 220 typedef mConfig::Object_type mObject;
experimental-genesis 221 typedef mConfig::Array_type mArray;
experimental-genesis 222
experimental-genesis 223 // typedefs for Unicode
experimental-genesis 224
experimental-genesis 225 #ifndef BOOST_NO_STD_WSTRING
experimental-genesis 226
experimental-genesis 227 typedef Config_map< std::wstring > wmConfig;
experimental-genesis 228
experimental-genesis 229 typedef wmConfig::Value_type wmValue;
experimental-genesis 230 typedef wmConfig::Object_type wmObject;
experimental-genesis 231 typedef wmConfig::Array_type wmArray;
experimental-genesis 232
experimental-genesis 233 #endif
experimental-genesis 234
experimental-genesis 235 ///////////////////////////////////////////////////////////////////////////////////////////////
experimental-genesis 236 //
experimental-genesis 237 // implementation
experimental-genesis 238
experimental-genesis 239 template< class Config >
experimental-genesis 240 const Value_impl< Config > Value_impl< Config >::null;
experimental-genesis 241
experimental-genesis 242 template< class Config >
experimental-genesis 243 Value_impl< Config >::Value_impl()
experimental-genesis 244 : type_( null_type )
experimental-genesis 245 , is_uint64_( false )
experimental-genesis 246 {
experimental-genesis 247 }
experimental-genesis 248
experimental-genesis 249 template< class Config >
experimental-genesis 250 Value_impl< Config >::Value_impl( const Const_str_ptr value )
experimental-genesis 251 : type_( str_type )
experimental-genesis 252 , v_( String_type( value ) )
experimental-genesis 253 , is_uint64_( false )
experimental-genesis 254 {
experimental-genesis 255 }
experimental-genesis 256
experimental-genesis 257 template< class Config >
experimental-genesis 258 Value_impl< Config >::Value_impl( const String_type& value )
experimental-genesis 259 : type_( str_type )
experimental-genesis 260 , v_( value )
experimental-genesis 261 , is_uint64_( false )
experimental-genesis 262 {
experimental-genesis 263 }
experimental-genesis 264
experimental-genesis 265 template< class Config >
experimental-genesis 266 Value_impl< Config >::Value_impl( const Object& value )
experimental-genesis 267 : type_( obj_type )
experimental-genesis 268 , v_( value )
experimental-genesis 269 , is_uint64_( false )
experimental-genesis 270 {
experimental-genesis 271 }
experimental-genesis 272
experimental-genesis 273 template< class Config >
experimental-genesis 274 Value_impl< Config >::Value_impl( const Array& value )
experimental-genesis 275 : type_( array_type )
experimental-genesis 276 , v_( value )
experimental-genesis 277 , is_uint64_( false )
experimental-genesis 278 {
experimental-genesis 279 }
experimental-genesis 280
experimental-genesis 281 template< class Config >
experimental-genesis 282 Value_impl< Config >::Value_impl( bool value )
experimental-genesis 283 : type_( bool_type )
experimental-genesis 284 , v_( value )
experimental-genesis 285 , is_uint64_( false )
experimental-genesis 286 {
experimental-genesis 287 }
experimental-genesis 288
experimental-genesis 289 template< class Config >
experimental-genesis 290 Value_impl< Config >::Value_impl( int value )
experimental-genesis 291 : type_( int_type )
experimental-genesis 292 , v_( static_cast< boost::int64_t >( value ) )
experimental-genesis 293 , is_uint64_( false )
experimental-genesis 294 {
experimental-genesis 295 }
experimental-genesis 296
experimental-genesis 297 template< class Config >
experimental-genesis 298 Value_impl< Config >::Value_impl( boost::int64_t value )
experimental-genesis 299 : type_( int_type )
experimental-genesis 300 , v_( value )
experimental-genesis 301 , is_uint64_( false )
experimental-genesis 302 {
experimental-genesis 303 }
experimental-genesis 304
experimental-genesis 305 template< class Config >
experimental-genesis 306 Value_impl< Config >::Value_impl( boost::uint64_t value )
experimental-genesis 307 : type_( int_type )
experimental-genesis 308 , v_( static_cast< boost::int64_t >( value ) )
experimental-genesis 309 , is_uint64_( true )
experimental-genesis 310 {
experimental-genesis 311 }
experimental-genesis 312
experimental-genesis 313 template< class Config >
experimental-genesis 314 Value_impl< Config >::Value_impl( double value )
experimental-genesis 315 : type_( real_type )
experimental-genesis 316 , v_( value )
experimental-genesis 317 , is_uint64_( false )
experimental-genesis 318 {
experimental-genesis 319 }
experimental-genesis 320
experimental-genesis 321 template< class Config >
experimental-genesis 322 Value_impl< Config >::Value_impl( const Value_impl< Config >& other )
experimental-genesis 323 : type_( other.type() )
experimental-genesis 324 , v_( other.v_ )
experimental-genesis 325 , is_uint64_( other.is_uint64_ )
experimental-genesis 326 {
experimental-genesis 327 }
experimental-genesis 328
experimental-genesis 329 template< class Config >
experimental-genesis 330 Value_impl< Config >& Value_impl< Config >::operator=( const Value_impl& lhs )
experimental-genesis 331 {
experimental-genesis 332 Value_impl tmp( lhs );
experimental-genesis 333
experimental-genesis 334 std::swap( type_, tmp.type_ );
experimental-genesis 335 std::swap( v_, tmp.v_ );
experimental-genesis 336 std::swap( is_uint64_, tmp.is_uint64_ );
experimental-genesis 337
experimental-genesis 338 return *this;
experimental-genesis 339 }
experimental-genesis 340
experimental-genesis 341 template< class Config >
experimental-genesis 342 bool Value_impl< Config >::operator==( const Value_impl& lhs ) const
experimental-genesis 343 {
experimental-genesis 344 if( this == &lhs ) return true;
experimental-genesis 345
experimental-genesis 346 if( type() != lhs.type() ) return false;
experimental-genesis 347
experimental-genesis 348 return v_ == lhs.v_;
experimental-genesis 349 }
experimental-genesis 350
experimental-genesis 351 template< class Config >
experimental-genesis 352 Value_type Value_impl< Config >::type() const
experimental-genesis 353 {
experimental-genesis 354 return type_;
experimental-genesis 355 }
experimental-genesis 356
experimental-genesis 357 template< class Config >
experimental-genesis 358 bool Value_impl< Config >::is_uint64() const
experimental-genesis 359 {
experimental-genesis 360 return is_uint64_;
experimental-genesis 361 }
experimental-genesis 362
experimental-genesis 363 template< class Config >
experimental-genesis 364 bool Value_impl< Config >::is_null() const
experimental-genesis 365 {
experimental-genesis 366 return type() == null_type;
experimental-genesis 367 }
experimental-genesis 368
experimental-genesis 369 template< class Config >
experimental-genesis 370 void Value_impl< Config >::check_type( const Value_type vtype ) const
experimental-genesis 371 {
experimental-genesis 372 if( type() != vtype )
experimental-genesis 373 {
experimental-genesis 374 std::ostringstream os;
experimental-genesis 375
experimental-genesis 376 ///// Bitcoin: Tell the types by name instead of by number
experimental-genesis 377 os << "value is type " << Value_type_name[type()] << ", expected " << Value_type_name[vtype];
experimental-genesis 378
experimental-genesis 379 throw std::runtime_error( os.str() );
experimental-genesis 380 }
experimental-genesis 381 }
experimental-genesis 382
experimental-genesis 383 template< class Config >
experimental-genesis 384 const typename Config::String_type& Value_impl< Config >::get_str() const
experimental-genesis 385 {
experimental-genesis 386 check_type( str_type );
experimental-genesis 387
experimental-genesis 388 return *boost::get< String_type >( &v_ );
experimental-genesis 389 }
experimental-genesis 390
experimental-genesis 391 template< class Config >
experimental-genesis 392 const typename Value_impl< Config >::Object& Value_impl< Config >::get_obj() const
experimental-genesis 393 {
experimental-genesis 394 check_type( obj_type );
experimental-genesis 395
experimental-genesis 396 return *boost::get< Object >( &v_ );
experimental-genesis 397 }
experimental-genesis 398
experimental-genesis 399 template< class Config >
experimental-genesis 400 const typename Value_impl< Config >::Array& Value_impl< Config >::get_array() const
experimental-genesis 401 {
experimental-genesis 402 check_type( array_type );
experimental-genesis 403
experimental-genesis 404 return *boost::get< Array >( &v_ );
experimental-genesis 405 }
experimental-genesis 406
experimental-genesis 407 template< class Config >
experimental-genesis 408 bool Value_impl< Config >::get_bool() const
experimental-genesis 409 {
experimental-genesis 410 check_type( bool_type );
experimental-genesis 411
experimental-genesis 412 return boost::get< bool >( v_ );
experimental-genesis 413 }
experimental-genesis 414
experimental-genesis 415 template< class Config >
experimental-genesis 416 int Value_impl< Config >::get_int() const
experimental-genesis 417 {
experimental-genesis 418 check_type( int_type );
experimental-genesis 419
experimental-genesis 420 return static_cast< int >( get_int64() );
experimental-genesis 421 }
experimental-genesis 422
experimental-genesis 423 template< class Config >
experimental-genesis 424 boost::int64_t Value_impl< Config >::get_int64() const
experimental-genesis 425 {
experimental-genesis 426 check_type( int_type );
experimental-genesis 427
experimental-genesis 428 return boost::get< boost::int64_t >( v_ );
experimental-genesis 429 }
experimental-genesis 430
experimental-genesis 431 template< class Config >
experimental-genesis 432 boost::uint64_t Value_impl< Config >::get_uint64() const
experimental-genesis 433 {
experimental-genesis 434 check_type( int_type );
experimental-genesis 435
experimental-genesis 436 return static_cast< boost::uint64_t >( get_int64() );
experimental-genesis 437 }
experimental-genesis 438
experimental-genesis 439 template< class Config >
experimental-genesis 440 double Value_impl< Config >::get_real() const
experimental-genesis 441 {
experimental-genesis 442 if( type() == int_type )
experimental-genesis 443 {
experimental-genesis 444 return is_uint64() ? static_cast< double >( get_uint64() )
experimental-genesis 445 : static_cast< double >( get_int64() );
experimental-genesis 446 }
experimental-genesis 447
experimental-genesis 448 check_type( real_type );
experimental-genesis 449
experimental-genesis 450 return boost::get< double >( v_ );
experimental-genesis 451 }
experimental-genesis 452
experimental-genesis 453 template< class Config >
experimental-genesis 454 typename Value_impl< Config >::Object& Value_impl< Config >::get_obj()
experimental-genesis 455 {
experimental-genesis 456 check_type( obj_type );
experimental-genesis 457
experimental-genesis 458 return *boost::get< Object >( &v_ );
experimental-genesis 459 }
experimental-genesis 460
experimental-genesis 461 template< class Config >
experimental-genesis 462 typename Value_impl< Config >::Array& Value_impl< Config >::get_array()
experimental-genesis 463 {
experimental-genesis 464 check_type( array_type );
experimental-genesis 465
experimental-genesis 466 return *boost::get< Array >( &v_ );
experimental-genesis 467 }
experimental-genesis 468
experimental-genesis 469 template< class Config >
experimental-genesis 470 Pair_impl< Config >::Pair_impl( const String_type& name, const Value_type& value )
experimental-genesis 471 : name_( name )
experimental-genesis 472 , value_( value )
experimental-genesis 473 {
experimental-genesis 474 }
experimental-genesis 475
experimental-genesis 476 template< class Config >
experimental-genesis 477 bool Pair_impl< Config >::operator==( const Pair_impl< Config >& lhs ) const
experimental-genesis 478 {
experimental-genesis 479 if( this == &lhs ) return true;
experimental-genesis 480
experimental-genesis 481 return ( name_ == lhs.name_ ) && ( value_ == lhs.value_ );
experimental-genesis 482 }
experimental-genesis 483
experimental-genesis 484 // converts a C string, ie. 8 bit char array, to a string object
experimental-genesis 485 //
experimental-genesis 486 template < class String_type >
experimental-genesis 487 String_type to_str( const char* c_str )
experimental-genesis 488 {
experimental-genesis 489 String_type result;
experimental-genesis 490
experimental-genesis 491 for( const char* p = c_str; *p != 0; ++p )
experimental-genesis 492 {
experimental-genesis 493 result += *p;
experimental-genesis 494 }
experimental-genesis 495
experimental-genesis 496 return result;
experimental-genesis 497 }
experimental-genesis 498
experimental-genesis 499 //
experimental-genesis 500
experimental-genesis 501 namespace internal_
experimental-genesis 502 {
experimental-genesis 503 template< typename T >
experimental-genesis 504 struct Type_to_type
experimental-genesis 505 {
experimental-genesis 506 };
experimental-genesis 507
experimental-genesis 508 template< class Value >
experimental-genesis 509 int get_value( const Value& value, Type_to_type< int > )
experimental-genesis 510 {
experimental-genesis 511 return value.get_int();
experimental-genesis 512 }
experimental-genesis 513
experimental-genesis 514 template< class Value >
experimental-genesis 515 boost::int64_t get_value( const Value& value, Type_to_type< boost::int64_t > )
experimental-genesis 516 {
experimental-genesis 517 return value.get_int64();
experimental-genesis 518 }
experimental-genesis 519
experimental-genesis 520 template< class Value >
experimental-genesis 521 boost::uint64_t get_value( const Value& value, Type_to_type< boost::uint64_t > )
experimental-genesis 522 {
experimental-genesis 523 return value.get_uint64();
experimental-genesis 524 }
experimental-genesis 525
experimental-genesis 526 template< class Value >
experimental-genesis 527 double get_value( const Value& value, Type_to_type< double > )
experimental-genesis 528 {
experimental-genesis 529 return value.get_real();
experimental-genesis 530 }
experimental-genesis 531
experimental-genesis 532 template< class Value >
experimental-genesis 533 typename Value::String_type get_value( const Value& value, Type_to_type< typename Value::String_type > )
experimental-genesis 534 {
experimental-genesis 535 return value.get_str();
experimental-genesis 536 }
experimental-genesis 537
experimental-genesis 538 template< class Value >
experimental-genesis 539 typename Value::Array get_value( const Value& value, Type_to_type< typename Value::Array > )
experimental-genesis 540 {
experimental-genesis 541 return value.get_array();
experimental-genesis 542 }
experimental-genesis 543
experimental-genesis 544 template< class Value >
experimental-genesis 545 typename Value::Object get_value( const Value& value, Type_to_type< typename Value::Object > )
experimental-genesis 546 {
experimental-genesis 547 return value.get_obj();
experimental-genesis 548 }
experimental-genesis 549
experimental-genesis 550 template< class Value >
experimental-genesis 551 bool get_value( const Value& value, Type_to_type< bool > )
experimental-genesis 552 {
experimental-genesis 553 return value.get_bool();
experimental-genesis 554 }
experimental-genesis 555 }
experimental-genesis 556
experimental-genesis 557 template< class Config >
experimental-genesis 558 template< typename T >
experimental-genesis 559 T Value_impl< Config >::get_value() const
experimental-genesis 560 {
experimental-genesis 561 return internal_::get_value( *this, internal_::Type_to_type< T >() );
experimental-genesis 562 }
experimental-genesis 563 }
experimental-genesis 564
experimental-genesis 565 #endif