source: icGREP/icgrep-devel/icgrep/grep_engine.h @ 5481

Last change on this file since 5481 was 5481, checked in by cameron, 22 months ago

Refactoring grepEngine: separate out codepoint/property value grep

File size: 1.4 KB
Line 
1/*
2 *  Copyright (c) 2017 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 *  icgrep is a trademark of International Characters.
5 */
6#ifndef GREP_ENGINE_H
7#define GREP_ENGINE_H
8#include <grep_interface.h>
9#include <grep_type.h>  // for GrepType, GrepType::Normal
10#include <string>       // for string
11#include <vector>
12#include <re/re_parser.h> 
13
14namespace re { class CC; }
15namespace re { class RE; }
16namespace llvm { namespace cl { class OptionCategory; } }
17class Driver;
18
19
20namespace grep {
21
22class GrepEngine {
23public:
24
25    GrepEngine();
26
27
28    ~GrepEngine();
29
30    void grepCodeGen(std::vector<re::RE *> REs, GrepModeType grepMode, bool UTF_16, GrepSource grepSource);
31
32    void grepCodeGen_nvptx(std::vector<re::RE *> REs, GrepModeType grepMode, bool UTF_16);
33
34    void doGrep(const std::string & fileName) const;
35
36        uint64_t doGrep(const std::string & fileName, const uint32_t fileIdx) const;
37
38    uint64_t doGrep(const int32_t fileDescriptor, const uint32_t fileIdx) const;
39       
40private:
41   
42    Driver * mGrepDriver;
43};
44
45void initFileResult(std::vector<std::string> filenames);
46   
47void PrintResult(GrepModeType grepMode, std::vector<size_t> & total_CountOnly);
48   
49
50re::CC * grepCodepoints(re::RE * pattern, char * UnicodeDataBuffer, size_t bufferLength);
51   
52const std::vector<std::string> & grepPropertyValues(const std::string& propertyName, re::RE * propertyValuePattern);
53
54}
55
56#endif
Note: See TracBrowser for help on using the repository browser.