• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ ctype类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ctype的典型用法代码示例。如果您正苦于以下问题:C++ ctype类的具体用法?C++ ctype怎么用?C++ ctype使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: _Initialize_get_digit

void  _STLP_CALL
_Initialize_get_digit(wchar_t* digits, wchar_t* xdigits,
                       const ctype<wchar_t>& ct)
{
  ct.widen(narrow_digits + 0,  narrow_digits + 10,  digits);
  ct.widen(narrow_xdigits + 0, narrow_xdigits + 10, xdigits);
}
开发者ID:Jay-Jay-OPL,项目名称:ps2sdk-ports,代码行数:7,代码来源:num_get.cpp


示例2: __convert_float_buffer

wchar_t* _STLP_CALL
__convert_float_buffer(const char* first, const char* last, wchar_t* out,
                       const ctype<wchar_t>& ct, wchar_t dot)
{
  ct.widen(first, last, out);
  replace(out, out + (last - first), ct.widen('.'), dot);
  return out + (last - first);
}
开发者ID:RaymondLiao,项目名称:elektronika,代码行数:8,代码来源:num_put_float.cpp


示例3: __get_monetary_value

bool
__get_monetary_value(_InIt& __first, _InIt __last, _OuIt __out_ite,
                     const ctype<_CharT>& _c_type,
                     _CharT __point, int __frac_digits, _CharT __sep,
                     const string& __grouping, bool &__syntax_ok) {
  if (__first == __last || !_c_type.is(ctype_base::digit, *__first))
    return false;

  char __group_sizes[128];
  char* __group_sizes_end = __grouping.empty()? 0 : __group_sizes;
  char   __current_group_size = 0;

  while (__first != __last) {
    if (_c_type.is(ctype_base::digit, *__first)) {
      ++__current_group_size;
      *__out_ite++ = *__first++;
    }
    else if (__group_sizes_end) {
      if (*__first == __sep) {
        *__group_sizes_end++ = __current_group_size;
        __current_group_size = 0;
        ++__first;
      }
      else break;
    }
    else
      break;
  }

  if (__grouping.empty())
    __syntax_ok = true;
  else {
    if (__group_sizes_end != __group_sizes)
      *__group_sizes_end++ = __current_group_size;
    
    __syntax_ok = __valid_grouping(__group_sizes, __group_sizes_end,
                                   __grouping.data(), __grouping.data()+ __grouping.size());  
    
    if (__first == __last || *__first != __point) {
      for (int __digits = 0; __digits != __frac_digits; ++__digits)
        *__out_ite++ = _CharT('0');
      return true; // OK not to have decimal point
    }
  }

  ++__first;

  int __digits = 0;

  while (__first != __last && _c_type.is(ctype_base::digit, *__first)) {
      *__out_ite++ = *__first++;
     ++__digits;
  }

  __syntax_ok = __syntax_ok && (__digits == __frac_digits);

  return true;
}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:58,代码来源:_monetary.c


示例4: __convert_float_buffer

void _STLP_CALL
__convert_float_buffer(__iostring const& str, __iowstring &out,
                       const ctype<wchar_t>& ct, wchar_t dot, bool __check_dot) {
    wchar_t __static_buf[128];
    wchar_t *__beg = __static_buf;
    wchar_t *__end = __static_buf + (sizeof(__static_buf) / sizeof(wchar_t));
    string::const_iterator str_ite(str.begin()), str_end(str.end());

    wchar_t *__cur = __beg;
    //First loop, check the dot char
    if (__check_dot) {
        while (str_ite != str_end) {
            if (*str_ite != '.') {
                *__cur = ct.widen(*str_ite);
            } else {
                *__cur = dot;
                break;
            }
            ++__cur;
            if (__cur == __end) {
                out.append(__beg, __cur);
                __cur = __beg;
            }
            ++str_ite;
        }
    } else {
        if (str_ite != str_end) {
            *__cur = ct.widen(*str_ite);
        }
    }

    if (str_ite != str_end) {
        ++__cur;
        ++str_ite;
        if (__cur == __end) {
            out.append(__beg, __cur);
            __cur = __beg;
        }

        //Second loop, dot has been found, no check anymore
        while (str_ite != str_end) {
            *__cur = ct.widen(*str_ite);
            ++__cur;
            if (__cur == __end) {
                out.append(__beg, __cur);
                __cur = __beg;
            }
            ++str_ite;
        }
    }

    out.append(__beg, __cur);
}
开发者ID:RenEvo,项目名称:dead6,代码行数:53,代码来源:num_put_float.cpp


示例5: __get_base_or_zero

int
__get_base_or_zero(_InputIter& __in_ite, _InputIter& __end,
                   ios_base::fmtflags __flags, const ctype<_CharT>& __c_type) {
  _CharT __atoms[5];
  __c_type.widen(__narrow_atoms(), __narrow_atoms() + 5, __atoms);

  bool __negative = false;
  _CharT __c = *__in_ite;

  if (__c == __atoms[1] /* __xminus_char */ ) {
    __negative = true;
    ++__in_ite;
  }
  else if (__c == __atoms[0] /* __xplus_char */ )
    ++__in_ite;

  int __base;
  int __valid_zero = 0;

  ios_base::fmtflags __basefield = __flags & ios_base::basefield;

  switch (__basefield) {
  case ios_base::oct:
    __base = 8;
    break;
  case ios_base::dec:
    __base = 10;
    break;
  case ios_base::hex:
    __base = 16;
    if (__in_ite != __end && *__in_ite == __atoms[2] /* __zero_char */ ) {
      ++__in_ite;
      if (__in_ite != __end &&
          (*__in_ite == __atoms[3] /* __x_char */ || *__in_ite == __atoms[4] /* __X_char */ ))
        ++__in_ite;
      else
        __valid_zero = 1; // That zero is valid by itself.
    }
    break;
  default:
    if (__in_ite != __end && *__in_ite == __atoms[2] /* __zero_char */ ) {
      ++__in_ite;
      if (__in_ite != __end &&
          (*__in_ite == __atoms[3] /* __x_char */ || *__in_ite == __atoms[4] /* __X_char */ )) {
        ++__in_ite;
        __base = 16;
      }
      else
        {
          __base = 8;
          __valid_zero = 1; // That zero is still valid by itself.
        }
    }
    else
      __base = 10;
    break;
  }
  return (__base << 2) | ((int)__negative << 1) | __valid_zero;
}
开发者ID:miaozhendaoren,项目名称:K2SAR_EMS,代码行数:59,代码来源:_num_get.c


示例6: __initialize_get_digit

__STL_BEGIN_NAMESPACE

//----------------------------------------------------------------------
// num_get

// Helper functions for _M_do_get_integer.

void  __STL_CALL
__initialize_get_digit(wchar_t* digits, wchar_t* xdigits,
                       const ctype<wchar_t>& ct)
{
    char narrow_digits[11]  = "0123456789";
    char narrow_xdigits[13] = "aAbBcCdDeEfF";

    ct.widen(narrow_digits + 0,  narrow_digits + 10,  digits);
    ct.widen(narrow_xdigits + 0, narrow_xdigits + 10, xdigits);
}
开发者ID:jiayuehua,项目名称:STLport,代码行数:17,代码来源:num_get.cpp


示例7: operator

 const char_type*
 operator()(const char_type* __first, const char_type* __last) const {
   return _M_ctype->scan_is(ctype_base::space, __first, __last);
 }
开发者ID:RenEvo,项目名称:dead6,代码行数:4,代码来源:_istream.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cube类代码示例发布时间:2022-05-31
下一篇:
C++ ctkLogger类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap