summaryrefslogtreecommitdiff
path: root/libs/hunspell/src/csutil.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hunspell/src/csutil.hxx')
-rw-r--r--libs/hunspell/src/csutil.hxx24
1 files changed, 10 insertions, 14 deletions
diff --git a/libs/hunspell/src/csutil.hxx b/libs/hunspell/src/csutil.hxx
index c6f03d8f76..808087d1f1 100644
--- a/libs/hunspell/src/csutil.hxx
+++ b/libs/hunspell/src/csutil.hxx
@@ -78,7 +78,9 @@
#include <fstream>
#include <string>
#include <vector>
-#include <string.h>
+#include <cassert>
+#include <cstring>
+#include <algorithm>
#include "w_char.hxx"
#include "htypes.hxx"
@@ -135,14 +137,12 @@ LIBHUNSPELL_DLL_EXPORTED std::string& u16_u8(std::string& dest,
// convert UTF-8 characters to UTF-16
LIBHUNSPELL_DLL_EXPORTED int u8_u16(std::vector<w_char>& dest,
- const std::string& src);
+ const std::string& src,
+ bool only_convert_first_letter = false);
// remove end of line char(s)
LIBHUNSPELL_DLL_EXPORTED void mychomp(std::string& s);
-// duplicate string
-LIBHUNSPELL_DLL_EXPORTED char* mystrdup(const char* s);
-
// parse into tokens with char delimiter
LIBHUNSPELL_DLL_EXPORTED std::string::const_iterator mystrsep(const std::string &str,
std::string::const_iterator& start);
@@ -181,8 +181,6 @@ struct cs_info {
unsigned char cupper;
};
-LIBHUNSPELL_DLL_EXPORTED void initialize_utf_tbl();
-LIBHUNSPELL_DLL_EXPORTED void free_utf_tbl();
LIBHUNSPELL_DLL_EXPORTED unsigned short unicodetoupper(unsigned short c,
int langnum);
LIBHUNSPELL_DLL_EXPORTED w_char upper_utf(w_char u, int langnum);
@@ -276,10 +274,8 @@ LIBHUNSPELL_DLL_EXPORTED char* get_stored_pointer(const char* s);
// "likely false", if ignored_chars characters are not ASCII)
inline bool has_no_ignored_chars(const std::string& word,
const std::string& ignored_chars) {
- for (std::string::const_iterator it = ignored_chars.begin(), end = ignored_chars.end(); it != end; ++it)
- if (word.find(*it) != std::string::npos)
- return false;
- return true;
+ return std::all_of(ignored_chars.begin(), ignored_chars.end(),
+ [&word](char ic) { return word.find(ic) == std::string::npos; });
}
// hash entry macros
@@ -319,9 +315,9 @@ inline const char* HENTRY_DATA2(
return ret;
}
-inline char* HENTRY_FIND(struct hentry* h,
- const char* p) {
- return (HENTRY_DATA(h) ? strstr(HENTRY_DATA(h), p) : NULL);
+inline char* HENTRY_FIND(struct hentry* h, const char* p) {
+ char* data = HENTRY_DATA(h);
+ return data ? strstr(data, p) : NULL;
}
#endif