| 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: 23 окт. 2020 г. |
| 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_RESOURCE_DIRLOADER_H_ |
| 23 |
#define LSP_PLUG_IN_RESOURCE_DIRLOADER_H_ |
| 24 |
|
| 25 |
#include <lsp-plug.in/runtime/version.h> |
| 26 |
#include <lsp-plug.in/resource/ILoader.h> |
| 27 |
|
| 28 |
namespace lsp |
| 29 |
{ |
| 30 |
namespace resource |
| 31 |
{ |
| 32 |
class DirLoader: public ILoader |
| 33 |
{ |
| 34 |
private: |
| 35 |
DirLoader & operator = (const DirLoader & ); |
| 36 |
DirLoader(const DirLoader &); |
| 37 |
|
| 38 |
protected: |
| 39 |
io::Path sPath; |
| 40 |
bool bEnforce; |
| 41 |
|
| 42 |
protected: |
| 43 |
status_t build_path(io::Path *dst, const io::Path *name); |
| 44 |
|
| 45 |
public: |
| 46 |
explicit DirLoader(); |
| 47 |
virtual ~DirLoader(); |
| 48 |
|
| 49 |
public: |
| 50 |
status_t set_path(const char *path); |
| 51 |
status_t set_path(const LSPString *path); |
| 52 |
status_t set_path(const io::Path *path); |
| 53 |
|
| 54 |
bool set_enforce(bool enforce); |
| 55 |
inline bool get_enforce() const { return bEnforce; } |
| 56 |
|
| 57 |
public: |
| 58 |
virtual io::IInStream *read_stream(const io::Path *name); |
| 59 |
virtual ssize_t enumerate(const io::Path *path, resource_t **list); |
| 60 |
}; |
| 61 |
} |
| 62 |
} |
| 63 |
|
| 64 |
#endif /* LSP_PLUG_IN_RESOURCE_DIRLOADER_H_ */ |