retdec
pattern.h
Go to the documentation of this file.
1 
7 #ifndef FILEINFO_FILE_INFORMATION_FILE_INFORMATION_TYPES_PATTERN_PATTERN_H
8 #define FILEINFO_FILE_INFORMATION_FILE_INFORMATION_TYPES_PATTERN_PATTERN_H
9 
10 #include <string>
11 #include <vector>
12 
14 
15 namespace retdec {
16 namespace fileinfo {
17 
21 class Pattern
22 {
23  private:
24  using patternMatchConstIterator = std::vector<PatternMatch>::const_iterator;
25  using patternMatchIterator = std::vector<PatternMatch>::iterator;
26  std::string name;
27  std::string description;
28  std::string yaraRuleName;
29  bool little = false;
30  bool big = false;
31  std::vector<PatternMatch> matches;
32  public:
35  bool isLittle() const;
36  bool isBig() const;
38 
41  std::string getName() const;
42  std::string getDescription() const;
43  std::string getYaraRuleName() const;
44  std::size_t getNumberOfMatches() const;
45  const PatternMatch* getMatch(std::size_t index) const;
46  const std::vector<PatternMatch>& getMatches() const;
48 
56 
59  void setName(std::string sName);
60  void setDescription(std::string sDescription);
61  void setYaraRuleName(std::string sYaraRuleName);
62  void setLittle();
63  void setBig();
65 
70 };
71 
72 } // namespace fileinfo
73 } // namespace retdec
74 
75 #endif
Definition: pattern_match.h:21
Definition: pattern.h:22
std::string yaraRuleName
set name of YARA rule
Definition: pattern.h:28
patternMatchConstIterator begin() const
Definition: pattern.cpp:88
bool little
true if pattern is little endian
Definition: pattern.h:29
std::string getDescription() const
Definition: pattern.cpp:43
void setBig()
Definition: pattern.cpp:156
bool isLittle() const
Definition: pattern.cpp:16
patternMatchConstIterator end() const
Definition: pattern.cpp:96
const PatternMatch * getMatch(std::size_t index) const
Definition: pattern.cpp:71
std::string description
description of pattern
Definition: pattern.h:27
std::vector< PatternMatch > matches
all matches of pattern
Definition: pattern.h:31
bool isBig() const
Definition: pattern.cpp:25
void setDescription(std::string sDescription)
Definition: pattern.cpp:130
void setLittle()
Definition: pattern.cpp:147
void setYaraRuleName(std::string sYaraRuleName)
Definition: pattern.cpp:139
std::vector< PatternMatch >::iterator patternMatchIterator
Definition: pattern.h:25
std::size_t getNumberOfMatches() const
Definition: pattern.cpp:61
bool big
true if pattern is big endian
Definition: pattern.h:30
std::string name
name of pattern
Definition: pattern.h:26
std::vector< PatternMatch >::const_iterator patternMatchConstIterator
Definition: pattern.h:24
std::string getYaraRuleName() const
Definition: pattern.cpp:52
const std::vector< PatternMatch > & getMatches() const
Definition: pattern.cpp:80
void addMatch(PatternMatch &match)
Definition: pattern.cpp:166
std::string getName() const
Definition: pattern.cpp:34
void setName(std::string sName)
Definition: pattern.cpp:121
bool match(SymbolicTree &st, const Pattern &p)
Definition: symbolic_tree_match.h:28
Definition: archive_wrapper.h:19
Information about pattern match.