| Oyranos Colour Management System API

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- Data Structures
- Data Structure Index
- Class Hierarchy
- Data Fields

Public Member Functions | Data Fields
oyOption_s Struct Reference
Values Handling

Option object. More...

`#include <oyOption_s.h>`

Inheritance diagram for oyOption_s:
Collaboration diagram for oyOption_s:

## Public Member Functions
OYAPI oyOption_s *OYEXPORT | oyOption_New (oyObject_s object)
| allocate a new Option object More...
OYAPI oyOption_s *OYEXPORT | oyOption_Copy (oyOption_s *option, oyObject_s object)
| copy or reference a Option object More...
OYAPI int OYEXPORT | oyOption_Release (oyOption_s **option)
| release and possibly deallocate a oyOption_s object More...
oyOption_s * | oyOption_FromRegistration (const char *registration, oyObject_s object)
| new option with registration and value filled from DB if available More...
int | oyOption_GetId (oyOption_s *obj)
| get the identification number of a option More...
const char * | oyOption_GetText (oyOption_s *obj, oyNAME_e type)
| get a text dump More...
int | oyOption_SetFromText (oyOption_s *obj, const char *text, uint32_t flags)
| set a option value from a string More...
char * | oyOption_GetValueText (oyOption_s *obj, oyAlloc_f allocateFunc)
| get value as a text dump More...
const char * | oyOption_GetValueString (oyOption_s *obj, int pos)
| get a string More...
int | oyOption_SetFromInt (oyOption_s *obj, int32_t integer, int pos, uint32_t flags)
| set a integer More...
int32_t | oyOption_GetValueInt (oyOption_s *obj, int pos)
| get a integer More...
int | oyOption_SetFromDouble (oyOption_s *obj, double floating_point, int pos, uint32_t flags)
| set a double value More...
double | oyOption_GetValueDouble (oyOption_s *obj, int pos)
| get a double More...
int | oyOption_Clear (oyOption_s *obj)
| clear a option More...
int | oyOption_SetFromData (oyOption_s *option, oyPointer ptr, size_t size)
| set value from a data blob More...
oyPointer | oyOption_GetData (oyOption_s *option, size_t *size, oyAlloc_f allocateFunc)
| get the data blob More...
int | oyOption_SetRegistration (oyOption_s *option, const char *registration)
| set the registration More...
const char * | oyOption_GetRegistration (oyOption_s *option)
| get the registration More...
int | oyOption_StructMoveIn (oyOption_s *option, oyStruct_s **oystruct)
| value filled by a oyStruct_s object More...
oyStruct_s * | oyOption_GetStruct (oyOption_s *option, oyOBJECT_e type)
| ask for a oyStruct_s object More...
oyOption_s * | oyOption_FromDB (const char *registration, oyObject_s object)
| new option with registration and value filled from DB if available More...
int | oyOption_SetValueFromDB (oyOption_s *option)
| Value filled from DB if available. More...
Public Member Functions inherited from oyStruct_s
const char * | oyStruct_GetText (oyStruct_s *obj, oyNAME_e name_type, uint32_t flags)
| get a text dump More...

## Data Fields
oyStruct_Copy_f | copy
oyStruct_Release_f | release
Data Fields inherited from oyStruct_s
oyStruct_Copy_f | copy
oyStruct_Release_f | release

## Detailed Description

Option object.

Todo:
  include the oyOptions_t_ type for gui elements should be used in a list oyColourTransformOptions_s to form a options set oyOptions_t_ covers as well the UI part which should be separated as of the SimpleToolkitAbstraction project: http://www.oyranos.org/wiki/index.php?title=XML_Plug-in_options As of this architecture change The UI part must be decided to obtain a place. Probably in oyOptions_s? Thus the oyOption_s::name member should be removed.

The id field maps to a oyWidget_s object. Options and widgets are to be queried by the according function / CMM combination.

Version
  Oyranos: 0.1.8

Since
  2007/00/00 (Oyranos: 0.1.x)

Date
  2008/04/14

## Member Function Documentation

int oyOption_Clear | ( | oyOption_s * | obj | ) |

