views:

44

answers:

1

Can someone please explain what #ifdef..#else..#endif does in this piece of code? It's from an open-source iphone twitter client.

#ifdef ENABLE_OAUTH
@interface NTLNTwitterClient : NTLNOAuthHttpClient {
#else
@interface NTLNTwitterClient : NTLNHttpClient {
#endif
    int requestPage;
    NSString *screenNameForUserTimeline;
    BOOL parseResultXML;
    NSObject<NTLNTwitterClientDelegate> *delegate;
    BOOL requestForTimeline;
    BOOL requestForDirectMessage;
    NTLNTwitterXMLParser *xmlParser;
}
+3  A: 

If ENABLE_OAUTH is defined somewhere else, then the class NTLNTwitterClient will be a subclass of NTLNOAuthHttpClient.

If ENABLE_OAUTH is not defined, then the class NTLNTwitterClient will be a subclass of NTLNHttpClient.

Jaanus
Cool. Thanks for the response!
dpigera