mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-12 10:03:51 +01:00
Remove trailing space characters (#1256)
Also add two newlines (rebased from `aaronfranke/formatting`) resolves #1220 Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
This commit is contained in:
parent
940982438d
commit
be4a512887
@ -4,7 +4,7 @@ WarningsAsErrors: ''
|
|||||||
HeaderFilterRegex: ''
|
HeaderFilterRegex: ''
|
||||||
AnalyzeTemporaryDtors: false
|
AnalyzeTemporaryDtors: false
|
||||||
FormatStyle: none
|
FormatStyle: none
|
||||||
CheckOptions:
|
CheckOptions:
|
||||||
- key: modernize-use-using.IgnoreMacros
|
- key: modernize-use-using.IgnoreMacros
|
||||||
value: '0'
|
value: '0'
|
||||||
...
|
...
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||||
python $DIR/run-clang-format.py -r $DIR/../src/**/ $DIR/../include/**/
|
python $DIR/run-clang-format.py -r $DIR/../src/**/ $DIR/../include/**/
|
||||||
|
14
LICENSE
14
LICENSE
@ -1,25 +1,25 @@
|
|||||||
The JsonCpp library's source code, including accompanying documentation,
|
The JsonCpp library's source code, including accompanying documentation,
|
||||||
tests and demonstration applications, are licensed under the following
|
tests and demonstration applications, are licensed under the following
|
||||||
conditions...
|
conditions...
|
||||||
|
|
||||||
Baptiste Lepilleur and The JsonCpp Authors explicitly disclaim copyright in all
|
Baptiste Lepilleur and The JsonCpp Authors explicitly disclaim copyright in all
|
||||||
jurisdictions which recognize such a disclaimer. In such jurisdictions,
|
jurisdictions which recognize such a disclaimer. In such jurisdictions,
|
||||||
this software is released into the Public Domain.
|
this software is released into the Public Domain.
|
||||||
|
|
||||||
In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
|
In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
|
||||||
2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur and
|
2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur and
|
||||||
The JsonCpp Authors, and is released under the terms of the MIT License (see below).
|
The JsonCpp Authors, and is released under the terms of the MIT License (see below).
|
||||||
|
|
||||||
In jurisdictions which recognize Public Domain property, the user of this
|
In jurisdictions which recognize Public Domain property, the user of this
|
||||||
software may choose to accept it either as 1) Public Domain, 2) under the
|
software may choose to accept it either as 1) Public Domain, 2) under the
|
||||||
conditions of the MIT License (see below), or 3) under the terms of dual
|
conditions of the MIT License (see below), or 3) under the terms of dual
|
||||||
Public Domain/MIT License conditions described here, as they choose.
|
Public Domain/MIT License conditions described here, as they choose.
|
||||||
|
|
||||||
The MIT License is about as close to Public Domain as a license can get, and is
|
The MIT License is about as close to Public Domain as a license can get, and is
|
||||||
described in clear, concise terms at:
|
described in clear, concise terms at:
|
||||||
|
|
||||||
http://en.wikipedia.org/wiki/MIT_License
|
http://en.wikipedia.org/wiki/MIT_License
|
||||||
|
|
||||||
The full text of the MIT License follows:
|
The full text of the MIT License follows:
|
||||||
|
|
||||||
========================================================================
|
========================================================================
|
||||||
|
@ -146,7 +146,7 @@ def glob(dir_path,
|
|||||||
entry_type = is_file and FILE_LINK or DIR_LINK
|
entry_type = is_file and FILE_LINK or DIR_LINK
|
||||||
else:
|
else:
|
||||||
entry_type = is_file and FILE or DIR
|
entry_type = is_file and FILE or DIR
|
||||||
## print '=> type: %d' % entry_type,
|
## print '=> type: %d' % entry_type,
|
||||||
if (entry_type & entry_type_filter) != 0:
|
if (entry_type & entry_type_filter) != 0:
|
||||||
## print ' => KEEP'
|
## print ' => KEEP'
|
||||||
yield os.path.join(dir_path, entry)
|
yield os.path.join(dir_path, entry)
|
||||||
|
@ -32,8 +32,8 @@ def fix_source_eol(path, is_dry_run = True, verbose = True, eol = '\n'):
|
|||||||
if verbose:
|
if verbose:
|
||||||
print(is_dry_run and ' NEED FIX' or ' FIXED')
|
print(is_dry_run and ' NEED FIX' or ' FIXED')
|
||||||
return True
|
return True
|
||||||
##
|
##
|
||||||
##
|
##
|
||||||
##
|
##
|
||||||
##def _do_fix(is_dry_run = True):
|
##def _do_fix(is_dry_run = True):
|
||||||
## from waftools import antglob
|
## from waftools import antglob
|
||||||
|
@ -20,7 +20,7 @@ def update_license(path, dry_run, show_diff):
|
|||||||
dry_run: if True, just print the path of the file that would be updated,
|
dry_run: if True, just print the path of the file that would be updated,
|
||||||
but don't change it.
|
but don't change it.
|
||||||
show_diff: if True, print the path of the file that would be modified,
|
show_diff: if True, print the path of the file that would be modified,
|
||||||
as well as the change made to the file.
|
as well as the change made to the file.
|
||||||
"""
|
"""
|
||||||
with open(path, 'rt') as fin:
|
with open(path, 'rt') as fin:
|
||||||
original_text = fin.read().replace('\r\n','\n')
|
original_text = fin.read().replace('\r\n','\n')
|
||||||
@ -51,7 +51,7 @@ def update_license_in_source_directories(source_dirs, dry_run, show_diff):
|
|||||||
dry_run: if True, just print the path of the file that would be updated,
|
dry_run: if True, just print the path of the file that would be updated,
|
||||||
but don't change it.
|
but don't change it.
|
||||||
show_diff: if True, print the path of the file that would be modified,
|
show_diff: if True, print the path of the file that would be modified,
|
||||||
as well as the change made to the file.
|
as well as the change made to the file.
|
||||||
"""
|
"""
|
||||||
from devtools import antglob
|
from devtools import antglob
|
||||||
prune_dirs = antglob.prune_dirs + 'scons-local* ./build* ./libs ./dist'
|
prune_dirs = antglob.prune_dirs + 'scons-local* ./build* ./libs ./dist'
|
||||||
|
@ -46,7 +46,7 @@ def do_subst_in_file(targetfile, sourcefile, dict):
|
|||||||
with open(sourcefile, 'r') as f:
|
with open(sourcefile, 'r') as f:
|
||||||
contents = f.read()
|
contents = f.read()
|
||||||
for (k,v) in list(dict.items()):
|
for (k,v) in list(dict.items()):
|
||||||
v = v.replace('\\','\\\\')
|
v = v.replace('\\','\\\\')
|
||||||
contents = re.sub(k, v, contents)
|
contents = re.sub(k, v, contents)
|
||||||
with open(targetfile, 'w') as f:
|
with open(targetfile, 'w') as f:
|
||||||
f.write(contents)
|
f.write(contents)
|
||||||
@ -158,7 +158,7 @@ def main():
|
|||||||
Generates doxygen documentation in build/doxygen.
|
Generates doxygen documentation in build/doxygen.
|
||||||
Optionally makes a tarball of the documentation to dist/.
|
Optionally makes a tarball of the documentation to dist/.
|
||||||
|
|
||||||
Must be started in the project top directory.
|
Must be started in the project top directory.
|
||||||
"""
|
"""
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
parser = OptionParser(usage=usage)
|
parser = OptionParser(usage=usage)
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
***NOTE***
|
***NOTE***
|
||||||
|
|
||||||
If you get linker errors about undefined references to symbols that involve types in the `std::__cxx11` namespace or the tag
|
If you get linker errors about undefined references to symbols that involve types in the `std::__cxx11` namespace or the tag
|
||||||
`[abi:cxx11]` then it probably indicates that you are trying to link together object files that were compiled with different
|
`[abi:cxx11]` then it probably indicates that you are trying to link together object files that were compiled with different
|
||||||
values for the _GLIBCXX_USE_CXX11_ABI marco. This commonly happens when linking to a third-party library that was compiled with
|
values for the _GLIBCXX_USE_CXX11_ABI marco. This commonly happens when linking to a third-party library that was compiled with
|
||||||
an older version of GCC. If the third-party library cannot be rebuilt with the new ABI, then you need to recompile your code with
|
an older version of GCC. If the third-party library cannot be rebuilt with the new ABI, then you need to recompile your code with
|
||||||
the old ABI,just like:
|
the old ABI,just like:
|
||||||
**g++ stringWrite.cpp -ljsoncpp -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0 -o stringWrite**
|
**g++ stringWrite.cpp -ljsoncpp -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0 -o stringWrite**
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
[ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||||
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
||||||
"ccccccccccccccccccccccc",
|
"ccccccccccccccccccccccc",
|
||||||
"dddddddddddddddddddddddddddddddddddddddddddddddddddd" ]
|
"dddddddddddddddddddddddddddddddddddddddddddddddddddd" ]
|
@ -1,17 +1,17 @@
|
|||||||
{
|
{
|
||||||
"count" : 1234,
|
"count" : 1234,
|
||||||
"name" : { "aka" : "T.E.S.T.", "id" : 123987 },
|
"name" : { "aka" : "T.E.S.T.", "id" : 123987 },
|
||||||
"attribute" : [
|
"attribute" : [
|
||||||
"random",
|
"random",
|
||||||
"short",
|
"short",
|
||||||
"bold",
|
"bold",
|
||||||
12,
|
12,
|
||||||
{ "height" : 7, "width" : 64 }
|
{ "height" : 7, "width" : 64 }
|
||||||
],
|
],
|
||||||
"test": { "1" :
|
"test": { "1" :
|
||||||
{ "2" :
|
{ "2" :
|
||||||
{ "3" : { "coord" : [ 1,2] }
|
{ "3" : { "coord" : [ 1,2] }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"count" : 1234,
|
"count" : 1234,
|
||||||
"name" : "test",
|
"name" : "test",
|
||||||
"attribute" : "random"
|
"attribute" : "random"
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"" : 1234
|
"" : 1234
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,6 @@
|
|||||||
/* Comment before 'second'
|
/* Comment before 'second'
|
||||||
*/
|
*/
|
||||||
.second=2
|
.second=2
|
||||||
/* A comment at
|
/* A comment at
|
||||||
the end of the file.
|
the end of the file.
|
||||||
*/
|
*/
|
||||||
|
@ -9,6 +9,6 @@
|
|||||||
"second" : 2
|
"second" : 2
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A comment at
|
/* A comment at
|
||||||
the end of the file.
|
the end of the file.
|
||||||
*/
|
*/
|
||||||
|
@ -15,7 +15,7 @@ import types
|
|||||||
if len(sys.argv) != 2:
|
if len(sys.argv) != 2:
|
||||||
print("Usage: %s input-json-file", sys.argv[0])
|
print("Usage: %s input-json-file", sys.argv[0])
|
||||||
sys.exit(3)
|
sys.exit(3)
|
||||||
|
|
||||||
input_path = sys.argv[1]
|
input_path = sys.argv[1]
|
||||||
base_path = os.path.splitext(input_path)[0]
|
base_path = os.path.splitext(input_path)[0]
|
||||||
actual_path = base_path + '.actual'
|
actual_path = base_path + '.actual'
|
||||||
@ -23,7 +23,7 @@ rewrite_path = base_path + '.rewrite'
|
|||||||
rewrite_actual_path = base_path + '.actual-rewrite'
|
rewrite_actual_path = base_path + '.actual-rewrite'
|
||||||
|
|
||||||
def valueTreeToString(fout, value, path = '.'):
|
def valueTreeToString(fout, value, path = '.'):
|
||||||
ty = type(value)
|
ty = type(value)
|
||||||
if ty is types.DictType:
|
if ty is types.DictType:
|
||||||
fout.write('%s={}\n' % path)
|
fout.write('%s={}\n' % path)
|
||||||
suffix = path[-1] != '.' and '.' or ''
|
suffix = path[-1] != '.' and '.' or ''
|
||||||
@ -49,7 +49,7 @@ def valueTreeToString(fout, value, path = '.'):
|
|||||||
fout.write('%s=null\n' % path)
|
fout.write('%s=null\n' % path)
|
||||||
else:
|
else:
|
||||||
assert False and "Unexpected value type"
|
assert False and "Unexpected value type"
|
||||||
|
|
||||||
def parseAndSaveValueTree(input, actual_path):
|
def parseAndSaveValueTree(input, actual_path):
|
||||||
root = json.loads(input)
|
root = json.loads(input)
|
||||||
fout = file(actual_path, 'wt')
|
fout = file(actual_path, 'wt')
|
||||||
@ -62,7 +62,7 @@ def rewriteValueTree(value, rewrite_path):
|
|||||||
#rewrite = rewrite[1:-1] # Somehow the string is quoted ! jsonpy bug ?
|
#rewrite = rewrite[1:-1] # Somehow the string is quoted ! jsonpy bug ?
|
||||||
file(rewrite_path, 'wt').write(rewrite + '\n')
|
file(rewrite_path, 'wt').write(rewrite + '\n')
|
||||||
return rewrite
|
return rewrite
|
||||||
|
|
||||||
input = file(input_path, 'rt').read()
|
input = file(input_path, 'rt').read()
|
||||||
root = parseAndSaveValueTree(input, actual_path)
|
root = parseAndSaveValueTree(input, actual_path)
|
||||||
rewrite = rewriteValueTree(json.write(root), rewrite_path)
|
rewrite = rewriteValueTree(json.write(root), rewrite_path)
|
||||||
|
Loading…
Reference in New Issue
Block a user