aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/yaml-cpp/src/parser.cpp
diff options
context:
space:
mode:
authorantonyzhilin <antonyzhilin@yandex-team.com>2024-07-05 19:56:10 +0300
committerantonyzhilin <antonyzhilin@yandex-team.com>2024-07-05 20:06:51 +0300
commit92272084057d874f12ce24f5a7950b867f7d50c2 (patch)
tree80fd973f61edfd5c1961c6dd024096b5f2822a5e /contrib/libs/yaml-cpp/src/parser.cpp
parentada19b071f15ecd5d6784db9fd710f68bcccf310 (diff)
downloadydb-92272084057d874f12ce24f5a7950b867f7d50c2.tar.gz
feat contrib: update yaml-cpp to 0.8.0
6e6348bacf1f4cc2d24d90954c63619ba9bee1f0
Diffstat (limited to 'contrib/libs/yaml-cpp/src/parser.cpp')
-rw-r--r--contrib/libs/yaml-cpp/src/parser.cpp28
1 files changed, 9 insertions, 19 deletions
diff --git a/contrib/libs/yaml-cpp/src/parser.cpp b/contrib/libs/yaml-cpp/src/parser.cpp
index cd69f39fce..b8b78ebabc 100644
--- a/contrib/libs/yaml-cpp/src/parser.cpp
+++ b/contrib/libs/yaml-cpp/src/parser.cpp
@@ -11,15 +11,13 @@
namespace YAML {
class EventHandler;
-Parser::Parser() {}
+Parser::Parser() : m_pScanner{}, m_pDirectives{} {}
-Parser::Parser(std::istream& in) { Load(in); }
+Parser::Parser(std::istream& in) : Parser() { Load(in); }
-Parser::~Parser() {}
+Parser::~Parser() = default;
-Parser::operator bool() const {
- return m_pScanner.get() && !m_pScanner->empty();
-}
+Parser::operator bool() const { return m_pScanner && !m_pScanner->empty(); }
void Parser::Load(std::istream& in) {
m_pScanner.reset(new Scanner(in));
@@ -27,7 +25,7 @@ void Parser::Load(std::istream& in) {
}
bool Parser::HandleNextDocument(EventHandler& eventHandler) {
- if (!m_pScanner.get())
+ if (!m_pScanner)
return false;
ParseDirectives();
@@ -43,11 +41,7 @@ bool Parser::HandleNextDocument(EventHandler& eventHandler) {
void Parser::ParseDirectives() {
bool readDirective = false;
- while (1) {
- if (m_pScanner->empty()) {
- break;
- }
-
+ while (!m_pScanner->empty()) {
Token& token = m_pScanner->peek();
if (token.type != Token::DIRECTIVE) {
break;
@@ -113,17 +107,13 @@ void Parser::HandleTagDirective(const Token& token) {
}
void Parser::PrintTokens(std::ostream& out) {
- if (!m_pScanner.get()) {
+ if (!m_pScanner) {
return;
}
- while (1) {
- if (m_pScanner->empty()) {
- break;
- }
-
+ while (!m_pScanner->empty()) {
out << m_pScanner->peek() << "\n";
m_pScanner->pop();
}
}
-}
+} // namespace YAML