-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
DictionaryParser.h
50 lines (37 loc) · 1.53 KB
/
DictionaryParser.h
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
// 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
#pragma once
#include "Globals.h"
//////////////////////////////////////////////////////////////////////
//
class CParserStringRange : public CStringRange
{
public:
CParserStringRange() : CStringRange()
{
_fEscapeIncluded = FALSE;
}
BOOL _fEscapeIncluded; // flag. This string range included escape sequence.
};
//////////////////////////////////////////////////////////////////////
//
class CDictionaryParser
{
public:
CDictionaryParser(LCID locale);
virtual ~CDictionaryParser();
BOOL ParseLine(_In_reads_(dwBufLen) LPCWSTR pwszBuffer, DWORD_PTR dwBufLen, _Out_ CParserStringRange *psrgKeyword, _Inout_opt_ CSampleImeArray<CParserStringRange> *pValue = nullptr);
// dwBufLen - in character count
_Ret_maybenull_
LPCWSTR GetToken(_In_reads_(dwBufLen) LPCWSTR pwszBuffer, DWORD_PTR dwBufLen, _In_ const WCHAR chDelimiter, _Out_ CParserStringRange *srgKeyWord);
protected:
BOOL RemoveWhiteSpaceFromBegin(_Inout_opt_ CStringRange *pString);
BOOL RemoveWhiteSpaceFromEnd(_Inout_opt_ CStringRange *pString);
BOOL RemoveStringDelimiter(_Inout_opt_ CStringRange *pString);
DWORD_PTR GetOneLine(_In_z_ LPCWSTR pwszBuffer, DWORD_PTR dwBufLen);
LCID _locale; // used for CompareString
};