OLD | NEW |
1 // Copyright 2009 The RE2 Authors. All Rights Reserved. | 1 // Copyright 2009 The RE2 Authors. All Rights Reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef RE2_UTIL_UTIL_H__ | 5 #ifndef RE2_UTIL_UTIL_H__ |
6 #define RE2_UTIL_UTIL_H__ | 6 #define RE2_UTIL_UTIL_H__ |
7 | 7 |
8 // C | 8 // C |
9 #include <stdio.h> | 9 #include <stdio.h> |
10 #include <string.h> | 10 #include <string.h> |
11 #include <stdint.h> | 11 #include <stdint.h> |
12 #include <stddef.h> // For size_t | 12 #include <stddef.h> // For size_t |
13 #include <assert.h> | 13 #include <assert.h> |
14 #include <stdarg.h> | 14 #include <stdarg.h> |
15 #ifndef WIN32 | 15 #ifndef WIN32 |
16 #include <sys/time.h> | 16 #include <sys/time.h> |
17 #endif | 17 #endif |
18 #include <time.h> | 18 #include <time.h> |
| 19 #include <ctype.h> // For isdigit, isalpha. |
19 | 20 |
20 // C++ | 21 // C++ |
21 #include <vector> | 22 #include <vector> |
22 #include <string> | 23 #include <string> |
23 #include <algorithm> | 24 #include <algorithm> |
24 #include <iosfwd> | 25 #include <iosfwd> |
25 #include <map> | 26 #include <map> |
26 #include <stack> | 27 #include <stack> |
27 #include <ostream> | 28 #include <ostream> |
28 #include <utility> | 29 #include <utility> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] | 83 typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] |
83 | 84 |
84 // DISALLOW_EVIL_CONSTRUCTORS disallows the copy and operator= functions. | 85 // DISALLOW_EVIL_CONSTRUCTORS disallows the copy and operator= functions. |
85 // It goes in the private: declarations in a class. | 86 // It goes in the private: declarations in a class. |
86 #define DISALLOW_EVIL_CONSTRUCTORS(TypeName) \ | 87 #define DISALLOW_EVIL_CONSTRUCTORS(TypeName) \ |
87 TypeName(const TypeName&); \ | 88 TypeName(const TypeName&); \ |
88 void operator=(const TypeName&) | 89 void operator=(const TypeName&) |
89 | 90 |
90 #define arraysize(array) (sizeof(array)/sizeof((array)[0])) | 91 #define arraysize(array) (sizeof(array)/sizeof((array)[0])) |
91 | 92 |
| 93 // Fake lock annotations. For real ones, see |
| 94 // http://code.google.com/p/data-race-test/ |
| 95 #ifndef ANNOTATE_PUBLISH_MEMORY_RANGE |
| 96 #define ANNOTATE_PUBLISH_MEMORY_RANGE(a, b) |
| 97 #define ANNOTATE_IGNORE_WRITES_BEGIN() |
| 98 #define ANNOTATE_IGNORE_WRITES_END() |
| 99 #define ANNOTATE_BENIGN_RACE(a, b) |
| 100 #define NO_THREAD_SAFETY_ANALYSIS |
| 101 #define ANNOTATE_HAPPENS_BEFORE(x) |
| 102 #define ANNOTATE_HAPPENS_AFTER(x) |
| 103 #define ANNOTATE_UNPROTECTED_READ(x) (x) |
| 104 #endif |
| 105 |
92 class StringPiece; | 106 class StringPiece; |
93 | 107 |
94 string CEscape(const StringPiece& src); | 108 string CEscape(const StringPiece& src); |
95 int CEscapeString(const char* src, int src_len, char* dest, int dest_len); | 109 int CEscapeString(const char* src, int src_len, char* dest, int dest_len); |
96 | 110 |
97 extern string StringPrintf(const char* format, ...); | 111 extern string StringPrintf(const char* format, ...); |
98 extern void SStringPrintf(string* dst, const char* format, ...); | 112 extern void SStringPrintf(string* dst, const char* format, ...); |
99 extern void StringAppendF(string* dst, const char* format, ...); | 113 extern void StringAppendF(string* dst, const char* format, ...); |
100 extern string PrefixSuccessor(const StringPiece& prefix); | 114 extern string PrefixSuccessor(const StringPiece& prefix); |
101 | 115 |
(...skipping 13 matching lines...) Expand all Loading... |
115 } | 129 } |
116 | 130 |
117 } // namespace re2 | 131 } // namespace re2 |
118 | 132 |
119 #include "util/arena.h" | 133 #include "util/arena.h" |
120 #include "util/logging.h" | 134 #include "util/logging.h" |
121 #include "util/mutex.h" | 135 #include "util/mutex.h" |
122 #include "util/utf.h" | 136 #include "util/utf.h" |
123 | 137 |
124 #endif // RE2_UTIL_UTIL_H__ | 138 #endif // RE2_UTIL_UTIL_H__ |
OLD | NEW |