convert line ends
[canaan.git] / prj / cam / src / object / property.h
blobee0057595ef74bdb787311cf6a13e5a20f127a5b
1 /*
2 @Copyright Looking Glass Studios, Inc.
3 1996,1997,1998,1999,2000 Unpublished Work.
4 */
6 // $Header: r:/t2repos/thief2/src/object/property.h,v 1.15 2000/01/29 13:24:22 adurant Exp $
7 #pragma once
9 #ifndef PROPERTY__H
10 #define PROPERTY__H
12 #include <comtools.h>
13 #include <objtype.h>
14 #include <proptype.h>
15 #include <propdef.h>
17 ////////////////////////////////////////////////////////////
18 // PROPERTY SYSTEM COM INTERFACES
20 // NOTE: Make sure that any change to this interface is also made in propdef.h
22 F_DECLARE_INTERFACE(IProperty);
23 #undef INTERFACE
24 #define INTERFACE IProperty
26 DECLARE_INTERFACE_ (IProperty, IUnknown)
28 // IUnknown methods
29 DECLARE_UNKNOWN_PURE ();
32 // Return my description
34 STDMETHOD_ (const sPropertyDesc *, Describe) (THIS) CONSTFUNC PURE;
37 // Return my ID
39 STDMETHOD_(PropertyID, GetID) (THIS) CONSTFUNC PURE;
42 // Return a description of my type
44 STDMETHOD_ (const sPropertyTypeDesc *, DescribeType) (THIS) CONSTFUNC PURE;
47 // Force this property to be relevent for the object, use a default value, return success
49 STDMETHOD(Create)(THIS_ ObjID obj) PURE;
52 // Set the property for an object, given another object as an example to copy
54 STDMETHOD(Copy)(THIS_ ObjID to, ObjID from) PURE;
57 // Decide that this property is irrelevant for the object
59 STDMETHOD(Delete) (THIS_ ObjID obj) PURE;
62 // Return whether an object possesses a property
64 STDMETHOD_(BOOL, IsRelevant) (THIS_ ObjID obj) CONSTFUNC PURE;
67 // Return whether an object posesses the property *without inheritance*
70 STDMETHOD_(BOOL, IsSimplyRelevant) (THIS_ ObjID obj) CONSTFUNC PURE;
73 // Refresh the property as if it had just been set for a particular obj
75 STDMETHOD_(BOOL,Touch) (THIS_ ObjID obj) PURE;
78 // Notify the property of various events. Used by the property manager mainly.
80 STDMETHOD_(void, Notify) (THIS_ ePropertyNotifyMsg msg, PropNotifyData data) PURE;
83 // Listen for property changes to an object
85 STDMETHOD_(PropListenerHandle, Listen) (THIS_ PropertyListenMsgSet interests, PropertyListenFunc func, PropListenerData data) PURE;
87 STDMETHOD(Unlisten)(THIS_ PropListenerHandle listener) PURE;
89 // Start iterating over all objects with this property
92 STDMETHOD_(void, IterStart) (THIS_ sPropertyObjIter* iter) CONSTFUNC PURE;
95 // Fill in obj with the next obj in iteration, return FALSE= done.
97 STDMETHOD_(BOOL, IterNext) (THIS_ sPropertyObjIter* iter,ObjID* next) CONSTFUNC PURE;
100 // Clean up after iteration
102 STDMETHOD_(void, IterStop) (THIS_ sPropertyObjIter* iter) CONSTFUNC PURE;
105 ////////////////////////////////////////
107 #define IProperty_Describe(p) COMCall0(p, Describe)
108 #define IProperty_GetID(p) COMCall0(p, GetID)
109 #define IProperty_DescribeType(p) COMCall0(p, DescribeType)
110 #define IProperty_Create(p,a) COMCall1(p, Create, a)
111 #define IProperty_Copy(p,a,b) COMCall2(p, Copy, a, b)
112 #define IProperty_Delete(p,a) COMCall1(p, Delete, a)
113 #define IProperty_IsRelevant(p,a) COMCall1(p, IsRelevant, a)
114 #define IProperty_IsSimplyRelevant(p,a) COMCall1(p, IsSimplyRelevant, a)
115 #define IProperty_Touch(p,a) COMCall1(p, Touch, a)
116 #define IProperty_Notify(p, a, b) COMCall2(p, Notify, a, b)
117 #define IProperty_Listen(p, a, b, c) COMCall3(p, Listen, a, b, c)
118 #define IProperty_IterStart(p, a) COMCall1(p, IterStart, a)
119 #define IProperty_IterNext(p, a, b) COMCall2(p, IterNext, a, b)
120 #define IProperty_IterStop(p, a) COMCall1(p, IterStop, a)
123 ////////////////////////////////////////////////////////////
124 // PROPERTY ACCESSORS
127 #define PROPERTY_GET(p, a, b) COMCall2(p, Get, a, b)
128 #define PROPERTY_GET_SIMPLE(p, a, b) COMCall2(p, GetSimple, a, b)
129 #define PROPERTY_SET(p, a, b) COMCall2(p, Set, a, b)
130 #define PROPERTY_ITER_NEXT_VALUE(p, a, b, c) COMCall3(p, IterNextValue, a, b,c)
132 #ifdef __cplusplus
133 class cPropertyImpl;
134 #else
135 typedef void cPropertyImpl;
136 #endif
139 // These are for use by macros only. They violate COM refcount conventions.
140 // REPEAT: DO NOT CALL THESE DIRECTLY
142 EXTERN IProperty* _GetProperty(PropertyID id);
143 EXTERN IProperty* _GetPropertyNamed(const char* name);
145 ////////////////////////////////////////////////////////////
146 // LOOK UP A PROPERTY BY ID OR NAME
149 EXTERN IProperty* GetProperty(PropertyID id);
150 EXTERN IProperty* GetPropertyNamed(const char* name);
153 // Interfaces
156 #define GetPropertyInterface(id,IFACE,ppFace) \
157 (COMQueryInterface(_GetProperty(id),IID_##IFACE,(void**)ppFace) == S_OK)
158 #define GetPropertyInterfaceNamed(name,IFACE,ppFace) \
159 (COMQueryInterface(_GetPropertyNamed(name),IID_##IFACE,(void**)ppFace) == S_OK)
165 #endif // PROPERTY__H
169 Local Variables:
170 Typedefs:("BOOL" "ObjID" "REFIID" "ePropertyImpl")
171 End: