|
a/src/utils/smallut.h |
|
b/src/utils/smallut.h |
1 |
#ifndef _SMALLUT_H_INCLUDED_
|
1 |
#ifndef _SMALLUT_H_INCLUDED_
|
2 |
#define _SMALLUT_H_INCLUDED_
|
2 |
#define _SMALLUT_H_INCLUDED_
|
3 |
/* @(#$Id: smallut.h,v 1.13 2006-01-26 07:03:35 dockes Exp $ (C) 2004 J.F.Dockes */
|
3 |
/* @(#$Id: smallut.h,v 1.14 2006-01-26 12:29:20 dockes Exp $ (C) 2004 J.F.Dockes */
|
4 |
#include <string>
|
4 |
#include <string>
|
5 |
#include <list>
|
5 |
#include <list>
|
6 |
|
6 |
|
7 |
#ifndef NO_NAMESPACES
|
7 |
#ifndef NO_NAMESPACES
|
8 |
using std::string;
|
8 |
using std::string;
|
|
... |
|
... |
38 |
|
38 |
|
39 |
/** Remove instances of characters belonging to set (default {space,
|
39 |
/** Remove instances of characters belonging to set (default {space,
|
40 |
tab}) at beginning and end of input string */
|
40 |
tab}) at beginning and end of input string */
|
41 |
extern void trimstring(string &s, const char *ws = " \t");
|
41 |
extern void trimstring(string &s, const char *ws = " \t");
|
42 |
|
42 |
|
|
|
43 |
/** Escape things like < or & by turining them to entities */
|
43 |
extern string escapeHtml(const string &in);
|
44 |
extern string escapeHtml(const string &in);
|
44 |
|
45 |
|
|
|
46 |
|
|
|
47 |
class Chrono {
|
|
|
48 |
public:
|
|
|
49 |
Chrono();
|
|
|
50 |
/** Reset origin */
|
|
|
51 |
long restart();
|
|
|
52 |
/** Snapshot current time */
|
|
|
53 |
static void refnow();
|
|
|
54 |
/** Get current elapsed since creation or restart
|
|
|
55 |
*
|
|
|
56 |
* @param frozen give time since the last refnow call (this is to
|
|
|
57 |
* allow for using one actual system call to get values from many
|
|
|
58 |
* chrono objects, like when examining timeouts in a queue)
|
|
|
59 |
*/
|
|
|
60 |
long millis(int frozen = 0);
|
|
|
61 |
long micros(int frozen = 0);
|
|
|
62 |
float secs(int frozen = 0);
|
|
|
63 |
private:
|
|
|
64 |
long m_secs;
|
|
|
65 |
long m_nsecs;
|
|
|
66 |
};
|
|
|
67 |
|
|
|
68 |
|
45 |
#endif /* _SMALLUT_H_INCLUDED_ */
|
69 |
#endif /* _SMALLUT_H_INCLUDED_ */
|