Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
icalset.c File Reference
#include "ical.h"
#include "icalset.h"
#include "icalfileset.h"
#include "icalfilesetimpl.h"
#include "icaldirset.h"
#include "icaldirsetimpl.h"
#include <stdlib.h>
#include <string.h>
#include <errno.h>

Go to the source code of this file.

Functions

icalset * icalset_new (icalset_kind kind, const char *dsn, void *options)
 Generic icalset constructor.
icalset * icalset_new_file (const char *path)
icalset * icalset_new_file_writer (const char *path)
icalset * icalset_new_file_reader (const char *path)
icalset * icalset_new_dir (const char *path)
icalset * icalset_new_dir_writer (const char *path)
icalset * icalset_new_dir_reader (const char *path)
void icalset_free (icalset *set)
 free memory associated with this icalset automatically calls the implementation specific free routine
const char * icalset_path (icalset *set)
void icalset_mark (icalset *set)
 Mark the cluster as changed, so it will be written to disk when it is freed.
icalerrorenum icalset_commit (icalset *set)
 Write changes to disk immediately.
icalerrorenum icalset_add_component (icalset *set, icalcomponent *comp)
icalerrorenum icalset_remove_component (icalset *set, icalcomponent *comp)
int icalset_count_components (icalset *set, icalcomponent_kind kind)
icalerrorenum icalset_select (icalset *set, icalgauge *gauge)
 Restrict the component returned by icalset_first, _next to those that pass the gauge.
void icalset_clear (icalset *set)
icalcomponent * icalset_fetch (icalset *set, const char *uid)
 Get a component by uid.
icalcomponent * icalset_fetch_match (icalset *set, icalcomponent *comp)
int icalset_has_uid (icalset *set, const char *uid)
icalerrorenum icalset_modify (icalset *set, icalcomponent *old, icalcomponent *new)
 Modify components according to the MODIFY method of CAP.
icalcomponent * icalset_get_current_component (icalset *set)
 Iterate through the components.
icalcomponent * icalset_get_first_component (icalset *set)
icalcomponent * icalset_get_next_component (icalset *set)
icalsetiter icalset_begin_component (icalset *set, icalcomponent_kind kind, icalgauge *gauge)
icalcomponent * icalsetiter_next (icalsetiter *itr)
 Default _next, _prior, _deref for subclasses that use single cluster.
icalcomponent * icalsetiter_prior (icalsetiter *i)
icalcomponent * icalsetiter_deref (icalsetiter *i)
icalcomponent * icalsetiter_to_next (icalset *set, icalsetiter *i)
 for subclasses that use multiple clusters that require specialized cluster traversal
icalcomponent * icalsetiter_to_prior (icalset *set, icalsetiter *i)

Variables

static icalset icalset_dirset_init
static icalset icalset_fileset_init
icalsetiter icalsetiter_null = {{ICAL_NO_COMPONENT, 0}, 0}
 External Iterator with gauge - for thread safety.

Function Documentation

icalerrorenum icalset_add_component ( icalset *  set,
icalcomponent *  comp 
)

Definition at line 391 of file icalset.c.

                                                                       {
    return set->add_component(set,comp);
}

Here is the caller graph for this function:

icalsetiter icalset_begin_component ( icalset *  set,
icalcomponent_kind  kind,
icalgauge *  gauge 
)

Definition at line 442 of file icalset.c.

                                                                            {
    return set->icalset_begin_component(set, kind, gauge);
}
void icalset_clear ( icalset *  set)

Definition at line 407 of file icalset.c.

                                 {
    set->clear(set);
}
icalerrorenum icalset_commit ( icalset *  set)

Write changes to disk immediately.

Definition at line 387 of file icalset.c.

                                           {
    return set->commit(set);
}
int icalset_count_components ( icalset *  set,
icalcomponent_kind  kind 
)

Definition at line 399 of file icalset.c.

                                                                   {
    return set->count_components(set,kind);
}
icalcomponent* icalset_fetch ( icalset *  set,
const char *  uid 
)

Get a component by uid.

Definition at line 411 of file icalset.c.

                                                            {
    return set->fetch(set, uid);
}

