Commit graph

368 commits

Author SHA1 Message Date
Niels
53e3da8071 minor adjustments to pull request #38 2015-03-23 20:27:30 +01:00
Niels
a382a93a8e Merge pull request #38 from wtsi-hgi/feature/small-float-serialization
Feature/small float serialization
2015-03-23 20:15:50 +01:00
Niels
bb2671df11 fixed #43 (adding friendship to allow iterator change) 2015-03-22 19:18:21 +01:00
Niels
f2957dc3bf fixed #45 (added count function for keys in objects) 2015-03-22 19:07:43 +01:00
Niels
cf829ac2e8 fixed deprecated warnings in issue #42 2015-03-22 17:50:43 +01:00
Niels
abc6137001 fixed #48 (using nonmember begin/end) 2015-03-22 17:30:48 +01:00
Aaron Burghardt
396f64a058 Replaced leading tabs with spaces (4 per tab). 2015-03-02 15:25:09 -05:00
Aaron Burghardt
87746280ca Added parse() for streams. 2015-03-01 06:31:33 -05:00
Aaron Burghardt
2855c70c27 Use inplace configuration for yyfill and disable the parameter to yyfill. 2015-03-01 05:55:40 -05:00
Aaron Burghardt
268fd444e6 Added comments to new method yyfill. 2015-03-01 05:55:40 -05:00
Aaron Burghardt
edb697293b Fixed variable adjustments in yyfill(). 2015-03-01 05:55:40 -05:00
Aaron Burghardt
ec6979bf76 Purged old commented-out code. 2015-03-01 05:55:40 -05:00
Aaron Burghardt
b66c306d47 Removed unused member m_state. 2015-03-01 05:55:40 -05:00
Aaron Burghardt
0d79e7c2a2 Removed duplicate m_marker updates in YYFILL macro. 2015-03-01 05:55:40 -05:00
Aaron Burghardt
e3e18d7b85 Deleted extraneous comment. 2015-03-01 05:55:40 -05:00
Aaron Burghardt
e4cc42cf81 Moved m_marker in lexer::scan() to be a member of lexer. 2015-03-01 05:55:40 -05:00
Aaron Burghardt
754c38e871 Moved buffer management into the lexer class and implemented YYFILL so that streams are read incrementally. 2015-03-01 05:55:40 -05:00
Joshua C. Randall
7bfcbe2825 Fixes serialization of small floats
Now uses std::snprintf() to generate a "%.15g" formatted string
for JSON values of type number_float. 15 decimals digits are
enough to round-trip an IEEE 754 double from string->double->string
and get an identical result.

std::snprintf is called twice. Once to determine the required
buffer size and then again after allocating a buffer of that
size.

