Use instancetype.

This commit is contained in:
Jonathan Schleifer 2013-06-23 23:41:47 +02:00
parent 4fead04d9a
commit 9ae39edeb4
32 changed files with 153 additions and 153 deletions

View file

@ -39,11 +39,11 @@ typedef void (^xmpp_callback_block_t)(XMPPConnection*, XMPPIQ*);
}
#ifdef OF_HAVE_BLOCKS
+ callbackWithBlock: (xmpp_callback_block_t)callback;
+ (instancetype)callbackWithBlock: (xmpp_callback_block_t)callback;
- initWithBlock: (xmpp_callback_block_t)callback;
#endif
+ callbackWithTarget: (id)target
+ (instancetype)callbackWithTarget: (id)target
selector: (SEL)selector;
- initWithTarget: (id)target
selector: (SEL)selector;

View file

@ -28,7 +28,7 @@
@implementation XMPPCallback
#ifdef OF_HAVE_BLOCKS
+ callbackWithBlock: (xmpp_callback_block_t)block
+ (instancetype)callbackWithBlock: (xmpp_callback_block_t)block
{
return [[(XMPPCallback*)[self alloc] initWithBlock: block] autorelease];
}
@ -48,7 +48,7 @@
}
#endif
+ callbackWithTarget: (id)target
+ (instancetype)callbackWithTarget: (id)target
selector: (SEL)selector
{
return [[[self alloc] initWithTarget: target

View file

@ -218,7 +218,7 @@
*
* \return A new autoreleased XMPPConnection
*/
+ connection;
+ (instancetype)connection;
/**
* \brief Adds the specified delegate.

View file

@ -117,7 +117,7 @@
@end
@implementation XMPPConnection
+ connection
+ (instancetype)connection
{
return [[[self alloc] init] autorelease];
}

View file

@ -58,7 +58,7 @@
* \param connection The XMPPConnection to serve responses on.
* \return A new autoreleased XMPPDiscoEntity
*/
+ discoEntityWithConnection: (XMPPConnection*)connection;
+ (instancetype)discoEntityWithConnection: (XMPPConnection*)connection;
/**
* \brief Creates a new autoreleased XMPPDiscoEntity with the specified
@ -68,7 +68,7 @@
* \param capsNode The node advertised for the entity's capabilites
* \return A new autoreleased XMPPDiscoEntity
*/
+ discoEntityWithConnection: (XMPPConnection*)connection
+ (instancetype)discoEntityWithConnection: (XMPPConnection*)connection
capsNode: (OFString*)capsNode;
/**

View file

@ -26,12 +26,12 @@
#import "namespaces.h"
@implementation XMPPDiscoEntity
+ discoEntityWithConnection: (XMPPConnection*)connection
+ (instancetype)discoEntityWithConnection: (XMPPConnection*)connection
{
return [[[self alloc] initWithConnection: connection] autorelease];
}
+ discoEntityWithConnection: (XMPPConnection*)connection
+ (instancetype)discoEntityWithConnection: (XMPPConnection*)connection
capsNode: (OFString*)capsNode
{
return [[[self alloc] initWithConnection: connection

View file

@ -47,7 +47,7 @@
* \param name The name of the identity
* \return A new autoreleased XMPPDiscoIdentity
*/
+ identityWithCategory: (OFString*)category
+ (instancetype)identityWithCategory: (OFString*)category
type: (OFString*)type
name: (OFString*)name;
@ -59,7 +59,7 @@
* \param type The type of the identity
* \return A new autoreleased XMPPDiscoIdentity
*/
+ identityWithCategory: (OFString*)category
+ (instancetype)identityWithCategory: (OFString*)category
type: (OFString*)type;
/**

View file

@ -23,7 +23,7 @@
#import "XMPPDiscoIdentity.h"
@implementation XMPPDiscoIdentity
+ identityWithCategory: (OFString*)category
+ (instancetype)identityWithCategory: (OFString*)category
type: (OFString*)type
name: (OFString*)name
{
@ -32,7 +32,7 @@
name: name] autorelease];
}
+ identityWithCategory: (OFString*)category
+ (instancetype)identityWithCategory: (OFString*)category
type: (OFString*)type
{
return [[[self alloc] initWithCategory: category

View file

@ -61,7 +61,7 @@
* \param node The node's opaque name
* \return A new autoreleased XMPPDiscoNode
*/
+ discoNodeWithJID: (XMPPJID*)JID
+ (instancetype)discoNodeWithJID: (XMPPJID*)JID
node: (OFString*)node;
/**
@ -73,7 +73,7 @@
* \param name The node's human friendly name
* \return A new autoreleased XMPPDiscoNode
*/
+ discoNodeWithJID: (XMPPJID*)JID
+ (instancetype)discoNodeWithJID: (XMPPJID*)JID
node: (OFString*)node
name: (OFString*)name;

View file

@ -28,7 +28,7 @@
#import "namespaces.h"
@implementation XMPPDiscoNode
+ discoNodeWithJID: (XMPPJID*)JID
+ (instancetype)discoNodeWithJID: (XMPPJID*)JID
node: (OFString*)node;
{
return [[[self alloc] initWithJID: JID
@ -36,7 +36,7 @@
}
+ discoNodeWithJID: (XMPPJID*)JID
+ (instancetype)discoNodeWithJID: (XMPPJID*)JID
node: (OFString*)node
name: (OFString*)name
{

View file

@ -32,7 +32,7 @@
*
* \return A new autoreleased XMPPEXTERNALAuth
*/
+ EXTERNALAuth;
+ (instancetype)EXTERNALAuth;
/**
* \brief Creates a new autoreleased XMPPEXTERNALAuth with an authzid.
@ -40,5 +40,5 @@
* \param authzid The authzid to get authorization for
* \return A new autoreleased XMPPEXTERNALAuth
*/
+ EXTERNALAuthWithAuthzid: (OFString*)authzid;
+ (instancetype)EXTERNALAuthWithAuthzid: (OFString*)authzid;
@end

View file

@ -27,13 +27,13 @@
#import "XMPPEXTERNALAuth.h"
@implementation XMPPEXTERNALAuth: XMPPAuthenticator
+ EXTERNALAuth
+ (instancetype)EXTERNALAuth
{
return [[[self alloc] initWithAuthcid: nil
password: nil] autorelease];
}
+ EXTERNALAuthWithAuthzid: (OFString*)authzid
+ (instancetype)EXTERNALAuthWithAuthzid: (OFString*)authzid
{
return [[[self alloc] initWithAuthzid: authzid
authcid: nil

View file

@ -45,7 +45,7 @@
* for this exception
* \return A new XMPPException
*/
+ exceptionWithConnection: (XMPPConnection*)connection;
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection;
/**
* \brief Initializes an already allocated XMPPException.
@ -82,7 +82,7 @@
* \param reason The descriptive free-form text specified by the stream error
* \return A new XMPPStreamErrorException
*/
+ exceptionWithConnection: (XMPPConnection*)connection
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection
condition: (OFString*)condition
reason: (OFString*)reason;
@ -126,7 +126,7 @@
* \param string The string that failed the stringprep profile
* \return A new XMPPStringPrepFailedException
*/
+ exceptionWithConnection: (XMPPConnection*)connection
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection
profile: (OFString*)profile
string: (OFString*)string;
@ -169,7 +169,7 @@
* \param string The string that could not be translated
* \return A new XMPPIDNATranslationFailedException
*/
+ exceptionWithConnection: (XMPPConnection*)connection
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection
operation: (OFString*)operation
string: (OFString*)string;
@ -209,7 +209,7 @@
* \param reason The reason the authentication failed
* \return A new XMPPAuthFailedException
*/
+ exceptionWithConnection: (XMPPConnection*)connection
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection
reason: (OFString*)reason;
/**

View file

@ -30,7 +30,7 @@
#import "XMPPConnection.h"
@implementation XMPPException
+ exceptionWithConnection: (XMPPConnection*)connection
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection
{
return [[[self alloc] initWithConnection: connection] autorelease];
}
@ -75,7 +75,7 @@
@end
@implementation XMPPStreamErrorException
+ exceptionWithConnection: (XMPPConnection*)connection
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection
condition: (OFString*)condition
reason: (OFString*)reason;
{
@ -139,7 +139,7 @@
@end
@implementation XMPPStringPrepFailedException
+ exceptionWithConnection: (XMPPConnection*)connection
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection
profile: (OFString*)profile
string: (OFString*)string
{
@ -204,7 +204,7 @@
@end
@implementation XMPPIDNATranslationFailedException
+ exceptionWithConnection: (XMPPConnection*)connection
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection
operation: (OFString*)operation
string: (OFString*)string
{
@ -268,7 +268,7 @@
@end
@implementation XMPPAuthFailedException
+ exceptionWithConnection: (XMPPConnection*)connection
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection
reason: (OFString*)reason;
{
return [[[self alloc] initWithConnection: connection

View file

@ -34,7 +34,7 @@
* \param ID The value for the stanza's id attribute
* \return A new autoreleased XMPPIQ
*/
+ IQWithType: (OFString*)type
+ (instancetype)IQWithType: (OFString*)type
ID: (OFString*)ID;
/**

View file

@ -29,7 +29,7 @@
#import "XMPPIQ.h"
@implementation XMPPIQ
+ IQWithType: (OFString*)type
+ (instancetype)IQWithType: (OFString*)type
ID: (OFString*)ID
{
return [[[self alloc] initWithType: type

View file

@ -45,7 +45,7 @@
*
* \return A new autoreleased XMPPJID
*/
+ JID;
+ (instancetype)JID;
/**
* \brief Creates a new autoreleased XMPPJID from a string.
@ -53,7 +53,7 @@
* \param string The string to parse into a JID object
* \return A new autoreleased XMPPJID
*/
+ JIDWithString: (OFString*)string;
+ (instancetype)JIDWithString: (OFString*)string;
/**
* \brief Initializes an already allocated XMPPJID with a string.

View file

@ -33,12 +33,12 @@
#import "XMPPExceptions.h"
@implementation XMPPJID
+ JID
+ (instancetype)JID
{
return [[[self alloc] init] autorelease];
}
+ JIDWithString: (OFString*)string
+ (instancetype)JIDWithString: (OFString*)string
{
return [[[self alloc] initWithString: string] autorelease];
}

View file

@ -37,7 +37,7 @@
*
* \return A new autoreleased XMPPMessage
*/
+ message;
+ (instancetype)message;
/**
* \brief Creates a new autoreleased XMPPMessage with the specified ID.
@ -45,7 +45,7 @@
* \param ID The value for the stanza's id attribute
* \return A new autoreleased XMPPMessage
*/
+ messageWithID: (OFString*)ID;
+ (instancetype)messageWithID: (OFString*)ID;
/**
* \brief Creates a new autoreleased XMPPMessage with the specified type.
@ -53,7 +53,7 @@
* \param type The value for the stanza's type attribute
* \return A new autoreleased XMPPMessage
*/
+ messageWithType: (OFString*)type;
+ (instancetype)messageWithType: (OFString*)type;
/**
* \brief Creates a new autoreleased XMPPMessage with the specified type and ID.
@ -62,7 +62,7 @@
* \param ID The value for the stanza's id attribute
* \return A new autoreleased XMPPMessage
*/
+ messageWithType: (OFString*)type
+ (instancetype)messageWithType: (OFString*)type
ID: (OFString*)ID;
/**

View file

@ -29,22 +29,22 @@
#import "namespaces.h"
@implementation XMPPMessage
+ message
+ (instancetype)message
{
return [[[self alloc] init] autorelease];
}
+ messageWithID: (OFString*)ID
+ (instancetype)messageWithID: (OFString*)ID
{
return [[[self alloc] initWithID: ID] autorelease];
}
+ messageWithType: (OFString*)type
+ (instancetype)messageWithType: (OFString*)type
{
return [[[self alloc] initWithType: type] autorelease];
}
+ messageWithType: (OFString*)type
+ (instancetype)messageWithType: (OFString*)type
ID: (OFString*)ID
{
return [[[self alloc] initWithType: type

View file

@ -34,7 +34,7 @@
* \param password The password to authenticate with
* \return A new autoreleased XMPPPLAINAuth
*/
+ PLAINAuthWithAuthcid: (OFString*)authcid
+ (instancetype)PLAINAuthWithAuthcid: (OFString*)authcid
password: (OFString*)password;
/**
@ -46,7 +46,7 @@
* \param password The password to authenticate with
* \return A new autoreleased XMPPPLAINAuth
*/
+ PLAINAuthWithAuthzid: (OFString*)authzid
+ (instancetype)PLAINAuthWithAuthzid: (OFString*)authzid
authcid: (OFString*)authcid
password: (OFString*)password;
@end

View file

@ -28,14 +28,14 @@
#import "XMPPExceptions.h"
@implementation XMPPPLAINAuth
+ PLAINAuthWithAuthcid: (OFString*)authcid
+ (instancetype)PLAINAuthWithAuthcid: (OFString*)authcid
password: (OFString*)password
{
return [[[self alloc] initWithAuthcid: authcid
password: password] autorelease];
}
+ PLAINAuthWithAuthzid: (OFString*)authzid
+ (instancetype)PLAINAuthWithAuthzid: (OFString*)authzid
authcid: (OFString*)authcid
password: (OFString*)password
{

View file

@ -42,7 +42,7 @@
*
* \return A new autoreleased XMPPPresence
*/
+ presence;
+ (instancetype)presence;
/**
* \brief Creates a new autoreleased XMPPPresence with the specified ID.
@ -50,7 +50,7 @@
* \param ID The value for the stanza's id attribute
* \return A new autoreleased XMPPPresence
*/
+ presenceWithID: (OFString*)ID;
+ (instancetype)presenceWithID: (OFString*)ID;
/**
* \brief Creates a new autoreleased XMPPPresence with the specified type.
@ -58,7 +58,7 @@
* \param type The value for the stanza's type attribute
* \return A new autoreleased XMPPPresence
*/
+ presenceWithType: (OFString*)type;
+ (instancetype)presenceWithType: (OFString*)type;
/**
* \brief Creates a new autoreleased XMPPPresence with the specified type and
@ -68,7 +68,7 @@
* \param ID The value for the stanza's id attribute
* \return A new autoreleased XMPPPresence
*/
+ presenceWithType: (OFString*)type
+ (instancetype)presenceWithType: (OFString*)type
ID: (OFString*)ID;
/**

View file

@ -43,22 +43,22 @@ static int show_to_int(OFString *show)
}
@implementation XMPPPresence
+ presence
+ (instancetype)presence
{
return [[[self alloc] init] autorelease];
}
+ presenceWithID: (OFString*)ID
+ (instancetype)presenceWithID: (OFString*)ID
{
return [[[self alloc] initWithID: ID] autorelease];
}
+ presenceWithType: (OFString*)type
+ (instancetype)presenceWithType: (OFString*)type
{
return [[[self alloc] initWithType: type] autorelease];
}
+ presenceWithType: (OFString*)type
+ (instancetype)presenceWithType: (OFString*)type
ID: (OFString*)ID
{
return [[[self alloc] initWithType: type

View file

@ -51,7 +51,7 @@
*
* \return A new autoreleased roster item.
*/
+ rosterItem;
+ (instancetype)rosterItem;
- (void)setJID: (XMPPJID*)JID;
- (XMPPJID*)JID;

View file

@ -30,7 +30,7 @@
#import <ObjFW/macros.h>
@implementation XMPPRosterItem
+ rosterItem
+ (instancetype)rosterItem
{
return [[[self alloc] init] autorelease];
}

View file

@ -49,7 +49,7 @@
* \param plusAvailable Whether the PLUS variant was offered
* \return A new autoreleased XMPPSCRAMAuth
*/
+ SCRAMAuthWithAuthcid: (OFString*)authcid
+ (instancetype)SCRAMAuthWithAuthcid: (OFString*)authcid
password: (OFString*)password
connection: (XMPPConnection*)connection
hash: (Class)hash
@ -67,7 +67,7 @@
* \param plusAvailable Whether the PLUS variant was offered
* \return A new autoreleased XMPPSCRAMAuth
*/
+ SCRAMAuthWithAuthzid: (OFString*)authzid
+ (instancetype)SCRAMAuthWithAuthzid: (OFString*)authzid
authcid: (OFString*)authcid
password: (OFString*)password
connection: (XMPPConnection*)connection

View file

@ -38,7 +38,7 @@
#define HMAC_OPAD 0x5c
@implementation XMPPSCRAMAuth
+ SCRAMAuthWithAuthcid: (OFString*)authcid
+ (instancetype)SCRAMAuthWithAuthcid: (OFString*)authcid
password: (OFString*)password
connection: (XMPPConnection*)connection
hash: (Class)hash
@ -51,7 +51,7 @@
plusAvailable: plusAvailable] autorelease];
}
+ SCRAMAuthWithAuthzid: (OFString*)authzid
+ (instancetype)SCRAMAuthWithAuthzid: (OFString*)authzid
authcid: (OFString*)authcid
password: (OFString*)password
connection: (XMPPConnection*)connection

View file

@ -43,11 +43,11 @@
@property (readonly, copy) OFString *target;
#endif
+ entryWithPriority: (uint16_t)priority
+ (instancetype)entryWithPriority: (uint16_t)priority
weight: (uint16_t)weight
port: (uint16_t)port
target: (OFString*)target;
+ entryWithResourceRecord: (ns_rr)resourceRecord
+ (instancetype)entryWithResourceRecord: (ns_rr)resourceRecord
handle: (ns_msg)handle;
- initWithPriority: (uint16_t)priority
weight: (uint16_t)weight
@ -74,7 +74,7 @@
@property (readonly, copy) OFString *domain;
#endif
+ lookupWithDomain: (OFString*)domain;
+ (instancetype)lookupWithDomain: (OFString*)domain;
- initWithDomain: (OFString*)domain;
- (void)XMPP_lookup;

View file

@ -37,7 +37,7 @@
#import "XMPPSRVLookup.h"
@implementation XMPPSRVEntry
+ entryWithPriority: (uint16_t)priority
+ (instancetype)entryWithPriority: (uint16_t)priority
weight: (uint16_t)weight
port: (uint16_t)port
target: (OFString*)target
@ -48,7 +48,7 @@
target: target] autorelease];
}
+ entryWithResourceRecord: (ns_rr)resourceRecord
+ (instancetype)entryWithResourceRecord: (ns_rr)resourceRecord
handle: (ns_msg)handle
{
return [[[self alloc] initWithResourceRecord: resourceRecord
@ -163,7 +163,7 @@
@end
@implementation XMPPSRVLookup
+ lookupWithDomain: (OFString*)domain
+ (instancetype)lookupWithDomain: (OFString*)domain
{
return [[[self alloc] initWithDomain: domain] autorelease];
}

View file

@ -52,7 +52,7 @@
* \param name The stanza's name (one of iq, message or presence)
* \return A new autoreleased XMPPStanza
*/
+ stanzaWithName: (OFString*)name;
+ (instancetype)stanzaWithName: (OFString*)name;
/**
* \brief Creates a new autoreleased XMPPStanza with the specified name and
@ -62,7 +62,7 @@
* \param type The value for the stanza's type attribute
* \return A new autoreleased XMPPStanza
*/
+ stanzaWithName: (OFString*)name
+ (instancetype)stanzaWithName: (OFString*)name
type: (OFString*)type;
/**
@ -72,7 +72,7 @@
* \param ID The value for the stanza's id attribute
* \return A new autoreleased XMPPStanza
*/
+ stanzaWithName: (OFString*)name
+ (instancetype)stanzaWithName: (OFString*)name
ID: (OFString*)ID;
/**
@ -84,7 +84,7 @@
* \param ID The value for the stanza's id attribute
* \return A new autoreleased XMPPStanza
*/
+ stanzaWithName: (OFString*)name
+ (instancetype)stanzaWithName: (OFString*)name
type: (OFString*)type
ID: (OFString*)ID;
@ -94,7 +94,7 @@
* \param element The element to base the XMPPStanza on
* \return A new autoreleased XMPPStanza
*/
+ stanzaWithElement: (OFXMLElement*)element;
+ (instancetype)stanzaWithElement: (OFXMLElement*)element;
/**
* \brief Initializes an already allocated XMPPStanza with the specified name.

View file

@ -30,26 +30,26 @@
#import "namespaces.h"
@implementation XMPPStanza
+ stanzaWithName: (OFString*)name
+ (instancetype)stanzaWithName: (OFString*)name
{
return [[[self alloc] initWithName: name] autorelease];
}
+ stanzaWithName: (OFString*)name
+ (instancetype)stanzaWithName: (OFString*)name
type: (OFString*)type
{
return [[[self alloc] initWithName: name
type: type] autorelease];
}
+ stanzaWithName: (OFString*)name
+ (instancetype)stanzaWithName: (OFString*)name
ID: (OFString*)ID
{
return [[[self alloc] initWithName: name
ID: ID] autorelease];
}
+ stanzaWithName: (OFString*)name
+ (instancetype)stanzaWithName: (OFString*)name
type: (OFString*)type
ID: (OFString*)ID
{
@ -58,7 +58,7 @@
ID: ID] autorelease];
}
+ stanzaWithElement: (OFXMLElement*)element
+ (instancetype)stanzaWithElement: (OFXMLElement*)element
{
return [[[self alloc] initWithElement: element] autorelease];
}