/********************************************************************
*
* File: gfCCatalogueParserYaml.h
*
* Purpose: Parse the catalogue data file
*
*********************************************************************/
#ifndef gfCCatalogueParserYamlhdr
#define gfCCatalogueParserYamlhdr
#include <map>
#include "../gfICatalogueParser.h"
class gfICatalogueEntry;
class gfCCatalogueCatalogue;
class fsCVariableTable;
namespace YAML{
class Node;
};
class gfCCatalogueParserYaml : public gfICatalogueParser
{
public:
gfCCatalogueCatalogue* const catalogueLoad(const fsStr& pFileName) override;
gfCCatalogueParserYaml();
virtual ~gfCCatalogueParserYaml();<--- Destructor in derived class
protected:
void categoryLoad(gfCCatalogueCatalogue* pCatalogue, const fsStr& pParentCategory, const fsStr& pFileName);
private:
struct SSettings
{
fsStr mIconFileBase;
fsStr mImageFileBase;
fsStr mDefaultAction;
fsStr mDefaultType;
};
void entriesCreate(gfCCatalogueCatalogue* pCatalogue, const fsStr& pParentCategory,
fsCVariableTable* pVarTable, const SSettings& pSettings);
static fsBool itemCreate(gfCCatalogueCatalogue* pCatalogue, const fsStr& pParentCategory,
fsCVariableTable* pVarTable, const SSettings& pSettings, fsS32 pIndex);
static void graphicFileBasesGet(fsCVariableTable* pVarTable, SSettings& pSettings);
static fsStr extensionAdd(const fsStr& pFilename);
std::map<std::string, std::string> flatten(const YAML::Node& node);
};
#endif