@@ -167,6 +167,8 @@ class JSON_API Value {
167
167
template <typename T>
168
168
friend class ValueIteratorBase ;
169
169
public:
170
+ typedef _String String;
171
+ typedef _Alloc Allocator;
170
172
typedef std::vector<std::string> Members;
171
173
typedef ValueIterator<Value> iterator;
172
174
typedef ValueConstIterator<Value> const_iterator;
@@ -295,7 +297,7 @@ Json::Value obj_value(Json::objectValue); // {}
295
297
* \endcode
296
298
*/
297
299
Value (const Json::StaticString& value);
298
- Value (const std::string & value); // /< Copy data() til size(). Embedded zeroes too.
300
+ Value (const String & value); // /< Copy data() til size(). Embedded zeroes too.
299
301
#ifdef JSON_USE_CPPTL
300
302
Value (const CppTL::ConstString& value);
301
303
#endif
@@ -328,7 +330,7 @@ Json::Value obj_value(Json::objectValue); // {}
328
330
int compare (const Value& other) const ;
329
331
330
332
const char * asCString () const ; // /< Embedded zeroes could cause you trouble!
331
- std::string asString () const ; // /< Embedded zeroes are possible.
333
+ String asString () const ; // /< Embedded zeroes are possible.
332
334
/* * Get raw char* of string-value.
333
335
* \return false if !string. (Seg-fault if str or end are NULL.)
334
336
*/
@@ -432,11 +434,11 @@ Json::Value obj_value(Json::objectValue); // {}
432
434
const Value& operator [](const char * key) const ;
433
435
// / Access an object value by name, create a null member if it does not exist.
434
436
// / \param key may contain embedded nulls.
435
- Value& operator [](const std::string & key);
437
+ Value& operator [](const String & key);
436
438
// / Access an object value by name, returns null if there is no member with
437
439
// / that name.
438
440
// / \param key may contain embedded nulls.
439
- const Value& operator [](const std::string & key) const ;
441
+ const Value& operator [](const String & key) const ;
440
442
/* * \brief Access an object value by name, create a null member if it does not
441
443
exist.
442
444
@@ -467,7 +469,7 @@ Json::Value obj_value(Json::objectValue); // {}
467
469
// / Return the member named key if it exist, defaultValue otherwise.
468
470
// / \note deep copy
469
471
// / \param key may contain embedded nulls.
470
- Value get (const std::string & key, const Value& defaultValue) const ;
472
+ Value get (const String & key, const Value& defaultValue) const ;
471
473
#ifdef JSON_USE_CPPTL
472
474
// / Return the member named key if it exist, defaultValue otherwise.
473
475
// / \note deep copy
@@ -492,7 +494,7 @@ Json::Value obj_value(Json::objectValue); // {}
492
494
// / Same as removeMember(const char*)
493
495
// / \param key may contain embedded nulls.
494
496
// / \deprecated
495
- Value removeMember (const std::string & key);
497
+ Value removeMember (const String & key);
496
498
// / Same as removeMember(const char* begin, const char* end, Value* removed),
497
499
// / but 'key' is null-terminated.
498
500
bool removeMember (const char * key, Value* removed);
@@ -502,8 +504,8 @@ Json::Value obj_value(Json::objectValue); // {}
502
504
\param key may contain embedded nulls.
503
505
\return true iff removed (no exceptions)
504
506
*/
505
- bool removeMember (std::string const & key, Value* removed);
506
- // / Same as removeMember(std::string const& key, Value* removed)
507
+ bool removeMember (String const & key, Value* removed);
508
+ // / Same as removeMember(String const& key, Value* removed)
507
509
bool removeMember (const char * begin, const char * end, Value* removed);
508
510
/* * \brief Remove the indexed array element.
509
511
@@ -518,8 +520,8 @@ Json::Value obj_value(Json::objectValue); // {}
518
520
bool isMember (const char * key) const ;
519
521
// / Return true if the object has a member named key.
520
522
// / \param key may contain embedded nulls.
521
- bool isMember (const std::string & key) const ;
522
- // / Same as isMember(std::string const& key)const
523
+ bool isMember (const String & key) const ;
524
+ // / Same as isMember(String const& key)const
523
525
bool isMember (const char * begin, const char * end) const ;
524
526
#ifdef JSON_USE_CPPTL
525
527
// / Return true if the object has a member named key.
@@ -539,17 +541,17 @@ Json::Value obj_value(Json::objectValue); // {}
539
541
// # endif
540
542
541
543
// / \deprecated Always pass len.
542
- JSONCPP_DEPRECATED (" Use setComment(std::string const&) instead." )
544
+ JSONCPP_DEPRECATED (" Use setComment(String const&) instead." )
543
545
void setComment (const char * comment, CommentPlacement placement);
544
546
// / Comments must be //... or /* ... */
545
547
void setComment (const char * comment, size_t len, CommentPlacement placement);
546
548
// / Comments must be //... or /* ... */
547
- void setComment (const std::string & comment, CommentPlacement placement);
549
+ void setComment (const String & comment, CommentPlacement placement);
548
550
bool hasComment (CommentPlacement placement) const ;
549
551
// / Include delimiters and embedded newlines.
550
- std::string getComment (CommentPlacement placement) const ;
552
+ String getComment (CommentPlacement placement) const ;
551
553
552
- std::string toStyledString () const ;
554
+ String toStyledString () const ;
553
555
554
556
const_iterator begin () const ;
555
557
const_iterator end () const ;
@@ -613,21 +615,22 @@ Json::Value obj_value(Json::objectValue); // {}
613
615
template <class _Value >
614
616
class JSON_API PathArgument {
615
617
public:
618
+ typedef typename _Value::String String;
616
619
template <typename T>
617
620
friend class Path ;
618
621
619
622
PathArgument ();
620
623
PathArgument (ArrayIndex index);
621
624
PathArgument (const char * key);
622
- PathArgument (const std::string & key);
625
+ PathArgument (const String & key);
623
626
624
627
private:
625
628
enum Kind {
626
629
kindNone = 0 ,
627
630
kindIndex,
628
631
kindKey
629
632
};
630
- std::string key_;
633
+ String key_;
631
634
ArrayIndex index_;
632
635
Kind kind_;
633
636
};
@@ -646,7 +649,8 @@ class JSON_API PathArgument {
646
649
template <class _Value >
647
650
class JSON_API Path {
648
651
public:
649
- Path (const std::string& path,
652
+ typedef typename _Value::String String;
653
+ Path (const String& path,
650
654
const PathArgument<_Value>& a1 = PathArgument<_Value>(),
651
655
const PathArgument<_Value>& a2 = PathArgument<_Value>(),
652
656
const PathArgument<_Value>& a3 = PathArgument<_Value>(),
@@ -663,12 +667,12 @@ class JSON_API Path {
663
667
typedef std::vector<const PathArgument<_Value>*> InArgs;
664
668
typedef std::vector<PathArgument<_Value>> Args;
665
669
666
- void makePath (const std::string & path, const InArgs& in);
667
- void addPathInArg (const std::string & path,
670
+ void makePath (const String & path, const InArgs& in);
671
+ void addPathInArg (const String & path,
668
672
const InArgs& in,
669
673
typename InArgs::const_iterator& itInArg,
670
674
typename PathArgument<_Value>::Kind kind);
671
- void invalidPath (const std::string & path, int location);
675
+ void invalidPath (const String & path, int location);
672
676
673
677
Args args_;
674
678
};
@@ -679,6 +683,7 @@ class JSON_API Path {
679
683
template <class _Value >
680
684
class JSON_API ValueIteratorBase {
681
685
public:
686
+ typedef typename _Value::String String;
682
687
typedef std::bidirectional_iterator_tag iterator_category;
683
688
typedef unsigned int size_t ;
684
689
typedef int difference_type;
@@ -702,7 +707,7 @@ class JSON_API ValueIteratorBase {
702
707
// / Return the member name of the referenced Value, or "" if it is not an
703
708
// / objectValue.
704
709
// / \note Avoid `c_str()` on result, as embedded zeroes are possible.
705
- std::string name () const ;
710
+ String name () const ;
706
711
707
712
// / Return the member name of the referenced Value. "" if it is not an
708
713
// / objectValue.
0 commit comments