Functions#

bt() None#

Added in version 1.0.

errno_return() ErrorEnum#

Returns the error stored in the library. If no error, return I_CAL_NO_ERROR.

Added in version 1.0.

Returns:

Return the error happened

error_clear_errno() None#

Added in version 1.0.

error_crash_here() None#

Shout out the errors to the compiler.

Added in version 1.0.

error_get_error_state(error: ErrorEnum) ErrorState#

Gets the state of an error.

Added in version 1.0.

Parameters:

error – The error to be checked

Returns:

The state of the error

error_perror() str#

Gets the ErrorEnum in the string representation. This method called the icalerrorno_return to get the current error.

Added in version 1.0.

Returns:

The string representation of the current error

error_restore(error: str, es: ErrorState) None#

Restores the error to specified state.

Added in version 1.0.

Parameters:
  • error – The error to be restored

  • es – The error state to be restored

error_set_errno(x: ErrorEnum) None#

Sets the errno.

Added in version 1.0.

Parameters:

x – The error to be set

error_set_error_state(error: ErrorEnum, state: ErrorState) None#

Sets the state to the corresponding error in the library.

Added in version 1.0.

Parameters:
  • error – The error enum

  • state – The error state

error_stop_here() None#

Added in version 1.0.

error_strerror(e: ErrorEnum) str#

Translates the ErrorEnum to the string representation.

Added in version 1.0.

Parameters:

e – The ErrorEnum to be translated

Returns:

The string representation of e

error_supress(error: str) ErrorState#

Suppresses the error.

Added in version 1.0.

Parameters:

error – The error to be suppressed

Returns:

The error state suppressed

get_unknown_token_handling_setting() Unknowntokenhandling#

Gets the setting of Unknowntokenhandling.

Added in version 1.0.

Returns:

The setting of Unknowntokenhandling

memory_add_tmp_buffer(buf: Any = None) None#

Adds an existing buffer to the buffer ring.

Added in version 1.0.

Parameters:

buf – The existing buffer to be added into the ical

memory_append_char(buf: list[int], pos: list[int], ch: int) tuple[list[int], list[int]]#

Append the character to the buffer. Only use them on normally allocated memory, or on buffers created from icalmemory_new_buffer, never with buffers created by icalmemory_tmp_buffer. If icalmemory_append_string has to resize a buffer on the ring, the ring will loose track of it an you will have memory problems.

Added in version 1.0.

Parameters:
  • buf – The buffer to be appended. It should not be the memory in ical.

  • pos – The position at which the new string to be appended

  • ch – The character to be allocated

memory_append_string(buf: list[int], pos: list[int], str: str) tuple[list[int], list[int]]#

Appends the string to the buffer. Only use them on normally allocated memory, or on buffers created from icalmemory_new_buffer, never with buffers created by icalmemory_tmp_buffer. If icalmemory_append_string has to resize a buffer on the ring, the ring will loose track of it an you will have memory problems.

Added in version 1.0.

Parameters:
  • buf – The buffer to be appended. It should not be the memory in ical.

  • pos – The position at which the new string to be appended

  • str – The string to be allocated

memory_free_buffer(buf: Any = None) None#

Frees the buffer.

Added in version 1.0.

Parameters:

buf – The buffer to be freed

memory_new_buffer(size: int) Any | None#

Creates a new buffer with target size. The caller should deallocate it when necessary.

Added in version 1.0.

Parameters:

size – The size of the new buffer to be created

Returns:

The newly created buffer with the target size.

memory_resize_buffer(buf: Any, size: int) Any | None#

Resizes the buffer to the target size.

Added in version 1.0.

Parameters:
  • buf – The buffer needs to be resized

  • size – The target size the buffer to be resized to

Returns:

The buffer after being resized.

memory_strdup(s: str) str#

A wrapper around strdup. Partly to trap calls to strdup, partly because in -ansi, gcc on Red Hat claims that strdup is undeclared.

Added in version 1.0.

Parameters:

s – The string to be cloned

Returns:

The cloned string.

memory_tmp_buffer(size: int) Any | None#

Creates a buffer with target size.

Added in version 1.0.

Parameters:

size – The size of the buffer to be created

Returns:

The newly created buffer

mime_parse(func: Callable[[list[int], Any], str], user_data: Any = None) Component#

Parses data to Component using the given function.

Added in version 1.0.

Parameters:
  • func – The parsing function

  • user_data – The date given to func

Returns:

The parsed Component

recur_expand_recurrence(rule: str, start: int, count: int) list[int]#

Fills an array with the ‘count’ number of occurrences generated by the rrule. Note that the times are returned in UTC, but the times are calculated in local time. YOu will have to convert the results back into local time before using them.

Added in version 1.0.

Parameters:
  • rule – The rule of the recurrence

  • start – The start seconds past the POSIX epoch

  • count – The number of elements to be filled up in the array

Returns:

If successful, return the array. NULL if failed.

request_status_code(stat: RequestStatus) str#

Returns the code for a request status.

Added in version 1.0.

Parameters:

stat – The RequestStatus to be queried

Returns:

The code for a request status

request_status_desc(stat: RequestStatus) str#

Returns the descriptive text for a request status.

Added in version 1.0.

Parameters:

stat – The RequestStatus to be translated

Returns:

The description of the stat

request_status_from_num(major: int, minor: int) RequestStatus#

Returns a request status for major/minor status numbers.

Added in version 1.0.

Parameters:
  • major – The major number

  • minor – The minor number

Returns:

The corresponding RequestStatus

request_status_major(stat: RequestStatus) int#

Returns the major number for a request status.

Added in version 1.0.

Parameters:

stat – The RequestStatus to be queried

Returns:

The major number for a request status

request_status_minor(stat: RequestStatus) int#

Returns the minor number for a request status.

Added in version 1.0.

Parameters:

stat – The RequestStatus to be queried

Returns:

The minor number for a request status

restriction_check(comp: Component) int#

Checks whether the Component is valid.

Added in version 1.0.

Parameters:

comp – The component to be checked

Returns:

Whether the comp is valid.

restriction_compare(restr: RestrictionKind, count: int) int#

Compares the kind of restriction and the count to determine whether it is valid.

Added in version 1.0.

Parameters:
  • restr – The restriction kind

  • count – The number of restrictions

Returns:

Whether it is valid or not. -1 indicates invalid or more analysis. 1 indicates pass and 0 or 2+ indicates fail.

set_unknown_token_handling_setting(newSetting: Unknowntokenhandling) None#

Sets Unknowntokenhandling.

Added in version 1.0.

Parameters:

newSetting – A Unknowntokenhandling