OpendTect-6_4  6.4
compoundkey.h
Go to the documentation of this file.
1 #ifndef compoundkey_h
2 #define compoundkey_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-2000
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 
16 #include "basicmod.h"
17 #include "bufstring.h"
18 
19 
24 {
25 public:
26 
27  inline CompoundKey( const char* s=0 ) { if ( s ) impl_ = s; }
28  inline CompoundKey( const CompoundKey& ck )
29  : impl_(ck.impl_) {}
30  inline CompoundKey& operator=( const char* s )
31  { impl_ = s; return *this;}
32  inline CompoundKey& operator+=( const char* );
33  inline bool operator==( const char* s ) const
34  { return impl_ == s; }
35  inline bool operator==( const CompoundKey& oth ) const
36  { return impl_ == oth.impl_; }
37  inline bool operator!=( const char* s ) const
38  { return impl_ != s; }
39  inline bool operator!=(const CompoundKey& u) const
40  { return impl_ != u.impl_; }
41  inline void setEmpty() { impl_.setEmpty(); }
42  inline bool isEmpty() const { return impl_.isEmpty();}
43  inline char* getCStr() { return impl_.getCStr(); }
44  inline const char* buf() const { return impl_.buf(); }
45  inline operator const char*() const
46  { return buf(); }
47 
48  int nrKeys() const;
49  BufferString key(int) const;
50  void setKey(int,const char*);
51  CompoundKey upLevel() const;
52  bool isUpLevelOf(const CompoundKey&) const;
53 
54 protected:
55 
57  char* fromKey(int) const;
58  const char* getKeyPart(int) const;
59 
60 private:
61 
62  char* fetchKeyPart(int,bool) const;
63 
64 };
65 
66 
67 inline CompoundKey& CompoundKey::operator +=( const char* s )
68 {
69  if ( !impl_.isEmpty() )
70  impl_.add( "." );
71  impl_.add( s );
72  return *this;
73 }
74 
75 
76 #endif
#define mExpClass(module)
Definition: commondefs.h:160
bool operator==(const CompoundKey &oth) const
Definition: compoundkey.h:35
CompoundKey & operator=(const char *s)
Definition: compoundkey.h:30
char * getCStr()
Definition: compoundkey.h:43
CompoundKey(const CompoundKey &ck)
Definition: compoundkey.h:28
bool isEmpty() const
Definition: compoundkey.h:42
const char * buf() const
Definition: compoundkey.h:44
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
bool isEmpty() const
Definition: odstring.h:51
Concatenated short keys separated by dots. Used for Object identifiers in the Object Manager...
Definition: compoundkey.h:23
bool operator==(const char *s) const
Definition: compoundkey.h:33
BufferString & add(char)
CompoundKey(const char *s=0)
Definition: compoundkey.h:27
CompoundKey & operator+=(const char *)
Definition: compoundkey.h:67
void setEmpty()
Definition: compoundkey.h:41
BufferString impl_
Definition: compoundkey.h:56
bool operator!=(const char *s) const
Definition: compoundkey.h:37
bool operator!=(const CompoundKey &u) const
Definition: compoundkey.h:39

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