VirtualBox

source: vbox/trunk/include/VBox/com/VirtualBoxErrorInfo.h@ 21783

Last change on this file since 21783 was 21783, checked in by vboxsync, 15 years ago

API: make IVirtualBoxErrorInfo available via the webservice, and eliminate the last use of the "uuid" type.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.7 KB
Line 
1/* $Id: VirtualBoxErrorInfo.h 21783 2009-07-24 11:44:32Z vboxsync $ */
2
3/** @file
4 * MS COM / XPCOM Abstraction Layer:
5 * VirtualBoxErrorInfo COM class declaration
6 */
7
8/*
9 * Copyright (C) 2008 Sun Microsystems, Inc.
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 *
19 * The contents of this file may alternatively be used under the terms
20 * of the Common Development and Distribution License Version 1.0
21 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
22 * VirtualBox OSE distribution, in which case the provisions of the
23 * CDDL are applicable instead of those of the GPL.
24 *
25 * You may elect to license modified versions of this file under the
26 * terms and conditions of either the GPL or the CDDL or both.
27 *
28 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
29 * Clara, CA 95054 USA or visit http://www.sun.com if you need
30 * additional information or have any questions.
31 */
32
33#ifndef ___VBox_com_VirtualBoxErrorInfo_h
34#define ___VBox_com_VirtualBoxErrorInfo_h
35
36#include "VBox/com/defs.h"
37#include "VBox/com/string.h"
38#include "VBox/com/ptr.h"
39#include "VBox/com/Guid.h"
40
41/// @todo this is for IVirtualBoxErrorInfo, see the @todo below.
42#include "VBox/com/VirtualBox.h"
43
44namespace com
45{
46
47/**
48 * The VirtualBoxErrorInfo class implements the IVirtualBoxErrorInfo interface
49 * that provides extended error information about interface/component method
50 * invocation.
51 *
52 * @todo Rename IVirtualBoxErrorInfo/VirtualBoxErrorInfo to something like
53 * IExtendedErrorInfo since it's not actually VirtualBox-dependent any
54 * more. This will also require to create IExtendedErrorInfo.idl/h etc to
55 * let adding this class to custom type libraries.
56 */
57class ATL_NO_VTABLE VirtualBoxErrorInfo
58#if !defined (VBOX_WITH_XPCOM)
59 : public CComObjectRootEx <CComMultiThreadModel>
60#else
61 : public CComObjectRootEx
62#endif
63 , public IVirtualBoxErrorInfo
64{
65public:
66
67 DECLARE_NOT_AGGREGATABLE (VirtualBoxErrorInfo)
68
69 DECLARE_PROTECT_FINAL_CONSTRUCT()
70
71 BEGIN_COM_MAP (VirtualBoxErrorInfo)
72 COM_INTERFACE_ENTRY (IErrorInfo)
73 COM_INTERFACE_ENTRY (IVirtualBoxErrorInfo)
74 END_COM_MAP()
75
76 NS_DECL_ISUPPORTS
77
78 VirtualBoxErrorInfo() : mResultCode (S_OK) {}
79
80 // public initializer/uninitializer for internal purposes only
81
82 HRESULT init (HRESULT aResultCode, const GUID *aIID,
83 const char *aComponent, const char *aText,
84 IVirtualBoxErrorInfo *aNext = NULL);
85
86 // IVirtualBoxErrorInfo properties
87 STDMETHOD(COMGETTER(ResultCode)) (LONG *aResultCode);
88 STDMETHOD(COMGETTER(InterfaceID)) (BSTR *aIID);
89 STDMETHOD(COMGETTER(Component)) (BSTR *aComponent);
90 STDMETHOD(COMGETTER(Text)) (BSTR *aText);
91 STDMETHOD(COMGETTER(Next)) (IVirtualBoxErrorInfo **aNext);
92
93#if !defined (VBOX_WITH_XPCOM)
94
95 HRESULT init (IErrorInfo *aInfo);
96
97 STDMETHOD(GetGUID) (GUID *guid);
98 STDMETHOD(GetSource) (BSTR *source);
99 STDMETHOD(GetDescription) (BSTR *description);
100 STDMETHOD(GetHelpFile) (BSTR *pBstrHelpFile);
101 STDMETHOD(GetHelpContext) (DWORD *pdwHelpContext);
102
103#else /* !defined (VBOX_WITH_XPCOM) */
104
105 HRESULT init (nsIException *aInfo);
106
107 NS_DECL_NSIEXCEPTION
108#endif
109
110private:
111
112 HRESULT mResultCode;
113 Bstr mText;
114 Guid mIID;
115 Bstr mComponent;
116 ComPtr <IVirtualBoxErrorInfo> mNext;
117};
118
119/**
120 * The VirtualBoxErrorInfoGlue class glues two IVirtualBoxErrorInfo chains by
121 * attaching the head of the second chain to the tail of the first one.
122 *
123 * This is done by wrapping around each member of the first chain and
124 * substituting the next attribute implementation.
125 */
126class ATL_NO_VTABLE VirtualBoxErrorInfoGlue
127#if !defined (VBOX_WITH_XPCOM)
128 : public CComObjectRootEx <CComMultiThreadModel>
129#else
130 : public CComObjectRootEx
131#endif
132 , public IVirtualBoxErrorInfo
133{
134public:
135
136 DECLARE_NOT_AGGREGATABLE (VirtualBoxErrorInfoGlue)
137
138 DECLARE_PROTECT_FINAL_CONSTRUCT()
139
140 BEGIN_COM_MAP (VirtualBoxErrorInfoGlue)
141 COM_INTERFACE_ENTRY (IErrorInfo)
142 COM_INTERFACE_ENTRY (IVirtualBoxErrorInfo)
143 END_COM_MAP()
144
145 NS_DECL_ISUPPORTS
146
147 VirtualBoxErrorInfoGlue() {}
148
149 // public initializer/uninitializer for internal purposes only
150
151 HRESULT init (IVirtualBoxErrorInfo *aReal, IVirtualBoxErrorInfo *aNext);
152
153protected:
154
155 HRESULT protectedInit (IVirtualBoxErrorInfo *aReal, IVirtualBoxErrorInfo *aNext);
156
157private:
158
159 // IVirtualBoxErrorInfo properties
160 COM_FORWARD_IVirtualBoxErrorInfo_GETTER_ResultCode_TO_OBJ (mReal)
161 COM_FORWARD_IVirtualBoxErrorInfo_GETTER_InterfaceID_TO_OBJ (mReal)
162 COM_FORWARD_IVirtualBoxErrorInfo_GETTER_Component_TO_OBJ (mReal)
163 COM_FORWARD_IVirtualBoxErrorInfo_GETTER_Text_TO_OBJ (mReal)
164 STDMETHOD(COMGETTER(Next)) (IVirtualBoxErrorInfo **aNext);
165
166#if !defined (VBOX_WITH_XPCOM)
167
168 STDMETHOD(GetGUID) (GUID *guid) { return mReal->GetGUID (guid); }
169 STDMETHOD(GetSource) (BSTR *source) { return mReal->GetSource (source); }
170 STDMETHOD(GetDescription) (BSTR *description) { return mReal->GetDescription (description); }
171 STDMETHOD(GetHelpFile) (BSTR *pBstrHelpFile) { return mReal->GetHelpFile (pBstrHelpFile); }
172 STDMETHOD(GetHelpContext) (DWORD *pdwHelpContext) { return mReal->GetHelpContext (pdwHelpContext); }
173
174#else /* !defined (VBOX_WITH_XPCOM) */
175
176 NS_FORWARD_NSIEXCEPTION (mReal->)
177
178#endif
179
180private:
181
182 ComPtr <IVirtualBoxErrorInfo> mReal;
183 ComPtr <IVirtualBoxErrorInfo> mNext;
184};
185
186} /* namespace com */
187
188#endif /* ___VBox_com_VirtualBoxErrorInfo_h */
189
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette