Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
005a5c28
Commit
005a5c28
authored
Feb 13, 2015
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some fixes and cleanup
parent
36e36bf8
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
355 additions
and
735 deletions
+355
-735
.travis.yml
.travis.yml
+1
-5
Makefile.am
Makefile.am
+0
-32
configure.ac
configure.ac
+0
-14
src/json.hpp
src/json.hpp
+331
-674
src/json.hpp.re2c
src/json.hpp.re2c
+23
-10
No files found.
.travis.yml
View file @
005a5c28
...
...
@@ -9,11 +9,7 @@ before_install:
-
if [ "$CXX" = "g++" ]; then sudo apt-get install -qq g++-4.9; fi
-
if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi
-
sudo pip install cpp-coveralls pyyaml
-
sudo apt-get install valgrind re2c
before_script
:
-
autoreconf -iv
-
./configure
-
sudo apt-get install valgrind
script
:
-
make
...
...
Makefile.am
deleted
100644 → 0
View file @
36e36bf8
.PHONY
:
header_only
noinst_PROGRAMS
=
json_unit
FLAGS
=
-Wall
-Wextra
-pedantic
-Weffc
++
-Wcast-align
-Wcast-qual
-Wctor-dtor-privacy
-Wdisabled-optimization
-Wformat
=
2
-Winit-self
-Wmissing-declarations
-Wmissing-include-dirs
-Wold-style-cast
-Woverloaded-virtual
-Wredundant-decls
-Wshadow
-Wsign-conversion
-Wsign-promo
-Wstrict-overflow
=
5
-Wswitch
-Wundef
-Wno-unused
-Wnon-virtual-dtor
-Wreorder
json_unit_SOURCES
=
src/json.hpp
test
/catch.hpp
test
/unit.cpp
json_unit_CXXFLAGS
=
$(FLAGS)
-std
=
c++11
json_unit_CPPFLAGS
=
-I
$(top_srcdir)
/src
-I
$(top_srcdir)
/test
-Dprivate
=
public
# parameters:
# -b use bit vectors
# -s nested ifs
# -i do not create #line information
# --no-generation-date suppress generation date output
src/json.hpp
:
src/json.hpp.re2c
$(AM_V_GEN)$(RE2C)
-b
-s
-i
--no-generation-date
$<
|
$(SED)
'1d'
>
$@
cppcheck
:
cppcheck
--enable
=
all
--inconclusive
--std
=
c++11 src/json.hpp
svn-clean
:
maintainer-clean
rm
-fr
configure INSTALL aclocal.m4 build-aux depcomp install-sh missing test-driver
for
DIR
in
$(DIST_SUBDIRS)
.
;
do
rm
-f
$$
DIR/Makefile.in
;
done
pretty
:
astyle
--style
=
allman
--indent
=
spaces
=
4
--indent-modifiers
\
--indent-switches
--indent-preproc-block
--indent-preproc-define
\
--indent-col1-comments
--pad-oper
--pad-header
--align-pointer
=
type
\
--align-reference
=
type
--add-brackets
--convert-tabs
--close-templates
\
--lineend
=
linux
--preserve-date
--suffix
=
none
\
src/json.hpp src/json.hpp.re2c
test
/unit.cpp
configure.ac
deleted
100644 → 0
View file @
36e36bf8
AC_INIT([JSON], [3.0], [mail@nlohmann.me])
AC_CONFIG_SRCDIR([src/json.hpp.re2c])
AM_INIT_AUTOMAKE([foreign subdir-objects])
AM_SILENT_RULES([yes])
AC_PROG_CXX
AC_PROG_SED
AM_MISSING_PROG(RE2C, [re2c])
AM_MISSING_PROG(CPPCHECK, [cppcheck])
AM_MISSING_PROG(ASTYLE, [astyle])
AC_CONFIG_FILES(Makefile)
AC_OUTPUT
src/json.hpp
View file @
005a5c28
This diff is collapsed.
Click to expand it.
src/json.hpp.re2c
View file @
005a5c28
...
...
@@ -454,7 +454,12 @@ class basic_json
}
/// copy assignment
inline reference& operator=(basic_json other) noexcept
inline reference& operator=(basic_json other) noexcept (
std::is_nothrow_move_constructible<value_t>::value and
std::is_nothrow_move_assignable<value_t>::value and
std::is_nothrow_move_constructible<json_value>::value and
std::is_nothrow_move_assignable<json_value>::value
)
{
std::swap(m_type, other.m_type);
std::swap(m_value, other.m_value);
...
...
@@ -1043,7 +1048,12 @@ class basic_json
}
/// swaps the contents
inline void swap(reference other) noexcept
inline void swap(reference other) noexcept (
std::is_nothrow_move_constructible<value_t>::value and
std::is_nothrow_move_assignable<value_t>::value and
std::is_nothrow_move_constructible<json_value>::value and
std::is_nothrow_move_assignable<json_value>::value
)
{
std::swap(m_type, other.m_type);
std::swap(m_value, other.m_value);
...
...
@@ -1464,10 +1474,13 @@ class basic_json
inline string_t dump(const bool prettyPrint, const unsigned int indentStep,
unsigned int currentIndent = 0) const noexcept
{
// variable to hold indentation for recursive calls
auto new_indent = currentIndent;
// helper function to return whitespace as indentation
const auto indent = [prettyPrint, &
currentI
ndent]()
const auto indent = [prettyPrint, &
new_i
ndent]()
{
return prettyPrint ? string_t(
currentI
ndent, ' ') : string_t();
return prettyPrint ? string_t(
new_i
ndent, ' ') : string_t();
};
switch (m_type)
...
...
@@ -1484,7 +1497,7 @@ class basic_json
// increase indentation
if (prettyPrint)
{
currentI
ndent += indentStep;
new_i
ndent += indentStep;
result += "\n";
}
...
...
@@ -1495,13 +1508,13 @@ class basic_json
result += prettyPrint ? ",\n" : ",";
}
result += indent() + "\"" + escape_string(i->first) + "\":" + (prettyPrint ? " " : "")
+ i->second.dump(prettyPrint, indentStep,
currentI
ndent);
+ i->second.dump(prettyPrint, indentStep,
new_i
ndent);
}
// decrease indentation
if (prettyPrint)
{
currentI
ndent -= indentStep;
new_i
ndent -= indentStep;
result += "\n";
}
...
...
@@ -1520,7 +1533,7 @@ class basic_json
// increase indentation
if (prettyPrint)
{
currentI
ndent += indentStep;
new_i
ndent += indentStep;
result += "\n";
}
...
...
@@ -1530,13 +1543,13 @@ class basic_json
{
result += prettyPrint ? ",\n" : ",";
}
result += indent() + i->dump(prettyPrint, indentStep,
currentI
ndent);
result += indent() + i->dump(prettyPrint, indentStep,
new_i
ndent);
}
// decrease indentation
if (prettyPrint)
{
currentI
ndent -= indentStep;
new_i
ndent -= indentStep;
result += "\n";
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment