Make NSNetServices use formal protocol, as in 10.6. When compiling with clang, use @optional, otherwise fall back to defining an empty protocol and defining an informal protocol with the methods.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31594 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
David Chisnall 2010-11-07 15:43:46 +00:00
parent a3d6bd2eab
commit e523978a5d
2 changed files with 31 additions and 12 deletions

View file

@ -33,6 +33,8 @@
extern "C" {
#endif
@protocol NSNetServiceBrowserDelegate, NSNetServiceDelegate;
enum
{
NSNetServicesUnknownError = -72000L,
@ -165,8 +167,13 @@ GS_EXPORT NSString * const NSNetServicesErrorDomain;
- (void) startMonitoring;
- (void) stopMonitoring;
- (id) delegate;
- (void) setDelegate: (id) delegate;
#if OS_API_VERSION(100500,GS_API_LATEST)
- (NSInteger)port;
- (void) publishWithOptions: (NSNetServiceOptions)options;
#endif
- (id<NSNetServiceDelegate>) delegate;
- (void) setDelegate: (id<NSNetServiceDelegate>) delegate;
- (NSArray *) addresses;
- (NSString *) domain;
@ -238,15 +245,15 @@ GS_EXPORT NSString * const NSNetServicesErrorDomain;
- (void) stop;
- (id) delegate;
- (void) setDelegate: (id) delegate;
- (id<NSNetServiceBrowserDelegate>) delegate;
- (void) setDelegate: (id<NSNetServiceBrowserDelegate>) delegate;
@end
/**
* <unit>
* <heading>
* NSObject (NSNetServiceDelegateMethods) class description
* NSNetServiceDelegate protocol description
* </heading>
* <p>
* <!-- Foreword -->
@ -257,12 +264,18 @@ GS_EXPORT NSString * const NSNetServicesErrorDomain;
* </p>
* </unit>
* <p>
* This informal protocol must be adopted by any class wishing to implement
* This protocol must be adopted by any class wishing to implement
* an [NSNetService] delegate.
* </p>
*/
@protocol NSNetServiceDelegate
#ifdef __clang__
@optional
#else
@end
@interface NSObject (NSNetServiceDelegateMethods)
#endif
/**
* Notifies the delegate that the network is ready to publish the service.
@ -353,7 +366,7 @@ GS_EXPORT NSString * const NSNetServicesErrorDomain;
/**
* <unit>
* <heading>
* NSObject (NSNetServiceBrowserDelegateMethods) class description
* NSNetServiceBrowserDelegate protocol description
* </heading>
* <p>
* <!-- Foreword -->
@ -364,12 +377,18 @@ GS_EXPORT NSString * const NSNetServicesErrorDomain;
* </p>
* </unit>
* <p>
* This informal protocol must be adopted by any class wishing to implement
* This protocol must be adopted by any class wishing to implement
* an [NSNetServiceBrowser] delegate.
* </p>
*/
@protocol NSNetServiceBrowserDelegate
#ifdef __clang__
@optional
#else
@end
@interface NSObject (NSNetServiceBrowserDelegateMethods)
#endif
/**
* Notifies the delegate that the search is about to begin.

View file

@ -155,12 +155,12 @@ static Class concreteBrowserClass;
}
- (id) delegate
- (id<NSNetServiceDelegate>) delegate
{
return _delegate;
}
- (void) setDelegate: (id) delegate
- (void) setDelegate: (id<NSNetServiceDelegate>) delegate
{
_delegate = delegate;
}
@ -449,12 +449,12 @@ static Class concreteBrowserClass;
}
- (id) delegate
- (id<NSNetServiceBrowserDelegate>) delegate
{
return _delegate;
}
- (void) setDelegate: (id) delegate
- (void) setDelegate: (id<NSNetServiceBrowserDelegate>) delegate
{
_delegate = delegate;
}