clear a option

Function oyOption_Clear

Version
  Oyranos: 0.1.9

Since
  2008/11/27 (Oyranos: 0.1.9)

Date
  2008/11/27

References oyOBJECT_OPTION_S, oySIGNAL_DATA_CHANGED, oyObserver_s::oyStruct_ObserverSignal(), and oyValue_u::oyValueRelease().

OYAPI oyOption_s *OYEXPORT oyOption_Copy | ( | oyOption_s * | option,
|  | oyObject_s | object
| ) |  |

copy or reference a Option object

Function oyOption_Copy

The function is for copying and for referencing. The reference is the most often used way, which saves resourcs and time.

Parameters

  [in] | option | Option struct object
  | object | NULL - means reference, the optional object triggers a real copy

References oyOBJECT_OPTION_S.

Referenced by oyOptions_s::oyOptions_Add(), and oyOptions_s::oyOptions_Set().

oyOption_s * oyOption_FromDB | ( | const char * | registration,
|  | oyObject_s | object
| ) |  |

new option with registration and value filled from DB if available

Function oyOption_FromDB

Parameters

  registration | no or full qualified registration
  object | the optional object

Returns
  the option

Version
  Oyranos: 0.1.10

Since
  2009/01/24 (Oyranos: 0.1.10)

Date
  2009/01/24

This is merely a wrapper to oyOption_New() and oyOption_SetValueFromDB().

References oyOption_FromRegistration(), oyOption_SetFromText(), oyOption_SetValueFromDB(), and oyOPTIONSOURCE_DATA.

Referenced by oyConfigs_s::oyConfigs_FromDB().

oyOption_s * oyOption_FromRegistration | ( | const char * | registration,
|  | oyObject_s | object
| ) |  |

new option with registration and value filled from DB if available

Function oyOption_FromRegistration

FIXME value filled from DB if available???

Parameters

  registration | no or full qualified registration
  object | the optional object

Returns
  the option

Version
  Oyranos: 0.1.10

Since
  2009/01/24 (Oyranos: 0.1.10)

Date
  2009/01/24

References oyOption_New(), oyOption_Release(), and oyOption_SetRegistration().

Referenced by oyDeviceSetup(), oyOption_FromDB(), oyOptions_s::oyOptions_MoveInStruct(), oyOptions_s::oyOptions_SetDriverContext(), oyOptions_s::oyOptions_SetFromData(), oyOptions_s::oyOptions_SetFromDouble(), oyOptions_s::oyOptions_SetFromInt(), and oyOptions_s::oyOptions_SetFromText().

oyPointer oyOption_GetData | ( | oyOption_s * | option,
|  | size_t * | size,
|  | oyAlloc_f | allocateFunc
| ) |  |

get the data blob

Function oyOption_GetData

With data size being greater than zero, the returned pointer is owned by the caller.

Parameters

  [in] | option | the option
  [out] | size | data size
  [in] | allocateFunc | user allocator

Returns
  data

Version
  Oyranos: 0.1.10

Since
  2009/01/04 (Oyranos: 0.1.10)

Date
  2009/07/22

References oyOBJECT_BLOB_S, oyOBJECT_OPTION_S, oyOBJECT_POINTER_S, and oyVAL_STRUCT.

Referenced by oyOptions_s::oyOptions_FindData().

int oyOption_GetId | ( | oyOption_s * | obj | ) |

get the identification number of a option

Function oyOption_GetId

Version
  Oyranos: 0.1.8

Since
  2008/07/10 (Oyranos: 0.1.8)

Date
  2008/07/10

References oyOBJECT_OPTION_S.

const char * oyOption_GetRegistration | ( | oyOption_s * | option | ) |

get the registration

Function oyOption_GetRegistration

Parameters

  [in] | option | the option

Returns
  registration

Version
  Oyranos: 0.1.10

Since
  2010/02/26 (Oyranos: 0.1.10)

Date
  2010/02/26

References oyOBJECT_OPTION_S.

