GUIDs are structures containing 128 bits of pure noise, hopefully unique throughout all time and space. They are used to identify interfaces and object classes.
typedef void *
An object is a pointer. The first element of the pointer is the vTable, so an object of type IUnknown (all COM objects) is a pointer to a pointer to the IUnknown vTable.
typedef unsigned int
An ID code is a 32-bit word, with values constructed by passing four characters to the macro below.
This is the IUnknown interface. In COM terminology, an “interface” describes the layout of a table containing method function vectors, or “vTable.” Three functions at the start of all COM object vTables control polymorphism and reference counting. The LXxMETHOD macro allows us to control the function declaration across different systems or compilers, although it is just the default for now.
COM objects are relative black boxes; They are passed around as ILxUnknown objects, and only become more descriptive and useful when queried for an interface. Often it can be helpful for clients to be able to perform basic interaction with the COM object, without knowing which interfaces it implements. The ILxObject interface is implemented by all COM objects. It provides methods for querying the object name, as well as enumerating over interfaces implemented by the COM interface.
InterfaceCount(LXtObjectID self, unsigned int *count)¶
Returns the number of interfaces implemented by the object.
InterfaceByIndex(LXtObjectID self, unsigned int index, const LXtGUID **guid)¶
Returns the GUID of an interface specified by index.
AddObserver(LXtObjectID self, LXtObjectID visitor)¶
Attach a visitor to the lifetime of the COM object. When the reference count of the COM object reaches zero, and the object is destroyed, the Evaluate method on the visitor will be called.
const LXtGUID *
Translate(LXtObjectID self, const char *guidStr)¶
A service interface for converting between GUID strings and LXtGUID structs is exported as part of the application global.
Translate takes a GUID string (either the LXu_* long format or an LXa_* alias) and returns a pointer to an LXtGUID. The returned pointer is non-volatile and can be stored.
GetName takes a pointer to an LXtGUID struct and returns the name for the GUID. This will be the short alias for the GUID if it exists.
Compare takes two LXtGUID pointers and returns a ranking metric for sorting them. The result is similar to strcmp().
Fixed takes a GUID pointer that may be volatile and returns a non-volatile version from the global pool.
Class takes a GUID pointer and returns the class GUID, if any.
ClassName takes a GUID pointer and returns the name for the class, if any.
- const LXtGUID *
Crazy-ass Mac code needed to define LXx_OVERRIDE, which doesn’t need to be part of the public docs.