Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Enumerations | Functions | Variables
icalset.h File Reference
#include <limits.h>
#include "ical.h"
#include "icalgauge.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  icalsetiter
struct  icalset_impl

Defines

#define ICAL_PATH_MAX   1024

Typedefs

typedef struct icalset_impl
typedef enum icalset_kind icalset_kind
typedef struct icalsetiter icalsetiter

Enumerations

enum  icalset_kind { ICAL_FILE_SET, ICAL_DIR_SET, ICAL_BDB_SET }

Functions

int icalset_register_class (icalset *set)
 Register a new derived class.
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_reader (const char *path)
icalset * icalset_new_file_writer (const char *path)
icalset * icalset_new_dir (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_select (icalset *set)
 Clears the gauge defined by icalset_select()
icalcomponent * icalset_fetch (icalset *set, const char *uid)
 Get a component by uid.
int icalset_has_uid (icalset *set, const char *uid)
icalcomponent * icalset_fetch_match (icalset *set, icalcomponent *c)
icalerrorenum icalset_modify (icalset *set, icalcomponent *oldc, icalcomponent *newc)
 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 *i)
 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

icalsetiter icalsetiter_null
 External Iterator with gauge - for thread safety.

Detailed Description

Author:
eric 28 November 1999

Icalset is the "base class" for representations of a collection of iCal components. Derived classes (actually delegatees) include:

icalfileset Store components in a single file icaldirset Store components in multiple files in a directory icalbdbset Store components in a Berkeley DB File icalheapset Store components on the heap icalmysqlset Store components in a mysql database.

Definition in file icalset.h.


Class Documentation

struct icalsetiter

Definition at line 61 of file icalset.h.

Collaboration diagram for icalsetiter:
Class Members
icalgauge * gauge
icalcompiter iter
icalcomponent * last_component
icalrecur_iterator * ritr
const char * tzid

Define Documentation

#define ICAL_PATH_MAX   1024

Definition at line 49 of file icalset.h.


Typedef Documentation

typedef struct icalset_impl

Definition at line 53 of file icalset.h.

typedef enum icalset_kind icalset_kind
typedef struct icalsetiter icalsetiter

Enumeration Type Documentation

Enumerator:
ICAL_FILE_SET 
ICAL_DIR_SET 
ICAL_BDB_SET 

Definition at line 55 of file icalset.h.


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_select ( icalset *  set)

Clears the gauge defined by icalset_select()

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 *  c 
)

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_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);
}
int icalset_register_class ( icalset *  set)

Register a new derived class.

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 i)

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

External Iterator with gauge - for thread safety.

Definition at line 440 of file icalset.c.