Back to index

lightning-sunbird  0.9+nobinonly
Typedefs | Functions
icalattach.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct icalattach_impl
typedef void(* icalattach_free_fn_t )(unsigned char *data, void *user_data)

Functions

icalattach * icalattach_new_from_url (const char *url)
icalattach * icalattach_new_from_data (unsigned char *data, icalattach_free_fn_t free_fn, void *free_fn_data)
void icalattach_ref (icalattach *attach)
void icalattach_unref (icalattach *attach)
int icalattach_get_is_url (icalattach *attach)
const char * icalattach_get_url (icalattach *attach)
unsigned char * icalattach_get_data (icalattach *attach)
struct icalattachtype * icalattachtype_new (void)
void icalattachtype_add_reference (struct icalattachtype *v)
void icalattachtype_free (struct icalattachtype *v)
void icalattachtype_set_url (struct icalattachtype *v, char *url)
char * icalattachtype_get_url (struct icalattachtype *v)
void icalattachtype_set_base64 (struct icalattachtype *v, char *base64, int owns)
char * icalattachtype_get_base64 (struct icalattachtype *v)
void icalattachtype_set_binary (struct icalattachtype *v, char *binary, int owns)
voidicalattachtype_get_binary (struct icalattachtype *v)

Typedef Documentation

typedef void(* icalattach_free_fn_t)(unsigned char *data, void *user_data)

Definition at line 30 of file icalattach.h.

typedef struct icalattach_impl

Definition at line 28 of file icalattach.h.


Function Documentation

unsigned char* icalattach_get_data ( icalattach *  attach)

Definition at line 133 of file icalattach.c.

{
    icalerror_check_arg_rz ((attach != NULL), "attach");
    icalerror_check_arg_rz ((!attach->is_url), "!attach->is_url");

    return attach->u.data.data;
}
int icalattach_get_is_url ( icalattach *  attach)

Definition at line 116 of file icalattach.c.

{
    icalerror_check_arg_rz ((attach != NULL), "attach");

    return attach->is_url ? 1 : 0;
}
const char* icalattach_get_url ( icalattach *  attach)

Definition at line 124 of file icalattach.c.

{
    icalerror_check_arg_rz ((attach != NULL), "attach");
    icalerror_check_arg_rz ((attach->is_url), "attach->is_url");

    return attach->u.url.url;
}
icalattach* icalattach_new_from_data ( unsigned char *  data,
icalattach_free_fn_t  free_fn,
void free_fn_data 
)

Definition at line 66 of file icalattach.c.

{
    icalattach *attach;

    icalerror_check_arg_rz ((data != NULL), "data");

    if ((attach = malloc (sizeof (icalattach))) == NULL) {
       errno = ENOMEM;
       return NULL;
    }

    attach->refcount = 1;
    attach->is_url = 0;
    attach->u.data.data = data;
    attach->u.data.free_fn = free_fn;
    attach->u.data.free_fn_data = free_fn_data;

    return attach;
}
icalattach* icalattach_new_from_url ( const char *  url)

Definition at line 40 of file icalattach.c.

{
    icalattach *attach;
    char *url_copy;

    icalerror_check_arg_rz ((url != NULL), "url");

    if ((attach = malloc (sizeof (icalattach))) == NULL) {
       errno = ENOMEM;
       return NULL;
    }

    if ((url_copy = strdup (url)) == NULL) {
       free (attach);
       errno = ENOMEM;
       return NULL;
    }

    attach->refcount = 1;
    attach->is_url = 1;
    attach->u.url.url = url_copy;

    return attach;
}
void icalattach_ref ( icalattach *  attach)

Definition at line 88 of file icalattach.c.

{
    icalerror_check_arg_rv ((attach != NULL), "attach");
    icalerror_check_arg_rv ((attach->refcount > 0), "attach->refcount > 0");

    attach->refcount++;
}
void icalattach_unref ( icalattach *  attach)

Definition at line 97 of file icalattach.c.

{
    icalerror_check_arg_rv ((attach != NULL), "attach");
    icalerror_check_arg_rv ((attach->refcount > 0), "attach->refcount > 0");

    attach->refcount--;

    if (attach->refcount != 0)
       return;

    if (attach->is_url)
       free (attach->u.url.url);
    else if (attach->u.data.free_fn)
       (* attach->u.data.free_fn) (attach->u.data.data, attach->u.data.free_fn_data);

    free (attach);
}
void icalattachtype_add_reference ( struct icalattachtype *  v)
void icalattachtype_free ( struct icalattachtype *  v)
char* icalattachtype_get_base64 ( struct icalattachtype *  v)
void* icalattachtype_get_binary ( struct icalattachtype *  v)
char* icalattachtype_get_url ( struct icalattachtype *  v)
struct icalattachtype* icalattachtype_new ( void  ) [read]
void icalattachtype_set_base64 ( struct icalattachtype *  v,
char *  base64,
int  owns 
)
void icalattachtype_set_binary ( struct icalattachtype *  v,
char *  binary,
int  owns 
)
void icalattachtype_set_url ( struct icalattachtype *  v,
char *  url 
)