mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-10-18 03:29:46 +02:00
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.
This commit is contained in:
@@ -8,16 +8,13 @@
|
||||
#include <json/value.h>
|
||||
#include <json/writer.h>
|
||||
#endif // if !defined(JSON_IS_AMALGAMATION)
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
#ifdef JSON_USE_CPPTL
|
||||
#include <cpptl/conststring.h>
|
||||
#endif
|
||||
#include <algorithm> // min()
|
||||
#include <cstddef> // size_t
|
||||
|
||||
// Provide implementation equivalent of std::snprintf for older _MSC compilers
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
@@ -419,14 +416,6 @@ Value::Value(const StaticString& value) {
|
||||
value_.string_ = const_cast<char*>(value.c_str());
|
||||
}
|
||||
|
||||
#ifdef JSON_USE_CPPTL
|
||||
Value::Value(const CppTL::ConstString& value) {
|
||||
initBasic(stringValue, true);
|
||||
value_.string_ = duplicateAndPrefixStringValue(
|
||||
value, static_cast<unsigned>(value.length()));
|
||||
}
|
||||
#endif
|
||||
|
||||
Value::Value(bool value) {
|
||||
initBasic(booleanValue);
|
||||
value_.bool_ = value;
|
||||
@@ -654,15 +643,6 @@ String Value::asString() const {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef JSON_USE_CPPTL
|
||||
CppTL::ConstString Value::asConstString() const {
|
||||
unsigned len;
|
||||
char const* str;
|
||||
decodePrefixedString(isAllocated(), value_.string_, &len, &str);
|
||||
return CppTL::ConstString(str, len);
|
||||
}
|
||||
#endif
|
||||
|
||||
Value::Int Value::asInt() const {
|
||||
switch (type()) {
|
||||
case intValue:
|
||||
@@ -1135,18 +1115,6 @@ Value& Value::operator[](const StaticString& key) {
|
||||
return resolveReference(key.c_str());
|
||||
}
|
||||
|
||||
#ifdef JSON_USE_CPPTL
|
||||
Value& Value::operator[](const CppTL::ConstString& key) {
|
||||
return resolveReference(key.c_str(), key.end_c_str());
|
||||
}
|
||||
Value const& Value::operator[](CppTL::ConstString const& key) const {
|
||||
Value const* found = find(key.c_str(), key.end_c_str());
|
||||
if (!found)
|
||||
return nullSingleton();
|
||||
return *found;
|
||||
}
|
||||
#endif
|
||||
|
||||
Value& Value::append(const Value& value) { return append(Value(value)); }
|
||||
|
||||
Value& Value::append(Value&& value) {
|
||||
@@ -1240,13 +1208,6 @@ bool Value::removeIndex(ArrayIndex index, Value* removed) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef JSON_USE_CPPTL
|
||||
Value Value::get(const CppTL::ConstString& key,
|
||||
const Value& defaultValue) const {
|
||||
return get(key.c_str(), key.end_c_str(), defaultValue);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool Value::isMember(char const* begin, char const* end) const {
|
||||
Value const* value = find(begin, end);
|
||||
return nullptr != value;
|
||||
@@ -1258,12 +1219,6 @@ bool Value::isMember(String const& key) const {
|
||||
return isMember(key.data(), key.data() + key.length());
|
||||
}
|
||||
|
||||
#ifdef JSON_USE_CPPTL
|
||||
bool Value::isMember(const CppTL::ConstString& key) const {
|
||||
return isMember(key.c_str(), key.end_c_str());
|
||||
}
|
||||
#endif
|
||||
|
||||
Value::Members Value::getMemberNames() const {
|
||||
JSON_ASSERT_MESSAGE(
|
||||
type() == nullValue || type() == objectValue,
|
||||
@@ -1279,31 +1234,6 @@ Value::Members Value::getMemberNames() const {
|
||||
}
|
||||
return members;
|
||||
}
|
||||
//
|
||||
//# ifdef JSON_USE_CPPTL
|
||||
// EnumMemberNames
|
||||
// Value::enumMemberNames() const
|
||||
//{
|
||||
// if ( type() == objectValue )
|
||||
// {
|
||||
// return CppTL::Enum::any( CppTL::Enum::transform(
|
||||
// CppTL::Enum::keys( *(value_.map_), CppTL::Type<const CZString &>() ),
|
||||
// MemberNamesTransform() ) );
|
||||
// }
|
||||
// return EnumMemberNames();
|
||||
//}
|
||||
//
|
||||
//
|
||||
// EnumValues
|
||||
// Value::enumValues() const
|
||||
//{
|
||||
// if ( type() == objectValue || type() == arrayValue )
|
||||
// return CppTL::Enum::anyValues( *(value_.map_),
|
||||
// CppTL::Type<const Value &>() );
|
||||
// return EnumValues();
|
||||
//}
|
||||
//
|
||||
//# endif
|
||||
|
||||
static bool IsIntegral(double d) {
|
||||
double integral_part;
|
||||
|
Reference in New Issue
Block a user