Here is the caller graph for this function:

icalcomponent* icalset_fetch_match ( icalset *  set,
icalcomponent *  comp 
)

Definition at line 415 of file icalset.c.

                                                                      {
    return set->fetch_match(set, comp);
}

Here is the caller graph for this function:

void icalset_free ( icalset *  set)

free memory associated with this icalset automatically calls the implementation specific free routine

Definition at line 367 of file icalset.c.

{
  if (set->free)
    set->free(set);

  if (set->dsn)
    free(set->dsn);

  free(set);
}

Here is the caller graph for this function:

icalcomponent* icalset_get_current_component ( icalset *  set)

Iterate through the components.

If a guage has been defined, these will skip over components that do not pass the gauge

Definition at line 428 of file icalset.c.

                                                           {
    return set->get_current_component(set);
}
icalcomponent* icalset_get_first_component ( icalset *  set)

Definition at line 432 of file icalset.c.

                                                         {
    return set->get_first_component(set);
}

Here is the caller graph for this function:

icalcomponent* icalset_get_next_component ( icalset *  set)

Definition at line 436 of file icalset.c.

                                                        {
    return set->get_next_component(set);
}

Here is the caller graph for this function:

int icalset_has_uid ( icalset *  set,
const char *  uid 
)

Definition at line 419 of file icalset.c.

                                                   {
    return set->has_uid(set, uid);
}
void icalset_mark ( icalset *  set)

Mark the cluster as changed, so it will be written to disk when it is freed.

Definition at line 383 of file icalset.c.

                                {
    set->mark(set);
}
icalerrorenum icalset_modify ( icalset *  set,
icalcomponent *  oldc,
icalcomponent *  newc 
)

Modify components according to the MODIFY method of CAP.

Works on the currently selected components.

Definition at line 423 of file icalset.c.

                                                {
    return set->modify(set, old, new);
}
icalset* icalset_new ( icalset_kind  kind,
const char *  dsn,
void options 
)

Generic icalset constructor.

Parameters:
kindThe type of icalset to create
dsnData Source Name - usually a pathname or DB handle
optionsAny implementation specific options
Returns:
A valid icalset reference or NULL if error.

This creates any of the icalset types available.

unimplemented

call the implementation specific initializer

