diff options
author | Oran Juice <oranjuices@hotmail.com> | 2014-10-02 21:14:29 +0530 |
---|---|---|
committer | Oran Juice <oranjuices@hotmail.com> | 2014-10-02 21:44:26 +0530 |
commit | fa723d8af8f624d5719dcfa5a0cf1fc1b45be01e (patch) | |
tree | 252cefdec6a174727f0190d9b885310d9deb3f8a /src/mnemonics/language_base.h | |
parent | Restructured language sources to be singletons (diff) | |
download | monero-fa723d8af8f624d5719dcfa5a0cf1fc1b45be01e.tar.xz |
Cut short word lists to 1626 words, added attribution to Electrum, some bug fixes
Diffstat (limited to 'src/mnemonics/language_base.h')
-rw-r--r-- | src/mnemonics/language_base.h | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/src/mnemonics/language_base.h b/src/mnemonics/language_base.h index 90ff9c334..b8b6a162f 100644 --- a/src/mnemonics/language_base.h +++ b/src/mnemonics/language_base.h @@ -1,61 +1,61 @@ -#ifndef LANGUAGE_BASE_H -#define LANGUAGE_BASE_H - -#include <vector> -#include <unordered_map> -#include <string> - -namespace Language -{ - const int unique_prefix_length = 4; - class Base - { - protected: - std::vector<std::string> *word_list; - std::unordered_map<std::string, uint32_t> *word_map; - std::unordered_map<std::string, uint32_t> *trimmed_word_map; - std::string language_name; - void populate_maps() - { - int ii; - std::vector<std::string>::iterator it; - for (it = word_list->begin(), ii = 0; it != word_list->end(); it++, ii++) - { - (*word_map)[*it] = ii; - if (it->length() > 4) - { - (*trimmed_word_map)[it->substr(0, 4)] = ii; - } - else - { - (*trimmed_word_map)[*it] = ii; - } - } - } - public: - Base() - { - word_list = new std::vector<std::string>; - word_map = new std::unordered_map<std::string, uint32_t>; - trimmed_word_map = new std::unordered_map<std::string, uint32_t>; - } - const std::vector<std::string>& get_word_list() const - { - return *word_list; - } - const std::unordered_map<std::string, uint32_t>& get_word_map() const - { - return *word_map; - } - const std::unordered_map<std::string, uint32_t>& get_trimmed_word_map() const - { - return *trimmed_word_map; - } - std::string get_language_name() const - { - return language_name; - } - }; -} - -#endif +#ifndef LANGUAGE_BASE_H
+#define LANGUAGE_BASE_H
+
+#include <vector>
+#include <unordered_map>
+#include <string>
+
+namespace Language
+{
+ const int unique_prefix_length = 4;
+ class Base
+ {
+ protected:
+ std::vector<std::string> *word_list;
+ std::unordered_map<std::string, uint32_t> *word_map;
+ std::unordered_map<std::string, uint32_t> *trimmed_word_map;
+ std::string language_name;
+ void populate_maps()
+ {
+ int ii;
+ std::vector<std::string>::iterator it;
+ for (it = word_list->begin(), ii = 0; it != word_list->end(); it++, ii++)
+ {
+ (*word_map)[*it] = ii;
+ if (it->length() > 4)
+ {
+ (*trimmed_word_map)[it->substr(0, 4)] = ii;
+ }
+ else
+ {
+ (*trimmed_word_map)[*it] = ii;
+ }
+ }
+ }
+ public:
+ Base()
+ {
+ word_list = new std::vector<std::string>;
+ word_map = new std::unordered_map<std::string, uint32_t>;
+ trimmed_word_map = new std::unordered_map<std::string, uint32_t>;
+ }
+ const std::vector<std::string>& get_word_list() const
+ {
+ return *word_list;
+ }
+ const std::unordered_map<std::string, uint32_t>& get_word_map() const
+ {
+ return *word_map;
+ }
+ const std::unordered_map<std::string, uint32_t>& get_trimmed_word_map() const
+ {
+ return *trimmed_word_map;
+ }
+ std::string get_language_name() const
+ {
+ return language_name;
+ }
+ };
+}
+
+#endif
|