Changeset 7187 for code/branches
- Timestamp:
- Aug 19, 2010, 2:42:40 AM (14 years ago)
- Location:
- code/branches/consolecommands3/src/libraries
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/consolecommands3/src/libraries/core/Executor.cc
r7186 r7187 43 43 this->functor_ = functor; 44 44 this->name_ = name; 45 46 this->bAddedDefaultValue_[0] = false;47 this->bAddedDefaultValue_[1] = false;48 this->bAddedDefaultValue_[2] = false;49 this->bAddedDefaultValue_[3] = false;50 this->bAddedDefaultValue_[4] = false;51 45 } 52 46 … … 73 67 (*this->functor_)(MultiType(params)); 74 68 } 75 else if ( this->bAddedDefaultValue_[0])69 else if (!this->defaultValue_[0].null()) 76 70 { 77 71 COUT(5) << "Calling Executor " << this->name_ << " through parser with one parameter, using default value: " << this->defaultValue_[0] << std::endl; … … 90 84 for (unsigned int i = tokens.size(); i < this->functor_->getParamCount(); i++) 91 85 { 92 if ( !this->bAddedDefaultValue_[i])86 if (this->defaultValue_[i].null()) 93 87 { 94 88 COUT(2) << "Warning: Can't call executor " << this->name_ << " through parser: Not enough parameters or default values given (input:" << params << ")." << std::endl; … … 156 150 return true; 157 151 } 158 else if ( this->bAddedDefaultValue_[0])152 else if (!this->defaultValue_[0].null()) 159 153 { 160 154 param[0] = this->defaultValue_[0]; … … 171 165 // if there are not enough params given, check if there are default values 172 166 for (unsigned int i = tokens.size(); i < this->functor_->getParamCount(); i++) 173 if ( !this->bAddedDefaultValue_[i])167 if (this->defaultValue_[i].null()) 174 168 return false; 175 169 … … 193 187 { 194 188 this->defaultValue_[0] = param1; 195 this->bAddedDefaultValue_[0] = true;196 189 197 190 return (*this); … … 201 194 { 202 195 this->defaultValue_[0] = param1; 203 this->bAddedDefaultValue_[0] = true; 204 this->defaultValue_[1] = param2; 205 this->bAddedDefaultValue_[1] = true; 196 this->defaultValue_[1] = param2; 206 197 207 198 return (*this); … … 211 202 { 212 203 this->defaultValue_[0] = param1; 213 this->bAddedDefaultValue_[0] = true; 214 this->defaultValue_[1] = param2; 215 this->bAddedDefaultValue_[1] = true; 204 this->defaultValue_[1] = param2; 216 205 this->defaultValue_[2] = param3; 217 this->bAddedDefaultValue_[2] = true;218 206 219 207 return (*this); … … 223 211 { 224 212 this->defaultValue_[0] = param1; 225 this->bAddedDefaultValue_[0] = true; 226 this->defaultValue_[1] = param2; 227 this->bAddedDefaultValue_[1] = true; 213 this->defaultValue_[1] = param2; 228 214 this->defaultValue_[2] = param3; 229 this->bAddedDefaultValue_[2] = true;230 215 this->defaultValue_[3] = param4; 231 this->bAddedDefaultValue_[3] = true;232 216 233 217 return (*this); … … 237 221 { 238 222 this->defaultValue_[0] = param1; 239 this->bAddedDefaultValue_[0] = true; 240 this->defaultValue_[1] = param2; 241 this->bAddedDefaultValue_[1] = true; 223 this->defaultValue_[1] = param2; 242 224 this->defaultValue_[2] = param3; 243 this->bAddedDefaultValue_[2] = true;244 225 this->defaultValue_[3] = param4; 245 this->bAddedDefaultValue_[3] = true;246 226 this->defaultValue_[4] = param5; 247 this->bAddedDefaultValue_[4] = true;248 227 249 228 return (*this); … … 253 232 { 254 233 if (index < MAX_FUNCTOR_ARGUMENTS) 255 {256 234 this->defaultValue_[index] = param; 257 this->bAddedDefaultValue_[index] = true; 258 } 235 259 236 return (*this); 260 237 } … … 263 240 { 264 241 for (unsigned int i = 0; i < this->functor_->getParamCount(); i++) 265 if ( !this->bAddedDefaultValue_[i])242 if (this->defaultValue_[i].null()) 266 243 return false; 267 244 -
code/branches/consolecommands3/src/libraries/core/Executor.h
r7186 r7187 101 101 { 102 102 if (index < MAX_FUNCTOR_ARGUMENTS) 103 return this->bAddedDefaultValue_[index];103 return !this->defaultValue_[index].null(); 104 104 105 105 return false; … … 110 110 std::string name_; 111 111 MultiType defaultValue_[MAX_FUNCTOR_ARGUMENTS]; 112 bool bAddedDefaultValue_[MAX_FUNCTOR_ARGUMENTS];113 112 }; 114 113 -
code/branches/consolecommands3/src/libraries/util/MultiType.h
r7165 r7187 351 351 352 352 /** @brief Checks whether the value is a default one. */ 353 bool hasDefaultValue() const { return this->value_->hasDefaultValue(); } 353 bool hasDefaultValue() const { return this->value_->hasDefaultValue(); } 354 355 /** @brief Checks if the MT contains no value. */ 356 bool null() const { return (!this->value_); } 354 357 355 358 operator char() const;
Note: See TracChangeset
for help on using the changeset viewer.