- Timestamp:
- Jan 26, 2007 2:46:16 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 17921
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ProgressImpl.cpp
r351 r357 839 839 const char *aText, ...) 840 840 { 841 va_list args; 842 va_start (args, aText); 843 Bstr text = Utf8StrFmt (aText, args); 844 va_end (args); 845 846 return notifyCompleteBstr (aResultCode, aIID, aComponent, text); 847 } 848 849 /** 850 * Marks the operation as complete and attaches full error info. 851 * See VirtualBoxSupportErrorInfoImpl::setError(HRESULT, const GUID &, const wchar_t *, const char *, ...) 852 * for more info. 853 * 854 * This method is preferred iy you have a ready (translated and formatted) 855 * Bstr string, because it omits an extra conversion Utf8Str -> Bstr. 856 * 857 * @param aResultCode operation result (error) code, must not be S_OK 858 * @param aIID IID of the intrface that defines the error 859 * @param aComponent name of the component that generates the error 860 * @param aText error message (must not be null) 861 */ 862 HRESULT Progress::notifyCompleteBstr (HRESULT aResultCode, const GUID &aIID, 863 const Bstr &aComponent, const Bstr &aText) 864 { 841 865 AutoLock lock (this); 842 866 AssertReturn (isReady(), E_UNEXPECTED); … … 852 876 if (SUCCEEDED (rc)) 853 877 { 854 va_list args; 855 va_start (args, aText); 856 Bstr bstrText = Utf8StrFmt (aText, args); 857 va_end (args); 858 errorInfo->init (aResultCode, aIID, aComponent, bstrText); 878 errorInfo->init (aResultCode, aIID, aComponent, aText); 859 879 errorInfo.queryInterfaceTo (mErrorInfo.asOutParam()); 860 880 } -
trunk/src/VBox/Main/include/ProgressImpl.h
r1 r357 182 182 const Bstr &aComponent, 183 183 const char *aText, ...); 184 HRESULT notifyCompleteBstr (HRESULT aResultCode, const GUID &aIID, 185 const Bstr &aComponent, const Bstr &aText); 184 186 185 187 private: -
trunk/src/VBox/Main/include/VirtualBoxBase.h
r1 r357 1214 1214 * 1215 1215 * See #setError (HRESULT, const GUID &, const wchar_t *, const char *text, ...) 1216 * for details. 1217 * 1218 * This method is the most common (and convenient) way to set error 1219 * information from within interface methods. A typical pattern of usage 1220 * is looks like this: 1221 * 1222 * <code> 1223 * return setErrorV (E_FAIL, pszFormat, args); 1224 * </code> 1225 * or 1226 * <code> 1227 * HRESULT rc = setErrorV (E_FAIL, pszFormat, args); 1228 * ... 1229 * return rc; 1230 * </code> 1216 * and #setError (HRESULT, const char *, ...) for details. 1231 1217 */ 1232 1218 inline static HRESULT setErrorV (HRESULT resultCode, const char *text, va_list args) … … 1234 1220 HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setError ( 1235 1221 resultCode, COM_IIDOF(I), C::getComponentName(), text, args); 1222 return rc; 1223 } 1224 1225 /** 1226 * Sets the error information for the current thread, BStr variant. 1227 * A convenience method that automatically sets the default interface 1228 * ID (taken from the I template argument) and the component name 1229 * (a value of C::getComponentName()). 1230 * 1231 * This method is preferred iy you have a ready (translated and formatted) 1232 * Bstr string, because it omits an extra conversion Utf8Str -> Bstr. 1233 * 1234 * See #setError (HRESULT, const GUID &, const wchar_t *, const char *text, ...) 1235 * and #setError (HRESULT, const char *, ...) for details. 1236 */ 1237 inline static HRESULT setErrorBstr (HRESULT resultCode, const Bstr &text) 1238 { 1239 HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setError ( 1240 resultCode, COM_IIDOF(I), C::getComponentName(), text); 1236 1241 return rc; 1237 1242 }
Note:
See TracChangeset
for help on using the changeset viewer.