From eff097a0590574eea49cb196ed3e276fc1e5d09d Mon Sep 17 00:00:00 2001 From: chatlanin Date: Sun, 27 Mar 2022 23:04:36 +0300 Subject: [PATCH] return --- src/logger/logger.cpp | 10 ++++---- src/logger/logger.hpp | 58 +++++++++++++++++++++---------------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/logger/logger.cpp b/src/logger/logger.cpp index 7dbc049..520f4df 100644 --- a/src/logger/logger.cpp +++ b/src/logger/logger.cpp @@ -2,22 +2,22 @@ namespace hack { - // std::string log::devider = " "; - // int log::count = 0; + std::string log::devider = " "; + int log::count = 0; log::log(const std::string devider_, std::experimental::source_location location_) : location { location_ } { - //this->devider = devider_; + this->devider = devider_; } warn::warn(const std::string devider_, std::experimental::source_location location_) : location { location_ } { - //this->devider = devider_; + this->devider = devider_; } error::error(const std::string devider_, std::experimental::source_location location_) : location { location_ } { - //this->devider = devider_; + this->devider = devider_; } void log::print() { std::cout << std::endl; } diff --git a/src/logger/logger.hpp b/src/logger/logger.hpp index bab34bf..75943bb 100644 --- a/src/logger/logger.hpp +++ b/src/logger/logger.hpp @@ -21,80 +21,80 @@ namespace hack template void operator() (const Args&... args) { - std::cout /*<< make_type_view*/ + std::cout << make_type_view << location.file_name() << ":" << view::color::reset << view::color::italic << view::color::yellow << location.function_name() << "()" << view::color::reset << view::color::bold << view::color::blue << "[" << location.line() << "]" << view::color::reset << ": "; - //count = sizeof...(Args); + count = sizeof...(Args); print(args...); } private: std::experimental::source_location location; - //static int count; - //static std::string devider; + static int count; + static std::string devider; private: - void print(); + static void print(); - std::ostream& make_type_view(std::ostream &os) + static std::ostream& make_type_view(std::ostream &os) { os << view::color::bold << view::color::green << "[ok]" << view::color::reset << view::color::green; return os; } template - void print(const T& data, const Args&... args) + static void print(const T& data, const Args&... args) { - //count--; + count--; print_t(data); print(args...); } template - void print_t(const T& data) + static void print_t(const T& data) { - //std::cout << data << (count != 0 ? devider : ""); + std::cout << data << (count != 0 ? devider : ""); } template - void print_t(const T& data) + static void print_t(const T& data) { - //std::cout << data << (count != 0 ? devider : ""); + std::cout << data << (count != 0 ? devider : ""); } template - void print_t(const T& data) + static void print_t(const T& data) { std::cout << "{ "; std::copy(data.cbegin(), data.cend(), iterators::sequence_ostream_iterator(data.size(), std::cout)); - //std::cout << " }" << (count != 0 ? devider : ""); + std::cout << " }" << (count != 0 ? devider : ""); } template - void print_t(const T& data) + static void print_t(const T& data) { std::cout << "{"; std::copy(data.cbegin(), data.cend(), iterators::associative_ostream_iterator(data.size(), std::cout)); - //std::cout << "}" << (count != 0 ? devider : ""); + std::cout << "}" << (count != 0 ? devider : ""); } template - void print_t(const T& data) + static void print_t(const T& data) { print_t(data, std::make_index_sequence::value>{}); } template - void print_t(const T& data, std::index_sequence) + static void print_t(const T& data, std::index_sequence) { std::cout << "{ "; - // ((std::cout << std::get(data) << (idx != std::tuple_size::value - 1 ? devider : "")), ...); - //std::cout << " }" << (count != 0 ? devider : ""); + ((std::cout << std::get(data) << (idx != std::tuple_size::value - 1 ? devider : "")), ...); + std::cout << " }" << (count != 0 ? devider : ""); } template - void print_t(const matrix& data) + static void print_t(const matrix& data) { std::size_t index = data.size(); for (auto& r : data) @@ -107,9 +107,9 @@ namespace hack } template - void print_t(const T& data) + static void print_t(const T& data) { - //std::cout << data << (count != 0 ? devider : ""); + std::cout << data << (count != 0 ? devider : ""); } friend class warn; @@ -127,11 +127,11 @@ namespace hack template void operator() (const Args&... args) { - std::cout /*<< make_type_view*/ + std::cout << make_type_view << location.file_name() << ":" << view::color::reset << view::color::italic << view::color::yellow << location.function_name() << "()" << view::color::reset << view::color::bold << view::color::blue << "[" << location.line() << "]" << view::color::reset << ": "; - //count = sizeof...(Args); + count = sizeof...(Args); print(args...); } @@ -139,7 +139,7 @@ namespace hack std::experimental::source_location location; private: - std::ostream& make_type_view(std::ostream &os) + static std::ostream& make_type_view(std::ostream &os) { os << view::color::bold << view::color::yellow << "[WARN]" << view::color::reset << view::color::yellow; return os; @@ -157,11 +157,11 @@ namespace hack template void operator() (const Args&... args) { - std::cout /*<< make_type_view*/ + std::cout << make_type_view << location.file_name() << ":" << view::color::reset << view::color::italic << view::color::yellow << location.function_name() << "()" << view::color::reset << view::color::bold << view::color::blue << "[" << location.line() << "]" << view::color::reset << ": "; - //count = sizeof...(Args); + count = sizeof...(Args); print(args...); } @@ -169,7 +169,7 @@ namespace hack std::experimental::source_location location; private: - std::ostream& make_type_view(std::ostream &os) + static std::ostream& make_type_view(std::ostream &os) { os << view::color::bold << view::color::red << "[ERROR]" << view::color::reset << view::color::red; return os;