Calculator
Extensible stack-based calculator primarily in library form
Calculator::VariableSet Class Reference

All variables belonging to a Stack. More...

#include <VariableSet.h>

Public Member Functions

 VariableSet ()
 Construct with an empty variable set. More...
 
 VariableSet (const VariableSet &)=delete
 
 VariableSet (VariableSet &&)=delete
 
VariableSetoperator= (const VariableSet &)=delete
 
VariableSetoperator= (VariableSet &&)=delete
 
void clear ()
 Clear all set variables. More...
 
std::shared_ptr< StackItemget (const std::string &name) const
 Get the value of name, if any. More...
 
void set (const std::string &name, std::shared_ptr< StackItem > value)
 Set the value of name, overriding existing values. More...
 

Detailed Description

All variables belonging to a Stack.

A variable without a value is acceptable until its value is requested; such a request is not allowed.

Definition at line 28 of file VariableSet.h.

Constructor & Destructor Documentation

◆ VariableSet() [1/3]

Calculator::VariableSet::VariableSet ( )

Construct with an empty variable set.

Definition at line 31 of file VariableSet.cpp.

◆ VariableSet() [2/3]

Calculator::VariableSet::VariableSet ( const VariableSet )
delete

◆ VariableSet() [3/3]

Calculator::VariableSet::VariableSet ( VariableSet &&  )
delete

Member Function Documentation

◆ clear()

void Calculator::VariableSet::clear ( )

Clear all set variables.

Definition at line 36 of file VariableSet.cpp.

◆ get()

std::shared_ptr< StackItem > Calculator::VariableSet::get ( const std::string &  name) const

Get the value of name, if any.

Parameters
nameof the variable go get
Returns
StackItem holding the value of the variable

Definition at line 40 of file VariableSet.cpp.

◆ operator=() [1/2]

VariableSet& Calculator::VariableSet::operator= ( const VariableSet )
delete

◆ operator=() [2/2]

VariableSet& Calculator::VariableSet::operator= ( VariableSet &&  )
delete

◆ set()

void Calculator::VariableSet::set ( const std::string &  name,
std::shared_ptr< StackItem value 
)

Set the value of name, overriding existing values.

Parameters
nameof the variable go set
valueholding the value of the variable

Definition at line 49 of file VariableSet.cpp.


The documentation for this class was generated from the following files: