Commit Graph

17 Commits

Author SHA1 Message Date
Tomasz Sowa 7fcfdac52f Space: added pretty_print parameter to some json serializing methods 2021-08-07 21:19:38 +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 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 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 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 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 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 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 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 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 3984c29fbf moved all directories to src subdirectory 2021-05-09 20:11:37 +02:00