Github user zuyu commented on a diff in the pull request:

    https://github.com/apache/incubator-quickstep/pull/232#discussion_r112825394
  
    --- Diff: cli/LineReaderBuffered.hpp ---
    @@ -0,0 +1,75 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + **/
    +
    +#ifndef QUICKSTEP_CLI_LINE_READER_BUFFERED_HPP_
    +#define QUICKSTEP_CLI_LINE_READER_BUFFERED_HPP_
    +
    +#include <string>
    +
    +#include "cli/LineReader.hpp"
    +#include "utility/Macros.hpp"
    +
    +namespace quickstep {
    +
    +class LineReaderBuffered : public LineReader {
    + public:
    +  /**
    +   * @brief A line reader which accepts a string buffer.
    +   * Other line readers are meant to support some form of user 
interaction. This linereader does not and is intended for
    +   * programmer use- it does not print anything to stdout. Therefore it 
ignores any prompt strings given to the
    +   * inherited constructor.
    +   * @param default_prompt Not used by this line reader, but required by 
interface.
    +   * @param continue_prompt Not used by this line reader, but required by 
interface.
    +   */
    +  LineReaderBuffered(const std::string &default_prompt,
    +                     const std::string &continue_prompt);
    +
    +  LineReaderBuffered();
    +
    +  ~LineReaderBuffered() override {}
    +
    +  /**
    +   * @brief Replaces the current buffer contents with new contents.
    +   * @param buffer Replacement text.
    +   */
    +  void setBuffer(std::string buffer) {
    +    leftover_ = buffer;
    +    buffer_empty_ = false;
    +  }
    +
    +  /**
    +   * @brief This is set to true after getNextCommand is called and runs 
out of input to process.
    +   * @return True if the buffer has been consumed.
    +   */
    +  bool bufferEmpty() {
    --- End diff --
    
    Mark `const`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to