m-holger
39dfd305c8
In JSONParser add lexer states for delimiters
2023-02-04 13:44:39 +00:00
m-holger
1e0ab79aec
Remove redundant JSONParser::before_point etc
2023-02-01 14:19:08 +00:00
m-holger
83f972ceda
Refactor end of input handling in JSONParser
2023-02-01 14:18:57 +00:00
m-holger
8fd6e1c5b2
Refactor handling of ls_number in JSONParser::getToken
...
Reflect that the ls_number case only handles the digits after an 'e'.
Also, change state to ls_number for all 'ready' numbers.
2023-02-01 14:18:39 +00:00
m-holger
6ea543e6c7
In JSONParser add lex_state ls_number_e_sign
2023-02-01 14:12:32 +00:00
m-holger
04333bbc20
In JSONParser add lex_state ls_number_e
...
Also, allow 'E' as alternative to 'e'.
2023-02-01 14:09:39 +00:00
m-holger
972ebca505
In JSONParser add lex_state ls_number_after_point
2023-02-01 14:01:57 +00:00
m-holger
cdd1f0a9f6
In JSONParser add lex_state ls_number_point
...
Also. remove '.' as starting char in lsTop.
2023-02-01 14:01:57 +00:00
m-holger
bfda62aeeb
In JSONParser add lex_state ls_number_before_point
2023-02-01 14:01:57 +00:00
m-holger
08e768909d
In JSONParser add lex_state ls_number_leading_zero
2023-02-01 14:01:57 +00:00
m-holger
cba1c352e3
In JSONParser add lex_state ls_number_minus
2023-02-01 14:01:57 +00:00
m-holger
b6b4d3b299
Add new method JSONParser::numberError
2023-02-01 14:01:57 +00:00
m-holger
1787d85096
Refactor JSON::addDictionaryMember
2023-01-28 14:49:37 -05:00
m-holger
dce43d4f7f
Refactor JSON::JSON_string::write
2023-01-28 14:49:32 -05:00
m-holger
4c914aee96
Refactor JSON::writeDictionaryKey
2023-01-28 14:49:32 -05:00
m-holger
3dde66ddcd
Refactor JSON::writeNext
2023-01-28 14:49:32 -05:00
m-holger
dfa7d414f5
Refactor JSON::writeClose
2023-01-28 14:49:32 -05:00
m-holger
2e6869483b
Replace calls to QUtil::int_to_string with std::to_string
2022-09-21 15:57:14 -04:00
m-holger
7c6901bce5
Code tidy: remove redundant calls to smart_ptrs get() method
2022-08-07 10:33:25 +01:00
Jay Berkenbilt
0e3d4cdc97
Fix/clarify meaning of depth parameter to json write methods
2022-07-31 10:32:55 -04:00
Jay Berkenbilt
4feb10fdaf
Merge pull request #734 from m-holger/nullptr
...
Code tidy : replace 0 with nullptr or true
2022-07-31 08:33:45 -04:00
m-holger
073808aa50
Code tidy : replace 0 with nullptr or true
2022-07-26 13:40:13 +01:00
Jay Berkenbilt
4674c04cb8
JSON schema: support multi-element array validation
2022-07-24 16:44:51 -04:00
Jay Berkenbilt
f8d1ab9462
JSON schema -- accept single item in place of array
...
When the schema wants a variable-length array, allow a single item as
well as allowing an array.
2022-07-24 16:17:03 -04:00
Jay Berkenbilt
c56a9ca7f6
JSON: Fix large file support
2022-05-21 09:43:45 -04:00
Jay Berkenbilt
3eb77a7004
JSON: detect duplicate dictionary keys while parsing
2022-05-20 10:13:15 -04:00
Jay Berkenbilt
6c7326b290
JSON fix: correctly parse UTF-16 surrogate pairs
2022-05-20 09:16:25 -04:00
Jay Berkenbilt
4c7cfd5cbc
JSON reactor: improve handling of nested containers
...
Call the parent container's item method before calling the child
item's start method so we can easily know the current nesting level
when nested items are added.
2022-05-14 17:35:06 -04:00
Jay Berkenbilt
948de60990
Objects json: write incrementally and in numeric order
...
The following script was used to adjust test data:
----------
#!/usr/bin/env python3
import json
import sys
import re
def json_dumps(data):
return json.dumps(data, ensure_ascii=False,
indent=2, separators=(',', ': '))
for filename in sys.argv[1:]:
with open(filename, 'r') as f:
data = json.loads(f.read())
if 'objects' not in data:
continue
trailer = None
to_sort = []
for k, v in data['objects'].items():
if k == 'trailer':
trailer = v
else:
m = re.match(r'^(\d+) \d+ R', k)
if m:
to_sort.append([int(m.group(1)), k, v])
newobjects = {x[1]: x[2] for x in sorted(to_sort)}
if trailer is not None:
newobjects['trailer'] = trailer
data['objects'] = newobjects
print(json_dumps(data))
----------
2022-05-07 08:26:31 -04:00
Jay Berkenbilt
a3c9980395
Add next to Pl_String and fix comments
2022-05-07 08:26:31 -04:00
Jay Berkenbilt
0500d4347a
JSON: add blob type that generates base64-encoded binary data
2022-05-06 19:14:52 -04:00
Jay Berkenbilt
05fda4afa2
Change JSON parser to parse from an InputSource
2022-05-04 12:07:11 -04:00
Jay Berkenbilt
e259635986
JSON: add write methods and implement unparse() in terms of those
2022-05-04 12:07:11 -04:00
Jay Berkenbilt
8d2a0eda5a
Add reactors to the JSON parser
2022-05-01 19:55:52 -04:00
Jay Berkenbilt
72e5c73419
Limit parser depth for json parser
2022-05-01 12:56:22 -04:00
Jay Berkenbilt
7f023701dd
Formatting: remove space in range-style for loops
...
Change .clang-format and commit automated changes from a fresh run of
format-code
2022-04-30 13:26:43 -04:00
Jay Berkenbilt
cdd0b4fb7d
Use = default and = delete where possible in classes
2022-04-16 11:39:14 -04:00
Jay Berkenbilt
12f1eb15ca
Programmatically apply new formatting to code
...
Run this:
for i in **/*.cc **/*.c **/*.h **/*.hh; do
clang-format < $i >| $i.new && mv $i.new $i
done
2022-04-04 08:10:40 -04:00
Jay Berkenbilt
36794a60cf
Allow \/ in a json string
2022-02-25 11:42:50 -05:00
Jay Berkenbilt
2229e37e88
Add a blank line after the first header included in each source
2022-02-04 16:31:31 -05:00
Jay Berkenbilt
f0c2e0ef1e
JSON: use std::shared_ptr internally
2022-02-04 13:12:37 -05:00
Jay Berkenbilt
9044a24097
PointerHolder: deprecate getPointer() and getRefcount()
...
Use get() and use_count() instead. Add #define
NO_POINTERHOLDER_DEPRECATION to remove deprecation markers for these
only.
This commit also removes all deprecated PointerHolder API calls from
qpdf's code except in PointerHolder's test suite, which must continue
to test the deprecated APIs.
2022-02-04 13:12:37 -05:00
Jay Berkenbilt
7097f29019
More editorial changes from m-holger + spell check
2022-01-30 13:11:03 -05:00
Jay Berkenbilt
8dea480c9f
Allow optional fields in json "schema" checks
2022-01-30 13:11:03 -05:00
Jay Berkenbilt
37105710ee
Implement JSONHandler for recursively processing JSON
2022-01-30 13:11:03 -05:00
Jay Berkenbilt
e8e8f6f43c
Add JSON::parse
2022-01-30 13:11:03 -05:00
Jay Berkenbilt
b9af421ef7
Add missing \f support for JSON string encoder
2022-01-30 13:11:03 -05:00
Jay Berkenbilt
aa0a379b37
Add JSON::isDictionary and JSON::isArray
2022-01-30 13:11:03 -05:00
Jay Berkenbilt
1a7d3700a6
Fix unnecessary copies in auto iter ( fixes #426 )
...
Also switch to colon-style iteration in some cases. Thanks to Dean
Scarff for drawing this to my attention after detecting some
unnecessary copies with
https://clang.llvm.org/extra/clang-tidy/checks/performance-for-range-copy.html
2020-04-08 20:45:26 -04:00
Jay Berkenbilt
7246404177
JSON: implement pattern keys in schema
2020-04-04 18:06:32 -04:00