Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

BOSS::FSA Class Reference

BOSS::FSA is a finite-state automaton that splits a string into substrings defined by regular expressions. More...

#include <boss_fsa.h>

List of all members.

Public Member Functions

 FSA (const string &filename) throw (BOSS::FileOpenError, BOSS::FileFormatError)
 This constructor reads regular expressions from a file.

 FSA (const BOSS::t_SVector &expressions) throw (BOSS::FileFormatError)
 This constructor reads regular expressions from an input string vector (t_SVector).

 ~FSA ()
 Destroy the FSA.

BOSS::t_SVector parse (const string &trans) const throw (BOSS::NoRegexMatch)
 Divide "trans" into substrings.


Protected Member Functions

 FSA ()

Protected Attributes

regex_t preg


Detailed Description

BOSS::FSA is a finite-state automaton that splits a string into substrings defined by regular expressions.

Author:
Karlheinz Stoeber
This class is used to divide a string into substrings. It is also used as a base class for classes with special adaptation to the format of the set of regular expressions used by this class. A substring is defined by a regular expression which is normally given in a file. Each row of this file forms a regular expression. The constructor reads such a file and creates the finite state automaton from it. The parse function divides a string into its substrings by matching the longest substrings in the given string from left to right. This class uses the regex-library from POSIX-libc!


Constructor & Destructor Documentation

BOSS::FSA::FSA  )  [inline, protected]
 

BOSS::FSA::FSA const string &  filename  )  throw (BOSS::FileOpenError, BOSS::FileFormatError)
 

This constructor reads regular expressions from a file.

This constructor reads elements from file "filename". Each row of the input file is expected to contain a regular expression X, which is extended to (^X). After creation, the FSA is stored in "preg". This constructor throws the following exceptions:

"BOSS_FileOpenError", if file opening fails, or "BOSS_FormatError", if there are problems creating the FSA.

BOSS::FSA::FSA const BOSS::t_SVector expressions  )  throw (BOSS::FileFormatError)
 

This constructor reads regular expressions from an input string vector (t_SVector).

This constructor reads regular expressions from an input string vector (t_SVector). It works exactly like the constructor that reads from a file, except that the expressions are read from an input string vector instead of a file.

BOSS::FSA::~FSA  ) 
 

Destroy the FSA.


Member Function Documentation

BOSS::t_SVector BOSS::FSA::parse const string &  trans  )  const throw (BOSS::NoRegexMatch)
 

Divide "trans" into substrings.

Divide "trans" into substrings. Each substring satisfies at least one regular expression. If more than one regular expression matches, the longest match is taken. The result is returned as a vector. Each element contains one substring.


Member Data Documentation

regex_t BOSS::FSA::preg [protected]
 


The documentation for this class was generated from the following files:
Generated on Tue Dec 20 23:14:41 2005 for BOSS by doxygen 1.3.6