ROSE 0.11.145.192
Convert.h
1#ifndef ROSE_StringUtility_Convert_H
2#define ROSE_StringUtility_Convert_H
3#include <RoseFirst.h>
4#include <rosedll.h>
5
6#include <cstdint>
7#include <string>
8#include <vector>
9
10namespace Rose {
11namespace StringUtility {
12
14// String conversion functions
16
20ROSE_UTIL_API std::string convertToLowerCase(const std::string &inputString);
21
28ROSE_UTIL_API std::string fixLineTermination(const std::string &input);
29
37ROSE_UTIL_API std::string prefixLines(const std::string &lines, const std::string &prefix,
38 bool prefixAtFront=true, bool prefixAtBack=false);
39
44ROSE_UTIL_API std::string leftJustify(const std::string &input, size_t width, char fill = ' ');
45
50ROSE_UTIL_API std::string rightJustify(const std::string &input, size_t width, char fill = ' ');
51
56ROSE_UTIL_API std::string centerJustify(const std::string &input, size_t width, char fill = ' ');
57
67ROSE_UTIL_API std::string makeOneLine(const std::string &s, std::string replacement=" ");
68
72ROSE_UTIL_API std::string trim(const std::string &str, const std::string &strip=" \t\r\n",
73 bool at_beginning=true, bool at_end=true);
74
76ROSE_UTIL_API std::string untab(const std::string &str, size_t tabstops=8, size_t firstcol=0);
77
87ROSE_UTIL_API std::string removeRedundantSubstrings(const std::string&);
88
93ROSE_UTIL_API std::string removeAnsiEscapes(const std::string&);
94
101ROSE_UTIL_API std::string encode_base64(const std::vector<uint8_t> &data, bool do_pad=true);
102ROSE_UTIL_API std::string encode_base64(const uint8_t *data, size_t nbytes, bool do_padd=true);
106ROSE_UTIL_API std::vector<uint8_t> decode_base64(const std::string &encoded);
107
115ROSE_UTIL_API unsigned long generate_checksum(std::string s);
116
117} // namespace
118} // namespace
119
120#endif
ROSE_UTIL_API unsigned long generate_checksum(std::string s)
Compute a checkshum.
ROSE_UTIL_API std::string convertToLowerCase(const std::string &inputString)
Convert to lower case.
ROSE_UTIL_API std::string leftJustify(const std::string &input, size_t width, char fill=' ')
Left justify a string to specified width.
ROSE_UTIL_API std::string removeRedundantSubstrings(const std::string &)
Remove redundant and blank lines.
ROSE_UTIL_API std::vector< uint8_t > decode_base64(const std::string &encoded)
Convert base-64 to binary.
ROSE_UTIL_API std::string rightJustify(const std::string &input, size_t width, char fill=' ')
Right justify a string to specified width.
ROSE_UTIL_API std::string removeAnsiEscapes(const std::string &)
Remove ANSI escape characters.
ROSE_UTIL_API std::string makeOneLine(const std::string &s, std::string replacement=" ")
Converts a multi-line string to a single line.
ROSE_UTIL_API std::string encode_base64(const std::vector< uint8_t > &data, bool do_pad=true)
Convert binary data to base-64.
ROSE_UTIL_API std::string fixLineTermination(const std::string &input)
Normalizes line termination.
ROSE_UTIL_API std::string trim(const std::string &str, const std::string &strip=" \t\r\n", bool at_beginning=true, bool at_end=true)
Trims white space from the beginning and end of a string.
ROSE_UTIL_API std::string prefixLines(const std::string &lines, const std::string &prefix, bool prefixAtFront=true, bool prefixAtBack=false)
Insert a prefix string before every line.
ROSE_UTIL_API std::string centerJustify(const std::string &input, size_t width, char fill=' ')
Center a string in a field.
ROSE_UTIL_API std::string untab(const std::string &str, size_t tabstops=8, size_t firstcol=0)
Expand horizontal tab characters.
The ROSE library.