13
0

add upcase() method; remove upcase version of internationalize()

This commit is contained in:
Paul Davis 2023-01-27 15:05:08 -07:00
parent 125421f686
commit 68f4c7ce8e
2 changed files with 14 additions and 15 deletions

View File

@ -74,6 +74,19 @@ downcase (const char* str)
return copy; return copy;
} }
vector<string>
upcase (char const *array[])
{
vector<string> ret;
for (int n = 0; array[n]; ++n) {
string s (array[n]);
std::transform (s.begin(), s.end(), s.begin(), ::toupper);
ret.push_back (s);
}
return ret;
}
string string
short_version (string orig, string::size_type target_length) short_version (string orig, string::size_type target_length)
{ {
@ -174,20 +187,6 @@ internationalize (const char *package_name, const char **array)
return v; return v;
} }
vector<string>
internationalize_and_upcase (const char *package_name, const char **array)
{
vector<string> v;
for (uint32_t i = 0; array[i]; ++i) {
string s (dgettext(package_name, array[i]));
std::transform (s.begin(), s.end(), s.begin(), ::toupper);
v.push_back (s);
}
return v;
}
static int32_t static int32_t
int_from_hex (char hic, char loc) int_from_hex (char hic, char loc)
{ {

View File

@ -43,12 +43,12 @@ LIBPBD_API std::string url_decode (std::string const &);
LIBPBD_API std::string capitalize (const std::string&); LIBPBD_API std::string capitalize (const std::string&);
LIBPBD_API std::string downcase (const std::string&); LIBPBD_API std::string downcase (const std::string&);
LIBPBD_API const char* downcase (const char*); LIBPBD_API const char* downcase (const char*);
LIBPBD_API std::vector<std::string> upcase (char const *[]);
// std::string length2string (const int32_t samples, const float sample_rate); // std::string length2string (const int32_t samples, const float sample_rate);
LIBPBD_API std::string length2string (const int64_t samples, const double sample_rate); LIBPBD_API std::string length2string (const int64_t samples, const double sample_rate);
LIBPBD_API std::vector<std::string> internationalize (const char *, const char **); LIBPBD_API std::vector<std::string> internationalize (const char *, const char **);
LIBPBD_API std::vector<std::string> internationalize_and_upcase (const char *, const char **);
LIBPBD_API bool strings_equal_ignore_case (const std::string& a, const std::string& b); LIBPBD_API bool strings_equal_ignore_case (const std::string& a, const std::string& b);
LIBPBD_API const char* sgettext (const char *, const char *); LIBPBD_API const char* sgettext (const char *, const char *);