![]() |
VCV Rack API
v1
|
Supplemental std::string
functions.
More...
Classes | |
struct | CaseInsensitiveCompare |
Functions | |
std::string | fromWstring (const std::wstring &s) |
Converts a UTF-16/32 string (depending on the size of wchar_t) to a UTF-8 string. More... | |
std::wstring | toWstring (const std::string &s) |
std::string | f (const char *format,...) |
Converts a printf() format string and optional arguments into a std::string. More... | |
std::string | lowercase (const std::string &s) |
Replaces all characters to lowercase letters. More... | |
std::string | uppercase (const std::string &s) |
Replaces all characters to uppercase letters. More... | |
std::string | trim (const std::string &s) |
Removes whitespace from beginning and end of string. More... | |
std::string | ellipsize (const std::string &s, size_t len) |
Truncates and adds "..." to a string, not exceeding len characters. More... | |
std::string | ellipsizePrefix (const std::string &s, size_t len) |
bool | startsWith (const std::string &str, const std::string &prefix) |
bool | endsWith (const std::string &str, const std::string &suffix) |
std::string | directory (const std::string &path) |
Extracts the directory of the path. More... | |
std::string | filename (const std::string &path) |
Extracts the filename of the path. More... | |
std::string | filenameBase (const std::string &filename) |
Extracts the portion of a filename without the extension. More... | |
std::string | filenameExtension (const std::string &filename) |
Extracts the extension of a filename. More... | |
std::string | absolutePath (const std::string &path) |
Returns the canonicalized absolute path pointed to by path , following symlinks. More... | |
float | fuzzyScore (const std::string &s, const std::string &query) |
Scores how well a query matches a string. More... | |
std::string | toBase64 (const uint8_t *data, size_t len) |
Converts a byte array to a Base64-encoded string. More... | |
uint8_t * | fromBase64 (const std::string &str, size_t *outLen) |
Converts a Base64-encoded string to a byte array. More... | |
Supplemental std::string
functions.
std::string rack::string::fromWstring | ( | const std::wstring & | s | ) |
Converts a UTF-16/32 string (depending on the size of wchar_t) to a UTF-8 string.
std::wstring rack::string::toWstring | ( | const std::string & | s | ) |
std::string rack::string::f | ( | const char * | format, |
... | |||
) |
Converts a printf()
format string and optional arguments into a std::string.
Remember that "%s" must reference a char *
, so use .c_str()
for std::string
s, otherwise you might get binary garbage.
std::string rack::string::lowercase | ( | const std::string & | s | ) |
Replaces all characters to lowercase letters.
std::string rack::string::uppercase | ( | const std::string & | s | ) |
Replaces all characters to uppercase letters.
std::string rack::string::trim | ( | const std::string & | s | ) |
Removes whitespace from beginning and end of string.
std::string rack::string::ellipsize | ( | const std::string & | s, |
size_t | len | ||
) |
Truncates and adds "..." to a string, not exceeding len
characters.
std::string rack::string::ellipsizePrefix | ( | const std::string & | s, |
size_t | len | ||
) |
bool rack::string::startsWith | ( | const std::string & | str, |
const std::string & | prefix | ||
) |
bool rack::string::endsWith | ( | const std::string & | str, |
const std::string & | suffix | ||
) |
std::string rack::string::directory | ( | const std::string & | path | ) |
Extracts the directory of the path.
Example: directory("dir/file.txt") // "dir" Calls POSIX dirname().
std::string rack::string::filename | ( | const std::string & | path | ) |
Extracts the filename of the path.
Example: directory("dir/file.txt") // "file.txt" Calls POSIX basename().
std::string rack::string::filenameBase | ( | const std::string & | filename | ) |
Extracts the portion of a filename without the extension.
Example: filenameBase("file.txt") // "file" Note: Only works on filenames. Call filename(path) to get the filename of the path.
std::string rack::string::filenameExtension | ( | const std::string & | filename | ) |
Extracts the extension of a filename.
Example: filenameExtension("file.txt") // "txt" Note: Only works on filenames. Call filename(path) to get the filename of the path.
std::string rack::string::absolutePath | ( | const std::string & | path | ) |
Returns the canonicalized absolute path pointed to by path
, following symlinks.
Returns "" if the symbol is not found.
float rack::string::fuzzyScore | ( | const std::string & | s, |
const std::string & | query | ||
) |
Scores how well a query matches a string.
A score of 0 means no match. The score is arbitrary and is only meaningful for sorting.
std::string rack::string::toBase64 | ( | const uint8_t * | data, |
size_t | len | ||
) |
Converts a byte array to a Base64-encoded string.
uint8_t* rack::string::fromBase64 | ( | const std::string & | str, |
size_t * | outLen | ||
) |
Converts a Base64-encoded string to a byte array.
outLen
is set to the length of the byte array. If non-NULL, caller must delete[] the result.