示例#1
0
std::string FunctionCall::ToString( const PrintingContext& pctx ) const
{
    std::string tabs = pctx.Tabs();
    std::string str;
    
    if( !pctx.inlineWriting )
        str += tabs;
    
    str += myCalledFunction->GetName() + "( ";
    
    if( mySubOps.size() > 0 )
    {
        for( size_t i = 0; i < mySubOps.size()-1; i++ )
            str += mySubOps[i]->ToString( pctx.InlineWriting() ) + ", ";
        
        str += mySubOps[ mySubOps.size() - 1 ]->ToString( pctx.InlineWriting() );
    }
    
    str += " )";
    
    if( !pctx.inlineWriting )
        str += ";\n";
        
    return str;
}
示例#2
0
std::string Substraction::ToString(const PrintingContext& pctx) const
{
    return "(" + mySubOps[0]->ToString(pctx.InlineWriting()) + "-" + mySubOps[1]->ToString(pctx.InlineWriting()) + ")";
}
示例#3
0
文件: Power.cpp 项目: Ziple/ShadeGen
std::string Power::ToString(const PrintingContext& pctx) const
{
    return "(" + mySubOps[0]->ToString(pctx.InlineWriting()) + "^" + mySubOps[1]->ToString(pctx.InlineWriting()) + ")";
}