/usr/include/modp_ascii.h is in libmodpbase64-dev 3.10.3-2.
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 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4 -*- */
/* vi: set expandtab shiftwidth=4 tabstop=4: */
/**
* \file modp_ascii.h
* <PRE>
* MODP_ASCII -- Simple ascii manipulation (uppercase, lowercase, etc)
* http://code.google.com/p/stringencoders/
*
* Copyright © 2007, Nick Galbreath -- nickg [at] modp [dot] com
* All rights reserved.
*
* Released under bsd license. See modp_ascii.c for details.
* </PRE>
*
*/
#ifndef COM_MODP_STRINGENCODERS_ASCII
#define COM_MODP_STRINGENCODERS_ASCII
#ifdef __cplusplus
#define BEGIN_C extern "C" {
#define END_C }
#else
#define BEGIN_C
#define END_C
#endif
BEGIN_C
/*
* \param[in,out] str the input string
* \param[in] len the length of input string (the strlen)
*/
void modp_toupper(char* str, int len);
/** \brief make lower case copy of input string
*
* \param[out] 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, int 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, int len);
/** \brief make lower case copy of input string
*
* \param[out] 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, int 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, int 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] 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, int len);
END_C
#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);
modp_toupper_copy(const_cast<char*>(s.c_str()), s.data(), s.size());
return s;
}
inline std::string tolower(const std::string& str)
{
std::string s(str);
modp_tolower_copy(const_cast<char*>(s.c_str()), s.data(), s.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);
modp_toprint_copy(const_cast<char*>(s.c_str()), s.data(), s.size());
return s;
}
inline std::string& toprint(std::string& str)
{
modp_toprint(const_cast<char*>(str.c_str()), str.size());
return str;
}
}
#endif /* __cplusplus */
#endif /* MODP_ASCII */
|