change dir name

This commit is contained in:
chatlanin 2023-05-23 12:13:38 +03:00
parent b0ea45e84d
commit d691c0e655
29 changed files with 60 additions and 78 deletions

39
bin/main.cpp Normal file → Executable file
View File

@ -7,20 +7,20 @@
#include <type_traits> #include <type_traits>
#include <string_view> #include <string_view>
#include "string/string.hpp" #include "hack/string/string.hpp"
#include "string/string_concat_helper.hpp" #include "hack/string/string_concat_helper.hpp"
#include "range/range.hpp" #include "hack/range/range.hpp"
#include "container/container.hpp" #include "hack/container/container.hpp"
#include "logger/logger.hpp" #include "hack/logger/logger.hpp"
#include "math/matrix.hpp" #include "hack/math/matrix.hpp"
#include "math/vector.hpp" #include "hack/math/vector.hpp"
#include "utils/utils.hpp" #include "hack/utils/utils.hpp"
#include "utils/func_query.hpp" #include "hack/utils/func_query.hpp"
#include "security/validate_email.hpp" #include "hack/security/validate_email.hpp"
#include "security/uuid.hpp" #include "hack/security/uuid.hpp"
#include "security/is_string.hpp" #include "hack/security/is_string.hpp"
#include "security/is_link.hpp" #include "hack/security/is_link.hpp"
#include "string/utf8_len.hpp" #include "hack/string/utf8_len.hpp"
// for example // for example
int f(int a) int f(int a)
@ -44,11 +44,16 @@ struct ForTypeTrace
int a; int a;
}; };
struct counter_test : public hack::utils::counter<int> struct counter_test
{ {
counter_test() : id { ++hack::utils::counter<int>::id } { } counter_test() : id { ++hack::utils::counter<int>::id } { }
int id; int id;
};
struct counter_test_2
{
counter_test_2() : id { ++hack::utils::counter<int>::id } { }
int id;
}; };
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@ -278,7 +283,9 @@ int main(int argc, char *argv[])
{// ex: counter {// ex: counter
counter_test a, b, c; counter_test a, b, c;
counter_test_2 a1, b1, c1;
hack::log()(c.id); hack::log()(c.id);
hack::log()(c1.id);
} }
{// ex: case as string {// ex: case as string
@ -299,7 +306,7 @@ int main(int argc, char *argv[])
query = hack::utils::make_query("super_function", 1, 'c'); query = hack::utils::make_query("super_function", 1, 'c');
hack::log()("query", query); hack::log()("query", query);
hack::utils::json js { "test", "data" }; hack::utils::JSON js { "test", "data" };
query = hack::utils::make_query("super_function", 1, 123.3f, js); query = hack::utils::make_query("super_function", 1, 123.3f, js);
hack::log()("query", query); hack::log()("query", query);

3
bin/meson.build Normal file → Executable file
View File

@ -2,5 +2,6 @@ executable(
'hack', 'hack',
'main.cpp', 'main.cpp',
dependencies : deps, dependencies : deps,
cpp_args: args cpp_args: args,
include_directories : inc
) )

View File

@ -42,4 +42,4 @@ inc = []
subdir('src') subdir('src')
subdir('bin') subdir('bin')
subdir('tests') # subdir('tests')

View File

