From 4bbacf4aae4b8b98d02ea887593492c1b9dacdc7 Mon Sep 17 00:00:00 2001 From: lloyd Date: Tue, 13 Jun 2006 01:35:53 +0000 Subject: Add some initial support for centralized/user-pluggable character set conversions, to replace the current hardcoded stuff. --- include/charset.h | 13 +++++++++++++ include/enums.h | 2 ++ include/libstate.h | 5 +++++ 3 files changed, 20 insertions(+) (limited to 'include') diff --git a/include/charset.h b/include/charset.h index f2fb33e76..a79530f05 100644 --- a/include/charset.h +++ b/include/charset.h @@ -7,10 +7,23 @@ #define BOTAN_CHARSET_H__ #include +#include #include namespace Botan { +/************************************************* +* Character Set Transcoder Object * +*************************************************/ +class Charset_Transcoder + { + public: + virtual std::string transcode(const std::string&, + Character_Set, Character_Set) const = 0; + + virtual ~Charset_Transcoder() {} + }; + /************************************************* * Character Set Handling * *************************************************/ diff --git a/include/enums.h b/include/enums.h index 0d3841d68..c03f71004 100644 --- a/include/enums.h +++ b/include/enums.h @@ -92,6 +92,8 @@ enum Cipher_Dir { ENCRYPTION, DECRYPTION }; enum Signature_Format { IEEE_1363, DER_SEQUENCE }; +enum Character_Set { LOCAL_CHARSET, UTF8_CHARSET, LATIN1_CHARSET }; + } #endif diff --git a/include/libstate.h b/include/libstate.h index 340644502..ccc09c224 100644 --- a/include/libstate.h +++ b/include/libstate.h @@ -51,6 +51,10 @@ class Library_State class Mutex* get_mutex(); + void set_transcoder(class Charset_Transcoder*); + std::string transcode(const std::string, + Character_Set, Character_Set) const; + Library_State(class Mutex_Factory*, class Timer*); ~Library_State(); private: @@ -68,6 +72,7 @@ class Library_State std::map alloc_factory; mutable Allocator* cached_default_allocator; + class Charset_Transcoder* transcoder; RandomNumberGenerator* rng; std::vector entropy_sources; std::vector engines; -- cgit v1.2.3