Code::Blocks
SVN r11506
include
encodingdetector.h
Go to the documentation of this file.
1
/*
2
* This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
3
* http://www.gnu.org/licenses/lgpl-3.0.html
4
*/
5
6
#ifndef ENCODINGDETECTOR_H
7
#define ENCODINGDETECTOR_H
8
9
#include "
settings.h
"
10
#include "
filemanager.h
"
11
#include <
wx/fontmap.h
>
12
#include "nsUniversalDetector.h"
13
14
class
wxString
;
15
17
class
DLLIMPORT
EncodingDetector
:
public
nsUniversalDetector
18
{
19
public
:
20
EncodingDetector
(
const
wxString
& filename,
bool
useLog=
true
);
21
EncodingDetector
(
LoaderBase
* fileLdr,
bool
useLog=
true
);
22
EncodingDetector
(
const
wxByte
* buffer,
size_t
size,
bool
useLog=
true
);
23
EncodingDetector
(
const
EncodingDetector
& rhs,
bool
useLog=
true
);
24
~
EncodingDetector
()
override
;
25
27
bool
IsOK()
const
;
29
bool
UsesBOM()
const
;
31
int
GetBOMSizeInBytes()
const
;
33
wxFontEncoding
GetFontEncoding()
const
;
34
wxString
GetWxStr()
const
;
35
protected
:
37
bool
DetectEncoding(
const
wxString
& filename,
bool
convert_to_wxstring =
true
);
38
bool
DetectEncoding(
const
wxByte
* buffer,
size_t
size,
bool
convert_to_wxstring =
true
);
39
bool
DetectEncodingEx(
const
wxByte
* buffer,
size_t
len);
40
void
Report(
const
char
* aCharset)
override
;
41
42
bool
m_IsOK
;
43
bool
m_UseBOM
;
44
bool
m_UseLog
;
45
int
m_BOMSizeInBytes
;
46
wxFontEncoding
m_Encoding
;
47
private
:
48
bool
ConvertToWxString(
const
wxByte
* buffer,
size_t
size);
49
50
wxString
m_MozillaResult
;
51
wxString
m_ConvStr
;
52
};
53
54
#endif // ENCODINGDETECTOR_H
EncodingDetector::m_UseBOM
bool m_UseBOM
Definition:
encodingdetector.h:43
EncodingDetector::m_UseLog
bool m_UseLog
Definition:
encodingdetector.h:44
EncodingDetector::m_Encoding
wxFontEncoding m_Encoding
Definition:
encodingdetector.h:46
wxByte
wxUint8 wxByte
EncodingDetector::m_IsOK
bool m_IsOK
Definition:
encodingdetector.h:42
fontmap.h
LoaderBase
Definition:
filemanager.h:31
wxFontEncoding
wxFontEncoding
DLLIMPORT
#define DLLIMPORT
Definition:
settings.h:16
EncodingDetector
Try to detect the encoding of a file on disk.
Definition:
encodingdetector.h:17
EncodingDetector::m_BOMSizeInBytes
int m_BOMSizeInBytes
Definition:
encodingdetector.h:45
settings.h
wxString
EncodingDetector::m_MozillaResult
wxString m_MozillaResult
Definition:
encodingdetector.h:50
EncodingDetector::m_ConvStr
wxString m_ConvStr
Definition:
encodingdetector.h:51
filemanager.h
Generated by
1.8.13