Changeset 6693 in orxonox.OLD for branches/network/src/lib/util
- Timestamp:
- Jan 25, 2006, 2:19:46 PM (19 years ago)
- Location:
- branches/network/src/lib/util
- Files:
-
- 4 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/util/executor/executor.cc
r6222 r6693 60 60 { 61 61 int type = va_arg(parameterList, int); 62 this->defaultValue[i].setType( type);62 this->defaultValue[i].setType((MT_Type)type); 63 63 } 64 64 } -
branches/network/src/lib/util/multi_type.cc
r5660 r6693 122 122 123 123 /** 124 * @brief checks if the two Multitypes match 125 * @param mt MultiType to check against this one 126 * @returns true on match. false otherwise 127 * 128 * Two MultiType match if and only if 129 * 1. the internal Type is the same 130 * 2. the stored values match 131 */ 132 bool MultiType::operator==(const MultiType& mt) const 133 { 134 if (this->type != mt.type) 135 return false; 136 137 switch (this->type) 138 { 139 case MT_NULL: 140 return true; 141 case MT_BOOL: 142 return (this->value.Bool == mt.value.Bool); 143 case MT_INT: 144 return (this->value.Int == mt.value.Int); 145 case MT_CHAR: 146 return (this->value.Char == mt.value.Char); 147 case MT_FLOAT: 148 return (this->value.Float == mt.value.Float); 149 case MT_STRING: 150 if (this->value.String != NULL && mt.value.String != NULL) 151 return (!strcmp(this->value.String, mt.value.String)); 152 else 153 return (this->value.String == NULL && mt.value.String == NULL); 154 } 155 } 156 157 /** 158 * @brief checks if the internal value matches the boolean value. 159 * @param value to check against this one 160 * @returns true on match. false otherwise 161 * 162 * Two MultiType match if and only if 163 * 1. the stored values match the given Value 164 */ 165 bool MultiType::operator==(const char* value) const 166 { 167 if (this->value.String != NULL && value != NULL) 168 return (!strcmp(this->value.String, value)); 169 else 170 return (this->value.String == NULL && value == NULL); 171 } 172 173 174 /** 124 175 * initializes the MultiType 125 176 */ … … 136 187 * @param type the new Type 137 188 */ 138 void MultiType::setType( inttype)189 void MultiType::setType(MT_Type type) 139 190 { 140 191 if (this->type != type) 141 this->type = (MT_Type)type;192 this->type = type; 142 193 } 143 194 -
branches/network/src/lib/util/multi_type.h
r5659 r6693 31 31 */ 32 32 class MultiType { 33 34 33 public: 35 34 MultiType(); … … 42 41 virtual ~MultiType(); 43 42 44 MultiType& operator= (const MultiType& mt); 43 MultiType& operator=(const MultiType& mt); 44 MultiType& operator=(bool value) { this->setBool(value); return *this; }; 45 MultiType& operator=(int value) { this->setInt(value); return *this; }; 46 MultiType& operator=(float value) { this->setFloat(value); return *this; }; 47 MultiType& operator=(char value) { this->setChar(value); return *this; }; 48 MultiType& operator=(const char* value) { this->setString(value); return *this; }; 45 49 46 void setType(int type); 50 bool operator==(const MultiType& mt) const; 51 bool operator==(bool value) const { return (this->getBool() == value); }; 52 bool operator==(int value) const { return (this->getInt() == value); }; 53 bool operator==(float value) const { return (this->getFloat() == value); }; 54 bool operator==(char value) const { return (this->getChar() == value); }; 55 bool operator==(const char* value) const; 56 bool operator==(MT_Type type) const { return (this->type == type); } 57 bool operator!=(MT_Type type) const { return (this->type != type); } 58 59 void setType(MT_Type type); 47 60 48 61 void setBool(bool value); … … 52 65 void setString(const char* value); 53 66 67 // for your convenience. 54 68 inline void setValue(bool value) { this->setBool(value); }; 55 69 inline void setValue(int value) { this->setInt(value); }; … … 81 95 82 96 private: 83 84 97 union MultiTypeValue 85 98 { -
branches/network/src/lib/util/substring.h
r5656 r6693 16 16 ~SubString(); 17 17 18 const char* operator[](unsigned int i) { return this->getString(i); }; 19 18 20 inline unsigned int getCount() { return this->splittersCount; }; 19 21 const char* getString(unsigned int i);
Note: See TracChangeset
for help on using the changeset viewer.