tomasz.sowa
bdb2616f32
added: HTMLFilter (html/htmlfilter.h|cpp) - copied from winix project
2021-07-17 13:35:10 +02:00
tomasz.sowa
1e5598cde1
added to Date: SerializeMonthAsRoman(Stream & out, int month) - serialize month in Roman numerals
...
added a param: 'bool roman_month' to some serialize methods
2021-07-06 21:44:04 +02:00
tomasz.sowa
198945c97b
PatternReplacerBase: to_string() changed to to_str()
2021-07-06 21:42:42 +02:00
tomasz.sowa
34f1fc04cf
added Space::remove(size_t table_index) for removing a table item
...
fixed: pretty printing for Space format
2021-06-29 23:25:31 +02:00
tomasz.sowa
8997284b16
added trim(...) functions to convert/text.h
...
void trim_first_white(std::string & str, bool check_additional_chars = true, bool treat_new_line_as_white = true);
void trim_first_white(std::wstring & str, bool check_additional_chars = true, bool treat_new_line_as_white = true);
void trim_last_white(std::string & str, bool check_additional_chars = true, bool treat_new_line_as_white = true);
void trim_last_white(std::wstring & str, bool check_additional_chars = true, bool treat_new_line_as_white = true);
void trim_white(std::string & str, bool check_additional_chars = true, bool treat_new_line_as_white = true);
void trim_white(std::wstring & str, bool check_additional_chars = true, bool treat_new_line_as_white = true);
void trim_first(std::string & str, wchar_t c);
void trim_first(std::wstring & str, wchar_t c);
void trim_last(std::string & str, wchar_t c);
void trim_last(std::wstring & str, wchar_t c);
void trim(std::string & str, wchar_t c);
void trim(std::wstring & str, wchar_t c);
2021-06-29 23:23:35 +02:00
tomasz.sowa
e31ef3c6c4
make depend
2021-06-27 22:34:05 +02:00
tomasz.sowa
e0d6e7fcb1
added to Space:
...
Space & get_add_space(const wchar_t * field);
Space & get_add_space(const std::wstring & field);
2021-06-27 15:58:53 +02:00
tomasz.sowa
009e240a8d
fixed some memory leaks in Space, pointers in tables and objects were not correctly 'deleted', affected methods:
...
set_empty_table()
set_empty_object()
add(const wchar_t * field, Space && space)
copy_value_object(const Value & value_from)
copy_value_table(const Value & value_from)
initialize_value_object_if_needed(ObjectType && obj)
initialize_value_table_if_needed(TableType && tab)
add_generic(const wchar_t * field, const ArgType & val)
2021-06-27 15:41:38 +02:00
tomasz.sowa
4a1630b1ea
removed support for so called child objects from Space (this was an old feature of Space struct, now not needed)
...
Space::get_object_field(...) renamed to Space::get_space(...)
2021-06-26 22:56:12 +02:00
tomasz.sowa
8ec9350d52
added two functions to utf8:
...
template<typename StreamType> bool utf8_to_wide(const Stream & stream, StreamType & res, bool clear = true, int mode = 1);
template<typename StreamType> bool wide_stream_to_utf8(const Stream & stream, StreamType & utf8, bool clear = true, int mode = 1);
these functions are moved from TextStreamBase
2021-06-25 19:10:01 +02:00
tomasz.sowa
792057a869
make depend
2021-06-24 21:18:48 +02:00
tomasz.sowa
4d9f5f6c55
Log class has the Stream class as a base class now
...
- implemented some missing operators<<(...)
- removed Manipulators: l1, l2, l3, l4, lend, lsave
- PascalCase to snake_case in Log
added to Stream:
virtual bool is_char_stream() const = 0;
virtual bool is_wchar_stream() const = 0;
virtual char get_char(size_t index) const = 0;
virtual wchar_t get_wchar(size_t index) const = 0;
virtual Stream & operator<<(const Stream & stream) = 0;
2021-06-24 20:52:48 +02:00
tomasz.sowa
2b6789754f
implemented pretty printing in Space::serialize_to_json_stream(StreamType & str, bool pretty_print, int level)
2021-06-23 21:54:34 +02:00
tomasz.sowa
3c0b59e115
added to Space: long double to Space::Value and methods for converting from/to long double
...
added global methods for converting float/string double/string and long double/string (convert/double.h|cpp):
float to_float(const char * str, const char ** after = nullptr);
float to_float(const wchar_t * str, const wchar_t ** after = nullptr);
double to_double(const char * str, const char ** after = nullptr);
double to_double(const wchar_t * str, const wchar_t ** after = nullptr);
long double to_long_double(const char * str, const char ** after = nullptr);
long double to_long_double(const wchar_t * str, const wchar_t ** after = nullptr);
float to_float(const std::string & str, const char ** after = nullptr);
float to_float(const std::wstring & str, const wchar_t ** after = nullptr);
double to_double(const std::string & str, const char ** after = nullptr);
double to_double(const std::wstring & str, const wchar_t ** after = nullptr);
long double to_long_double(const std::string & str, const char ** after = nullptr);
long double to_long_double(const std::wstring & str, const wchar_t ** after = nullptr);
std::string to_str(float val);
std::wstring to_wstr(float val);
std::string to_str(double val);
std::wstring to_wstr(double val);
std::string to_str(long double val);
std::wstring to_wstr(long double val);
2021-06-23 17:01:43 +02:00
tomasz.sowa
c1f1dc96df
added Space::serialize_to_string(StreamType & stream) template
2021-06-22 17:52:55 +02:00
tomasz.sowa
99fbdc1635
in Log::~Log(): removed call to save_log_and_clear()
...
it creates a problem if a buffer is destroyed first:
2021-06-20 18:19:53 +02:00
tomasz.sowa
4a2a99a77d
removed a comment
2021-06-20 17:39:37 +02:00
tomasz.sowa
0865c41e48
make depend
2021-06-20 16:47:12 +02:00
tomasz.sowa
ac407b2362
macro 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;
2021-06-20 16:46:08 +02:00
tomasz.sowa
819c49e638
added class Stream (textstream/stream.h) which acts as a base class for TextStream
...
TextStream is making conversions wide/utf8 now
2021-06-20 14:13:23 +02:00
tomasz.sowa
865837d911
fixed 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 returned
==15076==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7fffffffc7c0 at pc 0x000800a5d1bd bp 0x7fffffffc700 sp 0x7fffffffc6f8
READ of size 4 at 0x7fffffffc7c0 thread T0
#0 0x800a5d1bc in pt::Space::is_object() const /usr/home/tomek/roboczy/prog/pikotools/src/space/space.cpp:778:9
#1 0x800a67046 in pt::Space::get_object_field(wchar_t const*) /usr/home/tomek/roboczy/prog/pikotools/src/space/space.cpp:1519:6
#2 0x800a6761c in pt::Space::get_table(wchar_t const*) /usr/home/tomek/roboczy/prog/pikotools/src/space/space.cpp:1582:18
#3 0x800a694cb in pt::Space::find_child_space_table() /usr/home/tomek/roboczy/prog/pikotools/src/space/space.cpp:1953:9
#4 0x800855718 in Winix::TimeZone::SetTz(pt::Space&) /usr/home/tomek/roboczy/prog/winix/winixd/core/timezone.cpp:316:45
#5 0x80085b3a9 in Winix::TimeZones::ParseZones() /usr/home/tomek/roboczy/prog/winix/winixd/core/timezones.cpp:134:18
#6 0x80085c04b in Winix::TimeZones::ReadTimeZones(wchar_t const*) /usr/home/tomek/roboczy/prog/winix/winixd/core/timezones.cpp:176:3
#7 0x80085c69f in Winix::TimeZones::ReadTimeZones(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&) /usr/home/tomek/roboczy/prog/winix/winixd/core/timezones.cpp:199:9
#8 0x80083c380 in Winix::System::ReadTimeZones() /usr/home/tomek/roboczy/prog/winix/winixd/core/system.cpp:122:13
#9 0x80083ca19 in Winix::System::Init() /usr/home/tomek/roboczy/prog/winix/winixd/core/system.cpp:172:2
#10 0x80069ce41 in Winix::App::Init() /usr/home/tomek/roboczy/prog/winix/winixd/core/app.cpp:355:9
#11 0x2de92e in main /usr/home/tomek/roboczy/prog/winix/winixd/main/main.cpp:206:11
Address 0x7fffffffc7c0 is located in stack of thread T0 at offset 128 in frame
#0 0x800a66f3f in pt::Space::get_object_field(wchar_t const*) /usr/home/tomek/roboczy/prog/pikotools/src/space/space.cpp:1518
This frame has 3 object(s):
[32, 40) 'i' (line 1521)
[64, 88) 'ref.tmp' (line 1521)
[128, 136) 'ref.tmp4' (line 1523) <== Memory access at offset 128 is inside this variable
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
(longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-use-after-scope /usr/home/tomek/roboczy/prog/pikotools/src/space/space.cpp:778:9 in pt::Space::is_object() const
Shadow bytes around the buggy address:
0x4ffffffff8a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x4ffffffff8b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x4ffffffff8c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x4ffffffff8d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x4ffffffff8e0: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 f8 f2 f2 f2
=>0x4ffffffff8f0: f8 f8 f8 f2 f2 f2 f2 f2[f8]f3 f3 f3 00 00 00 00
0x4ffffffff900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x4ffffffff910: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x4ffffffff920: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 f8 f2 f2 f2
0x4ffffffff930: f8 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00
0x4ffffffff940: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc
==15076==ABORTING
2021-06-18 18:52:24 +02:00
tomasz.sowa
6d2503ae0e
make depend
2021-06-16 23:44:21 +02:00
tomasz.sowa
06e0f13df9
added a comment in textstream.h
2021-06-16 17:44:24 +02:00
tomasz.sowa
8b0ed5e750
added to TextStream:
...
TextStreamBase & operator<<(unsigned char);
TextStreamBase & operator<<(bool);
TextStreamBase & operator<<(short);
TextStreamBase & operator<<(unsigned short);
TextStreamBase & operator<<(float);
TextStreamBase & operator<<(long double);
2021-06-15 19:54:50 +02:00
tomasz.sowa
4d70ae9e87
fixed: 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)
2021-06-14 13:48:32 +02:00
tomasz.sowa
49c2b478c0
fixed return value from Space::add_child_space()
2021-05-21 17:32:10 +02:00
tomasz.sowa
5ce36ea844
changed 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 object
added methods for manipulating with child spaces:
TableType * find_child_space_table()
bool child_spaces_empty()
size_t child_spaces_size()
Space * find_child_space(size_t table_index)
Space & add_child_space(const wchar_t * space_name)
Space & add_child_space(const std::wstring & space_name)
std::wstring * find_child_space_name()
std::wstring get_child_space_name()
bool is_child_space_name(const wchar_t * name)
added additional methods:
size_t str_size()
size_t wstr_size()
size_t object_size()
size_t table_size()
2021-05-21 17:13:11 +02:00
tomasz.sowa
c11aa78335
changed: names of methods in SpaceParser: PascalCase to snake_case
2021-05-21 04:42:55 +02:00
tomasz.sowa
6e4a0f68b3
removed from SpaceParser: SetDefault(), SkipEmpty(bool skip) and UseEscapeChar(bool escape) methods
2021-05-21 04:28:31 +02:00
tomasz.sowa
82a21f6d85
removed: SpaceParser::SetSpace(...) methods, now ParseJSON/Space(...) methods take a space as an argument
2021-05-21 01:33:01 +02:00
tomasz.sowa
abeca010cc
fixed: 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() method
2021-05-21 00:26:19 +02:00
tomasz.sowa
59d4c9a9c8
changed utf8 functions: PascalCase to snake_case
2021-05-21 00:24:56 +02:00
tomasz.sowa
b574289054
namespace PT renamed to pt
2021-05-20 16:11:12 +02:00
tomasz.sowa
6f50626dda
fixed another memory leak in CSVParser::parse() (similar like before)
2021-05-19 22:34:10 +02:00
tomasz.sowa
f8d24de386
fixed memory leak in CSVParser::parse() - a Space struct was allocated but never freed
2021-05-19 22:31:18 +02:00
tomasz.sowa
604b47db32
added move semantics to Space class
...
added methods:
Space(Space && space);
Space & operator=(Space && space);
void set(const Space & space);
void set(Space && space);
Space & add(const Space & space);
Space & add(Space && space);
Space & add(const wchar_t * field, const Space & space);
Space & add(const wchar_t * field, Space && space);
Space & add(const std::wstring & field, const Space & space);
Space & add(const std::wstring & field, Space && space);
2021-05-19 22:24:53 +02:00
tomasz.sowa
430822bad8
make depend
2021-05-19 03:26:57 +02:00
tomasz.sowa
0ea5497094
added CSVParser - a csv parser
2021-05-19 03:26:46 +02:00
tomasz.sowa
ae1d25d5f3
removed old not used variable from Space
2021-05-19 03:23:18 +02:00
tomasz.sowa
e0565813de
removed *.a from .gitignore
2021-05-18 23:58:46 +02:00
tomasz.sowa
db93586c0e
make depend
2021-05-18 23:58:17 +02:00
tomasz.sowa
ad4e8078ae
MainSpaceParser class has been renamed to MainOptionsParser
2021-05-18 23:57:58 +02:00
tomasz.sowa
96e60c526f
moved files: mainspaceparser/mainspaceparser.(h|cpp) -> mainoptions/mainoptionsparser.(h|cpp)
2021-05-18 23:50:42 +02:00
tomasz.sowa
a5c8833452
added tests for MainSpaceParser
2021-05-18 22:57:26 +02:00
tomasz.sowa
91300bb245
make depend
2021-05-17 03:21:00 +02:00
tomasz.sowa
fe82f63efb
changed the way of building in Makefiles
2021-05-17 03:20:51 +02:00
tomasz.sowa
da6a36a205
start creating tests for MainSpaceParser
2021-05-17 03:19:47 +02:00
tomasz.sowa
ac691bccb7
updated 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 arg2
2021-05-17 03:09:21 +02:00
tomasz.sowa
77d7bb5e64
fixed 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 existed
2021-05-17 03:08:32 +02:00
tomasz.sowa
3d6c4e27c0
added .editorconfig file with tab style and tab size information
...
https://editorconfig.org/
2021-05-15 18:34:10 +02:00
tomasz.sowa
1260b303bc
added ./m to .gitignore
2021-05-10 21:24:37 +02:00
tomasz.sowa
d3dd74b3d4
added tests/tests to .gitignore
2021-05-10 20:16:54 +02:00
tomasz.sowa
7bdc4d2fc7
added global Makefile
2021-05-10 20:10:10 +02:00
tomasz.sowa
ce81670bb6
added 'tests' directory with tests for the pikotools library
...
currently only tests for convert/text functions
2021-05-10 20:08:50 +02:00
tomasz.sowa
cd9e501f48
make depend
2021-05-10 20:08:19 +02:00
tomasz.sowa
b3cd4d5f7f
removed definition of CXX and CXXFLAGS from Makefile
2021-05-10 20:07:08 +02:00
tomasz.sowa
adee7d134f
added macro PT_HAS_MORM in Log class where operator<<(morm::Model & model) is used
2021-05-10 20:05:55 +02:00
tomasz.sowa
7abe4b340a
changes 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'
2021-05-10 20:04:12 +02:00
tomasz.sowa
3984c29fbf
moved all directories to src subdirectory
2021-05-09 20:11:37 +02:00
tomasz.sowa
127f26884e
make depend
2021-05-08 22:40:06 +02:00
tomasz.sowa
b055c46ae8
fixed #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'
2021-05-08 22:37:31 +02:00
tomasz.sowa
463cec3283
fixed #2 : Procedures for reading an utf8 string incorrectly read some utf-8 characters.
...
Those characters were treated as invalid characters.
UTF8ToInt_FirstOctet incorrectly checked if the first octed is zero (after removing first bits).
This is a case only if the utf-8 character consists of two bytes. For 3 or 4 bytes
the first part can have all bits equal zero.
2021-05-07 15:53:19 +02:00
tomasz.sowa
96eedd9be9
added support for morm::Model to Log:
...
Log & operator<<(morm::Model & model);
but we need some kind of a macro to allow this
2021-04-30 01:17:47 +02:00
tomasz.sowa
f572250572
make depend
2021-04-30 01:17:29 +02:00
tomasz.sowa
16f6bdb358
fixed: Space::has_value(...) incorrectly compared strings
2021-04-14 17:42:57 +02:00
tomasz.sowa
297940ff7c
fix in SpaceParser when parsing json format: floating point values such as 1.123e+01 where not correctly parsed ('+' character was not correctly parsed)
...
added to Space: some methods for searching a field with ignoring case:
Space * get_object_field_nc(const wchar_t * field)
Space * get_object_field_nc(const std::wstring & field);
const Space * get_object_field_nc(const wchar_t * field) const;
const Space * get_object_field_nc(const std::wstring & field) const;
2021-04-12 18:49:34 +02:00
tomasz.sowa
5d34db5fcf
added 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);
2021-04-09 17:49:44 +02:00
tomasz.sowa
a1e8f13f46
fixed: calculating buffer length in Space: sizeof(char) -> sizeof(wchar_t)
2021-04-08 17:40:30 +02:00
tomasz.sowa
a2339eed34
fixed: 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)
2021-04-08 17:16:37 +02:00
tomasz.sowa
0aeac12fa0
make depend
2021-04-08 17:02:27 +02:00
tomasz.sowa
1c643a08b0
added 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 skipped
2021-03-18 17:55:30 +01:00
tomasz.sowa
539faa4976
changed the indentation algorithm when pretty printing the space format (no visual changes)
2021-03-18 17:28:11 +01:00
tomasz.sowa
679b9e6173
added some indentation when printing 'pretty Space format'
2021-03-18 17:19:36 +01:00
tomasz.sowa
4119461f8e
fixed: when reading a non-escaped space token we should check whether a delimiter was escaped or not
...
also a '#' was not tested
2021-03-18 16:26:56 +01:00
tomasz.sowa
db5e516564
added to Space: serialization do Space format
2021-03-18 15:33:43 +01:00
tomasz.sowa
1baf5042fe
removed: SpaceToJson
2021-03-17 18:35:48 +01:00
tomasz.sowa
ba82ac7cbe
renamed: JSONToSpaceParser -> SpaceParser
2021-03-17 18:33:41 +01:00
tomasz.sowa
961a02ab39
removed: old SpaceParser
2021-03-17 18:26:13 +01:00
tomasz.sowa
6e169f7650
added to JSONToSpaceParser: possibility to parse the Space format
...
renamed: ParseFile() -> ParseJSONFile()
added: ParseSpaceFile(), ParseJSON(), ParseSpace()
2021-03-17 18:24:50 +01:00
tomasz.sowa
31f7bdb857
added to Space: child_spaces and a name of a Space
2021-03-17 18:09:47 +01:00
tomasz.sowa
5b5a1dfbb6
changed 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: mainparser
2021-03-17 13:16:01 +01:00
tomasz.sowa
61291cf7ad
make depend
2021-03-16 18:43:34 +01:00
tomasz.sowa
0c0f15ab8a
changed: JSONToSpaceParser can parse json string/file to the new Space format now
...
(some minor chars escaping not ready yet)
2021-03-16 18:40:14 +01:00
tomasz.sowa
ba7fa1c195
fixed: 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();
2021-03-16 18:36:59 +01:00
tomasz.sowa
bc9e4a3844
use PT::WideStreamToUTF8() instead of PT::WideToUTF8() for a moment
2021-03-16 18:35:08 +01:00
tomasz.sowa
4ef8f5a884
template<size_t stack_size, size_t heap_block_size> changed to template<typename StreamType>
2021-03-15 20:09:23 +01:00
tomasz.sowa
f65d934e8c
start 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)
2021-03-15 19:36:49 +01:00
tomasz.sowa
7ccd435e2c
make depend
2021-03-15 19:36:04 +01:00
tomasz.sowa
fac3a7eb71
reorganization 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)
2021-03-15 19:34:51 +01:00
tomasz.sowa
effe9be0a3
added: typedef with char_type to TextStreamBase
2021-03-15 19:27:03 +01:00
tomasz.sowa
df88d4c0fc
temporarily blocked for compilation: mainspaceparser, jsontospaceparser, spaceparser, spacetojson
2021-03-15 19:25:04 +01:00
tomasz.sowa
f771f12027
renamed: std::wstring Toa(...) -> std::wstring to_str(...)
...
added: std::string to_str(...)
2021-03-15 19:23:49 +01:00
tomasz.sowa
448ad42961
added: 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);
2021-03-03 02:24:30 +01:00
tomasz.sowa
d9a4fa34e2
added .gitignore file
2021-02-17 17:04:05 +01:00
tomasz.sowa
49e49d1246
fixed: 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 flag
/usr/home/tomek/roboczy/prog/web.ttmath.org/../pikotools/textstream/textstream.h:225:11: fatal error: use of overloaded operator '!=' is ambiguous (with operand types
'PT::TextStreamBase<char, 256, 4096>::const_iterator' (aka 'PT::MemBuffer<char, 256, 4096>::const_iterator') and 'PT::TextStreamBase<char, 256, 4096>::const_iterator')
for( ; i != end() ; ++i)
~ ^ ~~~~~
/usr/home/tomek/roboczy/prog/web.ttmath.org/../morm/src/finderhelper.h:78:14: note: in instantiation of member function 'PT::TextStreamBase<char, 256, 4096>::to_string' requested here
table_name.to_string(table_name_str);
^
/usr/home/tomek/roboczy/prog/web.ttmath.org/../pikotools/membuffer/membuffer.h:93:8: note: candidate function
bool operator!=(const const_iterator & i);
^
/usr/home/tomek/roboczy/prog/web.ttmath.org/../pikotools/membuffer/membuffer.h:92:8: note: candidate function
bool operator==(const const_iterator & i);
^
/usr/home/tomek/roboczy/prog/web.ttmath.org/../pikotools/membuffer/membuffer.h:92:8: note: candidate function (with reversed parameter order)
2021-02-17 16:53:19 +01:00
tomasz.sowa
aff698d155
a comment added in Log::~Log(), we have to consider whether calling save_log_and_clear() in ~Log() should be removed
2021-02-17 16:51:06 +01:00
tomasz.sowa
a29cb45f6a
added: in FileLog::save_log(): test whether synchro_lock() has returned true
...
git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1216 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-09-25 16:12:10 +00:00
tomasz.sowa
7309c7817d
in spacetojson: if there is only one item then do not put it in the table
...
git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1170 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-02-19 13:08:07 +00:00
tomasz.sowa
c2e63f9290
added: to Date: support for parsing timezone offsets
...
git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1168 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-01-31 20:56:40 +00:00
tomasz.sowa
5a63a8c0ec
added: 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 integers
git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1167 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-01-28 18:06:18 +00:00