1 #ifndef DBALLE_CMDLINE_PROCESSOR_H
2 #define DBALLE_CMDLINE_PROCESSOR_H
9 #define DBALLE_JSON_VERSION "0.1"
43 const std::string& filename,
45 const std::string& msg)
46 : filename(filename), index(index)
48 initmsg(filename, index, msg.c_str());
60 const std::string& filename,
62 const std::exception& original)
63 : filename(filename), index(index)
65 initmsg(filename, index, original.what());
78 const std::string& filename,
80 const std::string& msg,
81 const std::exception& original)
82 : filename(filename), index(index)
84 initmsg(filename, index, msg.c_str());
86 this->msg += original.what();
91 virtual const char* what()
const throw ()
97 void initmsg(
const std::string& fname,
unsigned index,
const char* msg);
123 virtual bool operator()(
const Item& item) = 0;
128 std::vector<std::pair<int, int>> ranges;
130 void parse(
const std::string& str);
132 bool match(
int val)
const;
138 int subcategory = -1;
142 const char* index_filter =
nullptr;
143 const char* input_type =
"auto";
144 const char* fail_file_name =
nullptr;
151 int subcategory = -1;
162 void set_index_filter(
const std::string& val);
170 bool match_index(
int idx)
const;
172 bool match_msgs(
const Messages& msgs)
const;
177 bool match_item(
const Item& item)
const;
183 std::string input_type;
184 const char* fail_file_name;
186 void read_csv(
const std::list<std::string>& fnames,
Action& action);
187 void read_json(
const std::list<std::string>& fnames,
Action& action);
188 void read_file(
const std::list<std::string>& fnames,
Action& action);
193 bool verbose =
false;
194 unsigned count_successes = 0;
195 unsigned count_failures = 0;
199 bool has_fail_file()
const;
201 void read(
const std::list<std::string>& fnames,
Action& action);
Definition: processor.h:126
Definition: processor.h:120
void processing_failed(std::exception &e) const __attribute__((noreturn))
Throw a ProcessingException based on e.
Definition: processor.h:180
Message importer.
Definition: codec.h:33
void matcher_reset()
Reset to the empty matcher.
ProcessingException(const std::string &filename, unsigned index, const std::string &msg, const std::exception &original)
Create a new exception.
Definition: processor.h:77
Definition: processor.h:147
Definition: processor.h:100
Match DB-All.e objects using the same queries that can be made on DB-All.e databases.
Definition: matcher.h:92
void decode(msg::Importer &imp, bool print_errors=false)
Decode all that can be decoded.
Binary message.
Definition: file.h:132
ProcessingException(const std::string &filename, unsigned index, const std::exception &original)
Create a new exception.
Definition: processor.h:59
Ordered collection of messages.
Definition: message.h:67
Query used to filter DB-All.e data.
Definition: query.h:14
Definition: processor.h:135
void matcher_from_record(const Query &query)
Initialise the matcher from a record.
Exception used to embed processing issues that mean that processing of the current element can safely...
Definition: processor.h:29
void set_msgs(Messages *new_msgs)
Set the value of msgs, possibly replacing the previous one.
ProcessingException(const std::string &filename, unsigned index, const std::string &msg)
Create a new exception.
Definition: processor.h:42