27 #ifndef SQUASH_OPTIONS_H
28 #define SQUASH_OPTIONS_H
30 #if !defined (SQUASH_H_INSIDE) && !defined (SQUASH_COMPILATION)
31 #error "Only <squash/squash.h> can be included directly."
55 SQUASH_OPTION_TYPE_NONE = 0,
56 SQUASH_OPTION_TYPE_BOOL = 1,
57 SQUASH_OPTION_TYPE_STRING = 2,
58 SQUASH_OPTION_TYPE_INT = 3,
59 SQUASH_OPTION_TYPE_SIZE = 4,
61 SQUASH_OPTION_TYPE_ENUM_STRING = (16 | SQUASH_OPTION_TYPE_STRING),
62 SQUASH_OPTION_TYPE_ENUM_INT = (16 | SQUASH_OPTION_TYPE_INT),
64 SQUASH_OPTION_TYPE_RANGE_INT = (32 | SQUASH_OPTION_TYPE_INT),
65 SQUASH_OPTION_TYPE_RANGE_SIZE = (32 | SQUASH_OPTION_TYPE_SIZE),
74 const SquashOptionInfoEnumStringMap*
values;
117 SQUASH_API SquashOptions*
squash_options_newa (SquashCodec* codec,
const char*
const* keys,
const char*
const* values);
size_t min
minimum value for this option
SQUASH_API void squash_options_init(void *options, SquashCodec *codec, SquashDestroyNotify destroy_notify)
Initialize a new SquashOptions instance.
int max
maximum value for this option
SQUASH_API SquashStatus squash_options_parse(SquashOptions *options,...)
Parse a variadic list of options.
SQUASH_API int squash_options_get_int(SquashOptions *options, const char *key)
char * string_value
the value as a string
union _SquashOptionInfo::@1 info
detailed information about the value
SQUASH_API SquashStatus squash_options_parsev(SquashOptions *options, va_list options_list)
Parse a va_list of options.
SQUASH_API SquashStatus squash_options_parsea(SquashOptions *options, const char *const *keys, const char *const *values)
Parse an array of options.
int min
minimum value for this option
SQUASH_API SquashOptions * squash_options_new(SquashCodec *codec,...)
Create a new group of options.
SquashOptionType type
type of the option
void(* SquashDestroyNotify)(void *data)
Callback to be invoked when information data is no longer needed.
bool allow_zero
whether to allow zero as a value
size_t size_value
the value as a size
SQUASH_API const char * squash_options_get_string(SquashOptions *options, const char *key)
const char * name
a string representing the option value
SQUASH_API SquashStatus squash_options_parse_option(SquashOptions *options, const char *key, const char *value)
Parse a single option.
SQUASH_API SquashOptions * squash_options_newv(SquashCodec *codec, va_list options)
Create a new group of options from a variadic list.
SQUASH_API bool squash_options_get_bool(SquashOptions *options, const char *key)
SquashOptionValue default_value
value to use if none is provided by the user
size_t max
maximum value for this option
int value
an integer representing the option value
size_t values_length
number of integer values understood for this option
const SquashOptionInfoEnumStringMap * values
a NULL terminated list of string and integer pairs
size_t modulus
modulus of acceptable values, or 0 to accept all
A list of strings which are mapped to integer values.
SQUASH_API 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.
SquashStatus
Status codes.
Information about options which can be passed to a codec.
int int_value
the value as an integer
bool bool_value
the value as a boolean
SquashCodec * codec
Codec.
int modulus
modulus of acceptable values, or 0 to accept all
bool allow_zero
whether to allow zero as a value
SQUASH_API void squash_options_destroy(void *options)
Destroy a SquashOptions instance.
A set of compression/decompression options.
const char * name
name of the option
A list of potential integer values.
const int * values
array of integer values understood for this option
An item in a map of strings to integer values.
A range of potential size values.
SQUASH_API size_t squash_options_get_size(SquashOptions *options, const char *key)
SquashObject base_object
Base object.
A range of potential integer values.
SquashOptionValue * values
NULL-terminated array of option values.