00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Luke Moore 00008 * Side Effects Software Inc 00009 * 477 Richmond Street West 00010 * Toronto, Ontario 00011 * Canada M5V 3E7 00012 * 416-504-9876 00013 * 00014 * NAME: UT_DeepString.h 00015 * 00016 * COMMENTS: 00017 * A UT_DeepString is a UT_String that always stores a deep copy its 00018 * data. This way you can return strings by value and you can have string 00019 * member variables without having to define your own copy constructor and 00020 * assignment operator. 00021 * 00022 * Note that a UT_DeepString is just a UT_String that always stores 00023 * a deep copy. It's just a convenience class that avoids you having 00024 * to pass UT_String::ALWAYS_DEEP to the constructor of the UT_String. 00025 * 00026 * You should use UT_String with the UT_String::ALWAYS_DEEP parameter 00027 * instead of this class whenever possible. However, in templated 00028 * code, it might not always be possible. 00029 */ 00030 00031 #ifndef __UT_DeepString_h__ 00032 #define __UT_DeepString_h__ 00033 00034 #include "UT_API.h" 00035 #include "UT_String.h" 00036 00037 class UT_API UT_DeepString : public UT_String 00038 { 00039 public: 00040 UT_DeepString(const char *str = 0) 00041 : UT_String(UT_String::ALWAYS_DEEP, str) 00042 {} 00043 00044 UT_DeepString(const UT_String &str) 00045 : UT_String(UT_String::ALWAYS_DEEP, (const char *)str) 00046 {} 00047 00048 // When we copy construct a UT_String from a UT_DeepString, the UT_String 00049 // will always make a deep copy. 00050 UT_DeepString(const UT_DeepString &str) 00051 : UT_String(str) 00052 {} 00053 00054 ~UT_DeepString() 00055 {} 00056 00057 UT_DeepString &operator=(const UT_DeepString &str) 00058 { 00059 UT_String::operator=(str); 00060 return *this; 00061 } 00062 00063 UT_DeepString &operator=(const UT_String &str) 00064 { 00065 UT_String::operator=(str); 00066 return *this; 00067 } 00068 00069 UT_DeepString &operator=(const char *str) 00070 { 00071 UT_String::operator=(str); 00072 return *this; 00073 } 00074 00075 unsigned operator==(const char *str) const 00076 { return UT_String::operator==(str); } 00077 unsigned operator==(const UT_String &str) const 00078 { return UT_String::operator==(str); } 00079 00080 unsigned operator!=(const char *str) const 00081 { return UT_String::operator!=(str); } 00082 unsigned operator!=(const UT_String &str) const 00083 { return UT_String::operator!=(str); } 00084 00085 unsigned operator<(const char *str) const 00086 { return UT_String::operator<(str); } 00087 unsigned operator<(const UT_String &str) const 00088 { return UT_String::operator<(str); } 00089 00090 unsigned operator<=(const char *str) const 00091 { return UT_String::operator<=(str); } 00092 unsigned operator<=(const UT_String &str) const 00093 { return UT_String::operator<=(str); } 00094 00095 unsigned operator>(const char *str) const 00096 { return UT_String::operator>(str); } 00097 unsigned operator>(const UT_String &str) const 00098 { return UT_String::operator>(str); } 00099 00100 unsigned operator>=(const char *str) const 00101 { return UT_String::operator>=(str); } 00102 unsigned operator>=(const UT_String &str) const 00103 { return UT_String::operator>=(str); } 00104 }; 00105 00106 #endif
1.5.9