Recently on the list, there was a question regarding creating your own protocols for QC. This is perhaps a 3+ part problem, and I've only addressed 1. Never the less, it's a good start I think :)
- The Edit Conformance Information menu (I've addressed this one)
- The Composition Repository patch (not addressed)
- The New From Template Dialog (not addressed)
Making a new protocol is actually really simple. Using our "Skanky SDK" template makes it a snap.
Create a new project. Remove the CustomPatch.h, CustomPatch.m, CustomPatchUI.h, and CustomPatch.m files in the Patches directory (we don't need them for this exercise). The function we'll be working on is
registerNodesWithManager:, located in CustomPatchPrincipal.m. Remove references and #imports of these files too.
Add these following lines before the
@interface QCCompositionRepository: NSObject
This tells the compiler a bit about the Compo Repo that we're working with (actually, it doesn't say much at all, just that it's an extant class).
Next, clear out the
registerNodesWithManager function. We're not adding patches, so we don't need any of the auto-generated stuff in there.
Next, the protocol dictionary construction!:
// add and remove your specific keys to the
// appropriate structs -- Use the port's class
// as the object, and a name that follows the pattern
[optionalInputDict setObject:[QCStructurePort class]
[requiredInputDict setObject:[QCStructurePort class]
[optionalOutputDict setObject:[QCStructurePort class]
[requiredOutputDict setObject:[QCStructurePort class]
// here we set some metadata about the protocol:
// the display name (in the conformance dialog),
// and whether or not we allow consumer patches.
// (True in this example)
setObject:@"My Protocol's Display Name"
// We add the required and optional inputs
// to the protocol dictionary...
// the we register it!
// here you should release all the dictionaries.
// I'm lazy though, so you'll have to write that
Feel free to use this code however you want. If you do though, please drop me a line or comment on this post, so I know I didn't waste all this time for nothing :)