2016-12-14 17:27:41 +08:00
|
|
|
#pragma once
|
|
|
|
|
2017-02-18 18:54:37 +08:00
|
|
|
#include <iostream>
|
|
|
|
#include <map>
|
2016-12-14 17:27:41 +08:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2017-02-15 21:10:16 +08:00
|
|
|
class PrintRecordStream {
|
2017-02-18 18:54:37 +08:00
|
|
|
private:
|
2017-02-15 21:10:16 +08:00
|
|
|
std::ostream &stream;
|
2016-12-14 17:27:41 +08:00
|
|
|
|
2017-02-18 18:54:37 +08:00
|
|
|
public:
|
2017-02-15 21:10:16 +08:00
|
|
|
PrintRecordStream(std::ostream &stream) : stream(stream) {}
|
2016-12-14 17:27:41 +08:00
|
|
|
|
2017-02-18 18:54:37 +08:00
|
|
|
void write_success() { stream << "SUCCESS\n"; }
|
2016-12-14 17:27:41 +08:00
|
|
|
|
2017-02-18 18:54:37 +08:00
|
|
|
void write_success_empty() { stream << "SUCCESS EMPTY\n"; }
|
2016-12-14 17:27:41 +08:00
|
|
|
|
2017-02-18 18:54:37 +08:00
|
|
|
void write_ignored() { stream << "IGNORED\n"; }
|
2016-12-14 17:27:41 +08:00
|
|
|
|
2017-02-18 18:54:37 +08:00
|
|
|
void write_empty_fields() { stream << "EMPTY FIELDS\n"; }
|
2016-12-14 17:27:41 +08:00
|
|
|
|
2017-02-18 18:54:37 +08:00
|
|
|
void write_fields(const std::vector<std::string> &fields) {
|
2017-02-15 21:10:16 +08:00
|
|
|
stream << "FIELDS:";
|
|
|
|
for (auto &field : fields) {
|
|
|
|
stream << " " << field;
|
2016-12-14 17:27:41 +08:00
|
|
|
}
|
2017-02-15 21:10:16 +08:00
|
|
|
stream << '\n';
|
|
|
|
}
|
2016-12-14 17:27:41 +08:00
|
|
|
|
2017-02-15 21:10:16 +08:00
|
|
|
void write_field(const std::string &field) {
|
|
|
|
stream << "Field: " << field << '\n';
|
|
|
|
}
|
2016-12-14 17:27:41 +08:00
|
|
|
|
2017-02-18 18:54:37 +08:00
|
|
|
void write_list_header(size_t size) { stream << "List: " << size << '\n'; }
|
2016-12-14 17:27:41 +08:00
|
|
|
|
2017-02-18 18:54:37 +08:00
|
|
|
void write_record() { stream << "Record\n"; }
|
2016-12-14 17:27:41 +08:00
|
|
|
|
2017-02-15 21:10:16 +08:00
|
|
|
void write_meta(const std::string &type) {
|
|
|
|
stream << "Meta: " << type << std::endl;
|
|
|
|
}
|
2016-12-14 17:27:41 +08:00
|
|
|
|
2017-02-18 18:54:37 +08:00
|
|
|
void write_failure(const std::map<std::string, std::string> &data) {
|
2017-02-15 21:10:16 +08:00
|
|
|
}
|
2016-12-14 17:27:41 +08:00
|
|
|
|
2017-02-21 22:37:32 +08:00
|
|
|
void write_count(const size_t count) { }
|
2016-12-14 17:27:41 +08:00
|
|
|
};
|