UPnPsdk 0.1
Universal Plug and Play +, Software Development Kit
 
Loading...
Searching...
No Matches
UpnpEvent.cpp
Go to the documentation of this file.
1// Copyright (C) 2022+ GPL 3 and higher by Ingo Höft, <Ingo@Hoeft-online.de>
2// Redistribution only with this Copyright remark. Last modified: 2024-03-03
3// Also Copyright by other contributor as noted below.
10#include <UpnpEvent.hpp>
11
12#include <stdlib.h> /* for calloc(), free() */
13#include <string.h> /* for strlen(), strdup() */
14
24
26 struct s_UpnpEvent* p = (s_UpnpEvent*)calloc(1, sizeof(struct s_UpnpEvent));
27
28 if (!p)
29 return 0;
30
31 /*p->m_EventKey = 0;*/
32 /*p->m_ChangedVariables = 0;*/
33 p->m_SID = UpnpString_new();
34
35 return (UpnpEvent*)p;
36}
37
39 struct s_UpnpEvent* p = (struct s_UpnpEvent*)q;
40
41 if (!p)
42 return;
43
45 p->m_SID = 0;
46 p->m_ChangedVariables = 0;
47 p->m_EventKey = 0;
48
49 free(p);
50}
51
53 int ok = 1;
54
55 if (p != q) {
59 ok = ok && UpnpEvent_set_SID(p, UpnpEvent_get_SID(q));
60 }
61
62 return ok;
63}
64
67
68 if (!p)
69 return 0;
70
71 UpnpEvent_assign(p, q);
72
73 return p;
74}
75
76int UpnpEvent_get_EventKey(const UpnpEvent* p) { return p->m_EventKey; }
77
79 p->m_EventKey = n;
80
81 return 1;
82}
83
87
89 p->m_ChangedVariables = n;
90
91 return 1;
92}
93
94const UpnpString* UpnpEvent_get_SID(const UpnpEvent* p) { return p->m_SID; }
95
97 const char* q = UpnpString_get_String(s);
98
99 return UpnpString_set_String(p->m_SID, q);
100}
101
105
106const char* UpnpEvent_get_SID_cstr(const UpnpEvent* p) {
108}
109
110int UpnpEvent_strcpy_SID(UpnpEvent* p, const char* s) {
111 return UpnpString_set_String(p->m_SID, s);
112}
113
114int UpnpEvent_strncpy_SID(UpnpEvent* p, const char* s, size_t n) {
115 return UpnpString_set_StringN(p->m_SID, s, n);
116}
117
IXML_Document * UpnpEvent_get_ChangedVariables(const UpnpEvent *p)
Definition UpnpEvent.cpp:84
int UpnpEvent_set_EventKey(UpnpEvent *p, int n)
Definition UpnpEvent.cpp:78
int UpnpEvent_strncpy_SID(UpnpEvent *p, const char *s, size_t n)
UpnpString * m_SID
Definition UpnpEvent.cpp:21
void UpnpEvent_clear_SID(UpnpEvent *p)
int UpnpEvent_set_ChangedVariables(UpnpEvent *p, IXML_Document *n)
Definition UpnpEvent.cpp:88
int UpnpEvent_get_EventKey(const UpnpEvent *p)
Definition UpnpEvent.cpp:76
UpnpEvent * UpnpEvent_new()
Definition UpnpEvent.cpp:25
size_t UpnpEvent_get_SID_Length(const UpnpEvent *p)
int UpnpEvent_set_SID(UpnpEvent *p, const UpnpString *s)
Definition UpnpEvent.cpp:96
const char * UpnpEvent_get_SID_cstr(const UpnpEvent *p)
const UpnpString * UpnpEvent_get_SID(const UpnpEvent *p)
Definition UpnpEvent.cpp:94
int UpnpEvent_strcpy_SID(UpnpEvent *p, const char *s)
UpnpEvent * UpnpEvent_dup(const UpnpEvent *q)
Definition UpnpEvent.cpp:65
int UpnpEvent_assign(UpnpEvent *p, const UpnpEvent *q)
Definition UpnpEvent.cpp:52
void UpnpEvent_delete(UpnpEvent *q)
Definition UpnpEvent.cpp:38
IXML_Document * m_ChangedVariables
Definition UpnpEvent.cpp:20
s_UpnpEvent
Definition UpnpEvent.cpp:16
Header file for UpnpEvent methods.
Internal implementation of the class UpnpString.
PUPNP_Api int UpnpString_set_StringN(UpnpString *p, const char *s, size_t n)
Sets the string from a pointer to char using a maximum of N chars.
PUPNP_Api int UpnpString_set_String(UpnpString *p, const char *s)
Sets the string from a pointer to char.
PUPNP_Api size_t UpnpString_get_Length(const UpnpString *p)
Returns the length of the string.
PUPNP_Api UpnpString * UpnpString_new(void)
Constructor.
PUPNP_Api const char * UpnpString_get_String(const UpnpString *p)
Returns the pointer to char.
PUPNP_Api void UpnpString_delete(UpnpString *p)
Destructor.
PUPNP_Api void UpnpString_clear(UpnpString *p)
Clears the string, sets its size to zero.
Data structure representing the DOM Document.
Definition ixml.hpp:155