retdec
|
#include <compare.h>
Public Member Functions | |
Constructors. | |
RuleRelations (yaramod::Rule *rule) | |
Getters. | |
yaramod::Rule * | getRule () const |
std::vector< yaramod::Rule * > | getEquals () const |
std::vector< yaramod::Rule * > | getAlternatives () const |
Queries. | |
bool | hasEquals () const |
bool | hasAlternatives () const |
Comparisons. | |
bool | add (yaramod::Rule *otherRule) |
bool | isEqual (const yaramod::Rule *otherRule) const |
bool | isAlternative (const yaramod::Rule *otherRule) const |
bool | isEqualOrAlternative (const yaramod::Rule *otherRule) const |
Auxiliary. | |
void | makeAlternativesUniq () |
Private Attributes | |
yaramod::Rule * | rule |
Base rule. More... | |
std::vector< yaramod::Rule * > | equals |
std::vector< yaramod::Rule * > | alternatives |
Class representing relations of given rule with other rules.
RuleRelations::RuleRelations | ( | yaramod::Rule * | rule | ) |
Constructor.
rule | base rule |
bool RuleRelations::add | ( | yaramod::Rule * | otherRule | ) |
Add new relation for rule.
If rule is unrelated add nothing and return false.
otherRule | rule to add if related |
true
if rule is related and was added, false
otherwise std::vector< Rule * > RuleRelations::getAlternatives | ( | ) | const |
Get alternatives.
std::vector< Rule * > RuleRelations::getEquals | ( | ) | const |
Get equals.
Rule * RuleRelations::getRule | ( | ) | const |
Get base rule.
bool RuleRelations::hasAlternatives | ( | ) | const |
Check whether rule has any alternatives.
true
if rule has alternatives, false
otherwise bool RuleRelations::hasEquals | ( | ) | const |
Check whether rule has any equals.
true
if rule has equals, false
otherwise bool RuleRelations::isAlternative | ( | const yaramod::Rule * | otherRule | ) | const |
Check whether rule is alternative.
otherRule | rule to compare with |
true
if otherRule
is alternative, false
otherwise bool RuleRelations::isEqual | ( | const yaramod::Rule * | otherRule | ) | const |
Check whether rule is equal.
otherRule | rule to compare with |
true
if otherRule
is equal, false
otherwise bool RuleRelations::isEqualOrAlternative | ( | const yaramod::Rule * | otherRule | ) | const |
Check whether rule is related.
otherRule | rule to compare with |
true
if otherRule
is related, false
otherwise void RuleRelations::makeAlternativesUniq | ( | ) |
Filter out duplicates in alternatives.
|
private |
Rules with same patterns but different references.
These rules can be used later in static code detection, but can be stored more effectively in output file.
|
private |
Rules with both same patterns and same references.
These rules will have to be removed as it is impossible to detect them correctly in later stages of static code detection.
|
private |
Base rule.