Plot Script
Public Member Functions | List of all members
Atom Class Reference

A variant type that may be a Number or Symbol or the default type None. More...

#include <atom.hpp>

Public Member Functions

 Atom ()
 Construct a default Atom of type None. More...
 
 Atom (double value)
 Construct an Atom of type Number with value. More...
 
 Atom (const std::string &value)
 Construct an Atom of type Symbol named value. More...
 
 Atom (const Token &token)
 Construct an Atom directly from a Token. More...
 
 Atom (const Atom &x)
 Copy-construct an Atom. More...
 
Atomoperator= (const Atom &x)
 Assign an Atom. More...
 
 ~Atom ()
 Atom destructor. More...
 
bool isNone () const noexcept
 predicate to determine if an Atom is of type None More...
 
bool isNumber () const noexcept
 predicate to determine if an Atom is of type Number More...
 
bool isSymbol () const noexcept
 predicate to determine if an Atom is of type Symbol More...
 
double asNumber () const noexcept
 value of Atom as a number, return 0 if not a Number More...
 
std::string asSymbol () const noexcept
 value of Atom as a number, returns empty-string if not a Symbol More...
 
bool operator== (const Atom &right) const noexcept
 equality comparison based on type and value More...
 

Detailed Description

A variant type that may be a Number or Symbol or the default type None.

This class provides value semantics.

Constructor & Destructor Documentation

◆ Atom() [1/5]

Atom::Atom ( )

Construct a default Atom of type None.

◆ Atom() [2/5]

Atom::Atom ( double  value)

Construct an Atom of type Number with value.

◆ Atom() [3/5]

Atom::Atom ( const std::string &  value)

Construct an Atom of type Symbol named value.

◆ Atom() [4/5]

Atom::Atom ( const Token token)

Construct an Atom directly from a Token.

◆ Atom() [5/5]

Atom::Atom ( const Atom x)

Copy-construct an Atom.

◆ ~Atom()

Atom::~Atom ( )

Atom destructor.

Member Function Documentation

◆ asNumber()

double Atom::asNumber ( ) const
noexcept

value of Atom as a number, return 0 if not a Number

◆ asSymbol()

std::string Atom::asSymbol ( ) const
noexcept

value of Atom as a number, returns empty-string if not a Symbol

◆ isNone()

bool Atom::isNone ( ) const
noexcept

predicate to determine if an Atom is of type None

◆ isNumber()

bool Atom::isNumber ( ) const
noexcept

predicate to determine if an Atom is of type Number

◆ isSymbol()

bool Atom::isSymbol ( ) const
noexcept

predicate to determine if an Atom is of type Symbol

◆ operator=()

Atom & Atom::operator= ( const Atom x)

Assign an Atom.

◆ operator==()

bool Atom::operator== ( const Atom right) const
noexcept

equality comparison based on type and value

Member Data Documentation

◆ numberValue

double Atom::numberValue

◆ stringValue

std::string Atom::stringValue

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