1 /*
2  Copyright 2010 Sun Microsystems, Inc.
3  All rights reserved. Use is subject to license terms.
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License, version 2.0,
7  as published by the Free Software Foundation.
8 
9  This program is also distributed with certain software (including
10  but not limited to OpenSSL) that is licensed under separate terms,
11  as designated in a particular file or component or in included license
12  documentation.  The authors of MySQL hereby grant you an additional
13  permission to link the program and your derivative works with the
14  separately licensed software that they have included with MySQL.
15 
16  This program is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  GNU General Public License, version 2.0, for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with this program; if not, write to the Free Software
23  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
24 */
25 /*
26  * jtie_tconv_value.hpp
27  */
28 
29 #ifndef jtie_tconv_value_hpp
30 #define jtie_tconv_value_hpp
31 
32 #include <jni.h>
33 
34 #include "jtie_tconv.hpp"
35 
36 // ---------------------------------------------------------------------------
37 // Java <-> C primitive type conversions
38 // ---------------------------------------------------------------------------
39 
40 /**
41  * Defines the trait type aliases for the mapping of
42  * a basic Java type to a basic C++ type.
43  *
44  * The macro takes these arguments:
45  *   J: A JNI type name (representing a basic Java type).
46  *   C: A basic C++ type name.
47  *   T: A name tag for this mapping.
48  *
49  * Naming convention:
50  *   type alias:                specifies a mapping:
51  *   ttrait_<T>                 J <->       C
52  *   ttrait_<T>_c               J <-> const C
53  */
54 #define JTIE_DEFINE_BASIC_TYPE_MAPPING( J, C, T )       \
55     typedef ttrait< J, C                                \
56                     > ttrait_##T;                       \
57     typedef ttrait< J, const C                          \
58                     > ttrait_##T##_c;
59 
60 /**
61  * A helper class template that predicates the supported type conversions
62  * by presence of specialization.
63  */
64 // XXX move? used where?
65 template < typename J, typename C >
66 struct is_valid_primitive_type_mapping;
67 
68 // ---------------------------------------------------------------------------
69 
70 #endif // jtie_tconv_value_hpp
71