Squash  0.7.0
Data Structures | Functions | Variables
SquashOptions

A set of compression/decompression options. More...

Data Structures

struct  SquashOptions
 A set of compression/decompression options. More...
 
struct  SquashOptionInfoEnumString
 A list of strings which are mapped to integer values. More...
 
struct  _SquashOptionInfoEnumStringMap
 An item in a map of strings to integer values. More...
 
struct  SquashOptionInfoEnumInt
 A list of potential integer values. More...
 
struct  SquashOptionInfoRangeInt
 A range of potential integer values. More...
 
struct  SquashOptionInfoRangeSize
 A range of potential size values. More...
 
union  SquashOptionValue
 A value. More...
 
struct  SquashOptionInfo
 Information about options which can be passed to a codec. More...
 

Functions

const char * squash_options_get_string (SquashOptions *options, const char *key)
 
bool squash_options_get_bool (SquashOptions *options, const char *key)
 
int squash_options_get_int (SquashOptions *options, const char *key)
 
size_t squash_options_get_size (SquashOptions *options, const char *key)
 
SquashStatus squash_options_parse_option (SquashOptions *options, const char *key, const char *value)
 Parse a single option. More...
 
SquashStatus squash_options_parsea (SquashOptions *options, const char *const *keys, const char *const *values)
 Parse an array of options. More...
 
SquashStatus squash_options_parsev (SquashOptions *options, va_list options_list)
 Parse a va_list of options. More...
 
SquashStatus squash_options_parse (SquashOptions *options,...)
 Parse a variadic list of options. More...
 
SquashOptions * squash_options_new (SquashCodec *codec,...)
 Create a new group of options. More...
 
SquashOptions * squash_options_newv (SquashCodec *codec, va_list options)
 Create a new group of options from a variadic list. More...
 
SquashOptions * squash_options_newa (SquashCodec *codec, const char *const *keys, const char *const *values)
 Create a new group of options from key and value arrays. More...
 
void squash_options_init (void *options, SquashCodec *codec, SquashDestroyNotify destroy_notify)
 Initialize a new SquashOptions instance. More...
 
void squash_options_destroy (void *options)
 Destroy a SquashOptions instance. More...
 

Variables

SquashOptionValue * SquashOptions::values
 NULL-terminated array of option values.
 
const SquashOptionInfoEnumStringMap * SquashOptionInfoEnumString::values
 a NULL terminated list of string and integer pairs
 
const char * _SquashOptionInfoEnumStringMap::name
 a string representing the option value
 
int _SquashOptionInfoEnumStringMap::value
 an integer representing the option value
 
size_t SquashOptionInfoEnumInt::values_length
 number of integer values understood for this option
 
const int * SquashOptionInfoEnumInt::values
 array of integer values understood for this option
 
int SquashOptionInfoRangeInt::min
 minimum value for this option
 
int SquashOptionInfoRangeInt::max
 maximum value for this option
 
int SquashOptionInfoRangeInt::modulus
 modulus of acceptable values, or 0 to accept all
 
bool SquashOptionInfoRangeInt::allow_zero
 whether to allow zero as a value More...
 
size_t SquashOptionInfoRangeSize::min
 minimum value for this option
 
size_t SquashOptionInfoRangeSize::max
 maximum value for this option
 
size_t SquashOptionInfoRangeSize::modulus
 modulus of acceptable values, or 0 to accept all
 
bool SquashOptionInfoRangeSize::allow_zero
 whether to allow zero as a value More...
 
char * SquashOptionValue::string_value
 the value as a string
 
int SquashOptionValue::int_value
 the value as an integer
 
bool SquashOptionValue::bool_value
 the value as a boolean
 
size_t SquashOptionValue::size_value
 the value as a size
 
const char * SquashOptionInfo::name
 name of the option
 
SquashOptionType SquashOptionInfo::type
 type of the option
 
union {
   struct _SquashOptionInfoEnumString   enum_string
 
   struct _SquashOptionInfoEnumInt   enum_int
 
   struct _SquashOptionInfoRangeInt   range_int
 
