Commit Graph
100 Commits
Author SHA1 Message Date
Riyyi 8345f67c50 Everywhere: Switch to #pragma once, add missing copyright headers 2022-07-22 13:04:04 +02:00
Riyyi bba2b30cbb Util: Add helper Util::Json to Util::JSON::Value 2022-07-22 12:42:33 +02:00
Riyyi deb9f29b47 Util+Test: Change namespace of JSON classes: Json -> Util::JSON 2022-07-22 12:41:27 +02:00
Riyyi be74d89fea Test: Add string formatting tests 2022-07-22 12:06:42 +02:00
Riyyi 75034a2c5a Util: Implement Json::Value type customization for print formatting 2022-07-22 02:13:12 +02:00
Riyyi 835481f4a5 Util: Add formatting and type printing capability
Extending the type compatibility is done with an easy to use API.
2022-07-22 01:59:19 +02:00
Riyyi 9b3489676e Util: Add two functions to GenericLexer
- tellRemaining
- consumeSpecific
2022-07-22 01:48:14 +02:00
Riyyi dd209a2609 Util: Move json/conversion.h -> meta/odr.h 2022-07-21 01:50:15 +02:00
Riyyi 2408be335d Util: Rename two functions to be more in line with GenericLexer 2022-07-20 23:34:31 +02:00
Riyyi 42143fed71 Util: Rename Lexer/Parser get functions to consume 2022-07-20 22:57:35 +02:00
Riyyi 8dd3f11d7b Util: Run clang-format on Json::Lexer 2022-07-20 22:49:41 +02:00
Riyyi e3041bfdc7 Util: Implement GenericLexer in Json::Lexer 2022-07-20 22:49:41 +02:00
Riyyi 4ce026ec78 Util: Add GenericLexer class 2022-07-20 22:49:41 +02:00
Riyyi 4e6c5ca341 Util: Change Job m_input string -> string_view 2022-07-20 21:32:17 +02:00
Riyyi b4100113fe Util: Add missing include 2022-07-20 21:30:15 +02:00
Riyyi 11fdc64447 Util: Add pause() and resume() to Timer 2022-07-18 17:37:04 +02:00
Riyyi a92ac29d19 Util: Add parse(std::ifstream) function 2022-07-18 16:03:11 +02:00
Riyyi 07df4054da Util: Massively speedup serialization, remove all ifs from loop 2022-07-18 15:53:42 +02:00
Riyyi 2915c1c1ec Util: Reorder Array/Object functions, add empty() 2022-07-18 15:10:11 +02:00
Riyyi 161be80fd6 Util: Make second to last element detection more compatible
std::prev doesn't work on std::unordered_map, this patch makes it work.
2022-07-18 12:50:09 +02:00
Riyyi c3f5df7a29 Util: Optimize away returning strings 2022-07-18 12:42:08 +02:00
Riyyi 93eb2f4f6a Util: Optimize Value member away 2022-07-18 12:18:56 +02:00
Riyyi 99759b82b7 Util: Optimize more string creating and string.find() away 2022-07-17 22:03:48 +02:00
Riyyi 827286a0b2 Util: Optimize string creation and string.find() away 2022-07-17 21:16:53 +02:00
Riyyi 9f31a04909 Util: Optimize Lexer::getNumberOrLiteral() to one string append 2022-07-17 20:40:05 +02:00
Riyyi 3e69abdfa0 Util: Implement copy-and-swap idiom and the Rule of Five in Value 2022-07-16 00:51:32 +02:00
Riyyi a1bb1b93c9 Test: Hide JSON stderr output 2022-07-15 13:10:06 +02:00
Riyyi 7c1f95e850 Util: Prevent unnecessary copy assignment calls 2022-07-15 12:47:08 +02:00
Riyyi 0841e49b46 Util: Add user-defined string literal for Json::Value 2022-07-14 20:39:37 +02:00
Riyyi 3ea87a1d28 Util: Print Json error messages to stderr 2022-07-14 15:36:53 +02:00
Riyyi 4ea1242247 Manager: Switch to own JSON parser, remove nlohmann/json 2022-07-12 21:24:58 +02:00
Riyyi d6cd90ae4a Util: Rename Json::Value m_value union variables 2022-07-12 12:36:03 +02:00
Riyyi b76223693b Util: Add Parser and Serializer to Value friends 2022-07-12 12:07:49 +02:00
Riyyi ad137576a8 Util: Make character breaks in Lexer more clear syntactically 2022-07-12 11:17:34 +02:00
Riyyi 5835c63bda Util: Rename Array m_values -> m_elements 2022-07-12 11:06:46 +02:00
Riyyi aa283f8c75 Test: Add Json test cases 2022-07-12 02:28:22 +02:00
Riyyi 39329caf22 Util: Fix empty Object {} parsing 2022-07-12 02:00:49 +02:00
Riyyi a33f35faab Util: Rearrange Parser functions 2022-07-12 01:54:15 +02:00
Riyyi aa5b5117ad Util: Change seekForward() to go 1 step after the match 2022-07-12 01:54:15 +02:00
Riyyi 51e788a5ad Util: Change Token element access to use at() 2022-07-12 01:54:15 +02:00
Riyyi c7e4eb2575 Util: Add EOF detection in Parser getArray() getObject() 2022-07-12 01:54:15 +02:00
Riyyi 55ed70353a Util: Fix trailing comma in Object error message 2022-07-11 19:33:54 +02:00
Riyyi abb075939f Util: Properly detect empty Tokens and multiple root elements 2022-07-11 19:08:30 +02:00
Riyyi a3ab6aecfa Util: Fix comma placement in error message 2022-07-11 00:49:27 +02:00
Riyyi 097be4c012 Util: Fix Serializer trailing commas in Object dumping
The .end() returns an iterator one past the last pair, so it would
always add a comma after the last member.
2022-07-10 21:42:48 +02:00
Riyyi ea7049306e Util: Fix empty Array parsing 2022-07-10 16:13:44 +02:00
Riyyi fc3dc936fa Util: Fix line count detection for non-trailing newline in Job 2022-07-10 15:58:50 +02:00
Riyyi f2ea84be0f Util: Fix to break at the end of the file in Lexer 2022-07-10 15:49:34 +02:00
Riyyi 003db7332d Util: Add fromJson() functions for Object Value types 2022-07-10 00:56:39 +02:00
Riyyi 8797f695e0 Util: Fix type check 2022-07-10 00:41:28 +02:00
Riyyi 74dd24a516 Util: Add flexible constructor toJson() to Json::Value 2022-07-10 00:33:33 +02:00
Riyyi 5c95288874 Util: Move staticConst<T> to separate header 2022-07-10 00:30:31 +02:00
Riyyi 0c972f420c Util: Add get<T>() functionality with customization points to Value 2022-07-08 14:23:38 +02:00
Riyyi c5bbd7befd Util: Add exists() to Json::Value 2022-07-08 14:11:03 +02:00
Riyyi a209452a68 Util: Add Json::Value at() functions 2022-07-08 13:55:40 +02:00
Riyyi 4487c800df Util: Change Array constructor
std::vector supports both vector and initializer_list for construction.
2022-07-08 13:31:01 +02:00
Riyyi d9cfd3f7c1 Util: Forward declare Json::Value in Array and Object class 2022-07-08 13:29:23 +02:00
Riyyi 0465d5802a Util: Add size() getter to Json::Value 2022-07-07 09:47:34 +02:00
Riyyi 66774364fd Util: Forward declare Value in the Parser class 2022-07-06 10:51:27 +02:00
Riyyi 3078f62162 Util: Remove unneeded std::prev() use 2022-07-06 10:50:23 +02:00
Riyyi 8e92317f9e Util: Fix parsing solidus '/' 2022-07-06 10:23:43 +02:00
Riyyi c3d6af85ba Util: Rename Stringify -> Serializer 2022-07-04 17:04:16 +02:00
Riyyi 5d844554f5 Util: Fix Parser number error detection 2022-07-01 11:49:20 +02:00
Riyyi a3d1cd1d74 Util: Change Lexer line/column to 0-based 2022-07-01 11:43:15 +02:00
Riyyi ed5efdb0d6 Util: Remove unused function 2022-07-01 11:36:11 +02:00
Riyyi 4457a711cd Util: Remove debugging printf() statements 2022-07-01 11:32:26 +02:00
Riyyi 925fdd474a Util: Optimize m_index variable usage 2022-07-01 11:32:26 +02:00
Riyyi d65f56bf03 Util: Break Lexer strings on quote and new lines 2022-07-01 11:32:26 +02:00
Riyyi 4501061060 Util: Add string validation to Parser 2022-07-01 11:14:15 +02:00
Riyyi 0aef4ee2c0 Util: Only break Lexer string tokenization on unescaped " 2022-07-01 11:11:42 +02:00
Riyyi c1c9429a9d Util: Improve Lexer string tokenization 2022-06-30 20:46:11 +02:00
Riyyi 356cdaf051 Util: Add increment() and decrement() to Lexer 2022-06-30 20:46:11 +02:00
Riyyi b41bba72c9 Util: Rename Object key -> name 2022-06-30 20:46:08 +02:00
Riyyi a818c4489c Util: Add missing getter to Object 2022-06-30 20:45:33 +02:00
Riyyi 8800ff4f7a Util: Move literal validation logic to Parser 2022-06-30 20:45:33 +02:00
Riyyi 6161d577c6 Util: Change Object map unused value to uint8_t 2022-06-30 20:45:33 +02:00
Riyyi ddf0a2858b Util: Move number validation logic to Parser 2022-06-30 20:45:26 +02:00
Riyyi 8c08b8a594 Util: Add error report to Lexer default case 2022-06-29 14:14:09 +02:00
Riyyi 4a7ed92519 Util: Add constructor Value(Type) 2022-06-28 16:25:19 +02:00
Riyyi 95e0ddf49a Util: Fix return Value when an error has occurred 2022-06-28 16:24:13 +02:00
Riyyi fdeba07fd4 Util: Improve JSON parsing and add error messages 2022-06-28 16:24:13 +02:00
Riyyi a14cd1e0a5 Util: Change Parser switch cases to if-else 2022-06-28 16:11:33 +02:00
Riyyi 061ed74d4f Util: Check strings for double quotes in Lexer 2022-06-28 16:03:43 +02:00
Riyyi 8fb1a1a8e9 Util: Move vector<Token> ownership to Job class 2022-06-26 23:13:25 +02:00
Riyyi bc01b34e58 Util: Calculate JSON line number before lexing 2022-06-25 14:05:45 +02:00
Riyyi 68bc95fdf1 Util: Implement new JSON Job class 2022-06-24 14:56:37 +02:00
Riyyi 13d020a351 Util: Add JSON Job class
This class holds the to parse string and has a helper for printing error
messages.
2022-06-24 14:46:21 +02:00
Riyyi af678374bc Util: Add emplace() to Json::Value 2022-06-23 14:54:29 +02:00
Riyyi e5978310bf Util: Fix Parser Json::Value construction 2022-06-23 14:19:06 +02:00
Riyyi 8bfae9b483 Util: Add more ways of accessing and creating Json::Value objects 2022-06-23 13:47:07 +02:00
Riyyi 9f7fe81ef6 Util: Add parse() and dump() to Json::Value 2022-06-23 13:45:07 +02:00
Riyyi aad95de5fd Util: Add a JSON stringifier 2022-06-22 14:23:29 +02:00
Riyyi c385432bb0 Util: Add JSON accessors 2022-06-16 11:38:22 +02:00
Riyyi 5188d57d19 Util: Add JSON parser 2022-06-07 12:46:13 +02:00
Riyyi 0880d98fe0 Util: Add JSON Array/Object/Value types 2022-06-07 12:46:13 +02:00
Riyyi 1c676f9548 Util: Add JSON lexical analyzer 2022-06-07 12:46:13 +02:00
Riyyi cfe2987e50 Manager: Do not bail one of the targets requires root privileges 2022-03-23 23:17:50 +01:00
Riyyi 0e966a6408 Manager: Fix error message when copying files unprivileged 2022-03-23 23:16:25 +01:00
Riyyi 50baae0a66 Manager: Do not bail if one of the targets doesn't exist 2022-03-23 23:07:04 +01:00
Riyyi 4cac25b5b3 Manager: Change match() path argument type
Changed the path argument from directory_iterator to string, as nothing
in this function relied on the functionality.
2022-03-08 00:18:04 +01:00