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


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

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


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

示例1: FillDocInfo

void CDocListRetrieverFromDisc::FillDocInfo(SDocumentAttribtes& attrs)
{
    Stroka strFilePath = m_SmartFileFind.GetFoundFilePath(m_iCurPath);

    Stroka strURL;
    if (strFilePath == m_strSearchDir) {
        TStringBuf left, right;
        PathHelper::Split(strFilePath, left, right);
        strURL = ToString(right);
    } else
        strURL = strFilePath.substr(m_strSearchDir.size());

    if (strURL.empty())
        ythrow yexception() << "Can't build url for file \"" << strFilePath
                              << "\" with searchdir \"" << m_strSearchDir << "\".";

    TransformBackSlash(strURL);

    attrs.m_strUrl = strURL;

    Stroka strTime;
    if (stroka(m_strLTM) == "file") {
        CTime lw_time = m_SmartFileFind.GetFoundFileInfo(m_iCurPath).m_LastWriteTime;
        strTime = lw_time.Format("%d.%m.%Y %H:%M:%S");
    }

    if (strTime.empty())
        strTime = m_strStartTime;

    attrs.m_strTitle = CharToWide(strTime);
    attrs.m_strSource = strURL;
    attrs.m_strTitle = CharToWide(attrs.m_strSource);     // ??? rewriting
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:33,代码来源:doclistretrieverfromdisc.cpp

示例2: OpenOutput

static inline TAutoPtr<TOutputStream> OpenOutput(const Stroka& url) {
    if (url.empty()) {
        return new TBuffered<TFileOutput>(8192, Duplicate(1));
    } else {
        return new TBuffered<TFileOutput>(8192, url);
    }
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:7,代码来源:main.cpp

示例3: Init

bool CAgencyInfoRetriver::Init(const Stroka& strDoc2AgFile)
{
    if (!strDoc2AgFile.empty() && isexist(strDoc2AgFile.c_str()))
        m_DocId2AgNameFile = TFile(strDoc2AgFile.c_str(), OpenExisting | RdOnly);

    return true;
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:7,代码来源:agencyinforetriever.cpp

示例4: AddAliasImpl

inline void TFile::AddAliasImpl(const Stroka& name) {
    if (!name.empty() && !Is(name)) {
        Aliases_.push_back(name);
        if (!GeneratedDescriptor)
            GeneratedDescriptor = NBuiltin::FindInGeneratedPool(name);
    }
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:7,代码来源:builtin.cpp

示例5: TryConsumeImportFileName

bool TDependencyCollectorInputStream::TryConsumeImportFileName(const NProtoBuf::io::Tokenizer::Token& token)
{
    ImportProcessor.NextState(token);
    if (!ImportProcessor.Found())
        return false;

    YASSERT(token.type == NProtoBuf::io::Tokenizer::TYPE_STRING);

    // original imported file (unquoted)
    Stroka original;
    Tokenizer_.ParseString(token.text, &original);

    // canonic file
    const Stroka canonic = SourceTree->CanonicName(original);
    if (canonic.empty() || canonic == original) {
        // make a hint for this special case
        if (original == STRINGBUF("base.proto"))
            ErrorCollector->AddErrorAtCurrentFile(token.line, token.column,
                "Importing base.proto by shortcut name is not allowed from arcadia. You should use full path instead: import \"kernel/gazetteer/base.proto\";");
        return false;   // just proceed with original file name
    }

    // restore quotes and replace original with canonic in further pipeline.
    CanonicImportedFile.clear();
    CanonicImportedFile.append('"');
    EscapeC(canonic, CanonicImportedFile);
    CanonicImportedFile.append('"');
    return true;
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:29,代码来源:protoparser.cpp

示例6: SaveStateCollection

void CLRCollectionSet::SaveStateCollection(Stroka GrammarFileName, const CWorkGrammar* p_WorkGrammar) const
{
    if (GrammarFileName.empty()) return;
    FILE * fp = fopen(GrammarFileName.c_str(), "wb");

    for (int i = 0; i < (int)m_ItemSets.size(); i++) {
        fprintf(fp, "I%i =\n", i);

        for (yset<CLRItem>::const_iterator it = m_ItemSets[i].begin(); it != m_ItemSets[i].end(); it++) {
            fprintf(fp, "\t%s -> ", p_WorkGrammar->m_UniqueGrammarItems[it->m_pRule->m_LeftPart].m_ItemStrId.c_str());

            for (int j = 0; j < (int)it->m_pRule->m_RightPart.m_Items.size(); j++) {
                if (j == (int)it->m_DotSymbolNo)
                    fprintf(fp, "; ");
                fprintf(fp, "%s ", p_WorkGrammar->m_UniqueGrammarItems[it->m_pRule->m_RightPart.m_Items[j]].m_ItemStrId.c_str());
            }

            if (it->m_DotSymbolNo == it->m_pRule->m_RightPart.m_Items.size())
                fprintf(fp, "; ");
            fprintf(fp, "\n");
        }
        fprintf(fp, "\n");
    }

    fprintf(fp, "\n");
    for (ymap< CStateAndSymbol, size_t>::const_iterator it_goto = m_GotoFunction.begin(); it_goto != m_GotoFunction.end(); it_goto++)
        fprintf(fp, "GOTO( I%" PRISZT ", %s ) = I%" PRISZT "\n", it_goto->first.m_StateNo, p_WorkGrammar->m_UniqueGrammarItems[it_goto->first.m_SymbolNo].m_ItemStrId.c_str(), it_goto->second);

    fclose(fp);
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:30,代码来源:lr-items.cpp

示例7: Fix

static inline Stroka Fix(Stroka f) {
    if (!f.empty() && IsDelim(f[+f - 1])) {
        f.pop_back();
    }

    return f;
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:7,代码来源:main.cpp

示例8: StripFileComponent

Stroka StripFileComponent(const Stroka& fileName)
{
    Stroka dir = IsDir(fileName) ? fileName : GetDirName(fileName);
    if (!dir.empty() && dir.back() != GetDirectorySeparator()) {
        dir.append(GetDirectorySeparator());
    }
    return dir;
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:8,代码来源:dirut.cpp

示例9: BitsetToString

Stroka BitsetToString(const yvector<TGramBitSet>& bitset, const Stroka& delim /*= ", "*/, const Stroka& groupdelim /*= ", "*/) {
    Stroka s;
    for (size_t i = 0; i < bitset.size(); ++i) {
        if (!s.empty())
            s += groupdelim;
        s += bitset[i].ToString(~delim);
    }
    return s;
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:9,代码来源:terminals.cpp

示例10: 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

示例11: ParseListOfFacts

void CParserOptions::ParseListOfFacts(TXmlNodePtrBase piNode) {
    TXmlNodePtrBase piFacts = piNode->children;
    m_ParserOutputOptions.m_bShowFactsWithEmptyField = piNode.HasAttr("addEmpty");
    for (; piFacts.Get() != NULL; piFacts = piFacts->next) {
        if (!piFacts.HasName("fact"))
            continue;

        Stroka str = piFacts.GetAttr("name");
        if (!str.empty())
            AddFactToShow(str, !piFacts.HasAttr("noequality"));
    }
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:12,代码来源:parseroptions.cpp

示例12: StringToBitset

TGramBitSet StringToBitset(const Stroka& gram, const Stroka& delim /*= ",; "*/) {
    if (gram.empty())
        return TGramBitSet();
    TGramBitSet res;
    VectorStrok tokens;
    SplitStrokuBySet(&tokens, ~gram, ~delim);
    for (size_t i = 0; i < tokens.size(); ++i) {
        TGrammar code = TGrammarIndex::GetCode(tokens[i]);
        if (code != gInvalid)
            res.Set(code);
    }
    return res;
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:13,代码来源:terminals.cpp

示例13: WriteToLogFile

void WriteToLogFile(const Stroka& sGrammarFileLog, Stroka& str, bool bRW)
{
    if (sGrammarFileLog.empty())
        return;

    str += '\n';

    THolder<TFile> f;
    if (bRW)
        f.Reset(new TFile(sGrammarFileLog, CreateAlways | WrOnly | Seq));
    else
        f.Reset(new TFile(sGrammarFileLog, OpenAlways | WrOnly | Seq | ForAppend));

    TFileOutput out(*f);
    out.Write(str.c_str());
};
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:16,代码来源:utilit.cpp

示例14: BuildMessageInheritanceGraph

bool TProtoParser::BuildMessageInheritanceGraph(const TDescriptor* msg_descr, const TSimpleHierarchy& graph)
{
    for (int i = 0; i < msg_descr->nested_type_count(); ++i)
        if (!BuildMessageInheritanceGraph(msg_descr->nested_type(i), graph))
            return false;

    // Find a base descriptor. There are two possible cases:
    // 1) @msg_descr was taken from generated_pool (builtin) and it's base type name is stored in its GztProtoDerivedFrom option.
    // 2) @msg_descr was read from disk .proto (using TDependencyCollector) and its base is remembered in the inheritance graph.

    const Stroka* explicit_base_name = graph.GetBase(msg_descr->full_name());
    const Stroka implicit_base_name = msg_descr->options().GetExtension(GztProtoDerivedFrom);
    if (!explicit_base_name && !implicit_base_name)      // no base class
        return true;

    const NProtoBuf::Descriptor* explicit_base_descr = NULL;
    if (explicit_base_name) {
         explicit_base_descr = ResolveBaseMessageByName(*explicit_base_name, msg_descr);
         if (!explicit_base_descr)
            return false;
    }

    const NProtoBuf::Descriptor* implicit_base_descr = NULL;
    if (!implicit_base_name.empty()) {
         implicit_base_descr = ResolveBaseMessageByName(implicit_base_name, msg_descr);
         if (!implicit_base_descr)
            return false;
    }

    if (explicit_base_descr && implicit_base_descr && explicit_base_descr != implicit_base_descr) {
        Errors->AddError(msg_descr->file()->name(), -1, 0, NProtoBuf::strings::Substitute(
            "Ambiguous base type for $0: either $1 (disk) or $2 (builtin).", msg_descr->full_name(),
             explicit_base_descr->full_name(), implicit_base_descr->full_name()));
        return false;
    }

    RawMessageGraph[msg_descr] = explicit_base_descr ? explicit_base_descr : implicit_base_descr;
    // check if cycle dependency exists.
    if (!CheckIfSelfDerived(msg_descr))
        return false;

    return true;
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:43,代码来源:protoparser.cpp

示例15: ReadTo

    inline bool ReadTo(Stroka& st, char to) {
        Stroka res;
        Stroka s_tmp;

        bool ret = false;

        while (true) {
            if (MemInput_.Exhausted()) {
                const size_t readed = Slave_->Read(Buf(), BufLen());

                if (!readed) {
                    break;
                }

                MemInput_.Reset(Buf(), readed);
            }

            const size_t a_len(MemInput_.Avail());
            MemInput_.ReadTo(s_tmp, to);
            const size_t s_len = s_tmp.length();

            /*
             * mega-optimization
             */
            if (res.empty()) {
                res.swap(s_tmp);
            } else {
                res += s_tmp;
            }

            ret = true;

            if (s_len != a_len) {
                break;
            }
        }

        st.swap(res);

        return ret;
    }
开发者ID:noscripter,项目名称:tomita-parser,代码行数:41,代码来源:buffered.cpp


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