File: SEncoder.h

package info (click to toggle)
yudit 2.5.4-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 8,528 kB
  • ctags: 8,403
  • sloc: cpp: 59,394; ansic: 2,585; perl: 2,398; makefile: 864; sh: 321
file content (69 lines) | stat: -rw-r--r-- 2,120 bytes parent folder | download
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
/** 
 *  Yudit Unicode Editor Source File
 *
 *  GNU Copyright (C) 2002  Gaspar Sinai <gsinai@yudit.org>  
 *  GNU Copyright (C) 2001  Gaspar Sinai <gsinai@yudit.org>  
 *  GNU Copyright (C) 2000  Gaspar Sinai <gsinai@yudit.org>  
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License, version 2,
 *  dated June 1991. See file COPYYING for details.
 *
 *  This program 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 General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
#ifndef SEncoder_h
#define SEncoder_h

#include "stoolkit/STypes.h"
#include "stoolkit/SString.h"
#include "stoolkit/SStringVector.h"


class SEncoder : SObject 
{
public:
  SEncoder (void);
  SEncoder (const SString& name);
  SEncoder (const SEncoder& c);
  SEncoder& operator = (const SEncoder& c);
  virtual ~SEncoder ();

  const SString& encode (const SV_UCS4& input);
  const SV_UCS4& decode (const SString& input, bool more=true);
  unsigned int getDecoderMap (SStringVector* key, SStringVector* value,
        unsigned int size);

  /* These methods guess the line delimiters for the input */
  const SStringVector& delimiters ();
  const SString& getName() const;

  virtual SObject* clone() const;
  bool isOK() const;
  void      clear();
  static const SStringVector& builtin();
  static SStringVector external();

  /* return the string that still waits for match */
  SString preEditBuffer() const; /* for non-clustering it is remainder */
  SV_UCS4 postEditBuffer () const; /* for clustering */
  
protected:
  bool      ok;
  void      load ();
  SString   name;
  SString       buffer;
  SStringVector   delim;
  SV_UCS4       retUCS4;
  SV_UCS4       remaining;
  void*         delegate;
};

#endif /* SEncoder_h */