Browse Source

Made it easier to access shared pointer to translations.

stable
Maximilian Stiefel 7 years ago
parent
commit
78d4508181
  1. 1
      compile_and_install_ubuntu.sh
  2. 8
      dict/dict_imp.cc
  3. 7
      dict/dict_int.h

1
compile_and_install_ubuntu.sh

@ -9,3 +9,4 @@ if [ ! -f "$INST_FILE" ]
then
$INST_CMD
fi
rm dictcc

8
dict/dict_imp.cc

@ -85,7 +85,7 @@ namespace dictcc
return d_translations;
}
void dict::reset_search(void)
search_ptr_t dict::reset_search(void)
{
// Initialize the word lists so they are not empty.
str_list_t l0(1, ""), l1(1, "");
@ -97,6 +97,12 @@ namespace dictcc
// Apparently, the pointer has not been initialized yet.
d_translations = std::make_shared<search_t>(pair);
}
return d_translations;
}
search_ptr_t dict::get_translations(void)
{
return d_translations;
}
std::string dict::langs2str(const lang_t& lt)

7
dict/dict_int.h

@ -58,12 +58,15 @@ namespace dictcc
virtual ~dict(){}
public:
/*! \brief Perform a search and create a smart pointer object.
/*! \brief Perform a search and return results.
*/
search_ptr_t search(std::string word);
/*! \brief Make sure there are two empty word lists.
*/
void reset_search(void);
search_ptr_t reset_search(void);
/*! Simply returns a pointer to the translations, no matter if the smart pointer actually holds any data.
*/
search_ptr_t get_translations(void);
static std::string langs2str(const lang_t& lt);
static lang_t str2langs(const std::string& str);
/*! \brief Help function: Get the size of a string in chars containing multibyte characters e.g. ü.

Loading…
Cancel
Save