   struct _SquashOptionInfoRangeSize   range_size
 
SquashOptionInfo::info
 detailed information about the value
 
SquashOptionValue SquashOptionInfo::default_value
 value to use if none is provided by the user
 

Detailed Description

A set of compression/decompression options.

Function Documentation

void squash_options_destroy ( void *  options)

Destroy a SquashOptions instance.

This function should only be used for subclassing. See squash_object_destroy for more information.

Parameters
optionsThe instance to destroy.

Definition at line 661 of file options.c.

bool squash_options_get_bool ( SquashOptions *  options,
const char *  key 
)

Retrieve the value of a boolean option

Parameters
optionsthe options to retrieve the value from
keyname of the option to retrieve the value from
Returns
the value

Definition at line 217 of file options.c.

int squash_options_get_int ( SquashOptions *  options,
const char *  key 
)

Retrieve the value of an integer option

Parameters
optionsthe options to retrieve the value from
keyname of the option to retrieve the value from
Returns
the value

Definition at line 246 of file options.c.

size_t squash_options_get_size ( SquashOptions *  options,
const char *  key 
)

Retrieve the value of a size option

Parameters
optionsthe options to retrieve the value from
keyname of the option to retrieve the value from
Returns
the value

Definition at line 277 of file options.c.

const char* squash_options_get_string ( SquashOptions *  options,
const char *  key 
)

Retrieve the value of a string option

Note
If the option is not natively a string (e.g., if it is an integer, size, or boolean), it will not be serialized to one.
Parameters
optionsthe options to retrieve the value from
keyname of the option to retrieve the value from
Returns
the value, or NULL on failure

Definition at line 186 of file options.c.

void squash_options_init ( void *  options,
SquashCodec *  codec,
SquashDestroyNotify  destroy_notify 
)

Initialize a new SquashOptions instance.

This function should only be used for subclassing. See squash_object_init for more information.

Parameters
optionsThe instance to initialize.
codecThe codec to use.
destroy_notifyThe function to be squashled when the reference count reaches 0

Definition at line 607 of file options.c.

SquashOptions* squash_options_new ( SquashCodec *  codec,
  ... 
)

Create a new group of options.

Parameters
codecThe codec to create the options for.
...A variadic list of string key/value pairs followed by NULL
Returns
A new option group, or NULL on failure.

Definition at line 533 of file options.c.

SquashOptions* squash_options_newa ( SquashCodec *  codec,
const char *const *  keys,
const char *const *  values 
)

Create a new group of options from key and value arrays.

Parameters
codecThe codec to create the options for.
keysA NULL-terminated array of keys.
valuesA NULL-terminated array of values.
Returns
A new option group, or NULL on failure.

Definition at line 582 of file options.c.

SquashOptions* squash_options_newv ( SquashCodec *  codec,
va_list  options 
)

Create a new group of options from a variadic list.

Parameters
codecThe codec to create the options for.
optionsA variadic list of string key/value pairs followed by NULL
Returns
A new option group, or NULL if codec does not accept any options or could not be loaded.

Definition at line 560 of file options.c.

SquashStatus squash_options_parse ( SquashOptions *  options,
  ... 
)

Parse a variadic list of options.

Parameters
optionsThe options context.
...The options to parse. These should be alternating key and value pairs of strings, one for each option, followed by NULL.
Returns
A status code.

Definition at line 514 of file options.c.

SquashStatus squash_options_parse_option ( SquashOptions *  options,
const char *  key,
const char *  value 
)

Parse a single option.

Parameters
optionsThe options context.
keyThe option key to parse.
valueThe option value to parse.
Returns
A status code.
Return values
SQUASH_OKOption parsed successfully.
SQUASH_BAD_PARAMInvalid key.
SQUASH_BAD_VALUEInvalid value

Definition at line 311 of file options.c.

SquashStatus squash_options_parsea ( SquashOptions *  options,
const char *const *  keys,
const char *const *  values 
)

Parse an array of options.

Parameters
optionsThe options context.
keysThe option keys to parse.
valuesThe option values to parse.
Returns
A status code.

Definition at line 458 of file options.c.

SquashStatus squash_options_parsev ( SquashOptions *  options,
va_list  options_list 
)

Parse a va_list of options.

Parameters
options- The options context.
options_list- The options to parse. See squash_options_parse for a description of the format.
Returns
A status code.

Definition at line 486 of file options.c.

Variable Documentation

SquashOptionInfoRangeInt::allow_zero

whether to allow zero as a value

Note that this is in addition to the range, and independent of the modulus.

Definition at line 86 of file options.h.

SquashOptionInfoRangeSize::allow_zero

whether to allow zero as a value

Note that this is in addition to the range, and independent of the modulus.

Definition at line 93 of file options.h.