| 46 | cycrow | 1 | #pragma once
 | 
        
           |  |  | 2 |   | 
        
           |  |  | 3 | #include "../Utils/String.h"
 | 
        
           |  |  | 4 |   | 
        
           | 48 | cycrow | 5 | enum {PLUGIN_NORMAL, PLUGIN_STABLE, PLUGIN_EXPERIMENTAL, PLUGIN_CHEAT, PLUGIN_MOD}; // filters for browsing packages
 | 
        
           | 46 | cycrow | 6 |   | 
        
           |  |  | 7 | namespace SPK {
 | 
        
           |  |  | 8 | namespace Package {
 | 
        
           |  |  | 9 |   | 
        
           | 48 | cycrow | 10 |   | 
        
           | 46 | cycrow | 11 | class CInstallText;
 | 
        
           |  |  | 12 |   | 
        
           |  |  | 13 | class SPKEXPORT CCorePackage
 | 
        
           |  |  | 14 | {
 | 
        
           |  |  | 15 | private:
 | 
        
           |  |  | 16 | 	Utils::String _sName;
 | 
        
           |  |  | 17 | 	Utils::String _sVersion;
 | 
        
           |  |  | 18 | 	Utils::String _sAuthor;
 | 
        
           |  |  | 19 | 	Utils::String _sWebSite;
 | 
        
           |  |  | 20 | 	Utils::String _sWebAddress;
 | 
        
           |  |  | 21 | 	Utils::String _sEmail;
 | 
        
           |  |  | 22 | 	Utils::String _sDescription;
 | 
        
           |  |  | 23 | 	Utils::String _sCreationDate;
 | 
        
           |  |  | 24 | 	Utils::String _sForumLink;
 | 
        
           |  |  | 25 |   | 
        
           |  |  | 26 | 	Utils::String _sFilename;
 | 
        
           |  |  | 27 | 	Utils::String _sExportFilename;
 | 
        
           |  |  | 28 |   | 
        
           |  |  | 29 | 	CInstallText *_pInstallText;
 | 
        
           |  |  | 30 | 	CInstallText *_pUninstallText;
 | 
        
           |  |  | 31 |   | 
        
           |  |  | 32 | 	int _iPluginType;
 | 
        
           |  |  | 33 |   | 
        
           |  |  | 34 | 	// package stats
 | 
        
           |  |  | 35 | 	int _iRecommended;
 | 
        
           |  |  | 36 | 	int _iEaseOfUse;
 | 
        
           |  |  | 37 | 	int _iGameChanging;
 | 
        
           |  |  | 38 |   | 
        
           |  |  | 39 | 	bool _bChanged;
 | 
        
           |  |  | 40 |   | 
        
           |  |  | 41 | public:
 | 
        
           |  |  | 42 | 	CCorePackage(void);
 | 
        
           |  |  | 43 | 	virtual ~CCorePackage(void);
 | 
        
           |  |  | 44 |   | 
        
           |  |  | 45 | 	//getters
 | 
        
           |  |  | 46 | 	const Utils::String	&name			() const { return _sName; }
 | 
        
           |  |  | 47 | 	const Utils::String	&version	 	() const { return _sVersion; }
 | 
        
           | 50 | cycrow | 48 | 	const Utils::String	&author			() const { return _sAuthor; }
 | 
        
           | 46 | cycrow | 49 | 	const Utils::String	&webSite		() const { return _sWebSite; }
 | 
        
           |  |  | 50 | 	const Utils::String	&webAddress		() const { return _sWebAddress; }
 | 
        
           |  |  | 51 | 	const Utils::String	&email			() const { return _sEmail; }
 | 
        
           |  |  | 52 | 	const Utils::String	&creationDate	() const { return _sCreationDate; }
 | 
        
           | 48 | cycrow | 53 | 	const Utils::String	&description	() const { return _sDescription; }
 | 
        
           | 46 | cycrow | 54 | 	const Utils::String	&forumLink		() const { return _sForumLink; }
 | 
        
           |  |  | 55 | 	int					 recommended	() const { return _iRecommended; }
 | 
        
           |  |  | 56 | 	int					 easeOfUse		() const { return _iEaseOfUse; }
 | 
        
           |  |  | 57 | 	int					 gameChanging	() const { return _iGameChanging; }
 | 
        
           |  |  | 58 | 	const Utils::String &filename		() const { return _sFilename; }
 | 
        
           |  |  | 59 | 	const Utils::String &exportFilename	() const { return _sExportFilename; }
 | 
        
           |  |  | 60 | 	const CInstallText  *installText	() const { return _pInstallText; }
 | 
        
           |  |  | 61 | 	const CInstallText  *uninstallText	() const { return _pUninstallText; }
 | 
        
           | 48 | cycrow | 62 | 	int					 pluginType		() const { return _iPluginType; }
 | 
        
           | 50 | cycrow | 63 | 	bool				 hasChanged		() const { return _bChanged; }
 | 
        
           | 46 | cycrow | 64 |   | 
        
           |  |  | 65 | 	//setters
 | 
        
           |  |  | 66 | 	void setName			( const Utils::String &str ) { _changed(); _sName = str.remove ( '|' ); }
 | 
        
           |  |  | 67 | 	void setVersion			( const Utils::String &str ) { _changed(); _sVersion = str; }
 | 
        
           |  |  | 68 | 	void setAuthor			( const Utils::String &str ) { _changed(); _sAuthor = str.remove ( '|' ); }
 | 
        
           |  |  | 69 | 	void setWebAddress		( const Utils::String &str ) { _changed(); _sWebAddress = str; }
 | 
        
           |  |  | 70 | 	void setWebSite			( const Utils::String &str ) { _changed(); _sWebSite = str; }
 | 
        
           |  |  | 71 | 	void setEmail			( const Utils::String &str ) { _changed(); _sEmail = str; }
 | 
        
           |  |  | 72 | 	void setCreationDate	( const Utils::String &str ) { _changed(); _sCreationDate = str; }
 | 
        
           | 48 | cycrow | 73 | 	void setDescription		( const Utils::String &str ) { _changed(); _parseDescription(str); }
 | 
        
           | 46 | cycrow | 74 | 	void setFilename		( const Utils::String &str ) { _sFilename = str; }
 | 
        
           | 50 | cycrow | 75 | 	void setExportFilename	( const Utils::String &str ) { _sExportFilename = str; }
 | 
        
           | 46 | cycrow | 76 | 	void setForumLink		( const Utils::String &str ) { _changed(); _sForumLink = str; }
 | 
        
           |  |  | 77 | 	void setRecommended		( int i )					 { _changed(); _iRecommended = i; }
 | 
        
           |  |  | 78 | 	void setGameChanging	( int i )					 { _changed(); _iGameChanging = i; }
 | 
        
           |  |  | 79 | 	void setEaseOfUse		( int i )					 { _changed(); _iEaseOfUse = i; }
 | 
        
           | 48 | cycrow | 80 | 	void setPluginType		( int i )					 { _changed(); _iPluginType = i; }
 | 
        
           | 50 | cycrow | 81 | 	void adjustChanged		( bool bChanged )			 { _bChanged = bChanged; }
 | 
        
           | 46 | cycrow | 82 |   | 
        
           |  |  | 83 | 	// install texts
 | 
        
           |  |  | 84 | 	Utils::String installText(int iLang, bool bBefore, bool bIncludeDefault = true) const;
 | 
        
           |  |  | 85 | 	Utils::String uninstallText(int iLang, bool bBefore, bool bIncludeDefault = true) const;
 | 
        
           |  |  | 86 | 	void addInstallText(int iLang, bool bBefore, const Utils::String &sText);
 | 
        
           |  |  | 87 | 	void addUninstallText(int iLang, bool bBefore, const Utils::String &sText);
 | 
        
           |  |  | 88 | 	void removeInstallText(int iLang, bool bInstall);
 | 
        
           |  |  | 89 |   | 
        
           |  |  | 90 | protected:
 | 
        
           |  |  | 91 | 	virtual void _changed() { _bChanged = true; }
 | 
        
           |  |  | 92 | 	virtual void _setDefaults();
 | 
        
           |  |  | 93 | 	void _setRatings(int iEase, int iChanging, int iRec);
 | 
        
           | 48 | cycrow | 94 | 	void _parseDescription(const Utils::String &sDesc);
 | 
        
           | 46 | cycrow | 95 |   | 
        
           |  |  | 96 | 	bool _noRatings() const { return (_iRecommended == -1 && _iEaseOfUse == -1 && _iGameChanging == -1) ? true : false; }
 | 
        
           |  |  | 97 | 	void _merge(CCorePackage *pPackage);
 | 
        
           |  |  | 98 |   | 
        
           |  |  | 99 | 	Utils::String _installText(int iLang, bool bBefore, bool bIncludeDefault, const CInstallText *pText) const;
 | 
        
           |  |  | 100 | 	void _addInstallText(int iLang, bool bBefore, const Utils::String &sText, CInstallText *pText);
 | 
        
           |  |  | 101 | };
 | 
        
           |  |  | 102 |   | 
        
           |  |  | 103 |   | 
        
           |  |  | 104 | }}//NAMESPACE
 |