HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_DeepString.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_DeepString.h
7  *
8  * COMMENTS:
9  * A UT_DeepString is a UT_String that always stores a deep copy its
10  * data. This way you can return strings by value and you can have string
11  * member variables without having to define your own copy constructor and
12  * assignment operator.
13  *
14  * Note that a UT_DeepString is just a UT_String that always stores
15  * a deep copy. It's just a convenience class that avoids you having
16  * to pass UT_String::ALWAYS_DEEP to the constructor of the UT_String.
17  *
18  * You should use UT_String with the UT_String::ALWAYS_DEEP parameter
19  * instead of this class whenever possible. However, in templated
20  * code, it might not always be possible.
21  */
22 
23 #ifndef __UT_DeepString_h__
24 #define __UT_DeepString_h__
25 
26 #include "UT_API.h"
27 #include "UT_String.h"
28 
30 {
31 public:
32  UT_DeepString(const char *str = 0)
33  : UT_String(UT_String::ALWAYS_DEEP, str)
34  {}
35 
37  : UT_String(UT_String::ALWAYS_DEEP, str.c_str())
38  {}
39 
41  : UT_String(UT_String::ALWAYS_DEEP, (const char *)str)
42  {}
43 
44  // When we copy construct a UT_String from a UT_DeepString, the UT_String
45  // will always make a deep copy.
47  : UT_String(str)
48  {}
49 
51  {}
52 
54  {
56  return *this;
57  }
58 
60  {
62  return *this;
63  }
64 
65  UT_DeepString &operator=(const char *str)
66  {
68  return *this;
69  }
70 
71  bool operator==(const char *str) const
72  { return UT_String::operator==(str); }
73  bool operator==(const UT_String &str) const
74  { return UT_String::operator==(str); }
75 
76  bool operator!=(const char *str) const
77  { return UT_String::operator!=(str); }
78  bool operator!=(const UT_String &str) const
79  { return UT_String::operator!=(str); }
80 
81  bool operator<(const char *str) const
82  { return UT_String::operator<(str); }
83  bool operator<(const UT_String &str) const
84  { return UT_String::operator<(str); }
85 
86  bool operator<=(const char *str) const
87  { return UT_String::operator<=(str); }
88  bool operator<=(const UT_String &str) const
89  { return UT_String::operator<=(str); }
90 
91  bool operator>(const char *str) const
92  { return UT_String::operator>(str); }
93  bool operator>(const UT_String &str) const
94  { return UT_String::operator>(str); }
95 
96  bool operator>=(const char *str) const
97  { return UT_String::operator>=(str); }
98  bool operator>=(const UT_String &str) const
99  { return UT_String::operator>=(str); }
100 };
101 
102 inline size_t hash_value(const UT_DeepString &str)
103 {
104  return (size_t)str.hash();
105 }
106 
107 
108 #endif
bool operator!=(const char *str) const
Definition: UT_String.h:427
bool operator>=(const UT_String &str) const
Definition: UT_DeepString.h:98
bool operator!=(const UT_String &str) const
Definition: UT_DeepString.h:78
bool operator<(const char *str) const
Definition: UT_DeepString.h:81
UT_DeepString(const UT_DeepString &str)
Definition: UT_DeepString.h:46
bool operator<=(const char *str) const
Definition: UT_String.h:451
GLsizei const GLchar *const * string
Definition: glcorearb.h:814
bool operator==(const char *str) const
Definition: UT_String.h:415
bool operator<=(const UT_String &str) const
Definition: UT_DeepString.h:88
#define UT_API
Definition: UT_API.h:14
bool operator!=(const char *str) const
Definition: UT_DeepString.h:76
bool operator<(const char *str) const
Definition: UT_String.h:439
bool operator>=(const char *str) const
Definition: UT_DeepString.h:96
SYS_FORCE_INLINE uint32 hash() const
Definition: UT_String.h:902
size_t hash_value(const UT_DeepString &str)
bool operator>=(const char *str) const
Definition: UT_String.h:475
UT_String & operator=(UT_String &&str)
Definition: UT_String.h:177
bool operator>(const UT_String &str) const
Definition: UT_DeepString.h:93
UT_DeepString & operator=(const UT_String &str)
Definition: UT_DeepString.h:59
UT_DeepString(const std::string &str)
Definition: UT_DeepString.h:36
bool operator>(const char *str) const
Definition: UT_String.h:463
bool operator==(const UT_String &str) const
Definition: UT_DeepString.h:73
bool operator<(const UT_String &str) const
Definition: UT_DeepString.h:83
UT_DeepString(const char *str=0)
Definition: UT_DeepString.h:32
bool operator<=(const char *str) const
Definition: UT_DeepString.h:86
UT_DeepString & operator=(const char *str)
Definition: UT_DeepString.h:65
UT_DeepString & operator=(const UT_DeepString &str)
Definition: UT_DeepString.h:53
UT_DeepString(const UT_String &str)
Definition: UT_DeepString.h:40
bool operator==(const char *str) const
Definition: UT_DeepString.h:71
bool operator>(const char *str) const
Definition: UT_DeepString.h:91