10 #ifndef ATILACALCULATORSOFTWARE_UTILITIES_H 11 #define ATILACALCULATORSOFTWARE_UTILITIES_H 26 #define GZ_BUFFER_SIZE 2000 35 #define __HERE__ std::string(__FILE__) + ":" + std::to_string(__LINE__) 40 #define __THROW__(x) throw std::runtime_error(std::string("[" + __HERE__ + "] " + x)); 43 #define __DEBUG__(x) std::cout << "[" << __HERE__ << "]" << x << std::endl; 44 #define __DEBUG_FIELDS__(x) \ 45 __DEBUG__(std::string("Fields: ") + std::string(fields[0]) + std::string(", ") + \ 46 std::string(fields[1]) + std::string(", ") + std::string(fields[2]) + \ 47 std::string(", ") + std::string(fields[3]) + std::string(", ") + \ 48 std::string(fields[4]) + std::string(", ") + std::string(fields[5]) + \ 49 std::string(", ") + std::string(fields[6]) + std::string(", ") + \ 50 std::string(fields[7]) + std::string(", ") + std::string(fields[8]) + \ 51 std::string(", ") + std::string(fields[9])); 52 #define __PDEBUG__(x, y) std::cout << "[" << __HERE__ << "]" << x << ": " << y << std::endl; 54 #define __DEBUG__(x) \ 56 #define __DEBUG_FIELDS__(x) \ 58 #define __PDEBUG__(x, y) \ 67 #define GZ_READ_CHECK(FILE, BUFFER, LEN) \ 68 if (static_cast<int>((LEN) * sizeof(*(BUFFER))) != \ 69 gzread((FILE), (BUFFER), (LEN) * sizeof(*(BUFFER)))) \ 87 inline std::string
const&
to_string(std::string
const& s) {
return s; }
99 template<
typename... TArgs> std::string
concat(TArgs
const&... args) {
105 int unpack[] { 0, (str +=
to_string(args), 0)... };
106 static_cast<void>(unpack);
125 #endif // ATILACALCULATORSOFTWARE_UTILITIES_H std::string const & to_string(std::string const &s)
Allows to use to_string method for elements that are already string.
Definition: utilities.h:87
std::string concat(TArgs const &... args)
Cast and concatenate parameter pack elements as string.
Definition: utilities.h:99
unsigned int getFields(gzFile file, char *buffer, dataFields fields)
Read fields from the given resource file.
Definition: utilities.cpp:12
char dataFields[10][40]
Definition: utilities.h:76