Template object for SubscriptionRequest.
This commit is contained in:
parent
c90d6492e8
commit
fe778cfd00
@ -9,57 +9,19 @@
|
|||||||
*
|
*
|
||||||
* \brief UpnpSubscriptionRequest object declararion.
|
* \brief UpnpSubscriptionRequest object declararion.
|
||||||
*
|
*
|
||||||
|
* Returned along with a \b UPNP_EVENT_SUBSCRIPTION_REQUEST callback.
|
||||||
|
*
|
||||||
* \author Marcelo Roberto Jimenez
|
* \author Marcelo Roberto Jimenez
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define CLASS UpnpSubscriptionRequest
|
||||||
|
|
||||||
/*! Returned along with a \b UPNP_EVENT_SUBSCRIPTION_REQUEST callback. */
|
#define EXPAND_CLASS_MEMBERS(CLASS) \
|
||||||
typedef struct s_UpnpSubscriptionRequest UpnpSubscriptionRequest;
|
EXPAND_CLASS_MEMBER_STRING(CLASS, ServiceId) \
|
||||||
|
EXPAND_CLASS_MEMBER_STRING(CLASS, UDN) \
|
||||||
|
EXPAND_CLASS_MEMBER_STRING(CLASS, SID) \
|
||||||
|
|
||||||
|
#include "TemplateInclude.h"
|
||||||
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
|
|
||||||
#include "UpnpString.h"
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
/*! Constructor */
|
|
||||||
EXPORT_SPEC UpnpSubscriptionRequest *UpnpSubscriptionRequest_new();
|
|
||||||
|
|
||||||
/*! Destructor */
|
|
||||||
EXPORT_SPEC void UpnpSubscriptionRequest_delete(UpnpSubscriptionRequest *p);
|
|
||||||
|
|
||||||
/*! Copy Constructor */
|
|
||||||
EXPORT_SPEC UpnpSubscriptionRequest *UpnpSubscriptionRequest_dup(const UpnpSubscriptionRequest *p);
|
|
||||||
|
|
||||||
/*! Assignment operator */
|
|
||||||
EXPORT_SPEC void UpnpSubscriptionRequest_assign(UpnpSubscriptionRequest *p, const UpnpSubscriptionRequest *q);
|
|
||||||
|
|
||||||
/*! The identifier for the service being subscribed to. */
|
|
||||||
EXPORT_SPEC const UpnpString *UpnpSubscriptionRequest_get_ServiceId(const UpnpSubscriptionRequest *p);
|
|
||||||
EXPORT_SPEC const char *UpnpSubscriptionRequest_get_ServiceId_cstr(const UpnpSubscriptionRequest *p);
|
|
||||||
EXPORT_SPEC void UpnpSubscriptionRequest_set_ServiceId(UpnpSubscriptionRequest *p, const UpnpString *s);
|
|
||||||
EXPORT_SPEC void UpnpSubscriptionRequest_strcpy_ServiceId(UpnpSubscriptionRequest *p, const char *s);
|
|
||||||
|
|
||||||
/*! Universal device name. */
|
|
||||||
EXPORT_SPEC const UpnpString *UpnpSubscriptionRequest_get_UDN(const UpnpSubscriptionRequest *p);
|
|
||||||
EXPORT_SPEC const char *UpnpSubscriptionRequest_get_UDN_cstr(const UpnpSubscriptionRequest *p);
|
|
||||||
EXPORT_SPEC void UpnpSubscriptionRequest_set_UDN(UpnpSubscriptionRequest *p, const UpnpString *s);
|
|
||||||
EXPORT_SPEC void UpnpSubscriptionRequest_strcpy_UDN(UpnpSubscriptionRequest *p, const char *s);
|
|
||||||
|
|
||||||
/*! The assigned subscription ID for this subscription. */
|
|
||||||
EXPORT_SPEC const UpnpString *UpnpSubscriptionRequest_get_SID(const UpnpSubscriptionRequest *p);
|
|
||||||
EXPORT_SPEC const char *UpnpSubscriptionRequest_get_SID_cstr(const UpnpSubscriptionRequest *p);
|
|
||||||
EXPORT_SPEC void UpnpSubscriptionRequest_set_SID(UpnpSubscriptionRequest *p, const UpnpString *s);
|
|
||||||
EXPORT_SPEC void UpnpSubscriptionRequest_strcpy_SID(UpnpSubscriptionRequest *p, const char *s);
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* SUBSCRIPTIONREQUEST_H */
|
#endif /* SUBSCRIPTIONREQUEST_H */
|
||||||
|
@ -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 "SubscriptionRequest.h"
|
#include "SubscriptionRequest.h"
|
||||||
|
|
||||||
|
|
||||||
#include <stdlib.h> /* for calloc(), free() */
|
|
||||||
#include <string.h> /* for memset(), strlen(), strdup() */
|
|
||||||
|
|
||||||
|
|
||||||
struct SUpnpSubscriptionRequest
|
|
||||||
{
|
|
||||||
UpnpString *m_serviceId;
|
|
||||||
UpnpString *m_UDN;
|
|
||||||
UpnpString *m_SID;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
UpnpSubscriptionRequest *UpnpSubscriptionRequest_new()
|
|
||||||
{
|
|
||||||
struct SUpnpSubscriptionRequest *p = calloc(1, sizeof (struct SUpnpSubscriptionRequest));
|
|
||||||
|
|
||||||
p->m_serviceId = UpnpString_new();
|
|
||||||
p->m_UDN = UpnpString_new();
|
|
||||||
p->m_SID = UpnpString_new();
|
|
||||||
|
|
||||||
return (UpnpSubscriptionRequest *)p;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpSubscriptionRequest_delete(UpnpSubscriptionRequest *p)
|
|
||||||
{
|
|
||||||
struct SUpnpSubscriptionRequest *q = (struct SUpnpSubscriptionRequest *)p;
|
|
||||||
|
|
||||||
if (!q) return;
|
|
||||||
|
|
||||||
UpnpString_delete(q->m_serviceId);
|
|
||||||
q->m_serviceId = NULL;
|
|
||||||
|
|
||||||
UpnpString_delete(q->m_UDN);
|
|
||||||
q->m_UDN = NULL;
|
|
||||||
|
|
||||||
UpnpString_delete(q->m_SID);
|
|
||||||
q->m_SID = NULL;
|
|
||||||
|
|
||||||
free(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
UpnpSubscriptionRequest *UpnpSubscriptionRequest_dup(const UpnpSubscriptionRequest *p)
|
|
||||||
{
|
|
||||||
UpnpSubscriptionRequest *q = UpnpSubscriptionRequest_new();
|
|
||||||
|
|
||||||
UpnpSubscriptionRequest_assign(q, p);
|
|
||||||
|
|
||||||
return q;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpSubscriptionRequest_assign(UpnpSubscriptionRequest *p, const UpnpSubscriptionRequest *q)
|
|
||||||
{
|
|
||||||
if (p != q) {
|
|
||||||
UpnpSubscriptionRequest_set_ServiceId(p, UpnpSubscriptionRequest_get_ServiceId(q));
|
|
||||||
UpnpSubscriptionRequest_set_UDN(p, UpnpSubscriptionRequest_get_UDN(q));
|
|
||||||
UpnpSubscriptionRequest_set_SID(p, UpnpSubscriptionRequest_get_SID(q));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const UpnpString *UpnpSubscriptionRequest_get_ServiceId(const UpnpSubscriptionRequest *p)
|
|
||||||
{
|
|
||||||
return ((struct SUpnpSubscriptionRequest *)p)->m_serviceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *UpnpSubscriptionRequest_get_ServiceId_cstr(const UpnpSubscriptionRequest *p)
|
|
||||||
{
|
|
||||||
return UpnpString_get_String(UpnpSubscriptionRequest_get_ServiceId(p));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpSubscriptionRequest_set_ServiceId(UpnpSubscriptionRequest *p, const UpnpString *s)
|
|
||||||
{
|
|
||||||
UpnpString_delete(((struct SUpnpSubscriptionRequest *)p)->m_serviceId);
|
|
||||||
((struct SUpnpSubscriptionRequest *)p)->m_serviceId = UpnpString_dup(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpSubscriptionRequest_strcpy_ServiceId(UpnpSubscriptionRequest *p, const char *s)
|
|
||||||
{
|
|
||||||
UpnpString_delete(((struct SUpnpSubscriptionRequest *)p)->m_serviceId);
|
|
||||||
((struct SUpnpSubscriptionRequest *)p)->m_serviceId = UpnpString_new();
|
|
||||||
UpnpString_set_String(((struct SUpnpSubscriptionRequest *)p)->m_serviceId, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const UpnpString *UpnpSubscriptionRequest_get_UDN(const UpnpSubscriptionRequest *p)
|
|
||||||
{
|
|
||||||
return ((struct SUpnpSubscriptionRequest *)p)->m_UDN;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *UpnpSubscriptionRequest_get_UDN_cstr(const UpnpSubscriptionRequest *p)
|
|
||||||
{
|
|
||||||
return UpnpString_get_String(UpnpSubscriptionRequest_get_UDN(p));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpSubscriptionRequest_set_UDN(UpnpSubscriptionRequest *p, const UpnpString *s)
|
|
||||||
{
|
|
||||||
UpnpString_delete(((struct SUpnpSubscriptionRequest *)p)->m_UDN);
|
|
||||||
((struct SUpnpSubscriptionRequest *)p)->m_UDN = UpnpString_dup(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpSubscriptionRequest_strcpy_UDN(UpnpSubscriptionRequest *p, const char *s)
|
|
||||||
{
|
|
||||||
UpnpString_delete(((struct SUpnpSubscriptionRequest *)p)->m_UDN);
|
|
||||||
((struct SUpnpSubscriptionRequest *)p)->m_UDN = UpnpString_new();
|
|
||||||
UpnpString_set_String(((struct SUpnpSubscriptionRequest *)p)->m_UDN, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const UpnpString *UpnpSubscriptionRequest_get_SID(const UpnpSubscriptionRequest *p)
|
|
||||||
{
|
|
||||||
return ((struct SUpnpSubscriptionRequest *)p)->m_SID;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *UpnpSubscriptionRequest_get_SID_cstr(const UpnpSubscriptionRequest *p)
|
|
||||||
{
|
|
||||||
return UpnpString_get_String(UpnpSubscriptionRequest_get_SID(p));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpSubscriptionRequest_set_SID(UpnpSubscriptionRequest *p, const UpnpString *s)
|
|
||||||
{
|
|
||||||
UpnpString_delete(((struct SUpnpSubscriptionRequest *)p)->m_SID);
|
|
||||||
((struct SUpnpSubscriptionRequest *)p)->m_SID = UpnpString_dup(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpSubscriptionRequest_strcpy_SID(UpnpSubscriptionRequest *p, const char *s)
|
|
||||||
{
|
|
||||||
UpnpString_delete(((struct SUpnpSubscriptionRequest *)p)->m_SID);
|
|
||||||
((struct SUpnpSubscriptionRequest *)p)->m_SID = UpnpString_new();
|
|
||||||
UpnpString_set_String(((struct SUpnpSubscriptionRequest *)p)->m_SID, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user