⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spellyer.h

📁 语法检查程序
💻 H
字号:
/***************************************************************************/
/* NOTE:                                                                   */
/* This document is copyright (c) by Oz Solomon and Yonat Sharon, and is   */
/* bound by the MIT open source license.                                   */ 
/* See License.txt or visit www.opensource.org/licenses/mit-license.html   */
/***************************************************************************/

#ifndef SPELLYER_H
#define SPELLYER_H

#pragma warning (disable : 4786)

#include "Spelly.h"
#include <map>

class CodeParser;
class SpellyParserContext;

class Spellyer
{
public:
    Spellyer();
    ~Spellyer();
    void Spell(
        I_TEXT_DOC* inDoc,
        bool inCheckAll); // not only comments and strings
private:
    CComQIPtr<I_TEXT_SELECTION, &IID_I_TEXT_SELECTION>  itsSelection;
    CPoint  itsStartPoint;  // where to start checking
    CPoint  itsEndPoint;    // where to stop checking
    CPoint  itsCurrPoint;   // current checking point
    CPoint  itsOrgPoint;    // used if nothing was selected. Otherwise == (0,0)
    bool    itsRestoreSelection; // restore original selection when finished
    SIZE    itsDlgOffset;   // for the CSuggestDlg
    std::map<CString,CString>   itsReplacements; // for Replace All

    // to check only strings and comments
    CodeParser*             itsCodeParser;
    SpellyParserContext*    itsParserContext;

    void InitCodeParser(I_TEXT_DOC* inDoc);
    void InitSelection(I_TEXT_DOC* inDoc); // find area to check and go to its start
    bool SpellCurrLine(); // returns: continue to next line
    void Cleanup(); // restore the original selection/position

    void Parse(char c); // using itsCodeParser
    bool InSpellZone(char c); // c is still in area to check

    bool FindNextWord(
        const char* inText,
        unsigned&   outWordStartPos,
        unsigned&   outWordLen);
    
    bool Misspelled(const CString& inWord);

    CString SpellWord( // returns: ""=no replacement, "!"=stop, else=replace
        const CString& inWord);
    
    void ReportError(const CString& error);
};

#endif // SPELLYER_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -