diff options
author | Peng Wu <alexepico@gmail.com> | 2012-10-18 13:27:18 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2012-10-18 13:28:14 +0800 |
commit | 6f20354f6fe1772d150144c108760ba57e983ea4 (patch) | |
tree | 2c61463bcf455fb000fd9607dbf15a9562be62fc /src | |
parent | 1f46032ac851f086a5e31f4f5b11ccf896844a74 (diff) | |
download | libpinyin-6f20354f6fe1772d150144c108760ba57e983ea4.tar.gz libpinyin-6f20354f6fe1772d150144c108760ba57e983ea4.tar.xz libpinyin-6f20354f6fe1772d150144c108760ba57e983ea4.zip |
update tag utility
Diffstat (limited to 'src')
-rw-r--r-- | src/storage/tag_utility.cpp | 13 | ||||
-rw-r--r-- | src/storage/tag_utility.h | 17 |
2 files changed, 28 insertions, 2 deletions
diff --git a/src/storage/tag_utility.cpp b/src/storage/tag_utility.cpp index 5115f7d..2701934 100644 --- a/src/storage/tag_utility.cpp +++ b/src/storage/tag_utility.cpp @@ -400,4 +400,17 @@ char * taglib_token_to_string(FacadePhraseIndex * phrase_index, return phrase; } +bool taglib_validate_token_with_string(FacadePhraseIndex * phrase_index, + phrase_token_t token, + const char * string){ + bool result = false; + + char * str = taglib_token_to_string(phrase_index, token); + result = (0 == strcmp(str, string)); + g_free(str); + + return result; +} + + }; diff --git a/src/storage/tag_utility.h b/src/storage/tag_utility.h index e4e49c3..68e298d 100644 --- a/src/storage/tag_utility.h +++ b/src/storage/tag_utility.h @@ -141,9 +141,22 @@ phrase_token_t taglib_string_to_token(PhraseLargeTable2 * phrase_table, char * taglib_token_to_string(FacadePhraseIndex * phrase_index, phrase_token_t token); -/* Note: the following function is only available when the optional tag exists. - * bool taglib_report_status(int line_type); +/** + * taglib_validate_token_with_string: + * @phrase_index: the phrase index. + * @token: the phrase token. + * @string: the phrase string. + * @returns: whether the token is validated with the phrase string. + * + * Validate the token with the phrase string. + * */ +bool taglib_validate_token_with_string(FacadePhraseIndex * phrase_index, + phrase_token_t token, + const char * string); + +/* Note: the following function is only available when the optional tag exists. + bool taglib_report_status(int line_type); */ /* Note: taglib_write is omited, as printf is more suitable for this. */ |