Skip to content

Commit

Permalink
Merge pull request open-source-parsers#1101 from open-source-parsers/…
Browse files Browse the repository at this point in the history
…drop_cpptl_support

Issue 1100: Drop CPPTL support
  • Loading branch information
cdunn2001 authored Nov 15, 2019
2 parents 781eec4 + a481201 commit cfc3e92
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 192 deletions.
6 changes: 3 additions & 3 deletions include/json/allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// recognized in your jurisdiction.
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE

#ifndef CPPTL_JSON_ALLOCATOR_H_INCLUDED
#define CPPTL_JSON_ALLOCATOR_H_INCLUDED
#ifndef JSON_ALLOCATOR_H_INCLUDED
#define JSON_ALLOCATOR_H_INCLUDED

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

#pragma pack(pop)

#endif // CPPTL_JSON_ALLOCATOR_H_INCLUDED
#endif // JSON_ALLOCATOR_H_INCLUDED
6 changes: 3 additions & 3 deletions include/json/assertions.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// recognized in your jurisdiction.
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE

#ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED
#define CPPTL_JSON_ASSERTIONS_H_INCLUDED
#ifndef JSON_ASSERTIONS_H_INCLUDED
#define JSON_ASSERTIONS_H_INCLUDED

#include <cstdlib>
#include <sstream>
Expand Down Expand Up @@ -56,4 +56,4 @@
JSON_FAIL_MESSAGE(message); \
}

#endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED
#endif // JSON_ASSERTIONS_H_INCLUDED
25 changes: 0 additions & 25 deletions include/json/autolink.h

This file was deleted.

26 changes: 5 additions & 21 deletions include/json/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@
#include <string>
#include <type_traits>

/// If defined, indicates that json library is embedded in CppTL library.
//# define JSON_IN_CPPTL 1

/// If defined, indicates that json may leverage CppTL library
//# define JSON_USE_CPPTL 1
/// If defined, indicates that cpptl vector based map should be used instead of
/// std::map
/// as Value container.
//# define JSON_USE_CPPTL_SMALLMAP 1

// If non-zero, the library uses exceptions to report bad input instead of C
// assertion macros. The default is to use exceptions.
#ifndef JSON_USE_EXCEPTION
Expand All @@ -40,28 +30,22 @@
/// Remarks: it is automatically defined in the generated amalgamated header.
// #define JSON_IS_AMALGAMATION

#ifdef JSON_IN_CPPTL
#include <cpptl/config.h>
#ifndef JSON_USE_CPPTL
#define JSON_USE_CPPTL 1
#endif
#endif

#ifdef JSON_IN_CPPTL
#define JSON_API CPPTL_API
#elif defined(JSON_DLL_BUILD)
// Export macros for DLL visibility
#if defined(JSON_DLL_BUILD)
#if defined(_MSC_VER) || defined(__MINGW32__)
#define JSON_API __declspec(dllexport)
#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
#elif defined(__GNUC__) || defined(__clang__)
#define JSON_API __attribute__((visibility("default")))
#endif // if defined(_MSC_VER)

#elif defined(JSON_DLL)
#if defined(_MSC_VER) || defined(__MINGW32__)
#define JSON_API __declspec(dllimport)
#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
#endif // if defined(_MSC_VER)
#endif // ifdef JSON_IN_CPPTL
#endif // ifdef JSON_DLL_BUILD

#if !defined(JSON_API)
#define JSON_API
#endif
Expand Down
2 changes: 1 addition & 1 deletion include/json/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifndef JSON_JSON_H_INCLUDED
#define JSON_JSON_H_INCLUDED

#include "autolink.h"
#include "config.h"
#include "json_features.h"
#include "reader.h"
#include "value.h"
Expand Down
6 changes: 3 additions & 3 deletions include/json/json_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// recognized in your jurisdiction.
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE

#ifndef CPPTL_JSON_FEATURES_H_INCLUDED
#define CPPTL_JSON_FEATURES_H_INCLUDED
#ifndef JSON_FEATURES_H_INCLUDED
#define JSON_FEATURES_H_INCLUDED

#if !defined(JSON_IS_AMALGAMATION)
#include "forwards.h"
Expand Down Expand Up @@ -64,4 +64,4 @@ class JSON_API Features {

#pragma pack(pop)

#endif // CPPTL_JSON_FEATURES_H_INCLUDED
#endif // JSON_FEATURES_H_INCLUDED
6 changes: 3 additions & 3 deletions include/json/reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// recognized in your jurisdiction.
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE

#ifndef CPPTL_JSON_READER_H_INCLUDED
#define CPPTL_JSON_READER_H_INCLUDED
#ifndef JSON_READER_H_INCLUDED
#define JSON_READER_H_INCLUDED

#if !defined(JSON_IS_AMALGAMATION)
#include "json_features.h"
Expand Down Expand Up @@ -400,4 +400,4 @@ JSON_API IStream& operator>>(IStream&, Value&);
#pragma warning(pop)
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)

