OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
defs.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectComponents
3// Copyright (c) 1994, 1996 by Borland International, All Rights Reserved
4/// \file
5/// ObjectComponents fundamental definitions
6//----------------------------------------------------------------------------
7
8#if !defined(OCF_DEFS_H)
9#define OCF_DEFS_H
10
11#include <owl/private/defs.h>
12#if defined(BI_HAS_PRAGMA_ONCE)
13# pragma once
14#endif
15
16#include <owl/defs.h> // Includes <windows.h>.
17
18//
19// We must use all libraries as DLLs if we are using OCF as a DLL
20//
21// Define _OCFDLL with -WSE (-WE for 32bit) to use BIDS & RTL in dlls.
22//
23// Be sure _BUILDOCFDLL is defined when building an actual OCF dll
24//
25#if defined(_OCFDLL) || defined(_BUILDOCFDLL)
26# if !defined(_OCFDLL)
27# define _OCFDLL
28# endif
29#endif
30
31//----------------------------------------------------------------------------
32// Setup class, function and data modifier macros for OCF
33//
34#if defined(_BUILDOCFDLL)
35# define _OCFCLASS _OWLEXPORTCLASS
36# define _OCFDATA _OWLEXPORTDATA
37# define _OCFFUNC _OWLEXPORTFUNC
38# define _OCFCFUNC _OWLEXPORTCFUNC
39#elif defined(_OCFDLL)
40# define _OCFCLASS _OWLIMPORTCLASS
41# define _OCFDATA _OWLIMPORTDATA
42# define _OCFFUNC _OWLIMPORTFUNC
43# define _OCFCFUNC _OWLIMPORTCFUNC
44#else
45# define _OCFCLASS
46# define _OCFDATA(p) p
47# define _OCFFUNC(p) p
48# define _OCFCFUNC(p) p _CCONV
49#endif
50
51// only for OWL
52#if defined(_BUILDOCFDLL) || defined(_OCFDLL)
53# define DECLARE_STREAMABLE_OCF( cls, ver ) \
54 DECLARE_STREAMABLE( _OCFCLASS, cls, ver )
55# define DECLARE_STREAMABLE_FROM_BASE_OCF( cls, base ) \
56 DECLARE_STREAMABLE_FROM_BASE( _OCFCLASS, cls, base )
57#define DECLARE_ABSTRACT_STREAMABLE_OCF(cls, ver ) \
58 DECLARE_ABSTRACT_STREAMABLE( _OCFCLASS, cls, ver )
59
60#else
61# define DECLARE_STREAMABLE_OCF(cls, ver ) \
62 DECLARE_STREAMABLE( _OCFCLASS, cls, ver )
63# define DECLARE_STREAMABLE_FROM_BASE_OCF( cls, base ) \
64 DECLARE_STREAMABLE_FROM_BASE( _OCFCLASS, cls, base )
65#define DECLARE_ABSTRACT_STREAMABLE_OCF(cls, ver ) \
66 DECLARE_ABSTRACT_STREAMABLE( _OCFCLASS, cls, ver )
67
68#endif
69
70//
71// Useful HRESULT constants and test functions
72//
73#define HR_NOERROR NOERROR
74#define HR_OK ResultFromScode(S_OK) // same as NOERROR
75#define HR_FALSE ResultFromScode(S_FALSE)
76#define HR_NOTIMPL ResultFromScode(E_NOTIMPL)
77#define HR_OUTOFMEMORY ResultFromScode(E_OUTOFMEMORY)
78#define HR_INVALIDARG ResultFromScode(E_INVALIDARG)
79#define HR_NOINTERFACE ResultFromScode(E_NOINTERFACE)
80#define HR_POINTER ResultFromScode(E_POINTER)
81#define HR_HANDLE ResultFromScode(E_HANDLE)
82#define HR_ABORT ResultFromScode(E_ABORT)
83#define HR_FAIL ResultFromScode(E_FAIL)
84
85#define HR_CLASS_NOAGGREGATION ResultFromScode(CLASS_E_NOAGGREGATION)
86#define HR_CLASS_CLASSNOTAVAILABLE ResultFromScode(CLASS_E_CLASSNOTAVAILABLE)
87
88#define HR_DISP_MEMBERNOTFOUND ResultFromScode(DISP_E_MEMBERNOTFOUND)
89#define HR_DISP_BADPARAMCOUNT ResultFromScode(DISP_E_BADPARAMCOUNT)
90#define HR_DISP_BADVARTYPE ResultFromScode(DISP_E_BADVARTYPE)
91#define HR_DISP_OVERFLOW ResultFromScode(DISP_E_OVERFLOW)
92#define HR_DISP_TYPEMISMATCH ResultFromScode(DISP_E_TYPEMISMATCH)
93#define HR_DISP_PARAMNOTFOUND ResultFromScode(DISP_E_PARAMNOTFOUND)
94#define HR_DISP_PARAMNOTOPTIONAL ResultFromScode(DISP_E_PARAMNOTOPTIONAL)
95#define HR_DISP_EXCEPTION ResultFromScode(DISP_E_EXCEPTION)
96#define HR_DISP_OVERFLOW ResultFromScode(DISP_E_OVERFLOW)
97#define HR_DISP_UNKNOWNINTERFACE ResultFromScode(DISP_E_UNKNOWNINTERFACE)
98#define HR_DISP_UNKNOWNNAME ResultFromScode(DISP_E_UNKNOWNNAME)
99
100#define HR_TYPE_INVALIDSTATE ResultFromScode(TYPE_E_INVALIDSTATE)
101#define HR_TYPE_WRONGTYPEKIND ResultFromScode(TYPE_E_WRONGTYPEKIND)
102#define HR_TYPE_LIBNOTREGISTERED ResultFromScode(TYPE_E_LIBNOTREGISTERED)
103#define HR_TYPE_ELEMENTNOTFOUND ResultFromScode(TYPE_E_ELEMENTNOTFOUND)
104#define HR_TYPE_UNSUPFORMAT ResultFromScode(TYPE_E_UNSUPFORMAT)
105
106#define HR_DATA_FORMATETC ResultFromScode(DATA_E_FORMATETC)
107#define HR_DV_FORMATETC ResultFromScode(DV_E_FORMATETC)
108#define HR_DATA_SAMEFORMATETC ResultFromScode(DATA_S_SAMEFORMATETC)
109
110#define HR_MK_NOOBJECT ResultFromScode(MK_E_NOOBJECT)
111#define HR_MK_NOSTORAGE ResultFromScode(MK_E_NOSTORAGE)
112#define HR_MK_UNAVAILABLE ResultFromScode(MK_E_UNAVAILABLE)
113
114#define HR_OLE_STATIC ResultFromScode(OLE_E_STATIC)
115#define HR_OLE_NOT_INPLACEACTIVE ResultFromScode(OLE_E_NOT_INPLACEACTIVE)
116#define HR_OLEOBJ_INVALIDVERB ResultFromScode(OLEOBJ_S_INVALIDVERB)
117#define HR_OLE_USEREG ResultFromScode(OLE_S_USEREG)
118
119#define HR_RPC_CALL_REJECTED ResultFromScode(RPC_E_CALL_REJECTED)
120#define HR_STG_CANTSAVE ResultFromScode(STG_E_CANTSAVE)
121
122namespace ocf {
123
124// Return result codes based on bool expression
125//
128
129// Return bool based on hresult test
130//
131inline bool HRSucceeded(HRESULT hr) {return SUCCEEDED(hr);}
132inline bool HRIsOK(HRESULT hr) {return static_cast<bool>(hr == HR_OK);}
133
134} // OCF namespace
135
136#if !defined(_BUILDOCFDLL)
137#include <ocf/ocflink.h>
138#endif
139
140//
141// Provide alias for old all-uppercase namespace name.
142//
143#if defined(OWL5_COMPAT)
144#define OCF ocf
145#endif
146
147#endif // OCF_DEFS_H
Object Component Framework (COM encapsulation)
Definition appdesc.h:22
bool HRIsOK(HRESULT hr)
Definition defs.h:132
HRESULT HRFailIfZero(int bexpr)
Definition defs.h:126
HRESULT HRFalseIfZero(int bexpr)
Definition defs.h:127
bool HRSucceeded(HRESULT hr)
Definition defs.h:131
#define HR_OK
Definition defs.h:74
#define HR_NOERROR
Definition defs.h:73
#define HR_FALSE
Definition defs.h:75
#define HR_FAIL
Definition defs.h:83
General definitions used by all ObjectWindows programs.