From d691c0e6557c348932fd7e168624f85d2000f80d Mon Sep 17 00:00:00 2001 From: chatlanin Date: Tue, 23 May 2023 12:13:38 +0300 Subject: [PATCH] change dir name --- bin/main.cpp | 39 +++++++++++-------- bin/meson.build | 3 +- meson.build | 2 +- src/{ => hack}/concepts/concepts.hpp | 0 src/{ => hack}/container/container.hpp | 0 .../associative_ostream_iterator.hpp | 0 .../iterators/sequence_ostream_iterator.hpp | 0 src/{ => hack}/logger/logger.hpp | 33 ++++++++++------ src/{ => hack}/math/matrix.hpp | 0 src/{ => hack}/math/max.hpp | 0 src/{ => hack}/math/vector.hpp | 0 src/{ => hack}/range/range.hpp | 0 src/{ => hack}/security/is_link.hpp | 0 src/{ => hack}/security/is_string.hpp | 0 src/{ => hack}/security/uuid.hpp | 0 src/{ => hack}/security/validate_email.hpp | 0 src/{ => hack}/string/string.hpp | 0 .../string/string_concat_helper.hpp | 0 src/{ => hack}/string/utf8_len.hpp | 0 src/{ => hack}/utils/func_query.hpp | 4 +- src/{ => hack}/utils/utils.hpp | 6 +++ src/{ => hack}/view/color.hpp | 0 src/logger/logger.cpp | 24 ------------ src/logger/meson.build | 13 ------- src/meson.build | 5 --- tests/container.cpp | 2 +- tests/math.cpp | 2 +- tests/range.cpp | 2 +- tests/string.cpp | 3 +- 29 files changed, 60 insertions(+), 78 deletions(-) mode change 100644 => 100755 bin/main.cpp mode change 100644 => 100755 bin/meson.build rename src/{ => hack}/concepts/concepts.hpp (100%) rename src/{ => hack}/container/container.hpp (100%) rename src/{ => hack}/iterators/associative_ostream_iterator.hpp (100%) rename src/{ => hack}/iterators/sequence_ostream_iterator.hpp (100%) rename src/{ => hack}/logger/logger.hpp (89%) rename src/{ => hack}/math/matrix.hpp (100%) rename src/{ => hack}/math/max.hpp (100%) rename src/{ => hack}/math/vector.hpp (100%) rename src/{ => hack}/range/range.hpp (100%) rename src/{ => hack}/security/is_link.hpp (100%) rename src/{ => hack}/security/is_string.hpp (100%) rename src/{ => hack}/security/uuid.hpp (100%) rename src/{ => hack}/security/validate_email.hpp (100%) rename src/{ => hack}/string/string.hpp (100%) rename src/{ => hack}/string/string_concat_helper.hpp (100%) rename src/{ => hack}/string/utf8_len.hpp (100%) rename src/{ => hack}/utils/func_query.hpp (95%) rename src/{ => hack}/utils/utils.hpp (94%) rename src/{ => hack}/view/color.hpp (100%) delete mode 100755 src/logger/logger.cpp delete mode 100755 src/logger/meson.build diff --git a/bin/main.cpp b/bin/main.cpp old mode 100644 new mode 100755 index e2a4c42..6149942 --- a/bin/main.cpp +++ b/bin/main.cpp @@ -7,20 +7,20 @@ #include #include -#include "string/string.hpp" -#include "string/string_concat_helper.hpp" -#include "range/range.hpp" -#include "container/container.hpp" -#include "logger/logger.hpp" -#include "math/matrix.hpp" -#include "math/vector.hpp" -#include "utils/utils.hpp" -#include "utils/func_query.hpp" -#include "security/validate_email.hpp" -#include "security/uuid.hpp" -#include "security/is_string.hpp" -#include "security/is_link.hpp" -#include "string/utf8_len.hpp" +#include "hack/string/string.hpp" +#include "hack/string/string_concat_helper.hpp" +#include "hack/range/range.hpp" +#include "hack/container/container.hpp" +#include "hack/logger/logger.hpp" +#include "hack/math/matrix.hpp" +#include "hack/math/vector.hpp" +#include "hack/utils/utils.hpp" +#include "hack/utils/func_query.hpp" +#include "hack/security/validate_email.hpp" +#include "hack/security/uuid.hpp" +#include "hack/security/is_string.hpp" +#include "hack/security/is_link.hpp" +#include "hack/string/utf8_len.hpp" // for example int f(int a) @@ -44,11 +44,16 @@ struct ForTypeTrace int a; }; -struct counter_test : public hack::utils::counter +struct counter_test { counter_test() : id { ++hack::utils::counter::id } { } int id; +}; +struct counter_test_2 +{ + counter_test_2() : id { ++hack::utils::counter::id } { } + int id; }; int main(int argc, char *argv[]) @@ -278,7 +283,9 @@ int main(int argc, char *argv[]) {// ex: counter counter_test a, b, c; + counter_test_2 a1, b1, c1; hack::log()(c.id); + hack::log()(c1.id); } {// ex: case as string @@ -299,7 +306,7 @@ int main(int argc, char *argv[]) query = hack::utils::make_query("super_function", 1, 'c'); 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); hack::log()("query", query); diff --git a/bin/meson.build b/bin/meson.build old mode 100644 new mode 100755 index f2e8917..d948b43 --- a/bin/meson.build +++ b/bin/meson.build @@ -2,5 +2,6 @@ executable( 'hack', 'main.cpp', dependencies : deps, - cpp_args: args + cpp_args: args, + include_directories : inc ) diff --git a/meson.build b/meson.build index d678870..0fb867a 100755 --- a/meson.build +++ b/meson.build @@ -42,4 +42,4 @@ inc = [] subdir('src') subdir('bin') -subdir('tests') +# subdir('tests') diff --git a/src/concepts/concepts.hpp b/src/hack/concepts/concepts.hpp similarity index 100% rename from src/concepts/concepts.hpp rename to src/hack/concepts/concepts.hpp diff --git a/src/container/container.hpp b/src/hack/container/container.hpp similarity index 100% rename from src/container/container.hpp rename to src/hack/container/container.hpp diff --git a/src/iterators/associative_ostream_iterator.hpp b/src/hack/iterators/associative_ostream_iterator.hpp similarity index 100% rename from src/iterators/associative_ostream_iterator.hpp rename to src/hack/iterators/associative_ostream_iterator.hpp diff --git a/src/iterators/sequence_ostream_iterator.hpp b/src/hack/iterators/sequence_ostream_iterator.hpp similarity index 100% rename from src/iterators/sequence_ostream_iterator.hpp rename to src/hack/iterators/sequence_ostream_iterator.hpp diff --git a/src/logger/logger.hpp b/src/hack/logger/logger.hpp similarity index 89% rename from src/logger/logger.hpp rename to src/hack/logger/logger.hpp index b42bd18..b54fd06 100755 --- a/src/logger/logger.hpp +++ b/src/hack/logger/logger.hpp @@ -4,11 +4,11 @@ #include "boost/type_index.hpp" -#include "view/color.hpp" -#include "concepts/concepts.hpp" -#include "iterators/sequence_ostream_iterator.hpp" -#include "iterators/associative_ostream_iterator.hpp" -#include "math/matrix.hpp" +#include "hack/view/color.hpp" +#include "hack/concepts/concepts.hpp" +#include "hack/iterators/sequence_ostream_iterator.hpp" +#include "hack/iterators/associative_ostream_iterator.hpp" +#include "hack/math/matrix.hpp" // #include "nlohmann/json.hpp" namespace hack @@ -25,7 +25,11 @@ namespace hack class log { 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; @@ -48,11 +52,11 @@ namespace hack private: std::experimental::source_location location; - static int count; - static std::string devider; + inline static int count = 0; + inline static std::string devider = " "; private: - static void print(); + static void print() { std::cout << std::endl; } static std::ostream& make_type_view(std::ostream &os) { @@ -136,7 +140,11 @@ namespace hack class warn : public log { 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; @@ -163,7 +171,10 @@ namespace hack class error : public log { 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; diff --git a/src/math/matrix.hpp b/src/hack/math/matrix.hpp similarity index 100% rename from src/math/matrix.hpp rename to src/hack/math/matrix.hpp diff --git a/src/math/max.hpp b/src/hack/math/max.hpp similarity index 100% rename from src/math/max.hpp rename to src/hack/math/max.hpp diff --git a/src/math/vector.hpp b/src/hack/math/vector.hpp similarity index 100% rename from src/math/vector.hpp rename to src/hack/math/vector.hpp diff --git a/src/range/range.hpp b/src/hack/range/range.hpp similarity index 100% rename from src/range/range.hpp rename to src/hack/range/range.hpp diff --git a/src/security/is_link.hpp b/src/hack/security/is_link.hpp similarity index 100% rename from src/security/is_link.hpp rename to src/hack/security/is_link.hpp diff --git a/src/security/is_string.hpp b/src/hack/security/is_string.hpp similarity index 100% rename from src/security/is_string.hpp rename to src/hack/security/is_string.hpp diff --git a/src/security/uuid.hpp b/src/hack/security/uuid.hpp similarity index 100% rename from src/security/uuid.hpp rename to src/hack/security/uuid.hpp diff --git a/src/security/validate_email.hpp b/src/hack/security/validate_email.hpp similarity index 100% rename from src/security/validate_email.hpp rename to src/hack/security/validate_email.hpp diff --git a/src/string/string.hpp b/src/hack/string/string.hpp similarity index 100% rename from src/string/string.hpp rename to src/hack/string/string.hpp diff --git a/src/string/string_concat_helper.hpp b/src/hack/string/string_concat_helper.hpp similarity index 100% rename from src/string/string_concat_helper.hpp rename to src/hack/string/string_concat_helper.hpp diff --git a/src/string/utf8_len.hpp b/src/hack/string/utf8_len.hpp similarity index 100% rename from src/string/utf8_len.hpp rename to src/hack/string/utf8_len.hpp diff --git a/src/utils/func_query.hpp b/src/hack/utils/func_query.hpp similarity index 95% rename from src/utils/func_query.hpp rename to src/hack/utils/func_query.hpp index 662690c..b71b07a 100755 --- a/src/utils/func_query.hpp +++ b/src/hack/utils/func_query.hpp @@ -2,8 +2,8 @@ #include -#include "string/string_concat_helper.hpp" -#include "concepts/concepts.hpp" +#include "hack/string/string_concat_helper.hpp" +#include "hack/concepts/concepts.hpp" #include "nlohmann/json.hpp" namespace hack::utils diff --git a/src/utils/utils.hpp b/src/hack/utils/utils.hpp similarity index 94% rename from src/utils/utils.hpp rename to src/hack/utils/utils.hpp index d2260c4..b436565 100755 --- a/src/utils/utils.hpp +++ b/src/hack/utils/utils.hpp @@ -62,6 +62,12 @@ namespace hack::utils return result; } + template + struct counter + { + inline static T id = value; + }; + // this function can will use // as switch wiht string // switch(case_int("key")) diff --git a/src/view/color.hpp b/src/hack/view/color.hpp similarity index 100% rename from src/view/color.hpp rename to src/hack/view/color.hpp diff --git a/src/logger/logger.cpp b/src/logger/logger.cpp deleted file mode 100755 index abcb4fe..0000000 --- a/src/logger/logger.cpp +++ /dev/null @@ -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; } -} diff --git a/src/logger/meson.build b/src/logger/meson.build deleted file mode 100755 index 398973c..0000000 --- a/src/logger/meson.build +++ /dev/null @@ -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 -) diff --git a/src/meson.build b/src/meson.build index 3b2ab4f..5086055 100755 --- a/src/meson.build +++ b/src/meson.build @@ -1,6 +1 @@ inc += include_directories('.') - -subdir('logger') - -deps += logger_dep - diff --git a/tests/container.cpp b/tests/container.cpp index 1662b66..b795d2f 100755 --- a/tests/container.cpp +++ b/tests/container.cpp @@ -1,6 +1,6 @@ #include -#include "container/container.hpp" +#include "hack/container/container.hpp" TEST(vector_multiset, check) { diff --git a/tests/math.cpp b/tests/math.cpp index 9019c01..8610f92 100755 --- a/tests/math.cpp +++ b/tests/math.cpp @@ -1,6 +1,6 @@ #include -#include "math/matrix.hpp" +#include "hack/math/matrix.hpp" TEST(matrix, check) { diff --git a/tests/range.cpp b/tests/range.cpp index 4066e39..ab3e260 100755 --- a/tests/range.cpp +++ b/tests/range.cpp @@ -1,6 +1,6 @@ #include -#include "range/range.hpp" +#include "hack/range/range.hpp" TEST(within, check) { diff --git a/tests/string.cpp b/tests/string.cpp index 5896538..c5fbeb3 100755 --- a/tests/string.cpp +++ b/tests/string.cpp @@ -2,8 +2,7 @@ #include #include -#include "string/string.hpp" - +#include "hack/string/string.hpp" TEST(split_str, check) {