| 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: 29 авг. 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_OBJECTSTREAMCLASS_H_ |
| 23 |
#define LSP_PLUG_IN_FMT_JAVA_OBJECTSTREAMCLASS_H_ |
| 24 |
|
| 25 |
#include <lsp-plug.in/runtime/version.h> |
| 26 |
#include <lsp-plug.in/runtime/LSPString.h> |
| 27 |
#include <lsp-plug.in/common/types.h> |
| 28 |
#include <lsp-plug.in/fmt/java/const.h> |
| 29 |
#include <lsp-plug.in/fmt/java/Object.h> |
| 30 |
#include <lsp-plug.in/fmt/java/ObjectStreamField.h> |
| 31 |
|
| 32 |
namespace lsp |
| 33 |
{ |
| 34 |
namespace java |
| 35 |
{ |
| 36 |
class ObjectStreamClass: public Object |
| 37 |
{ |
| 38 |
public: |
| 39 |
static const char *CLASS_NAME; |
| 40 |
|
| 41 |
private: |
| 42 |
friend class ObjectStream; |
| 43 |
ObjectStreamClass & operator = (const ObjectStreamClass &); |
| 44 |
|
| 45 |
protected: |
| 46 |
ObjectStreamClass *pParent; |
| 47 |
LSPString sName; |
| 48 |
char *pRawName; |
| 49 |
uint64_t nSuid; |
| 50 |
size_t nFlags; |
| 51 |
size_t nFields; |
| 52 |
size_t nClasses; |
| 53 |
size_t nSizeOf; |
| 54 |
ObjectStreamField **vFields; |
| 55 |
ObjectStreamClass **vClasses; |
| 56 |
|
| 57 |
public: |
| 58 |
explicit ObjectStreamClass(); |
| 59 |
virtual ~ObjectStreamClass(); |
| 60 |
|
| 61 |
public: |
| 62 |
inline ObjectStreamClass *parent() { return pParent; } |
| 63 |
inline const LSPString *name() const { return &this->sName; } |
| 64 |
inline const char *raw_name() const { return pRawName; } |
| 65 |
inline size_t size_of() const { return nSizeOf; } |
| 66 |
inline uint64_t suid() const { return this->nSuid; } |
| 67 |
inline bool is_proxy() const { return nFlags & JCF_PROXY; } |
| 68 |
inline bool has_write_method() const { return nFlags & JCF_WRITE_METHOD; } |
| 69 |
inline bool has_block_external_data() const { return nFlags & JCF_BLOCK_DATA; } |
| 70 |
inline bool is_externalizable() const { return nFlags & JCF_EXTERNALIZABLE; } |
| 71 |
inline bool is_serializable() const { return nFlags & (JCF_EXTERNALIZABLE | JCF_SERIALIZABLE); } |
| 72 |
inline const ObjectStreamField *field(size_t idx) const { return (idx < nFields) ? vFields[idx] : NULL; } |
| 73 |
inline const ObjectStreamClass *slot(size_t idx) const { return (idx < nClasses) ? vClasses[idx] : NULL; } |
| 74 |
inline size_t fields() const { return nFields; }; |
| 75 |
}; |
| 76 |
|
| 77 |
} /* namespace java */ |
| 78 |
} /* namespace lsp */ |
| 79 |
|
| 80 |
#endif /* LSP_PLUG_IN_FMT_JAVA_OBJECTSTREAMCLASS_H_ */ |