-
Notifications
You must be signed in to change notification settings - Fork 1
/
DisplayAttributeProvider.cpp
81 lines (68 loc) · 2.22 KB
/
DisplayAttributeProvider.cpp
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
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved
#include "Private.h"
#include "globals.h"
#include "SampleIME.h"
#include "DisplayAttributeInfo.h"
#include "EnumDisplayAttributeInfo.h"
//+---------------------------------------------------------------------------
//
// ITfDisplayAttributeProvider::EnumDisplayAttributeInfo
//
//----------------------------------------------------------------------------
STDAPI CSampleIME::EnumDisplayAttributeInfo(__RPC__deref_out_opt IEnumTfDisplayAttributeInfo **ppEnum)
{
CEnumDisplayAttributeInfo *pAttributeEnum = nullptr;
if (ppEnum == nullptr)
{
return E_INVALIDARG;
}
*ppEnum = nullptr;
pAttributeEnum = new (std::nothrow) CEnumDisplayAttributeInfo();
if (pAttributeEnum == nullptr)
{
return E_OUTOFMEMORY;
}
*ppEnum = pAttributeEnum;
return S_OK;
}
//+---------------------------------------------------------------------------
//
// ITfDisplayAttributeProvider::GetDisplayAttributeInfo
//
//----------------------------------------------------------------------------
STDAPI CSampleIME::GetDisplayAttributeInfo(__RPC__in REFGUID guidInfo,
__RPC__deref_out_opt ITfDisplayAttributeInfo **ppInfo)
{
if (ppInfo == nullptr)
{
return E_INVALIDARG;
}
*ppInfo = nullptr;
// Which display attribute GUID?
if (IsEqualGUID(guidInfo, Global::SampleIMEGuidDisplayAttributeInput))
{
*ppInfo = new (std::nothrow) CDisplayAttributeInfoInput();
if ((*ppInfo) == nullptr)
{
return E_OUTOFMEMORY;
}
}
else if (IsEqualGUID(guidInfo, Global::SampleIMEGuidDisplayAttributeConverted))
{
*ppInfo = new (std::nothrow) CDisplayAttributeInfoConverted();
if ((*ppInfo) == nullptr)
{
return E_OUTOFMEMORY;
}
}
else
{
return E_INVALIDARG;
}
return S_OK;
}