@@ -8,10 +8,11 @@ * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #import "OFObject.h" +#import "OFString.h" /** * An exception indicating an object could not be allocated. * * This exception is preallocated, as if there's no memory, no exception can @@ -29,24 +30,24 @@ } + (Class)class; /** - * \return An error message for the exception as a C string + * \return An error message for the exception as a string */ -- (const char*)cString; +- (OFString*)string; @end /** * The OFException class is the base class for all exceptions in ObjFW. * * IMPORTANT: Exceptions do NOT use OFAutoreleasePools!! */ @interface OFException: OFObject { - Class class; - char *string; + Class class; + OFString *string; } /** * Creates a new exception. * @@ -67,13 +68,13 @@ * \return The class of the object in which the exception happened */ - (Class)inClass; /** - * \return An error message for the exception as a C string + * \return An error message for the exception as a string */ -- (const char*)cString; +- (OFString*)string; @end /** * An OFException indicating there is not enough memory available. */ @@ -219,51 +220,51 @@ /** * An OFException indicating the file couldn't be opened. */ @interface OFOpenFileFailedException: OFException { - char *path; - char *mode; + OFString *path; + OFString *mode; int err; } /** * \param class The class of the object which caused the exception - * \param path A C string of the path to the file tried to open - * \param mode A C string of the mode in which the file should have been opened + * \param path A string of the path to the file tried to open + * \param mode A string of the mode in which the file should have been opened * \return A new open file failed exception */ + newWithClass: (Class)class - andPath: (const char*)path - andMode: (const char*)mode; + andPath: (OFString*)path + andMode: (OFString*)mode; /** * Initializes an already allocated open file failed exception. * * \param class The class of the object which caused the exception - * \param path A C string of the path to the file which couldn't be opened - * \param mode A C string of the mode in which the file should have been opened + * \param path A string of the path to the file which couldn't be opened + * \param mode A string of the mode in which the file should have been opened * \return An initialized open file failed exception */ - initWithClass: (Class)class - andPath: (const char*)path - andMode: (const char*)mode; + andPath: (OFString*)path + andMode: (OFString*)mode; /** * \return The errno from when the exception was created */ - (int)errNo; /** - * \return A C string of the path to the file which couldn't be opened + * \return A string of the path to the file which couldn't be opened */ -- (char*)path; +- (OFString*)path; /** - * \return A C string of the mode in which the file should have been opened + * \return A string of the mode in which the file should have been opened */ -- (char*)mode; +- (OFString*)mode; @end /** * An OFException indicating a read or write to the file failed. */ @@ -365,35 +366,29 @@ * or bound socket. */ @interface OFAlreadyConnectedException: OFException {} @end -/** - * An OFException indicating that the specified port is invalid. - */ -@interface OFInvalidPortException: OFException {} -@end - /** * An OFException indicating the translation of an address failed. */ @interface OFAddressTranslationFailedException: OFException { - char *node; - char *service; - int err; + OFString *node; + OFString *service; + int err; } /** * \param class The class of the object which caused the exception * \param node The node for which translation was requested * \param service The service of the node for which translation was requested * \return A new address translation failed exception */ + newWithClass: (Class)class - andNode: (const char*)node - andService: (const char*)service; + andNode: (OFString*)node + andService: (OFString*)service; /** * Initializes an already allocated address translation failed exception. * * \param class The class of the object which caused the exception @@ -400,128 +395,128 @@ * \param node The node for which translation was requested * \param service The service of the node for which translation was requested * \return An initialized address translation failed exception */ - initWithClass: (Class)class - andNode: (const char*)node - andService: (const char*)service; + andNode: (OFString*)node + andService: (OFString*)service; /** * \return The errno from when the exception was created */ - (int)errNo; /** * /return The node for which translation was requested */ -- (const char*)node; +- (OFString*)node; /** * \return The service of the node for which translation was requested */ -- (const char*)service; +- (OFString*)service; @end /** * An OFException indicating that the connection could not be established. */ @interface OFConnectionFailedException: OFException { - char *host; - uint16_t port; + OFString *node; + OFString *service; int err; } /** * \param class The class of the object which caused the exception - * \param host The host to which the connection failed - * \param port The port on the host to which the connection failed + * \param node The node to which the connection failed + * \param service The service on the node to which the connection failed * \return A new connection failed exception */ + newWithClass: (Class)class - andHost: (const char*)host - andPort: (uint16_t)port; + andNode: (OFString*)node + andService: (OFString*)service; /** * Initializes an already allocated connection failed exception. * * \param class The class of the object which caused the exception - * \param host The host to which the connection failed - * \param port The port on the host to which the connection failed + * \param node The node to which the connection failed + * \param service The service on the node to which the connection failed * \return An initialized connection failed exception */ - initWithClass: (Class)class - andHost: (const char*)host - andPort: (uint16_t)port; + andNode: (OFString*)node + andService: (OFString*)service; /** * \return The errno from when the exception was created */ - (int)errNo; /** - * \return The host to which the connection failed + * \return The node to which the connection failed */ -- (const char*)host; +- (OFString*)node; /** - * \return The port on the host to which the connection failed + * \return The service on the node to which the connection failed */ -- (uint16_t)port; +- (OFString*)service; @end /** * An OFException indicating that binding the socket failed. */ @interface OFBindFailedException: OFException { - char *host; - uint16_t port; + OFString *node; + OFString *service; int family; int err; } /** * \param class The class of the object which caused the exception - * \param host The host on which binding failed - * \param port The port on which binding failed + * \param node The node on which binding failed + * \param service The service on which binding failed * \param family The family for which binnding failed * \return A new bind failed exception */ + newWithClass: (Class)class - andHost: (const char*)host - andPort: (uint16_t)port + andNode: (OFString*)node + andService: (OFString*)service andFamily: (int)family; /** * Initializes an already allocated bind failed exception. * * \param class The class of the object which caused the exception - * \param host The host on which binding failed - * \param port The port on which binding failed + * \param node The node on which binding failed + * \param service The service on which binding failed * \param family The family for which binnding failed * \return An initialized bind failed exception */ - initWithClass: (Class)class - andHost: (const char*)host - andPort: (uint16_t)port + andNode: (OFString*)node + andService: (OFString*)service andFamily: (int)family; /** * \return The errno from when the exception was created */ - (int)errNo; /** - * \return The host on which binding failed + * \return The node on which binding failed */ -- (const char*)host; +- (OFString*)node; /** - * \return The port on which binding failed + * \return The service on which binding failed */ -- (uint16_t)port; +- (OFString*)service; /** * \return The family for which binding failed */ - (int)family;