Skip to content

Commit 9704ced

Browse files
committed
Issue 1100: Drop CPPTL support
CPPTL support is no longer relevant to JsonCpp, and can be removed from the library. This patch removes all mentions of CPPTL, by removing all definitions and code sections conditionally compiled only when JsonCpp is used with CPPTL. Include guards are also renamed to not refer to CPPTL where appropriate.
1 parent 781eec4 commit 9704ced

File tree

10 files changed

+21
-185
lines changed

10 files changed

+21
-185
lines changed

include/json/allocator.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// recognized in your jurisdiction.
44
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
55

6-
#ifndef CPPTL_JSON_ALLOCATOR_H_INCLUDED
7-
#define CPPTL_JSON_ALLOCATOR_H_INCLUDED
6+
#ifndef JSON_ALLOCATOR_H_INCLUDED
7+
#define JSON_ALLOCATOR_H_INCLUDED
88

99
#include <cstring>
1010
#include <memory>
@@ -86,4 +86,4 @@ bool operator!=(const SecureAllocator<T>&, const SecureAllocator<U>&) {
8686

8787
#pragma pack(pop)
8888

89-
#endif // CPPTL_JSON_ALLOCATOR_H_INCLUDED
89+
#endif // JSON_ALLOCATOR_H_INCLUDED

include/json/assertions.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// recognized in your jurisdiction.
44
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
55

6-
#ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED
7-
#define CPPTL_JSON_ASSERTIONS_H_INCLUDED
6+
#ifndef JSON_ASSERTIONS_H_INCLUDED
7+
#define JSON_ASSERTIONS_H_INCLUDED
88

99
#include <cstdlib>
1010
#include <sstream>
@@ -56,4 +56,4 @@
5656
JSON_FAIL_MESSAGE(message); \
5757
}
5858

59-
#endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED
59+
#endif // JSON_ASSERTIONS_H_INCLUDED

include/json/autolink.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,10 @@
88

99
#include "config.h"
1010

11-
#ifdef JSON_IN_CPPTL
12-
#include <cpptl/cpptl_autolink.h>
13-
#endif
14-
15-
#if !defined(JSON_NO_AUTOLINK) && !defined(JSON_DLL_BUILD) && \
16-
!defined(JSON_IN_CPPTL)
17-
#define CPPTL_AUTOLINK_NAME "json"
18-
#undef CPPTL_AUTOLINK_DLL
11+
#if !defined(JSON_NO_AUTOLINK) && !defined(JSON_DLL_BUILD)
12+
#define AUTOLINK_NAME "json"
1913
#ifdef JSON_DLL
20-
#define CPPTL_AUTOLINK_DLL
14+
#define AUTOLINK_DLL
2115
#endif
2216
#include "autolink.h"
2317
#endif

include/json/config.h

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,6 @@
1414
#include <string>
1515
#include <type_traits>
1616

17-
/// If defined, indicates that json library is embedded in CppTL library.
18-
//# define JSON_IN_CPPTL 1
19-
20-
/// If defined, indicates that json may leverage CppTL library
21-
//# define JSON_USE_CPPTL 1
22-
/// If defined, indicates that cpptl vector based map should be used instead of
23-
/// std::map
24-
/// as Value container.
25-
//# define JSON_USE_CPPTL_SMALLMAP 1
26-
2717
// If non-zero, the library uses exceptions to report bad input instead of C
2818
// assertion macros. The default is to use exceptions.
2919
#ifndef JSON_USE_EXCEPTION
@@ -40,28 +30,6 @@
4030
/// Remarks: it is automatically defined in the generated amalgamated header.
4131
// #define JSON_IS_AMALGAMATION
4232

