forked from FlatGlobus/WTLBuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ValueListHelper.cpp
54 lines (47 loc) · 1.37 KB
/
ValueListHelper.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
// Copyright (C) FlatGlobus([email protected]) All rights reserved.
//
// This file is a part of the WTLBuilder.
// The use and distribution terms for this software are covered by the
// Microsoft Public License (http://opensource.org/licenses/MS-PL)
// which can be found in the file MS-PL.txt at the root folder.
#include "stdafx.h"
#include "ValueListHelper.h"
#include "PropertyItem.h"
long __stdcall CValueListHelper::GetValCount(BSTR customValName)
{
CCustomVal * values=GetCustomVal(CString(customValName));
if(values)
{
long i=0;
for (i = 0; values[i].name!=NULL; i++);
return i;
}
return 0;
}
BSTR __stdcall CValueListHelper::GetValName(BSTR customValName,long idx)
{
CCustomVal * values=GetCustomVal(CString(customValName));
if(values)
{
long i=0;
for (i = 0; values[i].name!=NULL && i != idx ; i++);
if(i==idx && values[i].name!=NULL)
{
CString str(values[i].decorate);
return str.AllocSysString();
}
}
return NULL;
}
long __stdcall CValueListHelper::GetValID(BSTR customValName,long idx)
{
CCustomVal * values=GetCustomVal(CString(customValName));
if(values)
{
long i=0;
for (i = 0; values[i].name!=NULL && i != idx ; i++);
if(i==idx && values[i].name!=NULL)
return values[i].id;
}
return 0;
}