|
@@ -3,7 +3,7 @@
|
|
|
* Company: Lynar Studios
|
|
|
* E-Mail: webmaster@lynarstudios.com
|
|
|
* Created: 2020-12-25
|
|
|
- * Changed: 2023-02-04
|
|
|
+ * Changed: 2023-02-05
|
|
|
*
|
|
|
* */
|
|
|
|
|
@@ -48,9 +48,9 @@ bool ls::std::io::KvParser::_contains(const ::std::string &_text, const ::std::s
|
|
|
return _text.find(_searchText) != ::std::string::npos;
|
|
|
}
|
|
|
|
|
|
-bool ls::std::io::KvParser::_lineHasPair(const ls::std::io::KvParseParameter &_parseParameter)
|
|
|
+bool ls::std::io::KvParser::_lineHasPair(ls::std::io::KvParseParameter &_parseParameter)
|
|
|
{
|
|
|
- return ls::std::io::KvParser::_contains(_parseParameter.line, "=") && ls::std::io::KvParser::_contains(_parseParameter.line, ";");
|
|
|
+ return ls::std::io::KvParser::_contains(_parseParameter.getLine(), "=") && ls::std::io::KvParser::_contains(_parseParameter.getLine(), ";");
|
|
|
}
|
|
|
|
|
|
void ls::std::io::KvParser::_parse(const ls::std::core::type::byte_field &_data)
|
|
@@ -59,17 +59,17 @@ void ls::std::io::KvParser::_parse(const ls::std::core::type::byte_field &_data)
|
|
|
{
|
|
|
ls::std::io::KvParseParameter parseParameter = ls::std::io::KvParser::_readLine(_data, index);
|
|
|
this->_parsePair(parseParameter);
|
|
|
- index = parseParameter.index;
|
|
|
+ index = parseParameter.getIndex();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void ls::std::io::KvParser::_parsePair(const ls::std::io::KvParseParameter &_parseParameter)
|
|
|
+void ls::std::io::KvParser::_parsePair(ls::std::io::KvParseParameter &_parseParameter)
|
|
|
{
|
|
|
if (ls::std::io::KvParser::_lineHasPair(_parseParameter))
|
|
|
{
|
|
|
- size_t equalSignPosition = _parseParameter.line.find('=');
|
|
|
- ls::std::core::type::kv_key key = _parseParameter.line.substr(0, equalSignPosition);
|
|
|
- ls::std::core::type::kv_value value = _parseParameter.line.substr(equalSignPosition + 1);
|
|
|
+ size_t equalSignPosition = _parseParameter.getLine().find('=');
|
|
|
+ ls::std::core::type::kv_key key = _parseParameter.getLine().substr(0, equalSignPosition);
|
|
|
+ ls::std::core::type::kv_value value = _parseParameter.getLine().substr(equalSignPosition + 1);
|
|
|
value = value.substr(0, value.find(';'));
|
|
|
|
|
|
this->document->addPair(ls::std::io::KvPair{key, value});
|
|
@@ -79,32 +79,32 @@ void ls::std::io::KvParser::_parsePair(const ls::std::io::KvParseParameter &_par
|
|
|
ls::std::io::KvParseParameter ls::std::io::KvParser::_readLine(const ls::std::core::type::byte_field &_data, ::std::string::size_type _index)
|
|
|
{
|
|
|
ls::std::io::KvParseParameter parseParameter{};
|
|
|
- parseParameter.line = _data.substr(_index);
|
|
|
+ parseParameter.setLine(_data.substr(_index));
|
|
|
|
|
|
- if (ls::std::io::KvParser::_contains(parseParameter.line, ls::std::io::NewLine::getWindowsNewLine()))
|
|
|
+ if (ls::std::io::KvParser::_contains(parseParameter.getLine(), ls::std::io::NewLine::getWindowsNewLine()))
|
|
|
{
|
|
|
ls::std::io::KvParser::_readLineWithWindowsLineBreak(parseParameter);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if (ls::std::io::KvParser::_contains(parseParameter.line, ls::std::io::NewLine::getUnixNewLine()))
|
|
|
+ if (ls::std::io::KvParser::_contains(parseParameter.getLine(), ls::std::io::NewLine::getUnixNewLine()))
|
|
|
{
|
|
|
ls::std::io::KvParser::_readLineWithUnixLineBreak(parseParameter);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- parseParameter.index = _index + parseParameter.line.size();
|
|
|
+ parseParameter.setIndex(_index + parseParameter.getLine().size());
|
|
|
return parseParameter;
|
|
|
}
|
|
|
|
|
|
void ls::std::io::KvParser::_readLineWithUnixLineBreak(ls::std::io::KvParseParameter &_parseParameter)
|
|
|
{
|
|
|
- size_t newLinePosition = _parseParameter.line.find(ls::std::io::NewLine::getUnixNewLine());
|
|
|
- _parseParameter.line = _parseParameter.line.substr(0, newLinePosition);
|
|
|
+ size_t newLinePosition = _parseParameter.getLine().find(ls::std::io::NewLine::getUnixNewLine());
|
|
|
+ _parseParameter.setLine(_parseParameter.getLine().substr(0, newLinePosition));
|
|
|
}
|
|
|
|
|
|
void ls::std::io::KvParser::_readLineWithWindowsLineBreak(ls::std::io::KvParseParameter &_parseParameter)
|
|
|
{
|
|
|
- size_t newLinePosition = _parseParameter.line.find(ls::std::io::NewLine::getWindowsNewLine());
|
|
|
- _parseParameter.line = _parseParameter.line.substr(0, newLinePosition + 1);
|
|
|
+ size_t newLinePosition = _parseParameter.getLine().find(ls::std::io::NewLine::getWindowsNewLine());
|
|
|
+ _parseParameter.setLine(_parseParameter.getLine().substr(0, newLinePosition + 1));
|
|
|
}
|