github-actions[bot] commented on code in PR #19185: URL: https://github.com/apache/doris/pull/19185#discussion_r1188189080
########## be/src/util/jsonb_document.h: ########## @@ -213,6 +224,83 @@ class JsonbDocument { char payload_[0]; }; +/// A simple input stream class for the JSON path parser. +class Stream { +public: + /// Creates an input stream reading from a character string. + /// @param string the input string + /// @param length the length of the input string + Stream(const char* string, size_t length) : m_position(string), m_end(string + length), leg() {} + + /// Returns a pointer to the current position in the stream. + const char* position() const { return m_position; } + + /// Returns a pointer to the position just after the end of the stream. + const char* end() const { return m_end; } + + /// Returns the number of bytes remaining in the stream. + size_t remaining() const { + assert(m_position <= m_end); + return m_end - m_position; + } + + /// Tells if the stream has been exhausted. + bool exhausted() const { return remaining() == 0; } + + /// Reads the next byte from the stream and moves the position forward. + char read() { + assert(!exhausted()); + return *m_position++; + } + + /// Reads the next byte from the stream without moving the position forward. + char peek() const { + assert(!exhausted()); + return *m_position; + } + + /// Moves the position to the next non-whitespace character. + void skip_whitespace() { + m_position = std::find_if_not(m_position, m_end, [](char c) { return std::isspace(c); }); Review Comment: warning: no member named 'find_if_not' in namespace 'std' [clang-diagnostic-error] ```cpp m_position = std::find_if_not(m_position, m_end, [](char c) { return std::isspace(c); }); ^ ``` ########## be/src/util/jsonb_document.h: ########## @@ -213,6 +224,83 @@ char payload_[0]; }; +/// A simple input stream class for the JSON path parser. +class Stream { +public: + /// Creates an input stream reading from a character string. + /// @param string the input string + /// @param length the length of the input string + Stream(const char* string, size_t length) : m_position(string), m_end(string + length), leg() {} + + /// Returns a pointer to the current position in the stream. + const char* position() const { return m_position; } + + /// Returns a pointer to the position just after the end of the stream. + const char* end() const { return m_end; } + + /// Returns the number of bytes remaining in the stream. + size_t remaining() const { + assert(m_position <= m_end); + return m_end - m_position; + } + + /// Tells if the stream has been exhausted. + bool exhausted() const { return remaining() == 0; } + + /// Reads the next byte from the stream and moves the position forward. + char read() { + assert(!exhausted()); + return *m_position++; + } + + /// Reads the next byte from the stream without moving the position forward. + char peek() const { + assert(!exhausted()); + return *m_position; + } + + /// Moves the position to the next non-whitespace character. + void skip_whitespace() { + m_position = std::find_if_not(m_position, m_end, [](char c) { return std::isspace(c); }); Review Comment: warning: no member named 'isspace' in namespace 'std' [clang-diagnostic-error] ```cpp m_position = std::find_if_not(m_position, m_end, [](char c) { return std::isspace(c); }); ^ ``` ########## be/src/util/jsonb_document.h: ########## @@ -213,6 +224,83 @@ char payload_[0]; }; +/// A simple input stream class for the JSON path parser. +class Stream { +public: + /// Creates an input stream reading from a character string. + /// @param string the input string + /// @param length the length of the input string + Stream(const char* string, size_t length) : m_position(string), m_end(string + length), leg() {} + + /// Returns a pointer to the current position in the stream. + const char* position() const { return m_position; } + + /// Returns a pointer to the position just after the end of the stream. + const char* end() const { return m_end; } + + /// Returns the number of bytes remaining in the stream. + size_t remaining() const { + assert(m_position <= m_end); + return m_end - m_position; + } + + /// Tells if the stream has been exhausted. + bool exhausted() const { return remaining() == 0; } + + /// Reads the next byte from the stream and moves the position forward. + char read() { + assert(!exhausted()); + return *m_position++; + } + + /// Reads the next byte from the stream without moving the position forward. + char peek() const { + assert(!exhausted()); + return *m_position; + } + + /// Moves the position to the next non-whitespace character. + void skip_whitespace() { + m_position = std::find_if_not(m_position, m_end, [](char c) { return std::isspace(c); }); + } + + /// Moves the position n bytes forward. + void skip(size_t n) { + assert(remaining() >= n); + m_position += n; + } + + void appendLeg(char a) { leg += a; } + + void clearLeg() { leg.clear(); } + + void setLeg(std::string a) { + clearLeg(); + leg = a; + } + + std::string getLeg() { return leg; } Review Comment: warning: no type named 'string' in namespace 'std' [clang-diagnostic-error] ```cpp std::string getLeg() { return leg; } ^ ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org