Subversion Repositories spk

Rev

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