Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
FileCommands Class Reference

Container for all the file system operations. More...

#include <FileCommands.hxx>

Public Member Functions

 FileCommands (Console *console)
 Constructor.
 

Private Member Functions

 DISALLOW_COPY_AND_ASSIGN (FileCommands)
 

Static Private Member Functions

static Console::CommandStatus cat_command (FILE *fp, int argc, const char *argv[], void *context)
 Concatinate files.
 
static Console::CommandStatus echo_command (FILE *fp, int argc, const char *argv[], void *context)
 Echo string.
 
static Console::CommandStatus rm_command (FILE *fp, int argc, const char *argv[], void *context)
 Remove files or directories.
 
static Console::CommandStatus ls_command (FILE *fp, int argc, const char *argv[], void *context)
 List directory contents.
 
static void ls_printline (FILE *fp, const char *name, struct stat *stat)
 Helper method to print a single "ls" line.
 

Detailed Description

Container for all the file system operations.

This class can be used by intantiating an instance of FileCommands and passing to the constructor a Console instance reference. The commands implemented by FileCommands will be added to the Console instance.

Definition at line 45 of file FileCommands.hxx.

Constructor & Destructor Documentation

◆ FileCommands()

FileCommands::FileCommands ( Console console)
inline

Constructor.

Parameters
consoleconsole instance to add the commands to

Definition at line 50 of file FileCommands.hxx.

Member Function Documentation

◆ cat_command()

static Console::CommandStatus FileCommands::cat_command ( FILE *  fp,
int  argc,
const char *  argv[],
void *  context 
)
inlinestaticprivate

Concatinate files.

Parameters
fpfile pointer to console
argcnumber of arguments including the command itself
argvarray of arguments starting with the command itself
contextunused
Returns
COMMAND_OK

Definition at line 66 of file FileCommands.hxx.

◆ echo_command()

static Console::CommandStatus FileCommands::echo_command ( FILE *  fp,
int  argc,
const char *  argv[],
void *  context 
)
inlinestaticprivate

Echo string.

Parameters
fpfile pointer to console
argcnumber of arguments including the command itself
argvarray of arguments starting with the command itself
contextunused
Returns
COMMAND_OK

Definition at line 109 of file FileCommands.hxx.

◆ ls_command()

static Console::CommandStatus FileCommands::ls_command ( FILE *  fp,
int  argc,
const char *  argv[],
void *  context 
)
inlinestaticprivate

List directory contents.

Parameters
fpfile pointer to console
argcnumber of arguments including the command itself
argvarray of arguments starting with the command itself
contextunused
Returns
COMMAND_OK

Definition at line 190 of file FileCommands.hxx.

◆ ls_printline()

static void FileCommands::ls_printline ( FILE *  fp,
const char *  name,
struct stat *  stat 
)
inlinestaticprivate

Helper method to print a single "ls" line.

Parameters
fpfile pointer to console
namename of the entry
statstatus information about the entry

Definition at line 244 of file FileCommands.hxx.

◆ rm_command()

static Console::CommandStatus FileCommands::rm_command ( FILE *  fp,
int  argc,
const char *  argv[],
void *  context 
)
inlinestaticprivate

Remove files or directories.

Parameters
fpfile pointer to console
argcnumber of arguments including the command itself
argvarray of arguments starting with the command itself
contextunused
Returns
COMMAND_OK

Definition at line 153 of file FileCommands.hxx.


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