Commit 1b29d9040e0dbe4e6c27dd96bc0a14d78ea94f70
- Diff rendering mode:
- inline
- side by side
gchardet.cpp
(11 / 0)
|   | |||
| 6 | 6 | #include "gchardet.h" | |
| 7 | 7 | #include "nscore.h" | |
| 8 | 8 | #include "nsUniversalDetector.h" | |
| 9 | #include <string.h> | ||
| 9 | 10 | ||
| 10 | 11 | ||
| 11 | 12 | class CharsetDetector : public nsUniversalDetector | |
| … | … | ||
| 84 | 84 | g_return_if_fail (cd != NULL); | |
| 85 | 85 | CharsetDetector *impl = reinterpret_cast <CharsetDetector*> (cd); | |
| 86 | 86 | impl -> DataEnd (); | |
| 87 | } | ||
| 88 | |||
| 89 | |||
| 90 | gchar* | ||
| 91 | g_chardet_detect (const gchar *string, guint32 lang_filter) | ||
| 92 | { | ||
| 93 | g_return_val_if_fail (string != NULL, NULL); | ||
| 94 | CharsetDetector impl (lang_filter); | ||
| 95 | impl.HandleData (string, strlen (string)); | ||
| 96 | return g_strdup (impl.GetCharset ()); | ||
| 87 | 97 | } |
gchardet.h
(1 / 0)
|   | |||
| 36 | 36 | gboolean g_chardet_found (g_chardet_t* cd); | |
| 37 | 37 | void g_chardet_finish (g_chardet_t* cd); | |
| 38 | 38 | void g_chardet_free (g_chardet_t* cd); | |
| 39 | gchar* g_chardet_detect (const gchar *string, guint32 lang_filter); | ||
| 39 | 40 | ||
| 40 | 41 | G_END_DECLS | |
| 41 | 42 |

