ac407b2362macro renamed: PT_HAS_MORM -> PT_HAS_MORM_LIBRARY TextStream::to_string(...) is now TextStream::to_str(...) added: std::string TextStream::to_str() const; added: std::wstring TextStream::to_wstr() const;Tomasz Sowa2021-06-20 16:46:08 +02:00
819c49e638added class Stream (textstream/stream.h) which acts as a base class for TextStream TextStream is making conversions wide/utf8 nowTomasz Sowa2021-06-20 14:13:23 +02:00
865837d911fixed in Space::find_child_space_const(...) - clang address sanitizer reports stack-use-after-scope we have got a reference to a Space instead of a pointer and a local object was created and returnedTomasz Sowa2021-06-18 18:52:24 +02:00
55f6bda3abMerge branch 'api2021' added support for surrogate pairs when reading \uHHHH format added support to parse \u{H...} format (only if parsing Space format) and some fixesTomasz Sowa2021-06-14 13:51:53 +02:00
4d70ae9e87fixed: using size() when serializing strings - this allows to serialize a string which contain a null character fixed: printing null character in space format: \u0000 (before was \0 which is not correct in json) fixed: in serialize_string_buffer(const char * input_str, ...) a temporary fixed was used when copying input string added support for surrogate pairs when reading \uHHHH format added support to parse \u{H...} format (only if parsing Space format)Tomasz Sowa2021-06-14 13:48:32 +02:00
848cdf9c03Merge pull request 'api2021 part I' (#4) from api2021 into masterTomasz Sowa2021-05-27 10:37:35 +02:00
49c2b478c0fixed return value from Space::add_child_space()Tomasz Sowa2021-05-21 17:32:10 +02:00
5ce36ea844changed the way how child_spaces are created in Space class - removed child_spaces and name pointers - now a table with child spaces is created under "child_spaces" object field - a name of the child space is stored in "name" field of the child objectTomasz Sowa2021-05-21 17:13:11 +02:00
c11aa78335changed: names of methods in SpaceParser: PascalCase to snake_caseTomasz Sowa2021-05-21 04:42:55 +02:00
6e4a0f68b3removed from SpaceParser: SetDefault(), SkipEmpty(bool skip) and UseEscapeChar(bool escape) methodsTomasz Sowa2021-05-21 04:28:31 +02:00
82a21f6d85removed: SpaceParser::SetSpace(...) methods, now ParseJSON/Space(...) methods take a space as an argumentTomasz Sowa2021-05-21 01:33:01 +02:00
abeca010ccfixed: SpaceParser was using space->set_empty_object() when parsing a space and it cleared all values if not an empty object was provided to the set_space() methodTomasz Sowa2021-05-21 00:26:19 +02:00
59d4c9a9c8changed utf8 functions: PascalCase to snake_caseTomasz Sowa2021-05-21 00:24:56 +02:00
fe82f63efbchanged the way of building in MakefilesTomasz Sowa2021-05-17 03:20:51 +02:00
da6a36a205start creating tests for MainSpaceParserTomasz Sowa2021-05-17 03:19:47 +02:00
ac691bccb7updated MainSpaceParser to the new Space format, changed api to snake case now we can: - parse short options, those beginning with a hypnen '-' - parse long options, those beginning with two hyphens '--' - long options can have arguments in two forms: - either with an equal sign, e.g.: --opion-name=argument - or with a space, e.g: --option argument in the latter case we can have more than one argument, e.g: --option argument1 argument2 - parse non-option arguments, those after two hyphens to the end of a string, e.g: -- arg1 arg2Tomasz Sowa2021-05-17 03:09:21 +02:00
77d7bb5e64fixed in Space: set_empty_string(), set_empty_wstring(), set_empty_table() and set_empty_object() didn't clear its object if the same kind of object already existedTomasz Sowa2021-05-17 03:08:32 +02:00
ce81670bb6added 'tests' directory with tests for the pikotools library currently only tests for convert/text functionsTomasz Sowa2021-05-10 20:08:50 +02:00
b3cd4d5f7fremoved definition of CXX and CXXFLAGS from MakefileTomasz Sowa2021-05-10 20:07:08 +02:00
adee7d134fadded macro PT_HAS_MORM in Log class where operator<<(morm::Model & model) is usedTomasz Sowa2021-05-10 20:05:55 +02:00
7abe4b340achanges in convert/text functions - changed function names: PascalCase to snake_case - templates functions moved to a seperate file (text_private.h) - as a public api only available functions with char/wchar_t/std::string/std::wstring - ToLower(...) changed to to_lower_emplace(...), similar ToUpper(...) to to_upper_emplace(...) - added functions: std::string to_lower(const std::string & str); std::string to_upper(const std::string & str); and with std::wstring too - functions with postfix 'NoCase' changed to 'nc'Tomasz Sowa2021-05-10 20:04:12 +02:00
3984c29fbfmoved all directories to src subdirectoryTomasz Sowa2021-05-09 20:11:37 +02:00
b055c46ae8fixed#3: CompareNoCase incorrectly returned that string1 is greater than string2 for some characters when converting from 'char' to 'int' we should first convert to 'unsigned char' and then to 'int'Tomasz Sowa2021-05-08 22:37:31 +02:00
463cec3283fixed#2: Procedures for reading an utf8 string incorrectly read some utf-8 characters. Those characters were treated as invalid characters.Tomasz Sowa2021-05-07 15:53:19 +02:00
96eedd9be9added support for morm::Model to Log: Log & operator<<(morm::Model & model); but we need some kind of a macro to allow thisTomasz Sowa2021-04-30 01:17:47 +02:00
297940ff7cfix in SpaceParser when parsing json format: floating point values such as 1.123e+01 where not correctly parsed ('+' character was not correctly parsed)Tomasz Sowa2021-04-12 18:49:34 +02:00
5d34db5fcfadded to Space: - methods for testing a string value if a Space is a string or a table: bool has_value(const char * val) const; bool has_value(const std::string & val) const; bool has_value(const wchar_t * val) const; bool has_value(const std::wstring & val) const; - methods for testing a string value in an object (testing a string or a table): bool has_value(const wchar_t * field, const char * val) const; bool has_value(const wchar_t * field, const std::string & val) const; bool has_value(const wchar_t * field, const wchar_t * val) const; bool has_value(const wchar_t * field, const std::wstring & val) const; - methods for removing a child space: void remove_child_space(const wchar_t * name); void remove_child_space(const std::wstring & name); void remove_child_space(size_t index);Tomasz Sowa2021-04-09 17:49:44 +02:00
a2339eed34fixed: in Space: pointers 'name' and 'child_spaces' were not correctly initialized in cctors added in Space: - some methods for adding values to an object, such as: Space & Space::add(const std::wstring & field, bool val) (bool, short, int, long, long long etc.) - methods for creating lists: void Space::to_list(std::list<std::string> & output_list, bool clear_list) const bool Space::to_list(const wchar_t * field, std::list<std::string> & output_list, bool clear_list) const - methods for converting a value from an object field: bool Space::to_bool(const wchar_t * field, bool default_value) const - methods for testing strings: bool Space::is_equal(const char * val) const bool Space::is_equal(const std::string & val) const bool Space::is_equal(const wchar_t * val) const bool Space::is_equal(const std::wstring & val) const - methods to get the raw pointer to a value from an object, such as: bool * Space::get_bool(const wchar_t * field) float * Space::get_float(const wchar_t * field) - methods for finding a child space (used in Space format only) Space * Space::find_child_space(const wchar_t * name) Space & Space::find_add_child_space(const wchar_t * name)Tomasz Sowa2021-04-08 17:16:37 +02:00
1c643a08b0added a test whether we have reach the end of the input string without this such an input json (incorrect json string as there is no {} characters): "key": "value" would be parsed correctly: "key" would be parsed and the rest would be skippedTomasz Sowa2021-03-18 17:55:30 +01:00
539faa4976changed the indentation algorithm when pretty printing the space format (no visual changes)Tomasz Sowa2021-03-18 17:28:11 +01:00
679b9e6173added some indentation when printing 'pretty Space format'Tomasz Sowa2021-03-18 17:19:36 +01:00
4119461f8efixed: when reading a non-escaped space token we should check whether a delimiter was escaped or not also a '#' was not testedTomasz Sowa2021-03-18 16:26:56 +01:00
db5e516564added to Space: serialization do Space formatTomasz Sowa2021-03-18 15:33:43 +01:00
6e169f7650added to JSONToSpaceParser: possibility to parse the Space format renamed: ParseFile() -> ParseJSONFile() added: ParseSpaceFile(), ParseJSON(), ParseSpace()Tomasz Sowa2021-03-17 18:24:50 +01:00
31f7bdb857added to Space: child_spaces and a name of a SpaceTomasz Sowa2021-03-17 18:09:47 +01:00
5b5a1dfbb6changed the way how the library is built - now there is only one Makefile in the root directory and we have only one pikotools.a lib file - removed: mainparserTomasz Sowa2021-03-17 13:16:01 +01:00
0c0f15ab8achanged: JSONToSpaceParser can parse json string/file to the new Space format now (some minor chars escaping not ready yet)Tomasz Sowa2021-03-16 18:40:14 +01:00
ba7fa1c195fixed: in serialize_json_double(): the buffer length was calculated incorrectly: sizeof(char) changed to sizeof(wchar_t) added to Space struct: void set_null(); void set_empty_string(); void set_empty_wstring(); void set_empty_table(); void set_empty_object(); void clear();Tomasz Sowa2021-03-16 18:36:59 +01:00
bc9e4a3844use PT::WideStreamToUTF8() instead of PT::WideToUTF8() for a momentTomasz Sowa2021-03-16 18:35:08 +01:00
f65d934e8cstart working on a new version of Space struct - better support for JSON format now we have a correct model, some methods for setting/getting values and serialization to json (no serialization to Space yet)Tomasz Sowa2021-03-15 19:36:49 +01:00
fac3a7eb71reorganization in utf8 - utf8 auxiliary functions moved to utf8_private.h file - in utf8.h are shown only functions available for consumers - template functions has been moved to utf8_template.h (in utf8.h are only declarations) utf8_template.h is included at the end of utf8.h - functions which take std::ostream changed to template (the stream is a template argument now)Tomasz Sowa2021-03-15 19:34:51 +01:00
effe9be0a3added: typedef with char_type to TextStreamBaseTomasz Sowa2021-03-15 19:27:03 +01:00
448ad42961added: Toa() methods for converting to a string (new file convert/inttostr.cpp): template<class StringType> void Toa(unsigned long long value, StringType & res, bool clear_string = true, int base = 10); template<class StringType> void Toa(long long value, StringType & res, bool clear_string = true, int base = 10); template<class StringType> void Toa(unsigned long value, StringType & res, bool clear_string = true, int base = 10); template<class StringType> void Toa(long value, StringType & res, bool clear_string = true, int base = 10); template<class StringType> void Toa(unsigned int value, StringType & res, bool clear_string = true, int base = 10); template<class StringType> void Toa(int value, StringType & res, bool clear_string = true, int base = 10); template<class StringType> void Toa(unsigned short value, StringType & res, bool clear_string = true, int base = 10); template<class StringType> void Toa(short value, StringType & res, bool clear_string = true, int base = 10); std::wstring Toa(unsigned long long value, int base); std::wstring Toa(long long value, int base); std::wstring Toa(unsigned long value, int base); std::wstring Toa(long value, int base); std::wstring Toa(unsigned int value, int base); std::wstring Toa(int value, int base); std::wstring Toa(unsigned short value, int base); std::wstring Toa(short value, int base);Tomasz Sowa2021-03-03 02:24:30 +01:00
49e49d1246fixed: operator==() and operator!=() in iterators in MemBuffer<> template did not have 'const' modifier and there was an error when compiling with clang with -std=c++20 flagTomasz Sowa2021-02-17 16:53:19 +01:00
aff698d155a comment added in Log::~Log(), we have to consider whether calling save_log_and_clear() in ~Log() should be removedTomasz Sowa2021-02-17 16:51:06 +01:00
a29cb45f6aadded: in FileLog::save_log(): test whether synchro_lock() has returned trueTomasz Sowa2019-09-25 16:12:10 +00:00
7309c7817din spacetojson: if there is only one item then do not put it in the tableTomasz Sowa2019-02-19 13:08:07 +00:00
c2e63f9290added: to Date: support for parsing timezone offsetsTomasz Sowa2019-01-31 20:56:40 +00:00
5a63a8c0ecadded: to Log: IntMinWidth(size_t min_width) minimal width for integers added: to Log: operator<<(long long s) added: to TextStreamBase: operator<<(long long); operator<<(unsigned long long); int_min_width(size_t min_width); // minimal width for integersTomasz Sowa2019-01-28 18:06:18 +00:00
e9df044f9eadded to convert: PatternReplacer for replacing parameters in patterns e.g. Replace("param %0", "first param")Tomasz Sowa2019-01-07 03:29:34 +00:00
6c4a76baadchanged in utf8: functions taking WTextStream now take a template TextStreamBaseTomasz Sowa2018-11-24 17:09:25 +00:00
8b3ae14d9afixed: FileLog didn't save an utf8 sequenceTomasz Sowa2018-11-24 10:47:13 +00:00
e971e1ef9bchanged in logger: renamed Logger -> Log this class has an api (<< operators) for taking what should be put to the log file as the buffer is used WTextStream which should be allocated elsewhere added: FileLog - this class saves to a file logTomasz Sowa2018-11-23 17:07:52 +00:00