summaryrefslogtreecommitdiff
path: root/Common/CmptData.h
blob: 985de2dd5ce57767f7504a60b6f30b8c49067c8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// ShutdownData.h: interface for the CShutdownData class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(PROPERTYBAGIMPL_H__6CC5C4C0_1F0A_11D2_B2D4_0020182B97FC__INCLUDED_)
#define PROPERTYBAGIMPL_H__6CC5C4C0_1F0A_11D2_B2D4_0020182B97FC__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#define NS_NO_KEY				_T("No Key")
#define NS_BACKUP_REG_SOURCE	_T("Source%.4d")
#define NS_BACKUP_REG_DEST		_T("Destination")
#define NS_BACKUP_REG_ENGINE	_T("Engine")
#define NS_IGNORE_REG_EXT		_T("Ignore%.4d")
#define NS_ENCRYPT_REG_FILES	_T("Path%.4d")
#define NS_ENCRYPT_REG_DISABLE	_T("Disable")
#define NS_ENCRYPT_REG_READONLY _T("ReadOnly")

class CPropertyBag 
{

public:
	CPropertyBag();
	virtual ~CPropertyBag();

	HRESULT DeleteProperty(const string& sKeyName);
	HRESULT WriteString(const string& sKeyName, const string& sValue);
	HRESULT WriteInt(const string& sKeyName, int nValue);
	string GetString(const string& sKeyName, const string& sDefault) const;
	int GetInt(const string& sKeyName, int nDefault) const;

	// Chooses the first IPropertyBag it finds
	HRESULT Initialize(int cUnks, IUnknown** ppUnks);
	HRESULT Initialize(IUnknown* pUnk);

	bool IsInitialized()
		{ return m_pBag != NULL; };

	UINT GetStringSet(const string& sFormat, string_array& asData) const;
	UINT WriteStringSet(const string& sFormat, const string_array& asData);

// Data 
protected:
	IPropertyBag* m_pBag;
};

#endif // !defined(AFX_PROPERTYBAGIMPL_H__6CC5C4C0_1F0A_11D2_B2D4_0020182B97FC__INCLUDED_)