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

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