Coconut XML Framework  beta
CNXMLObject.h
Go to the documentation of this file.
00001 
00008 #ifndef CNXMLOBJECT_H
00009 #define CNXMLOBJECT_H
00010 
00011 #include <Coconut/Coconut.h>
00012 #include "CNXMLForwarders.h"
00013 
00015 typedef xmlNodePtr (*CNEncodeObjectFuncRef)(const struct CNXMLObject * src) ;
00016 
00018 struct CNXMLObjectMethods
00019 {
00021         struct CNObjectMethods                  superClass ;
00023         CNEncodeObjectFuncRef                   encodeFuncRef ;
00024 } ;
00025 
00029 struct CNXMLObject
00030 {
00032         struct CNObject                                 superClass ;
00033 } ;
00034 
00043 static inline struct CNXMLObject *
00044 CNAllocateXMLObject(size_t size, const struct CNXMLObjectMethods * methods, struct CNResource * resource)
00045 {
00046         struct CNXMLObject * newobject ;
00047         newobject = (struct CNXMLObject *) CNAllocateObject(size, &(methods->superClass), resource) ;
00048         if(newobject){
00049                 /* init members */
00050         }
00051         return newobject ;
00052 }
00053 
00058 static inline void
00059 CNRetainXMLObject(struct CNXMLObject * dst)
00060 {
00061         CNRetainObject(&(dst->superClass)) ;
00062 }
00063 
00068 static inline void
00069 CNReleaseXMLObject(struct CNXMLObject * dst)
00070 {
00071         CNReleaseObject(&(dst->superClass)) ;
00072 }
00073 
00079 static inline xmlNodePtr
00080 CNEncodeXMLObject(const struct CNXMLObject * src)
00081 {
00082         struct CNXMLObjectMethods * methods ;
00083         methods = (struct CNXMLObjectMethods *) CNMethodsOfObject(&(src->superClass)) ;
00084         CNEncodeObjectFuncRef encodefunc = methods->encodeFuncRef ;
00085         return (*encodefunc)(src) ;
00086 }
00087 
00088 #endif  /* CNXMLOBJECT_H */
00089