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


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

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


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

示例1: TestIconv

static void TestIconv(const Stroka& utf8, const Stroka& other, ECharset enc) {
    Wtroka wide0 = CharToWide(utf8, CODES_UTF8);
    Wtroka wide1 = CharToWide(other, enc);

    UNIT_ASSERT(wide0 == wide1);

    Stroka temp = WideToChar(wide0, CODES_UTF8);
    UNIT_ASSERT(temp == utf8);

    temp = WideToChar(wide0, enc);
    UNIT_ASSERT(temp == other);

    temp = Recode(enc, CODES_UTF8, other);
    UNIT_ASSERT(temp == utf8);

    temp = Recode(CODES_UTF8, enc, utf8);
    UNIT_ASSERT(temp == other);

    size_t read = 0;
    size_t written = 0;

    RECODE_RESULT res = RecodeToUnicode(enc, other.c_str(), wide1.begin(), other.size(), wide1.size(), read, written);
    UNIT_ASSERT(res == RECODE_OK);
    UNIT_ASSERT(read == other.size());
    UNIT_ASSERT(written == wide1.size());
    UNIT_ASSERT(wide0 == wide1);

    res = RecodeFromUnicode(enc, wide0.c_str(), temp.begin(), wide0.size(), temp.size(), read, written);
    UNIT_ASSERT(res == RECODE_OK);
    UNIT_ASSERT(read == wide0.size());
    UNIT_ASSERT(written == other.size());
    UNIT_ASSERT(temp == other);
}
开发者ID:Mirocow,项目名称:balancer,代码行数:33,代码来源:iconv_ut.cpp

示例2: FormLine

 size_t TFormatOutput::FormLine(const char *str, size_t pos, Stroka &Line) {
     Line = "";
     size_t len = strlen(str);
     for(size_t i = 0; i < Level; i++)
         Line += Ident;
     int NextLine;
     size_t pos1 = pos;
     while(1) {
         pos1 = skipspace(str, pos1, len, NextLine, Line);
         if(NextLine || Line.size() >= MaxLen || pos1 >= len)
             return pos1;
         pos1 = skipword(str, pos1, len, NextLine, Line);
         if(NextLine || Line.size() >= MaxLen || pos1 >= len)
             return pos1;
     }
 }
开发者ID:pyal,项目名称:eos_cpp,代码行数:16,代码来源:CommandLine.cpp

示例3: QuoteForHelp

// Like Stroka::Quote(), but does not quote digits-only string
static Stroka QuoteForHelp(const Stroka& str) {
    if (str.empty())
        return str.Quote();
    for (size_t i = 0; i < str.size(); ++i) {
        if (!isdigit(str[i]))
            return str.Quote();
    }
    return str;
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:10,代码来源:last_getopt.cpp

示例4: Print

void CHomonym::Print(TOutputStream& stream, const Stroka& strKwType, ECharset encoding) const
{
    Stroka s;
    if (strKwType.size())
        s = Substitute(" (<b>$0</b>) ", strKwType);

    stream << "  " << NStr::Encode(GetShortLemma(), encoding) << " ";
    PrintFormGrammems(stream, encoding);
    stream << s << GetLabelsString(encoding) << Endl;
}
开发者ID:dubrousky,项目名称:tomita-parser,代码行数:10,代码来源:homonym.cpp

示例5: IsAllowedLongName

bool TOpt::IsAllowedLongName(const Stroka& name, unsigned char* out) {
    for (size_t i = 0; i != name.size(); ++i) {
        const unsigned char c = name[i];
        if (!isprint(c) || TStringBuf::npos != ExcludedLongNameChars.find(c)) {
            if (NULL != out)
                *out = c;
            return false;
        }
    }
    return true;
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:11,代码来源:last_getopt.cpp

示例6: GetInterviewFio

Wtroka CProcessor::GetInterviewFio(Stroka strUrl) const
{
    ymap<Stroka, Wtroka>::const_iterator it = InterviewUrl2Fio.find(strUrl);
    if (it != InterviewUrl2Fio.end())
        return it->second;
    static const Stroka kHTTP = "http://";
    if (strUrl.has_prefix(kHTTP)) {
        strUrl = strUrl.substr(kHTTP.size());
        return GetInterviewFio(strUrl);
    }
    return Wtroka();
}
开发者ID:leotop,项目名称:tomita-parser,代码行数:12,代码来源:processor.cpp

示例7: GetPrettyOutputFileName

Stroka CCommonParm::GetPrettyOutputFileName() const {
    if (NULL != Config.Get() && Config->has_prettyoutput()) {
        Stroka fn = Config->GetPrettyOutput();
        fn.to_lower();
        if ("stdout" == fn || "stderr" == fn)
            return fn;
        if ("-" == fn)
            return "stdout";
        if (fn.size() > 0)
            return Config->GetPrettyOutput();
    }

    return Stroka("");
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:14,代码来源:commonparm.cpp

示例8: ReadLV

// read length-value (throws yexception or TLoadEOF)
void CStdinMapReduceDocsReader::ReadLV(TInputStream& is, Stroka& value)
{
    ::Load(&is, value);
    if (value.size() == 0 || value.size() > (1 << 27))
        ythrow yexception() << "bad data size wile reading MapReduce length-value output (" << value.size() << " bytes)";
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:7,代码来源:stdinmapreducedocsreader.cpp


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