BasicParser now uses string_view

This commit is contained in:
MihailRis
2024-05-08 23:32:04 +03:00
parent 65e85f362c
commit 5da2a30326
9 changed files with 45 additions and 43 deletions
+3 -3
View File
@@ -177,7 +177,7 @@ const std::string& Document::getEncoding() const {
return encoding;
}
Parser::Parser(const std::string& filename, const std::string& source)
Parser::Parser(std::string_view filename, std::string_view source)
: BasicParser(filename, source) {
}
@@ -250,7 +250,7 @@ std::string Parser::parseText() {
}
nextChar();
}
return source.substr(start, pos-start);
return std::string(source.substr(start, pos-start));
}
inline bool is_xml_identifier_start(char c) {
@@ -270,7 +270,7 @@ std::string Parser::parseXMLName() {
while (hasNext() && is_xml_identifier_part(source[pos])) {
pos++;
}
return source.substr(start, pos-start);
return std::string(source.substr(start, pos-start));
}
xmlelement Parser::parseElement() {