Oolite 1.91.0.7646-241128-10e222e
Loading...
Searching...
No Matches
main.c File Reference
#include <CoreFoundation/CoreFoundation.h>
#include <CoreFoundation/CFPlugInCOM.h>
#include <CoreServices/CoreServices.h>
+ Include dependency graph for main.c:

Go to the source code of this file.

Classes

struct  __MetadataImporterPluginType
 

Macros

#define PLUGIN_ID   "44E7EDBD-F1D0-4031-9E99-D272D8166D11"
 

Typedefs

typedef struct __MetadataImporterPluginType MetadataImporterPluginType
 

Functions

Boolean GetMetadataForFile (void *thisInterface, CFMutableDictionaryRef attributes, CFStringRef contentTypeUTI, CFStringRef pathToFile)
 
MetadataImporterPluginTypeAllocMetadataImporterPluginType (CFUUIDRef inFactoryID)
 
void DeallocMetadataImporterPluginType (MetadataImporterPluginType *thisInstance)
 
HRESULT MetadataImporterQueryInterface (void *thisInstance, REFIID iid, LPVOID *ppv)
 
void * MetadataImporterPluginFactory (CFAllocatorRef allocator, CFUUIDRef typeID)
 
ULONG MetadataImporterPluginAddRef (void *thisInstance)
 
ULONG MetadataImporterPluginRelease (void *thisInstance)
 
 __attribute__ ((visibility("default")))
 

Variables

static MDImporterInterfaceStruct testInterfaceFtbl
 

Macro Definition Documentation

◆ PLUGIN_ID

#define PLUGIN_ID   "44E7EDBD-F1D0-4031-9E99-D272D8166D11"

Definition at line 35 of file main.c.

Referenced by __attribute__().

Typedef Documentation

◆ MetadataImporterPluginType

Function Documentation

◆ __attribute__()

__attribute__ ( (visibility("default")) )

Definition at line 207 of file main.c.

209{
211 CFUUIDRef uuid;
212
213 /* If correct type is being requested, allocate an
214 * instance of TestType and return the IUnknown interface.
215 */
216 if (CFEqual(typeID,kMDImporterTypeID)){
217 uuid = CFUUIDCreateFromString(kCFAllocatorDefault,CFSTR(PLUGIN_ID));
218 result = AllocMetadataImporterPluginType(uuid);
219 CFRelease(uuid);
220 return result;
221 }
222 /* If the requested type is incorrect, return NULL. */
223 return NULL;
224}
MetadataImporterPluginType * AllocMetadataImporterPluginType(CFUUIDRef inFactoryID)
Definition main.c:97
#define PLUGIN_ID
Definition main.c:35

References AllocMetadataImporterPluginType(), and PLUGIN_ID.

+ Here is the call graph for this function:

◆ AllocMetadataImporterPluginType()

MetadataImporterPluginType * AllocMetadataImporterPluginType ( CFUUIDRef inFactoryID)

Definition at line 97 of file main.c.

98{
99 MetadataImporterPluginType *theNewInstance;
100
101 theNewInstance = (MetadataImporterPluginType *)malloc(sizeof(MetadataImporterPluginType));
102 memset(theNewInstance,0,sizeof(MetadataImporterPluginType));
103
104 /* Point to the function table */
105 theNewInstance->conduitInterface = &testInterfaceFtbl;
106
107 /* Retain and keep an open instance refcount for each factory. */
108 theNewInstance->factoryID = CFRetain(inFactoryID);
109 CFPlugInAddInstanceForFactory(inFactoryID);
110
111 /* This function returns the IUnknown interface so set the refCount to one. */
112 theNewInstance->refCount = 1;
113 return theNewInstance;
114}
static MDImporterInterfaceStruct testInterfaceFtbl
Definition main.c:81
MDImporterInterfaceStruct * conduitInterface
Definition main.c:58

References __MetadataImporterPluginType::conduitInterface, __MetadataImporterPluginType::factoryID, __MetadataImporterPluginType::refCount, and testInterfaceFtbl.

Referenced by __attribute__().

