75 #ifndef JSON_AMALGATED_H_INCLUDED    76 # define JSON_AMALGATED_H_INCLUDED    77 #define JSON_IS_AMALGATED    90 #ifndef JSON_CONFIG_H_INCLUDED    91 # define JSON_CONFIG_H_INCLUDED   113 # define JSON_USE_EXCEPTION 1   118 #define JSON_IS_AMALGAMATION   121 # ifdef JSON_IN_CPPTL   122 #  include <cpptl/config.h>   123 #  ifndef JSON_USE_CPPTL   124 #   define JSON_USE_CPPTL 1   128 # ifdef JSON_IN_CPPTL   129 #  define JSON_API CPPTL_API   130 # elif defined(JSON_DLL_BUILD)   131 #  define JSON_API __declspec(dllexport)   132 # elif defined(JSON_DLL)   133 #  define JSON_API __declspec(dllimport)   142 #if defined(_MSC_VER)  &&  _MSC_VER <= 1200 // MSVC 6   145 #define JSON_USE_INT64_DOUBLE_CONVERSION 1   146 #endif // if defined(_MSC_VER)  &&  _MSC_VER < 1200 // MSVC 6   148 #if defined(_MSC_VER)  &&  _MSC_VER >= 1500 // MSVC 2008   149 # define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))   153 #if !defined(JSONCPP_DEPRECATED)   154 # define JSONCPP_DEPRECATED(message)   155 #endif // if !defined(JSONCPP_DEPRECATED)   159    typedef unsigned int UInt;
   160 # if defined(JSON_NO_INT64)   163 #  undef JSON_HAS_INT64   164 # else // if defined(JSON_NO_INT64)   166 #  if defined(_MSC_VER) // Microsoft Visual Studio   167    typedef __int64 
Int64;
   168    typedef unsigned __int64 
UInt64;
   169 #  else // if defined(_MSC_VER) // Other platforms, use long long   170    typedef long long int Int64;
   171    typedef unsigned long long int UInt64;
   172 #  endif // if defined(_MSC_VER)   175 #  define JSON_HAS_INT64   176 # endif // if defined(JSON_NO_INT64)   180 #endif // JSON_CONFIG_H_INCLUDED   200 #ifndef JSON_FORWARDS_H_INCLUDED   201 # define JSON_FORWARDS_H_INCLUDED   203 #if !defined(JSON_IS_AMALGAMATION)   205 #endif // if !defined(JSON_IS_AMALGAMATION)   225    class ValueIteratorBase;
   227    class ValueConstIterator;
   228 #ifdef JSON_VALUE_USE_INTERNAL_MAP   229    class ValueMapAllocator;
   230    class ValueInternalLink;
   231    class ValueInternalArray;
   232    class ValueInternalMap;
   233 #endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP   238 #endif // JSON_FORWARDS_H_INCLUDED   258 #ifndef CPPTL_JSON_FEATURES_H_INCLUDED   259 # define CPPTL_JSON_FEATURES_H_INCLUDED   261 #if !defined(JSON_IS_AMALGAMATION)   263 #endif // if !defined(JSON_IS_AMALGAMATION)   301 #endif // CPPTL_JSON_FEATURES_H_INCLUDED   321 #ifndef CPPTL_JSON_H_INCLUDED   322 # define CPPTL_JSON_H_INCLUDED   324 #if !defined(JSON_IS_AMALGAMATION)   326 #endif // if !defined(JSON_IS_AMALGAMATION)   330 # ifndef JSON_USE_CPPTL_SMALLMAP   333 #  include <cpptl/smallmap.h>   335 # ifdef JSON_USE_CPPTL   336 #  include <cpptl/forwards.h>   392       operator const char *() 
const   436 # ifdef JSON_VALUE_USE_INTERNAL_MAP   437       friend class ValueInternalLink;
   438       friend class ValueInternalMap;
   446 # if defined(JSON_HAS_INT64)   449 #endif // defined(JSON_HAS_INT64)   477 #ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION   478 # ifndef JSON_VALUE_USE_INTERNAL_MAP   493          bool operator<( 
