checks-parser/output/output_options.h

67 lines
1.5 KiB
C
Raw Normal View History

2024-11-22 23:26:42 +03:00
#ifndef OUTPUT_OPTIONS_H
#define OUTPUT_OPTIONS_H
#include <string>
#include <vector>
2024-12-01 18:53:16 +03:00
#if __GNUC__ < 8
# include <experimental/filesystem>
#else
# include <filesystem>
#endif
2024-11-22 23:26:42 +03:00
#include <iostream>
#include <string>
#include <vector>
#include "../net/net.h"
#include "../settings/settings.h"
enum class ColumnType {
goods_name,
goods_price_per_unit,
goods_quantity,
goods_net_weight,
goods_total
};
struct Column { // Example:
ColumnType type; // goods_name
std::string name; // "Товар"
unsigned int position; // "0" <-- 0 = "A", 1 = "B", etc.. column letter in
// table processor (i.e. excel or libreoffice)
} typedef Column;
enum class OutputFormat { csv, ods, xlsx, plaintext } typedef OutputFormat;
class OutputOptions {
std::vector<Column> order;
bool print_header;
bool print_total;
OutputFormat format;
std::string path;
public:
OutputOptions();
void add_or_update_column(Column &);
void update_column(Column&, unsigned short);
void remove_column(unsigned short);
void remove_column(ColumnType);
unsigned short find_column(ColumnType);
bool column_exist(ColumnType);
Column& get_column(ColumnType);
std::vector<Column>& get_columns();
void set_print_header(bool);
bool get_print_header();
void set_print_total(bool);
bool get_print_total();
void set_output_format(OutputFormat);
OutputFormat get_output_format();
void set_path(std::string);
std::string &get_path();
};
#endif // OUTPUT_OPTIONS_H