43-
#ifdef JSON_IN_CPPTL
44-
#include <cpptl/config.h>
45-
#ifndef JSON_USE_CPPTL
46-
#define JSON_USE_CPPTL 1
47-
#endif
48-
#endif
49-
50-
#ifdef JSON_IN_CPPTL
51-
#define JSON_API CPPTL_API
52-
#elif defined(JSON_DLL_BUILD)
53-
#if defined(_MSC_VER) || defined(__MINGW32__)
54-
#define JSON_API __declspec(dllexport)
55-
#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
56-
#elif defined(__GNUC__) || defined(__clang__)
57-
#define JSON_API __attribute__((visibility("default")))
58-
#endif // if defined(_MSC_VER)
59-
#elif defined(JSON_DLL)
60-
#if defined(_MSC_VER) || defined(__MINGW32__)
61-
#define JSON_API __declspec(dllimport)
62-
#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
63-
#endif // if defined(_MSC_VER)
64-
#endif // ifdef JSON_IN_CPPTL
6533
#if !defined(JSON_API)
6634
#define JSON_API
6735
#endif

include/json/json_features.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// recognized in your jurisdiction.
44
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
55

6-
#ifndef CPPTL_JSON_FEATURES_H_INCLUDED
7-
#define CPPTL_JSON_FEATURES_H_INCLUDED
6+
#ifndef JSON_FEATURES_H_INCLUDED
7+
#define JSON_FEATURES_H_INCLUDED
88

