Files
pip/libs/main/resources/piresourcesstorage.h
2020-08-19 00:47:05 +03:00

83 lines
2.2 KiB
C++

/*
PIP - Platform Independent Primitives
Resources subsystem
Ivan Pelipenko peri4ko@yandex.ru
This program 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
(at your option) any later version.
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PIRESOURCES_P_H
#define PIRESOURCES_P_H
#include "pistring.h"
#include "pimap.h"
class PIResources;
class PIP_EXPORT PIResourcesStorage {
friend class PIResources;
public:
static PIResourcesStorage * instance();
struct PIP_EXPORT Section {
Section();
~Section();
void add(const Section & s);
void purge();
PIMap<PIString, PIByteArray * > entries;
};
struct PIP_EXPORT __RCEntry {
__RCEntry(const PIString & s = PIString(), const PIString & n = PIString(), const PIString & a = PIString(),
const PIString & f = PIString(), llong o = 0, llong si = 0, int fl = 0) {
section = s;
name = n;
alias = a;
file = f;
offset = o;
size = si;
flags = fl;
}
PIString section;
PIString name;
PIString alias;
PIString file;
llong offset;
llong size;
int flags;
};
void registerSection(const PIString & section_name, const Section & data);
void registerSection(const uchar * rc_data, const uchar * rc_desc, int rc_desc_size);
Section * section(const PIString & section_name) const;
PIByteArray get(const PIString & section_name, const PIString & entry_name) const;
PIByteArray get(const PIString & entry_name) const;
void clear();
private:
PIResourcesStorage();
~PIResourcesStorage();
PIMap<PIString, Section * > sections;
};
PIP_EXPORT PIByteArray & operator <<(PIByteArray & b, const PIResourcesStorage::__RCEntry & v);
PIP_EXPORT PIByteArray & operator >>(PIByteArray & b, PIResourcesStorage::__RCEntry & v);
#endif // PIRESOURCES_H