1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23#ifndef __com_sun_star_script_Converter_idl__ 24#define __com_sun_star_script_Converter_idl__ 25 26#ifndef __com_sun_star_script_XTypeConverter_idl__ 27#include <com/sun/star/script/XTypeConverter.idl> 28#endif 29 30 31//============================================================================= 32 33 module com { module sun { module star { module script { 34 35//============================================================================= 36 37/** This service provides a widening converter converting from one type to another, 38 if possible. 39 40 <p>What is possible? 41 <ul> 42 <li>byte: byte, (short *1), (long *1), (hyper *1), (float *1), (double *1), (enum *2), (any *3), boolean, (char *4), (string *5)</li> 43 <li>short: byte, short, (long *1), (hyper *1), (float *7), (double *7), (enum *2), (any *3), boolean, char, (string *5)</li> 44 <li>long: byte, short, long, (hyper *1), (float *7), (double *7), enum, (any *3), boolean, char, (string *5)</li> 45 <li>hyper: byte, short, long, hyper, (float *7), (double *7), enum, (any *3), boolean, char, (string *5)</li> 46 <li>float: byte, short, long, hyper, float, (double *7), (enum *8), (any *3), boolean, char, (string *5)</li> 47 <li>double: byte, short, long, hyper, float, double, enum, (any *3), boolean, char, (string *5)</li> 48 <li>enum: (byte *9), (short *9), (long *9), (hyper *9), (float *9), (double *9), (enum *10), (any *3), (string *11)</li> 49 <li>void: ok for all types</li> 50 <li>any: ok for all types</li> 51 <li>boolean: byte, short, long, hyper, float, double, (any *3), boolean, char, (string *12). 0 => false, != 0 => true</li> 52 <li>char: byte, short, (long *1), (hyper *1), (float *7), (double *7), enum, (any *3), boolean, char, (string *13)</li> 53 <li>string: byte, short, long, hyper, float, double, enum, (any *3), boolean, char, string</li> 54 <li>struct: (any *3), (struct *14)</li> 55 <li>interface: (any *3), (struct *14)</li> 56 <li>exception: (any *3), (exception *14)</li> 57 <li>union: (any *3), (union *14)</li> 58 <li>sequence: (any *3), (sequence *15)</li> 59 </ul> 60 rules: 61 <ul> 62 <li>1: only converts if the value is in the range of the target type.</li> 63 <li>2: only converts if the value, not the position, of the enum is in the range of the target type.</li> 64 <li>3: get value until it is not an any. Then convert it with the other rules.</li> 65 <li>4: only converts if the value of the character is between 0 - 255.</li> 66 <li>5: only converts if the value represents a decimal, hexadecimal (0x...) or a floating point number. 67 Examples: 10, 0x10, 10.045, 10,555, +10, +10.6e10, -10.6e-10, .16.</li> 68 <li>7: only converts if the value is in the range of the target type. 69 The value is rounded to an integer.</li> 70 <li>8: only converts if the float can be converted back to the same enum value.</li> 71 <li>9: only converts if the number is one of the enumeration type values. Normally you need 72 reflection information of the enum type.</li> 73 <li>10: only converts if it is the same enumeration type.</li> 74 <li>11: only converts if the string contains the name of an enumeration type value. Normally you need 75 core reflection information of the enum type.</li> 76 <li>12: only converts if the value of the string is "1", "true" or "0", "false". The comparison 77 is case insensitive.</li> 78 <li>13: only converts if the length of the string is 1 or 0.</li> 79 <li>14: only converts if the types are equal or the source type is derived from the destination 80 type.</li> 81 <li>15: only converts if each element of the source sequence can be converted to an element 82 of the destination sequence.</li> 83 </ul> 84*/ 85published service Converter 86{ 87 /** Conversion interface. 88 */ 89 interface com::sun::star::script::XTypeConverter; 90 91}; 92 93//============================================================================= 94 95}; }; }; }; 96 97/*============================================================================= 98 99=============================================================================*/ 100#endif 101