Skip to content

Commit 031a0b6

Browse files
committed
Merge branch 'master' into travis
2 parents 5a955c0 + a627774 commit 031a0b6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+17065
-16683
lines changed

.gitattributes

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text=auto
3+
4+
# Explicitly declare text files you want to always be normalized and converted
5+
# to native line endings on checkout.
6+
*.cpp text
7+
*.h text
8+
*.txt text
9+
*.md text
10+
*.cmake text
11+
*.svg text
12+
*.dot text
13+
*.yml text
14+
*.in text
15+
*.sh text
16+
*.autopkg text
17+
Dockerfile text
18+
19+
# Denote all files that are truly binary and should not be modified.
20+
*.png binary
21+
*.jpg binary
22+
*.json binary

.travis.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,32 +48,68 @@ matrix:
4848
compiler: clang
4949
addons:
5050
apt:
51+
sources:
52+
- llvm-toolchain-precise-3.7
53+
- ubuntu-toolchain-r-test
5154
packages:
5255
- *default_packages
5356
- g++-multilib
5457
- libc6-dbg:i386
58+
- clang-3.7
5559
- env: CONF=debug ARCH=x86_64 CXX11=ON CCACHE_CPP2=yes
5660
compiler: clang
61+
addons:
62+
apt:
63+
sources:
64+
- llvm-toolchain-precise-3.7
65+
- ubuntu-toolchain-r-test
66+
packages:
67+
- *default_packages
68+
- clang-3.7
5769
- env: CONF=debug ARCH=x86 CXX11=OFF CCACHE_CPP2=yes
5870
compiler: clang
5971
addons:
6072
apt:
73+
sources:
74+
- llvm-toolchain-precise-3.7
75+
- ubuntu-toolchain-r-test
6176
packages:
6277
- *default_packages
6378
- g++-multilib
6479
- libc6-dbg:i386
80+
- clang-3.7
6581
- env: CONF=debug ARCH=x86_64 CXX11=OFF CCACHE_CPP2=yes
6682
compiler: clang
83+
addons:
84+
apt:
85+
sources:
86+
- llvm-toolchain-precise-3.7
87+
- ubuntu-toolchain-r-test
88+
packages:
89+
- *default_packages
90+
- clang-3.7
6791
- env: CONF=release ARCH=x86 CXX11=ON CCACHE_CPP2=yes
6892
compiler: clang
6993
addons:
7094
apt:
95+
sources:
96+
- llvm-toolchain-precise-3.7
97+
- ubuntu-toolchain-r-test
7198
packages:
7299
- *default_packages
73100
- g++-multilib
74101
- libc6-dbg:i386
102+
- clang-3.7
75103
- env: CONF=release ARCH=x86_64 CXX11=ON CCACHE_CPP2=yes
76104
compiler: clang
105+
addons:
106+
apt:
107+
sources:
108+
- llvm-toolchain-precise-3.7
109+
- ubuntu-toolchain-r-test
110+
packages:
111+
- *default_packages
112+
- clang-3.7
77113
# coverage report
78114
- env: CONF=debug ARCH=x86 CXX11=ON GCOV_FLAGS='--coverage'
79115
compiler: gcc
@@ -122,6 +158,7 @@ before_script:
122158
- mkdir build
123159

