Source-highlight Library
srchilite::RegexRuleFactory Class Reference

Implementation of the abstract factory, creating highlighting rules based on boost::regex regular expressions. More...

#include <regexrulefactory.h>

Inheritance diagram for srchilite::RegexRuleFactory:
Collaboration diagram for srchilite::RegexRuleFactory:

List of all members.

Public Member Functions

virtual HighlightRulecreateSimpleRule (const std::string &name, const std::string &s)
 Creates a generic highlighting rule.
virtual HighlightRulecreateWordListRule (const std::string &name, const WordList &list, bool caseSensitve=true)
 Creates a rule for detecting a list of specific words, i.e., isolated from other parts by a space or a delimiter (e.g., if "class" is considered as a word, then it will not match the substring "class" in "myclass")
virtual HighlightRulecreateListRule (const std::string &name, const WordList &list, bool caseSensitve=true)
 Creates a rule for detecting a list of specific expressions.
virtual HighlightRulecreateLineRule (const std::string &name, const std::string &start, const std::string &end, const std::string &escape="", bool nested=false)
 Creates a rule for matching a delimited string (spanning a single line)
virtual HighlightRulecreateMultiLineRule (const std::string &name, const std::string &start, const std::string &end, const std::string &escape, bool nested)
 Creates a rule for matching a delimited string (possibly spanning more than one line)
virtual HighlightRulecreateCompoundRule (const ElemNameList &nameList, const std::string &rep)
 Creates a rule for matching many element names, each represented by a subexpression (the number of subexpression must be equal to the size of the nameList)

Detailed Description

Implementation of the abstract factory, creating highlighting rules based on boost::regex regular expressions.


Member Function Documentation

HighlightRule * srchilite::RegexRuleFactory::createCompoundRule ( const ElemNameList &  nameList,
const std::string &  rep 
) [virtual]

Creates a rule for matching many element names, each represented by a subexpression (the number of subexpression must be equal to the size of the nameList)

Parameters:
nameListthe list of element names represented by the rule
repthe string representation of the rule
Returns:
the generated rule

Implements srchilite::HighlightRuleFactory.

HighlightRule * srchilite::RegexRuleFactory::createLineRule ( const std::string &  name,
const std::string &  start,
const std::string &  end,
const std::string &  escape = "",
bool  nested = false 
) [virtual]

Creates a rule for matching a delimited string (spanning a single line)

Parameters:
namethe element name represented by the rule
startthe string determining the start of the sequence
endthe string determining the end of the sequence
escapethe string the escape sequence (typically a char, e.g., \)
nestedwhether the delimiters can be nested
Returns:
the generated rule

Implements srchilite::HighlightRuleFactory.

HighlightRule * srchilite::RegexRuleFactory::createListRule ( const std::string &  name,
const WordList &  list,
bool  caseSensitve = true 
) [virtual]

Creates a rule for detecting a list of specific expressions.

Parameters:
namethe element name represented by the rule
listthe list of words to detect
caseSensitiveif the characters in the expression must be interpreted case sensitive
Returns:
the generated rule

Implements srchilite::HighlightRuleFactory.

HighlightRule * srchilite::RegexRuleFactory::createMultiLineRule ( const std::string &  name,
const std::string &  start,
const std::string &  end,
const std::string &  escape,
bool  nested 
) [virtual]

Creates a rule for matching a delimited string (possibly spanning more than one line)

Parameters:
namethe element name represented by the rule
startthe string determining the start of the sequence
endthe string determining the end of the sequence
escapethe string the escape sequence (typically a char, e.g., \)
nestedwhether the delimiters can be nested
Returns:
the generated rule

Implements srchilite::HighlightRuleFactory.

HighlightRule * srchilite::RegexRuleFactory::createSimpleRule ( const std::string &  name,
const std::string &  s 
) [virtual]

Creates a generic highlighting rule.

Parameters:
namethe element name represented by the rule
thestring representation
Returns:
the generated rule

Implements srchilite::HighlightRuleFactory.

HighlightRule * srchilite::RegexRuleFactory::createWordListRule ( const std::string &  name,
const WordList &  list,
bool  caseSensitve = true 
) [virtual]

Creates a rule for detecting a list of specific words, i.e., isolated from other parts by a space or a delimiter (e.g., if "class" is considered as a word, then it will not match the substring "class" in "myclass")

Parameters:
namethe element name represented by the rule
listthe list of words to detect
caseSensitiveif the characters in the expression must be interpreted case sensitive
Returns:
the generated rule

Implements srchilite::HighlightRuleFactory.


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