@ -4,11 +4,11 @@
#include "boost/type_index.hpp" #include "boost/type_index.hpp"
#include "view/color.hpp" #include "hack/view/color.hpp"
#include "concepts/concepts.hpp" #include "hack/concepts/concepts.hpp"
#include "iterators/sequence_ostream_iterator.hpp" #include "hack/iterators/sequence_ostream_iterator.hpp"
#include "iterators/associative_ostream_iterator.hpp" #include "hack/iterators/associative_ostream_iterator.hpp"
#include "math/matrix.hpp" #include "hack/math/matrix.hpp"
// #include "nlohmann/json.hpp" // #include "nlohmann/json.hpp"
namespace hack namespace hack
@ -25,7 +25,11 @@ namespace hack
class log class log
{ {
public: public:
log(std::string devider_ = ", ", std::experimental::source_location location_ = std::experimental::source_location::current()); log(std::string devider_ = ", ", std::experimental::source_location location_ = std::experimental::source_location::current()) : location { location_ }
{
this->devider = devider_;
}
log(log&) = delete; log(log&) = delete;
log(log&&) = delete; log(log&&) = delete;
@ -48,11 +52,11 @@ namespace hack
private: private:
std::experimental::source_location location; std::experimental::source_location location;
static int count; inline static int count = 0;
static std::string devider; inline static std::string devider = " ";
private: private:
static void print(); static void print() { std::cout << std::endl; }
static std::ostream& make_type_view(std::ostream &os) static std::ostream& make_type_view(std::ostream &os)
{ {
@ -136,7 +140,11 @@ namespace hack
class warn : public log class warn : public log
{ {
public: public:
warn(std::string devider_ = ", ", std::experimental::source_location location_ = std::experimental::source_location::current()); warn(std::string devider_ = ", ", std::experimental::source_location location_ = std::experimental::source_location::current()) : location { location_ }
{
this->devider = devider_;
}
warn(warn&) = delete; warn(warn&) = delete;
warn(warn&&) = delete; warn(warn&&) = delete;
@ -163,7 +171,10 @@ namespace hack
class error : public log class error : public log
{ {
public: public:
error(std::string devider_ = ", ", std::experimental::source_location location_ = std::experimental::source_location::current()); error(std::string devider_ = ", ", std::experimental::source_location location_ = std::experimental::source_location::current()) : location { location_ }
{
this->devider = devider_;
}
error(error&) = delete; error(error&) = delete;
error(error&&) = delete; error(error&&) = delete;

View File

@ -2,8 +2,8 @@
#include <regex> #include <regex>
#include "string/string_concat_helper.hpp" #include "hack/string/string_concat_helper.hpp"
#include "concepts/concepts.hpp" #include "hack/concepts/concepts.hpp"
#include "nlohmann/json.hpp" #include "nlohmann/json.hpp"
namespace hack::utils namespace hack::utils

View File

@ -62,6 +62,12 @@ namespace hack::utils
return result; return result;
} }
template<typename T, T value = 0>
struct counter
{
inline static T id = value;
};
// this function can will use // this function can will use
// as switch wiht string // as switch wiht string
// switch(case_int("key")) // switch(case_int("key"))

View File

@ -1,24 +0,0 @@
#include "logger.hpp"
namespace hack
{
std::string log::devider = " ";
int log::count = 0;
log::log(std::string devider_, std::experimental::source_location location_) : location { location_ }
{
this->devider = devider_;
}
warn::warn(std::string devider_, std::experimental::source_location location_) : location { location_ }
{
this->devider = devider_;
}
error::error(std::string devider_, std::experimental::source_location location_) : location { location_ }
{
this->devider = devider_;
}
void log::print() { std::cout << std::endl; }
}

View File

@ -1,13 +0,0 @@
headers = ['logger.hpp']
sources = ['logger.cpp']
lib = library(
'logger',
include_directories : inc,
sources: [headers, sources]
)
logger_dep = declare_dependency(
include_directories: inc,
link_with: lib
)

View File

@ -1,6 +1 @@
inc += include_directories('.') inc += include_directories('.')
subdir('logger')
deps += logger_dep

View File

@ -1,6 +1,6 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "container/container.hpp" #include "hack/container/container.hpp"
TEST(vector_multiset, check) TEST(vector_multiset, check)
{ {

View File

@ -1,6 +1,6 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "math/matrix.hpp" #include "hack/math/matrix.hpp"
TEST(matrix, check) TEST(matrix, check)
{ {

View File

@ -1,6 +1,6 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "range/range.hpp" #include "hack/range/range.hpp"
TEST(within, check) TEST(within, check)
{ {

View File

@ -2,8 +2,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "string/string.hpp" #include "hack/string/string.hpp"
TEST(split_str, check) TEST(split_str, check)
{ {