124160
script:
161+
- if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi
125162
- >
126163
eval "ARCH_FLAGS=\${ARCH_FLAGS_${ARCH}}" ;
127164
(cd build && cmake

bin/data/readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sample.json is obtained from http://code.google.com/p/json-test-suite/downloads/detail?name=sample.zip
1+
sample.json is obtained from http://code.google.com/p/json-test-suite/downloads/detail?name=sample.zip

docker/debian/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# BUILD: docker build -t rapidjson-debian .
2+
# RUN: docker run -it -v "$PWD"/../..:/rapidjson rapidjson-debian
3+
4+
FROM debian:jessie
5+
6+
RUN apt-get update && apt-get install -y g++ cmake doxygen valgrind
7+
8+
ENTRYPOINT ["/bin/bash"]

example/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
# Copyright (c) 2011 Milo Yip ([email protected])
2-
# Copyright (c) 2013 Rafal Jeczalik ([email protected])
3-
# Distributed under the MIT License (see license.txt file)
41
cmake_minimum_required(VERSION 2.8)
52

63
set(EXAMPLES
74
capitalize
85
condense
96
jsonx
107
messagereader
8+
parsebyparts
119
pretty
1210
prettyauto
1311
schemavalidator
@@ -22,9 +20,9 @@ include_directories("../include/")
2220
add_definitions(-D__STDC_FORMAT_MACROS)
2321

2422
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
25-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Weffc++ -Wswitch-default")
23+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Werror -Wall -Wextra -Weffc++ -Wswitch-default")
2624
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
27-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Weffc++ -Wswitch-default -Wfloat-equal -Wimplicit-fallthrough -Weverything")
25+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lpthread -Werror -Wall -Wextra -Weffc++ -Wswitch-default -Wfloat-equal -Wimplicit-fallthrough -Weverything")
2826
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
2927
add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)
3028
endif()

example/capitalize/capitalize.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ struct CapitalizeFilter {
2424
bool Int64(int64_t i) { return out_.Int64(i); }
2525
bool Uint64(uint64_t u) { return out_.Uint64(u); }
2626
bool Double(double d) { return out_.Double(d); }
27-
bool String(const char* str, SizeType length, bool) {
27+
bool RawNumber(const char* str, SizeType length, bool copy) { return out_.RawNumber(str, length, copy); }
28+
bool String(const char* str, SizeType length, bool) {
2829
buffer_.clear();
2930
for (SizeType i = 0; i < length; i++)
3031
buffer_.push_back(static_cast<char>(std::toupper(str[i])));

example/condense/condense.cpp

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
// JSON condenser example
2-
3-
// This example parses JSON text from stdin with validation,
4-
// and re-output the JSON content to stdout without whitespace.
5-
6-
#include "rapidjson/reader.h"
7-
#include "rapidjson/writer.h"
8-
#include "rapidjson/filereadstream.h"
9-
#include "rapidjson/filewritestream.h"
10-
#include "rapidjson/error/en.h"
11-
12-
using namespace rapidjson;
13-
14-
int main(int, char*[]) {
15-
// Prepare JSON reader and input stream.
16-
Reader reader;
17-
char readBuffer[65536];
18-
FileReadStream is(stdin, readBuffer, sizeof(readBuffer));
19-
20-
// Prepare JSON writer and output stream.
21-
char writeBuffer[65536];
22-
FileWriteStream os(stdout, writeBuffer, sizeof(writeBuffer));
23-
Writer<FileWriteStream> writer(os);
24-
25-
// JSON reader parse from the input stream and let writer generate the output.
26-
if (!reader.Parse(is, writer)) {
27-
fprintf(stderr, "\nError(%u): %s\n", static_cast<unsigned>(reader.GetErrorOffset()), GetParseError_En(reader.GetParseErrorCode()));
28-
return 1;
29-
}
30-
31-
return 0;
32-
}
1+
// JSON condenser example
2+
3+
// This example parses JSON text from stdin with validation,
4+
// and re-output the JSON content to stdout without whitespace.
5+
6+
#include "rapidjson/reader.h"
7+
#include "rapidjson/writer.h"
8+
#include "rapidjson/filereadstream.h"
9+
#include "rapidjson/filewritestream.h"
10+
#include "rapidjson/error/en.h"
11+
12+
using namespace rapidjson;
13+
14+
int main(int, char*[]) {
15+
// Prepare JSON reader and input stream.
16+
Reader reader;
17+
char readBuffer[65536];
18+
FileReadStream is(stdin, readBuffer, sizeof(readBuffer));
19+
20+
// Prepare JSON writer and output stream.
21+
char writeBuffer[65536];
22+
FileWriteStream os(stdout, writeBuffer, sizeof(writeBuffer));
23+
Writer<FileWriteStream> writer(os);
24+
25+
// JSON reader parse from the input stream and let writer generate the output.
26+
if (!reader.Parse(is, writer)) {
27+
fprintf(stderr, "\nError(%u): %s\n", static_cast<unsigned>(reader.GetErrorOffset()), GetParseError_En(reader.GetParseErrorCode()));
28+
return 1;
29+
}
30+
31+
return 0;
32+
}

example/jsonx/jsonx.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ class JsonxWriter {
5757
return WriteNumberElement(buffer, sprintf(buffer, "%.17g", d));
5858
}
5959

60+
bool RawNumber(const char* str, SizeType length, bool) {
61+
return
62+
WriteStartElement("number") &&
63+
WriteEscapedText(str, length) &&
64+
WriteEndElement("number");
65+
}
66+
6067
bool String(const char* str, SizeType length, bool) {
6168
return
6269
WriteStartElement("string") &&

0 commit comments

Comments
 (0)