Files
spark/src/lib/config/ConfigErrorCollector.h
T
2017-08-07 17:21:12 -04:00

54 lines
1.6 KiB
C++
Executable File

#pragma once
#include "ConfigLog.h"
#include <vector>
#include <string>
#include <google/protobuf/io/tokenizer.h>
#include <google/protobuf/descriptor.h>
namespace proto = google::protobuf;
namespace bts {
namespace config {
namespace internal {
class ConfigErrorCollector :
public proto::io::ErrorCollector,
public proto::DescriptorPool::ErrorCollector
{
public:
ConfigErrorCollector(IConfigLog& log, const char* file);
void AddError(int line, int column, const std::string& message) override;
void AddWarning(int line, int column, const std::string& message) override;
void AddError(
const std::string& filename, // File name in which the error occurred.
const std::string& element_name, // Full name of the erroneous element.
const proto::Message* descriptor, // Descriptor of the erroneous element.
ErrorLocation location, // One of the location constants, above.
const std::string& message // Human-readable error message.
) override;
void AddWarning(
const std::string& filename, // File name in which the error occurred.
const std::string& element_name, // Full name of the erroneous element.
const proto::Message* descriptor, // Descriptor of the erroneous element.
ErrorLocation location, // One of the location constants, above.
const std::string& message // Human-readable error message.
) override;
std::string ToString();
private:
BTS_NO_COPY(ConfigErrorCollector);
IConfigLog& _log;
std::string _file;
std::vector<std::string> _errors;
};
}}}//namespace