From b765b57739463d0aa3b833a70e0ea87bca68e82e Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Mon, 29 Jul 2013 21:07:40 +0200 Subject: Coding style improvements --- src/nodes.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/nodes.cc') diff --git a/src/nodes.cc b/src/nodes.cc index 2ec3167..4710400 100644 --- a/src/nodes.cc +++ b/src/nodes.cc @@ -7,9 +7,8 @@ namespace SimpleParser { -OperandNode::OperandNode(double val) { - this->value_ = val; -} +OperandNode::OperandNode(double val): + value_(val) { } double OperandNode::solve() { return this->value_; @@ -28,9 +27,8 @@ std::string OperandNode::print() { return convertStream.str(); } -OperatorNode::OperatorNode(char op) { - this->function_ = op; -} +OperatorNode::OperatorNode(char op): + function_(op) { } double OperatorNode::solve() { switch ( this->function_ ) { @@ -54,7 +52,9 @@ double OperatorNode::solve() { return this->leftChild->solve() - this->rightChild->solve(); } case '^': { - return std::pow( this->leftChild->solve(), this->rightChild->solve() ); + return std::pow( + this->leftChild->solve(), this->rightChild->solve() + ); } default: { throw operator_exception(); @@ -74,4 +74,4 @@ char OperatorNode::getFunction() { return this->function_; } -} // SimpleParser +} -- cgit v1.2.3