diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-08-20 11:39:38 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-08-20 11:39:38 +0200 |
commit | c51778aac8ed87de70b5cd74beb2af7421e35e9e (patch) | |
tree | 6082dd1bf134162a2d789d4bfb7b6cc96e1ad82b | |
parent | 84e85fafdf34c0265c4d994b1b1a254446efa5c8 (diff) |
Reorder inline functions to keep MinGW GCC happy (export)
-rw-r--r-- | butl/utility.ixx | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/butl/utility.ixx b/butl/utility.ixx index b0d83c9..df49c23 100644 --- a/butl/utility.ixx +++ b/butl/utility.ixx @@ -18,17 +18,11 @@ namespace butl return std::toupper (c); } - inline std::string - ucase (const char* s, std::size_t n) - { - std::string r (s, n == std::string::npos ? std::strlen (s) : n); - return ucase (r); - } - - inline std::string - ucase (const std::string& s) + inline void + ucase (char* s, std::size_t n) { - return ucase (s.c_str (), s.size ()); + for (const char* e (s + n); s != e; ++s) + *s = ucase (*s); } inline std::string& @@ -42,30 +36,30 @@ namespace butl return s; } - inline void - ucase (char* s, std::size_t n) + inline std::string + ucase (const char* s, std::size_t n) { - for (const char* e (s + n); s != e; ++s) - *s = ucase (*s); + std::string r (s, n == std::string::npos ? std::strlen (s) : n); + return ucase (r); } - inline char - lcase (char c) + inline std::string + ucase (const std::string& s) { - return std::tolower (c); + return ucase (s.c_str (), s.size ()); } - inline std::string - lcase (const char* s, std::size_t n) + inline char + lcase (char c) { - std::string r (s, n == std::string::npos ? std::strlen (s) : n); - return lcase (r); + return std::tolower (c); } - inline std::string - lcase (const std::string& s) + inline void + lcase (char* s, std::size_t n) { - return lcase (s.c_str (), s.size ()); + for (const char* e (s + n); s != e; ++s) + *s = lcase (*s); } inline std::string& @@ -79,11 +73,17 @@ namespace butl return s; } - inline void - lcase (char* s, std::size_t n) + inline std::string + lcase (const char* s, std::size_t n) { - for (const char* e (s + n); s != e; ++s) - *s = lcase (*s); + std::string r (s, n == std::string::npos ? std::strlen (s) : n); + return lcase (r); + } + + inline std::string + lcase (const std::string& s) + { + return lcase (s.c_str (), s.size ()); } inline int @@ -95,25 +95,25 @@ namespace butl } inline int - casecmp (const std::string& l, const std::string& r, std::size_t n) + casecmp (const char* l, const char* r, std::size_t n) { - return casecmp (l.c_str (), r.c_str (), n); +#ifndef _WIN32 + return n == std::string::npos ? strcasecmp (l, r) : strncasecmp (l, r, n); +#else + return n == std::string::npos ? _stricmp (l, r) : _strnicmp (l, r, n); +#endif } inline int - casecmp (const std::string& l, const char* r, std::size_t n) + casecmp (const std::string& l, const std::string& r, std::size_t n) { - return casecmp (l.c_str (), r, n); + return casecmp (l.c_str (), r.c_str (), n); } inline int - casecmp (const char* l, const char* r, std::size_t n) + casecmp (const std::string& l, const char* r, std::size_t n) { -#ifndef _WIN32 - return n == std::string::npos ? strcasecmp (l, r) : strncasecmp (l, r, n); -#else - return n == std::string::npos ? _stricmp (l, r) : _strnicmp (l, r, n); -#endif + return casecmp (l.c_str (), r, n); } inline bool |