+ Here is the caller graph for this function:

◆ DeallocMetadataImporterPluginType()

void DeallocMetadataImporterPluginType ( MetadataImporterPluginType * thisInstance)

Definition at line 124 of file main.c.

125{
126 CFUUIDRef theFactoryID;
127
128 theFactoryID = thisInstance->factoryID;
129 free(thisInstance);
130 if (theFactoryID){
131 CFPlugInRemoveInstanceForFactory(theFactoryID);
132 CFRelease(theFactoryID);
133 }
134}

References __MetadataImporterPluginType::factoryID.

Referenced by MetadataImporterPluginRelease().

+ Here is the caller graph for this function:

◆ GetMetadataForFile()

Boolean GetMetadataForFile ( void * thisInterface,
CFMutableDictionaryRef attributes,
CFStringRef contentTypeUTI,
CFStringRef pathToFile )

◆ MetadataImporterPluginAddRef()

ULONG MetadataImporterPluginAddRef ( void * thisInstance)

Definition at line 179 of file main.c.

180{
181 ((MetadataImporterPluginType *)thisInstance )->refCount += 1;
182 return ((MetadataImporterPluginType*) thisInstance)->refCount;
183}

◆ MetadataImporterPluginFactory()

void * MetadataImporterPluginFactory ( CFAllocatorRef allocator,
CFUUIDRef typeID )

◆ MetadataImporterPluginRelease()

ULONG MetadataImporterPluginRelease ( void * thisInstance)

Definition at line 191 of file main.c.

192{
193 ((MetadataImporterPluginType*)thisInstance)->refCount -= 1;
194 if (((MetadataImporterPluginType*)thisInstance)->refCount == 0){
196 return 0;
197 }else{
198 return ((MetadataImporterPluginType*) thisInstance )->refCount;
199 }
200}
void DeallocMetadataImporterPluginType(MetadataImporterPluginType *thisInstance)
Definition main.c:124

References DeallocMetadataImporterPluginType().

+ Here is the call graph for this function:

◆ MetadataImporterQueryInterface()

HRESULT MetadataImporterQueryInterface ( void * thisInstance,
REFIID iid,
LPVOID * ppv )

Definition at line 141 of file main.c.

142{
143 CFUUIDRef interfaceID;
144
145 interfaceID = CFUUIDCreateFromUUIDBytes(kCFAllocatorDefault,iid);
146
147 if (CFEqual(interfaceID,kMDImporterInterfaceID)){
148 /* If the Right interface was requested, bump the ref count,
149 * set the ppv parameter equal to the instance, and
150 * return good status.
151 */
152 ((MetadataImporterPluginType*)thisInstance)->conduitInterface->AddRef(thisInstance);
153 *ppv = thisInstance;
154 CFRelease(interfaceID);
155 return S_OK;
156 }else{
157 if (CFEqual(interfaceID,IUnknownUUID)){
158 /* If the IUnknown interface was requested, same as above. */
159 ((MetadataImporterPluginType*)thisInstance )->conduitInterface->AddRef(thisInstance);
160 *ppv = thisInstance;
161 CFRelease(interfaceID);
162 return S_OK;
163 }else{
164 /* Requested interface unknown, bail with error. */
165 *ppv = NULL;
166 CFRelease(interfaceID);
167 return E_NOINTERFACE;
168 }
169 }
170}

Variable Documentation

◆ testInterfaceFtbl

MDImporterInterfaceStruct testInterfaceFtbl
static
Initial value:
= {
NULL,
}
Boolean GetMetadataForFile(void *thisInterface, CFMutableDictionaryRef attributes, CFStringRef contentTypeUTI, CFStringRef pathToFile)
ULONG MetadataImporterPluginRelease(void *thisInstance)
Definition main.c:191
HRESULT MetadataImporterQueryInterface(void *thisInstance, REFIID iid, LPVOID *ppv)
Definition main.c:141
ULONG MetadataImporterPluginAddRef(void *thisInstance)
Definition main.c:179

Definition at line 81 of file main.c.

Referenced by AllocMetadataImporterPluginType().