Subversion Repositories spk

Rev

Rev 48 | Go to most recent revision | Details | Last modification | View Log | RSS feed

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