Skip to content

Commit

Permalink
- move functions to snapper namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
aschnell committed Nov 6, 2024
1 parent f82e6e0 commit 3697e01
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client/utils/HumanString.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace snapper
vector<string>
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<string> ret;

Expand Down
7 changes: 7 additions & 0 deletions client/utils/equal-date.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
}

}
3 changes: 3 additions & 0 deletions client/utils/equal-date.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
*/


namespace snapper
{

bool
equal_year(const struct tm& tmp1, const struct tm& tmp2);
Expand All @@ -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);

}
6 changes: 6 additions & 0 deletions client/utils/text.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

#include "text.h"


namespace snapper
{

using namespace std;


Expand Down Expand Up @@ -160,3 +164,5 @@ std::string mbs_substr_by_width(
return string();
return string(sptr, eptr - sptr);
}

}
8 changes: 7 additions & 1 deletion client/utils/text.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
#include <string>
#include <iosfwd>


namespace snapper
{

const char* _(const char* msgid) __attribute__ ((format_arg(1)));

const char* _(const char* msgid, const char* msgid_plural, unsigned long int n)
Expand All @@ -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

0 comments on commit 3697e01

Please sign in to comment.