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


C++ StringT::size方法代码示例

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


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

示例1: TOKEN_FROM_ID

    inline bool 
    handle_identifier(boost::wave::token_id prev, 
        boost::wave::token_id before, StringT const &value)
    {
        using namespace boost::wave;
        switch (static_cast<unsigned int>(prev)) {
        case T_IDENTIFIER:
        case T_NONREPLACABLE_IDENTIFIER:
        case T_COMPL_ALT:
        case T_OR_ALT:
        case T_AND_ALT:
        case T_NOT_ALT:
        case T_XOR_ALT:
        case T_ANDASSIGN_ALT:
        case T_ORASSIGN_ALT:
        case T_XORASSIGN_ALT:
        case T_NOTEQUAL_ALT:
        case T_FIXEDPOINTLIT:
            return true;

        case T_FLOATLIT:
        case T_INTLIT:
        case T_PP_NUMBER:
            return (value.size() > 1 || (value[0] != 'e' && value[0] != 'E'));
            
         // avoid constructing universal characters (\u1234)
        case TOKEN_FROM_ID('\\', UnknownTokenType):
            return would_form_universal_char(value);
        }
        return false;
    }
开发者ID:Axitonium,项目名称:sourcesdkpython,代码行数:31,代码来源:insert_whitespace_detection.hpp

示例2: ctx

void
read_s(
	StringT& str,
	void const* data,
	std::size_t const size
) {
	duct::IO::StreamContext ctx(FromU::id, duct::Endian::system);
	duct::IO::imemstream stream(data, size * FromU::char_size);
	std::printf(
		"stream size: %lu\n",
		static_cast<unsigned long>(duct::IO::size(stream))
	);
	DUCT_ASSERTE(stream.good());
	ctx.read_string(
		stream, str, static_cast<std::streamsize>(size), duct::CHAR_NULL
	);
	DUCT_ASSERTE(stream.good());
	print_states(stream);
	std::printf(
		"String [size: %lu bsize: %lu len: %lu]: |",
		static_cast<unsigned long>(size),
		static_cast<unsigned long>(size*FromU::char_size),
		static_cast<unsigned long>(str.size())
	);
	std::cout << str << "|\n";
	str.clear();
}
开发者ID:komiga,项目名称:duct-cpp,代码行数:27,代码来源:string.cpp

示例3: would_form_universal_char

 inline bool
 would_form_universal_char (StringT const &value)
 {
     if ('u' != value[0] && 'U' != value[0])
         return false;
     if ('u' == value[0] && value.size() < 5)
         return false;
     if ('U' == value[0] && value.size() < 9)
         return false;
 
 typename StringT::size_type pos = 
     value.find_first_not_of("0123456789abcdefABCDEF", 1);
     
     if (StringT::npos == pos || 
         ('u' == value[0] && pos > 5) ||
         ('U' == value[0] && pos > 9))
     {
         return true;        // would form an universal char
     }
     return false;
 }
开发者ID:Axitonium,项目名称:sourcesdkpython,代码行数:21,代码来源:insert_whitespace_detection.hpp

示例4: switch

inline bool 
is_trigraph(StringT const& trigraph)
{
    if (trigraph.size() < 3 || '?' != trigraph[0] || '?' != trigraph[1])
        return false;
        
    switch (trigraph[2]) {
    case '\'': case '=': case '/': case '(':
    case ')':  case '<': case '>': case '!':
    case '-':
        break;

    default:
        return false;
    }

    return true;
}
开发者ID:AndresGalaviz,项目名称:NAO,代码行数:18,代码来源:convert_trigraphs.hpp

示例5:

inline bool 
is_special_macroname (StringT const &name)
{
    if (name.size() < 7)
        return false;

    if ("defined" == name)
        return true;

    if ('_' == name[0] && '_' == name[1]) {
    StringT str = name.substr(2);

        if (str == "cplusplus"  || str == "STDC__" || 
            str == "TIME__"     || str == "DATE__" ||
            str == "LINE__"     || str == "FILE__" ||
            str == "INCLUDE_LEVEL__")
        {
            return true;
        }
    }
    return false;
}
开发者ID:QuentinRougemont,项目名称:MicrosatDemogInference,代码行数:22,代码来源:cpp_macromap_utils.hpp

示例6: show_help

 /**
  * show help and usage information
  *
  * @param out output stream
  * @param program_name the name of executable to display
  * @param usage_str additional help shown before help for options
  *
  * @param show_usage should "Usage:" information be shown, can be
  * useful when this help is shown additionally to main help
  */
 void show_help(std::ostream &out, char const *program_name
                , StringT const &usage_str = ""
                , bool show_usage = true) const
 {
     if (show_usage) {
         if (usage_str.size()) {
             out << "Usage: " << program_name << " " << usage_str;
         } else {
             out << "Usage: " << program_name << " [options]\n"
                 << "\twhere [options] are:\n";
         }
     } else {
         out << usage_str;
     }
     std::map<StringT, std::pair<char, StringT> > grouped;
     for (auto p : short_opts_)
         grouped[p.second].first = p.first;
     for (auto p : long_opts_)
         grouped[p.second].second = p.first;
     for (auto p : grouped) {
         auto &sl = p.second;
         out << "\t";
         if (sl.first) {
             out << '-' << sl.first;
             if (opt_with_params_.count(p.first))
                 out << " <" << p.first << '>';
         }
         out << "\t";
         if (sl.second.size()) {
             out << "--" << sl.second;
             if (opt_with_params_.count(p.first))
                 out << " <" << p.first << '>';
         }
         out << "\n";
     }
 }
开发者ID:cxl000,项目名称:cor,代码行数:46,代码来源:options.hpp

示例7: mg_write

	static int inline mg_write(struct mg_connection* conn, const StringT& string)
	{
		return mg_write(conn, string.c_str(), string.size());
	}
开发者ID:UNIVERSAL-IT-SYSTEMS,项目名称:libyuni,代码行数:4,代码来源:request.inc.hpp


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