69 lines
1.8 KiB
C++
69 lines
1.8 KiB
C++
//-----------------------------------------------------------------------------+
|
|
//
|
|
// = FileName : FindParser.h
|
|
// = Version : ver1.0
|
|
// = Author :
|
|
// = CreateDate : 2010-11-08
|
|
// = Description: 分析搜索的类的头文件
|
|
// = Maintainers:
|
|
//
|
|
//-----------------------------------------------------------------------------+
|
|
|
|
#ifndef _CFINDPARSER_H_
|
|
#define _CFINDPARSER_H_
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif // _MSC_VER > 1000
|
|
|
|
|
|
//#include <Windef.h>
|
|
//#include <WinNT.h>
|
|
//#include <AFX.H>
|
|
|
|
|
|
// Zyu add on 101013,根据搜索选项匹配字符串
|
|
#define FP_DEFAULT 0x00 // 默认设置
|
|
#define FP_INCREMENT 0x01 // 增量搜索
|
|
#define FP_MATCH_CASE 0x02 // 区分大小写
|
|
#define FP_WHOLE_WORD 0x04 // 全字匹配
|
|
#define FP_WILDCARD 0x08 // 使用通配符
|
|
#define FP_WORD_WIDTH 0x10 // 区分半/全角字符
|
|
|
|
|
|
class GEOAPI XFindParser
|
|
{
|
|
public:
|
|
XFindParser();
|
|
virtual ~XFindParser();
|
|
|
|
// 查找选项的Set/Get函数
|
|
DWORD GetFindOption() const;
|
|
void SetFindOption(DWORD dwMask);
|
|
|
|
// 获得目标字符串,源字符串以及匹配结果的方法
|
|
const CString& GetResult() const;
|
|
const CString& GetSrcString() const;
|
|
const CString& GetDestString() const;
|
|
|
|
// 搜索字符串
|
|
bool Find(LPCTSTR pszSrc, LPCTSTR pszDest, int &iPos);
|
|
// 将一个字符串分成字符和数字,用于增量查找
|
|
bool DivideString(LPCTSTR pszDest, CString &sSymble, CString &sNumber) const;
|
|
|
|
protected:
|
|
// 映射字符串,参数参照LCMapString函数,用于将字符串转为半角
|
|
bool MapString(CString &sDest, DWORD dwMapFlags) const;
|
|
|
|
private:
|
|
CString m_sResult; // 搜索结果
|
|
CString m_sDest; // 目标串
|
|
CString m_sSrc; // 源串
|
|
DWORD m_dwMask; // 搜索选项
|
|
};
|
|
|
|
// 全局查找替换保存设置
|
|
extern XFindParser g_FindParser;
|
|
|
|
#endif
|