Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
option_map Struct Reference

Data Fields

char name [NAME_LEN_MAX+1]
 
uint8_t type
 
uint8_t flags
 
uint16_t offset
 
union { 
 
   struct { 
 
      uint32_t   min 
 
      uint32_t   max 
 
   }   range 
 
   const name_value_map *   map 
 
u 
 
const char * name
 
const name_id_mapmap
 
uint64_t min
 
uint64_t max
 
union { 
 
   struct { 
 
      uint32_t   min 
 
      uint32_t   max 
 
   }   range 
 
   const name_value_map *   map 
 
u 
 
union { 
 
   const name_value_map *   map 
 
   struct { 
 
      uint32_t   min 
 
      uint32_t   max 
 
   }   range 
 
u 
 

Detailed Description

Each filter that has options needs an array of option_map structures. The array doesn't need to be terminated as the functions take the length of the array as an argument.

When converting a string to filter options structure, option values will be handled in a few different ways:

(1) If .type equals OPTMAP_TYPE_LZMA_PRESET then LZMA1/2 preset string is handled specially.

(2) If .flags has OPTMAP_USE_NAME_VALUE_MAP set then the string is converted to an integer using the name_value_map pointed by .u.map. The last element in .u.map must have .name = "" as the terminator.

(3) Otherwise the string is treated as a non-negative unsigned decimal integer which must be in the range set in .u.range. If .flags has OPTMAP_USE_BYTE_SUFFIX then KiB, MiB, and GiB suffixes are allowed.

The integer value from (2) or (3) is then stored to filter_options at the offset specified in .offset using the type specified in .type (default is uint32_t).

Stringifying a filter is done by processing a given number of options in oder from the beginning of an option_map array. The integer is read from filter_options at .offset using the type from .type.

If the integer is zero and .flags has OPTMAP_NO_STRFY_ZERO then the option is skipped.

If .flags has OPTMAP_USE_NAME_VALUE_MAP set then .u.map will be used to convert the option to a string. If the map doesn't contain a string for the integer value then "UNKNOWN" is used.

If .flags doesn't have OPTMAP_USE_NAME_VALUE_MAP set then the integer is converted to a decimal value. If OPTMAP_USE_BYTE_SUFFIX is used then KiB, MiB, or GiB suffix is used if the value is an exact multiple of these. Plain "B" suffix is never used.

Each filter that has options needs an array of option_map structures. The array doesn't need to be terminated as the functions take the length of the array as an argument.

When converting a string to filter options structure, option values will be handled in a few different ways:

(1) If .type equals OPTMAP_TYPE_LZMA_PRESET then LZMA1/2 preset string is handled specially.

(2) If .flags has OPTMAP_USE_NAME_VALUE_MAP set then the string is converted to an integer using the name_value_map pointed by .u.map. The last element in .u.map must have .name = "" as the terminator.

(3) Otherwise the string is treated as a non-negative unsigned decimal integer which must be in the range set in .u.range. If .flags has OPTMAP_USE_BYTE_SUFFIX then KiB, MiB, and GiB suffixes are allowed.

The integer value from (2) or (3) is then stored to filter_options at the offset specified in .offset using the type specified in .type (default is uint32_t).

Stringifying a filter is done by processing a given number of options in order from the beginning of an option_map array. The integer is read from filter_options at .offset using the type from .type.

If the integer is zero and .flags has OPTMAP_NO_STRFY_ZERO then the option is skipped.

If .flags has OPTMAP_USE_NAME_VALUE_MAP set then .u.map will be used to convert the option to a string. If the map doesn't contain a string for the integer value then "UNKNOWN" is used.

If .flags doesn't have OPTMAP_USE_NAME_VALUE_MAP set then the integer is converted to a decimal value. If OPTMAP_USE_BYTE_SUFFIX is used then KiB, MiB, or GiB suffix is used if the value is an exact multiple of these. Plain "B" suffix is never used.

Field Documentation

◆ flags

uint8_t flags

◆ map [1/2]

◆ map [2/2]

◆ max [1/2]

uint64_t max

◆ max [2/2]

uint64_t max

◆ min [1/2]

uint64_t min

◆ min [2/2]

uint64_t min

◆ name [1/2]

const char * name

◆ name [2/2]

const char* name

◆ offset

uint16_t offset

◆ [struct] [1/3]

struct { ... } range

◆ [struct] [2/3]

struct { ... } range

◆ [struct] [3/3]

struct { ... } range

◆ type

uint8_t type

◆ [union] [1/3]

union { ... } u

◆ [union] [2/3]

union { ... } u

◆ [union] [3/3]

union { ... } u

The documentation for this struct was generated from the following files: