libassa 3.5.1
Loading...
Searching...
No Matches
Regexp.h
Go to the documentation of this file.
1// -*- c++ -*-
2//------------------------------------------------------------------------------
3// Regexp.h
4//------------------------------------------------------------------------------
5// Copyright (C) 1997-2003 Vladislav Grinchenko <vlg@users.sourceforge.net>
6//
7// This library is free software; you can redistribute it and/or
8// modify it under the terms of the GNU Library General Public
9// License as published by the Free Software Foundation; either
10// version 2 of the License, or (at your option) any later version.
11//------------------------------------------------------------------------------
12#ifndef REGEXP_H
13#define REGEXP_H
14
15#include "assa/Assure.h"
16#include <sys/types.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22#include <regex.h>
23
24#ifdef __cplusplus
25}
26#endif /* C++ */
27
28
29#include <string>
30
31namespace ASSA {
32
43 class Regexp {
44 public:
48 Regexp (const std::string& pattern_);
49
53 ~Regexp ();
54
60 int match (const char* text_);
61
64 const char* get_error () const { return m_error_msg; }
65
68 const char* get_pattern () const { return m_pattern; }
69
70 private:
71 char* m_pattern;
74 };
75} // @end namespace
76
77#endif /* REGEXP_H */
78
79
80
A collection of assert function wrappers.
A wrapper class to provide AutoPtr with reference semantics.
Definition AutoPtr.h:32
Regexp class.
Definition Regexp.h:43
const char * get_pattern() const
Return the original pattern (uncompiled)
Definition Regexp.h:68
char * m_error_msg
Definition Regexp.h:72
char * m_pattern
Definition Regexp.h:71
const char * get_error() const
Return error message.
Definition Regexp.h:64
regex_t * m_compiled_pattern
Definition Regexp.h:73
~Regexp()
Destructor.
Definition Regexp.cpp:42
int match(const char *text_)
Match an ASCII character string agains the pattern this class wraps.
Definition Regexp.cpp:58