VR-Forces 4.1.1 Class Documentation
symStr.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 2004 MAK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: symStr.h,v $ $Revision: 1.2 $ $State: Exp $
7 *********************************************************************/
8 #ifndef symStr_H_
9 #define symStr_H_
10 
11 #include "tdbutil/tdbUtilDefines.h"
12 #include <vlutil/vlString.h>
13 #include "tdbutil/cstringHashKey.h"
14 #include "tdbutil/symbolStore.h"
15 
16 //
17 // This class allows one to collect and compare strings using an index
18 // number instead of having to do string compares. It is not virtual
19 // and is effectively 4 bytes meaning you can pass these by value as easily
20 // as passing a pointer
22 {
23 public:
24  // default constructor
26 
27  // additional constructors
28 // DtSymbolString(const char* str);
29  DtSymbolString(const DtString& str);
30  DtSymbolString(unsigned int i);
31 
32  // destructor
33  ~DtSymbolString();
34 
35  // copy constructor
36  DtSymbolString(const DtSymbolString& orig);
37 
38  // assignment operators
39  DtSymbolString& operator=(const DtString& orig);
40  DtSymbolString& operator=(const char* orig);
41 
42  // cast operator
43  // \deprecated This function is deprecated as of VRF 3.9, and should *not* be used.
44  operator const char*() const;
45 
46  // @return The string, in char form, associated with the symbol.
47  const char* c_str() const;
48 
49  // @return The string, in char form, associated with the symbol.
50  // \deprecated This function is deprecated as of VRF 3.9, and should *not* be used.
51  const char* string() const;
52 
53  const unsigned int symbol() const { return mySymbol; };
54 
55  // clone operator
56  DtSymbolString* clone();
57 
58  // comparison operators
59  bool operator==(const DtString& str) const; // string compare
60  bool operator!=(const DtString& str) const;
61 
62  bool operator==(const char* str) const; // string compare
63  bool operator!=(const char* str) const;
64 
65  bool operator==(const DtSymbolString& str) const; // int compare
66  bool operator!=(const DtSymbolString& str) const;
67 
68  // @note This is necessary because, unlike .Net, VC 6.0 can't auto-generate
69  // the operator when an instance of these is placed into a std::map.
70  bool operator<(const DtSymbolString& str) const;
71 
72 protected:
73 
74  unsigned int mySymbol;
75 };
76 
77 
78 #endif

Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)