1 | /** @file
|
---|
2 | *
|
---|
3 | * VirtualBoxErrorInfo COM classe implementation
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006 InnoTek Systemberatung GmbH
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License as published by the Free Software Foundation,
|
---|
13 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * If you received this file as part of a commercial VirtualBox
|
---|
18 | * distribution, then only the terms of your commercial VirtualBox
|
---|
19 | * license agreement apply instead of the previous paragraph.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #include "VirtualBoxErrorInfoImpl.h"
|
---|
23 | #include "Logging.h"
|
---|
24 |
|
---|
25 | // public initializer/uninitializer for internal purposes only
|
---|
26 | ////////////////////////////////////////////////////////////////////////////////
|
---|
27 |
|
---|
28 | void VirtualBoxErrorInfo::init (HRESULT aResultCode, const GUID &aIID,
|
---|
29 | const BSTR aComponent, const BSTR aText,
|
---|
30 | IVirtualBoxErrorInfo *aNext)
|
---|
31 | {
|
---|
32 | mResultCode = aResultCode;
|
---|
33 | mIID = aIID;
|
---|
34 | mComponent = aComponent;
|
---|
35 | mText = aText;
|
---|
36 | mNext = aNext;
|
---|
37 | }
|
---|
38 |
|
---|
39 | // IVirtualBoxErrorInfo properties
|
---|
40 | ////////////////////////////////////////////////////////////////////////////////
|
---|
41 |
|
---|
42 | STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(ResultCode) (HRESULT *aResultCode)
|
---|
43 | {
|
---|
44 | if (!aResultCode)
|
---|
45 | return E_POINTER;
|
---|
46 |
|
---|
47 | *aResultCode = mResultCode;
|
---|
48 | return S_OK;
|
---|
49 | }
|
---|
50 |
|
---|
51 | STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(InterfaceID) (GUIDPARAMOUT aIID)
|
---|
52 | {
|
---|
53 | if (!aIID)
|
---|
54 | return E_POINTER;
|
---|
55 |
|
---|
56 | mIID.cloneTo (aIID);
|
---|
57 | return S_OK;
|
---|
58 | }
|
---|
59 |
|
---|
60 | STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(Component) (BSTR *aComponent)
|
---|
61 | {
|
---|
62 | if (!aComponent)
|
---|
63 | return E_POINTER;
|
---|
64 |
|
---|
65 | mComponent.cloneTo (aComponent);
|
---|
66 | return S_OK;
|
---|
67 | }
|
---|
68 |
|
---|
69 | STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(Text) (BSTR *aText)
|
---|
70 | {
|
---|
71 | if (!aText)
|
---|
72 | return E_POINTER;
|
---|
73 |
|
---|
74 | mText.cloneTo (aText);
|
---|
75 | return S_OK;
|
---|
76 | }
|
---|
77 |
|
---|
78 | STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(Next) (IVirtualBoxErrorInfo **aNext)
|
---|
79 | {
|
---|
80 | if (!aNext)
|
---|
81 | return E_POINTER;
|
---|
82 |
|
---|
83 | /* this will set aNext to NULL if mNext is null */
|
---|
84 | return mNext.queryInterfaceTo (aNext);
|
---|
85 | }
|
---|
86 |
|
---|
87 | #if defined (__WIN__)
|
---|
88 |
|
---|
89 | // IErrorInfo methods
|
---|
90 | ////////////////////////////////////////////////////////////////////////////////
|
---|
91 |
|
---|
92 | STDMETHODIMP VirtualBoxErrorInfo::GetDescription (BSTR *description)
|
---|
93 | {
|
---|
94 | return COMGETTER(Text) (description);
|
---|
95 | }
|
---|
96 |
|
---|
97 | STDMETHODIMP VirtualBoxErrorInfo::GetGUID (GUID *guid)
|
---|
98 | {
|
---|
99 | return COMGETTER(InterfaceID) (guid);
|
---|
100 | }
|
---|
101 |
|
---|
102 | STDMETHODIMP VirtualBoxErrorInfo::GetHelpContext (DWORD *pdwHelpContext)
|
---|
103 | {
|
---|
104 | return E_NOTIMPL;
|
---|
105 | }
|
---|
106 |
|
---|
107 | STDMETHODIMP VirtualBoxErrorInfo::GetHelpFile (BSTR *pbstrHelpFile)
|
---|
108 | {
|
---|
109 | return E_NOTIMPL;
|
---|
110 | }
|
---|
111 |
|
---|
112 | STDMETHODIMP VirtualBoxErrorInfo::GetSource (BSTR *source)
|
---|
113 | {
|
---|
114 | return COMGETTER(Component) (source);
|
---|
115 | }
|
---|
116 |
|
---|
117 | #else // !defined (__WIN__)
|
---|
118 |
|
---|
119 | // nsIException methods
|
---|
120 | ////////////////////////////////////////////////////////////////////////////////
|
---|
121 |
|
---|
122 | /* readonly attribute string message; */
|
---|
123 | NS_IMETHODIMP VirtualBoxErrorInfo::GetMessage (char **aMessage)
|
---|
124 | {
|
---|
125 | if (!aMessage)
|
---|
126 | return NS_ERROR_INVALID_POINTER;
|
---|
127 |
|
---|
128 | Utf8Str (mText).cloneTo (aMessage);
|
---|
129 | return S_OK;
|
---|
130 | }
|
---|
131 |
|
---|
132 | /* readonly attribute nsresult result; */
|
---|
133 | NS_IMETHODIMP VirtualBoxErrorInfo::GetResult (nsresult *aResult)
|
---|
134 | {
|
---|
135 | return COMGETTER(ResultCode) (aResult);
|
---|
136 | }
|
---|
137 |
|
---|
138 | /* readonly attribute string name; */
|
---|
139 | NS_IMETHODIMP VirtualBoxErrorInfo::GetName (char **aName)
|
---|
140 | {
|
---|
141 | return NS_ERROR_NOT_IMPLEMENTED;
|
---|
142 | }
|
---|
143 |
|
---|
144 | /* readonly attribute string filename; */
|
---|
145 | NS_IMETHODIMP VirtualBoxErrorInfo::GetFilename (char **aFilename)
|
---|
146 | {
|
---|
147 | return NS_ERROR_NOT_IMPLEMENTED;
|
---|
148 | }
|
---|
149 |
|
---|
150 | /* readonly attribute PRUint32 lineNumber; */
|
---|
151 | NS_IMETHODIMP VirtualBoxErrorInfo::GetLineNumber (PRUint32 *aLineNumber)
|
---|
152 | {
|
---|
153 | return NS_ERROR_NOT_IMPLEMENTED;
|
---|
154 | }
|
---|
155 |
|
---|
156 | /* readonly attribute PRUint32 columnNumber; */
|
---|
157 | NS_IMETHODIMP VirtualBoxErrorInfo::GetColumnNumber (PRUint32 *aColumnNumber)
|
---|
158 | {
|
---|
159 | return NS_ERROR_NOT_IMPLEMENTED;
|
---|
160 | }
|
---|
161 |
|
---|
162 | /* readonly attribute nsIStackFrame location; */
|
---|
163 | NS_IMETHODIMP VirtualBoxErrorInfo::GetLocation (nsIStackFrame **aLocation)
|
---|
164 | {
|
---|
165 | return NS_ERROR_NOT_IMPLEMENTED;
|
---|
166 | }
|
---|
167 |
|
---|
168 | /* readonly attribute nsIException inner; */
|
---|
169 | NS_IMETHODIMP VirtualBoxErrorInfo::GetInner (nsIException **aInner)
|
---|
170 | {
|
---|
171 | ComPtr <IVirtualBoxErrorInfo> info;
|
---|
172 | nsresult rv = COMGETTER(Next) (info.asOutParam());
|
---|
173 | CheckComRCReturnRC (rv);
|
---|
174 | return info.queryInterfaceTo (aInner);
|
---|
175 | }
|
---|
176 |
|
---|
177 | /* readonly attribute nsISupports data; */
|
---|
178 | NS_IMETHODIMP VirtualBoxErrorInfo::GetData (nsISupports **aData)
|
---|
179 | {
|
---|
180 | return NS_ERROR_NOT_IMPLEMENTED;
|
---|
181 | }
|
---|
182 |
|
---|
183 | /* string toString (); */
|
---|
184 | NS_IMETHODIMP VirtualBoxErrorInfo::ToString (char **_retval)
|
---|
185 | {
|
---|
186 | return NS_ERROR_NOT_IMPLEMENTED;
|
---|
187 | }
|
---|
188 |
|
---|
189 | NS_IMPL_THREADSAFE_ISUPPORTS2 (VirtualBoxErrorInfo,
|
---|
190 | nsIException, IVirtualBoxErrorInfo)
|
---|
191 |
|
---|
192 | #endif
|
---|
193 |
|
---|