Template object for ActionComplete.

This commit is contained in:
Marcelo Roberto Jimenez 2010-09-11 16:45:50 -03:00
parent cf79479b2b
commit c7475fab70
2 changed files with 9 additions and 299 deletions

View File

@ -1,5 +1,4 @@
#ifndef ACTIONCOMPLETE_H #ifndef ACTIONCOMPLETE_H
#define ACTIONCOMPLETE_H #define ACTIONCOMPLETE_H
@ -7,166 +6,20 @@
/*! /*!
* \file * \file
* *
* \brief UpnpActionComplete object declararion. * \brief UpnpActionComplete object declarartion.
* *
* \author Marcelo Roberto Jimenez * \author Marcelo Roberto Jimenez
*/ */
#define CLASS UpnpActionComplete
/*! #define EXPAND_CLASS_MEMBERS(CLASS) \
* \brief The type of an UpnpActionComplete object. EXPAND_CLASS_MEMBER_INT(CLASS, ErrCode, int) \
*/ EXPAND_CLASS_MEMBER_STRING(CLASS, CtrlUrl) \
typedef struct s_UpnpActionComplete UpnpActionComplete; EXPAND_CLASS_MEMBER_INT(CLASS, ActionRequest, IXML_Document *) \
EXPAND_CLASS_MEMBER_INT(CLASS, ActionResult, IXML_Document *) \
#include "TemplateInclude.h"
#include "ixml.h" /* for IXML_Document */
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
#include "UpnpString.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*!
* \brief Constructor.
*
* \return Pointer to the newly created object.
*/
EXPORT_SPEC UpnpActionComplete *UpnpActionComplete_new();
/*!
* \brief Destructor.
*/
EXPORT_SPEC void UpnpActionComplete_delete(
/*! [in] \b this pointer. */
UpnpActionComplete *p);
/*!
* \brief Copy Constructor.
*/
EXPORT_SPEC UpnpActionComplete *UpnpActionComplete_dup(
/*! [in] \b this pointer. */
const UpnpActionComplete *p);
/*!
* \brief Assignment operator.
*/
EXPORT_SPEC void UpnpActionComplete_assign(
/*! [in] \b this pointer. */
UpnpActionComplete *p,
/*! [in] \b that pointer. */
const UpnpActionComplete *q);
/*!
* \brief Error code getter.
*/
EXPORT_SPEC int UpnpActionComplete_get_ErrCode(
/*! [in] \b this pointer. */
const UpnpActionComplete *p);
/*!
* \brief Error code setter.
*/
EXPORT_SPEC void UpnpActionComplete_set_ErrCode(
/*! [in] \b this pointer. */
UpnpActionComplete *p,
/*! [in] The error code to set. */
int n);
/*!
* \brief Control URL getter.
*
* \return The control URL string.
*/
EXPORT_SPEC const UpnpString *UpnpActionComplete_get_CtrlUrl(
/*! [in] \b this pointer. */
const UpnpActionComplete *p);
/*!
* \brief Control URL getter as a C string
*
* \return The control URL string.
*/
EXPORT_SPEC const char *UpnpActionComplete_get_CtrlUrl_cstr(
/*! [in] \b this pointer. */
const UpnpActionComplete *p);
/*!
* \brief Control URL setter.
*/
EXPORT_SPEC void UpnpActionComplete_set_CtrlUrl(
/*! [in] \b this pointer. */
UpnpActionComplete *p,
/*! [in] The control URL string to copy. */
const UpnpString *s);
/*!
* \brief Set the control URL from a null terminated C string.
*/
EXPORT_SPEC void UpnpActionComplete_strcpy_CtrlUrl(
/*! [in] \b this pointer. */
UpnpActionComplete *p,
/*! [in] The null terminated control URL C string to copy. */
const char *s);
/*!
* \brief ActionRequest document getter.
*
* \return A pointer to the document object.
*/
EXPORT_SPEC IXML_Document *UpnpActionComplete_get_ActionRequest(
/*! [in] \b this pointer. */
const UpnpActionComplete *p);
/*!
* \brief ActionRequest document setter.
*
* \note The ActionComplete object takes ownership of the document parameter,
* i.e. it is responsible for deleting it upon destruction.
*/
EXPORT_SPEC void UpnpActionComplete_set_ActionRequest(
/*! [in] \b this pointer. */
UpnpActionComplete *p,
/*! [in] Document to copy. */
IXML_Document *d);
/*!
* \brief ActionResult document getter.
*/
EXPORT_SPEC IXML_Document *UpnpActionComplete_get_ActionResult(
/*! [in] \b this pointer. */
const UpnpActionComplete *p);
/*!
* \brief ActionResult document setter.
*
* \note The ActionComplete object takes ownership of the document parameter,
* i.e. it is responsible for deleting it upon destruction.
*/
EXPORT_SPEC void UpnpActionComplete_set_ActionResult(
/*! [in] \b this pointer. */
UpnpActionComplete *p,
/*! [in] Document to copy. */
IXML_Document *d);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* ACTIONCOMPLETE_H */ #endif /* ACTIONCOMPLETE_H */

