LibreOffice LibreOffice 6.0 SDK API Reference

List of all members
Converter Service Referencepublished

This service provides a widening converter converting from one type to another, if possible. More...

`import"Converter.idl";`

Inheritance diagram for Converter:

## Additional Inherited Members
Public Member Functions inherited from XTypeConverter
any | convertTo ([in] any aFrom, [in] type xDestinationType) raises ( com::sun::star::lang::IllegalArgumentException, com::sun::star::script::CannotConvertException )
| Converts the value `aFrom` to the specified type `xDestinationType`. More...
any | convertToSimpleType ([in] any aFrom, [in] com::sun::star::uno::TypeClass aDestinationType) raises ( com::sun::star::lang::IllegalArgumentException, com::sun::star::script::CannotConvertException )
| Converts the value `aFrom` to the specified simple type `aDestinationType`. More...
Public Member Functions inherited from XInterface
any | queryInterface ([in] type aType)
| queries for a new interface to an existing UNO object. More...
void | acquire ()
| increases the reference counter by one. More...
void | release ()
| decreases the reference counter by one. More...

## Detailed Description

This service provides a widening converter converting from one type to another, if possible.

What is possible?

- byte: byte, (short *1), (long *1), (hyper *1), (float *1), (double *1), (enum *2), (any *3), boolean, (char *4), (string *5)
- short: byte, short, (long *1), (hyper *1), (float *7), (double *7), (enum *2), (any *3), boolean, char, (string *5)
- long: byte, short, long, (hyper *1), (float *7), (double *7), enum, (any *3), boolean, char, (string *5)
- hyper: byte, short, long, hyper, (float *7), (double *7), enum, (any *3), boolean, char, (string *5)
- float: byte, short, long, hyper, float, (double *7), (enum *8), (any *3), boolean, char, (string *5)
- double: byte, short, long, hyper, float, double, enum, (any *3), boolean, char, (string *5)
- enum: (byte *9), (short *9), (long *9), (hyper *9), (float *9), (double *9), (enum *10), (any *3), (string *11)
- void: ok for all types
- any: ok for all types
- boolean: byte, short, long, hyper, float, double, (any *3), boolean, char, (string *12). 0 => false, != 0 => true
- char: byte, short, (long *1), (hyper *1), (float *7), (double *7), enum, (any *3), boolean, char, (string *13)
- string: byte, short, long, hyper, float, double, enum, (any *3), boolean, char, string
- struct: (any *3), (struct *14)
- interface: (any *3), (struct *14)
- exception: (any *3), (exception *14)
- union: (any *3), (union *14)
- sequence: (any *3), (sequence *15)

rules:

- 1: only converts if the value is in the range of the target type.
- 2: only converts if the value, not the position, of the enum is in the range of the target type.
- 3: get value until it is not an any. Then convert it with the other rules.
- 4: only converts if the value of the character is between 0 - 255.
- 5: only converts if the value represents a decimal, hexadecimal (0x...) or a floating point number. Examples: 10, 0x10, 10.045, 10,555, +10, +10.6e10, -10.6e-10, .16.
- 7: only converts if the value is in the range of the target type. The value is rounded to an integer.
- 8: only converts if the float can be converted back to the same enum value.
- 9: only converts if the number is one of the enumeration type values. Normally you need reflection information of the enum type.
- 10: only converts if it is the same enumeration type.
- 11: only converts if the string contains the name of an enumeration type value. Normally you need core reflection information of the enum type.
- 12: only converts if the value of the string is "1", "true" or "0", "false". The comparison is case insensitive.
- 13: only converts if the length of the string is 1 or 0.
- 14: only converts if the types are equal or the source type is derived from the destination type.
- 15: only converts if each element of the source sequence can be converted to an element of the destination sequence.

Developers Guide
  AdvUNO - UNO Reflection API

The documentation for this service was generated from the following file:

- com/sun/star/script/Converter.idl