Beispiel #1
0
/** @internal
 *  Function oyOption_Copy__
 *  @memberof oyOption_s_
 *  @brief   real copy a Option object
 *
 *  @param[in]     option                 Option struct object
 *  @param         object              the optional object
 *
 *  @version Oyranos: 
 *  @since   2010/04/26 (Oyranos: 0.1.10)
 *  @date    2010/04/26
 */
oyOption_s_ * oyOption_Copy__ ( oyOption_s_ *option, oyObject_s object )
{
  oyOption_s_ *s = 0;
  int error = 0;

  if(!option || !object)
    return s;

  s = (oyOption_s_*) oyOption_New( object );
  error = !s;

  if(!error) {
    
    /* ---- start of custom Option copy constructor ----- */
    error = oyOption_Copy__Members( s, option );
    /* ---- end of custom Option copy constructor ------- */
    
    
    
    
    
    
  }

  if(error)
    oyOption_Release_( &s );

  return s;
}
Beispiel #2
0
/** Function oyOption_FromDB
 *  @memberof oyOption_s
 *  @brief   new option with registration and value filled from DB if available
 *
 *  @param         registration        no or full qualified registration
 *  @param         object              the optional object
 *  @return                            the option
 *
 *  @version Oyranos: 0.1.10
 *  @since   2009/01/24 (Oyranos: 0.1.10)
 *  @date    2009/01/24
 */
oyOption_s *   oyOption_FromDB       ( const char        * registration,
                                       oyObject_s          object )
{
  int error = !registration;
  oyOption_s * o = 0;

  if(error <= 0)
  {
    /** This is merely a wrapper to oyOption_New() and
     *  oyOption_SetValueFromDB(). */
    o = oyOption_New( object );
    error = oyOption_SetValueFromDB( o );
    ((oyOption_s_*)o)->source = oyOPTIONSOURCE_DATA;
  }

  return o;
}
Beispiel #3
0
/** Function oyOption_FromRegistration
 *  @memberof oyOption_s
 *  @brief   new option with registration and value filled from DB if available
 *
 *  FIXME value filled from DB if available???
 *
 *  @param         registration        no or full qualified registration
 *  @param         object              the optional object
 *  @return                            the option
 *
 *  @version Oyranos: 0.1.10
 *  @since   2009/01/24 (Oyranos: 0.1.10)
 *  @date    2009/01/24
 */
oyOption_s *   oyOption_FromRegistration( const char        * registration,
                                         oyObject_s          object )
{
  oyOption_s *s = oyOption_New( object );

  if(registration)
  {
    if(!registration[0] ||
       !oyStrrchr_( registration, OY_SLASH_C ))
    {
      WARNc2_S("%s: %s",
               "passed a incomplete registration string to option creation",
               registration );
      oyOption_Release( &s );
      return 0;
    } else
      oyOption_SetRegistration( s, registration );
  }

  return s;
}