| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
<html> |
| 12 |
<head> |
| 13 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 14 |
<meta http-equiv="Content-Language" content="en-us"> |
| 15 |
<title>decvalue_unichar</title> |
| 16 |
</head> |
| 17 |
<body bgcolor="#DAD3C5" vlink="#0094D2" link="#003258"> |
| 18 |
<table align="left" border="0" cellspacing="0" cellpadding="0" valign=top> |
| 19 |
<tr> |
| 20 |
<td width=105 height=40><a href="https://projects.eclipse.org/projects/tools.titan"><img src="../images/titan_transparent.gif" border=0 width=105 height=40 align="left" alt="Titan"></a></td> |
| 21 |
</tr> |
| 22 |
</table> |
| 23 |
<table border="0" align="right" cellpadding="0" cellspacing="0"> |
| 24 |
<tr> |
| 25 |
<td><a href="../titan_main.html" alt="contents"><img border="0" src="../images/ao.jpg" width="53" height="40"></a></td> |
| 26 |
<td><a href="../titan_index.html" alt="index"><img border="0" src="../images/up.jpg" width="53" height="40"></a></td> |
| 27 |
<td><a href="decvalue.html" alt="previous"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td> |
| 28 |
<td><a href="default.html" alt="next"><img border="0" src="../images/right.jpg" width="53" height="40"></a></td> |
| 29 |
</tr> |
| 30 |
</table> |
| 31 |
<p><br clear="all"> |
| 32 |
</p> |
| 33 |
<hr> |
| 34 |
<h1>decvalue_unichar</h1> |
| 35 |
<hr align="left" width="75%"> |
| 36 |
<p>This built-in function decodes a value from a universal charstring and cuts the consumed part from the universal charstring. |
| 37 |
<ul> |
| 38 |
<li>The function return type is integer holding the error code: <b>0</b> - decoding was successful, <b>1</b> - unspecified cause of decoding failure, |
| 39 |
<b>2</b> - decoding failed because the universal charstring did not contain enough characters.</li> |
| 40 |
<li>Decoded value returned through the second (out) argument.</li> |
| 41 |
<li>Type of the second argument has to have an <i>encoding method</i> explicitly set with its atributes.</li> |
| 42 |
<li>The third argument determines the string serialization of the universal charstring argument. The possible serializations are: <i> |
| 43 |
UTF-8, UTF-16, UTF-16LE, UTF-16BE, UTF-32, UTF-32LE and UTF-32BE</i>. If the argument is omitted, then UTF-8 serialization is used.</li> |
| 44 |
<li>The fourth argument is currently ignored.</li> |
| 45 |
<li>The fifth argument selects the encoding method to use, if the type has multiple encoding methods set.</li> |
| 46 |
</ul> |
| 47 |
<p>Related keywords:</p> |
| 48 |
<ul> |
| 49 |
<li><a href="encode.html"><b><font face="Courier New" color="#003258" size="4">encode</font></b></a></li> |
| 50 |
<li><a href="encvalue.html"><b><font face="Courier New" color="#003258" size="4">encvalue</font></b></a></li> |
| 51 |
<li><a href="encvalue_unichar.html"><b><font face="Courier New" color="#003258" size="4">encvalue_unichar</font></b></a></li> |
| 52 |
<li><a href="decvalue.html"><b><font face="Courier New" color="#003258" size="4">decvalue</font></b></a></li> |
| 53 |
</ul> |
| 54 |
<hr align="left" width="50%"> |
| 55 |
<div align="center"> |
| 56 |
<center> |
| 57 |
<table border="0" width="90%" bgcolor="#FFB599" cellpadding="4"> |
| 58 |
<tr> |
| 59 |
<td width="100%"> |
| 60 |
<h3 align="center"><font face="Courier New" color="#003258" size="5"><b>decvalue_unichar(</b></font> <i>inout bitstring_value, |
| 61 |
out decoded_value [, in string_serialization [, in encoding_info [, in dynamic_encoding]]]</i> |
| 62 |
<font face="Courier New" color="#003258" size="5"><b>) return integer;</b></font></h3> |
| 63 |
</td> |
| 64 |
</tr> |
| 65 |
</table> |
| 66 |
</center> |
| 67 |
</div> |
| 68 |
<hr align="left" width="50%"> |
| 69 |
<p>Example 1: |
| 70 |
<p><font face="Courier New">type float MyFloat with { encode "RAW" }</font> |
| 71 |
<p><font face="Courier New">var MyFloat f := 1.1;</font> |
| 72 |
<p><font face="Courier New">var universal charstring ucs := encvalue_unichar(f);</font> |
| 73 |
<p><font face="Courier New">var integer i := decvalue_unichar(ucs, f);</font> |
| 74 |
<hr align="left" width="25%"> |
| 75 |
<p>Example 2: |
| 76 |
<p><font face="Courier New">type record MyRecord {<br> |
| 77 |
integer num,<br> |
| 78 |
charstring str<br> |
| 79 |
}<br> |
| 80 |
with {<br> |
| 81 |
encode "XML";<br> |
| 82 |
encode "JSON";<br> |
| 83 |
}</font> |
| 84 |
<p><font face="Courier New">var MyRecord r := { num := 3, str := "abc" };</font> |
| 85 |
<p><font face="Courier New">var universal charstring ucs := encvalue_unichar(r, "UTF-8", "", "JSON");</font> |
| 86 |
<p><font face="Courier New">var integer i := decvalue_unichar(ucs, r, "UTF-8", "", "JSON");</font> |
| 87 |
<hr align="left" width="25%"> |
| 88 |
<hr align="left" width="25%"> |
| 89 |
<p><a HREF="BNF.html#decvalue_unichar">BNF definition</a> of <font face="Courier New">decvalue_unichar</font></p> |
| 90 |
</body> |
| 91 |
</html> |