Rev 116 | Rev 197 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#pragma once#include "../Utils/String.h"#include <map>enum {PLUGIN_NORMAL, PLUGIN_STABLE, PLUGIN_EXPERIMENTAL, PLUGIN_CHEAT, PLUGIN_MOD}; // filters for browsing packagesnamespace SPK {namespace Package {class CInstallText;class SPKEXPORT CCorePackage{private:Utils::String _sName;Utils::String _sVersion;Utils::String _sAuthor;Utils::String _sWebSite;Utils::String _sWebAddress;Utils::String _sEmail;Utils::String _sDescription;Utils::String _sCreationDate;Utils::String _sForumLink;Utils::String _sFilename;Utils::String _sExportFilename;std::map<unsigned int, Utils::String> *_pAutoExtract;std::map<unsigned int, Utils::String> *_pAutoExport;CInstallText *_pInstallText;CInstallText *_pUninstallText;int _iPluginType;// package statsint _iRecommended;int _iEaseOfUse;int _iGameChanging;bool _bChanged;public:CCorePackage(void);virtual ~CCorePackage(void);//gettersconst Utils::String &name () const { return _sName; }const Utils::String &version () const { return _sVersion; }const Utils::String &author () const { return _sAuthor; }const Utils::String &webSite () const { return _sWebSite; }const Utils::String &webAddress () const { return _sWebAddress; }const Utils::String &email () const { return _sEmail; }const Utils::String &creationDate () const { return _sCreationDate; }const Utils::String &description () const { return _sDescription; }const Utils::String &forumLink () const { return _sForumLink; }int recommended () const { return _iRecommended; }int easeOfUse () const { return _iEaseOfUse; }int gameChanging () const { return _iGameChanging; }const Utils::String &filename () const { return _sFilename; }const Utils::String &exportFilename () const { return _sExportFilename; }const CInstallText *installText () const { return _pInstallText; }const CInstallText *uninstallText () const { return _pUninstallText; }int pluginType () const { return _iPluginType; }bool hasChanged () const { return _bChanged; }const std::map<unsigned int, Utils::String> *autoExtraction() const { return _pAutoExtract; }const std::map<unsigned int, Utils::String> *autoExporter() const { return _pAutoExport; }//settersvoid setName ( const Utils::String &str ) { _changed(); _sName = str.remove ( '|' ); }void setVersion ( const Utils::String &str ) { _changed(); _sVersion = str; }void setAuthor ( const Utils::String &str ) { _changed(); _sAuthor = str.remove ( '|' ); }void setWebAddress ( const Utils::String &str ) { _changed(); _sWebAddress = str; }void setWebSite ( const Utils::String &str ) { _changed(); _sWebSite = str; }void setEmail ( const Utils::String &str ) { _changed(); _sEmail = str; }void setCreationDate ( const Utils::String &str ) { _changed(); _sCreationDate = str; }void setDescription ( const Utils::String &str ) { _changed(); _parseDescription(str); }void setFilename ( const Utils::String &str ) { _sFilename = str; }void setExportFilename ( const Utils::String &str ) { _sExportFilename = str; }void setForumLink ( const Utils::String &str ) { _changed(); _sForumLink = str; }void setRecommended ( int i ) { _changed(); _iRecommended = i; }void setGameChanging ( int i ) { _changed(); _iGameChanging = i; }void setEaseOfUse ( int i ) { _changed(); _iEaseOfUse = i; }void setPluginType ( int i ) { _changed(); _iPluginType = i; }void adjustChanged ( bool bChanged ) { _bChanged = bChanged; }void addAutoExtract(unsigned int game, const Utils::String &dir);void addAutoExport(unsigned int game, const Utils::String &file);void clearAutoExtract();void clearAutoExport();// install textsUtils::String installText(int iLang, bool bBefore, bool bIncludeDefault = true) const;Utils::String uninstallText(int iLang, bool bBefore, bool bIncludeDefault = true) const;void addInstallText(int iLang, bool bBefore, const Utils::String &sText);void addUninstallText(int iLang, bool bBefore, const Utils::String &sText);void removeInstallText(int iLang, bool bInstall);protected:virtual void _changed() { _bChanged = true; }virtual void _setDefaults();void _setRatings(int iEase, int iChanging, int iRec);void _parseDescription(const Utils::String &sDesc);bool _noRatings() const { return (_iRecommended == -1 && _iEaseOfUse == -1 && _iGameChanging == -1) ? true : false; }void _merge(CCorePackage *pPackage);Utils::String _installText(int iLang, bool bBefore, bool bIncludeDefault, const CInstallText *pText) const;void _addInstallText(int iLang, bool bBefore, const Utils::String &sText, CInstallText *pText);};}}//NAMESPACE