#ifndef __PROHIBITION_WORD_PARSER_H #define __PROHIBITION_WORD_PARSER_H #pragma once //================================================================================================== // (History) // - 09.07.10, waverix, code rearrangement // , move from global namespace to class nested type // //-------------------------------------------------------------------------------------------------- // (Utility) #include #include #include #include //-------------------------------------------------------------------------------------------------- // (ProgramCommon) #include #include //#define MAX_PATTERN_LENGTH 20 // (WAVERIX) (090710) (CHANGES) //static int m_nBanWordCnt = 0; // (WAVERIX) (090710) (REMOVED) //================================================================================================== // class ProhibitionWordParser : public util::Singleton, public IParser, public ITextFilter { static const int MAX_PATTERN_LENGTH = 20; // (CHANGES) define -> const typedef STLX_VECTOR BAN_WORD_VEC; typedef STLX_VECTOR FILTER_VEC; typedef STLX_VECTOR FILTER_NAME_VEC; public: ProhibitionWordParser(void); virtual ~ProhibitionWordParser(void); void Init(char* pszPackFileName); void Release() {} void Unload(); //---------------------------------------------------------------------------------------------- #ifdef _NA_0_20100929_LANGUAGE_OF_FILTER BOOL VerifyCharName(util::cSTRING_REF& IN rCharName, BYTE byLanguageOfFilter); #endif BOOL VerifyCharName(util::cSTRING_REF& IN rCharName); void CalFailFuction(); void InitPattern(); //BOOL CheckIncludeString(TCHAR* ptszCharName); //Ư¼ö¹®ÀÚ °Ë»ç BOOL CheckIncludeBanWord(TCHAR* ptszCharName); //±ÝÁö¹®ÀÚ °Ë»ç void CheckIncludeSymbol(TCHAR* ptszMemo); virtual HRESULT Create(); virtual HRESULT Destroy(); virtual HRESULT Save(const char* szFName); virtual HRESULT Load(const char* szFName, bool bNameFilter = true); virtual HRESULT LoadFromPack(const char* szFName, bool bNameFilter = true); // IParser interface virtual BOOL LoadScript(eSCRIPT_CODE ScriptCode, BOOL bReload); // CHANGES: f110826.1L, changes the interface specification template bool CheckFilterName(const TCHAR (&null_terminated_string)[_Size]) const; // CHANGES: f110826.1L, changes the interface specification template bool CheckFilter(const TCHAR (&null_terminated_string)[_Size]) const; #if !defined(_NA002676_WORLD_SERVER_RENEWAL) || 1// to compatible world server (old version) BOOL CheckFilter(util::cSTRING_REF& IN rCHRCTL); BOOL CheckFilterName(util::cSTRING_REF& IN rCHRCTL); #endif protected: virtual char* GetReplaceTarget(int* nLength, char* szSrc); private: BOOL _LoadFilter(BOOL bReload); BOOL _LoadFilterName(BOOL bReload); // CHANGES: f110826.1L, changes the interface specification bool CheckFilterName(const TCHAR* null_terminated_string, size_t string_length) const; // CHANGES: f110826.1L, changes the interface specification bool CheckFilter(const TCHAR* null_terminated_string, size_t string_length) const; //---------------------------------------------------------------------------------------------- // (Fields) ITextFilter* m_pITextFilter; BAN_WORD_VEC m_vecBanWord; FILTER_VEC m_vecFilter; FILTER_NAME_VEC m_vecFilterName; util::cSTRING_REF_RW_WITH_BUFFER m_Buffer; // UNUSED SECTION? BYTE m_PatternLength; TCHAR m_Pattern[MAX_PATTERN_LENGTH + 1]; TCHAR m_PatternFail[MAX_PATTERN_LENGTH + 1]; // // Çѹø »ç¿ëÇÏ¸é ¾µ¸ð ¾ø´Â °Í Àú~ ¸Ö¸® Ä¡¿öµÎÀÚ. TCHAR m_pszFileName[MAX_PATH]; }; //================================================================================================== // CHANGES: f110826.1L, changes the interface specification template bool ProhibitionWordParser::CheckFilterName(const TCHAR (&null_terminated_string)[_Size]) const { BOOST_STATIC_ASSERT(_Size != 0); if (null_terminated_string[_Size - 1] != _T('\0')) { return false; }; return CheckFilterName(null_terminated_string, ::_tcslen(null_terminated_string)); }; // CHANGES: f110826.1L, changes the interface specification template bool ProhibitionWordParser::CheckFilter(const TCHAR (&null_terminated_string)[_Size]) const { BOOST_STATIC_ASSERT(_Size != 0); if (null_terminated_string[_Size - 1] != _T('\0')) { return false; }; return CheckFilter(null_terminated_string, ::_tcslen(null_terminated_string)); } #endif //__PROHIBITION_WORD_PARSER_H