amath  1.8.5
Simple command line calculator
ListStatement Class Reference

#include <list.h>

Inheritance diagram for ListStatement:
Collaboration diagram for ListStatement:

Public Member Functions

 ListStatement ()
 
 ListStatement (const char *directory)
 
 ~ListStatement ()
 
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

char * directory
 

Additional Inherited Members

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

Detailed Description

Definition at line 35 of file list.h.

Constructor & Destructor Documentation

◆ ListStatement() [1/2]

ListStatement::ListStatement ( )

Definition at line 36 of file list.cpp.

References directory, and StatementNode::StatementNode().

Referenced by Parser::ParseListStatement().

36  :
38 {
39  directory = nullptr;
40 }
char * directory
Definition: list.h:44
StatementNode()
Definition: node.cpp:34
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ListStatement() [2/2]

ListStatement::ListStatement ( const char *  directory)
explicit

Definition at line 42 of file list.cpp.

References AllocAndCopy(), directory, and StatementNode::StatementNode().

Referenced by Parser::ParseListStatement().

42  :
44 {
46 }
unsigned int AllocAndCopy(char **destination, const char *source)
Allocate memory and copy a string into the array.
Definition: alloccpy.c:40
char * directory
Definition: list.h:44
StatementNode()
Definition: node.cpp:34
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~ListStatement()

ListStatement::~ListStatement ( )

Definition at line 48 of file list.cpp.

References directory.

49 {
50  if (directory != nullptr)
51  {
52  delete [] directory;
53  }
54 }
char * directory
Definition: list.h:44

Member Function Documentation

◆ Execute()

char * ListStatement::Execute ( )
virtual

Implements StatementNode.

Definition at line 56 of file list.cpp.

References directory, Program::Filesystem, CharBuffer::GetString(), FilesystemBase::ListDirectory(), and SyntaxNode::output.

57 {
59  if (text == nullptr)
60  {
61  return static_cast<char*>(MSGNODIR);
62  }
63 
64  delete output;
65  output = text;
66  return text->GetString();
67 }
Master control class.
Definition: program.h:55
#define MSGNODIR
Definition: text.h:101
char * GetString() const
Definition: charbuf.cpp:306
class FilesystemBase * Filesystem
Definition: program.h:74
virtual CharBuffer * ListDirectory(const char *path)=0
char * directory
Definition: list.h:44
CharBuffer * output
Definition: nodes.h:85
Encapsulate an character array which can be used as a string.
Definition: charbuf.h:44
Here is the call graph for this function:

Member Data Documentation

◆ directory

char* ListStatement::directory
private

Definition at line 44 of file list.h.

Referenced by Execute(), ListStatement(), and ~ListStatement().


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