amath  1.8.5
Simple command line calculator
NumeralSystem Class Referenceabstract

Base class for all numeral systems. More...

#include <ntext.h>

Inheritance diagram for NumeralSystem:
Collaboration diagram for NumeralSystem:

Public Member Functions

 NumeralSystem ()
 
virtual ~NumeralSystem ()
 
virtual const char * GetName ()=0
 
virtual const char * GetPrefix ()=0
 
virtual unsigned int GetDigits ()=0
 
virtual void SetDigits (unsigned int digits)=0
 
virtual const char GetFractionPoint ()=0
 
virtual void SetFractionPoint (const char fractionPoint)=0
 
virtual const char * GetText (Number *number)=0
 
virtual NumberParse (const char *text, unsigned int *length, char **end)=0
 
virtual NumberParse (const char *text)
 

Protected Attributes

CharBufferbuf
 

Detailed Description

Base class for all numeral systems.

More info on numeral systems is available at Wikipedia: https://wikipedia.org/wiki/Numeral_system

Definition at line 49 of file ntext.h.

Constructor & Destructor Documentation

◆ NumeralSystem()

NumeralSystem::NumeralSystem ( )

Definition at line 33 of file ntext.cpp.

References buf, CharBuffer::CharBuffer(), and CharBuffer::Empty().

34 {
35  buf = new CharBuffer();
36  buf->Empty();
37 }
CharBuffer * buf
Definition: ntext.h:65
void Empty()
Definition: charbuf.cpp:218
Encapsulate an character array which can be used as a string.
Definition: charbuf.h:44
Here is the call graph for this function:

◆ ~NumeralSystem()

NumeralSystem::~NumeralSystem ( )
virtual

Definition at line 39 of file ntext.cpp.

References buf.

40 {
41  delete buf;
42 }
CharBuffer * buf
Definition: ntext.h:65

Member Function Documentation

◆ GetDigits()

virtual unsigned int NumeralSystem::GetDigits ( )
pure virtual

Implemented in PositionalNumeralSystem.

Referenced by DigitsStatement::Execute(), OutputStatement::Execute(), and InputStatement::Execute().

Here is the caller graph for this function:

◆ GetFractionPoint()

virtual const char NumeralSystem::GetFractionPoint ( )
pure virtual

Implemented in PositionalNumeralSystem.

◆ GetName()

virtual const char* NumeralSystem::GetName ( )
pure virtual

Implemented in PositionalNumeralSystem.

Referenced by InputStatement::Execute(), and OutputStatement::Execute().

Here is the caller graph for this function:

◆ GetPrefix()

virtual const char* NumeralSystem::GetPrefix ( )
pure virtual

Implemented in PositionalNumeralSystem.

◆ GetText()

◆ Parse() [1/2]

virtual Number* NumeralSystem::Parse ( const char *  text,
unsigned int *  length,
char **  end 
)
pure virtual

Implemented in PositionalNumeralSystem.

Referenced by Lexer::GetDigitValue(), and Parse().

Here is the caller graph for this function:

◆ Parse() [2/2]

Number * NumeralSystem::Parse ( const char *  text)
virtual

Definition at line 44 of file ntext.cpp.

References Parse().

Referenced by Parser::ParseDigistStatement(), Parser::ParseNumber(), and Parser::ParseNumeralStatement().

45 {
46  unsigned int length;
47  char *end;
48  return Parse(text, &length, &end);
49 }
virtual Number * Parse(const char *text, unsigned int *length, char **end)=0
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetDigits()

virtual void NumeralSystem::SetDigits ( unsigned int  digits)
pure virtual

Implemented in PositionalNumeralSystem.

Referenced by DigitsStatement::Execute(), and PrefsStatement::Execute().

Here is the caller graph for this function:

◆ SetFractionPoint()

virtual void NumeralSystem::SetFractionPoint ( const char  fractionPoint)
pure virtual

Implemented in PositionalNumeralSystem.

Member Data Documentation

◆ buf


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