merged tag ooo/OOO330_m14
[LibreOffice.git] / udkapi / com / sun / star / script / Converter.idl
blobf0a9167ab0742f495044fae8ac9da1019fc7f3dc
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
27 #ifndef __com_sun_star_script_Converter_idl__
28 #define __com_sun_star_script_Converter_idl__
30 #ifndef __com_sun_star_script_XTypeConverter_idl__
31 #include <com/sun/star/script/XTypeConverter.idl>
32 #endif
35 //=============================================================================
37 module com { module sun { module star { module script {
39 //=============================================================================
41 /** This service provides a widening converter converting from one type to another,
42 if possible.
44 <p>What is possible?
45 <ul>
46 <li>byte: byte, (short *1), (long *1), (hyper *1), (float *1), (double *1), (enum *2), (any *3), boolean, (char *4), (string *5)</li>
47 <li>short: byte, short, (long *1), (hyper *1), (float *7), (double *7), (enum *2), (any *3), boolean, char, (string *5)</li>
48 <li>long: byte, short, long, (hyper *1), (float *7), (double *7), enum, (any *3), boolean, char, (string *5)</li>
49 <li>hyper: byte, short, long, hyper, (float *7), (double *7), enum, (any *3), boolean, char, (string *5)</li>
50 <li>float: byte, short, long, hyper, float, (double *7), (enum *8), (any *3), boolean, char, (string *5)</li>
51 <li>double: byte, short, long, hyper, float, double, enum, (any *3), boolean, char, (string *5)</li>
52 <li>enum: (byte *9), (short *9), (long *9), (hyper *9), (float *9), (double *9), (enum *10), (any *3), (string *11)</li>
53 <li>void: ok for all types</li>
54 <li>any: ok for all types</li>
55 <li>boolean: byte, short, long, hyper, float, double, (any *3), boolean, char, (string *12). 0 => false, != 0 => true</li>
56 <li>char: byte, short, (long *1), (hyper *1), (float *7), (double *7), enum, (any *3), boolean, char, (string *13)</li>
57 <li>string: byte, short, long, hyper, float, double, enum, (any *3), boolean, char, string</li>
58 <li>struct: (any *3), (struct *14)</li>
59 <li>interface: (any *3), (struct *14)</li>
60 <li>exception: (any *3), (exception *14)</li>
61 <li>union: (any *3), (union *14)</li>
62 <li>sequence: (any *3), (sequence *15)</li>
63 </ul>
64 rules:
65 <ul>
66 <li>1: only converts if the value is in the range of the target type.</li>
67 <li>2: only converts if the value, not the position, of the enum is in the range of the target type.</li>
68 <li>3: get value until it is not an any. Then convert it with the other rules.</li>
69 <li>4: only converts if the value of the character is between 0 - 255.</li>
70 <li>5: only converts if the value represents a decimal, hexadecimal (0x...) or a floating point number.
71 Examples: 10, 0x10, 10.045, 10,555, +10, +10.6e10, -10.6e-10, .16.</li>
72 <li>7: only converts if the value is in the range of the target type.
73 The value is rounded to an integer.</li>
74 <li>8: only converts if the float can be converted back to the same enum value.</li>
75 <li>9: only converts if the number is one of the enumeration type values. Normally you need
76 reflection information of the enum type.</li>
77 <li>10: only converts if it is the same enumeration type.</li>
78 <li>11: only converts if the string contains the name of an enumeration type value. Normally you need
79 core reflection information of the enum type.</li>
80 <li>12: only converts if the value of the string is "1", "true" or "0", "false". The comparision
81 is case insensitive.</li>
82 <li>13: only converts if the length of the string is 1 or 0.</li>
83 <li>14: only converts if the types are equal or the source type is derived from the destination
84 type.</li>
85 <li>15: only converts if each element of the source sequence can be converted to an element
86 of the destination sequence.</li>
87 </ul>
89 published service Converter
91 /** Conversion interface.
93 interface com::sun::star::script::XTypeConverter;
97 //=============================================================================
99 }; }; }; };
101 /*=============================================================================
103 =============================================================================*/
104 #endif