📄 unary_expr.cc
字号:
#include "Unary_expr.h"#include "Globals.h"#include "Cmd_options.h"#include "Number_expr.h"Unary_expr::Unary_expr(Expr * c) : Expr(c) { child = c;}Unary_expr::~Unary_expr() { delete child;}Expr * Unary_expr::clone() const { Unary_expr * c; c = (Unary_expr *) shallow_copy(); c->child = child->clone(); c->globals = globals; c->source_line = source_line; c->source = source; return c;}string Unary_expr::to_matlab() const { string s; if (globals->cmd_options->all_params_symbolic() || !is_number() ) { s += this->symbol_str(); if (child->is_binary_expr()) { s += "("; s += child->to_matlab(); s += ")"; } else s += child->to_matlab(); } else { Number *n; n=compute_number(); s += n->to_matlab(); delete n; } return s;}bool Unary_expr::is_const() const { return child->is_const();}bool Unary_expr::is_symbolic() const { return child->is_symbolic();}/** has to be overwritten by cast-operators */bool Unary_expr::is_real() const { return child->is_real();}/** has to be overwritten by cast-operators */bool Unary_expr::is_logic() const { return child->is_logic();}list < Item * > Unary_expr::unroll() { return child->unroll();}string Unary_expr::arg_range_check_matlab() const { string res; res += child->arg_range_check_matlab(); return res;} void Unary_expr::simplify() { Expr *tmp; if (!globals->cmd_options->all_params_symbolic()) { if (child->is_number()) { tmp=child; child=new Number_expr(child->compute_number(), globals); delete tmp; } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -