| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #ifndef _TEXT_CONVERSION_H__ | ||
| 2 | #define _TEXT_CONVERSION_H__ | ||
| 3 | |||
| 4 | #include <array> | ||
| 5 | #include <string> | ||
| 6 | |||
| 7 | namespace text_conversion | ||
| 8 | { | ||
| 9 | /** | ||
| 10 | * Converts the given text to title case. | ||
| 11 | * Modifies the data in-place. | ||
| 12 | * | ||
| 13 | * @param[in,out] data Pointer to the text to convert. | ||
| 14 | * @param[in] cnt Length of the text. | ||
| 15 | */ | ||
| 16 | void convert_to_title_case(char* data, size_t cnt); | ||
| 17 | |||
| 18 | /** | ||
| 19 | * Converts the given string to title case. | ||
| 20 | * Modifies the data in-place. | ||
| 21 | * | ||
| 22 | * @param[in,out] data std::string to convert. | ||
| 23 | */ | ||
| 24 | void convert_to_title_case(std::string& data); | ||
| 25 | |||
| 26 | #if __cplusplus >= 201703L | ||
| 27 | /** | ||
| 28 | * Converts the given std::array to title case. | ||
| 29 | * Modifies the data in-place. | ||
| 30 | * | ||
| 31 | * @param[in,out] data std::array to convert. | ||
| 32 | */ | ||
| 33 | 1 | template <typename T, auto N> void convert_to_title_case(std::array<T, N>& data) | |
| 34 | { | ||
| 35 | 1 | convert_to_title_case(data.data(), N); | |
| 36 | 1 | } | |
| 37 | #else | ||
| 38 | /** | ||
| 39 | * Converts the given std::array to title case. | ||
| 40 | * Modifies the data in-place. | ||
| 41 | * | ||
| 42 | * @param[in,out] data std::array to convert. | ||
| 43 | */ | ||
| 44 | template <typename T, int N> void convert_to_title_case(std::array<T, N>& data) | ||
| 45 | { | ||
| 46 | convert_to_title_case(data.data(), N); | ||
| 47 | } | ||
| 48 | #endif | ||
| 49 | |||
| 50 | /** | ||
| 51 | * Returns the library version. | ||
| 52 | * | ||
| 53 | * @return The library version as null-terminated string. | ||
| 54 | */ | ||
| 55 | const char* version(); | ||
| 56 | |||
| 57 | /** | ||
| 58 | * Returns the library build date. | ||
| 59 | * | ||
| 60 | * @return The library build date as null-terminated string. | ||
| 61 | */ | ||
| 62 | const char* date(); | ||
| 63 | |||
| 64 | } // namespace text_conversion | ||
| 65 | |||
| 66 | #endif | ||
| 67 |