@@ -374,20 +374,10 @@ * * \return A description for the class, which is usually the class name */ + (OFString*)description; -/** - * \brief Replaces a class method implementation with another implementation. - * - * \param newImp The new implementation for the class method - * \param selector The selector of the class method to replace - * \return The old implementation - */ -+ (IMP)setImplementation: (IMP)newImp - forClassMethod: (SEL)selector; - /** * \brief Replaces a class method with a class method from another class. * * \param selector The selector of the class method to replace * \param class_ The class from which the new class method should be taken @@ -394,21 +384,10 @@ * \return The old implementation */ + (IMP)replaceClassMethod: (SEL)selector withMethodFromClass: (Class)class_; -/** - * \brief Replaces an instance method implementation with another - * implementation. - * - * \param newImp The new implementation for the instance method - * \param selector The selector of the instance method to replace - * \return The old implementation - */ -+ (IMP)setImplementation: (IMP)newImp - forInstanceMethod: (SEL)selector; - /** * \brief Replaces an instance method with an instance method from another * class. * * \param selector The selector of the instance method to replace @@ -417,40 +396,40 @@ */ + (IMP)replaceInstanceMethod: (SEL)selector withMethodFromClass: (Class)class_; /** - * \brief Adds a class method to the class. - * - * If the method already exists, nothing is done and NO is returned. If you want - * to change the implementation of a method, use - * setImplementation:forClassMethod:. - * - * \param selector The selector for the new method - * \param typeEncoding The type encoding for the new method - * \param implementation The implementation for the new method - * \return Whether the method has been added - */ -+ (BOOL)addClassMethod: (SEL)selector - withTypeEncoding: (const char*)typeEncoding - implementation: (IMP)implementation; - -/** - * \brief Adds an instance method to the class. - * - * If the method already exists, nothing is done and NO is returned. If you want - * to change the implementation of a method, use - * setImplementation:forInstanceMethod:. - * - * \param selector The selector for the new method - * \param typeEncoding The type encoding for the new method - * \param implementation The implementation for the new method - * \return Whether the method has been added - */ -+ (BOOL)addInstanceMethod: (SEL)selector - withTypeEncoding: (const char*)typeEncoding - implementation: (IMP)implementation; + * \brief Replaces or adds a class method. + * + * If the method already exists, it is replaced and the old implementation + * returned. If the method does not exist, it is added with the specified type + * encoding. + * + * \param selector The selector for the new method + * \param implementation The implementation for the new method + * \param typeEncoding The type encoding for the new method + * \return The old implementation or nil if the method was added + */ ++ (IMP)replaceClassMethod: (SEL)selector + withImplementation: (IMP)implementation + typeEncoding: (const char*)typeEncoding; + +/** + * \brief Replaces or adds an instance method. + * + * If the method already exists, it is replaced and the old implementation + * returned. If the method does not exist, it is added with the specified type + * encoding. + * + * \param selector The selector for the new method + * \param implementation The implementation for the new method + * \param typeEncoding The type encoding for the new method + * \return The old implementation or nil if the method was added + */ ++ (IMP)replaceInstanceMethod: (SEL)selector + withImplementation: (IMP)implementation + typeEncoding: (const char*)typeEncoding; /** * \brief Adds all methods from the specified class to the class that is the * receiver. *