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

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