Example #1
0
/**
 * Creates a new string property, if it does not already exist, and sets its
 * attributes to those given.
 * @param   key       The property key.
 * @param   val       Default value of key.
 * @param   short_opt Short option used to set the property from command
 *                    line.
 * @param   long_opt  Long option used to set the property from command line.
 * @param   desc      String description of property.
 * @return  @c ECORE_CONFIG_ERR_SUCC on success.
 * @ingroup Ecore_Config_Create_Group
 */
int
ecore_config_string_create(const char *key, char *val, char short_opt,
			   char *long_opt, char *desc)
{
   return
      ecore_config_typed_create(key, (void *)val, ECORE_CONFIG_STR, short_opt, long_opt,
				desc);
}
Example #2
0
/**
 * Creates a new integer property, if it does not already exist, and sets its
 * attributes to those given.
 * @param   key       The property key.
 * @param   val       Default integer value of key.
 * @param   short_opt Short option used to set the property from command
 *                    line.
 * @param   long_opt  Long option used to set the property from command line.
 * @param   desc      String description of property.
 * @return  @c ECORE_CONFIG_ERR_SUCC on success.
 * @ingroup Ecore_Config_Create_Group
 */
int
ecore_config_int_create(const char *key, int val, char short_opt,
			char *long_opt, char *desc)
{
   return
      ecore_config_typed_create(key, (void *)&val, ECORE_CONFIG_INT, short_opt, long_opt,
				desc);
}
/**
 * Creates a new property, if it does not already exist, and sets its
 * attributes to those given.
 *
 * The type of the property is guessed from the key and the value
 * given.
 *
 * @param   key       The property key.
 * @param   val       Pointer to default value of key.
 * @param   short_opt Short option used to set the property from command
 *                    line.
 * @param   long_opt  Long option used to set the property from command line.
 * @param   desc      String description of property.
 * @return  @c ECORE_CONFIG_ERR_SUCC on success.
 * @ingroup Ecore_Config_Create_Group
 */
int
ecore_config_create(const char *key, void *val, char short_opt, char *long_opt,
		    char *desc)
{
   int                 type = ecore_config_type_guess(key, val);

   return ecore_config_typed_create(key, val, type, short_opt, long_opt, desc);
}
Example #4
0
/**
 * Creates a new float property, if it does not already exist, and sets its
 * attributes to those given.
 * @param   key       The property key.
 * @param   val       Default float value of key.
 * @param   low       Lowest valid float value for the property.
 * @param   high      Highest valid float value for the property.
 * @param   step      Increment value for the property.
 * @param   short_opt Short option used to set the property from command
 *                    line.
 * @param   long_opt  Long option used to set the property from command line.
 * @param   desc      String description of property.
 * @return  @c ECORE_CONFIG_ERR_SUCC on success.
 * @ingroup Ecore_Config_Create_Group
 */
int
ecore_config_float_create_bound(const char *key, float val, float low,
				float high, float step, char short_opt,
				char *long_opt, char *desc)
{
   Ecore_Config_Prop  *e;
   int                 ret;

   ret =
      ecore_config_typed_create(key, (void *)&val, ECORE_CONFIG_FLT, short_opt, long_opt,
				desc);
   e = ecore_config_get(key);
   if (e)
     {
	e->step = (int)(step * ECORE_CONFIG_FLOAT_PRECISION);
	e->flags |= ECORE_CONFIG_FLAG_BOUNDS;
	e->lo = (int)(low * ECORE_CONFIG_FLOAT_PRECISION);
	e->hi = (int)(high * ECORE_CONFIG_FLOAT_PRECISION);
	ecore_config_bound(e);
     }
   return ret;
}
Example #5
0
/**
 * Creates a new integer property, if it does not already exist, and sets its
 * attributes to those given.
 * @param   key       The property key.
 * @param   val       Default integer value of key.
 * @param   low       Lowest valid integer value for the property.
 * @param   high      Highest valid integer value for the property.
 * @param   step      Increment value for the property.
 * @param   short_opt Short option used to set the property from command
 *                    line.
 * @param   long_opt  Long option used to set the property from command line.
 * @param   desc      String description of property.
 * @return  @c ECORE_CONFIG_ERR_SUCC on success.
 * @ingroup Ecore_Config_Create_Group
 */
int
ecore_config_int_create_bound(const char *key, int val, int low, int high,
			      int step, char short_opt, char *long_opt,
			      char *desc)
{
   Ecore_Config_Prop  *e;
   int                 ret;

   ret =
      ecore_config_typed_create(key, (void *)&val, ECORE_CONFIG_INT, short_opt, long_opt,
				desc);
   if (ret != ECORE_CONFIG_ERR_SUCC)
      return ret;
   e = ecore_config_get(key);
   if (e)
     {
	e->step = step;
	e->flags |= ECORE_CONFIG_FLAG_BOUNDS;
	e->lo = low;
	e->hi = high;
	ecore_config_bound(e);
     }
   return ret;
}