Switch to unified view

a/src/smallut.h b/src/smallut.h
...
...
17
 */
17
 */
18
#ifndef _SMALLUT_H_INCLUDED_
18
#ifndef _SMALLUT_H_INCLUDED_
19
#define _SMALLUT_H_INCLUDED_
19
#define _SMALLUT_H_INCLUDED_
20
20
21
#include <sys/types.h>
21
#include <sys/types.h>
22
#include <stdint.h>
22
23
23
#include <string>
24
#include <string>
24
#include <vector>
25
#include <vector>
25
#include <map>
26
#include <map>
26
#include <set>
27
#include <set>
...
...
139
extern bool stringToBool(const std::string& s);
140
extern bool stringToBool(const std::string& s);
140
141
141
/** Remove instances of characters belonging to set (default {space,
142
/** Remove instances of characters belonging to set (default {space,
142
    tab}) at beginning and end of input string */
143
    tab}) at beginning and end of input string */
143
extern void trimstring(std::string& s, const char *ws = " \t");
144
extern void trimstring(std::string& s, const char *ws = " \t");
145
extern void rtrimstring(std::string& s, const char *ws = " \t");
146
extern void ltrimstring(std::string& s, const char *ws = " \t");
144
147
145
/** Escape things like < or & by turning them into entities */
148
/** Escape things like < or & by turning them into entities */
146
extern std::string escapeHtml(const std::string& in);
149
extern std::string escapeHtml(const std::string& in);
147
150
148
/** Double-quote and escape to produce C source code string (prog generation) */
151
/** Double-quote and escape to produce C source code string (prog generation) */
...
...
160
/** Truncate a string to a given maxlength, avoiding cutting off midword
163
/** Truncate a string to a given maxlength, avoiding cutting off midword
161
 *  if reasonably possible. */
164
 *  if reasonably possible. */
162
extern std::string truncate_to_word(const std::string& input,
165
extern std::string truncate_to_word(const std::string& input,
163
                                    std::string::size_type maxlen);
166
                                    std::string::size_type maxlen);
164
167
165
void ulltodecstr(unsigned long long val, std::string& buf);
168
void ulltodecstr(uint64_t val, std::string& buf);
166
void lltodecstr(long long val, std::string& buf);
169
void lltodecstr(int64_t val, std::string& buf);
167
std::string lltodecstr(long long val);
170
std::string lltodecstr(int64_t val);
168
std::string ulltodecstr(unsigned long long val);
171
std::string ulltodecstr(uint64_t val);
169
172
170
/** Convert byte count into unit (KB/MB...) appropriate for display */
173
/** Convert byte count into unit (KB/MB...) appropriate for display */
171
std::string displayableBytes(off_t size);
174
std::string displayableBytes(int64_t size);
172
175
173
/** Break big string into lines */
176
/** Break big string into lines */
174
std::string breakIntoLines(const std::string& in, unsigned int ll = 100,
177
std::string breakIntoLines(const std::string& in, unsigned int ll = 100,
175
                           unsigned int maxlines = 50);
178
                           unsigned int maxlines = 50);
176
179