~ubuntu-branches/ubuntu/raring/codeblocks/raring-proposed

« back to all changes in this revision

Viewing changes to src/include/encodingdetector.h

  • Committer: Bazaar Package Importer
  • Author(s): Cosme Domínguez Díaz
  • Date: 2010-08-09 04:38:38 UTC
  • mfrom: (1.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20100809043838-a59ygguym4eg0jgw
Tags: 10.05-0ubuntu1
* New upstream release. Closes (LP: #322350)
 - Switch to dpkg-source 3.0 (quilt) format
 - Remove unneeded README.source
 - Add debian/get-source-orig script that removes all
   Windows prebuilt binaries
* Bump Standards-Version to 3.9.1
 - Stop shipping *.la files
* debian/control
 - Add cdbs package as Build-Depend
 - Add libbz2-dev and zlib1g-dev packages as
   Build-Depends (needed by libhelp_plugin.so)
 - Remove dpatch package of Build-Depends
 - Add codeblocks-contrib-debug package
 - Split architecture-independent files of codeblocks
   package in codeblocks-common package
* debian/rules
 - Switch to CDBS rules system
 - Add parallel build support
 - Add a call to debian/get-source-orig script
 - Use lzma compression (saves 23,5 MB of free space)
* debian/patches
 - Refresh 01_codeblocks_plugin_path
 - Add 02_no_Makefiles_in_debian_dir to remove any link
   in codeblocks build system to deleted Makefiles of debian directory
 - Drop 02_ftbfs_gcc44 and 03_ftbfs_glib221 (merged in upstream)
* debian/watch
 - Update to use the new host (berlios.de)

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
#include "settings.h"
10
10
#include "filemanager.h"
11
11
#include <wx/fontmap.h>
 
12
#include "nsUniversalDetector.h"
12
13
 
13
14
class wxString;
14
15
 
15
16
/** Try to detect the encoding of a file on disk. */
16
 
class DLLIMPORT EncodingDetector
 
17
class DLLIMPORT EncodingDetector :
 
18
            public nsUniversalDetector
17
19
{
18
20
        public:
19
 
                EncodingDetector(const wxString& filename);
20
 
                EncodingDetector(LoaderBase* fileLdr);
21
 
                EncodingDetector(const wxByte* buffer, size_t size);
22
 
                EncodingDetector(const EncodingDetector& rhs);
 
21
                EncodingDetector(const wxString& filename, bool useLog=true);
 
22
                EncodingDetector(LoaderBase* fileLdr, bool useLog=true);
 
23
                EncodingDetector(const wxByte* buffer, size_t size, bool useLog=true);
 
24
                EncodingDetector(const EncodingDetector& rhs, bool useLog=true);
23
25
                ~EncodingDetector();
24
26
 
 
27
        const wxString& DoIt(const char* aBuf, PRUint32 aLen);
25
28
        /** @return True if file was read, false if not. */
26
29
        bool IsOK() const;
27
30
        /** @return True if the file contains a BOM (Byte Order Mark), false if not. */
33
36
                wxString GetWxStr() const;
34
37
        protected:
35
38
        /** @return True if succeeded, false if not (e.g. file didn't exist). */
36
 
                bool DetectEncoding(const wxString& filename, bool ConvertToWxString = true);
37
 
                bool DetectEncoding(const wxByte* buffer, size_t size, bool ConvertToWxString = true);
 
39
        bool DetectEncoding(const wxString& filename, bool ConvertToWxString = true);
 
40
        bool DetectEncoding(const wxByte* buffer, size_t size, bool ConvertToWxString = true);
 
41
        void Report(const char* aCharset);
38
42
 
39
43
        bool m_IsOK;
40
 
                bool m_UseBOM;
41
 
                int m_BOMSizeInBytes;
42
 
                wxFontEncoding m_Encoding;
 
44
        bool m_UseBOM;
 
45
        bool m_UseLog;
 
46
        int m_BOMSizeInBytes;
 
47
        wxFontEncoding m_Encoding;
43
48
        private:
 
49
        wxString mResult;
44
50
        wxString m_ConvStr;
45
51
        bool ConvertToWxStr(const wxByte* buffer, size_t size);
46
 
        inline bool IsUTF8Tail(wxByte b) { return ((b & 0xC0) == 0x80); };
47
 
        bool DetectUTF8(wxByte* byt, size_t size);
48
 
        bool IsTextUTF16BE(wxByte *text, size_t size);
49
 
        bool IsTextUTF16LE(wxByte *text, size_t size);
50
 
        bool DetectUTF16(wxByte* byt, size_t size);
51
 
        bool IsTextUTF32BE(wxByte *text, size_t size);
52
 
        bool IsTextUTF32LE(wxByte *text, size_t size);
53
 
        bool DetectUTF32(wxByte* byt, size_t size);
 
52
//        static inline bool IsUTF8Tail(wxByte b) { return ((b & 0xC0) == 0x80); };
 
53
//        bool DetectUTF8(const wxByte* byt, size_t size);
 
54
        bool IsTextUTF16BE(const wxByte *text, size_t size);
 
55
        bool IsTextUTF16LE(const wxByte *text, size_t size);
 
56
        bool DetectUTF16(const wxByte* byt, size_t size);
 
57
        bool IsTextUTF32BE(const wxByte *text, size_t size);
 
58
        bool IsTextUTF32LE(const wxByte *text, size_t size);
 
59
        bool DetectUTF32(const wxByte* byt, size_t size);
54
60
};
55
61
 
56
62
#endif // ENCODINGDETECTOR_H