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

Side by Side Diff: base/regexp.cc

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « base/regexp.h ('k') | base/registry_hive.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 2005-2009 Google Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 // ========================================================================
15
16 #include "omaha/base/regexp.h"
17 #include "omaha/base/debug.h"
18
19 namespace omaha {
20
21 #define kMaxArgs 16
22
23 bool RE::PartialMatch(const TCHAR* text, const RE& re, // 3..16 args
24 CString * a0,
25 CString * a1,
26 CString * a2,
27 CString * a3,
28 CString * a4,
29 CString * a5,
30 CString * a6,
31 CString * a7,
32 CString * a8,
33 CString * a9,
34 CString * a10,
35 CString * a11,
36 CString * a12,
37 CString * a13,
38 CString * a14,
39 CString * a15)
40 {
41 ASSERT(text, (L""));
42 // a0 may be NULL
43 // a1 may be NULL
44 // a2 may be NULL
45 // a3 may be NULL
46 // a4 may be NULL
47 // a5 may be NULL
48 // a6 may be NULL
49 // a7 may be NULL
50 // a8 may be NULL
51 // a9 may be NULL
52 // a10 may be NULL
53 // a11 may be NULL
54 // a12 may be NULL
55 // a13 may be NULL
56 // a14 may be NULL
57 // a15 may be NULL
58
59 CString * args[kMaxArgs];
60 int n = 0;
61 if (a0 == NULL) goto done; args[n++] = a0;
62 if (a1 == NULL) goto done; args[n++] = a1;
63 if (a2 == NULL) goto done; args[n++] = a2;
64 if (a3 == NULL) goto done; args[n++] = a3;
65 if (a4 == NULL) goto done; args[n++] = a4;
66 if (a5 == NULL) goto done; args[n++] = a5;
67 if (a6 == NULL) goto done; args[n++] = a6;
68 if (a7 == NULL) goto done; args[n++] = a7;
69 if (a8 == NULL) goto done; args[n++] = a8;
70 if (a9 == NULL) goto done; args[n++] = a9;
71 if (a10 == NULL) goto done; args[n++] = a10;
72 if (a11 == NULL) goto done; args[n++] = a11;
73 if (a12 == NULL) goto done; args[n++] = a12;
74 if (a13 == NULL) goto done; args[n++] = a13;
75 if (a14 == NULL) goto done; args[n++] = a14;
76 if (a15 == NULL) goto done; args[n++] = a15;
77
78 done:
79 return re.DoMatchImpl(text,args,n,NULL);
80 }
81
82 // Like PartialMatch(), except the "input" is advanced past the matched
83 // text. Note: "input" is modified iff this routine returns true.
84 // For example, "FindAndConsume(s, "(\\w+)", &word)" finds the next
85 // word in "s" and stores it in "word".
86 bool RE::FindAndConsume(const TCHAR **input, const RE& re,
87 CString * a0,
88 CString * a1,
89 CString * a2,
90 CString * a3,
91 CString * a4,
92 CString * a5,
93 CString * a6,
94 CString * a7,
95 CString * a8,
96 CString * a9,
97 CString * a10,
98 CString * a11,
99 CString * a12,
100 CString * a13,
101 CString * a14,
102 CString * a15)
103 {
104 ASSERT(input, (L""));
105 // a0 may be NULL
106 // a1 may be NULL
107 // a2 may be NULL
108 // a3 may be NULL
109 // a4 may be NULL
110 // a5 may be NULL
111 // a6 may be NULL
112 // a7 may be NULL
113 // a8 may be NULL
114 // a9 may be NULL
115 // a10 may be NULL
116 // a11 may be NULL
117 // a12 may be NULL
118 // a13 may be NULL
119 // a14 may be NULL
120 // a15 may be NULL
121
122 CString * args[kMaxArgs];
123 int n = 0;
124 if (a0 == NULL) goto done; args[n++] = a0;
125 if (a1 == NULL) goto done; args[n++] = a1;
126 if (a2 == NULL) goto done; args[n++] = a2;
127 if (a3 == NULL) goto done; args[n++] = a3;
128 if (a4 == NULL) goto done; args[n++] = a4;
129 if (a5 == NULL) goto done; args[n++] = a5;
130 if (a6 == NULL) goto done; args[n++] = a6;
131 if (a7 == NULL) goto done; args[n++] = a7;
132 if (a8 == NULL) goto done; args[n++] = a8;
133 if (a9 == NULL) goto done; args[n++] = a9;
134 if (a10 == NULL) goto done; args[n++] = a10;
135 if (a11 == NULL) goto done; args[n++] = a11;
136 if (a12 == NULL) goto done; args[n++] = a12;
137 if (a13 == NULL) goto done; args[n++] = a13;
138 if (a14 == NULL) goto done; args[n++] = a14;
139 if (a15 == NULL) goto done; args[n++] = a15;
140
141 done:
142 return re.DoMatchImpl(*input,args,n,input);
143 }
144
145 } // namespace omaha
146
OLDNEW
« no previous file with comments | « base/regexp.h ('k') | base/registry_hive.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698