File: FXTextCodec.h

package info (click to toggle)
gogglesmm 1.2.5-6
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 16,812 kB
  • sloc: cpp: 231,960; ansic: 893; xml: 222; makefile: 33
file content (125 lines) | stat: -rw-r--r-- 4,803 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/********************************************************************************
*                                                                               *
*                   U n i c o d e   T e x t   C o d e c                         *
*                                                                               *
*********************************************************************************
* Copyright (C) 2002,2022 by L.Johnson & J.van der Zijp.  All Rights Reserved.  *
*********************************************************************************
* This library is free software; you can redistribute it and/or modify          *
* it under the terms of the GNU Lesser General Public License as published by   *
* the Free Software Foundation; either version 3 of the License, or             *
* (at your option) any later version.                                           *
*                                                                               *
* This library is distributed in the hope that it will be useful,               *
* but WITHOUT ANY WARRANTY; without even the implied warranty of                *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 *
* GNU Lesser General Public License for more details.                           *
*                                                                               *
* You should have received a copy of the GNU Lesser General Public License      *
* along with this program.  If not, see <http://www.gnu.org/licenses/>          *
********************************************************************************/
#ifndef FXTEXTCODEC_H
#define FXTEXTCODEC_H

#ifndef FXOBJECT_H
#include "FXObject.h"
#endif

namespace FX {


/**
 * Abstract base class for a stateless coder/decoder.
 */
class FXAPI FXTextCodec : public FXObject {
  FXDECLARE_ABSTRACT(FXTextCodec)
public:

  /// Construct text codec
  FXTextCodec(){}

  /// Count utf8 bytes needed to convert multi-byte characters from src
  virtual FXint mb2utflen(const FXchar* src,FXint nsrc) const;

  /// Count utf8 bytes needed to convert multi-byte characters from src
  FXint mb2utflen(const FXString& src) const;

  /// Convert multi-byte characters from src to utf8 characters at dst
  virtual FXint mb2utf(FXchar* dst,FXint ndst,const FXchar* src,FXint nsrc) const;

  /// Convert multi-byte characters from src to utf8 characters at dst
  FXint mb2utf(FXchar* dst,FXint ndst,const FXchar* src) const;

  /// Convert multi-byte characters from src to utf8 characters at dst
  FXint mb2utf(FXchar* dst,FXint ndst,const FXString& src) const;

  /// Convert multi-byte characters from src to utf8 string
  FXString mb2utf(const FXchar* src,FXint nsrc) const;

  /// Convert multi-byte characters from src to utf8 string
  FXString mb2utf(const FXchar* src) const;

  /// Convert multi-byte string to utf8 string
  FXString mb2utf(const FXString& src) const;

  /// Convert multi-byte characters from src to single wide character
  virtual FXint mb2wc(FXwchar& wc,const FXchar* src,FXint nsrc) const;



  /// Count multi-byte characters characters needed to convert utf8 from src
  virtual FXint utf2mblen(const FXchar* src,FXint nsrc) const;

  /// Count multi-byte characters characters needed to convert utf8 from src
  virtual FXint utf2mblen(const FXString& src) const;

  /// Convert utf8 characters at src to multi-byte characters at dst
  virtual FXint utf2mb(FXchar* dst,FXint ndst,const FXchar* src,FXint nsrc) const;

  /// Convert utf8 characters at src to multi-byte characters at dst
  FXint utf2mb(FXchar* dst,FXint ndst,const FXchar* src) const;

  /// Convert utf8 characters at src to multi-byte characters at dst
  FXint utf2mb(FXchar* dst,FXint ndst,const FXString& src) const;

  /// Convert utf8 characters at src to multi-byte string
  FXString utf2mb(const FXchar* src,FXint nsrc) const;

  /// Convert utf8 characters at src to multi-byte string
  FXString utf2mb(const FXchar* src) const;

  /// Convert utf8 string to multi-byte string
  FXString utf2mb(const FXString& src) const;

  /// Convert single wide character to multi-byte characters at dst
  virtual FXint wc2mb(FXchar* dst,FXint ndst,FXwchar wc) const;


  /**
  * Return the Management Information Base (MIBenum) for the character set.
  */
  virtual FXint mibEnum() const = 0;

  /**
  * Return name of the codec.
  */
  virtual const FXchar* name() const = 0;

  /**
  * Return the IANA mime name for this codec; this is used for example
  * as "text/utf-8" in drag and drop protocols.
  */
  virtual const FXchar* mimeName() const = 0;

  /**
  * Return NULL-terminated list of aliases for this codec.
  */
  virtual const FXchar* const* aliases() const = 0;

  /// Destruct codec
  virtual ~FXTextCodec(){}
  };

}

#endif