Function

ClutterUnitsfrom_string

Declaration [src]

gboolean
clutter_units_from_string (
  ClutterUnits* units,
  const gchar* str
)

Description [src]

Parses a value and updates units with it

A ClutterUnits expressed in string should match:

  units: wsp* unit-value wsp* unit-name? wsp*
  unit-value: number
  unit-name: 'px' | 'pt' | 'mm' | 'em' | 'cm'
  number: digit+
          | digit* sep digit+
  sep: '.' | ','
  digit: '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
  wsp: (#0x20 | #0x9 | #0xA | #0xB | #0xC | #0xD)+

For instance, these are valid strings:

  10 px
  5.1 em
  24 pt
  12.6 mm
  .3 cm

While these are not:

  42 cats
  omg!1!ponies

If no unit is specified, pixels are assumed.

Parameters

units

Type: ClutterUnits

A ClutterUnits.

The argument will be set by the function.
The data is owned by the function.
str

Type: const gchar*

The string to convert.

The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.

Return value

Type: gboolean

TRUE if the string was successfully parsed, and FALSE otherwise.