Free Electron
Regex.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __platform_regex_h__
8 #define __platform_regex_h__
9 
10 namespace fe
11 {
12 
13 extern "C"
14 {
15 
16 typedef void* (FE_CDECL RegexInitFunction)(const char* a_pattern);
17 typedef void* (FE_CDECL RegexMatchFunction)(void* a_expression,const char* a_candidate);
18 typedef const char* (FE_CDECL RegexResultFunction)(void* a_result,U32 a_index);
19 typedef void* (FE_CDECL RegexReplaceFunction)(void* a_expression,
20  const char* a_candidate,const char* a_replacement);
21 typedef void (FE_CDECL RegexFinishFunction)(void* a_expression);
22 typedef void (FE_CDECL RegexReleaseFunction)(void* a_result);
23 
24 } /* extern "C" */
25 
26 FE_MEM_PORT extern RegexInitFunction* gs_fnRegexInit;
27 FE_MEM_PORT extern RegexMatchFunction* gs_fnRegexMatch;
28 FE_MEM_PORT extern RegexMatchFunction* gs_fnRegexSearch;
29 FE_MEM_PORT extern RegexResultFunction* gs_fnRegexResult;
30 FE_MEM_PORT extern RegexReplaceFunction* gs_fnRegexReplace;
31 FE_MEM_PORT extern RegexFinishFunction* gs_fnRegexFinish;
32 FE_MEM_PORT extern RegexReleaseFunction* gs_fnRegexRelease;
33 FE_MEM_PORT extern BWORD gs_regexChecked;
34 
35 class FE_DL_PUBLIC FE_DL_EXPORT Regex
36 {
37  public:
38  Regex(const char* a_pattern);
39  ~Regex(void);
40  BWORD match(const char* a_candidate);
41  BWORD search(const char* a_candidate);
42 const char* replace(const char* a_candidate,const char* a_replacement);
43 const char* result(U32 a_index);
44 
45 static void replaceInitFunction(RegexInitFunction* a_fnInit)
46  { gs_fnRegexInit=a_fnInit; }
47 static void replaceMatchFunction(RegexMatchFunction* a_fnMatch)
48  { gs_fnRegexMatch=a_fnMatch; }
49 static void replaceSearchFunction(RegexMatchFunction* a_fnSearch)
50  { gs_fnRegexSearch=a_fnSearch; }
51 static void replaceResultFunction(RegexResultFunction* a_fnResult)
52  { gs_fnRegexResult=a_fnResult; }
53 static void replaceReplaceFunction(RegexReplaceFunction* a_fnReplace)
54  { gs_fnRegexReplace=a_fnReplace; }
55 static void replaceFinishFunction(RegexFinishFunction* a_fnFinish)
56  { gs_fnRegexFinish=a_fnFinish; }
57 static void replaceReleaseFunction(RegexReleaseFunction* a_fnRelease)
58  { gs_fnRegexRelease=a_fnRelease; }
59 
60 static BWORD confirm(String a_hint="");
61 
62  private:
63 
64  void* m_pExpression;
65  void* m_pResult;
66 };
67 
68 } /* namespace */
69 
70 #endif /* __platform_regex_h__ */
kernel
Definition: namespace.dox:3