Debian Codegraph @

modules/lsp-runtime-lib/include/lsp-plug.in/fmt/java/const.h

raw
1 /*
2 * Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/>
3 * (C) 2020 Vladimir Sadovnikov <[email protected]>
4 *
5 * This file is part of lsp-runtime-lib
6 * Created on: 31 авг. 2019 г.
7 *
8 * lsp-runtime-lib is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * any later version.
12 *
13 * lsp-runtime-lib is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with lsp-runtime-lib. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22 #ifndef LSP_PLUG_IN_FMT_JAVA_CONST_H_
23 #define LSP_PLUG_IN_FMT_JAVA_CONST_H_
24
25 #include <lsp-plug.in/runtime/version.h>
26 #include <lsp-plug.in/common/types.h>
27
28 namespace lsp
29 {
30 namespace java
31 {
32 typedef float float_t;
33 typedef double double_t;
34 typedef uint8_t bool_t;
35 typedef lsp_utf16_t char_t;
36 typedef int8_t byte_t;
37 typedef int16_t short_t;
38 typedef int32_t int_t;
39 typedef int64_t long_t;
40
41 enum stream_token_t
42 {
43 JST_NULL, ///< Null object reference.
44 JST_REFERENCE, ///< Reference to an object already written into the stream.
45 JST_CLASS_DESC, ///< new Class Descriptor.
46 JST_OBJECT, ///< Object.
47 JST_STRING, ///< String.
48 JST_ARRAY, ///< Array.
49 JST_CLASS, ///< Reference to Class.
50 JST_BLOCK_DATA, ///< Block of optional data. Byte following tag indicates number of bytes in this block data.
51 JST_END_BLOCK_DATA, ///< End of block of optional data.
52 JST_RESET, ///< Reset stream context. All handles written into stream are reset.
53 JST_EXCEPTION, ///< Exception during write.
54 JST_PROXY_CLASS_DESC, ///< new Proxy Class Descriptor.
55 JST_ENUM, ///< new Enum constant, since java 1.5
56
57 JST_UNDEFINED = -1
58 };
59
60 enum cflags_t
61 {
62 JCF_PROXY = 1 << 0,
63 JCF_WRITE_METHOD = 1 << 1,
64 JCF_BLOCK_DATA = 1 << 2,
65 JCF_EXTERNALIZABLE = 1 << 3,
66 JCF_SERIALIZABLE = 1 << 4,
67 JCF_ENUM = 1 << 5
68 };
69
70 enum ftype_t
71 {
72 JFT_BYTE,
73 JFT_CHAR,
74 JFT_DOUBLE,
75 JFT_FLOAT,
76 JFT_INTEGER,
77 JFT_LONG,
78 JFT_SHORT,
79 JFT_BOOL,
80 JFT_ARRAY,
81 JFT_OBJECT,
82
83 JFT_TOTAL,
84 JFT_UNKNOWN = -1
85 };
86
87 /**
88 * Determine size of primitive type
89 * @param type of primitive type
90 * @return size of primitive type
91 */
92 size_t size_of(ftype_t type);
93
94 /**
95 * Compute aligned offset of the typed data
96 * @param offset the current offset
97 * @param type data type
98 * @return aligned offset, greater or equal than passed value
99 */
100 size_t aligned_offset(size_t offset, ftype_t type);
101
102 /**
103 * Check that type is primitive
104 * @param type type
105 * @return true if type is primitive
106 */
107 bool is_primitive(ftype_t type);
108
109 /**
110 * Check that type is reference
111 * @param type type
112 * @return true if type is reference
113 */
114 bool is_reference(ftype_t type);
115 }
116 }
117
118 #endif /* LSP_PLUG_IN_FMT_JAVA_CONST_H_ */