Code::Blocks
SVN r11506
|
Try to detect the encoding of a file on disk. More...
#include <encodingdetector.h>
Public Member Functions | |
EncodingDetector (const wxString &filename, bool useLog=true) | |
EncodingDetector (LoaderBase *fileLdr, bool useLog=true) | |
EncodingDetector (const wxByte *buffer, size_t size, bool useLog=true) | |
EncodingDetector (const EncodingDetector &rhs, bool useLog=true) | |
~EncodingDetector () override | |
bool | IsOK () const |
bool | UsesBOM () const |
int | GetBOMSizeInBytes () const |
wxFontEncoding | GetFontEncoding () const |
wxString | GetWxStr () const |
Protected Member Functions | |
bool | DetectEncoding (const wxString &filename, bool convert_to_wxstring=true) |
bool | DetectEncoding (const wxByte *buffer, size_t size, bool convert_to_wxstring=true) |
bool | DetectEncodingEx (const wxByte *buffer, size_t len) |
void | Report (const char *aCharset) override |
Protected Attributes | |
bool | m_IsOK |
bool | m_UseBOM |
bool | m_UseLog |
int | m_BOMSizeInBytes |
wxFontEncoding | m_Encoding |
Private Member Functions | |
bool | ConvertToWxString (const wxByte *buffer, size_t size) |
Private Attributes | |
wxString | m_MozillaResult |
wxString | m_ConvStr |
Try to detect the encoding of a file on disk.
Definition at line 17 of file encodingdetector.h.
EncodingDetector::EncodingDetector | ( | const wxString & | filename, |
bool | useLog = true |
||
) |
Definition at line 35 of file encodingdetector.cpp.
References DetectEncoding(), wxLocale::GetSystemEncoding(), m_Encoding, m_IsOK, and wxEmptyString.
EncodingDetector::EncodingDetector | ( | LoaderBase * | fileLdr, |
bool | useLog = true |
||
) |
Definition at line 47 of file encodingdetector.cpp.
References DetectEncoding(), LoaderBase::GetData(), LoaderBase::GetLength(), wxLocale::GetSystemEncoding(), m_Encoding, m_IsOK, and wxEmptyString.
EncodingDetector::EncodingDetector | ( | const wxByte * | buffer, |
size_t | size, | ||
bool | useLog = true |
||
) |
Definition at line 59 of file encodingdetector.cpp.
References DetectEncoding(), wxLocale::GetSystemEncoding(), m_Encoding, m_IsOK, and wxEmptyString.
EncodingDetector::EncodingDetector | ( | const EncodingDetector & | rhs, |
bool | useLog = true |
||
) |
|
override |
Definition at line 71 of file encodingdetector.cpp.
|
private |
Definition at line 431 of file encodingdetector.cpp.
References _T, wxEncodingConverter::Convert(), LogManager::DebugLog(), wxFontMapper::Get(), Manager::Get(), Manager::GetConfigManager(), Manager::GetLogManager(), wxLocale::GetSystemEncoding(), wxEncodingConverter::Init(), wxCSConv::IsOk(), m_BOMSizeInBytes, m_ConvStr, m_Encoding, m_UseLog, makeStringNoNull(), wxString::Printf(), ConfigManager::ReadBool(), wxFONTENCODING_ISO8859_1, wxFONTENCODING_UNICODE, wxFONTENCODING_UTF16BE, wxFONTENCODING_UTF16LE, wxFONTENCODING_UTF32BE, wxFONTENCODING_UTF32LE, wxFONTENCODING_UTF7, and wxFONTENCODING_UTF8.
Referenced by DetectEncoding().
|
protected |
Definition at line 113 of file encodingdetector.cpp.
References wxFile::Close(), wxFile::IsOpened(), wxFile::Length(), and wxFile::Read().
Referenced by EncodingDetector().
|
protected |
Definition at line 147 of file encodingdetector.cpp.
References _T, wxFontMapper::CharsetToEncoding(), ConvertToWxString(), LogManager::DebugLog(), DetectEncodingEx(), F(), wxFontMapper::Get(), Manager::Get(), Manager::GetConfigManager(), wxFontMapper::GetEncodingFromName(), Manager::GetLogManager(), wxLocale::GetSystemEncodingName(), wxString::IsEmpty(), m_BOMSizeInBytes, m_Encoding, m_MozillaResult, m_UseBOM, m_UseLog, wxString::Printf(), ConfigManager::Read(), ConfigManager::ReadInt(), wxEmptyString, and wxFONTENCODING_DEFAULT.
|
protected |
Definition at line 256 of file encodingdetector.cpp.
References m_BOMSizeInBytes, m_Encoding, m_UseBOM, wxFONTENCODING_DEFAULT, wxFONTENCODING_UTF16BE, wxFONTENCODING_UTF16LE, wxFONTENCODING_UTF32BE, wxFONTENCODING_UTF32LE, wxFONTENCODING_UTF7, wxFONTENCODING_UTF8, wxUINT16_SWAP_ON_BE, wxUINT16_SWAP_ON_LE, wxUINT32_SWAP_ON_BE, and wxUINT32_SWAP_ON_LE.
Referenced by DetectEncoding().
int EncodingDetector::GetBOMSizeInBytes | ( | ) | const |
Definition at line 98 of file encodingdetector.cpp.
References m_BOMSizeInBytes.
Referenced by cbEditorInternalData::cbEditorInternalData().
wxFontEncoding EncodingDetector::GetFontEncoding | ( | ) | const |
Definition at line 103 of file encodingdetector.cpp.
References m_Encoding.
Referenced by cbEditorInternalData::cbEditorInternalData().
wxString EncodingDetector::GetWxStr | ( | ) | const |
Definition at line 108 of file encodingdetector.cpp.
References m_ConvStr.
Referenced by FindReplace::FindInFiles(), CodeRefactoring::SearchInFiles(), and CodeRefactoring::VerifyResult().
bool EncodingDetector::IsOK | ( | ) | const |
Definition at line 88 of file encodingdetector.cpp.
References m_IsOK.
Referenced by cbEditorInternalData::cbEditorInternalData(), FindReplace::FindInFiles(), CodeRefactoring::SearchInFiles(), and CodeRefactoring::VerifyResult().
|
overrideprotected |
Definition at line 75 of file encodingdetector.cpp.
References _T, cbC2U(), wxString::Contains(), LogManager::DebugLog(), F(), Manager::Get(), Manager::GetLogManager(), m_MozillaResult, m_UseLog, wxString::wx_str(), wxEmptyString, and wxT.
bool EncodingDetector::UsesBOM | ( | ) | const |
Definition at line 93 of file encodingdetector.cpp.
References m_UseBOM.
Referenced by cbEditorInternalData::cbEditorInternalData().
|
protected |
Definition at line 45 of file encodingdetector.h.
Referenced by ConvertToWxString(), DetectEncoding(), DetectEncodingEx(), and GetBOMSizeInBytes().
|
private |
Definition at line 51 of file encodingdetector.h.
Referenced by ConvertToWxString(), and GetWxStr().
|
protected |
Definition at line 46 of file encodingdetector.h.
Referenced by ConvertToWxString(), DetectEncoding(), DetectEncodingEx(), EncodingDetector(), and GetFontEncoding().
|
protected |
Definition at line 42 of file encodingdetector.h.
Referenced by EncodingDetector(), and IsOK().
|
private |
Definition at line 50 of file encodingdetector.h.
Referenced by DetectEncoding(), and Report().
|
protected |
Definition at line 43 of file encodingdetector.h.
Referenced by DetectEncoding(), DetectEncodingEx(), and UsesBOM().
|
protected |
Definition at line 44 of file encodingdetector.h.
Referenced by ConvertToWxString(), DetectEncoding(), and Report().