MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
jtie_tconv_string.hpp
1 /*
2  Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; version 2 of the License.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 /*
18  * jtie_tconv_string.hpp
19  */
20 
21 #ifndef jtie_tconv_string_hpp
22 #define jtie_tconv_string_hpp
23 
24 #include <jni.h>
25 
26 #include "jtie_tconv.hpp"
27 
28 // ---------------------------------------------------------------------------
29 // Java String <-> [const] char * type conversions
30 // ---------------------------------------------------------------------------
31 
32 // comments:
33 // - The offered mappings of '[const] char *' to Java Strings
34 // - require a) null-terminated and b) (modified) UTF8-encoded strings
35 // (as descibed by the JNI specification);
36 // - always copy content (by the JNI API as well as encoding conversion);
37 // for pass-by-reference semantics, a ByteBuffer mapping is the only way.
38 // - For 'char *' mappings:
39 // - only result and no parameter mappings are supported for Java Strings,
40 // since a) Strings are immutable and b) no implicit conversions from
41 // 'const char*' to 'char *' should be allowed through Java;
42 // - there's no point in offering a 'Java StringBuilder' mapping, for it's
43 // complex to implement and as inefficient as when done from Java.
44 
45 // aliases for: <char>_<[const]pointer[const]>_<encoding>_<String>
50 
51 // ---------------------------------------------------------------------------
52 // Java String[] <-> const char * * type conversions
53 // ---------------------------------------------------------------------------
54 
55 #if 0 // XXX implement and test mapping String[] <-> char * *
56 // XXX aliases for: <const-char>_<[const-]pointer>_<[const-]pointer>_<String[]>
57 typedef ttrait< jobjectArray, const char * * > ttrait_utf8cstring_a;
58 typedef ttrait< jobjectArray, const char * const * > ttrait_utf8cstring_ca;
59 typedef ttrait< jobjectArray, const char * const * const > ttrait_utf8cstring_cac;
60 #endif // XXX implement and test mapping String[] <-> char * *
61 
62 // ---------------------------------------------------------------------------
63 
64 #endif // jtie_tconv_string_hpp