This commit was generated by cvs2svn to track changes on a CVS vendor

branch.
This commit is contained in:
mvl%exedo.nl 2005-01-05 20:48:57 +00:00
Родитель bbf362e803 6d2861c577
Коммит 87e2563581
7 изменённых файлов: 3100 добавлений и 7 удалений

Просмотреть файл

@ -10,13 +10,6 @@ icalversion.h
*.la
ical.h
icalyacc.output
icalproperty.c
icalproperty.h
icalvalue.h
icalvalue.c
icalparameter.h
icalparameter.c
icalrestriction.c
icalderivedparameter.c
icalderivedparameter.h
icalderivedproperty.c

Просмотреть файл

@ -0,0 +1,400 @@
/* -*- Mode: C -*-
======================================================================
FILE: icalderivedparameters.{c,h}
CREATOR: eric 09 May 1999
$Id: icalparameter.c,v 1.12 2004/03/17 19:04:53 acampi Exp $
$Locker: $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The original code is icalderivedparameters.{c,h}
Contributions from:
Graham Davison (g.m.davison@computer.org)
======================================================================*/
/*#line 29 "icalparameter.c.in"*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "icalparameter.h"
#include "icalproperty.h"
#include "icalerror.h"
#include "icalmemory.h"
#include "icalparameterimpl.h"
#include <stdlib.h> /* for malloc() */
#include <errno.h>
#include <string.h> /* for memset() */
/* In icalderivedparameter */
icalparameter* icalparameter_new_from_value_string(icalparameter_kind kind,const char* val);
struct icalparameter_impl* icalparameter_new_impl(icalparameter_kind kind)
{
struct icalparameter_impl* v;
if ( ( v = (struct icalparameter_impl*)
malloc(sizeof(struct icalparameter_impl))) == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
strcpy(v->id,"para");
v->kind = kind;
v->size = 0;
v->string = 0;
v->x_name = 0;
v->parent = 0;
v->data = 0;
return v;
}
icalparameter*
icalparameter_new (icalparameter_kind kind)
{
struct icalparameter_impl* v = icalparameter_new_impl(kind);
return (icalparameter*) v;
}
icalparameter *
icalparameter_new_x_name(const char *name, const char *value) {
icalparameter *ret;
if (name == NULL || value == NULL)
return NULL;
ret = icalparameter_new_x(value);
if (ret == NULL)
return NULL;
icalparameter_set_xname(ret, name);
return ret;
}
void
icalparameter_free (icalparameter* param)
{
/* HACK. This always triggers, even when parameter is non-zero
icalerror_check_arg_rv((parameter==0),"parameter");*/
#ifdef ICAL_FREE_ON_LIST_IS_ERROR
icalerror_assert( (param->parent ==0),"Tried to free a parameter that is still attached to a component. ");
#else
if(param->parent !=0){
return;
}
#endif
if (param->string != 0){
free ((void*)param->string);
}
if (param->x_name != 0){
free ((void*)param->x_name);
}
memset(param,0,sizeof(param));
param->parent = 0;
param->id[0] = 'X';
free(param);
}
icalparameter*
icalparameter_new_clone(icalparameter* old)
{
struct icalparameter_impl *new;
new = icalparameter_new_impl(old->kind);
icalerror_check_arg_rz((old!=0),"param");
if (new == 0){
return 0;
}
memcpy(new,old,sizeof(struct icalparameter_impl));
if (old->string != 0){
new->string = icalmemory_strdup(old->string);
if (new->string == 0){
icalparameter_free(new);
return 0;
}
}
if (old->x_name != 0){
new->x_name = icalmemory_strdup(old->x_name);
if (new->x_name == 0){
icalparameter_free(new);
return 0;
}
}
return new;
}
icalparameter* icalparameter_new_from_string(const char *str)
{
char* eq;
char* cpy;
icalparameter_kind kind;
icalparameter *param;
icalerror_check_arg_rz(str != 0,"str");
cpy = icalmemory_strdup(str);
if (cpy == 0){
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
eq = strchr(cpy,'=');
if(eq == 0){
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
return 0;
}
*eq = '\0';
eq++;
kind = icalparameter_string_to_kind(cpy);
if(kind == ICAL_NO_PARAMETER){
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
return 0;
}
param = icalparameter_new_from_value_string(kind,eq);
if(kind == ICAL_X_PARAMETER){
icalparameter_set_xname(param,cpy);
}
free(cpy);
return param;
}
/**
* Return a string representation of the parameter according to RFC2445.
*
* param = param-name "=" param-value
* param-name = iana-token / x-token
* param-value = paramtext /quoted-string
* paramtext = *SAFE-SHARE
* quoted-string= DQUOTE *QSAFE-CHARE DQUOTE
* QSAFE-CHAR = any character except CTLs and DQUOTE
* SAFE-CHAR = any character except CTLs, DQUOTE. ";", ":", ","
*/
char*
icalparameter_as_ical_string (icalparameter* param)
{
size_t buf_size = 1024;
char* buf;
char* buf_ptr;
char *out_buf;
const char *kind_string;
icalerror_check_arg_rz( (param!=0), "parameter");
/* Create new buffer that we can append names, parameters and a
value to, and reallocate as needed. Later, this buffer will be
copied to a icalmemory_tmp_buffer, which is managed internally
by libical, so it can be given to the caller without fear of
the caller forgetting to free it */
buf = icalmemory_new_buffer(buf_size);
buf_ptr = buf;
if(param->kind == ICAL_X_PARAMETER) {
icalmemory_append_string(&buf, &buf_ptr, &buf_size,
icalparameter_get_xname(param));
} else {
kind_string = icalparameter_kind_to_string(param->kind);
if (param->kind == ICAL_NO_PARAMETER ||
param->kind == ICAL_ANY_PARAMETER ||
kind_string == 0)
{
icalerror_set_errno(ICAL_BADARG_ERROR);
return 0;
}
/* Put the parameter name into the string */
icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);
}
icalmemory_append_string(&buf, &buf_ptr, &buf_size, "=");
if(param->string !=0){
int qm = 0;
/* Encapsulate the property in quotes if necessary */
if (strpbrk(param->string, ";:,") != 0) {
icalmemory_append_char (&buf, &buf_ptr, &buf_size, '"');
qm = 1;
}
icalmemory_append_string(&buf, &buf_ptr, &buf_size, param->string);
if (qm == 1) {
icalmemory_append_char (&buf, &buf_ptr, &buf_size, '"');
}
} else if (param->data != 0){
const char* str = icalparameter_enum_to_string(param->data);
icalmemory_append_string(&buf, &buf_ptr, &buf_size, str);
} else {
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
return 0;
}
/* Now, copy the buffer to a tmp_buffer, which is safe to give to
the caller without worring about de-allocating it. */
out_buf = icalmemory_tmp_copy(buf);
icalmemory_free_buffer(buf);
return out_buf;
}
int
icalparameter_is_valid (icalparameter* parameter);
icalparameter_kind
icalparameter_isa (icalparameter* parameter)
{
if(parameter == 0){
return ICAL_NO_PARAMETER;
}
return parameter->kind;
}
int
icalparameter_isa_parameter (void* parameter)
{
struct icalparameter_impl *impl = (struct icalparameter_impl *)parameter;
if (parameter == 0){
return 0;
}
if (strcmp(impl->id,"para") == 0) {
return 1;
} else {
return 0;
}
}
void
icalparameter_set_xname (icalparameter* param, const char* v)
{
icalerror_check_arg_rv( (param!=0),"param");
icalerror_check_arg_rv( (v!=0),"v");
if (param->x_name != 0){
free((void*)param->x_name);
}
param->x_name = icalmemory_strdup(v);
if (param->x_name == 0){
errno = ENOMEM;
}
}
const char*
icalparameter_get_xname (icalparameter* param)
{
icalerror_check_arg_rz( (param!=0),"param");
return param->x_name;
}
void
icalparameter_set_xvalue (icalparameter* param, const char* v)
{
icalerror_check_arg_rv( (param!=0),"param");
icalerror_check_arg_rv( (v!=0),"v");
if (param->string != 0){
free((void*)param->string);
}
param->string = icalmemory_strdup(v);
if (param->string == 0){
errno = ENOMEM;
}
}
const char*
icalparameter_get_xvalue (icalparameter* param)
{
icalerror_check_arg_rz( (param!=0),"param");
return param->string;
}
void icalparameter_set_parent(icalparameter* param,
icalproperty* property)
{
icalerror_check_arg_rv( (param!=0),"param");
param->parent = property;
}
icalproperty* icalparameter_get_parent(icalparameter* param)
{
icalerror_check_arg_rz( (param!=0),"param");
return param->parent;
}
/* Everything below this line is machine generated. Do not edit. */
/* ALTREP */

Просмотреть файл

@ -0,0 +1,70 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalparam.h
CREATOR: eric 20 March 1999
$Id: icalparameter.h,v 1.3 2004/03/17 19:04:54 acampi Exp $
$Locker: $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The original code is icalparam.h
======================================================================*/
#ifndef ICALPARAM_H
#define ICALPARAM_H
#include "icalderivedparameter.h"
/* Declared in icalderivedparameter.h */
/*typedef struct icalparameter_impl icalparameter;*/
icalparameter* icalparameter_new(icalparameter_kind kind);
icalparameter* icalparameter_new_x_name(const char *name, const char *value);
icalparameter* icalparameter_new_clone(icalparameter* p);
/* Create from string of form "PARAMNAME=VALUE" */
icalparameter* icalparameter_new_from_string(const char* value);
/* Create from just the value, the part after the "=" */
icalparameter* icalparameter_new_from_value_string(icalparameter_kind kind, const char* value);
void icalparameter_free(icalparameter* parameter);
char* icalparameter_as_ical_string(icalparameter* parameter);
int icalparameter_is_valid(icalparameter* parameter);
icalparameter_kind icalparameter_isa(icalparameter* parameter);
int icalparameter_isa_parameter(void* param);
/* Acess the name of an X parameer */
void icalparameter_set_xname (icalparameter* param, const char* v);
const char* icalparameter_get_xname(icalparameter* param);
void icalparameter_set_xvalue (icalparameter* param, const char* v);
const char* icalparameter_get_xvalue(icalparameter* param);
/* Convert enumerations */
const char* icalparameter_kind_to_string(icalparameter_kind kind);
icalparameter_kind icalparameter_string_to_kind(const char* string);
#endif

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,141 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalproperty.h
CREATOR: eric 20 March 1999
$Id: icalproperty.h,v 1.18 2004/03/17 19:06:50 acampi Exp $
$Locker: $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The original code is icalparam.h
======================================================================*/
#ifndef ICALPROPERTY_H
#define ICALPROPERTY_H
#include <time.h>
#include <stdarg.h> /* for va_... */
#include "icalderivedparameter.h"
#include "icalvalue.h"
#include "icalrecur.h"
/* Actually in icalderivedproperty.h:
typedef struct icalproperty_impl icalproperty; */
#include "icalderivedproperty.h" /* To get icalproperty_kind enumerations */
icalproperty* icalproperty_new(icalproperty_kind kind);
icalproperty* icalproperty_new_x_name(const char *name, const char *value);
icalproperty* icalproperty_new_clone(icalproperty * prop);
icalproperty* icalproperty_new_from_string(const char* str);
const char* icalproperty_as_ical_string(icalproperty* prop);
void icalproperty_free(icalproperty* prop);
icalproperty_kind icalproperty_isa(icalproperty* property);
int icalproperty_isa_property(void* property);
void icalproperty_add_parameters(struct icalproperty_impl *prop,va_list args);
void icalproperty_add_parameter(icalproperty* prop,icalparameter* parameter);
void icalproperty_set_parameter(icalproperty* prop,icalparameter* parameter);
void icalproperty_set_parameter_from_string(icalproperty* prop,
const char* name, const char* value);
const char* icalproperty_get_parameter_as_string(icalproperty* prop,
const char* name);
void icalproperty_remove_parameter(icalproperty* prop,
icalparameter_kind kind);
void icalproperty_remove_parameter_by_kind(icalproperty* prop,
icalparameter_kind kind);
void icalproperty_remove_parameter_by_name(icalproperty* prop,
const char *name);
void icalproperty_remove_parameter_by_ref(icalproperty* prop,
icalparameter *param);
int icalproperty_count_parameters(const icalproperty* prop);
/* Iterate through the parameters */
icalparameter* icalproperty_get_first_parameter(icalproperty* prop,
icalparameter_kind kind);
icalparameter* icalproperty_get_next_parameter(icalproperty* prop,
icalparameter_kind kind);
icalparameter* icalproperty_get_first_x_parameter(icalproperty* prop,
const char *name);
icalparameter* icalproperty_get_next_x_parameter(icalproperty* prop,
const char *name);
/* Access the value of the property */
void icalproperty_set_value(icalproperty* prop, icalvalue* value);
void icalproperty_set_value_from_string(icalproperty* prop,const char* value, const char* kind);
icalvalue* icalproperty_get_value(const icalproperty* prop);
const char* icalproperty_get_value_as_string(const icalproperty* prop);
/* Deal with X properties */
void icalproperty_set_x_name(icalproperty* prop, const char* name);
const char* icalproperty_get_x_name(icalproperty* prop);
/** Return the name of the property -- the type name converted to a
* string, or the value of _get_x_name if the type is and X
* property
*/
const char* icalproperty_get_property_name (const icalproperty* prop);
icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value value);
/* Convert kinds to string and get default value type */
icalvalue_kind icalproperty_kind_to_value_kind(icalproperty_kind kind);
icalproperty_kind icalproperty_value_kind_to_kind(icalvalue_kind kind);
const char* icalproperty_kind_to_string(icalproperty_kind kind);
icalproperty_kind icalproperty_string_to_kind(const char* string);
/** Check validity of a specific icalproperty_kind **/
int icalproperty_kind_is_valid(const icalproperty_kind kind);
icalproperty_method icalproperty_string_to_method(const char* str);
const char* icalproperty_method_to_string(icalproperty_method method);
const char* icalproperty_enum_to_string(int e);
int icalproperty_string_to_enum(const char* str);
int icalproperty_kind_and_string_to_enum(const int kind, const char* str);
const char* icalproperty_status_to_string(icalproperty_status);
icalproperty_status icalproperty_string_to_status(const char* string);
int icalproperty_enum_belongs_to_property(icalproperty_kind kind, int e);
#endif /*ICALPROPERTY_H*/

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,88 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalvalue.h
CREATOR: eric 20 March 1999
$Id: icalvalue.h,v 1.7 2002/08/08 16:48:29 lindner Exp $
$Locker: $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The original code is icalvalue.h
======================================================================*/
#ifndef ICALVALUE_H
#define ICALVALUE_H
#include <time.h>
#include "icalenums.h"
#include "icaltypes.h"
#include "icalrecur.h"
#include "icalduration.h"
#include "icalperiod.h"
#include "icalderivedproperty.h" /* For icalproperty_method, etc. */
#include "icalderivedparameter.h"
#include "icalderivedvalue.h"
/* Defined in icalderivedvalue.h */
/*typedef struct icalvalue_impl icalvalue;*/
icalvalue* icalvalue_new(icalvalue_kind kind);
icalvalue* icalvalue_new_clone(const icalvalue* value);
icalvalue* icalvalue_new_from_string(icalvalue_kind kind, const char* str);
void icalvalue_free(icalvalue* value);
int icalvalue_is_valid(const icalvalue* value);
const char* icalvalue_as_ical_string(const icalvalue* value);
icalvalue_kind icalvalue_isa(const icalvalue* value);
int icalvalue_isa_value(void*);
icalparameter_xliccomparetype icalvalue_compare(const icalvalue* a, const icalvalue *b);
/* Special, non autogenerated value accessors */
icalvalue* icalvalue_new_recur (struct icalrecurrencetype v);
void icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v);
struct icalrecurrencetype icalvalue_get_recur(const icalvalue* value);
icalvalue* icalvalue_new_trigger (struct icaltriggertype v);
void icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v);
struct icaltriggertype icalvalue_get_trigger(const icalvalue* value);
icalvalue* icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v);
void icalvalue_set_datetimeperiod(icalvalue* value,
struct icaldatetimeperiodtype v);
struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(const icalvalue* value);
/* Convert enumerations */
icalvalue_kind icalvalue_string_to_kind(const char* str);
const char* icalvalue_kind_to_string(const icalvalue_kind kind);
/** Check validity of a specific icalvalue_kind **/
int icalvalue_kind_is_valid(const icalvalue_kind kind);
/** Encode a character string in ical format, esacpe certain characters, etc. */
int icalvalue_encode_ical_string(const char *szText, char *szEncText, int MaxBufferLen);
#endif /*ICALVALUE_H*/