return
This commit is contained in:
parent
4820cbf7f7
commit
eff097a059
@ -2,22 +2,22 @@
|
|||||||
|
|
||||||
namespace hack
|
namespace hack
|
||||||
{
|
{
|
||||||
// std::string log::devider = " ";
|
std::string log::devider = " ";
|
||||||
// int log::count = 0;
|
int log::count = 0;
|
||||||
|
|
||||||
log::log(const std::string devider_, std::experimental::source_location location_) : location { location_ }
|
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_ }
|
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_ }
|
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; }
|
void log::print() { std::cout << std::endl; }
|
||||||
|
@ -21,80 +21,80 @@ namespace hack
|
|||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
void operator() (const Args&... args)
|
void operator() (const Args&... args)
|
||||||
{
|
{
|
||||||
std::cout /*<< make_type_view*/
|
std::cout << make_type_view
|
||||||
<< location.file_name() << ":" << view::color::reset
|
<< location.file_name() << ":" << view::color::reset
|
||||||
<< view::color::italic << view::color::yellow << location.function_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 << ": ";
|
<< view::color::bold << view::color::blue << "[" << location.line() << "]" << view::color::reset << ": ";
|
||||||
//count = sizeof...(Args);
|
count = sizeof...(Args);
|
||||||
print(args...);
|
print(args...);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::experimental::source_location location;
|
std::experimental::source_location location;
|
||||||
//static int count;
|
static int count;
|
||||||
//static std::string devider;
|
static std::string devider;
|
||||||
|
|
||||||
private:
|
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;
|
os << view::color::bold << view::color::green << "[ok]" << view::color::reset << view::color::green;
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename... Args>
|
template<typename T, typename... Args>
|
||||||
void print(const T& data, const Args&... args)
|
static void print(const T& data, const Args&... args)
|
||||||
{
|
{
|
||||||
//count--;
|
count--;
|
||||||
print_t(data);
|
print_t(data);
|
||||||
print(args...);
|
print(args...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<concepts::is_string T>
|
template<concepts::is_string T>
|
||||||
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<std::integral T>
|
template<std::integral T>
|
||||||
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<concepts::is_sequence_container T>
|
template<concepts::is_sequence_container T>
|
||||||
void print_t(const T& data)
|
static void print_t(const T& data)
|
||||||
{
|
{
|
||||||
std::cout << "{ ";
|
std::cout << "{ ";
|
||||||
std::copy(data.cbegin(), data.cend(), iterators::sequence_ostream_iterator<typename T::value_type>(data.size(), std::cout));
|
std::copy(data.cbegin(), data.cend(), iterators::sequence_ostream_iterator<typename T::value_type>(data.size(), std::cout));
|
||||||
//std::cout << " }" << (count != 0 ? devider : "");
|
std::cout << " }" << (count != 0 ? devider : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
template<concepts::is_map T>
|
template<concepts::is_map T>
|
||||||
void print_t(const T& data)
|
static void print_t(const T& data)
|
||||||
{
|
{
|
||||||
std::cout << "{";
|
std::cout << "{";
|
||||||
std::copy(data.cbegin(), data.cend(), iterators::associative_ostream_iterator<typename T::value_type>(data.size(), std::cout));
|
std::copy(data.cbegin(), data.cend(), iterators::associative_ostream_iterator<typename T::value_type>(data.size(), std::cout));
|
||||||
//std::cout << "}" << (count != 0 ? devider : "");
|
std::cout << "}" << (count != 0 ? devider : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
template<concepts::is_tuple T, typename std::size_t... idx>
|
template<concepts::is_tuple T, typename std::size_t... idx>
|
||||||
void print_t(const T& data)
|
static void print_t(const T& data)
|
||||||
{
|
{
|
||||||
print_t(data, std::make_index_sequence<std::tuple_size<T>::value>{});
|
print_t(data, std::make_index_sequence<std::tuple_size<T>::value>{});
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename std::size_t... idx>
|
template<typename T, typename std::size_t... idx>
|
||||||
void print_t(const T& data, std::index_sequence<idx...>)
|
static void print_t(const T& data, std::index_sequence<idx...>)
|
||||||
{
|
{
|
||||||
std::cout << "{ ";
|
std::cout << "{ ";
|
||||||
// ((std::cout << std::get<idx>(data) << (idx != std::tuple_size<T>::value - 1 ? devider : "")), ...);
|
((std::cout << std::get<idx>(data) << (idx != std::tuple_size<T>::value - 1 ? devider : "")), ...);
|
||||||
//std::cout << " }" << (count != 0 ? devider : "");
|
std::cout << " }" << (count != 0 ? devider : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, std::size_t demention>
|
template<typename T, std::size_t demention>
|
||||||
void print_t(const matrix<T, demention>& data)
|
static void print_t(const matrix<T, demention>& data)
|
||||||
{
|
{
|
||||||
std::size_t index = data.size();
|
std::size_t index = data.size();
|
||||||
for (auto& r : data)
|
for (auto& r : data)
|
||||||
@ -107,9 +107,9 @@ namespace hack
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<concepts::not_defined T>
|
template<concepts::not_defined T>
|
||||||
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;
|
friend class warn;
|
||||||
@ -127,11 +127,11 @@ namespace hack
|
|||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
void operator() (const Args&... args)
|
void operator() (const Args&... args)
|
||||||
{
|
{
|
||||||
std::cout /*<< make_type_view*/
|
std::cout << make_type_view
|
||||||
<< location.file_name() << ":" << view::color::reset
|
<< location.file_name() << ":" << view::color::reset
|
||||||
<< view::color::italic << view::color::yellow << location.function_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 << ": ";
|
<< view::color::bold << view::color::blue << "[" << location.line() << "]" << view::color::reset << ": ";
|
||||||
//count = sizeof...(Args);
|
count = sizeof...(Args);
|
||||||
print(args...);
|
print(args...);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ namespace hack
|
|||||||
std::experimental::source_location location;
|
std::experimental::source_location location;
|
||||||
|
|
||||||
private:
|
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;
|
os << view::color::bold << view::color::yellow << "[WARN]" << view::color::reset << view::color::yellow;
|
||||||
return os;
|
return os;
|
||||||
@ -157,11 +157,11 @@ namespace hack
|
|||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
void operator() (const Args&... args)
|
void operator() (const Args&... args)
|
||||||
{
|
{
|
||||||
std::cout /*<< make_type_view*/
|
std::cout << make_type_view
|
||||||
<< location.file_name() << ":" << view::color::reset
|
<< location.file_name() << ":" << view::color::reset
|
||||||
<< view::color::italic << view::color::yellow << location.function_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 << ": ";
|
<< view::color::bold << view::color::blue << "[" << location.line() << "]" << view::color::reset << ": ";
|
||||||
//count = sizeof...(Args);
|
count = sizeof...(Args);
|
||||||
print(args...);
|
print(args...);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ namespace hack
|
|||||||
std::experimental::source_location location;
|
std::experimental::source_location location;
|
||||||
|
|
||||||
private:
|
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;
|
os << view::color::bold << view::color::red << "[ERROR]" << view::color::reset << view::color::red;
|
||||||
return os;
|
return os;
|
||||||
|
Loading…
Reference in New Issue
Block a user