@@ -15,14 +15,16 @@ */ #import "OFXMLNode.h" @class OFString; -@class OFArray; @class OFMutableString; -@class OFMutableArray; -@class OFMutableDictionary; +#ifndef DOXYGEN +@class OFArray OF_GENERIC(ObjectType); +@class OFMutableArray OF_GENERIC(ObjectType); +@class OFMutableDictionary OF_GENERIC(KeyType, ObjectType); +#endif @class OFXMLAttribute; /*! * @class OFXMLElement OFXMLElement.h ObjFW/OFXMLElement.h * @@ -29,13 +31,13 @@ * @brief A class which stores an XML element. */ @interface OFXMLElement: OFXMLNode { OFString *_name, *_namespace, *_defaultNamespace; - OFMutableArray *_attributes; - OFMutableDictionary *_namespaces; - OFMutableArray *_children; + OFMutableArray OF_GENERIC(OFXMLAttribute*) *_attributes; + OFMutableDictionary OF_GENERIC(OFString*, OFString*) *_namespaces; + OFMutableArray OF_GENERIC(OFXMLNode*) *_children; } #ifdef OF_HAVE_PROPERTIES @property (copy) OFString *name; # ifdef __cplusplus @@ -42,12 +44,12 @@ @property (copy, getter=namespace, setter=setNamespace:) OFString *namespace_; # else @property (copy) OFString *namespace; # endif @property (copy) OFString *defaultNamespace; -@property (readonly, copy) OFArray *attributes; -@property (copy) OFArray *children; +@property (readonly, copy) OFArray OF_GENERIC(OFXMLAttribute*) *attributes; +@property (copy) OFArray OF_GENERIC(OFXMLNode*) *children; #endif /*! * @brief Creates a new XML element with the specified name. * @@ -227,25 +229,25 @@ /*! * @brief Returns an OFArray with the attributes of the element. * * @return An OFArray with the attributes of the element */ -- (OFArray*)attributes; +- (OFArray OF_GENERIC(OFXMLAttribute*)*)attributes; /*! * @brief Removes all children and adds the children from the specified array. * * @param children The new children to add */ -- (void)setChildren: (OFArray*)children; +- (void)setChildren: (OFArray OF_GENERIC(OFXMLNode*)*)children; /*! * @brief Returns an array of OFXMLNodes with all children of the element. * * @return An array of OFXMLNodes with all children of the element */ -- (OFArray*)children; +- (OFArray OF_GENERIC(OFXMLNode*)*)children; /*! * @brief Adds the specified attribute. * * If an attribute with the same name and namespace already exists, it is not @@ -362,11 +364,11 @@ * @brief Inserts the specified children at the specified index. * * @param children An array of OFXMLNodes which are added as children * @param index The index where the child is added */ -- (void)insertChildren: (OFArray*)children +- (void)insertChildren: (OFArray OF_GENERIC(OFXMLNode*)*)children atIndex: (size_t)index; /*! * @brief Removes the first child that is equal to the specified OFXMLNode. * @@ -403,18 +405,19 @@ /*! * @brief Returns all children that are elements. * * @return All children that are elements */ -- (OFArray*)elements; +- (OFArray OF_GENERIC(OFXMLElement*)*)elements; /*! * @brief Returns all children that have the specified namespace. * * @return All children that have the specified namespace */ -- (OFArray*)elementsForNamespace: (OFString*)elementNS; +- (OFArray OF_GENERIC(OFXMLElement*)*)elementsForNamespace: + (OFString*)elementNS; /*! * @brief Returns the first child element with the specified name. * * @param elementName The name of the element @@ -426,11 +429,11 @@ * @brief Returns the child elements with the specified name. * * @param elementName The name of the elements * @return The child elements with the specified name */ -- (OFArray*)elementsForName: (OFString*)elementName; +- (OFArray OF_GENERIC(OFXMLElement*)*)elementsForName: (OFString*)elementName; /*! * @brief Returns the first child element with the specified name and namespace. * * @param elementName The name of the element @@ -445,10 +448,10 @@ * * @param elementName The name of the elements * @param elementNS The namespace of the elements * @return The child elements with the specified name and namespace */ -- (OFArray*)elementsForName: (OFString*)elementName - namespace: (OFString*)elementNS; +- (OFArray OF_GENERIC(OFXMLElement*)*)elementsForName: (OFString*)elementName + namespace: (OFString*)elementNS; @end #import "OFXMLElement+Serialization.h"