Changeset 3318 in vbox for trunk/include/VBox/com/ErrorInfo.h
- Timestamp:
- Jun 27, 2007 2:58:18 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/com/ErrorInfo.h
r3044 r3318 187 187 bool isFullAvailable() const { return mIsFullAvailable; } 188 188 189 /** 190 * Returns @c true if both isBasicAvailable() and isFullAvailable() are 191 * @c false. 192 */ 193 bool isNull() const { return !mIsBasicAvailable && !mIsFullAvailable; } 194 189 195 /** 190 196 * Returns the COM result code of the failed operation. … … 242 248 */ 243 249 void print (const char *aPrefix = NULL); 250 251 /** 252 * Resets all collected error information. #isNull() will 253 * return @c true after this method is called. 254 */ 255 void setNull() 256 { 257 mIsBasicAvailable = false; 258 mIsFullAvailable = false; 259 260 mResultCode = S_OK; 261 mInterfaceID.clear(); 262 mComponent.setNull(); 263 mText.setNull(); 264 mNext.reset(); 265 mInterfaceName.setNull(); 266 mCalleeIID.clear(); 267 mCalleeName.setNull(); 268 mErrorInfo.setNull(); 269 } 244 270 245 271 protected: … … 327 353 public: 328 354 329 /** Constructs a new instance that will fetch the current error info. */ 330 ErrorInfoKeeper() : ErrorInfo (false), mForgot (false) 331 { init (true /* aKeepObj */); } 355 /** 356 * Constructs a new instance that will fetch the current error info if 357 * @a aIsNull is @c false (by default) or remain uninitialized (null) 358 * otherwise. 359 * 360 * @param aIsNull @true to prevent fetching error info and leave 361 * the instance uninitialized. 362 */ 363 ErrorInfoKeeper (bool aIsNull = false) 364 : ErrorInfo (false), mForgot (false) 365 { 366 if (!aIsNull) 367 init (true /* aKeepObj */); 368 } 332 369 333 370 /** … … 337 374 ~ErrorInfoKeeper() { if (!mForgot) restore(); } 338 375 376 /** 377 * Tries to (re-)fetch error info set on the current thread. On success, 378 * the previous error information, if any, will be overwritten with the 379 * new error information. On failure, or if there is no error information 380 * available, this instance will be reset to null. 381 */ 382 void fetch() 383 { 384 setNull(); 385 init (true /* aKeepObj */); 386 } 387 339 388 /** 340 389 * Restores error info fetched by the constructor and forgets it … … 349 398 * being restored by #restore() or by the destructor. 350 399 */ 351 void forget() { mForgot = 0; }400 void forget() { mForgot = true; } 352 401 353 402 /** … … 356 405 * stored error info object to the caller. 357 406 */ 358 ComPtr <IUnknown> takeError() { mForgot = 0; return mErrorInfo; }407 ComPtr <IUnknown> takeError() { mForgot = true; return mErrorInfo; } 359 408 360 409 private:
Note:
See TracChangeset
for help on using the changeset viewer.