/usr/include/modp_ascii.h is in libmodpbase64-dev 3.10.3+git20160924-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | /**
* \file modp_ascii.h
* \brief Simple ASCII manipulations including upper and lower casing,
* white space trimming, and conversion to "printable" characters.
*
* blah blah blah
*/
/*
* <PRE>
* MODP_ASCII -- Simple ascii manipulation (uppercase, lowercase, etc)
* https://github.com/client9/stringencoders
*
* Copyright © 2007-2016, Nick Galbreath -- nickg [at] client9 [dot] com
* All rights reserved.
*
* Released under MIT license. See LICENSE for details.
* </PRE>
*
*/
#ifndef COM_MODP_STRINGENCODERS_ASCII
#define COM_MODP_STRINGENCODERS_ASCII
#ifdef __cplusplus
extern "C" {
#endif
#include "modp_stdint.h"
/*
* \param[in,out] str the input string
* \param[in] len the length of input string (the strlen)
*/
void modp_toupper(char* str, size_t len);
/** \brief make lower case copy of input string
*
* \param[out] dest output buffer, with at least 'len + 1' bytes allocated
* \param[in] str the input string
* \param[in] len the length of input string (the strlen)
*
* Please make sure dest has been allocation with at least 'len+1'
* bytes. This appends a trailing NULL character at the end of
* dest!
*
* This is based on the algorithm by Paul Hsieh
* http://www.azillionmonkeys.com/qed/asmexample.html
*/
void modp_toupper_copy(char* dest, const char* str, size_t len);
/** \brief lower case a string in place
*
* \param[in,out] str the input string
* \param[in] len the length of input string (the strlen)
*
*/
void modp_tolower(char* str, size_t len);
/** \brief make lower case copy of input string
*
* \param[out] dest output buffer, with at least 'len + 1' bytes allocated
* \param[in] str the input string
* \param[in] len the length of input string (the strlen)
*
* Please make sure dest has been allocation with at least 'len+1'
* bytes. This appends a trailing NULL character at the end of
* dest!
*
* This is based on the algorithm by Paul Hsieh
* http://www.azillionmonkeys.com/qed/asmexample.html
*/
void modp_tolower_copy(char* dest, const char* str, size_t len);
/** \brief turn a string into 7-bit printable ascii.
*
* By "printable" we means all characters between 32 and 126.
* All other values are turned into '?'
*
* \param[in,out] str the input string
* \param[in] len the length of input string (the strlen)
*
*/
void modp_toprint(char* str, size_t len);
/** \brief make a printable copy of a string
*
* By "printable" we means all characters between 32 and 126.
* All other values are turned into '?'
*
* \param[out] dest output buffer, with at least 'len + 1' bytes allocated
* \param[in] str the input string
* \param[in] len the length of input string (the strlen)
*
* Please make sure dest has been allocation with at least 'len+1'
* bytes. This appends a trailing NULL character at the end of
* dest!
*/
void modp_toprint_copy(char* dest, const char* str, size_t len);
/**
* \brief remove trailing whitespace from a string
* \param[in,out] str string to be stripped
* \param[in] len the size of the input
* \return the size of the output, not including any ending null byte.
*/
size_t modp_rtrim(char* str, size_t len);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
#include <string>
namespace modp {
inline std::string& toupper(std::string& str)
{
modp_toupper(const_cast<char*>(str.c_str()), str.size());
return str;
}
inline std::string toupper(const std::string& str)
{
std::string s(str.size(), '\0');
modp_toupper_copy(const_cast<char*>(s.data()), str.data(), str.size());
return s;
}
inline std::string tolower(const std::string& str)
{
std::string s(str.size(), '\0');
modp_tolower_copy(const_cast<char*>(s.data()), str.data(), str.size());
return s;
}
inline std::string& tolower(std::string& str)
{
modp_tolower(const_cast<char*>(str.c_str()), str.size());
return str;
}
inline std::string toprint(const std::string& str)
{
std::string s(str.size(), '\0');
modp_toprint_copy(const_cast<char*>(s.data()), str.data(), str.size());
return s;
}
inline std::string& toprint(std::string& str)
{
modp_toprint(const_cast<char*>(str.c_str()), str.size());
return str;
}
inline std::string& rtrim(std::string& s)
{
size_t d = modp_rtrim(const_cast<char*>(s.data()), s.size());
s.erase(d, std::string::npos);
return s;
}
}
#endif /* __cplusplus */
#endif /* MODP_ASCII */
|