Subversion Repositories spk

Rev

Rev 50 | Rev 131 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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
116 cycrow 66
	void setName			( const Utils::String &str ) { 
67
		_changed(); _sName = str.remove ( '|' ); 
68
	}
46 cycrow 69
	void setVersion			( const Utils::String &str ) { _changed(); _sVersion = str; }
70
	void setAuthor			( const Utils::String &str ) { _changed(); _sAuthor = str.remove ( '|' ); }
71
	void setWebAddress		( const Utils::String &str ) { _changed(); _sWebAddress = str; }
72
	void setWebSite			( const Utils::String &str ) { _changed(); _sWebSite = str; }
73
	void setEmail			( const Utils::String &str ) { _changed(); _sEmail = str; }
74
	void setCreationDate	( const Utils::String &str ) { _changed(); _sCreationDate = str; }
48 cycrow 75
	void setDescription		( const Utils::String &str ) { _changed(); _parseDescription(str); }
46 cycrow 76
	void setFilename		( const Utils::String &str ) { _sFilename = str; }
50 cycrow 77
	void setExportFilename	( const Utils::String &str ) { _sExportFilename = str; }
46 cycrow 78
	void setForumLink		( const Utils::String &str ) { _changed(); _sForumLink = str; }
79
	void setRecommended		( int i )					 { _changed(); _iRecommended = i; }
80
	void setGameChanging	( int i )					 { _changed(); _iGameChanging = i; }
81
	void setEaseOfUse		( int i )					 { _changed(); _iEaseOfUse = i; }
48 cycrow 82
	void setPluginType		( int i )					 { _changed(); _iPluginType = i; }
50 cycrow 83
	void adjustChanged		( bool bChanged )			 { _bChanged = bChanged; }
46 cycrow 84
 
85
	// install texts
86
	Utils::String installText(int iLang, bool bBefore, bool bIncludeDefault = true) const;
87
	Utils::String uninstallText(int iLang, bool bBefore, bool bIncludeDefault = true) const;
88
	void addInstallText(int iLang, bool bBefore, const Utils::String &sText);
89
	void addUninstallText(int iLang, bool bBefore, const Utils::String &sText);
90
	void removeInstallText(int iLang, bool bInstall);
91
 
92
protected:
93
	virtual void _changed() { _bChanged = true; }
94
	virtual void _setDefaults();
95
	void _setRatings(int iEase, int iChanging, int iRec);
48 cycrow 96
	void _parseDescription(const Utils::String &sDesc);
46 cycrow 97
 
98
	bool _noRatings() const { return (_iRecommended == -1 && _iEaseOfUse == -1 && _iGameChanging == -1) ? true : false; }
99
	void _merge(CCorePackage *pPackage);
100
 
101
	Utils::String _installText(int iLang, bool bBefore, bool bIncludeDefault, const CInstallText *pText) const;
102
	void _addInstallText(int iLang, bool bBefore, const Utils::String &sText, CInstallText *pText);
103
};
104
 
105
 
106
}}//NAMESPACE