amath  1.8.5
Simple command line calculator
PrefsStatement Class Reference

Load or save preferences. More...

#include <prefs.h>

Inheritance diagram for PrefsStatement:
Collaboration diagram for PrefsStatement:

Public Member Functions

 PrefsStatement ()
 
 PrefsStatement (Symbol argument)
 
char * Execute ()
 
- Public Member Functions inherited from StatementNode
 StatementNode ()
 
 StatementNode (const char *text)
 
virtual ~StatementNode ()
 
NodeType GetNodeType ()
 
virtual SyntaxNodeGetNext ()
 
virtual char * GetTextCode ()
 
void Attach (SyntaxNode *node)
 
void Detach (SyntaxNode *node)
 
void Replace (SyntaxNode *n, SyntaxNode *x)
 
- Public Member Functions inherited from SyntaxNode
 SyntaxNode ()
 
virtual ~SyntaxNode ()
 
void SetFirstNode ()
 
bool GetFirstNode () const
 
SyntaxNodeGetParent () const
 
void SetParent (SyntaxNode *node)
 
virtual ReductionType GetReductionType ()
 
virtual void ResetIterator ()
 

Private Attributes

Symbol argument
 

Additional Inherited Members

- Protected Attributes inherited from StatementNode
char * statementText
 
- Protected Attributes inherited from SyntaxNode
CharBufferoutput
 
SyntaxNodeparent
 
SyntaxNodeiterator
 
bool leftBottom
 

Detailed Description

Load or save preferences.

Definition at line 40 of file prefs.h.

Constructor & Destructor Documentation

◆ PrefsStatement() [1/2]

PrefsStatement::PrefsStatement ( )

Definition at line 35 of file prefs.cpp.

References argument, and StatementNode::StatementNode().

Referenced by Parser::ParsePrefsStatement().

36  : StatementNode()
37 {
38  argument = Symbol(0);
39 }
StatementNode()
Definition: node.cpp:34
Symbol
Symbols generated by the Lexer.
Definition: symbol.h:41
Symbol argument
Definition: prefs.h:48
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PrefsStatement() [2/2]

PrefsStatement::PrefsStatement ( Symbol  argument)
explicit

Definition at line 41 of file prefs.cpp.

References argument.

Referenced by Parser::ParsePrefsStatement().

42 {
43  this->argument = argument;
44 }
Symbol argument
Definition: prefs.h:48
Here is the caller graph for this function:

Member Function Documentation

◆ Execute()

char * PrefsStatement::Execute ( )
virtual

Implements StatementNode.

Definition at line 46 of file prefs.cpp.

References argument, Program::Console, PreferencesBase::GetDescription(), PreferencesBase::GetDigits(), PreferencesBase::GetPrompt(), Program::Input, PreferencesBase::Keep(), PreferencesBase::Load(), Program::Output, Program::Preferences, PreferencesBase::Save(), NumeralSystem::SetDigits(), ConsoleBase::SetPrompt(), symload, and symsave.

47 {
48  bool success;
49 
50  if (argument == symsave)
51  {
52  success = Program->Preferences->Keep();
53  success &= Program->Preferences->Save();
54  return (success ? HELPPREFSAVE : HELPPREFNOSA);
55  }
56 
57  if (argument == symload)
58  {
59  success = Program->Preferences->Load();
60 
61  if (success)
62  {
66  return HELPPREFLOAD;
67  }
68 
69  return HELPPREFNOLO;
70  }
71 
73 }
char * GetDescription() const
Definition: preferences.cpp:60
Definition: symbol.h:84
Master control class.
Definition: program.h:55
virtual void SetDigits(unsigned int digits)=0
virtual bool Save()=0
virtual bool Keep()=0
virtual bool Load()=0
#define HELPPREFLOAD
Definition: text.h:97
#define HELPPREFNOLO
Definition: text.h:98
Definition: symbol.h:85
#define HELPPREFSAVE
Definition: text.h:99
#define HELPPREFNOSA
Definition: text.h:100
virtual void SetPrompt(const char *string)
Definition: console.cpp:214
char * GetPrompt() const
Symbol argument
Definition: prefs.h:48
class NumeralSystem * Input
Definition: program.h:75
int GetDigits() const
class ConsoleBase * Console
Definition: program.h:72
class PreferencesBase * Preferences
Definition: program.h:73
class NumeralSystem * Output
Definition: program.h:76
Here is the call graph for this function:

Member Data Documentation

◆ argument

Symbol PrefsStatement::argument
private

Definition at line 48 of file prefs.h.

Referenced by Execute(), and PrefsStatement().


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