Referenced by oyConfig_s::oyConfig_Compare(), oyConfig_s::oyConfig_EraseFromDB(), oyDeviceGetInfo(), oyDeviceProfileFromDB(), oyDeviceSelectSimiliar(), oyDeviceSetProfile(), oyDeviceToJSON(), oyOption_SetValueFromDB(), oyOptions_s::oyOptions_DoFilter(), oyOptions_s::oyOptions_SaveToDB(), and oyProfile_s::oyProfile_AddDevice().

oyStruct_s * oyOption_GetStruct | ( | oyOption_s * | option,
|  | oyOBJECT_e | type
| ) |  |

ask for a oyStruct_s object

Function oyOption_GetStruct

Parameters

  option | the option
  type | the Oranos oyOBJECT_e object type

Returns
  Oyranos struct, as reference if possible

Version
  Oyranos: 0.5.0

Date
  2012/10/05

Since
  2009/03/09 (Oyranos: 0.1.10)

References oyStruct_s::copy, and oyVAL_STRUCT.

Referenced by oyDeviceAskProfile2(), oyObserver_s::oyStruct_DisableSignalSend(), oyObserver_s::oyStruct_EnableSignalSend(), oyObserver_s::oyStruct_IsObserved(), and oyObserver_s::oyStruct_ObserverSignal().

const char * oyOption_GetText | ( | oyOption_s * | obj,
|  | oyNAME_e | type
| ) |  |

get a text dump

Function oyOption_GetText

Only oyOption_s::value is written.

The type argument should select the following string in return:

- oyNAME_NAME - a readable XFORMS element
- oyNAME_NICK - the hash ID
- oyNAME_DESCRIPTION - option registration name with key and without key attributes or value

Parameters

  [in,out] | obj | the option
  | type | oyNAME_NICK is equal to an ID

Returns
  the text

Version
  Oyranos: 0.1.10

Since
  2008/11/02 (Oyranos: 0.1.8)

Date
  2009/08/30

Iterate into oyOptions_s objects.

References oyNAME_DESCRIPTION, oyNAME_NAME, oyNAME_NICK, oyOBJECT_OPTION_S, oyOBJECT_OPTIONS_S, oyOption_GetValueText(), oyOptions_s::oyOptions_GetText(), oyStruct_s::oyStruct_GetText(), and oyVAL_STRUCT.

Referenced by oyOption_SetValueFromDB(), oyOptions_s::oyOptions_DoFilter(), and oyOptions_s::oyOptions_GetText().

double oyOption_GetValueDouble | ( | oyOption_s * | obj,
|  | int | pos
| ) |  |

get a double

Function oyOption_GetValueDouble

Parameters

  [in,out] | obj | the option
  | pos | position in a list

Returns
  double

Version
  Oyranos: 0.1.10

Since
  2009/08/03 (Oyranos: 0.1.10)

Date
  2009/08/03

References oyOBJECT_OPTION_S, and oyVAL_DOUBLE.

Referenced by oyOptions_s::oyOptions_FindDouble().

int32_t oyOption_GetValueInt | ( | oyOption_s * | obj,
|  | int | pos
| ) |  |

get a integer

Function oyOption_GetValueInt

Parameters

  [in,out] | obj | the option
  | pos | position in a list

Returns
  integer

Version
  Oyranos: 0.1.10

Since
  2009/05/04 (Oyranos: 0.1.10)

Date
  2009/05/04

References oyOBJECT_OPTION_S.

Referenced by oyOptions_s::oyOptions_FindInt().

const char * oyOption_GetValueString | ( | oyOption_s * | obj,
|  | int | pos
| ) |  |

get a string

Function oyOption_GetValueString

Parameters

  obj | the option
  pos | position in a list

Returns
  the text

Version
  Oyranos: 0.3.0

Since
  2011/02/01 (Oyranos: 0.3.0)

Date
  2011/02/01

References oyOBJECT_OPTION_S.

Referenced by oyDeviceProfileFromDB(), oyDeviceSelectSimiliar(), and oyOptions_s::oyOptions_SaveToDB().

char * oyOption_GetValueText | ( | oyOption_s * | obj,
|  | oyAlloc_f | allocateFunc
| ) |  |

