mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-10-15 23:20:05 +02:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f164288646 | ||
![]() |
3bfd215938 | ||
![]() |
400b744195 | ||
![]() |
bd55164089 | ||
![]() |
4c5832a0be | ||
![]() |
8ba9875962 | ||
![]() |
9c91b995dd |
21
dev.makefile
21
dev.makefile
@@ -1,5 +1,19 @@
|
|||||||
all: build test-amalgamate
|
# This is only for jsoncpp developers/contributors.
|
||||||
|
# We use this to sign releases, generate documentation, etc.
|
||||||
|
VER?=$(shell cat version)
|
||||||
|
|
||||||
|
default:
|
||||||
|
@echo "VER=${VER}"
|
||||||
|
sign: jsoncpp-${VER}.tar.gz
|
||||||
|
gpg --armor --detach-sign $<
|
||||||
|
gpg --verify $<.asc
|
||||||
|
# Then upload .asc to the release.
|
||||||
|
jsoncpp-%.tar.gz:
|
||||||
|
curl https://github.com/open-source-parsers/jsoncpp/archive/$*.tar.gz -o $@
|
||||||
|
dox:
|
||||||
|
python doxybuild.py --doxygen=$$(which doxygen) --in doc/web_doxyfile.in
|
||||||
|
rsync -va --delete dist/doxygen/jsoncpp-api-html-${VER}/ ../jsoncpp-docs/doxygen/
|
||||||
|
# Then 'git add -A' and 'git push' in jsoncpp-docs.
|
||||||
build:
|
build:
|
||||||
mkdir -p build/debug
|
mkdir -p build/debug
|
||||||
cd build/debug; cmake -DCMAKE_BUILD_TYPE=debug -DJSONCPP_LIB_BUILD_SHARED=ON -G "Unix Makefiles" ../..
|
cd build/debug; cmake -DCMAKE_BUILD_TYPE=debug -DJSONCPP_LIB_BUILD_SHARED=ON -G "Unix Makefiles" ../..
|
||||||
@@ -7,8 +21,11 @@ build:
|
|||||||
|
|
||||||
# Currently, this depends on include/json/version.h generated
|
# Currently, this depends on include/json/version.h generated
|
||||||
# by cmake.
|
# by cmake.
|
||||||
test-amalgamate: build
|
test-amalgamate:
|
||||||
python2.7 amalgamate.py
|
python2.7 amalgamate.py
|
||||||
python3.4 amalgamate.py
|
python3.4 amalgamate.py
|
||||||
|
|
||||||
|
clean:
|
||||||
|
\rm -rf *.gz *.asc dist/
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
|
@@ -946,7 +946,7 @@ public:
|
|||||||
bool operator!=(const SelfType& other) const { return !isEqual(other); }
|
bool operator!=(const SelfType& other) const { return !isEqual(other); }
|
||||||
|
|
||||||
difference_type operator-(const SelfType& other) const {
|
difference_type operator-(const SelfType& other) const {
|
||||||
return computeDistance(other);
|
return other.computeDistance(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return either the index or the member name of the referenced value as a
|
/// Return either the index or the member name of the referenced value as a
|
||||||
|
@@ -4,10 +4,10 @@
|
|||||||
#ifndef JSON_VERSION_H_INCLUDED
|
#ifndef JSON_VERSION_H_INCLUDED
|
||||||
# define JSON_VERSION_H_INCLUDED
|
# define JSON_VERSION_H_INCLUDED
|
||||||
|
|
||||||
# define JSONCPP_VERSION_STRING "1.4.1"
|
# define JSONCPP_VERSION_STRING "1.4.2"
|
||||||
# define JSONCPP_VERSION_MAJOR 1
|
# define JSONCPP_VERSION_MAJOR 1
|
||||||
# define JSONCPP_VERSION_MINOR 4
|
# define JSONCPP_VERSION_MINOR 4
|
||||||
# define JSONCPP_VERSION_PATCH 1
|
# define JSONCPP_VERSION_PATCH 2
|
||||||
# define JSONCPP_VERSION_QUALIFIER
|
# define JSONCPP_VERSION_QUALIFIER
|
||||||
# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
|
# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
|
||||||
|
|
||||||
|
@@ -77,7 +77,7 @@ ValueIteratorBase::difference_type
|
|||||||
ValueIteratorBase::computeDistance(const SelfType& other) const {
|
ValueIteratorBase::computeDistance(const SelfType& other) const {
|
||||||
#ifndef JSON_VALUE_USE_INTERNAL_MAP
|
#ifndef JSON_VALUE_USE_INTERNAL_MAP
|
||||||
#ifdef JSON_USE_CPPTL_SMALLMAP
|
#ifdef JSON_USE_CPPTL_SMALLMAP
|
||||||
return current_ - other.current_;
|
return other.current_ - current_;
|
||||||
#else
|
#else
|
||||||
// Iterator for null value are initialized using the default
|
// Iterator for null value are initialized using the default
|
||||||
// constructor, which initialize current_ to the default
|
// constructor, which initialize current_ to the default
|
||||||
|
@@ -1861,6 +1861,23 @@ JSONTEST_FIXTURE(CharReaderFailIfExtraTest, commentAfterBool) {
|
|||||||
JSONTEST_ASSERT_EQUAL(true, root.asBool());
|
JSONTEST_ASSERT_EQUAL(true, root.asBool());
|
||||||
delete reader;
|
delete reader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct IteratorTest : JsonTest::TestCase {};
|
||||||
|
|
||||||
|
JSONTEST_FIXTURE(IteratorTest, distance) {
|
||||||
|
Json::Value json;
|
||||||
|
json["k1"] = "a";
|
||||||
|
json["k2"] = "b";
|
||||||
|
int dist;
|
||||||
|
std::string str;
|
||||||
|
for (Json::ValueIterator it = json.begin(); it != json.end(); ++it) {
|
||||||
|
dist = it - json.begin();
|
||||||
|
str = it->asString().c_str();
|
||||||
|
}
|
||||||
|
JSONTEST_ASSERT_EQUAL(1, dist);
|
||||||
|
JSONTEST_ASSERT_STRING_EQUAL("b", str);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main(int argc, const char* argv[]) {
|
||||||
JsonTest::Runner runner;
|
JsonTest::Runner runner;
|
||||||
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, checkNormalizeFloatingPointStr);
|
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, checkNormalizeFloatingPointStr);
|
||||||
@@ -1884,6 +1901,9 @@ int main(int argc, const char* argv[]) {
|
|||||||
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, offsetAccessors);
|
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, offsetAccessors);
|
||||||
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, typeChecksThrowExceptions);
|
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, typeChecksThrowExceptions);
|
||||||
|
|
||||||
|
JSONTEST_REGISTER_FIXTURE(runner, WriterTest, dropNullPlaceholders);
|
||||||
|
JSONTEST_REGISTER_FIXTURE(runner, StreamWriterTest, dropNullPlaceholders);
|
||||||
|
|
||||||
JSONTEST_REGISTER_FIXTURE(runner, ReaderTest, parseWithNoErrors);
|
JSONTEST_REGISTER_FIXTURE(runner, ReaderTest, parseWithNoErrors);
|
||||||
JSONTEST_REGISTER_FIXTURE(
|
JSONTEST_REGISTER_FIXTURE(
|
||||||
runner, ReaderTest, parseWithNoErrorsTestingOffsets);
|
runner, ReaderTest, parseWithNoErrorsTestingOffsets);
|
||||||
@@ -1905,8 +1925,7 @@ int main(int argc, const char* argv[]) {
|
|||||||
JSONTEST_REGISTER_FIXTURE(runner, CharReaderFailIfExtraTest, commentAfterArray);
|
JSONTEST_REGISTER_FIXTURE(runner, CharReaderFailIfExtraTest, commentAfterArray);
|
||||||
JSONTEST_REGISTER_FIXTURE(runner, CharReaderFailIfExtraTest, commentAfterBool);
|
JSONTEST_REGISTER_FIXTURE(runner, CharReaderFailIfExtraTest, commentAfterBool);
|
||||||
|
|
||||||
JSONTEST_REGISTER_FIXTURE(runner, WriterTest, dropNullPlaceholders);
|
JSONTEST_REGISTER_FIXTURE(runner, IteratorTest, distance);
|
||||||
JSONTEST_REGISTER_FIXTURE(runner, StreamWriterTest, dropNullPlaceholders);
|
|
||||||
|
|
||||||
return runner.runCommandLine(argc, argv);
|
return runner.runCommandLine(argc, argv);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user