Changeset 3044 in vbox
- Timestamp:
- Jun 5, 2007 10:37:38 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/com/ErrorInfo.h
r2981 r3044 303 303 * error information while it still needs to make another call before return. 304 304 * 305 * Instead of calling #restore() explicitly you may let the object destructor 306 * do it for you, if you correctly limit the object's lifeime. 307 * 305 308 * The usage pattern is: 306 309 * <code> … … 313 316 * bar->method(); 314 317 * ... 315 * // restore error info from foo to return it to the caller 316 * eik.restore(); 318 * // no need to call #restore() explicitly here because the eik's 319 * // destructor will restore error info fetched after the failed 320 * // call to foo before returning to the caller 317 321 * return rc; 318 322 * } … … 329 333 /** 330 334 * Destroys this instance and automatically calls #restore() which will 331 * either restor rerror info fetched by the constructor or do nothing335 * either restore error info fetched by the constructor or do nothing 332 336 * if #forget() was called before destruction. */ 333 337 ~ErrorInfoKeeper() { if (!mForgot) restore(); } … … 342 346 343 347 /** 344 * Forgets error info fetched by the constructor which preventsit from348 * Forgets error info fetched by the constructor to prevent it from 345 349 * being restored by #restore() or by the destructor. 346 350 */ 347 351 void forget() { mForgot = 0; } 352 353 /** 354 * Forgets error info fetched by the constructor to prevent it from 355 * being restored by #restore() or by the destructor, and returns the 356 * stored error info object to the caller. 357 */ 358 ComPtr <IUnknown> takeError() { mForgot = 0; return mErrorInfo; } 348 359 349 360 private:
Note:
See TracChangeset
for help on using the changeset viewer.