1 #ifndef JSON_SPIRIT_UTILS
\r
2 #define JSON_SPIRIT_UTILS
\r
4 // Copyright John W. Wilkinson 2007 - 2011
\r
5 // Distributed under the MIT License, see accompanying file LICENSE.txt
\r
7 // json spirit version 4.05
\r
9 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
\r
13 #include "json_spirit_value.h"
\r
16 namespace json_spirit
\r
18 template< class Obj_t, class Map_t >
\r
19 void obj_to_map( const Obj_t& obj, Map_t& mp_obj )
\r
23 for( typename Obj_t::const_iterator i = obj.begin(); i != obj.end(); ++i )
\r
25 mp_obj[ i->name_ ] = i->value_;
\r
29 template< class Obj_t, class Map_t >
\r
30 void map_to_obj( const Map_t& mp_obj, Obj_t& obj )
\r
34 for( typename Map_t::const_iterator i = mp_obj.begin(); i != mp_obj.end(); ++i )
\r
36 obj.push_back( typename Obj_t::value_type( i->first, i->second ) );
\r
40 #ifdef JSON_SPIRIT_VALUE_ENABLED
\r
41 typedef std::map< std::string, Value > Mapped_obj;
\r
44 #if defined( JSON_SPIRIT_WVALUE_ENABLED ) && !defined( BOOST_NO_STD_WSTRING )
\r
45 typedef std::map< std::wstring, wValue > wMapped_obj;
\r
48 template< class Object_type, class String_type >
\r
49 const typename Object_type::value_type::Value_type& find_value( const Object_type& obj, const String_type& name )
\r
51 for( typename Object_type::const_iterator i = obj.begin(); i != obj.end(); ++i )
\r
53 if( i->name_ == name )
\r
59 return Object_type::value_type::Value_type::null;
\r