X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fstrings%2Futils.h;h=28763e6eba37df81efcdce612e9569db1bbdc27c;hb=6af098355f2b037a6f8084f9f6c741e462ffa614;hp=f7e9433fd2d07a3e7496e7e7735af77d5dfff4c0;hpb=5d51c374869f13f762039f58c03f3c5d75c12f07;p=libs%2Fcore.git diff --git a/source/strings/utils.h b/source/strings/utils.h index f7e9433..28763e6 100644 --- a/source/strings/utils.h +++ b/source/strings/utils.h @@ -3,6 +3,7 @@ #include #include +#include namespace Msp { @@ -10,22 +11,22 @@ namespace Msp { than, equal to or greater than zero depending on whether the first string lexicographically precedes, is equal to or follows the second one, respectively. */ -int strcasecmp(const std::string &s1, const std::string &s2); +MSPCORE_API int strcasecmp(const std::string &s1, const std::string &s2); /** Converts a string to lower case. */ -std::string tolower(const std::string &); +MSPCORE_API std::string tolower(const std::string &); /** Converts a string to upper case. */ -std::string toupper(const std::string &); +MSPCORE_API std::string toupper(const std::string &); /** Checks whether a string consists of digits only. */ -bool isnumrc(const std::string &); +MSPCORE_API bool isnumrc(const std::string &); /** Checks whether a string consists of alphabetic characters only. */ -bool isalpha(const std::string &); +MSPCORE_API bool isalpha(const std::string &); /** Checks whether a string consists of alphanumeric characters only. */ -bool isalnum(const std::string &); +MSPCORE_API bool isalnum(const std::string &); /* These are required to make the standard version work from inside the Msp namespace */ @@ -40,27 +41,27 @@ be treated as a single separator. If max_split is non-negative, at most that many split will be performed, i.e. the resulting vector will contain at most max_split+1 elements. */ -std::vector split(const std::string &str, const std::string &sep = " \t\r\n", int max_split = -1); +MSPCORE_API std::vector split(const std::string &str, const std::string &sep = " \t\r\n", int max_split = -1); /** Splits a string on occurrences of a single character. */ -std::vector split(const std::string &str, char sep, int max_split = -1); +MSPCORE_API std::vector split(const std::string &str, char sep, int max_split = -1); /** Splits a string on occurrences of another string. */ -std::vector split_long(const std::string &str, const std::string &sep, int max_split = -1); +MSPCORE_API std::vector split_long(const std::string &str, const std::string &sep, int max_split = -1); /** Splits a string on occurrences of another string. Two consecutive separators will cause an empty string to be placed in the result. */ -std::vector split_fields(const std::string &str, const std::string &sep, int max_split = -1); +MSPCORE_API std::vector split_fields(const std::string &str, const std::string &sep, int max_split = -1); /** Splits a string on occurrences of a single character. Two consecutive separators will cause an empty string to be placed in the result. */ -std::vector split_fields(const std::string &str, char sep, int max_split = -1); +MSPCORE_API std::vector split_fields(const std::string &str, char sep, int max_split = -1); /** Appends a string to another, using a separator if both are non-empty. */ -std::string &append(std::string &str, const std::string &sep, const std::string &other); +MSPCORE_API std::string &append(std::string &str, const std::string &sep, const std::string &other); /** Joins two strings, using a separator if both are non-empty. */ -std::string join(const std::string &str1, const std::string &sep, const std::string &str2); +MSPCORE_API std::string join(const std::string &str1, const std::string &sep, const std::string &str2); /** Concatenates strings from an iterator range. */ template @@ -74,14 +75,14 @@ std::string join(Iter begin, Iter end, const std::string &sep = " ") } /** Strips leading and trailing whitespace from a string. */ -std::string strip(const std::string &); +MSPCORE_API std::string strip(const std::string &); /** Unescapes a string with C escape sequences. */ -std::string c_unescape(const std::string &str); +MSPCORE_API std::string c_unescape(const std::string &str); /** Escapes any non-printable characters in a string with C escape sequences. Optionally, any characters with the high bit set can be escaped as well. */ -std::string c_escape(const std::string &str, bool escape_8bit = true); +MSPCORE_API std::string c_escape(const std::string &str, bool escape_8bit = true); } // namespace Msp