24 #ifndef HYPERTABLE_STRING_H
25 #define HYPERTABLE_STRING_H
47 typedef long unsigned int Lu;
50 typedef long long unsigned int Llu;
53 typedef long long int Lld;
87 String
format_bytes(
size_t n, const
void *buf,
size_t len,
88 const
char *trailer = "...");
98 template <class SequenceT>
99 String
format_list(const SequenceT &seq, const
char *sep = ", ") {
100 typedef typename SequenceT::const_iterator Iterator;
101 Iterator it = seq.begin(), end = seq.end();
102 std::ostringstream out;
109 for (; it != end; ++it)
130 const char **output,
size_t *output_len) {
132 !((*input ==
'\'' && input[input_len-1] ==
'\'') ||
133 (*input ==
'"' && input[input_len-1] ==
'"'))) {
135 *output_len = input_len;
139 *output_len = input_len - 2;
175 std::string
str()
const {
return std::string(
s,
size()); }
181 memcpy(p,
s,
size());
192 while (value >= 100) {
196 unsigned index = (value % 100) * 2;
202 *--
s =
static_cast<char>(
'0' + value);
205 unsigned index =
static_cast<unsigned>(value * 2);
255 #endif // HYPERTABLE_STRING_H
NumericSignedFormatter< int8_t > Int8Formatter
NumericUnsignedFormatter< uint32_t > UInt32Formatter
String format_number(int64_t n, int sep)
Return decimal number string separated by a separator (default: comma) for every 3 digits...
NumericSignedFormatter< int16_t > Int16Formatter
NumericSignedFormatter< int32_t > Int32Formatter
std::string String
A String is simply a typedef to std::string.
String format(const char *fmt,...)
Returns a String using printf like format facilities Vanilla snprintf is about 1.5x faster than this...
String format_list(const SequenceT &seq, const char *sep=", ")
Return a string presentation of a sequence.
long long unsigned int Llu
Shortcut for printf formats.
String format_bytes(size_t n, const void *buf, size_t len, const char *trailer)
Return first n bytes of buffer with an optional trailer if the size of the buffer exceeds n...
NumericUnsignedFormatter< uint16_t > UInt16Formatter
bool strip_enclosing_quotes(const char *input, size_t input_len, const char **output, size_t *output_len)
Strips enclosing quotes.
long long int Lld
Shortcut for printf formats.
NumericSignedFormatter< int64_t > Int64Formatter
NumericUnsignedFormatter< uint64_t > UInt64Formatter
long unsigned int Lu
Shortcut for printf formats.
NumericUnsignedFormatter< uint8_t > UInt8Formatter