V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
v8-regex.h
1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_INSPECTOR_V8_REGEX_H_
6 #define V8_INSPECTOR_V8_REGEX_H_
7 
8 #include "src/base/macros.h"
9 #include "src/inspector/string-16.h"
10 
11 #include "include/v8.h"
12 
13 namespace v8_inspector {
14 
15 class V8InspectorImpl;
16 
17 enum MultilineMode { MultilineDisabled, MultilineEnabled };
18 
19 class V8Regex {
20  public:
21  V8Regex(V8InspectorImpl*, const String16&, bool caseSensitive,
22  bool multiline = false);
23  int match(const String16&, int startFrom = 0,
24  int* matchLength = nullptr) const;
25  bool isValid() const { return !m_regex.IsEmpty(); }
26  const String16& errorMessage() const { return m_errorMessage; }
27 
28  private:
29  V8InspectorImpl* m_inspector;
30  v8::Global<v8::RegExp> m_regex;
31  String16 m_errorMessage;
32 
33  DISALLOW_COPY_AND_ASSIGN(V8Regex);
34 };
35 
36 } // namespace v8_inspector
37 
38 #endif // V8_INSPECTOR_V8_REGEX_H_