Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: third_party/re2/util/util.h

Issue 10575037: Include RE2 library (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Less intrusive fix for Android Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/re2/util/utf.h ('k') | third_party/re2/util/valgrind.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2009 The RE2 Authors. All Rights Reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 #ifndef RE2_UTIL_UTIL_H__
6 #define RE2_UTIL_UTIL_H__
7
8 // C
9 #include <stdio.h>
10 #include <string.h>
11 #include <stdint.h>
12 #include <stddef.h> // For size_t
13 #include <assert.h>
14 #include <stdarg.h>
15 #ifndef WIN32
16 #include <sys/time.h>
17 #endif
18 #include <time.h>
19
20 // C++
21 #include <vector>
22 #include <string>
23 #include <algorithm>
24 #include <iosfwd>
25 #include <map>
26 #include <stack>
27 #include <iostream>
28 #include <utility>
29 #include <set>
30
31 #include "build/build_config.h"
32 #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
33
34 // Use std names.
35 using std::set;
36 using std::pair;
37 using std::vector;
38 using std::string;
39 using std::min;
40 using std::max;
41 using std::ostream;
42 using std::map;
43 using std::stack;
44 using std::sort;
45 using std::swap;
46 using std::make_pair;
47
48 #if defined(__GNUC__) && !defined(USE_CXX0X) && !defined(OS_ANDROID)
49
50 #include <tr1/unordered_set>
51 using std::tr1::unordered_set;
52
53 #else
54
55 #include <unordered_set>
56 #if defined(WIN32) || defined(OS_ANDROID)
57 using std::tr1::unordered_set;
58 #else
59 using std::unordered_set;
60 #endif
61
62 #endif
63
64 namespace re2 {
65
66 typedef int8_t int8;
67 typedef uint8_t uint8;
68 typedef int16_t int16;
69 typedef uint16_t uint16;
70 typedef int32_t int32;
71 typedef uint32_t uint32;
72 typedef int64_t int64;
73 typedef uint64_t uint64;
74
75 typedef unsigned long ulong;
76 typedef unsigned int uint;
77 typedef unsigned short ushort;
78
79 // COMPILE_ASSERT causes a compile error about msg if expr is not true.
80 template<bool> struct CompileAssert {};
81 #define COMPILE_ASSERT(expr, msg) \
82 typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
83
84 // DISALLOW_EVIL_CONSTRUCTORS disallows the copy and operator= functions.
85 // It goes in the private: declarations in a class.
86 #define DISALLOW_EVIL_CONSTRUCTORS(TypeName) \
87 TypeName(const TypeName&); \
88 void operator=(const TypeName&)
89
90 #define arraysize(array) (sizeof(array)/sizeof((array)[0]))
91
92 class StringPiece;
93
94 string CEscape(const StringPiece& src);
95 int CEscapeString(const char* src, int src_len, char* dest, int dest_len);
96
97 extern string StringPrintf(const char* format, ...);
98 extern void SStringPrintf(string* dst, const char* format, ...);
99 extern void StringAppendF(string* dst, const char* format, ...);
100 extern string PrefixSuccessor(const StringPiece& prefix);
101
102 uint32 hashword(const uint32*, size_t, uint32);
103 void hashword2(const uint32*, size_t, uint32*, uint32*);
104
105 static inline uint32 Hash32StringWithSeed(const char* s, int len, uint32 seed) {
106 return hashword((uint32*)s, len/4, seed);
107 }
108
109 static inline uint64 Hash64StringWithSeed(const char* s, int len, uint32 seed) {
110 uint32 x, y;
111 x = seed;
112 y = 0;
113 hashword2((uint32*)s, len/4, &x, &y);
114 return ((uint64)x << 32) | y;
115 }
116
117 } // namespace re2
118
119 #include "util/arena.h"
120 #include "util/logging.h"
121 #include "util/mutex.h"
122 #include "util/utf.h"
123
124 #endif // RE2_UTIL_UTIL_H__
OLDNEW
« no previous file with comments | « third_party/re2/util/utf.h ('k') | third_party/re2/util/valgrind.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698