![]() | InDesign SDK 20.5 |
#include <Utils.h>
Public Member Functions | |
| Utils () | |
| ~Utils () | |
| IFace * | operator-> () const |
| operator IFace * () | |
| bool16 | Exists () const |
| IFace * | QueryUtilInterface () |
This is a helper class for calling methods in interfaces on the kUtilsBoss. The Utils boss is an easy way access common utilities interfaces.
If you want to do a one-line call on a method in a utility interface, you can do this: Utils<IFooUtils>()->MyFooMethod();
That one line will query the utils boss for the right interface, then call the MyFooMethod() on that interface.
If you want to use a utility interface in several places, it is more efficient to get the interface once, save it in an InterfacePtr, and call it from there. For example:
InterfacePtr<IFooUtils> fooUtils(Utils<IFooUtils>());
This does the QueryInterface() and Release just once, which is better than once per call if you are making many calls.
Construct a Utils helper object, which will Query for the <IFace> Interface on the utils boss.
Destruct a Utils helper object, which will Release the <IFace> interface on the utils boss.
| inline |
Returns true if the utility interface is present. Call this before using the utility interface if it's possible that the plug-in that supplies the interface has been removed.
| inline |
Return a pointer to the interface. The interface is good only until the Utils object is destructed, since the destructor will Release the interface.
| inline |
Return a pointer to the interface. The interface is good only until the Utils object is destructed, since the destructor will Release the interface.
| inline |
Returns a referenced pointer to the utility interface. Caller is resposible for calling Release() on the interface that is returned. Use this method if you want to get a pointer to a utility interface that will stay good after the Utils object has been destructed. Example call: InterfacePtr<IFace>myUtil( Utils<IFace>().QueryUtilInterface() );