File: const.h

package info (click to toggle)
lsp-plugins 1.2.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 91,856 kB
  • sloc: cpp: 427,831; xml: 57,779; makefile: 9,961; php: 1,005; sh: 18
file content (118 lines) | stat: -rw-r--r-- 3,997 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
 * Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/>
 *           (C) 2020 Vladimir Sadovnikov <sadko4u@gmail.com>
 *
 * This file is part of lsp-runtime-lib
 * Created on: 31 авг. 2019 г.
 *
 * lsp-runtime-lib is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * lsp-runtime-lib is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with lsp-runtime-lib. If not, see <https://www.gnu.org/licenses/>.
 */

#ifndef LSP_PLUG_IN_FMT_JAVA_CONST_H_
#define LSP_PLUG_IN_FMT_JAVA_CONST_H_

#include <lsp-plug.in/runtime/version.h>
#include <lsp-plug.in/common/types.h>

namespace lsp
{
    namespace java
    {
        typedef float               float_t;
        typedef double              double_t;
        typedef uint8_t             bool_t;
        typedef lsp_utf16_t         char_t;
        typedef int8_t              byte_t;
        typedef int16_t             short_t;
        typedef int32_t             int_t;
        typedef int64_t             long_t;

        enum stream_token_t
        {
            JST_NULL,               ///< Null object reference.
            JST_REFERENCE,          ///< Reference to an object already written into the stream.
            JST_CLASS_DESC,         ///< new Class Descriptor.
            JST_OBJECT,             ///< Object.
            JST_STRING,             ///< String.
            JST_ARRAY,              ///< Array.
            JST_CLASS,              ///< Reference to Class.
            JST_BLOCK_DATA,         ///< Block of optional data. Byte following tag indicates number of bytes in this block data.
            JST_END_BLOCK_DATA,     ///< End of block of optional data.
            JST_RESET,              ///< Reset stream context. All handles written into stream are reset.
            JST_EXCEPTION,          ///< Exception during write.
            JST_PROXY_CLASS_DESC,   ///< new Proxy Class Descriptor.
            JST_ENUM,               ///< new Enum constant, since java 1.5

            JST_UNDEFINED  = -1
        };

        enum cflags_t
        {
            JCF_PROXY           = 1 << 0,
            JCF_WRITE_METHOD    = 1 << 1,
            JCF_BLOCK_DATA      = 1 << 2,
            JCF_EXTERNALIZABLE  = 1 << 3,
            JCF_SERIALIZABLE    = 1 << 4,
            JCF_ENUM            = 1 << 5
        };

        enum ftype_t
        {
            JFT_BYTE,
            JFT_CHAR,
            JFT_DOUBLE,
            JFT_FLOAT,
            JFT_INTEGER,
            JFT_LONG,
            JFT_SHORT,
            JFT_BOOL,
            JFT_ARRAY,
            JFT_OBJECT,

            JFT_TOTAL,
            JFT_UNKNOWN = -1
        };

        /**
         * Determine size of primitive type
         * @param type of primitive type
         * @return size of primitive type
         */
        size_t      size_of(ftype_t type);

        /**
         * Compute aligned offset of the typed data
         * @param offset the current offset
         * @param type data type
         * @return aligned offset, greater or equal than passed value
         */
        size_t      aligned_offset(size_t offset, ftype_t type);

        /**
         * Check that type is primitive
         * @param type type
         * @return true if type is primitive
         */
        bool        is_primitive(ftype_t type);

        /**
         * Check that type is reference
         * @param type type
         * @return true if type is reference
         */
        bool        is_reference(ftype_t type);
    }
}

#endif /* LSP_PLUG_IN_FMT_JAVA_CONST_H_ */