summaryrefslogtreecommitdiffstats
path: root/public/sdk/inc/stgvarb.hxx
blob: d737fce4f31d45c8d6d1cf7174ea780bc66068cd (plain) (blame)
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
//+-------------------------------------------------------------------------
//
//  Microsoft Windows
//  Copyright (C) Microsoft Corporation, 1992 - 1992.
//
//  File:       StgVarB.hxx - Storage Variant Base Class
//
//  Contents:   C++ Base wrapper for PROPVARIANT.
//
//  History:    01-Aug-94 KyleP     Created
//
//--------------------------------------------------------------------------

#if !defined(__STGVARB_HXX__)
#define __STGVARB_HXX__

class PSerStream;
class PDeSerStream;

class PMemoryAllocator
{
public:
    virtual void *Allocate(ULONG cbSize) = 0;
    virtual void Free(void *pv) = 0;
};


#if defined(OFSDBG) || defined(CIDBG)
#define DBGPROP (OFSDBG || DBG || CIDBG)
#else
#define DBGPROP DBG
#endif

#if DBGPROP
#if !defined(_NTDLLBUILD_)
#define ENABLE_DISPLAY_VARIANT
#endif
#endif

#if defined(_NTDLLBUILD_) && defined(_CAIRO_)
#define OLDSUMCATAPI
#endif

#if !defined(_NTDLLBUILD_) || defined(OLDSUMCATAPI)
#define ENABLE_MARSHAL_VARIANT
#endif


//+-------------------------------------------------------------------------
//
//  Class:      CBaseStorageVariant
//
//  Purpose:    C++ wrapper for PROPVARIANT
//
//  History:    01-Aug-94 KyleP     Created
//
//  Notes:      Only contains a static method to unmarshal from a stream.
//
//--------------------------------------------------------------------------

class CBaseStorageVariant: public /* VC 5 fix - Was "protected" */ tagPROPVARIANT
{
#if defined(OLDSUMCATAPI)
    friend void MarshallVariant(PSerStream &stm, PROPVARIANT &var);
#endif

public:
    CBaseStorageVariant() {}
    CBaseStorageVariant(PROPVARIANT& var): tagPROPVARIANT(var) {}

#ifdef KERNEL
    static NTSTATUS UnmarshalledSize( PDeSerStream &stm, ULONG & cb );
#endif

    static NTSTATUS Unmarshall(
                        PDeSerStream &stm,
                        PROPVARIANT &sv,
                        PMemoryAllocator &ma);

#ifdef ENABLE_MARSHAL_VARIANT
    void Marshall(PSerStream& stm) const;
#endif

#ifdef ENABLE_DISPLAY_VARIANT
    VOID DisplayVariant(ULONG ulLevel, USHORT CodePage) const;
#endif
};


#if defined(OLDSUMCATAPI)
extern void MarshallVariant(PSerStream &stm, PROPVARIANT &var);
#endif


#endif // __STGVARB_HXX__