const CZString &other ) 
const;
   495          ArrayIndex index() 
const;
   496          const char *c_str() 
const;
   497          bool isStaticString() 
const;
   505 #  ifndef JSON_USE_CPPTL_SMALLMAP   508       typedef CppTL::SmallMap<CZString, Value> ObjectValues;
   509 #  endif // ifndef JSON_USE_CPPTL_SMALLMAP   510 # endif // ifndef JSON_VALUE_USE_INTERNAL_MAP   511 #endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION   532 #if defined(JSON_HAS_INT64)   533       Value( Int64 value );
   534       Value( UInt64 value );
   535 #endif // if defined(JSON_HAS_INT64)   536       Value( 
double value );
   537       Value( 
const char *value );
   538       Value( 
const char *beginValue, 
const char *endValue );
   550       Value( 
const std::string &value );
   551 # ifdef JSON_USE_CPPTL   552       Value( 
const CppTL::ConstString &value );
   566       bool operator <( 
const Value &other ) 
const;
   567       bool operator <=( 
const Value &other ) 
const;
   568       bool operator >=( 
const Value &other ) 
const;
   569       bool operator >( 
const Value &other ) 
const;
   571       bool operator ==( 
const Value &other ) 
const;
   572       bool operator !=( 
const Value &other ) 
const;
   574       int compare( 
const Value &other ) 
const;
   576       const char *asCString() 
const;
   577       std::string asString() 
const;
   578 # ifdef JSON_USE_CPPTL   579       CppTL::ConstString asConstString() 
const;
   583       Int64 asInt64() 
const;
   584       UInt64 asUInt64() 
const;
   585       LargestInt asLargestInt() 
const;
   586       LargestUInt asLargestUInt() 
const;
   587       float asFloat() 
const;
   588       double asDouble() 
const;
   595       bool isIntegral() 
const;
   596       bool isDouble() 
const;
   597       bool isNumeric() 
const;
   598       bool isString() 
const;
   599       bool isArray() 
const;
   600       bool isObject() 
const;
   602       bool isConvertibleTo( 
ValueType other ) 
const;
   605       ArrayIndex size() 
const;
   612       bool operator!() 
const;
   624       void resize( ArrayIndex size );
   631       Value &operator[]( ArrayIndex index );
   638       Value &operator[]( 
int index );
   643       const Value &operator[]( ArrayIndex index ) 
const;
   648       const Value &operator[]( 
int index ) 
const;
   652       Value get( ArrayIndex index, 
   653                  const Value &defaultValue ) 
const;
   655       bool isValidIndex( ArrayIndex index ) 
const;
   662       Value &operator[]( 
const char *key );
   664       const Value &operator[]( 
const char *key ) 
const;
   666       Value &operator[]( 
const std::string &key );
   668       const Value &operator[]( 
const std::string &key ) 
const;
   681 # ifdef JSON_USE_CPPTL   682       Value &operator[]( 
const CppTL::ConstString &key );
   685       const Value &operator[]( 
const CppTL::ConstString &key ) 
const;
   687       Value get( 
const char *key, 
   689                  const Value &defaultValue ) 
const;
   691       Value get( 
const std::string &key,
   692                  const Value &defaultValue ) 
const;
   693 # ifdef JSON_USE_CPPTL   694       Value get( 
const CppTL::ConstString &key,
   696                  const Value &defaultValue ) 
const;
   698       Value removeMember( 
const char* key );
   706       Value removeMember( 
const std::string &key );
   709       bool isMember( 
const char *key ) 
const;
   711       bool isMember( 
const std::string &key ) 
const;
   712 # ifdef JSON_USE_CPPTL   713       bool isMember( 
const CppTL::ConstString &key ) 
const;
   722       Members getMemberNames() 
