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 resultCode, const GUID &iid,
|
---|
29 | const BSTR component, const BSTR text)
|
---|
30 | {
|
---|
31 | mResultCode = resultCode;
|
---|
32 | mIID = iid;
|
---|
33 | mComponent = component;
|
---|
34 | mText = text;
|
---|
35 | }
|
---|
36 |
|
---|
37 | // IVirtualBoxErrorInfo properties
|
---|
38 | ////////////////////////////////////////////////////////////////////////////////
|
---|
39 |
|
---|
40 | STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(ResultCode) (HRESULT *resultCode)
|
---|
41 | {
|
---|
42 | if (!resultCode)
|
---|
43 | return E_POINTER;
|
---|
44 |
|
---|
45 | *resultCode = mResultCode;
|
---|
46 | return S_OK;
|
---|
47 | }
|
---|
48 |
|
---|
49 | STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(InterfaceID) (GUIDPARAMOUT iid)
|
---|
50 | {
|
---|
51 | if (!iid)
|
---|
52 | return E_POINTER;
|
---|
53 |
|
---|
54 | mIID.cloneTo (iid);
|
---|
55 | return S_OK;
|
---|
56 | }
|
---|
57 |
|
---|
58 | STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(Component) (BSTR *component)
|
---|
59 | {
|
---|
60 | if (!component)
|
---|
61 | return E_POINTER;
|
---|
62 |
|
---|
63 | mComponent.cloneTo (component);
|
---|
64 | return S_OK;
|
---|
65 | }
|
---|
66 |
|
---|
67 | STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(Text) (BSTR *text)
|
---|
68 | {
|
---|
69 | if (!text)
|
---|
70 | return E_POINTER;
|
---|
71 |
|
---|
72 | mText.cloneTo (text);
|
---|
73 | return S_OK;
|
---|
74 | }
|
---|
75 |
|
---|
76 | #if defined (__WIN__)
|
---|
77 |
|
---|
78 | // IErrorInfo methods
|
---|
79 | ////////////////////////////////////////////////////////////////////////////////
|
---|
80 |
|
---|
81 | STDMETHODIMP VirtualBoxErrorInfo::GetDescription (BSTR *description)
|
---|
82 | {
|
---|
83 | return COMGETTER(Text) (description);
|
---|
84 | }
|
---|
85 |
|
---|
86 | STDMETHODIMP VirtualBoxErrorInfo::GetGUID (GUID *guid)
|
---|
87 | {
|
---|
88 | return COMGETTER(InterfaceID) (guid);
|
---|
89 | }
|
---|
90 |
|
---|
91 | STDMETHODIMP VirtualBoxErrorInfo::GetHelpContext (DWORD *pdwHelpContext)
|
---|
92 | {
|
---|
93 | return E_NOTIMPL;
|
---|
94 | }
|
---|
95 |
|
---|
96 | STDMETHODIMP VirtualBoxErrorInfo::GetHelpFile (BSTR *pbstrHelpFile)
|
---|
97 | {
|
---|
98 | return E_NOTIMPL;
|
---|
99 | }
|
---|
100 |
|
---|
101 | STDMETHODIMP VirtualBoxErrorInfo::GetSource (BSTR *source)
|
---|
102 | {
|
---|
103 | return COMGETTER(Component) (source);
|
---|
104 | }
|
---|
105 |
|
---|
106 | #else // !defined (__WIN__)
|
---|
107 |
|
---|
108 | // nsIException methods
|
---|
109 | ////////////////////////////////////////////////////////////////////////////////
|
---|
110 |
|
---|
111 | /* readonly attribute string message; */
|
---|
112 | NS_IMETHODIMP VirtualBoxErrorInfo::GetMessage (char **aMessage)
|
---|
113 | {
|
---|
114 | if (!aMessage)
|
---|
115 | return NS_ERROR_INVALID_POINTER;
|
---|
116 |
|
---|
117 | Utf8Str (mText).cloneTo (aMessage);
|
---|
118 | return S_OK;
|
---|
119 | }
|
---|
120 |
|
---|
121 | /* readonly attribute nsresult result; */
|
---|
122 | NS_IMETHODIMP VirtualBoxErrorInfo::GetResult (nsresult *aResult)
|
---|
123 | {
|
---|
124 | return COMGETTER(ResultCode) (aResult);
|
---|
125 | }
|
---|
126 |
|
---|
127 | /* readonly attribute string name; */
|
---|
128 | NS_IMETHODIMP VirtualBoxErrorInfo::GetName (char **aName)
|
---|
129 | {
|
---|
130 | return NS_ERROR_NOT_IMPLEMENTED;
|
---|
131 | }
|
---|
132 |
|
---|
133 | /* readonly attribute string filename; */
|
---|
134 | NS_IMETHODIMP VirtualBoxErrorInfo::GetFilename (char **aFilename)
|
---|
135 | {
|
---|
136 | return NS_ERROR_NOT_IMPLEMENTED;
|
---|
137 | }
|
---|
138 |
|
---|
139 | /* readonly attribute PRUint32 lineNumber; */
|
---|
140 | NS_IMETHODIMP VirtualBoxErrorInfo::GetLineNumber (PRUint32 *aLineNumber)
|
---|
141 | {
|
---|
142 | return NS_ERROR_NOT_IMPLEMENTED;
|
---|
143 | }
|
---|
144 |
|
---|
145 | /* readonly attribute PRUint32 columnNumber; */
|
---|
146 | NS_IMETHODIMP VirtualBoxErrorInfo::GetColumnNumber (PRUint32 *aColumnNumber)
|
---|
147 | {
|
---|
148 | return NS_ERROR_NOT_IMPLEMENTED;
|
---|
149 | }
|
---|
150 |
|
---|
151 | /* readonly attribute nsIStackFrame location; */
|
---|
152 | NS_IMETHODIMP VirtualBoxErrorInfo::GetLocation (nsIStackFrame **aLocation)
|
---|
153 | {
|
---|
154 | return NS_ERROR_NOT_IMPLEMENTED;
|
---|
155 | }
|
---|
156 |
|
---|
157 | /* readonly attribute nsIException inner; */
|
---|
158 | NS_IMETHODIMP VirtualBoxErrorInfo::GetInner (nsIException **aInner)
|
---|
159 | {
|
---|
160 | return NS_ERROR_NOT_IMPLEMENTED;
|
---|
161 | }
|
---|
162 |
|
---|
163 | /* readonly attribute nsISupports data; */
|
---|
164 | NS_IMETHODIMP VirtualBoxErrorInfo::GetData (nsISupports **aData)
|
---|
165 | {
|
---|
166 | return NS_ERROR_NOT_IMPLEMENTED;
|
---|
167 | }
|
---|
168 |
|
---|
169 | /* string toString (); */
|
---|
170 | NS_IMETHODIMP VirtualBoxErrorInfo::ToString (char **_retval)
|
---|
171 | {
|
---|
172 | return NS_ERROR_NOT_IMPLEMENTED;
|
---|
173 | }
|
---|
174 |
|
---|
175 | NS_IMPL_THREADSAFE_ISUPPORTS2 (VirtualBoxErrorInfo,
|
---|
176 | nsIException, IVirtualBoxErrorInfo)
|
---|
177 |
|
---|
178 | #endif
|
---|
179 |
|
---|