get value as a text dump

Function oyOption_GetValueText

Parameters

  obj | the option
  allocateFunc | user allocator

Returns
  the text

Version
  Oyranos: 0.1.9

Since
  2008/12/05 (Oyranos: 0.1.9)

Date
  2009/08/17

References oyOBJECT_OPTION_S.

Referenced by oyConfig_s::oyConfig_Compare(), oyDeviceGetInfo(), oyDeviceProfileFromDB(), oyDeviceToJSON(), oyOption_GetText(), oyOptions_s::oyOptions_GetText(), and oyProfile_s::oyProfile_AddDevice().

OYAPI oyOption_s *OYEXPORT oyOption_New | ( | oyObject_s | object | ) |

allocate a new Option object

Function oyOption_New

References oyOBJECT_OBJECT_S.

Referenced by oyOption_FromRegistration().

OYAPI int OYEXPORT oyOption_Release | ( | oyOption_s ** | option | ) |

release and possibly deallocate a oyOption_s object

Function oyOption_Release

Parameters

  [in,out] | option | Option struct object

References oyOBJECT_OPTION_S.

Referenced by oyConfig_s::oyConfig_Compare(), oyConfig_s::oyConfig_EraseFromDB(), oyConfig_s::oyConfig_Has(), oyConfigs_s::oyConfigs_FromDB(), oyDeviceAskProfile2(), oyDeviceGetInfo(), oyDeviceProfileFromDB(), oyDeviceSelectSimiliar(), oyDeviceSetProfile(), oyDeviceSetup(), oyDeviceToJSON(), oyOption_FromRegistration(), oyOptions_s::oyOptions_Add(), oyOptions_s::oyOptions_CopyFrom(), oyOptions_s::oyOptions_CountType(), oyOptions_s::oyOptions_DoFilter(), oyOptions_s::oyOptions_Filter(), oyOptions_s::oyOptions_Find(), oyOptions_s::oyOptions_FindData(), oyOptions_s::oyOptions_FindDouble(), oyOptions_s::oyOptions_FindInt(), oyOptions_s::oyOptions_FindString(), oyOptions_s::oyOptions_ForFilter_(), oyOptions_s::oyOptions_FromBoolean(), oyOptions_s::oyOptions_GetText(), oyOptions_s::oyOptions_GetType(), oyOptions_s::oyOptions_MoveInStruct(), oyOptions_s::oyOptions_ObserversDisable(), oyOptions_s::oyOptions_ObserversEnable(), oyOptions_s::oyOptions_SaveToDB(), oyOptions_s::oyOptions_Set(), oyOptions_s::oyOptions_SetFromData(), oyOptions_s::oyOptions_SetFromDouble(), oyOptions_s::oyOptions_SetFromInt(), oyOptions_s::oyOptions_SetFromText(), oyOptions_s::oyOptions_SetOpts(), and oyOptions_s::oyOptions_SetSource().

int oyOption_SetFromData | ( | oyOption_s * | option,
|  | oyPointer | ptr,
|  | size_t | size
| ) |  |

set value from a data blob

Function oyOption_SetFromData

Parameters

  [in] | option | the option
  [in] | ptr | data
  [in] | size | data size

Returns
  0 - success, 1 - error

Version
  Oyranos: 0.1.10

Since
  2009/01/04 (Oyranos: 0.1.10)

Date
  2009/01/06

References oyBlob_s::oyBlob_New(), oyBlob_s::oyBlob_SetFromData(), oyOBJECT_BLOB_S, oyOBJECT_OPTION_S, oyOBJECT_POINTER_S, oySIGNAL_DATA_CHANGED, oyObserver_s::oyStruct_ObserverSignal(), oyVAL_STRUCT, and oyValue_u::oyValueClear().

Referenced by oyOption_SetValueFromDB(), oyOptions_s::oyOptions_SetDriverContext(), and oyOptions_s::oyOptions_SetFromData().

int oyOption_SetFromDouble | ( | oyOption_s * | obj,
|  | double | floating_point,
|  | int | pos,
|  | uint32_t | flags
| ) |  |