Note that the buffer size *could* be hardcoded for better
performance. "%.15g" should result in strings of maximum length
23, plus one character for the terminating null for a buffer size
of 24.
2015-02-28 17:11:46 +00:00
Niels
63c70fa07e minor changes 2015-02-24 23:19:19 +01:00
Niels
d524e23204 overworked iterators 2015-02-22 17:52:27 +01:00
Niels
bc2e3a798d a more forgiving array behavior 2015-02-21 13:24:07 +01:00
Niels
afd02eee44 fixed [] operator; added README 2015-02-18 22:28:56 +01:00
Niels
9e7941b6ba more type adjustments 2015-02-17 00:22:12 +01:00
Niels
432a54e570 some type fixes 2015-02-16 23:17:28 +01:00
Niels
a3f52a5a04 minor change to make code more portable 2015-02-16 22:54:07 +01:00
Niels
5ca84052a7 removed unused code and fixed includes 2015-02-16 22:47:30 +01:00
Niels
db91140156 clean up 2015-02-15 23:27:35 +01:00
Niels
429d2099ab more allocators 2015-02-15 23:13:46 +01:00
Niels
b387761e12 forgot to destroy object 2015-02-15 22:58:35 +01:00
Niels
568d75954e experiment with user-defined allocator 2015-02-15 22:49:26 +01:00
Niels
b1be1b45ee minor change 2015-02-15 18:43:17 +01:00
Niels
d31d1ca664 fix of the fix 2015-02-15 17:40:46 +01:00
Niels
9f87fd464a fixed Valgrind error 2015-02-15 17:07:19 +01:00
Niels
f1f72403cd some unicode magic 2015-02-15 16:56:54 +01:00
Niels
b80ca376f9 added some missing features from 2.0 version 2015-02-15 15:16:11 +01:00
Niels
2d8b362849 further cleanup 2015-02-15 14:52:00 +01:00
Niels
2fc82358ce clean up 2015-02-15 13:35:51 +01:00
Niels
bb558d8e6f added Unicode support 2015-02-15 11:44:49 +01:00
Niels
6ef3cb51a4 some reorganization 2015-02-14 17:34:06 +01:00
Niels
cc4a8319a1 reverse iterators 2015-02-14 16:47:14 +01:00
Niels
005a5c2858 some fixes and cleanup 2015-02-13 21:46:33 +01:00
Niels
4361c4d03f more test cases 2015-02-12 22:54:42 +01:00
Niels
89a1b0247b fixed a major bug in the parser 2015-02-11 17:24:14 +01:00
Niels
3f8dc632e2 test cases for iterator classes 2015-02-11 15:29:41 +01:00
Niels
53c9564c51 bug fix and test cases 2015-02-11 14:58:52 +01:00
Niels
7b7a54aca5 fixed a bug 2015-02-11 13:15:22 +01:00
Niels
f1bd206994 number test cases 2015-02-11 11:36:45 +01:00
Niels
463c38df60 fix test case 2015-02-11 10:57:17 +01:00
Niels
c816fd12a0 cleanup 2015-02-11 10:16:43 +01:00
Niels
d609790fff added whitespace handling 2015-02-11 09:51:24 +01:00
Niels
5d280143b7 fixes 2015-02-11 09:41:23 +01:00
Niels
8a4e127a57 + moved lexer to class 2015-02-11 09:10:28 +01:00
Niels
e845cd1db8 still errors... 2015-02-10 23:55:44 +01:00
Niels
0433e71fc3 rename member variables; add whitespace tests 2015-02-10 23:20:30 +01:00
Niels
f9797f8eb2 try 2015-02-10 23:05:45 +01:00
Niels
1aebb6e6ed removing failing (?) test cases 2015-02-10 22:48:16 +01:00
Niels
6232c78f88 possible fix 2015-02-10 22:37:07 +01:00
Niels
1bbde4597b more test cases 2015-02-10 22:09:21 +01:00
Niels
cd89a88b4a fix build error 2015-02-10 21:03:32 +01:00
Niels
963ec13b4a testing the parser 2015-02-10 20:52:39 +01:00
Niels
3589837071 more test cases 2015-02-10 20:28:16 +01:00
Niels
8c6bb04d10 added width feature / more test cases 2015-02-10 19:50:26 +01:00
Niels
4cd341d4db more unit tests 2015-02-10 18:51:09 +01:00
Niels
29a8d43d5a fixed tests for copy assignment 2015-02-10 17:40:47 +01:00
Niels
2ec0c79e0f test cases and clean up 2015-02-09 21:10:19 +01:00
Niels
0cfd0f5d68 added test cases and fixed some warnings 2015-02-09 20:21:26 +01:00
Niels
e53e84e1cc more test cases 2015-02-09 18:45:32 +01:00
Niels
48392cfa79 some bug fixing 2015-02-09 18:02:31 +01:00
Niels
330ffd952b removed reverse_iterators and fixed some bugs 2015-02-08 19:18:39 +01:00
Niels
441a6f267f more test cases 2015-02-08 16:08:48 +01:00
Niels
16b91d491e more test cases 2015-02-08 15:47:40 +01:00
Niels
7cd9067ea2 more test cases 2015-02-08 14:38:52 +01:00
Niels
caf82be2c7 added reverse iterators 2015-02-08 12:53:10 +01:00
Niels
87c250d843 another commit to trigger coverage 2015-02-07 19:14:23 +01:00
Niels
cc274f8145 small changes with default values 2015-02-07 19:04:08 +01:00
Niels
cf498ca4f2 added more features from master branch 2015-02-07 15:57:47 +01:00
Niels
ac274dee2a Zwischenstand 2015-02-05 22:45:33 +01:00
Niels
16fa85e9f2 Zwischenstand 2015-02-05 22:45:21 +01:00
Niels
a5188b08df strings are escaped 2015-02-04 22:49:46 +01:00
Niels
5ec433604a more test cases 2015-01-31 21:25:38 +01:00
Niels
385865c4ec remove checks in iterator 2015-01-31 20:46:23 +01:00
Niels
befd90dead cleanup 2015-01-31 20:13:11 +01:00
Niels
5199382c91 worked on issue #8 and #27 2015-01-24 20:33:06 +01:00
Niels
807de40463 implemented missing operator[] 2015-01-23 18:27:58 +01:00
Niels
6ee46ed519 cleanup 2015-01-21 17:42:45 +01:00
Niels
d66743b9c2 fixed a memory leak 2015-01-21 15:59:52 +01:00
Niels
bbc45eb4d8 overworked iterators 2015-01-21 15:43:24 +01:00
Niels
76be1ae1f6 + more adjustments toward a real container 2015-01-21 11:47:03 +01:00
Niels
3c780f0f57 + generic constructors for arrays and objects 2015-01-21 09:40:46 +01:00
Niels
a7a946bd18 added missing header 2015-01-20 21:15:14 +01:00
Niels
54fc97d434 + set number type to int64_t
+ replaced several functions by template magic
2015-01-20 20:43:54 +01:00
Niels
a144800774 + implemented member and non-member swap 2015-01-19 19:51:07 +01:00
Niels
7724d34741 fixed #31: only use spaces in pretty print 2015-01-18 10:58:48 +01:00
Niels
19043d2003 this should fix #28 2015-01-13 19:07:53 +01:00
WanCW
36f6199898 Fix string conversion under Clang 2015-01-12 20:03:41 +08:00
Niels
bd05c7a18a small tidy up after pull request #22
- removed IDE leftovers
- adjusted const’ness of some functions
- style guide
2015-01-11 15:16:14 +01:00
Niels
6533b33387 Merge pull request #22 from Teemperor/unicode_escaping
Unicode escaping
2015-01-11 15:08:13 +01:00
Niels
8d9c2bea4e + applied style guide 2015-01-11 15:05:04 +01:00
Raphael Isemann
7b97ec884e Fixed dumping of strings 2015-01-10 22:04:57 +01:00
Raphael Isemann
a866a9d980 Reapplied code style fixes 2015-01-10 19:53:13 +01:00
Raphael Isemann
a409ba9488 Fixed build 2015-01-10 18:46:01 +01:00
Raphael Isemann
6105ce5484 Allowed automerge 2015-01-10 17:33:18 +01:00
Raphael Isemann
1287f03084 Code point are two words, and so the "P" should be capital 2015-01-10 16:50:39 +01:00
Raphael Isemann
5a54e46709 Fully implemented the JSON spec 2015-01-10 16:49:10 +01:00
Raphael Isemann
222aacc213 Quick and dirty implementation for basic multilingual plane in the unicode escape mechanism 2015-01-10 10:36:30 +01:00
Niels
0cd2ecf48f minor style adjustments 2015-01-09 20:48:16 +01:00
Raphael Isemann
7f4fcc51f6 Implemented the JSON spec for string parsing for everything but the \uXXXX escaping for unicode 2015-01-09 20:03:18 +01:00
Niels
33f5236687 added missing header 2015-01-09 17:40:14 +01:00
Niels
535aef5ad0 Merge pull request #19 from kirkshoop/stditerator
add the std iterator typedefs to iterator and const_iterator
2015-01-09 17:37:42 +01:00
Niels
33f5e74905 minor syntax adjustments 2015-01-09 16:38:34 +01:00
Kirk Shoop
3486a5d9bb add the std iterator typedefs to iterator and const_iterator 2015-01-09 07:33:57 -08:00
Raphael Isemann
4a39bfb17e Fixed typo in comments 2015-01-09 11:57:39 +01:00
Raphael Isemann
fa0ee9c927 Fixed escaped quotes 2015-01-08 22:35:48 +01:00
Niels
4647401030 fixed #15 2015-01-06 22:05:32 +01:00
Niels
bd9f49efb9 implemented pretty printing (issue #13)
- to_string() method is now called dump()
- syntax borrowed from Python’s json.dumps()
2015-01-06 21:44:07 +01:00
Niels
5f05d02c6a Merge pull request #14 from elliotgoodrich/master
Fix double delete on std::bad_alloc exception
2015-01-06 18:43:21 +01:00
Niels
a53c878c81 moved class into "nlohmann" namespace
- fixed issue #9
- also removed std::mutex member variable
- also added “std::” prefix to size_t variables
2015-01-06 18:41:24 +01:00
Elliot Goodrich
0773f40a8e Fix double delete on std::bad_alloc exception
If the new operator throws in the json::find methods then result.oi_ is
deleted again in the destructor of json::iterator/json::const_iterator,
which is a double delete and undefined behaviour.
2015-01-06 09:12:55 +00:00
Niels
a9669a410d removed "noexpect" from all functions that use new 2015-01-04 23:18:24 +01:00
Niels
540cda6118 used _-suffix for member variables 2015-01-04 23:09:30 +01:00
Niels
3bef1a5097 renamed "toString()" to "to_string()" 2015-01-04 20:50:28 +01:00
Niels
f63ff7727e renamed class from "JSON" to "son" 2015-01-04 20:43:25 +01:00
Niels
4d00105e5c tidy up 2015-01-04 19:05:46 +01:00
Niels
bd0be5f0af fixed memory leak 2015-01-04 12:29:16 +01:00
Niels
481f377cfe + guard call to std::ios_base::sync_with_stdio 2015-01-04 12:05:28 +01:00
Niels
764ed26c41 cleanup 2015-01-03 17:18:17 +01:00
Niels
18364aac85 parser returns an object 2015-01-02 17:19:40 +01:00
Niels
16c30cff8b removed old C fragments 2015-01-02 15:29:36 +01:00
Niels
af4aca9edd + better string handling 2015-01-02 12:47:32 +01:00
Niels
6995d33fb1 + fixed documentation bugs 2014-12-30 11:57:58 +01:00
Niels
2335d3f3d5 tidy up 2014-12-30 11:47:28 +01:00
Niels
9e61092fc6 + overworked parser 2014-12-30 10:54:01 +01:00
Niels
4e44390090 + fixed a bug in the stream input 2014-12-29 21:13:03 +01:00
Niels
15a9d3cff6 minor changes 2014-12-29 19:54:31 +01:00
Niels
a8c4f84fb8 + removed data() function 2014-12-29 16:45:54 +01:00
Niels
725202356b + fix memory issues 2014-12-29 12:51:20 +01:00
Niels
2c1b3e5108 + small cleanup 2014-12-29 00:02:14 +01:00
Niels
bed47db168 + that could be it! 2014-12-28 23:09:31 +01:00
Niels
776611c270 + another check 2014-12-28 22:59:11 +01:00
Niels
0ced78bfa8 + test 2014-12-28 22:51:27 +01:00
Niels
b573841ace + more test cases 2014-12-28 22:38:57 +01:00
Niels
98af0887f2 + more test cases 2014-12-28 22:29:06 +01:00
Niels
48a349a058 + more test cases 2014-12-28 21:53:13 +01:00
Niels
8f45d9351e + overworked switches 2014-12-28 20:07:56 +01:00
Niels
cd48a01b20 + more test 2014-12-28 18:00:50 +01:00
Niels
d3216300b2 + more test cases 2014-12-28 17:26:33 +01:00
Niels
ea94518a64 + more test cases 2014-12-28 17:09:38 +01:00
Niels
5b1f69ce5b + overworked comments 2014-12-28 16:48:22 +01:00
Niels
a68b4cafa2 + more test cases 2014-12-28 14:57:21 +01:00
Niels
8d4f675151 + test cases for clear() 2014-12-28 12:50:52 +01:00
Niels
b57179e0fe + fixed a compiler warning
+ added coveralls
2014-12-28 09:23:49 +01:00
Niels
fbad7fac17 2.0 preview 2014-12-28 09:11:01 +01:00
Niels
278a9e7052 simplified code 2013-12-11 08:41:02 +01:00
Niels
81367a9a10 fixed a cppcheck warning 2013-12-10 12:44:23 +01:00
Niels Lohmann
a8f62ca052 + a fix for C++98 2013-07-15 08:32:10 +02:00
Niels
9a567d9d2d - tidied code
- added more documentation
2013-07-11 14:19:11 +02:00
Niels
52c2cb8ce7 - removed pointers to POD inside the union 2013-07-10 14:57:51 +02:00
Niels
4e6a400a23 - reorganized payload 2013-07-10 14:33:17 +02:00
Niels
ec6e628d4f - minor tweaks 2013-07-05 16:45:17 +02:00
Niels
cb2da141ec - further adjustments 2013-07-05 16:15:29 +02:00
Niels
0ee8d53a28 - a find() function 2013-07-05 14:16:47 +02:00
Niels
ac5ff65856 - bugfixing 2013-07-05 12:32:23 +02:00
Niels
abad903f31 - memory problem 2013-07-05 11:57:12 +02:00
Niels
61461ec456 - fixes from Harro 2013-07-05 11:23:49 +02:00
Niels
23ada516aa - header for NULL 2013-07-04 18:16:24 +02:00
Niels
d035fa581d - added missing headers 2013-07-04 18:13:17 +02:00
Niels
206e15dff7 - fixed bugs and added test cases 2013-07-04 17:06:53 +02:00
Niels
4502e7e51c - initial commit 2013-07-04 10:49:03 +02:00