retdec
Private Attributes | Friends | List of all members
retdec::yaracpp::YaraRule Class Reference

#include <yara_rule.h>

Collaboration diagram for retdec::yaracpp::YaraRule:
Collaboration graph
[legend]

Public Member Functions

Const getters
const std::string & getName () const
 
const YaraMetagetMeta (const std::string &id) const
 
const YaraMatchgetMatch (std::size_t index) const
 
const YaraMatchgetFirstMatch () const
 
const std::vector< YaraMeta > & getMetas () const
 
const std::vector< YaraMatch > & getMatches () const
 
std::size_t getNumberOfMetas () const
 
std::size_t getNumberOfMatches () const
 
Getters
YaraMetagetMeta (const std::string &id)
 
YaraMatchgetMatch (std::size_t index)
 
YaraMatchgetFirstMatch ()
 
Setters
void setName (const std::string &ruleName)
 
Other methods
void addMeta (const YaraMeta &meta)
 
void addMatch (const YaraMatch &match)
 

Private Attributes

std::string name
 
std::vector< YaraMetametas
 
std::vector< YaraMatchmatches
 

Friends

std::ostream & operator<< (std::ostream &o, const YaraRule &rule)
 

Detailed Description

Representation of one YARA rule

Member Function Documentation

◆ addMatch()

void retdec::yaracpp::YaraRule::addMatch ( const YaraMatch match)

Add match

Parameters
matchMatch related to this rule

◆ addMeta()

void retdec::yaracpp::YaraRule::addMeta ( const YaraMeta meta)

Add meta

Parameters
metaMeta related to this rule

◆ getFirstMatch() [1/2]

YaraMatch * retdec::yaracpp::YaraRule::getFirstMatch ( )

Get first match of this rule

Returns
Pointer to first match or nullptr if rule has no matches

◆ getFirstMatch() [2/2]

const YaraMatch * retdec::yaracpp::YaraRule::getFirstMatch ( ) const

Get first match of this rule

Returns
Pointer to first match or nullptr if rule has no matches

◆ getMatch() [1/2]

YaraMatch * retdec::yaracpp::YaraRule::getMatch ( std::size_t  index)

Get selected match of this rule

Parameters
indexIndex of selected match (indexed from 0)
Returns
Pointer to selected match or nullptr if such match is not found

◆ getMatch() [2/2]

const YaraMatch * retdec::yaracpp::YaraRule::getMatch ( std::size_t  index) const

Get selected match of this rule

Parameters
indexIndex of selected match (indexed from 0)
Returns
Pointer to selected match or nullptr if such match is not found

◆ getMatches()

const std::vector< YaraMatch > & retdec::yaracpp::YaraRule::getMatches ( ) const

Get all matches

Returns
All matches related to this rule

◆ getMeta() [1/2]

YaraMeta * retdec::yaracpp::YaraRule::getMeta ( const std::string &  id)

Get selected meta related to this rule

Parameters
idName of selected meta
Returns
Pointer to selected meta or nullptr if such meta is not found

◆ getMeta() [2/2]

const YaraMeta * retdec::yaracpp::YaraRule::getMeta ( const std::string &  id) const

Get selected meta related to this rule

Parameters
idName of selected meta
Returns
Pointer to selected meta or nullptr if such meta is not found

◆ getMetas()

const std::vector< YaraMeta > & retdec::yaracpp::YaraRule::getMetas ( ) const

Get all metas

Returns
All metas related to this rule

◆ getName()

const std::string & retdec::yaracpp::YaraRule::getName ( ) const

Get name related to this rule

Returns
Name of rule

◆ getNumberOfMatches()

std::size_t retdec::yaracpp::YaraRule::getNumberOfMatches ( ) const

Get number of stored matches

Returns
Number of stored matches

◆ getNumberOfMetas()

std::size_t retdec::yaracpp::YaraRule::getNumberOfMetas ( ) const

Get number of stored metas

Returns
Number of stored metas

◆ setName()

void retdec::yaracpp::YaraRule::setName ( const std::string &  ruleName)

Set name of rule

Parameters
ruleNameName of rule

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  o,
const YaraRule rule 
)
friend

Overload to print rule's name

Parameters
ooutput stream
rulerule being printed
Returns
output stream for chaining operators

Member Data Documentation

◆ matches

std::vector<YaraMatch> retdec::yaracpp::YaraRule::matches
private

◆ metas

std::vector<YaraMeta> retdec::yaracpp::YaraRule::metas
private

◆ name

std::string retdec::yaracpp::YaraRule::name
private

The documentation for this class was generated from the following files: