From 3697e0146463ad07ce74eeb30edfd5ac5156bef2 Mon Sep 17 00:00:00 2001 From: Arvin Schnell Date: Wed, 6 Nov 2024 15:31:52 +0100 Subject: [PATCH] - move functions to snapper namespace --- client/utils/HumanString.cc | 2 +- client/utils/equal-date.cc | 7 +++++++ client/utils/equal-date.h | 3 +++ client/utils/text.cc | 6 ++++++ client/utils/text.h | 8 +++++++- 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/client/utils/HumanString.cc b/client/utils/HumanString.cc index 028e3e85..5307b15e 100644 --- a/client/utils/HumanString.cc +++ b/client/utils/HumanString.cc @@ -55,7 +55,7 @@ namespace snapper vector get_all_suffixes(int i, bool all = true, bool classic = false) { - auto _ = [classic](const char* msg) { return classic ? msg : ::_(msg); }; + auto _ = [classic](const char* msg) { return classic ? msg : snapper::_(msg); }; vector ret; diff --git a/client/utils/equal-date.cc b/client/utils/equal-date.cc index e0c334f7..0e32547c 100644 --- a/client/utils/equal-date.cc +++ b/client/utils/equal-date.cc @@ -24,9 +24,14 @@ #include "equal-date.h" + #define isleapyear(year) \ ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0)) + +namespace snapper +{ + int yday_of_weeks_monday(const struct tm& tmp) { @@ -90,3 +95,5 @@ equal_hour(const struct tm& tmp1, const struct tm& tmp2) { return equal_day(tmp1, tmp2) && tmp1.tm_hour == tmp2.tm_hour; } + +} diff --git a/client/utils/equal-date.h b/client/utils/equal-date.h index 45cf9b25..6b4e7da4 100644 --- a/client/utils/equal-date.h +++ b/client/utils/equal-date.h @@ -20,6 +20,8 @@ */ +namespace snapper +{ bool equal_year(const struct tm& tmp1, const struct tm& tmp2); @@ -39,3 +41,4 @@ equal_day(const struct tm& tmp1, const struct tm& tmp2); bool equal_hour(const struct tm& tmp1, const struct tm& tmp2); +} diff --git a/client/utils/text.cc b/client/utils/text.cc index b593e7c2..26bb4590 100644 --- a/client/utils/text.cc +++ b/client/utils/text.cc @@ -12,6 +12,10 @@ #include "text.h" + +namespace snapper +{ + using namespace std; @@ -160,3 +164,5 @@ std::string mbs_substr_by_width( return string(); return string(sptr, eptr - sptr); } + +} diff --git a/client/utils/text.h b/client/utils/text.h index eb301781..80e2e152 100644 --- a/client/utils/text.h +++ b/client/utils/text.h @@ -11,6 +11,10 @@ #include #include + +namespace snapper +{ + const char* _(const char* msgid) __attribute__ ((format_arg(1))); const char* _(const char* msgid, const char* msgid_plural, unsigned long int n) @@ -29,4 +33,6 @@ std::string mbs_substr_by_width( std::string::size_type pos, std::string::size_type n = std::string::npos); -#endif /* ZYPPER_UTILS_TEXT_H_ */ +} + +#endif