1 /** 2 * Yudit Unicode Editor Source File 3 * 4 * GNU Copyright (C) 1997-2006 Gaspar Sinai <gaspar@yudit.org> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License, version 2, 8 * dated June 1991. See file COPYYING for details. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 */ 19 20 #ifndef SEncoder_h 21 #define SEncoder_h 22 23 #include "stoolkit/STypes.h" 24 #include "stoolkit/SString.h" 25 #include "stoolkit/SStringVector.h" 26 27 28 class SEncoder : SObject 29 { 30 public: 31 SEncoder (void); 32 SEncoder (const SString& name); 33 SEncoder (const SEncoder& c); 34 SEncoder& operator = (const SEncoder& c); 35 virtual ~SEncoder (); 36 37 const SString& encode (const SV_UCS4& input); 38 const SV_UCS4& decode (const SString& input, bool more=true); 39 unsigned int getDecoderMap (SStringVector* key, SStringVector* value, 40 unsigned int size); 41 42 /* These methods guess the line delimiters for the input */ 43 const SStringVector& delimiters (); 44 const SString& getName() const; 45 46 virtual SObject* clone() const; 47 bool isOK() const; 48 void clear(); 49 static const SStringVector& builtin(); 50 static SStringVector external(); 51 52 /* return the string that still waits for match */ 53 SString preEditBuffer() const; /* for non-clustering it is remainder */ 54 SV_UCS4 postEditBuffer () const; /* for clustering */ 55 56 protected: 57 bool ok; 58 void load (); 59 SString name; 60 SString buffer; 61 SStringVector delim; 62 SV_UCS4 retUCS4; 63 SV_UCS4 remaining; 64 void* delegate; 65 }; 66 67 #endif /* SEncoder_h */ 68