From 908d0cbd12baeef3e0e04f84d49d1d68713385c1 Mon Sep 17 00:00:00 2001 From: houxiao <houxiao@454eff88-639b-444f-9e54-f578c98de674> Date: 星期三, 09 八月 2017 11:10:56 +0800 Subject: [PATCH] add jsoncpp lib --- VisitFace/RtspNativeCodec/app/libs/jsoncpp/include/json/json_valueiterator.inl | 167 +++++++++++++++++++++++++++++++++ VisitFace/RtspNativeCodec/app/libs/jsoncpp/lib/armeabi/libjsoncpp.so | 0 VisitFace/RtspNativeCodec/app/libs/jsoncpp/lib/x86_64/libjsoncpp.so | 0 VisitFace/RtspNativeCodec/app/libs/jsoncpp/lib/x86/libjsoncpp.so | 0 VisitFace/RtspNativeCodec/app/libs/jsoncpp/include/json/json_tool.h | 117 +++++++++++++++++++++++ VisitFace/RtspNativeCodec/app/libs/jsoncpp/lib/armeabi-v7a/libjsoncpp.so | 0 VisitFace/RtspNativeCodec/app/libs/jsoncpp/lib/arm64-v8a/libjsoncpp.so | 0 7 files changed, 284 insertions(+), 0 deletions(-) diff --git a/VisitFace/RtspNativeCodec/app/libs/jsoncpp/include/json/json_tool.h b/VisitFace/RtspNativeCodec/app/libs/jsoncpp/include/json/json_tool.h new file mode 100644 index 0000000..4316178 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/jsoncpp/include/json/json_tool.h @@ -0,0 +1,117 @@ +// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED +#define LIB_JSONCPP_JSON_TOOL_H_INCLUDED + + +// Also support old flag NO_LOCALE_SUPPORT +#ifdef NO_LOCALE_SUPPORT +#define JSONCPP_NO_LOCALE_SUPPORT +#endif + +#ifndef JSONCPP_NO_LOCALE_SUPPORT +#include <clocale> +#endif + +/* This header provides common string manipulation support, such as UTF-8, + * portable conversion from/to string... + * + * It is an internal header that must not be exposed. + */ + +namespace Json { +static char getDecimalPoint() { +#ifdef JSONCPP_NO_LOCALE_SUPPORT + return '\0'; +#else + struct lconv* lc = localeconv(); + return lc ? *(lc->decimal_point) : '\0'; +#endif +} + +/// Converts a unicode code-point to UTF-8. +static inline JSONCPP_STRING codePointToUTF8(unsigned int cp) { + JSONCPP_STRING result; + + // based on description from http://en.wikipedia.org/wiki/UTF-8 + + if (cp <= 0x7f) { + result.resize(1); + result[0] = static_cast<char>(cp); + } else if (cp <= 0x7FF) { + result.resize(2); + result[1] = static_cast<char>(0x80 | (0x3f & cp)); + result[0] = static_cast<char>(0xC0 | (0x1f & (cp >> 6))); + } else if (cp <= 0xFFFF) { + result.resize(3); + result[2] = static_cast<char>(0x80 | (0x3f & cp)); + result[1] = static_cast<char>(0x80 | (0x3f & (cp >> 6))); + result[0] = static_cast<char>(0xE0 | (0xf & (cp >> 12))); + } else if (cp <= 0x10FFFF) { + result.resize(4); + result[3] = static_cast<char>(0x80 | (0x3f & cp)); + result[2] = static_cast<char>(0x80 | (0x3f & (cp >> 6))); + result[1] = static_cast<char>(0x80 | (0x3f & (cp >> 12))); + result[0] = static_cast<char>(0xF0 | (0x7 & (cp >> 18))); + } + + return result; +} + +/// Returns true if ch is a control character (in range [1,31]). +static inline bool isControlCharacter(char ch) { return ch > 0 && ch <= 0x1F; } + +enum { + /// Constant that specify the size of the buffer that must be passed to + /// uintToString. + uintToStringBufferSize = 3 * sizeof(LargestUInt) + 1 +}; + +// Defines a char buffer for use with uintToString(). +typedef char UIntToStringBuffer[uintToStringBufferSize]; + +/** Converts an unsigned integer to string. + * @param value Unsigned interger to convert to string + * @param current Input/Output string buffer. + * Must have at least uintToStringBufferSize chars free. + */ +static inline void uintToString(LargestUInt value, char*& current) { + *--current = 0; + do { + *--current = static_cast<char>(value % 10U + static_cast<unsigned>('0')); + value /= 10; + } while (value != 0); +} + +/** Change ',' to '.' everywhere in buffer. + * + * We had a sophisticated way, but it did not work in WinCE. + * @see https://github.com/open-source-parsers/jsoncpp/pull/9 + */ +static inline void fixNumericLocale(char* begin, char* end) { + while (begin < end) { + if (*begin == ',') { + *begin = '.'; + } + ++begin; + } +} + +static inline void fixNumericLocaleInput(char* begin, char* end) { + char decimalPoint = getDecimalPoint(); + if (decimalPoint != '\0' && decimalPoint != '.') { + while (begin < end) { + if (*begin == '.') { + *begin = decimalPoint; + } + ++begin; + } + } +} + +} // namespace Json { + +#endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED diff --git a/VisitFace/RtspNativeCodec/app/libs/jsoncpp/include/json/json_valueiterator.inl b/VisitFace/RtspNativeCodec/app/libs/jsoncpp/include/json/json_valueiterator.inl new file mode 100644 index 0000000..5243bfe --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/jsoncpp/include/json/json_valueiterator.inl @@ -0,0 +1,167 @@ +// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +// included by json_value.cpp + +namespace Json { + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class ValueIteratorBase +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +ValueIteratorBase::ValueIteratorBase() + : current_(), isNull_(true) { +} + +ValueIteratorBase::ValueIteratorBase( + const Value::ObjectValues::iterator& current) + : current_(current), isNull_(false) {} + +Value& ValueIteratorBase::deref() const { + return current_->second; +} + +void ValueIteratorBase::increment() { + ++current_; +} + +void ValueIteratorBase::decrement() { + --current_; +} + +ValueIteratorBase::difference_type +ValueIteratorBase::computeDistance(const SelfType& other) const { +#ifdef JSON_USE_CPPTL_SMALLMAP + return other.current_ - current_; +#else + // Iterator for null value are initialized using the default + // constructor, which initialize current_ to the default + // std::map::iterator. As begin() and end() are two instance + // of the default std::map::iterator, they can not be compared. + // To allow this, we handle this comparison specifically. + if (isNull_ && other.isNull_) { + return 0; + } + + // Usage of std::distance is not portable (does not compile with Sun Studio 12 + // RogueWave STL, + // which is the one used by default). + // Using a portable hand-made version for non random iterator instead: + // return difference_type( std::distance( current_, other.current_ ) ); + difference_type myDistance = 0; + for (Value::ObjectValues::iterator it = current_; it != other.current_; + ++it) { + ++myDistance; + } + return myDistance; +#endif +} + +bool ValueIteratorBase::isEqual(const SelfType& other) const { + if (isNull_) { + return other.isNull_; + } + return current_ == other.current_; +} + +void ValueIteratorBase::copy(const SelfType& other) { + current_ = other.current_; + isNull_ = other.isNull_; +} + +Value ValueIteratorBase::key() const { + const Value::CZString czstring = (*current_).first; + if (czstring.data()) { + if (czstring.isStaticString()) + return Value(StaticString(czstring.data())); + return Value(czstring.data(), czstring.data() + czstring.length()); + } + return Value(czstring.index()); +} + +UInt ValueIteratorBase::index() const { + const Value::CZString czstring = (*current_).first; + if (!czstring.data()) + return czstring.index(); + return Value::UInt(-1); +} + +JSONCPP_STRING ValueIteratorBase::name() const { + char const* keey; + char const* end; + keey = memberName(&end); + if (!keey) return JSONCPP_STRING(); + return JSONCPP_STRING(keey, end); +} + +char const* ValueIteratorBase::memberName() const { + const char* cname = (*current_).first.data(); + return cname ? cname : ""; +} + +char const* ValueIteratorBase::memberName(char const** end) const { + const char* cname = (*current_).first.data(); + if (!cname) { + *end = NULL; + return NULL; + } + *end = cname + (*current_).first.length(); + return cname; +} + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class ValueConstIterator +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +ValueConstIterator::ValueConstIterator() {} + +ValueConstIterator::ValueConstIterator( + const Value::ObjectValues::iterator& current) + : ValueIteratorBase(current) {} + +ValueConstIterator::ValueConstIterator(ValueIterator const& other) + : ValueIteratorBase(other) {} + +ValueConstIterator& ValueConstIterator:: +operator=(const ValueIteratorBase& other) { + copy(other); + return *this; +} + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class ValueIterator +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +ValueIterator::ValueIterator() {} + +ValueIterator::ValueIterator(const Value::ObjectValues::iterator& current) + : ValueIteratorBase(current) {} + +ValueIterator::ValueIterator(const ValueConstIterator& other) + : ValueIteratorBase(other) { + throwRuntimeError("ConstIterator to Iterator should never be allowed."); +} + +ValueIterator::ValueIterator(const ValueIterator& other) + : ValueIteratorBase(other) {} + +ValueIterator& ValueIterator::operator=(const SelfType& other) { + copy(other); + return *this; +} + +} // namespace Json diff --git a/VisitFace/RtspNativeCodec/app/libs/jsoncpp/lib/arm64-v8a/libjsoncpp.so b/VisitFace/RtspNativeCodec/app/libs/jsoncpp/lib/arm64-v8a/libjsoncpp.so new file mode 100644 index 0000000..c1286e4 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/jsoncpp/lib/arm64-v8a/libjsoncpp.so Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/jsoncpp/lib/armeabi-v7a/libjsoncpp.so b/VisitFace/RtspNativeCodec/app/libs/jsoncpp/lib/armeabi-v7a/libjsoncpp.so new file mode 100644 index 0000000..875c600 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/jsoncpp/lib/armeabi-v7a/libjsoncpp.so Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/jsoncpp/lib/armeabi/libjsoncpp.so b/VisitFace/RtspNativeCodec/app/libs/jsoncpp/lib/armeabi/libjsoncpp.so new file mode 100644 index 0000000..52655f4 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/jsoncpp/lib/armeabi/libjsoncpp.so Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/jsoncpp/lib/x86/libjsoncpp.so b/VisitFace/RtspNativeCodec/app/libs/jsoncpp/lib/x86/libjsoncpp.so new file mode 100644 index 0000000..cfd77a3 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/jsoncpp/lib/x86/libjsoncpp.so Binary files differ diff --git a/VisitFace/RtspNativeCodec/app/libs/jsoncpp/lib/x86_64/libjsoncpp.so b/VisitFace/RtspNativeCodec/app/libs/jsoncpp/lib/x86_64/libjsoncpp.so new file mode 100644 index 0000000..f5108eb --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/libs/jsoncpp/lib/x86_64/libjsoncpp.so Binary files differ -- Gitblit v1.8.0