root/src/Catalog.h @ 33172ad4
| 5fa4a398 | david.sorber | #ifndef __CATALOG_H__
|
||
#define __CATALOG_H__
|
||||
| f16b75e3 | david.sorber | #include <climits>
|
||
| 5fa4a398 | david.sorber | #include <cstdint>
|
||
#include <string>
|
||||
#include <vector>
|
||||
#include "CatalogItem.h"
|
||||
class Catalog
|
||||
{
|
||||
public:
|
||||
Catalog();
|
||||
~Catalog();
|
||||
| f16b75e3 | david.sorber | int load(
|
||
char* filePath,
|
||||
char* passwordBuffer,
|
||||
uint32_t passwordBufferSize,
|
||||
float* complete);
|
||||
inline bool getLoaded() const
|
||||
{
|
||||
return m_loaded;
|
||||
}
|
||||
| 5fa4a398 | david.sorber | inline std::vector<CatalogItem>::iterator begin()
|
||
{
|
||||
return m_catalog.begin();
|
||||
}
|
||||
inline std::vector<CatalogItem>::iterator end()
|
||||
{
|
||||
return m_catalog.end();
|
||||
}
|
||||
void setAllVisible();
|
||||
void filter(const std::string& criteria);
|
||||
| f16b75e3 | david.sorber | static const char* errToString(int err)
|
||
{
|
||||
switch (err)
|
||||
{
|
||||
case ERR_PWHASH_OUT_OF_MEMORY:
|
||||
return "pwhash: out of memory";
|
||||
case ERR_DECRYPT_INCOMPLETE_HEADER:
|
||||
return "decrypt: incomplete header";
|
||||
case ERR_DECRYPT_CORRUPTED_CHUNK:
|
||||
return "decrypt: corrupted chunk";
|
||||
case ERR_DECRYPT_PREMATURE_END:
|
||||
return "decrypt: premature end of file";
|
||||
default:
|
||||
return "unknown error";
|
||||
}
|
||||
}
|
||||
| 5fa4a398 | david.sorber | |||
private:
|
||||
| f16b75e3 | david.sorber | static inline const int ERR_PWHASH_OUT_OF_MEMORY = INT_MIN + 19;
|
||
static inline const int ERR_DECRYPT_INCOMPLETE_HEADER = INT_MIN + 20;
|
||||
static inline const int ERR_DECRYPT_CORRUPTED_CHUNK = INT_MIN + 21;
|
||||
static inline const int ERR_DECRYPT_PREMATURE_END = INT_MIN + 22;
|
||||
void sort();
|
||||
bool m_loaded;
|
||||
| 5fa4a398 | david.sorber | std::vector<CatalogItem> m_catalog;
|
||
};
|
||||
#endif // __CATALOG_H__
|