summaryrefslogtreecommitdiff
path: root/wpd/WpdServiceSampleDriver/FakeContactContent.h
blob: 1b2d8dfb6f55ccb863fdac638631b786adbb6606 (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
#pragma once

/**
 * This class represents an abstraction of a contact content object
 * Driver implementors should replace this with their own
 * device I/O classes/libraries.
 */

class FakeContactContent : public FakeContent
{
public:
    FakeContactContent()
    {
        Format              = FORMAT_AbstractContact;
        ContentType         = WPD_CONTENT_TYPE_CONTACT;
        RequiredScope       = CONTACTS_SERVICE_ACCESS;
        CanDelete           = true;
        VersionIdentifier   = 0;
    }

    FakeContactContent(const FakeContactContent& src)
    {
        *this = src;
    }

    ~FakeContactContent()
    {
    }

    FakeContactContent& operator= (const FakeContactContent& src)
    {
        FamilyName                  = src.FamilyName;
        GivenName                   = src.GivenName;
        VersionIdentifier           = src.VersionIdentifier;
        
        return *this;
    }

    HRESULT GetValue(
        _In_  REFPROPERTYKEY         Key, 
        _In_  IPortableDeviceValues* pStore);

    HRESULT WriteValue(
        _In_  REFPROPERTYKEY         Key, 
        _In_  REFPROPVARIANT         Value);

    HRESULT GetPropertyAttributes(
        _In_  REFPROPERTYKEY         Key, 
        _In_  IPortableDeviceValues* pAttributes);

    HRESULT GetSupportedProperties(
        _In_  IPortableDeviceKeyCollection* pKeys);
  
    HRESULT WriteValues(
        _In_  IPortableDeviceValues* pValues,
        _In_  IPortableDeviceValues* pResults,
        _Out_ bool*                  pbObjectChanged);

private:
    void UpdateVersion();

public:    
    // Custom properties defined by the contacts service
    CAtlStringW             FamilyName;
    CAtlStringW             GivenName;

private:
    // Indicates whether the object has been updated
    DWORD                   VersionIdentifier;
};

HRESULT GetSupportedContactProperties(
    _In_  IPortableDeviceKeyCollection* pKeys);

HRESULT GetContactPropertyAttributes(
    _In_  REFPROPERTYKEY                Key, 
    _In_  IPortableDeviceValues*        pAttributes);