Definition at line 237 of file icalset.c.

                                                                        {
  icalset *data = NULL;
  icalset *ret = NULL;

#ifdef _DLOPEN_TEST
    pvl_elem  e;
    icalset    *impl;

    if (!icalset_init_done)
       icalset_init();

    for(e = pvl_head(icalset_kinds); e!=0; e = pvl_next(e)) {
       impl = (icalset*)pvl_data(e);
       if (impl->kind == kind)
           break;
    }
    if (e == 0) {
       icalerror_set_errno(ICAL_UNIMPLEMENTED_ERROR);
       return(NULL);
    }

    data = (icalset*)malloc(impl->size);
    if (data == 0) {
       icalerror_set_errno(ICAL_NEWFAILED_ERROR);
       errno = ENOMEM;
       return 0;
    }

    /* The first member of the derived class must be an icalset. */
    memset(data,0,impl->size);
    /* *data = *impl; */
    memcpy(data, impl, sizeof(icalset));

    data->dsn     = strdup(dsn);
#else
  switch(kind) {
  case ICAL_FILE_SET:
    data = (icalset*) malloc(sizeof(icalfileset));
    if (data == 0) {
       icalerror_set_errno(ICAL_NEWFAILED_ERROR);
       errno = ENOMEM;
       return 0;
    }
    memset(data,0,sizeof(icalfileset));
    *data = icalset_fileset_init;
    break;
  case ICAL_DIR_SET:
    data = (icalset*) malloc(sizeof(icaldirset));
    if (data == 0) {
       icalerror_set_errno(ICAL_NEWFAILED_ERROR);
       errno = ENOMEM;
       return 0;
    }
    memset(data,0,sizeof(icaldirset));
    *data = icalset_dirset_init;
    break;
#ifdef WITH_BDB4
  case ICAL_BDB_SET:
    data = (icalset*) malloc(sizeof(icalbdbset));
    if (data == 0) {
       icalerror_set_errno(ICAL_NEWFAILED_ERROR);
       errno = ENOMEM;
       return 0;
    }
    memset(data,0,sizeof(icalbdbset));
    *data = icalset_bdbset_init;
    break;
#endif
    
  default:
    icalerror_set_errno(ICAL_UNIMPLEMENTED_ERROR);
    return(NULL);
  }

  if ( data == 0) {
    icalerror_set_errno(ICAL_NEWFAILED_ERROR);
    return 0;
  }
  data->kind    = kind;
  data->dsn     = strdup(dsn);
#endif

  if ((ret = data->init(data, dsn, options)) == NULL)
    icalset_free(data);

  return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

icalset* icalset_new_dir ( const char *  path)

Definition at line 343 of file icalset.c.

Here is the call graph for this function:

Here is the caller graph for this function:

icalset* icalset_new_dir_reader ( const char *  path)

Definition at line 353 of file icalset.c.

Here is the call graph for this function:

icalset* icalset_new_dir_writer ( const char *  path)

Definition at line 348 of file icalset.c.

Here is the call graph for this function:

icalset* icalset_new_file ( const char *  path)

Definition at line 327 of file icalset.c.

Here is the call graph for this function:

Here is the caller graph for this function:

icalset * icalset_new_file_reader ( const char *  path)

Definition at line 337 of file icalset.c.

Here is the call graph for this function:

icalset * icalset_new_file_writer ( const char *  path)

Definition at line 332 of file icalset.c.

Here is the call graph for this function:

const char* icalset_path ( icalset *  set)

Definition at line 379 of file icalset.c.

                                       {
    return set->path(set);
}
icalerrorenum icalset_remove_component ( icalset *  set,
icalcomponent *  comp 
)

Definition at line 395 of file icalset.c.

                                                                          {
    return set->remove_component(set,comp);
}
icalerrorenum icalset_select ( icalset *  set,
icalgauge *  gauge 
)

Restrict the component returned by icalset_first, _next to those that pass the gauge.

Definition at line 403 of file icalset.c.

                                                             {
    return set->select(set, gauge);
}
icalcomponent* icalsetiter_deref ( icalsetiter i)

Definition at line 479 of file icalset.c.

                                                 {
    icalerror_check_arg_rz( (i != NULL), "i" );
    return (icalcompiter_deref(&(i->iter)));
}

Here is the call graph for this function:

Here is the caller graph for this function:

icalcomponent* icalsetiter_next ( icalsetiter itr)

Default _next, _prior, _deref for subclasses that use single cluster.

Definition at line 447 of file icalset.c.

                                                  {

    icalcomponent* c = 0;
    icalerror_check_arg_rz( (itr != NULL), "i");

    do  {
       c = icalcompiter_next(&(itr->iter));
       if(c != 0 && (itr->gauge == 0 ||
                     icalgauge_compare(itr->gauge, c) == 1)){
           return c;
       }
    } while (c != 0);

    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

icalcomponent* icalsetiter_prior ( icalsetiter i)

Definition at line 463 of file icalset.c.

                                                 {

    icalcomponent* c = 0;
    icalerror_check_arg_rz( (i != NULL), "i" );

    do  {
       c = icalcompiter_prior(&(i->iter));
       if(c != 0 && (i->gauge == 0 ||
                     icalgauge_compare(i->gauge, c) == 1)){
           return c;
       }
    } while (c != 0);

    return 0;
}

Here is the call graph for this function:

icalcomponent* icalsetiter_to_next ( icalset *  set,
icalsetiter i 
)

for subclasses that use multiple clusters that require specialized cluster traversal

Definition at line 485 of file icalset.c.

{
    return set->icalsetiter_to_next(set, i);
}
icalcomponent* icalsetiter_to_prior ( icalset *  set,
icalsetiter i 
)

Definition at line 490 of file icalset.c.

{
    return set->icalsetiter_to_prior(set, i);
}

Variable Documentation

icalset icalset_dirset_init [static]
icalset icalset_fileset_init [static]

External Iterator with gauge - for thread safety.

Definition at line 440 of file icalset.c.