|
a/src/utils/smallut.h |
|
b/src/utils/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>
|
|
... |
|
... |
160 |
/** Truncate a string to a given maxlength, avoiding cutting off midword
|
161 |
/** Truncate a string to a given maxlength, avoiding cutting off midword
|
161 |
* if reasonably possible. */
|
162 |
* if reasonably possible. */
|
162 |
extern std::string truncate_to_word(const std::string& input,
|
163 |
extern std::string truncate_to_word(const std::string& input,
|
163 |
std::string::size_type maxlen);
|
164 |
std::string::size_type maxlen);
|
164 |
|
165 |
|
165 |
void ulltodecstr(unsigned long long val, std::string& buf);
|
166 |
void ulltodecstr(uint64_t val, std::string& buf);
|
166 |
void lltodecstr(long long val, std::string& buf);
|
167 |
void lltodecstr(int64_t val, std::string& buf);
|
167 |
std::string lltodecstr(long long val);
|
168 |
std::string lltodecstr(int64_t val);
|
168 |
std::string ulltodecstr(unsigned long long val);
|
169 |
std::string ulltodecstr(uint64_t val);
|
169 |
|
170 |
|
170 |
/** Convert byte count into unit (KB/MB...) appropriate for display */
|
171 |
/** Convert byte count into unit (KB/MB...) appropriate for display */
|
171 |
std::string displayableBytes(off_t size);
|
172 |
std::string displayableBytes(int64_t size);
|
172 |
|
173 |
|
173 |
/** Break big string into lines */
|
174 |
/** Break big string into lines */
|
174 |
std::string breakIntoLines(const std::string& in, unsigned int ll = 100,
|
175 |
std::string breakIntoLines(const std::string& in, unsigned int ll = 100,
|
175 |
unsigned int maxlines = 50);
|
176 |
unsigned int maxlines = 50);
|
176 |
|
177 |
|