/usr/include/bobcat/string is in libbobcat-dev 4.01.03-2ubuntu1.
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 | #ifndef INCLUDED_BOBCAT_STRING_
#define INCLUDED_BOBCAT_STRING_
#include <cstring>
#include <string>
#include <vector>
#include <cctype>
namespace FBB
{
struct String
{
enum Type
{
DQUOTE_UNTERMINATED, // unterminated d-quoted element
SQUOTE_UNTERMINATED, // unterminated s-quoted element
ESCAPED_END, // word with plain \ at the end
SEPARATOR, // separator encountered
NORMAL, // normal string-element in the original string
DQUOTE, // string-element originally surrounded by " chars
SQUOTE, // string-element originally surrounded by ' chars
};
typedef std::pair<std::string, Type> SplitPair;
static char const **argv(std::vector<std::string> const &lines);
static int casecmp(std::string const &lhs, std::string const &rhs); // .f
static std::string lc(std::string const &str);
static std::vector<std::string> // 1
split(Type *type, std::string const &str,
std::string const &separators = " \t", bool addEmpty = false);
static std::vector<SplitPair> // 3
split(std::string const &str, std::string const &separators = " \t",
bool addEmpty = false);
static size_t split(std::vector<std::string> *words, // 4
std::string const &str, char const *separators = " \t",
bool addEmpty = false);
// 5
static size_t split(std::vector<SplitPair> *words, std::string const &str,
char const *separators = " \t", bool addEmpty = false);
static std::string trim(std::string const &str);
static std::string uc(std::string const &str);
static std::string unescape(std::string const &str);
static std::string escape(std::string const &str,
char const *series = "'\"\\");
private:
typedef std::string::const_iterator ConstIter;
typedef std::pair<int, Type> IntType;
// used by split1..3.cc
static SplitPair split(ConstIter &begin, ConstIter const &end, // 6
std::string const &separators);
static SplitPair dquotedString(ConstIter &begin,
ConstIter const &end);
static SplitPair quotedString(ConstIter &begin, ConstIter const &end);
static IntType escapedString(ConstIter &begin, ConstIter const &end);
static Type nextField(std::string const &str,
ConstIter *until, ConstIter from,
std::string const &separators);
static ConstIter separator(std::string const &str,
ConstIter from,
std::string const &separators);
static ConstIter quoted(std::string const &str,
ConstIter from, int quote);
static Type word(std::string const &str,
ConstIter *until, ConstIter from,
std::string const &separators);
static void tolower(char &chr); // .f
static void toupper(char &chr); // .f
};
inline int String::casecmp(std::string const &lhs, std::string const &rhs)
{
return strcasecmp(lhs.c_str(), rhs.c_str());
}
} // FBB
#endif
|