35 lines
783 B
C++
Executable File
35 lines
783 B
C++
Executable File
#pragma once
|
|
|
|
#include <google/protobuf/io/zero_copy_stream_impl.h>
|
|
#include <boost/scoped_ptr.hpp>
|
|
#include "lib/utils/bts_no_copy.h"
|
|
|
|
#include <map>
|
|
#include <string>
|
|
#include <memory>
|
|
|
|
namespace bts {
|
|
namespace config {
|
|
|
|
namespace proto = google::protobuf;
|
|
|
|
class PreprocessInputStream : public proto::io::ZeroCopyInputStream
|
|
{
|
|
public:
|
|
PreprocessInputStream(std::istream& input, std::map<std::string, std::string> replacements);
|
|
~PreprocessInputStream();
|
|
|
|
bool Next(const void** data, int* size) override;
|
|
void BackUp(int count) override;
|
|
bool Skip(int count) override;
|
|
proto::int64 ByteCount() const override;
|
|
|
|
private:
|
|
std::string _buffer;
|
|
boost::scoped_ptr<proto::io::ArrayInputStream> _stream;
|
|
BTS_NO_COPY(PreprocessInputStream);
|
|
};
|
|
|
|
}}//namespace
|
|
|