set a double value

Function oyOption_SetFromDouble

Parameters

  [in,out] | obj | the option
  | floating_point | the value
  | pos | position in a list
  | flags | unused

Returns
  0 - success, 1 - error

Version
  Oyranos: 0.1.10

Since
  2009/08/03 (Oyranos: 0.1.10)

Date
  2009/08/03

References oyOBJECT_OPTION_S, oyOPTIONATTRIBUTE_EDIT, oySIGNAL_DATA_CHANGED, oyObserver_s::oyStruct_ObserverSignal(), oyVAL_DOUBLE, and oyValue_u::oyValueRelease().

Referenced by oyOptions_s::oyOptions_SetFromDouble().

int oyOption_SetFromInt | ( | oyOption_s * | obj,
|  | int32_t | integer,
|  | int | pos,
|  | uint32_t | flags
| ) |  |

set a integer

Function oyOption_SetFromInt

Parameters

  [in,out] | obj | the option
  | integer | the value
  | pos | position in a list
  | flags | unused

Returns
  0 - success, 1 - error

Version
  Oyranos: 0.1.10

Since
  2009/05/04 (Oyranos: 0.1.10)

Date
  2009/05/04

References oyOBJECT_OPTION_S.

Referenced by oyOptions_s::oyOptions_SetFromInt().

int oyOption_SetFromText | ( | oyOption_s * | obj,
|  | const char * | text,
|  | uint32_t | flags
| ) |  |

set a option value from a string

Function oyOption_SetFromText

Update the flags if necessary.

Parameters

  obj | the option
  text | the text to set
  flags | possible is OY_STRING_LIST

Returns
  0 - success, 1 - error

Version
  Oyranos: 0.2.1

Since
  2008/11/25 (Oyranos: 0.1.9)

Date
  2011/01/21

References oyOBJECT_OPTION_S.

Referenced by oyFilterGraph_s::oyFilterGraph_PrepareContexts(), oyOption_FromDB(), oyOption_SetValueFromDB(), oyOptions_s::oyOptions_DoFilter(), and oyOptions_s::oyOptions_SetFromText().

int oyOption_SetRegistration | ( | oyOption_s * | option,
|  | const char * | registration
| ) |  |

set the registration

Function oyOption_SetRegistration

Parameters

  [in] | option | the option
  [in] | registration | the option's registration and key name

Returns
  error

Version
  Oyranos: 0.1.10

Since
  2009/01/24 (Oyranos: 0.1.10)

Date
  2009/01/24

References oyOBJECT_OPTION_S.

Referenced by oyOption_FromRegistration().

int oyOption_SetValueFromDB | ( | oyOption_s * | option | ) |

Value filled from DB if available.

Function oyOption_SetValueFromDB

Parameters

  option | the option

Returns
  error

Version
  Oyranos: 0.1.10

Since
  2009/01/24 (Oyranos: 0.1.10)

Date
  2009/05/25

Change the option value only if something was found in the DB.

References oyNAME_DESCRIPTION, oyOBJECT_OPTION_S, oyOption_GetRegistration(), oyOption_GetText(), oyOption_SetFromData(), oyOption_SetFromText(), and oyOPTIONSOURCE_DATA.

Referenced by oyOption_FromDB().

int oyOption_StructMoveIn | ( | oyOption_s * | option,
|  | oyStruct_s ** | oystruct
| ) |  |

value filled by a oyStruct_s object

Function oyOption_StructMoveIn

Parameters

  option | the option
  s | the Oyranos style object

Returns
  error

Version
  Oyranos: 0.1.10

Since
  2009/01/28 (Oyranos: 0.1.10)

Date
  2009/01/28

References oyOBJECT_OPTION_S.

Referenced by oyDeviceSetup(), oyOptions_s::oyOptions_MoveInStruct(), and oyOptions_s::oyOptions_SetDriverContext().

## Field Documentation

oyStruct_Copy_f oyOption_s::copy

copy function

oyStruct_Release_f oyOption_s::release

release function