mirror of
https://github.com/darlinghq/darling-dbuskit.git
synced 2024-11-27 06:00:38 +00:00
Generate declarations for properties and add some documentation since property
support semes to be working now. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31334 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
29f75f3cc1
commit
658c08dac0
@ -1,3 +1,9 @@
|
||||
2010-09-12 Niels Grewe <niels.grewe@halbordnung.de>
|
||||
|
||||
* Source/DKInterface.m: Include property methods in protocol
|
||||
declarations (no Objective-C 2 style "@property()"-stuff yet)
|
||||
* Documentation/UsingDBus.texi: Document property support.
|
||||
|
||||
2010-09-12 Niels Grewe <niels.grewe@halbordnung.de>
|
||||
|
||||
* Source/DKMethodCall.m: Fix to respect the semantics of
|
||||
|
@ -151,6 +151,28 @@ statements would result in a call to the correct method:
|
||||
id anInstrument = [remoteObject getBass];
|
||||
@end example
|
||||
|
||||
@section Accessing and changing D-Bus properties
|
||||
@cindex property, D-Bus
|
||||
@cindex D-Bus property
|
||||
DBusKit will automatically generate getters and setters for D-Bus properties. A
|
||||
D-Bus interface might, for example, specifythe following property in its
|
||||
introspection data:
|
||||
@example
|
||||
<property name="address" type="s" access="readwrite"/>
|
||||
@end example
|
||||
This property can then be accessed by calling @code(-address) and changed by
|
||||
calling @code(-setaddress:). Both the plain C types and the corresponding
|
||||
Foundation classes are valid as parameters to the getter and setter methods:
|
||||
@example
|
||||
- (NSString*)address;
|
||||
- (char*)address;
|
||||
- (void)setaddress: (NSString*)address;
|
||||
- (void)setaddress: (char*)address;
|
||||
@end example
|
||||
If other methods with the same names exist within the same interface of the
|
||||
remote object, those will take precedence over the generated getter and setter
|
||||
methods.
|
||||
|
||||
@section Watching D-Bus Signals
|
||||
@cindex signal, D-Bus
|
||||
@cindex D-Bus signal
|
||||
|
@ -256,13 +256,29 @@
|
||||
{
|
||||
NSMutableString *declaration = [NSMutableString stringWithFormat: @"@protocol %@\n\n", [self protocolName]];
|
||||
NSEnumerator *methodEnum = [methods objectEnumerator];
|
||||
NSEnumerator *propertyEnum = [properties objectEnumerator];
|
||||
DKMethod *method = nil;
|
||||
|
||||
DKProperty *property = nil;
|
||||
while (nil != (method = [methodEnum nextObject]))
|
||||
{
|
||||
[declaration appendFormat: @"%@\n\n", [method methodDeclaration]];
|
||||
}
|
||||
|
||||
// TODO: Also generate Objective-C 2 syle @property declarations.
|
||||
while (nil != (property = [propertyEnum nextObject]))
|
||||
{
|
||||
DKPropertyAccessor *accessor = [property accessorMethod];
|
||||
DKPropertyMutator *mutator = [property mutatorMethod];
|
||||
|
||||
if (nil != accessor)
|
||||
{
|
||||
[declaration appendFormat: @"%@\n\n", [accessor methodDeclaration]];
|
||||
}
|
||||
if (nil != mutator)
|
||||
{
|
||||
[declaration appendFormat: @"%@\n\n", [mutator methodDeclaration]];
|
||||
}
|
||||
}
|
||||
[declaration appendFormat: @"@end\n"];
|
||||
return declaration;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user