Program Listing for File Convert.h

Program Listing for File Convert.h#

Return to documentation for file (src/util/StringUtility/Convert.h)

#ifndef ROSE_StringUtility_Convert_H
#define ROSE_StringUtility_Convert_H

#include <rosedll.h>

#include <cstdint>
#include <string>
#include <vector>

namespace Rose {
namespace StringUtility {

//                                      String conversion functions

ROSE_UTIL_API std::string convertToLowerCase(const std::string &inputString);

ROSE_UTIL_API std::string fixLineTermination(const std::string &input);

ROSE_UTIL_API std::string prefixLines(const std::string &lines, const std::string &prefix,
                                      bool prefixAtFront=true, bool prefixAtBack=false);

ROSE_UTIL_API std::string leftJustify(const std::string &input, size_t width, char fill = ' ');

ROSE_UTIL_API std::string rightJustify(const std::string &input, size_t width, char fill = ' ');

ROSE_UTIL_API std::string centerJustify(const std::string &input, size_t width, char fill = ' ');

ROSE_UTIL_API std::string makeOneLine(const std::string &s, std::string replacement=" ");

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);

ROSE_UTIL_API std::string untab(const std::string &str, size_t tabstops=8, size_t firstcol=0);

ROSE_UTIL_API std::string removeRedundantSubstrings(const std::string&);

ROSE_UTIL_API std::string removeAnsiEscapes(const std::string&);

ROSE_UTIL_API std::string encode_base64(const std::vector<uint8_t> &data, bool do_pad=true);
ROSE_UTIL_API std::string encode_base64(const uint8_t *data, size_t nbytes, bool do_padd=true);
ROSE_UTIL_API std::vector<uint8_t> decode_base64(const std::string &encoded);

ROSE_UTIL_API unsigned long generate_checksum(std::string s);

} // namespace
} // namespace

#endif