StarEncoding.hxx Source File documentation

StarEncoding.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2
3/* libstaroffice
4* Version: MPL 2.0 / LGPLv2+
5*
6* The contents of this file are subject to the Mozilla Public License Version
7* 2.0 (the "License"); you may not use this file except in compliance with
8* the License or as specified alternatively below. You may obtain a copy of
9* the License at http://www.mozilla.org/MPL/
10*
11* Software distributed under the License is distributed on an "AS IS" basis,
12* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13* for the specific language governing rights and limitations under the
14* License.
15*
16* Major Contributor(s):
17* Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18* Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20* Copyright (C) 2006, 2007 Andrew Ziem
21* Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22*
23*
24* All Rights Reserved.
25*
26* For minor contributions see the git repository.
27*
28* Alternatively, the contents of this file may be used under the terms of
29* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30* in which case the provisions of the LGPLv2+ are applicable
31* instead of those above.
32*/
33
34/*
35 * StarEncoding to read/parse some basic encoding in StarOffice documents
36 *
37 */
38#ifndef STAR_ENCODING
39# define STAR_ENCODING
40
41#include <vector>
42
43#include "libstaroffice_internal.hxx"
44
50 class StarEncoding
51{
52public:
54 enum Encoding {
55 E_DONTKNOW=0,E_MS_1252,E_APPLE_ROMAN,E_IBM_437,E_IBM_850,E_IBM_860,E_IBM_861,E_IBM_863,
56 E_IBM_865,/*SYSTEM=9,*/E_SYMBOL=10,E_ASCII_US,E_ISO_8859_1,E_ISO_8859_2,E_ISO_8859_3,E_ISO_8859_4,
57 E_ISO_8859_5,E_ISO_8859_6,E_ISO_8859_7,E_ISO_8859_8,E_ISO_8859_9,E_ISO_8859_14,E_ISO_8859_15,E_IBM_737,
58 E_IBM_775,E_IBM_852,E_IBM_855,E_IBM_857,E_IBM_862,E_IBM_864,E_IBM_866,E_IBM_869,
59 E_MS_874,E_MS_1250,E_MS_1251,E_MS_1253,E_MS_1254,E_MS_1255,E_MS_1256,E_MS_1257,
60 // 40
61 E_MS_1258,/*E_APPLE_ARABIC,*/E_APPLE_CENTEURO=42,E_APPLE_CROATIAN,E_APPLE_CYRILLIC,/*E_APPLE_DEVANAGARI,E_APPLE_FARSI,*/E_APPLE_GREEK=47,
62 /*E_APPLE_GUJARATI,E_APPLE_GURMUKHI,E_APPLE_HEBREW,*/E_APPLE_ICELAND=51,E_APPLE_ROMANIAN,/*E_APPLE_THAI,*/E_APPLE_TURKISH=54,E_APPLE_UKRAINIAN,
63 E_APPLE_CHINSIMP,E_APPLE_CHINTRAD,E_APPLE_JAPANESE,E_APPLE_KOREAN,E_MS_932,E_MS_936,E_MS_949,E_MS_950,
64 E_SHIFT_JIS,E_GB_2312,E_GBT_12345,E_GBK,E_BIG5,E_EUC_JP,E_EUC_CN,/*E_EUC_TW,*/
65 /*E_ISO_2022_JP,E_ISO_2022_CN,*/E_KOI8_R=74,E_UTF7,E_UTF8,E_ISO_8859_10,E_ISO_8859_13,E_EUC_KR,
66 // 80
67 /*E_ISO_2022_KR,*/E_JIS_X_0201=81,E_JIS_X_0208,E_JIS_X_0212,E_MS_1361,/*E_GB_18030,*/E_BIG5_HKSCS=86,E_TIS_620,
68 E_KOI8_U,E_ISCII_DEVANAGARI,
69
70 // E_USER_START=0x8000,E_USER_END=0xEFFF,
71
72 E_UCS4=0xFFFE,E_UCS2=0xFFFF
73 };
74
76 StarEncoding();
78 virtual ~StarEncoding();
79
81 static Encoding getEncodingForId(int id);
83 static bool convert(std::vector<uint8_t> const &src, Encoding encoding, std::vector<uint32_t> &dest, std::vector<size_t> &srcPositions);
84
85protected:
91 static bool read(std::vector<uint8_t> const &src, size_t &pos, Encoding encoding, std::vector<uint32_t> &dest);
92};
93#endif
94// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
StarEncoding::Encoding
Encoding
the different encoding
Definition StarEncoding.hxx:54
StarEncoding::E_IBM_855
@ E_IBM_855
Definition StarEncoding.hxx:58
StarEncoding::E_APPLE_ROMANIAN
@ E_APPLE_ROMANIAN
Definition StarEncoding.hxx:62
StarEncoding::E_GB_2312
@ E_GB_2312
Definition StarEncoding.hxx:64
StarEncoding::E_APPLE_ICELAND
@ E_APPLE_ICELAND
Definition StarEncoding.hxx:62
StarEncoding::E_ISO_8859_5
@ E_ISO_8859_5
Definition StarEncoding.hxx:57
StarEncoding::E_GBK
@ E_GBK
Definition StarEncoding.hxx:64
StarEncoding::E_DONTKNOW
@ E_DONTKNOW
Definition StarEncoding.hxx:55
StarEncoding::E_ISO_8859_8
@ E_ISO_8859_8
Definition StarEncoding.hxx:57
StarEncoding::E_MS_936
@ E_MS_936
Definition StarEncoding.hxx:63
StarEncoding::E_MS_1253
@ E_MS_1253
Definition StarEncoding.hxx:59
StarEncoding::E_SHIFT_JIS
@ E_SHIFT_JIS
Definition StarEncoding.hxx:64
StarEncoding::E_UTF8
@ E_UTF8
Definition StarEncoding.hxx:65
StarEncoding::E_ISO_8859_13
@ E_ISO_8859_13
Definition StarEncoding.hxx:65
StarEncoding::E_TIS_620
@ E_TIS_620
Definition StarEncoding.hxx:67
StarEncoding::E_APPLE_ROMAN
@ E_APPLE_ROMAN
Definition StarEncoding.hxx:55
StarEncoding::E_EUC_CN
@ E_EUC_CN
Definition StarEncoding.hxx:64
StarEncoding::E_APPLE_TURKISH
@ E_APPLE_TURKISH
Definition StarEncoding.hxx:62
StarEncoding::E_MS_1258
@ E_MS_1258
Definition StarEncoding.hxx:61
StarEncoding::E_ISCII_DEVANAGARI
@ E_ISCII_DEVANAGARI
Definition StarEncoding.hxx:68
StarEncoding::E_APPLE_KOREAN
@ E_APPLE_KOREAN
Definition StarEncoding.hxx:63
StarEncoding::E_MS_1255
@ E_MS_1255
Definition StarEncoding.hxx:59
StarEncoding::E_ISO_8859_4
@ E_ISO_8859_4
Definition StarEncoding.hxx:56
StarEncoding::E_JIS_X_0201
@ E_JIS_X_0201
Definition StarEncoding.hxx:67
StarEncoding::E_ISO_8859_9
@ E_ISO_8859_9
Definition StarEncoding.hxx:57
StarEncoding::E_APPLE_JAPANESE
@ E_APPLE_JAPANESE
Definition StarEncoding.hxx:63
StarEncoding::E_MS_1257
@ E_MS_1257
Definition StarEncoding.hxx:59
StarEncoding::E_APPLE_UKRAINIAN
@ E_APPLE_UKRAINIAN
Definition StarEncoding.hxx:62
StarEncoding::E_IBM_864
@ E_IBM_864
Definition StarEncoding.hxx:58
StarEncoding::E_MS_949
@ E_MS_949
Definition StarEncoding.hxx:63
StarEncoding::E_ISO_8859_6
@ E_ISO_8859_6
Definition StarEncoding.hxx:57
StarEncoding::E_APPLE_CROATIAN
@ E_APPLE_CROATIAN
Definition StarEncoding.hxx:61
StarEncoding::E_JIS_X_0208
@ E_JIS_X_0208
Definition StarEncoding.hxx:67
StarEncoding::E_BIG5
@ E_BIG5
Definition StarEncoding.hxx:64
StarEncoding::E_IBM_737
@ E_IBM_737
Definition StarEncoding.hxx:57
StarEncoding::E_KOI8_U
@ E_KOI8_U
Definition StarEncoding.hxx:68
StarEncoding::E_UCS4
@ E_UCS4
Definition StarEncoding.hxx:72
StarEncoding::E_UTF7
@ E_UTF7
Definition StarEncoding.hxx:65
StarEncoding::E_IBM_850
@ E_IBM_850
Definition StarEncoding.hxx:55
StarEncoding::E_IBM_775
@ E_IBM_775
Definition StarEncoding.hxx:58
StarEncoding::E_IBM_861
@ E_IBM_861
Definition StarEncoding.hxx:55
StarEncoding::E_IBM_866
@ E_IBM_866
Definition StarEncoding.hxx:58
StarEncoding::E_MS_1361
@ E_MS_1361
Definition StarEncoding.hxx:67
StarEncoding::E_IBM_862
@ E_IBM_862
Definition StarEncoding.hxx:58
StarEncoding::E_ISO_8859_7
@ E_ISO_8859_7
Definition StarEncoding.hxx:57
StarEncoding::E_APPLE_CENTEURO
@ E_APPLE_CENTEURO
Definition StarEncoding.hxx:61
StarEncoding::E_IBM_860
@ E_IBM_860
Definition StarEncoding.hxx:55
StarEncoding::E_APPLE_CHINTRAD
@ E_APPLE_CHINTRAD
Definition StarEncoding.hxx:63
StarEncoding::E_MS_874
@ E_MS_874
Definition StarEncoding.hxx:59
StarEncoding::E_ISO_8859_1
@ E_ISO_8859_1
Definition StarEncoding.hxx:56
StarEncoding::E_IBM_865
@ E_IBM_865
Definition StarEncoding.hxx:56
StarEncoding::E_IBM_863
@ E_IBM_863
Definition StarEncoding.hxx:55
StarEncoding::E_EUC_JP
@ E_EUC_JP
Definition StarEncoding.hxx:64
StarEncoding::E_JIS_X_0212
@ E_JIS_X_0212
Definition StarEncoding.hxx:67
StarEncoding::E_IBM_437
@ E_IBM_437
Definition StarEncoding.hxx:55
StarEncoding::E_MS_1254
@ E_MS_1254
Definition StarEncoding.hxx:59
StarEncoding::E_MS_1250
@ E_MS_1250
Definition StarEncoding.hxx:59
StarEncoding::E_IBM_857
@ E_IBM_857
Definition StarEncoding.hxx:58
StarEncoding::E_ISO_8859_15
@ E_ISO_8859_15
Definition StarEncoding.hxx:57
StarEncoding::E_IBM_869
@ E_IBM_869
Definition StarEncoding.hxx:58
StarEncoding::E_KOI8_R
@ E_KOI8_R
Definition StarEncoding.hxx:65
StarEncoding::E_MS_950
@ E_MS_950
Definition StarEncoding.hxx:63
StarEncoding::E_ISO_8859_10
@ E_ISO_8859_10
Definition StarEncoding.hxx:65
StarEncoding::E_EUC_KR
@ E_EUC_KR
Definition StarEncoding.hxx:65
StarEncoding::E_APPLE_GREEK
@ E_APPLE_GREEK
Definition StarEncoding.hxx:61
StarEncoding::E_MS_1252
@ E_MS_1252
Definition StarEncoding.hxx:55
StarEncoding::E_BIG5_HKSCS
@ E_BIG5_HKSCS
Definition StarEncoding.hxx:67
StarEncoding::E_GBT_12345
@ E_GBT_12345
Definition StarEncoding.hxx:64
StarEncoding::E_ISO_8859_2
@ E_ISO_8859_2
Definition StarEncoding.hxx:56
StarEncoding::E_MS_1256
@ E_MS_1256
Definition StarEncoding.hxx:59
StarEncoding::E_ASCII_US
@ E_ASCII_US
Definition StarEncoding.hxx:56
StarEncoding::E_ISO_8859_3
@ E_ISO_8859_3
Definition StarEncoding.hxx:56
StarEncoding::E_SYMBOL
@ E_SYMBOL
Definition StarEncoding.hxx:56
StarEncoding::E_MS_1251
@ E_MS_1251
Definition StarEncoding.hxx:59
StarEncoding::E_MS_932
@ E_MS_932
Definition StarEncoding.hxx:63
StarEncoding::E_APPLE_CYRILLIC
@ E_APPLE_CYRILLIC
Definition StarEncoding.hxx:61
StarEncoding::E_APPLE_CHINSIMP
@ E_APPLE_CHINSIMP
Definition StarEncoding.hxx:63
StarEncoding::E_UCS2
@ E_UCS2
Definition StarEncoding.hxx:72
StarEncoding::E_IBM_852
@ E_IBM_852
Definition StarEncoding.hxx:58
StarEncoding::E_ISO_8859_14
@ E_ISO_8859_14
Definition StarEncoding.hxx:57
StarEncoding::getEncodingForId
static Encoding getEncodingForId(int id)
return an encoding corresponding to an id
Definition StarEncoding.cxx:73
StarEncoding::convert
static bool convert(std::vector< uint8_t > const &src, Encoding encoding, std::vector< uint32_t > &dest, std::vector< size_t > &srcPositions)
try to convert a list of character and transforms it a unicode's list
Definition StarEncoding.cxx:61
StarEncoding::~StarEncoding
virtual ~StarEncoding()
destructor
Definition StarEncoding.cxx:57
StarEncoding::read
static bool read(std::vector< uint8_t > const &src, size_t &pos, Encoding encoding, std::vector< uint32_t > &dest)
try to read a character and add it to string
Definition StarEncoding.cxx:173
StarEncoding::StarEncoding
StarEncoding()
constructor
Definition StarEncoding.cxx:53
libstaroffice_internal.hxx