OpendTect-6_4  6.4
globexpr.h
Go to the documentation of this file.
1 #ifndef globexpr_h
2 #define globexpr_h
3 
4 /*
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: A.H. Bril
9  Date: 15-1-2001
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 */
14 
15 #include "basicmod.h"
16 #include "bufstring.h"
17 
27 {
28 public:
29 
30  GlobExpr( const char* s = 0, bool casesens=true )
31  : expr_(""), errmsg_(0), ci_(!casesens) { set(s); }
32  GlobExpr( const GlobExpr& ge )
33  : expr_(ge.expr_), errmsg_(0), ci_(ge.ci_) {}
34  GlobExpr& operator=( const GlobExpr& ge )
35  { expr_ = ge.expr_; errmsg_ = 0; ci_ = ge.ci_;
36  return *this; }
37  bool operator==( const GlobExpr& ge ) const
38  { return expr_ == ge.expr_ && ci_ == ge.ci_; }
39 
40  void setCaseInSensitive( bool yn=true ) { ci_ = yn; }
41 
42  void set(const char*);
43  inline operator const char*() const
44  { return (const char*)expr_; }
45 
46  inline bool matches( const char* t ) const
47  { return matches( expr_, t,
48  const_cast<const char*&>(errmsg_), ci_ ); }
49  const char* expressionFailMessage() const { return errmsg_; }
51 
52  static bool matches(const char* expression,const char* txt,
53  const char*& errmsg_if_expression_is_incorrect,
54  bool caseinsens);
55 
56 protected:
57 
59  const char* errmsg_;
60  bool ci_;
61 
62  static bool starMatches(const char*,const char*,const char*&,bool);
63 };
64 
65 
66 #endif
#define mExpClass(module)
Definition: commondefs.h:160
GlobExpr(const char *s=0, bool casesens=true)
Definition: globexpr.h:30
GlobExpr & operator=(const GlobExpr &ge)
Definition: globexpr.h:34
GlobExpr(const GlobExpr &ge)
Definition: globexpr.h:32
BufferString expr_
Definition: globexpr.h:58
bool matches(const char *t) const
Definition: globexpr.h:46
bool operator==(const GlobExpr &ge) const
Definition: globexpr.h:37
const char * errmsg_
Definition: globexpr.h:59
Glob-expression matching like UNIX shells.
Definition: globexpr.h:26
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
void setCaseInSensitive(bool yn=true)
Definition: globexpr.h:40
BufferString errmsg_
Definition: horizontracker.h:119
const char * expressionFailMessage() const
Normally null, only filled if invalid expression.
Definition: globexpr.h:49
bool ci_
Definition: globexpr.h:60

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019