summaryrefslogtreecommitdiff
path: root/setup_native/source/win32/customactions/reg4msdoc/registryvalueimpl.hxx
blob: a64058e2914142290b9f7b1b2686ac4572d698f7 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// RegistryValueImpl.h: Schnittstelle für die Klasse RegistryValueImpl.
//
//////////////////////////////////////////////////////////////////////

#ifndef _REGISTRYVALUEIMPL_HXX_
#define _REGISTRYVALUEIMPL_HXX_

#include <memory>
#include <string>

class RegistryValueImpl
{
public:

    //#################################
    // Creation/Destruction
    //#################################

    RegistryValueImpl(const std::wstring& Name, int Value);

    RegistryValueImpl(const std::wstring& Name, const std::wstring& Value);

    RegistryValueImpl(const std::wstring& Name, const std::string& Value);

    #if (_MSC_VER >= 1300)
    RegistryValueImpl::RegistryValueImpl(const RegistryValueImpl& s);
    #endif

    virtual ~RegistryValueImpl();


    //#################################
    // Query
    //#################################


    /** Returns the name of the value
    */
    std::wstring GetName() const;

    /** Return the size of data held
    */
    size_t GetDataSize() const;

    /** Get a pointer to the data buffer
        in order to copy the data
    */
    const void* GetDataBuffer() const;

    /** Returns the data as unicode string

        @precond GetType = STRING
    */
    std::wstring GetDataAsUniString() const;

    /** Returns the data as ansi string

        @precond GetType = STRING
    */
    std::string GetDataAsAnsiString() const;

    /** Returns the data as number

        @precond GetType = NUMBER
    */
    int GetDataAsInt() const;

    /** Returns the type of the data
    */
    int GetType() const;

    //#################################
    // Command
    //#################################


    /** Set a new name
    */
    void SetName(const std::wstring& NewName);

    /**
    */
    void SetValue(const std::wstring& NewValue);

    /**
    */
    void SetValue(const std::string& NewValue);

    /**
    */
    void SetValue(int NewValue);

    //#################################
    // Private data
    //#################################

private:
    std::wstring    m_Name;
    int             m_Type;
    std::wstring    m_StringData;
    int             m_IntData;
};


typedef std::auto_ptr<RegistryValueImpl> RegistryValue;


#endif