diff options
author | lloyd <[email protected]> | 2006-07-01 23:28:34 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-07-01 23:28:34 +0000 |
commit | 4a85275067375f0f08f2d281512f6d7174c6ca0e (patch) | |
tree | 1f3f5981d45bf542398dd9c16fa70ce40b7d17b1 | |
parent | 984d1c480e724ffba5a5aa1f09980016bb9b03ca (diff) |
Let modules override the transcoder object (since system libs
like iconv may be useful there...)
-rw-r--r-- | include/modules.h | 2 | ||||
-rw-r--r-- | src/init_def.cpp | 1 | ||||
-rw-r--r-- | src/libstate.cpp | 1 | ||||
-rw-r--r-- | src/modules.cpp | 9 |
4 files changed, 12 insertions, 1 deletions
diff --git a/include/modules.h b/include/modules.h index 81de52faf..d2d83985c 100644 --- a/include/modules.h +++ b/include/modules.h @@ -19,6 +19,7 @@ class Modules public: virtual class Mutex_Factory* mutex_factory() const = 0; virtual class Timer* timer() const = 0; + virtual class Charset_Transcoder* transcoder() const = 0; virtual std::string default_allocator() const = 0; @@ -37,6 +38,7 @@ class Builtin_Modules : public Modules public: class Mutex_Factory* mutex_factory() const; class Timer* timer() const; + class Charset_Transcoder* transcoder() const; std::string default_allocator() const; diff --git a/src/init_def.cpp b/src/init_def.cpp index 2edd43b97..efb23d439 100644 --- a/src/init_def.cpp +++ b/src/init_def.cpp @@ -55,7 +55,6 @@ void initialize(const std::string& arg_string) global_config().load_inifile(args.config_file()); global_state().load(modules); - global_state().set_transcoder(new Default_Charset_Transcoder); global_state().set_prng(new ANSI_X931_RNG); const u32bit min_entropy = diff --git a/src/libstate.cpp b/src/libstate.cpp index dd81342bc..d59d87be7 100644 --- a/src/libstate.cpp +++ b/src/libstate.cpp @@ -300,6 +300,7 @@ Config& Library_State::config() const void Library_State::load(Modules& modules) { set_timer(modules.timer()); + set_transcoder(modules.transcoder()); std::vector<Allocator*> allocators = modules.allocators(); diff --git a/src/modules.cpp b/src/modules.cpp index 92a5c8e75..48b043afe 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -5,6 +5,7 @@ #include <botan/modules.h> #include <botan/defalloc.h> +#include <botan/def_char.h> #include <botan/eng_def.h> #include <botan/es_file.h> @@ -204,4 +205,12 @@ std::vector<Engine*> Builtin_Modules::engines() const return engines; } +/************************************************* +* Find the best transcoder option * +*************************************************/ +Charset_Transcoder* Builtin_Modules::transcoder() const + { + return new Default_Charset_Transcoder; + } + } |