UI::Util::PosixRegex Class Reference

Wrapper class for POSIX.2 regex functions. More...

`#include <PosixRegex.hpp>`

Collaboration diagram for UI::Util::PosixRegex:

## Data Structures

class | Match
| Helper class representing match data. More...

## Public Types

typedef CodeException< reg_errcode_t > | Exception
| Exceptions we might throw.

## Public Member Functions

| PosixRegex (std::string const &regex, int cflags=0)
Match | runMatch (std::string const &text, int eflags=0)
| Check if text matches, and return the (first) match.
bool | run (std::string const &text, int eflags=0)
| Check if text matches.

## Detailed Description

Wrapper class for POSIX.2 regex functions.

Note
  For the future, one might rather use the libboost's regexx implementation.

See also
  regex(3)

Bug

  Not fully encapsulated; flags must be given using the values from regex.h; Catched exception code must be compared against the reg_errcode_t defined in regex.h.

  Does not support multiple matches (seems this does not work anyway currently)

  Does not support clear text error reporting as via regerror.

Examples
  Regex.cpp.

## Constructor & Destructor Documentation

## PosixRegex()

UI::Util::PosixRegex::PosixRegex | ( | std::string const & | regex,
|  | int | cflags = 0 )

Parameters

  regex | The regular expression
  cflags | Flags as described in regex(3)

References UI_THROW_CODE.

## Member Function Documentation

## run()

bool UI::Util::PosixRegex::run | ( | std::string const & | text,
|  | int | eflags = 0 )

Check if text matches.

Parameters

  text | Text to examine.
  eflags | Flags as described in regex(3).

Returns
  True if match found; else false.

References UI::Util::PosixRegex::Match::matches, and runMatch().

## runMatch()

PosixRegex::Match UI::Util::PosixRegex::runMatch | ( | std::string const & | text,
|  | int | eflags = 0 )

Check if text matches, and return the (first) match.

Parameters

  text | Text to examine.
  eflags | Flags as described in regex(3).

Returns
  First match found; if no match, match.matches will be false.

References UI::Util::PosixRegex::Match::begin, UI::Util::PosixRegex::Match::end, UI::Util::PosixRegex::Match::matches, and UI_THROW_CODE.

Referenced by run().

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

- PosixRegex.hpp
- PosixRegex.cpp