| 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: 5 сент. 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 |
#include <lsp-plug.in/fmt/java/Enum.h> |
| 23 |
|
| 24 |
namespace lsp |
| 25 |
{ |
| 26 |
namespace java |
| 27 |
{ |
| 28 |
const char *Enum::CLASS_NAME = "java.lang.Enum"; |
| 29 |
|
| 30 |
Enum::Enum(): Object(CLASS_NAME) |
| 31 |
{ |
| 32 |
} |
| 33 |
|
| 34 |
Enum::~Enum() |
| 35 |
{ |
| 36 |
} |
| 37 |
|
| 38 |
bool Enum::instanceof(const char *name) const |
| 39 |
{ |
| 40 |
if (name == CLASS_NAME) |
| 41 |
return true; |
| 42 |
if (::strcmp(name, CLASS_NAME) == 0) |
| 43 |
return true; |
| 44 |
return Object::instanceof(name); |
| 45 |
} |
| 46 |
|
| 47 |
status_t Enum::to_string_padded(LSPString *dst, size_t pad) |
| 48 |
{ |
| 49 |
if (!dst->fmt_append_utf8("*%p = %s.", this, class_name())) |
| 50 |
return STATUS_NO_MEM; |
| 51 |
if (!dst->append(&sName)) |
| 52 |
return STATUS_NO_MEM; |
| 53 |
return (dst->append('\n')) ? STATUS_OK : STATUS_NO_MEM; |
| 54 |
} |
| 55 |
|
| 56 |
} /* namespace java */ |
| 57 |
} /* namespace lsp */ |