2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
26 Copyright (c) 1999-2003, Apple, Inc. All rights reserved.
29 #if !defined(__COREFOUNDATION_CFPLUGINCOM__)
30 #define __COREFOUNDATION_CFPLUGINCOM__ 1
32 #include <CoreFoundation/CFPlugIn.h>
34 #if defined(__cplusplus)
38 /* ================= IUnknown definition (C struct) ================= */
40 /* All interface structs must have an IUnknownStruct at the beginning. */
41 /* The _reserved field is part of the Microsoft COM binary standard on Macintosh. */
42 /* You can declare new C struct interfaces by defining a new struct that includes "IUNKNOWN_C_GUTS;" before the first field of the struct. */
44 typedef SInt32 HRESULT
;
47 typedef CFUUIDBytes REFIID
;
49 #define SUCCEEDED(Status) ((HRESULT)(Status) >= 0)
50 #define FAILED(Status) ((HRESULT)(Status)<0)
52 /* Macros for more detailed HRESULT analysis */
53 #define IS_ERROR(Status) ((unsigned long)(Status) >> 31 == SEVERITY_ERROR)
54 #define HRESULT_CODE(hr) ((hr) & 0xFFFF)
55 #define HRESULT_FACILITY(hr) (((hr) >> 16) & 0x1fff)
56 #define HRESULT_SEVERITY(hr) (((hr) >> 31) & 0x1)
57 #define SEVERITY_SUCCESS 0
58 #define SEVERITY_ERROR 1
60 /* Creating an HRESULT from its component pieces */
61 #define MAKE_HRESULT(sev,fac,code) ((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) )
63 /* Pre-defined success HRESULTS */
64 #define S_OK ((HRESULT)0x00000000L)
65 #define S_FALSE ((HRESULT)0x00000001L)
67 /* Common error HRESULTS */
68 #define E_UNEXPECTED ((HRESULT)0x8000FFFFL)
69 #define E_NOTIMPL ((HRESULT)0x80000001L)
70 #define E_OUTOFMEMORY ((HRESULT)0x80000002L)
71 #define E_INVALIDARG ((HRESULT)0x80000003L)
72 #define E_NOINTERFACE ((HRESULT)0x80000004L)
73 #define E_POINTER ((HRESULT)0x80000005L)
74 #define E_HANDLE ((HRESULT)0x80000006L)
75 #define E_ABORT ((HRESULT)0x80000007L)
76 #define E_FAIL ((HRESULT)0x80000008L)
77 #define E_ACCESSDENIED ((HRESULT)0x80000009L)
79 /* This macro should be used when defining all interface functions (as it is for the IUnknown functions below). */
80 #define STDMETHODCALLTYPE
82 /* The __RPC_FAR macro is for COM source compatibility only. This macro is used a lot in COM interface definitions. If your CFPlugIn interfaces need to be COM interfaces as well, you can use this macro to get better source compatibility. It is not used in the IUnknown definition below, because when doing COM, you will be using the Microsoft supplied IUnknown interface anyway. */
85 /* The IUnknown interface */
86 #define IUnknownUUID CFUUIDGetConstantUUIDWithBytes(NULL, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
88 #define IUNKNOWN_C_GUTS \
90 HRESULT (STDMETHODCALLTYPE *QueryInterface)(void *thisPointer, REFIID iid, LPVOID *ppv); \
91 ULONG (STDMETHODCALLTYPE *AddRef)(void *thisPointer); \
92 ULONG (STDMETHODCALLTYPE *Release)(void *thisPointer)
94 typedef struct IUnknownVTbl
{
98 /* End of extern "C" stuff */
99 #if defined(__cplusplus)
104 /* C++ specific stuff */
105 #if defined(__cplusplus)
106 /* ================= IUnknown definition (C++ class) ================= */
108 /* This is a definition of IUnknown as a pure abstract virtual C++ class. This class will work only with compilers that can produce COM-compatible object layouts for C++ classes. egcs can not do this. MetroWerks can do this (if you subclass from __comobject) */
111 #if defined(__MWERKS__) && !defined(__MACH__)
116 virtual HRESULT STDMETHODCALLTYPE
QueryInterface(REFIID iid
, LPVOID
*ppv
) = 0;
117 virtual ULONG STDMETHODCALLTYPE
AddRef(void) = 0;
118 virtual ULONG STDMETHODCALLTYPE
Release(void) = 0;
123 #endif /* ! __COREFOUNDATION_CFPLUGINCOM__ */