#endif // CPPTL_JSON_READER_H_INCLUDED
#endif // JSON_READER_H_INCLUDED
57 changes: 4 additions & 53 deletions include/json/value.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// recognized in your jurisdiction.
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE

#ifndef CPPTL_JSON_H_INCLUDED
#define CPPTL_JSON_H_INCLUDED
#ifndef JSON_H_INCLUDED
#define JSON_H_INCLUDED

#if !defined(JSON_IS_AMALGAMATION)
#include "forwards.h"
Expand All @@ -23,19 +23,11 @@

#include <array>
#include <exception>
#include <map>
#include <memory>
#include <string>
#include <vector>

#ifndef JSON_USE_CPPTL_SMALLMAP
#include <map>
#else
#include <cpptl/smallmap.h>
#endif
#ifdef JSON_USE_CPPTL
#include <cpptl/forwards.h>
#endif

// Disable warning C4251: <data member>: <type> needs to have dll-interface to
// be used by...
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
Expand Down Expand Up @@ -120,11 +112,6 @@ enum PrecisionType {
decimalPlaces ///< we set max number of digits after "." in string
};

//# ifdef JSON_USE_CPPTL
// typedef CppTL::AnyEnumerator<const char *> EnumMemberNames;
// typedef CppTL::AnyEnumerator<const Value &> EnumValues;
//# endif

/** \brief Lightweight wrapper to tag static string.
*
* Value constructor and objectValue member assignment takes advantage of the
Expand Down Expand Up @@ -287,11 +274,7 @@ class JSON_API Value {
};

public:
#ifndef JSON_USE_CPPTL_SMALLMAP
typedef std::map<CZString, Value> ObjectValues;
#else
typedef CppTL::SmallMap<CZString, Value> ObjectValues;
#endif // ifndef JSON_USE_CPPTL_SMALLMAP
#endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION

public:
Expand Down Expand Up @@ -340,9 +323,6 @@ class JSON_API Value {
*/
Value(const StaticString& value);
Value(const String& value);
#ifdef JSON_USE_CPPTL
Value(const CppTL::ConstString& value);
#endif
Value(bool value);
Value(const Value& other);
Value(Value&& other);
Expand Down Expand Up @@ -384,9 +364,6 @@ class JSON_API Value {
* \return false if !string. (Seg-fault if str or end are NULL.)
*/
bool getString(char const** begin, char const** end) const;
#ifdef JSON_USE_CPPTL
CppTL::ConstString asConstString() const;
#endif
Int asInt() const;
UInt asUInt() const;
#if defined(JSON_HAS_INT64)
Expand Down Expand Up @@ -498,13 +475,6 @@ class JSON_API Value {
* \endcode
*/
Value& operator[](const StaticString& key);
#ifdef JSON_USE_CPPTL
/// Access an object value by name, create a null member if it does not exist.
Value& operator[](const CppTL::ConstString& key);
/// Access an object value by name, returns null if there is no member with
/// that name.
const Value& operator[](const CppTL::ConstString& key) const;
#endif
/// Return the member named key if it exist, defaultValue otherwise.
/// \note deep copy
Value get(const char* key, const Value& defaultValue) const;
Expand All @@ -517,11 +487,6 @@ class JSON_API Value {
/// \note deep copy
/// \param key may contain embedded nulls.
Value get(const String& key, const Value& defaultValue) const;
#ifdef JSON_USE_CPPTL
/// Return the member named key if it exist, defaultValue otherwise.
/// \note deep copy
Value get(const CppTL::ConstString& key, const Value& defaultValue) const;
#endif
/// Most general and efficient version of isMember()const, get()const,
/// and operator[]const
/// \note As stated elsewhere, behavior is undefined if (end-begin) >= 2^30
Expand Down Expand Up @@ -567,10 +532,6 @@ class JSON_API Value {
bool isMember(const String& key) const;
/// Same as isMember(String const& key)const
bool isMember(const char* begin, const char* end) const;
#ifdef JSON_USE_CPPTL
/// Return true if the object has a member named key.
bool isMember(const CppTL::ConstString& key) const;
#endif

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

//# ifdef JSON_USE_CPPTL
// EnumMemberNames enumMemberNames() const;
// EnumValues enumValues() const;
//# endif

/// \deprecated Always pass len.
JSONCPP_DEPRECATED("Use setComment(String const&) instead.")
void setComment(const char* comment, CommentPlacement placement) {
Expand Down Expand Up @@ -706,11 +662,6 @@ template <> inline float Value::as<float>() const { return asFloat(); }
template <> inline const char* Value::as<const char*>() const {
return asCString();
}
#ifdef JSON_USE_CPPTL
template <> inline CppTL::ConstString Value::as<CppTL::ConstString>() const {
return asConstString();
}
#endif

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

#endif // CPPTL_JSON_H_INCLUDED
#endif // JSON_H_INCLUDED
1 change: 0 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ project(
jsoncpp_headers = [
'include/json/allocator.h',
'include/json/assertions.h',
'include/json/autolink.h',
'include/json/config.h',
'include/json/json_features.h',
'include/json/forwards.h',
Expand Down
Loading

0 comments on commit cfc3e92

Please sign in to comment.