libjmmcg
release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
|
#include "core/application.hpp"
#include "core/exit_codes.hpp"
#include <boost/algorithm/string/split.hpp>
#include <boost/exception/diagnostic_information.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/program_options.hpp>
#include <cstdint>
#include <filesystem>
#include <fstream>
#include <iostream>
#include <map>
Go to the source code of this file.
Typedefs | |
using | row_t = std::vector< std::string > |
using | table_t = std::map< std::int32_t, row_t > |
using | parsed_csv_t = std::tuple< std::string, table_t, row_t::size_type, row_t::size_type > |
Functions | |
void | fixup_csv_line (std::string &line) noexcept(false) |
Some of the lines in the dratted CSV don't end with commas, so ensure that they do to allow the comma-recognition code to work correctly. More... | |
std::string | deoctalify (std::string const &code) noexcept(false) |
Some of the reject-codes are prefixed with zeroes, which in C++ signifies an octal number, strip those zeroes to ensure the reject-codes are correctly treated as decimal. More... | |
std::string | strip_trailing_junk (std::string const &code) noexcept(false) |
Sometimes the reject-code has trailing non-printable characters before the comma-separator. Strip it. More... | |
std::string | make_digits (std::string const &code) noexcept(false) |
Suitably clean up the reject-code. More... | |
row_t | make_row (std::string line) noexcept(false) |
Convert the scanned line from the input CSV-file into a collection of strings, one string per column. More... | |
std::string | remove_quotes (std::string const &s) noexcept(false) |
parsed_csv_t | read_csv (std::string const &fname, std::string const &version_headers, std::string const &end_of_version_headers, std::vector< std::string > const &reject_code_headers, std::string const &reject_column_name) noexcept(false) |
Read in and parse the specified CSV-file. More... | |
std::string | ASCII_ify (std::string const &arg) noexcept(false) |
Replace the non-alpha-numeric characters in the input string into underscores. More... | |
std::string | reject_code_to_enum_tag (table_t::const_iterator row, const row_t::size_type reason_index, const row_t::size_type process_index) noexcept(false) |
Construct a suitable enum-tag from the parsed row. More... | |
template<class Colln , class Op , class Trail > | |
void | fill (Colln &c, Op const &o, Trail const &t) noexcept(false) |
Apply a specified operator to all but the penultimate element in the collection, to which a different operation should be applied. More... | |
void | write_reject_code_enum (table_t const &table, const row_t::size_type reason_index, const row_t::size_type process_index, std::ostream &os) noexcept(false) |
void | write_string_table (table_t const &table, const row_t::size_type reason_index, std::ostream &os) noexcept(false) |
void | write_code_to_reason (table_t const &table, const row_t::size_type reason_index, const row_t::size_type process_index, std::ostream &os) noexcept(false) |
void | write_header (parsed_csv_t const &parsed_csv, std::string const &fname, std::string const &nm_space) noexcept(false) |
int | main (int argc, char const *const *argv) noexcept(true) |
For MIT-based protocols, auto-generate a C++ function to convert the reject codes to strings. The mapping comes from the downloaded XLS that has been converted to a CSV file. More... | |
Variables | |
constexpr const char | copyright [] |
constexpr const char | header_guard_postfix [] ="#endif\n" |
constexpr const row_t::size_type | code_index =0 |
The reject code must always be in the first column. More... | |
constexpr const row_t::size_type | max_columns =5 |
The maximum number of columns in the converted CSV. More... | |
constexpr const char | reject_codes_enum_str [] ="reject_codes_enum" |
The name of the enum that is created with tags composed from the printable characters from the string relating to the reject-code. More... | |
typedef std::tuple< std::string, table_t, row_t::size_type, row_t::size_type > parsed_csv_t |
Definition at line 37 of file reject_codes.cpp.
typedef std::vector< std::string > row_t |
Definition at line 35 of file reject_codes.cpp.
Definition at line 36 of file reject_codes.cpp.
|
inlinenoexcept |
Replace the non-alpha-numeric characters in the input string into underscores.
Definition at line 272 of file reject_codes.cpp.
|
inlinenoexcept |
Some of the reject-codes are prefixed with zeroes, which in C++ signifies an octal number, strip those zeroes to ensure the reject-codes are correctly treated as decimal.
Definition at line 82 of file reject_codes.cpp.
|
inlinenoexcept |
Apply a specified operator to all but the penultimate element in the collection, to which a different operation should be applied.
Algorithmic complexity: O(n)
c | The input collection. |
o | The functor to be applied to all but the penultimate element in the input collection. |
t | The functor to be applied to the penultimate element in the input collection. |
Definition at line 302 of file reject_codes.cpp.
|
inlinenoexcept |
Some of the lines in the dratted CSV don't end with commas, so ensure that they do to allow the comma-recognition code to work correctly.
If a terminal comma is omitted, that last column will be read as empty.
Definition at line 74 of file reject_codes.cpp.
|
noexcept |
For MIT-based protocols, auto-generate a C++ function to convert the reject codes to strings. The mapping comes from the downloaded XLS that has been converted to a CSV file.
Definition at line 417 of file reject_codes.cpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::exit_codes::exit_print_help, jmmcg::LIBJMMCG_VER_NAMESPACE::exit_codes::exit_print_version, jmmcg::LIBJMMCG_VER_NAMESPACE::exit_codes::exit_stl_exception, jmmcg::LIBJMMCG_VER_NAMESPACE::exit_codes::exit_success, jmmcg::LIBJMMCG_VER_NAMESPACE::exit_codes::exit_unknown_exception, and jmmcg::LIBJMMCG_VER_NAMESPACE::exit_codes::exit_unknown_failure.
|
inlinenoexcept |
Suitably clean up the reject-code.
Definition at line 102 of file reject_codes.cpp.
|
inlinenoexcept |
Convert the scanned line from the input CSV-file into a collection of strings, one string per column.
Also replace non-printable ASCII characters with underscores.
Also replace non-printable ASCII characters with underscores.
Definition at line 113 of file reject_codes.cpp.
|
inlinenoexcept |
Read in and parse the specified CSV-file.
Note that any lines with non-digit reject-codes will be silently ignored. All FixGateway reject-codes are ignored (as they cause duplicates) & the links are binary-only.
fname | The suitably-qualified path to the suitably-formatted CSV file. It must be comma separated, with no embedded commas. |
ver_headers | The string that specifies the headers for the version-table. |
Definition at line 155 of file reject_codes.cpp.
|
inlinenoexcept |
Construct a suitable enum-tag from the parsed row.
Definition at line 287 of file reject_codes.cpp.
|
inlinenoexcept |
Definition at line 141 of file reject_codes.cpp.
|
inlinenoexcept |
Sometimes the reject-code has trailing non-printable characters before the comma-separator. Strip it.
Definition at line 92 of file reject_codes.cpp.
|
inlinenoexcept |
Definition at line 353 of file reject_codes.cpp.
References reject_codes_enum_str.
|
inlinenoexcept |
Definition at line 388 of file reject_codes.cpp.
References header_guard_postfix.
|
inlinenoexcept |
Definition at line 313 of file reject_codes.cpp.
References reject_codes_enum_str.
|
inlinenoexcept |
Definition at line 334 of file reject_codes.cpp.
|
constexpr |
The reject code must always be in the first column.
Definition at line 63 of file reject_codes.cpp.
|
constexpr |
Definition at line 39 of file reject_codes.cpp.
|
constexpr |
Definition at line 61 of file reject_codes.cpp.
Referenced by write_header().
|
constexpr |
The maximum number of columns in the converted CSV.
Definition at line 65 of file reject_codes.cpp.
|
constexpr |
The name of the enum that is created with tags composed from the printable characters from the string relating to the reject-code.
Definition at line 67 of file reject_codes.cpp.
Referenced by write_code_to_reason(), and write_reject_code_enum().