Here is class example (though you can also find plenty of them in the Open source plugins I got, even if Bob’s plugins have only been tiny bit cleaned up then they still have working examples of making class).
The class bellow shows you class that has Methods, properties, constants and enums. And the class implements 2 interfaces.
(Its usually the norm of course to use some sizeof mechanic to count the entities, but I tend to not do it in some plugins because of some pitfalls with it I have had over the years)
static REALmethodDefinition BMPExporterMethods[8] =
{
{ (REALproc) BMPExporter_SaveToFile, REALnoImplementation, "SaveToFile(image as RawBitmap,f as FolderItem)",REALconsoleSafe},
{ (REALproc) BMPExporter_SaveToString, REALnoImplementation, "SaveToString(image as RawBitmap) as String",REALconsoleSafe},
{ (REALproc) BMPExporter_GetLastErrorCode, REALnoImplementation, "GetLastErrorCode() as Integer",REALconsoleSafe},
{ (REALproc) BMP_GetInternetMediaTypes, REALnoImplementation, "InternetMediaTypes() as String()", REALconsoleSafe},
{ (REALproc) BMP_GetFileExtensions, REALnoImplementation, "FileExtensions() as String()", REALconsoleSafe},
{ (REALproc) BMP_GetUTI, REALnoImplementation, "UTI() as String", REALconsoleSafe},
{ (REALproc) BMP_GetUTIDescription, REALnoImplementation, "UTIDescription() as String", REALconsoleSafe},
{ (REALproc) BMP_UTIConformsTo, REALnoImplementation, "UTIConformsTo() as String", REALconsoleSafe},
};
static REALproperty BMPExporterProperties[4] =
{
{nil,"ErrorMessage", "String", REALconsoleSafe, REALstandardGetter,REALnoImplementation, FieldOffset(BMPImporterData, ErrorMessage)},
{nil,"LastError", "RawBMPExporter.ErrorValues", REALconsoleSafe, (REALproc)BMPExporter_LastError,REALnoImplementation, nil},
{nil,"ProgressHandler","RawBitmap.ProgressDelegate",REALconsoleSafe, (REALproc)BMPExporter_ProgressHandlerGetter,(REALproc)BMPExporter_ProgressHandlerSetter},
{nil,"Aborted", "Boolean", REALconsoleSafe, REALstandardGetter,REALnoImplementation, FieldOffset(BMPExporterData, Aborted)},
};
static REALconstant BMPExporterClassConstants[1] =
{
{ PLUGIN_VERSION, nil, REALconsoleSafe | REALScopePublic, 0 , nil}
};
static const char* BMPExporter_ErrorValues[8] =
{
"NO_ERROR = 0",
"INVALID_PARAMETER = -2",
"UNSUPPORTED_FORMAT = -9",
"COULD_NOT_CREATE_FILE = -10",
"INVALID_COLOR_SPACE = -20",
"COULD_NOT_WRITE = -30",
"UNKNOWN_RAWBITMAP_FORMAT = -55",
"COULD_NOT_CONVERT_RAWBITMAP_FORMAT = -106"
};
static REALenum BMPExporterEnums[1] =
{
{"ErrorValues","Integer",0, BMPExporter_ErrorValues,8},
};
REALclassDefinition BMPExporterClass =
{
kCurrentREALControlVersion, // Version
"RawBMPExporter", // Name
nil, // Super Name
sizeof(BMPExporterData), // Data size
0, // Something for system use
(REALproc) BMPExporter_Constructor, // Constructor index
(REALproc) BMPExporter_Destructor, // Destructor Index
BMPExporterProperties, // Pointer to property def
4, // Property count
BMPExporterMethods, // Pointer to method def
8, // Method count
nil, // Pointer to Event def
0, // event Count
nil,
0,
"IRawBitmapWriter, IRawBitmapWriterV2",
nil,
0,
BMPExporterClassConstants,
1,
0, // Flags
nil,
0,
nil,
0,
nil,
0,
BMPExporterEnums,
1
};