View File

@ -1,5 +1,4 @@
/*! /*!
* \file * \file
* *
@ -8,150 +7,8 @@
* \author Marcelo Roberto Jimenez * \author Marcelo Roberto Jimenez
*/ */
#include "config.h" #include "config.h"
#define TEMPLATE_GENERATE_SOURCE
#include "ActionComplete.h" #include "ActionComplete.h"
#include <stdlib.h> /* for calloc(), free() */
#include <string.h> /* for strlen(), strdup() */
/*!
* \brief Internal implementation of the UpnpActionComplete object.
*/
struct SUpnpActionComplete
{
/*! The result of the operation */
int m_errCode;
/*! The control URL for service. */
UpnpString *m_ctrlUrl;
/*! The DOM document describing the action. */
IXML_Document *m_actionRequest;
/*! The DOM document describing the result of the action */
IXML_Document *m_actionResult;
};
UpnpActionComplete *UpnpActionComplete_new()
{
struct SUpnpActionComplete *p = calloc(1, sizeof (struct SUpnpActionComplete));
#if 0
p->m_errCode = 0;
#endif
p->m_ctrlUrl = UpnpString_new();
#if 0
p->m_actionRequest = NULL;
p->m_actionResult = NULL;
#endif
return (UpnpActionComplete *)p;
}
void UpnpActionComplete_delete(UpnpActionComplete *p)
{
struct SUpnpActionComplete *q = (struct SUpnpActionComplete *)p;
if (!q) return;
q->m_errCode = 0;
UpnpString_delete(q->m_ctrlUrl);
q->m_ctrlUrl = NULL;
UpnpActionComplete_set_ActionRequest(p, NULL);
UpnpActionComplete_set_ActionResult(p, NULL);
free(p);
}
UpnpActionComplete *UpnpActionComplete_dup(const UpnpActionComplete *p)
{
UpnpActionComplete *q = UpnpActionComplete_new();
UpnpActionComplete_assign(q, p);
return q;
}
void UpnpActionComplete_assign(UpnpActionComplete *p, const UpnpActionComplete *q)
{
if (p != q) {
UpnpActionComplete_set_ErrCode(p, UpnpActionComplete_get_ErrCode(q));
UpnpActionComplete_set_CtrlUrl(p, UpnpActionComplete_get_CtrlUrl(q));
UpnpActionComplete_set_ActionRequest(p, UpnpActionComplete_get_ActionRequest(q));
UpnpActionComplete_set_ActionResult(p, UpnpActionComplete_get_ActionResult(q));
}
}
int UpnpActionComplete_get_ErrCode(const UpnpActionComplete *p)
{
return ((struct SUpnpActionComplete *)p)->m_errCode;
}
void UpnpActionComplete_set_ErrCode(UpnpActionComplete *p, int n)
{
((struct SUpnpActionComplete *)p)->m_errCode = n;
}
const UpnpString *UpnpActionComplete_get_CtrlUrl(const UpnpActionComplete *p)
{
return ((struct SUpnpActionComplete *)p)->m_ctrlUrl;
}
const char *UpnpActionComplete_get_CtrlUrl_cstr(const UpnpActionComplete *p)
{
return UpnpString_get_String(UpnpActionComplete_get_CtrlUrl(p));
}
void UpnpActionComplete_set_CtrlUrl(UpnpActionComplete *p, const UpnpString *s)
{
UpnpString_delete(((struct SUpnpActionComplete *)p)->m_ctrlUrl);
((struct SUpnpActionComplete *)p)->m_ctrlUrl = UpnpString_dup(s);
}
void UpnpActionComplete_strcpy_CtrlUrl(UpnpActionComplete *p, const char *s)
{
UpnpString_delete(((struct SUpnpActionComplete *)p)->m_ctrlUrl);
((struct SUpnpActionComplete *)p)->m_ctrlUrl = UpnpString_new();
UpnpString_set_String(((struct SUpnpActionComplete *)p)->m_ctrlUrl, s);
}
IXML_Document *UpnpActionComplete_get_ActionRequest(const UpnpActionComplete *p)
{
return ((struct SUpnpActionComplete *)p)->m_actionRequest;
}
void UpnpActionComplete_set_ActionRequest(UpnpActionComplete *p, IXML_Document *d)
{
ixmlDocument_free(((struct SUpnpActionComplete *)p)->m_actionRequest);
((struct SUpnpActionComplete *)p)->m_actionRequest = d;
}
IXML_Document *UpnpActionComplete_get_ActionResult(const UpnpActionComplete *p)
{
return ((struct SUpnpActionComplete *)p)->m_actionResult;
}
void UpnpActionComplete_set_ActionResult(UpnpActionComplete *p, IXML_Document *d)
{
ixmlDocument_free(((struct SUpnpActionComplete *)p)->m_actionResult);
((struct SUpnpActionComplete *)p)->m_actionResult = d;
}