当前位置: 首页>>代码示例>>C++>>正文


C++ UNICHARSET::get_isupper方法代码示例

本文整理汇总了C++中UNICHARSET::get_isupper方法的典型用法代码示例。如果您正苦于以下问题:C++ UNICHARSET::get_isupper方法的具体用法?C++ UNICHARSET::get_isupper怎么用?C++ UNICHARSET::get_isupper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UNICHARSET的用法示例。


在下文中一共展示了UNICHARSET::get_isupper方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: IsCaseInvariant

    bool CubeUtils::IsCaseInvariant(const char_32 *str32, CharSet *char_set) {
        bool all_one_case = true;
        bool capitalized;
        bool prev_upper;
        bool prev_lower;
        bool first_upper;
        bool first_lower;
        bool cur_upper;
        bool cur_lower;

        string str8;
        if (!char_set) {
            // If cube char_set is missing, use C-locale-dependent functions
            // on UTF8 characters to determine case properties.
            first_upper = isupper(str32[0]);
            first_lower = islower(str32[0]);
            if (first_upper)
                capitalized = true;
            prev_upper = first_upper;
            prev_lower = islower(str32[0]);
            for (int c = 1; str32[c] != 0; ++c) {
                cur_upper = isupper(str32[c]);
                cur_lower = islower(str32[c]);
                if ((prev_upper && cur_lower) || (prev_lower && cur_upper))
                    all_one_case = false;
                if (cur_upper)
                    capitalized = false;
                prev_upper = cur_upper;
                prev_lower = cur_lower;
            }
        } else {
            UNICHARSET *unicharset = char_set->InternalUnicharset();
            // Use UNICHARSET functions to determine case properties
            first_upper = unicharset->get_isupper(char_set->ClassID(str32[0]));
            first_lower = unicharset->get_islower(char_set->ClassID(str32[0]));
            if (first_upper)
                capitalized = true;
            prev_upper = first_upper;
            prev_lower = unicharset->get_islower(char_set->ClassID(str32[0]));

            for (int c = 1; c < StrLen(str32); ++c) {
                cur_upper = unicharset->get_isupper(char_set->ClassID(str32[c]));
                cur_lower = unicharset->get_islower(char_set->ClassID(str32[c]));
                if ((prev_upper && cur_lower) || (prev_lower && cur_upper))
                    all_one_case = false;
                if (cur_upper)
                    capitalized = false;
                prev_upper = cur_upper;
                prev_lower = cur_lower;
            }
        }
        return all_one_case || capitalized;
    }
开发者ID:mehulsbhatt,项目名称:MyOCRTEST,代码行数:53,代码来源:cube_utils.cpp

示例2: StrLen

 char_32 *CubeUtils::ToLower(const char_32 *str32, CharSet *char_set) {
     if (!char_set) {
         return NULL;
     }
     UNICHARSET *unicharset = char_set->InternalUnicharset();
     int len = StrLen(str32);
     char_32 *lower = new char_32[len + 1];
     if (!lower)
         return NULL;
     for (int i = 0; i < len; ++i) {
         char_32 ch = str32[i];
         if (ch == INVALID_UNICHAR_ID) {
             delete[] lower;
             return NULL;
         }
         // convert upper-case characters to lower-case
         if (unicharset->get_isupper(char_set->ClassID(ch))) {
             UNICHAR_ID uid_lower = unicharset->get_other_case(char_set->ClassID(ch));
             const char_32 *str32_lower = char_set->ClassString(uid_lower);
             // expect lower-case version of character to be a single character
             if (!str32_lower || StrLen(str32_lower) != 1) {
                 delete[] lower;
                 return NULL;
             }
             lower[i] = str32_lower[0];
         } else {
             lower[i] = ch;
         }
     }
     lower[len] = 0;
     return lower;
 }
开发者ID:mehulsbhatt,项目名称:MyOCRTEST,代码行数:32,代码来源:cube_utils.cpp

示例3: case_ok

int Dict::case_ok(const WERD_CHOICE &word, const UNICHARSET &unicharset) {
  int state = 0;
  int x;
  for (x = 0; x < word.length(); ++x) {
    UNICHAR_ID ch_id = word.unichar_id(x);
    if (unicharset.get_isupper(ch_id))
      state = case_state_table[state][1];
    else if (unicharset.get_islower(ch_id))
      state = case_state_table[state][2];
    else if (unicharset.get_isdigit(ch_id))
      state = case_state_table[state][3];
    else
      state = case_state_table[state][0];
    if (state == -1) return false;
  }
  return state != 5; // single lower is bad
}
开发者ID:0ximDigital,项目名称:appsScanner,代码行数:17,代码来源:context.cpp

示例4: non_O_upper

BOOL8 Tesseract::non_O_upper(const UNICHARSET& ch_set, UNICHAR_ID unichar_id) {
  return ch_set.get_isupper(unichar_id) && !ch_set.eq(unichar_id, "O");
}
开发者ID:xmarston,项目名称:BillRecognizer,代码行数:3,代码来源:reject.cpp


注:本文中的UNICHARSET::get_isupper方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。