diff options
| author | Adrian Kummerländer | 2013-07-29 21:07:40 +0200 | 
|---|---|---|
| committer | Adrian Kummerländer | 2013-07-29 21:07:40 +0200 | 
| commit | b765b57739463d0aa3b833a70e0ea87bca68e82e (patch) | |
| tree | 096324034bd40cdb88fe4855c86194f3d4b1b48b /src/nodes.cc | |
| parent | 948cb0482be1783db036f40fd4f93a3355da232f (diff) | |
| download | SimpleParser-b765b57739463d0aa3b833a70e0ea87bca68e82e.tar SimpleParser-b765b57739463d0aa3b833a70e0ea87bca68e82e.tar.gz SimpleParser-b765b57739463d0aa3b833a70e0ea87bca68e82e.tar.bz2 SimpleParser-b765b57739463d0aa3b833a70e0ea87bca68e82e.tar.lz SimpleParser-b765b57739463d0aa3b833a70e0ea87bca68e82e.tar.xz SimpleParser-b765b57739463d0aa3b833a70e0ea87bca68e82e.tar.zst SimpleParser-b765b57739463d0aa3b833a70e0ea87bca68e82e.zip  | |
Coding style improvements
Diffstat (limited to 'src/nodes.cc')
| -rw-r--r-- | src/nodes.cc | 16 | 
1 files changed, 8 insertions, 8 deletions
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 +}  | 
