diff --git a/src/space/spaceparser.cpp b/src/space/spaceparser.cpp index e6ded1f..2e1db62 100644 --- a/src/space/spaceparser.cpp +++ b/src/space/spaceparser.cpp @@ -50,42 +50,16 @@ namespace pt SpaceParser::SpaceParser() { - root_space = 0; - SetDefault(); -} - - -void SpaceParser::SetDefault() -{ - // you can change this separators to what you want - // you shoud not use only white characters here (as expected by IsWhite() method) - // and new line characters ('\n') - separator = ':'; + root_space = nullptr; space_start = '{'; space_end = '}'; - table_start = '['; - table_end = ']'; option_delimiter = ','; - skip_empty = false; - use_escape_char = true; input_as_utf8 = true; } -void SpaceParser::SkipEmpty(bool skip) -{ - skip_empty = skip; -} - - -void SpaceParser::UseEscapeChar(bool escape) -{ - use_escape_char = escape; -} - - -void SpaceParser::UTF8(bool utf) +void SpaceParser::use_utf8(bool utf) { input_as_utf8 = utf; } @@ -1090,7 +1064,7 @@ int SpaceParser::ReadChar() char_was_escaped = false; ReadCharNoEscape(); - if( use_escape_char && lastc == '\\' ) + if( lastc == '\\' ) { char_was_escaped = true; ReadCharNoEscape(); diff --git a/src/space/spaceparser.h b/src/space/spaceparser.h index 6a1d7df..7af36db 100644 --- a/src/space/spaceparser.h +++ b/src/space/spaceparser.h @@ -60,15 +60,6 @@ public: SpaceParser(); - - - /* - setting options of the parser to the default values - utf8 etc. - */ - void SetDefault(); - - /* status of parsing */ @@ -133,33 +124,16 @@ public: */ - /* - if true then empty values and lists, e.g: - option = - option2 = () - will be omitted (not inserted to 'table') - default: false - */ - void SkipEmpty(bool skip); - /* - '\' character is used to escape other characters in a quoted string - so "some \t t\"ext" will produce "some t t"ext" - default: true - */ - void UseEscapeChar(bool escape); - - - /* - if true then the input file or string (char* or std::string) is treated as UTF-8 - default true - - the internal storage for strings is std::wstring so if you call UTF8(false) then - the characters of input string will be simple static_cast<> from char to wchar_t - */ - // rename to use_utf8(bool) - void UTF8(bool utf); + * if true then the input file or string (char* or std::string) is treated as UTF-8 + * default true + * + * the internal storage for strings is std::wstring so if you call set_utf8(false) then + * the characters of input string will be simple static_cast<> from char to wchar_t + * + */ + void use_utf8(bool utf); /* @@ -271,16 +245,6 @@ private: std::ifstream file; - /* - if true then empty lists, e.g: - option = - option2 = () - will be omitted (not inserted to 'table') - default: false - */ - bool skip_empty; - - /* input file is in UTF-8 default: true @@ -289,17 +253,8 @@ private: /* - if true you can use an escape character '\' in quoted values - */ - bool use_escape_char; - - - - /* - * * if parsing_space is false then it means we are parsing JSON format * - * */ bool parsing_space; @@ -347,7 +302,6 @@ private: void SkipLine(); void SkipWhite(); void TrimLastWhite(std::wstring & s); - //void Trim(std::wstring & s); bool IsHexDigit(wchar_t c); int HexToInt(wchar_t c); void ReadUnicodeCodePoint();