19#include "vcardparameterimpl.h"
20#include "icalerror_p.h"
28 struct vcardparameter_impl *v;
30 if ((v = (
struct vcardparameter_impl *)
icalmemory_new_buffer(
sizeof(
struct vcardparameter_impl))) == 0) {
35 memset(v, 0,
sizeof(
struct vcardparameter_impl));
37 v->id = ICAL_STRUCTURE_TYPE_PARAMETER;
53 if (!param || param->parent != 0) {
57 if (param->string != 0) {
59 }
else if (param->values != 0) {
65 }
else if (param->structured != 0) {
69 if (param->x_name != 0) {
76 param->id = ICAL_STRUCTURE_TYPE_PARAMETER_EMPTY;
82 struct vcardparameter_impl *clone;
84 icalerror_check_arg_rz((old != 0),
"param");
92 memcpy(clone, old,
sizeof(
struct vcardparameter_impl));
94 if (old->string != 0) {
96 if (clone->string == 0) {
103 if (old->x_name != 0) {
105 if (clone->x_name == 0) {
112 if (old->values != 0) {
114 if (clone->values == 0) {
131 icalerror_check_arg_rz(
str != 0,
"str");
140 eq = strchr(cpy,
'=');
193 size_t buf_size = 1024;
197 icalerror_check_arg_rz((param != 0),
"parameter");
228 if (param->string != 0) {
230 &buf_size, param->string);
231 }
else if (param->data != 0) {
236#define VCARD_INTEGER_LENGTH 21
247 }
else if (param->values != 0) {
249 const char *sep =
"";
251 for (i = 0; i < param->values->num_elements; i++) {
294 if (parameter == 0) {
298 return parameter->kind;
303 const struct vcardparameter_impl *impl = (
struct vcardparameter_impl *)parameter;
305 if (parameter == 0) {
309 return (impl->id == ICAL_STRUCTURE_TYPE_PARAMETER);
314 icalerror_check_arg_rv((param != 0),
"param");
315 icalerror_check_arg_rv((v != 0),
"v");
317 if (param->x_name != 0) {
323 if (param->x_name == 0) {
330 icalerror_check_arg_rz((param != 0),
"param");
332 return param->x_name;
337 icalerror_check_arg_rv((param != 0),
"param");
338 icalerror_check_arg_rv((v != 0),
"v");
340 if (param->string != 0) {
346 if (param->string == 0) {
353 icalerror_check_arg_rz((param != 0),
"param");
355 return param->string;
380 icalerror_check_arg_rv((param != 0),
"param");
382 param->parent = property;
387 icalerror_check_arg_rz((param != 0),
"param");
389 return param->parent;
399 icalerror_check_arg_rz((param1 != 0),
"param1");
400 icalerror_check_arg_rz((param2 != 0),
"param2");
405 if (kind1 != kind2) {
412 if (strcasecmp(name1, name2) != 0) {
418 if (strcasecmp(name1, name2) != 0) {
427 icalerror_check_arg_rz((param != 0),
"param");
429 return param->is_multivalued;
434 icalerror_check_arg_rz((param != 0),
"param");
enum icalrequeststatus kind
void icalerror_set_errno(icalerrorenum x)
Sets the icalerrno to a given error.
@ ICAL_MALFORMEDDATA_ERROR
void icalmemory_free_buffer(void *buf)
Releases a buffer.
char * icalmemory_strdup(const char *s)
Creates a duplicate of a string.
void icalmemory_append_string(char **buf, char **pos, size_t *buf_size, const char *string)
Appends a string to a buffer.
void * icalmemory_new_buffer(size_t size)
Creates new buffer with the specified size.
void icalmemory_append_encoded_string(char **buf, char **pos, size_t *buf_size, const char *string)
void icalmemory_add_tmp_buffer(void *buf)
Adds an externally allocated buffer to the ring.
void * icalmemory_tmp_buffer(size_t size)
Creates a new temporary buffer on the ring and returns it.
Common memory management routines.
struct vcardparameter_impl vcardparameter
const char * vcardparameter_enum_to_string(int e)
#define vcardenumarray_clone(array)
icalenumarray_element vcardenumarray_element
#define vcardenumarray_element_at(array, position)
#define vcardenumarray_free(array)
vcardparameter * vcardparameter_new_from_string(const char *str)
Creates new vcardparameter object from string.
bool vcardparameter_has_same_name(const vcardparameter *param1, const vcardparameter *param2)
Determines if two parameters have the same name.
char * vcardparameter_as_vcard_string(vcardparameter *param)
Converts vcardparameter into a string representation.
bool vcardparameter_is_structured(const vcardparameter *param)
struct vcardparameter_impl * vcardparameter_new_impl(vcardparameter_kind kind)
void vcardparameter_set_xname(vcardparameter *param, const char *v)
Sets the X-name of param to v.
const char * vcardparameter_get_iana_value(const vcardparameter *param)
Returns the IANA value of param.
void vcardparameter_free(vcardparameter *param)
Frees an vcardparameter object.
void vcardparameter_set_iana_value(vcardparameter *param, const char *v)
Sets the IANA value of param to v.
const char * vcardparameter_get_iana_name(const vcardparameter *param)
Returns the IANA name of param.
void vcardparameter_set_parent(vcardparameter *param, vcardproperty *property)
bool vcardparameter_is_multivalued(const vcardparameter *param)
bool vcardparameter_isa_parameter(void *parameter)
vcardparameter_kind vcardparameter_isa(const vcardparameter *parameter)
vcardproperty * vcardparameter_get_parent(const vcardparameter *param)
void vcardparameter_set_iana_name(vcardparameter *param, const char *v)
Sets the IANA name of param to v.
vcardparameter * vcardparameter_clone(const vcardparameter *old)
Creates new vcardparameter as a clone of the given one.
void vcardparameter_set_xvalue(vcardparameter *param, const char *v)
Sets the X-value of param to v.
const char * vcardparameter_get_xvalue(const vcardparameter *param)
Returns the X-value of param.
const char * vcardparameter_get_xname(const vcardparameter *param)
Returns the X-name of param.
#define VCARD_INTEGER_LENGTH
vcardparameter * vcardparameter_new(vcardparameter_kind kind)
Creates new vcardparameter object.
char * vcardparameter_as_vcard_string_r(vcardparameter *param)
Converts vcardparameter into an string representation according to RFC5445/RFC6868.
Defines the data structure representing vCard parameters.
const char * vcardparameter_kind_to_string(vcardparameter_kind kind)
Returns a string representing the given vcardparameter_kind.
vcardparameter * vcardparameter_new_from_value_string(vcardparameter_kind kind, const char *value)
Creates new vcardparameter of a given kind with a given value.
vcardparameter_kind vcardparameter_string_to_kind(const char *string)
Returns the vcardparameter_kind for a given string.
vcardvalue_kind vcardparameter_kind_value_kind(const vcardparameter_kind kind, int *is_multivalued)
#define vcardstrarray_clone(array)
#define vcardstrarray_free(array)
#define vcardstrarray_element_at(array, position)
void vcardstructured_unref(vcardstructuredtype *st)
Decrements the reference count of the vcardstructuredtype.
char * vcardstructured_as_vcard_string_r(const vcardstructuredtype *st, bool is_param)
Formats a vcardstructuredtype as a vCard property or parameter value.
bool vcardtime_is_valid_time(const struct vcardtimetype t)
const char * vcardtime_as_vcard_string(const vcardtimetype t, unsigned flags)