99
#if !defined(JSON_IS_AMALGAMATION)
1010
#include "forwards.h"
@@ -64,4 +64,4 @@ class JSON_API Features {
6464

6565
#pragma pack(pop)
6666

67-
#endif // CPPTL_JSON_FEATURES_H_INCLUDED
67+
#endif // JSON_FEATURES_H_INCLUDED

include/json/reader.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// recognized in your jurisdiction.
44
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
55

6-
#ifndef CPPTL_JSON_READER_H_INCLUDED
7-
#define CPPTL_JSON_READER_H_INCLUDED
6+
#ifndef JSON_READER_H_INCLUDED
7+
#define JSON_READER_H_INCLUDED
88

99
#if !defined(JSON_IS_AMALGAMATION)
1010
#include "json_features.h"
@@ -400,4 +400,4 @@ JSON_API IStream& operator>>(IStream&, Value&);
400400
#pragma warning(pop)
401401
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
402402

403-
#endif // CPPTL_JSON_READER_H_INCLUDED
403+
#endif // JSON_READER_H_INCLUDED

include/json/value.h

Lines changed: 4 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// recognized in your jurisdiction.
44
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
55

6-
#ifndef CPPTL_JSON_H_INCLUDED
7-
#define CPPTL_JSON_H_INCLUDED
6+
#ifndef JSON_H_INCLUDED
7+
#define JSON_H_INCLUDED
88

99
#if !defined(JSON_IS_AMALGAMATION)
1010
#include "forwards.h"
@@ -23,19 +23,11 @@
2323

2424
#include <array>
2525
#include <exception>
26+
#include <map>
2627
#include <memory>
2728
#include <string>
2829
#include <vector>
2930

30-
#ifndef JSON_USE_CPPTL_SMALLMAP
31-
#include <map>
32-
#else
33-
#include <cpptl/smallmap.h>
34-
#endif
35-
#ifdef JSON_USE_CPPTL
36-
#include <cpptl/forwards.h>
37-
#endif
38-
3931
// Disable warning C4251: <data member>: <type> needs to have dll-interface to
4032
// be used by...
4133
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
@@ -120,11 +112,6 @@ enum PrecisionType {
120112
decimalPlaces ///< we set max number of digits after "." in string
121113
};
122114

123-
//# ifdef JSON_USE_CPPTL
124-
// typedef CppTL::AnyEnumerator<const char *> EnumMemberNames;
125-
// typedef CppTL::AnyEnumerator<const Value &> EnumValues;
126-
//# endif
127-
128115
/** \brief Lightweight wrapper to tag static string.
129116
*
130117
* Value constructor and objectValue member assignment takes advantage of the
@@ -287,11 +274,7 @@ class JSON_API Value {
287274
};
288275

289276
public:
290-
#ifndef JSON_USE_CPPTL_SMALLMAP
291277
typedef std::map<CZString, Value> ObjectValues;
292-
#else
293-
typedef CppTL::SmallMap<CZString, Value> ObjectValues;
294-
#endif // ifndef JSON_USE_CPPTL_SMALLMAP
295278
#endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
296279

297280
public:
@@ -340,9 +323,6 @@ class JSON_API Value {
340323
*/
341324
Value(const StaticString& value);
342325
Value(const String& value);
343-
#ifdef JSON_USE_CPPTL
344-
Value(const CppTL::ConstString& value);
345-
#endif
346326
Value(bool value);
347327
Value(const Value& other);
348328
Value(Value&& other);
@@ -384,9 +364,6 @@ class JSON_API Value {
384364
* \return false if !string. (Seg-fault if str or end are NULL.)
385365
*/
386366
bool getString(char const** begin, char const** end) const;
387-
#ifdef JSON_USE_CPPTL
388-
CppTL::ConstString asConstString() const;
389-
#endif
390367
Int asInt() const;
391368
UInt asUInt() const;
392369
#if defined(JSON_HAS_INT64)
@@ -498,13 +475,6 @@ class JSON_API Value {
498475
* \endcode
499476
*/
500477
Value& operator[](const StaticString& key);
501-
#ifdef JSON_USE_CPPTL
502-
/// Access an object value by name, create a null member if it does not exist.
503-
Value& operator[](const CppTL::ConstString& key);
504-
/// Access an object value by name, returns null if there is no member with
505-
/// that name.
506-
const Value& operator[](const CppTL::ConstString& key) const;
507-
#endif
508478
/// Return the member named key if it exist, defaultValue otherwise.
509479
/// \note deep copy
510480
Value get(const char* key, const Value& defaultValue) const;
@@ -517,11 +487,6 @@ class JSON_API Value {
517487
/// \note deep copy
518488
/// \param key may contain embedded nulls.
519489
Value get(const String& key, const Value& defaultValue) const;
520-
#ifdef JSON_USE_CPPTL
521-
/// Return the member named key if it exist, defaultValue otherwise.
522-
/// \note deep copy
523-
Value get(const CppTL::ConstString& key, const Value& defaultValue) const;
524-
#endif
525490
/// Most general and efficient version of isMember()const, get()const,
526491
/// and operator[]const
527492
/// \note As stated elsewhere, behavior is undefined if (end-begin) >= 2^30
@@ -567,10 +532,6 @@ class JSON_API Value {
567532
bool isMember(const String& key) const;
568533
/// Same as isMember(String const& key)const
569534
bool isMember(const char* begin, const char* end) const;
570-
#ifdef JSON_USE_CPPTL
571-
/// Return true if the object has a member named key.
572-
bool isMember(const CppTL::ConstString& key) const;
573-
#endif
574535

575536
/// \brief Return a list of the member names.
576537
///
@@ -579,11 +540,6 @@ class JSON_API Value {
579540
/// \post if type() was nullValue, it remains nullValue
580541
Members getMemberNames() const;
581542

582-
//# ifdef JSON_USE_CPPTL
583-
// EnumMemberNames enumMemberNames() const;
584-
// EnumValues enumValues() const;
585-
//# endif
586-
587543
/// \deprecated Always pass len.
588544
JSONCPP_DEPRECATED("Use setComment(String const&) instead.")
589545
void setComment(const char* comment, CommentPlacement placement) {
@@ -706,11 +662,6 @@ template <> inline float Value::as<float>() const { return asFloat(); }
706662
template <> inline const char* Value::as<const char*>() const {
707663
return asCString();
708664
}
709-
#ifdef JSON_USE_CPPTL
710-
template <> inline CppTL::ConstString Value::as<CppTL::ConstString>() const {
711-
return asConstString();
712-
}
713-
#endif
714665

715666
/** \brief Experimental and untested: represents an element of the "path" to
716667
* access a node.
@@ -960,4 +911,4 @@ inline void swap(Value& a, Value& b) { a.swap(b); }
960911
#pragma warning(pop)
961912
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
962913

963-
#endif // CPPTL_JSON_H_INCLUDED
914+
#endif // JSON_H_INCLUDED

0 commit comments

Comments
 (0)