本文整理汇总了C++中Formula::formulas方法的典型用法代码示例。如果您正苦于以下问题:C++ Formula::formulas方法的具体用法?C++ Formula::formulas怎么用?C++ Formula::formulas使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Formula
的用法示例。
在下文中一共展示了Formula::formulas方法的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;
//.........这里部分代码省略.........