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


C++ Formula::symbol方法代码示例

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


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

示例1: operator

std::wstring Writer::operator ()(const Formula &formula, const Dictionary &dictionary, SymbolType *symbolType) const
{
    SymbolType localSymbolType;
    SymbolType &type = symbolType ? *symbolType : localSymbolType;
    std::wstring result;

    type = formula.type();

    switch (type) {
    case NONE_SYMBOL:
        return symbolic.noneSymbol;

        break;

    case FALSE_SYMBOL:
        return symbolic.falseSymbol;

        break;

    case TRUE_SYMBOL:
        return symbolic.trueSymbol;

        break;

    case EQUALITY:
        if (formula.terms().size()<=1) {
            return symbolic.trueSymbol;
        }

        result += operator ()(formula.terms()[0], dictionary);

        for (size_t i = 1; i < formula.terms().size(); ++i) {
            result += symbolic.equalitySymbol;
            result += operator ()(formula.terms()[i], dictionary);
        }

        break;

    case NONEQUALITY:
        if (formula.terms().size()<=1) {
            return symbolic.trueSymbol;
        }

        if (formula.terms().size()==2) {
            result += (*this)(formula.terms()[0], dictionary);
            result += symbolic.nonequalitySymbol;
            result += (*this)(formula.terms()[1], dictionary);
        } else {
            result += symbolic.nonequalitySymbol+symbolic.leftRelationBracket;

            for (size_t i = 0; i<formula.terms().size(); ++i) {
                if (i!=0) {
                    result += symbolic.relationSeparatorSymbol;
                    result += (*this)(formula.terms()[i], dictionary);
                }
            }

            result += symbolic.rightRelationBracket;
        }

        break;

    case RELATION:
        result = dictionary(formula.symbol());

        if (result.empty()) {
            result = relationName(formula.symbol().id);
        }

        result += symbolic.leftRelationBracket;

        if (formula.terms().empty() == false) {
            result += operator ()(formula.terms()[0], dictionary);

            for (size_t i = 1; i < formula.terms().size(); ++i) {
                result += symbolic.relationSeparatorSymbol;
                result += operator ()(formula.terms()[i], dictionary);
            }
        }

        result += symbolic.rightRelationBracket;

        break;

    case NEGATION:
        result = operator ()(formula.formulas()[0], dictionary, &type);
        insertBracketsIfNeeded(formula.type(), type, result);
        type = formula.type();
        result = symbolic.negationSymbol+result;

        break;

    case CONJUNCTION: case DISJUNCTION:
        switch (formula.formulas().size()) {
        case 0:
            if (type == CONJUNCTION) {
                result = symbolic.trueSymbol;
                type = TRUE_SYMBOL;
            } else {
                result = symbolic.falseSymbol;
//.........这里部分代码省略.........
开发者ID:recursivelab,项目名称:FunnyProof,代码行数:101,代码来源:readwrite.cpp


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