VR-Forces 4.0.4 Class Documentation
include/tdbutil/symStr.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 ** Copyright (c) 2004 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 *********************************************************************/
00005 /*********************************************************************
00006 ** $RCSfile: symStr.h,v $ $Revision: 1.2 $ $State: Exp $
00007 *********************************************************************/
00008 #ifndef symStr_H_
00009 #define symStr_H_
00010 
00011 #include "tdbutil/tdbUtilDefines.h"
00012 #include <vlutil/vlString.h>
00013 #include "tdbutil/cstringHashKey.h"
00014 #include "tdbutil/symbolStore.h"
00015 
00016 //
00017 // This class allows one to collect and compare strings using an index 
00018 // number instead of having to do string compares. It is not virtual
00019 // and is effectively 4 bytes meaning you can pass these by value as easily
00020 // as passing a pointer
00021 class DT_DLL_tdbutil DtSymbolString
00022 {
00023 public:
00024    // default constructor
00025    DtSymbolString();
00026 
00027    // additional constructors
00028 //   DtSymbolString(const char* str);
00029    DtSymbolString(const DtString& str);
00030    DtSymbolString(unsigned int i);
00031 
00032    // destructor
00033    ~DtSymbolString();
00034 
00035    // copy constructor
00036    DtSymbolString(const DtSymbolString& orig);
00037 
00038    // assignment operators
00039    DtSymbolString& operator=(const DtString& orig);
00040    DtSymbolString& operator=(const char* orig);
00041 
00042    // cast operator
00043    // \deprecated This function is deprecated as of VRF 3.9, and should *not* be used.
00044    operator const char*() const;
00045   
00046    // @return The string, in char form, associated with the symbol.
00047    const char* c_str() const;
00048 
00049    // @return The string, in char form, associated with the symbol.
00050    // \deprecated This function is deprecated as of VRF 3.9, and should *not* be used.
00051    const char* string() const;
00052 
00053    const unsigned int symbol() const { return mySymbol; };
00054 
00055    // clone operator
00056    DtSymbolString* clone();
00057 
00058    // comparison operators
00059    bool operator==(const DtString& str) const; // string compare
00060    bool operator!=(const DtString& str) const;
00061 
00062    bool operator==(const char* str) const; // string compare
00063    bool operator!=(const char* str) const;
00064 
00065    bool operator==(const DtSymbolString& str) const; // int compare
00066    bool operator!=(const DtSymbolString& str) const;
00067 
00068    // @note This is necessary because, unlike .Net, VC 6.0 can't auto-generate 
00069    // the operator when an instance of these is placed into a std::map.  
00070    bool operator<(const DtSymbolString& str) const;
00071 
00072 protected:
00073 
00074    unsigned int mySymbol;
00075 };
00076 
00077 
00078 #endif

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)