const;
   730       void setComment( 
const char *comment,
   733       void setComment( 
const std::string &comment,
   739       std::string toStyledString() 
const;
   741       const_iterator begin() 
const;
   742       const_iterator end() 
const;
   748       Value &resolveReference( 
const char *key, 
   751 # ifdef JSON_VALUE_USE_INTERNAL_MAP   752       inline bool isItemAvailable()
 const   754          return itemIsUsed_ == 0;
   757       inline void setItemUsed( 
bool isUsed = 
true )
   759          itemIsUsed_ = isUsed ? 1 : 0;
   762       inline bool isMemberNameStatic()
 const   764          return memberNameIsStatic_ == 0;
   767       inline void setMemberNameIsStatic( 
bool isStatic )
   769          memberNameIsStatic_ = isStatic ? 1 : 0;
   771 # endif // # ifdef JSON_VALUE_USE_INTERNAL_MAP   779          void setComment( 
const char *text );
   800 # ifdef JSON_VALUE_USE_INTERNAL_MAP   801          ValueInternalArray *array_;
   802          ValueInternalMap *map_;
   809 # ifdef JSON_VALUE_USE_INTERNAL_MAP   810       unsigned int itemIsUsed_ : 1;      
   811       int memberNameIsStatic_ : 1;       
   855       Path( 
const std::string &path,
   864                      const Value &defaultValue ) 
const;
   869       typedef std::vector<const PathArgument *> 
InArgs;
   870       typedef std::vector<PathArgument> 
Args;
   872       void makePath( 
const std::string &path,
   874       void addPathInArg( 
const std::string &path, 
   876                          InArgs::const_iterator &itInArg, 
   878       void invalidPath( 
const std::string &path, 
   886 #ifdef JSON_VALUE_USE_INTERNAL_MAP   934       virtual ~ValueMapAllocator();
   935       virtual ValueInternalMap *newMap() = 0;
   936       virtual ValueInternalMap *newMapCopy( 
const ValueInternalMap &other ) = 0;
   937       virtual void destructMap( ValueInternalMap *map ) = 0;
   938       virtual ValueInternalLink *allocateMapBuckets( 
unsigned int size ) = 0;
   939       virtual void releaseMapBuckets( ValueInternalLink *links ) = 0;
   940       virtual ValueInternalLink *allocateMapLink() = 0;
   941       virtual void releaseMapLink( ValueInternalLink *link ) = 0;
   950       enum { itemPerLink = 6 };  
   958       ~ValueInternalLink();
   960       Value items_[itemPerLink];
   961       char *keys_[itemPerLink];
   962       ValueInternalLink *previous_;
   963       ValueInternalLink *next_;
   984       typedef unsigned int HashKey;
   985       typedef unsigned int BucketIndex;
   987 # ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION   997          ValueInternalMap *map_;
   998          ValueInternalLink *link_;
   999          BucketIndex itemIndex_;
  1000          BucketIndex bucketIndex_;
  1002 # endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION  1005       ValueInternalMap( 
const ValueInternalMap &other );
  1006       ValueInternalMap &operator =( 
const ValueInternalMap &other );
  1007       ~ValueInternalMap();
  1009       void swap( ValueInternalMap &other );
  1011       BucketIndex size() 
const;
  1015       bool reserveDelta( BucketIndex growth );
  1017       bool reserve( BucketIndex newItemCount );
  1019       const Value *find( 
const char *key ) 
const;
  1021       Value *find( 
const char *key );
  1023       Value &resolveReference( 
const char *key, 
  1026       void remove( 
const char *key );
  1028       void doActualRemove( ValueInternalLink *link, 
  1030                            BucketIndex bucketIndex );
  1032       ValueInternalLink *&getLastLinkInBucket( BucketIndex bucketIndex );
  1034       Value &setNewItem( 
const char *key, 
  1036                          ValueInternalLink *link, 
  1037                          BucketIndex index );
  1039       Value &unsafeAdd( 
const char *key, 
  1041                         HashKey hashedKey );
  1043       HashKey hash( 
const char *key ) 
const;
  1045       int compare( 
const ValueInternalMap &other ) 
const;
  1048       void makeBeginIterator( IteratorState &it ) 
const;
  1049       void makeEndIterator( IteratorState &it ) 
const;
  1050       static bool equals( 
const IteratorState &x, 
const IteratorState &other );
  1051       static void increment( IteratorState &iterator );
  1052       static void incrementBucket( IteratorState &iterator );
  1053       static void decrement( IteratorState &iterator );
  1054       static const char *key( 
const IteratorState &iterator );
  1055       static const char *key( 
const IteratorState &iterator, 
bool &isStatic );
  1056       static Value &value( 
const IteratorState &iterator );
  1057       static int distance( 
const IteratorState &x, 
const IteratorState &y );
  1060       ValueInternalLink *buckets_;
  1061       ValueInternalLink *tailLink_;
  1062       BucketIndex bucketsSize_;
  1063       BucketIndex itemCount_;
  1082       enum { itemsPerPage = 8 };    
  1084       typedef unsigned int PageIndex;
  1086 # ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION  1087       struct IteratorState 
  1091             , currentPageIndex_(0)
  1092             , currentItemIndex_(0) 
  1095          ValueInternalArray *array_;
  1096          Value **currentPageIndex_;
  1097          unsigned int currentItemIndex_;
  1099 # endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION  1101       ValueInternalArray();
  1102       ValueInternalArray( 
const ValueInternalArray &other );
  1103       ValueInternalArray &operator =( 
const ValueInternalArray &other );
  1104       ~ValueInternalArray();
  1105       void swap( ValueInternalArray &other );
  1108       void resize( ArrayIndex newSize );
  1110       Value &resolveReference( ArrayIndex index );
  1112       Value *find( ArrayIndex index ) 
const;
  1114       ArrayIndex size() 
const;
  1116       int compare( 
const ValueInternalArray &other ) 
const;
  1119       static bool equals( 
const IteratorState &x, 
const IteratorState &other );
  1120       static void increment( IteratorState &iterator );
  1121       static void decrement( IteratorState &iterator );
  1122       static Value &dereference( 
const IteratorState &iterator );
  1123       static Value &unsafeDereference( 
const IteratorState &iterator );
  1124       static int distance( 
const IteratorState &x, 
const IteratorState &y );
  1125       static ArrayIndex indexOf( 
const IteratorState &iterator );
  1126       void makeBeginIterator( IteratorState &it ) 
const;
  1127       void makeEndIterator( IteratorState &it ) 
const;
  1128       void makeIterator( IteratorState &it, ArrayIndex index ) 
const;
  1130       void makeIndexValid( ArrayIndex index );
  1134       PageIndex pageCount_;
  1199       virtual ~ValueArrayAllocator();
  1200       virtual ValueInternalArray *newArray() = 0;
  1201       virtual ValueInternalArray *newArrayCopy( 
const ValueInternalArray &other ) = 0;
  1202       virtual void destructArray( ValueInternalArray *array ) = 0;
  1214       virtual void reallocateArrayPageIndex( 
Value **&indexes, 
  1215                                              ValueInternalArray::PageIndex &indexCount,
  1216                                              ValueInternalArray::PageIndex minNewIndexCount ) = 0;
  1217       virtual void releaseArrayPageIndex( 
Value **indexes, 
  1218                                           ValueInternalArray::PageIndex indexCount ) = 0;
  1219       virtual Value *allocateArrayPage() = 0;
  1220       virtual void releaseArrayPage( 
Value *value ) = 0;
  1222 #endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP  1236 #ifndef JSON_VALUE_USE_INTERNAL_MAP  1243       bool operator ==( 
const SelfType &other )
 const  1245          return isEqual( other );
  1248       bool operator !=( 
const SelfType &other )
 const  1250          return !isEqual( other );
  1253       difference_type operator -( 
const SelfType &other )
 const  1255          return computeDistance( other );
  1265       const char *memberName() 
const;
  1268       Value &deref() 
const;
  1274       difference_type computeDistance( 
const SelfType &other ) 
const;
  1276       bool isEqual( 
const SelfType &other ) 
const;
  1278       void copy( 
const SelfType &other );
  1281 #ifndef JSON_VALUE_USE_INTERNAL_MAP  1288          ValueInternalArray::IteratorState array_;
  1289          ValueInternalMap::IteratorState map_;
  1312 #ifndef JSON_VALUE_USE_INTERNAL_MAP  1323          SelfType temp( *
this );
  1330          SelfType temp( *
this );
  1347       reference operator *()
 const  1372 #ifndef JSON_VALUE_USE_INTERNAL_MAP  1373       explicit ValueIterator( 
const Value::ObjectValues::iterator ¤t );
  1375       ValueIterator( 
const ValueInternalArray::IteratorState &state );
  1376       ValueIterator( 
const ValueInternalMap::IteratorState &state );
  1380       SelfType &operator =( 
const SelfType &other );
  1384          SelfType temp( *
this );
  1391          SelfType temp( *
this );
  1408       reference operator *()
 const  1418 #endif // CPPTL_JSON_H_INCLUDED  1438 #ifndef CPPTL_JSON_READER_H_INCLUDED  1439 # define CPPTL_JSON_READER_H_INCLUDED  1441 #if !defined(JSON_IS_AMALGAMATION)  1442 # include "features.h"  1444 #endif // if !defined(JSON_IS_AMALGAMATION)  1448 # include <iostream>  1481       bool parse( 
const std::string &document, 
  1483                   bool collectComments = 
true );
  1497       bool parse( 
const char *beginDoc, 
const char *endDoc, 
  1499                   bool collectComments = 
true );
  1503       bool parse( std::istream &is,
  1505                   bool collectComments = 
true );
  1514       std::
string getFormatedErrorMessages() const;
  1521       std::
string getFormattedErrorMessages() const;
  1526          tokenEndOfStream = 0,
  1560       bool expectToken( 
TokenType type, 
Token &token, 
const char *message );
  1561       bool readToken( 
Token &token );
  1563       bool match( Location pattern, 
  1564                   int patternLength );
  1566       bool readCStyleComment();
  1567       bool readCppStyleComment();
  1571       bool readObject( 
Token &token );
  1572       bool readArray( 
Token &token );
  1573       bool decodeNumber( 
Token &token );
  1574       bool decodeString( 
Token &token );
  1575       bool decodeString( 
Token &token, std::string &decoded );
  1576       bool decodeDouble( 
Token &token );
  1577       bool decodeUnicodeCodePoint( 
Token &token, 
  1580                                    unsigned int &unicode );
  1581       bool decodeUnicodeEscapeSequence( 
Token &token, 
  1584                                         unsigned int &unicode );
  1585       bool addError( 
const std::string &message, 
  1587                      Location extra = 0 );
  1588       bool recoverFromError( 
TokenType skipUntilToken );
  1589       bool addErrorAndRecover( 
const std::string &message, 
  1592       void skipUntilSpace();
  1593       Value ¤tValue();
  1595       void getLocationLineAndColumn( Location location,
  1597                                      int &column ) 
const;
  1598       std::string getLocationLineAndColumn( Location location ) 
const;
  1599       void addComment( Location begin, 
  1602       void skipCommentTokens( 
Token &token );
  1646 #endif // CPPTL_JSON_READER_H_INCLUDED  1666 #ifndef JSON_WRITER_H_INCLUDED  1667 # define JSON_WRITER_H_INCLUDED  1669 #if !defined(JSON_IS_AMALGAMATION)  1671 #endif // if !defined(JSON_IS_AMALGAMATION)  1674 # include <iostream>  1687       virtual std::string write( 
const Value &root ) = 0;
  1702       void enableYAMLCompatibility();
  1705       virtual std::string write( 
const Value &root );
  1708       void writeValue( 
const Value &value );
  1743       virtual std::string write( 
const Value &root );
  1746       void writeValue( 
const Value &value );
  1747       void writeArrayValue( 
const Value &value );
  1748       bool isMultineArray( 
const Value &value );
  1749       void pushValue( 
const std::string &value );
  1751       void writeWithIndent( 
const std::string &value );
  1754       void writeCommentBeforeValue( 
const Value &root );
  1755       void writeCommentAfterValueOnSameLine( 
const Value &root );
  1756       bool hasCommentForValue( 
const Value &value );
  1757       static std::string normalizeEOL( 
const std::string &text );
  1801       void write( std::ostream &out, 
const Value &root );
  1804       void writeValue( 
const Value &value );
  1805       void writeArrayValue( 
const Value &value );
  1806       bool isMultineArray( 
const Value &value );
  1807       void pushValue( 
const std::string &value );
  1809       void writeWithIndent( 
const std::string &value );
  1812       void writeCommentBeforeValue( 
const Value &root );
  1813       void writeCommentAfterValueOnSameLine( 
const Value &root );
  1814       bool hasCommentForValue( 
const Value &value );
  1815       static std::string normalizeEOL( 
const std::string &text );
  1827 # if defined(JSON_HAS_INT64)  1830 # endif // if defined(JSON_HAS_INT64)  1845 #endif // JSON_WRITER_H_INCLUDED  1855 #endif //ifndef JSON_AMALGATED_H_INCLUDED 
std::stack< Value * > Nodes
std::vector< std::string > ChildValues
std::vector< std::string > Members
std::string JSON_API valueToQuotedString(const char *value)
std::ostream & operator<<(std::ostream &, const Value &root)
Output using the StyledStreamWriter. 
bool allowComments_
true if comments are allowed. Default: true. 
Writes a Value in JSON format in a human friendly way, to a stream rather than to a string...
Json::LargestInt LargestInt
static const LargestUInt maxLargestUInt
Maximum unsigned integer value that can be stored in a Json::Value. 
const char * c_str() const
static const LargestInt minLargestInt
Minimum signed integer value that can be stored in a Json::Value. 
std::string indentString_
TFSIMD_FORCE_INLINE bool operator==(const Matrix3x3 &m1, const Matrix3x3 &m2)
Experimental and untested: represents an element of the "path" to access a node. 
Json::ArrayIndex ArrayIndex
std::string commentsBefore_
std::vector< const PathArgument * > InArgs
Lightweight wrapper to tag static string. 
ValueConstIterator const_iterator
bool yamlCompatiblityEnabled_
static const UInt maxUInt
Maximum unsigned int value that can be stored in a Json::Value. 
std::string JSON_API valueToString(Int value)
ROSCPP_DECL std::string resolve(const std::string &name, bool remap=true)
void swap(Bag &a, Bag &b)
Configuration passed to reader and writer. This configuration object can be used to force the Reader ...
a comment placed on the line before a value 
static const UInt64 maxUInt64
Maximum unsigned 64 bits int value that can be stored in a Json::Value. 
std::deque< ErrorInfo > Errors
static const Int64 maxInt64
Maximum signed 64 bits int value that can be stored in a Json::Value. 
Outputs a Value in JSON format without formatting (not human friendly). 
static const Int minInt
Minimum signed int value that can be stored in a Json::Value. 
std::map< CZString, Value > ObjectValues
static const Int64 minInt64
Minimum signed 64 bits int value that can be stored in a Json::Value. 
Abstract class for writers. 
ValueConstIterator SelfType
object value (collection of name/value pairs). 
Json::LargestUInt LargestUInt
ValueType
Type of the value held by a Value object. 
JSON (JavaScript Object Notation). 
ValueIteratorBase SelfType
a comment just after a value on the same line 
std::istream & operator>>(std::istream &, Value &)
Read from 'sin' into 'root'. 
base class for Value iterators. 
std::string indentString_
a comment on the line after a value (only make sense for root value) 
static bool in(Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4)
static const Int maxInt
Maximum signed int value that can be stored in a Json::Value. 
ROSCPP_DECL std::string append(const std::string &left, const std::string &right)
StaticString(const char *czstring)
Unserialize a JSON document into a Value. 
unsigned long long int UInt64
std::vector< PathArgument > Args
static const LargestInt maxLargestInt
Maximum signed integer value that can be stored in a Json::Value. 
Iterator for object and array value. 
std::vector< std::string > ChildValues
Writes a Value in JSON format in a human friendly way. 
Experimental and untested: represents a "path" to access a node. 
bool strictRoot_
true if root must be either an array or an object value. Default: false. 
const iterator for object and array value. 
#define JSONCPP_DEPRECATED(message)
void increment(int *value)
Value::ObjectValues::iterator current_
array value (ordered list)