nds2-client - User 0.16.7
Loading...
Searching...
No Matches
nds_bash_pattern.hh
1/* -*- mode: C++ ; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
3#ifndef SWIG__COMMON__NDS_BASH_PATTERN_HH
4#define SWIG__COMMON__NDS_BASH_PATTERN_HH
5
6#include <string>
7#include "bash_pattern.h"
8
9namespace NDS
10{
11 namespace detail
12 {
13 class bash_pattern
14 {
15 public:
16 explicit bash_pattern( const std::string& expression )
17 : compiled_expr(::bash_pattern_compile( expression.c_str( ) ) )
18 {
19 }
20
21 explicit bash_pattern( const char* expression )
22 : compiled_expr(::bash_pattern_compile(
23 ( expression ? expression : "" ) ) )
24 {
25 }
26
27 ~bash_pattern( )
28 {
29 if ( compiled_expr )
30 {
31 ::bash_pattern_free( compiled_expr );
32 }
33 }
34
35 int
36 matches( const char* text )
37 {
38 return ::bash_pattern_matches( compiled_expr, text );
39 }
40
41 private:
42 typedef ::bash_pattern bash_pattern_t;
43
44 bash_pattern_t* compiled_expr;
45 }; // class bash_pattern
46 }
47}
48
49#endif /* SWIG__COMMON__NDS_BASH_PATTERN_HH */
The NDS client namespace.
Definition debug_stream.cc:18