E-MailRelay
Public Member Functions | Static Public Member Functions | List of all members
G::BatchFile Class Reference

A class for reading and writing windows-style startup batch files containing a single command-line, optionally using "start". More...

#include <gbatchfile.h>

Public Member Functions

 BatchFile (const Path &)
 Constructor that reads from a file. More...
 
 BatchFile (const Path &, std::nothrow_t)
 Constructor that reads from a file that might be missing or empty. More...
 
 BatchFile (std::istream &, const std::string &stream_name=std::string())
 Constructor that reads from a stream. More...
 
std::string line () const
 Returns the main command-line from within the batchfile, with normalised spaces, without any "start" prefix, and including quotes. More...
 
std::string name () const
 Returns the "start" window name, if any. More...
 
const StringArrayargs () const
 Returns the startup command-line broken up into de-quoted pieces. More...
 
std::size_t lineArgsPos () const
 Returns the position in line() where the arguments start. More...
 

Static Public Member Functions

static void write (const Path &, const StringArray &args, const std::string &start_window_name=std::string())
 Writes a startup batch file, including a "start" prefix. More...
 

Detailed Description

A class for reading and writing windows-style startup batch files containing a single command-line, optionally using "start".

Definition at line 42 of file gbatchfile.h.

Constructor & Destructor Documentation

◆ BatchFile() [1/3]

G::BatchFile::BatchFile ( const Path path)
explicit

Constructor that reads from a file.

Definition at line 31 of file gbatchfile.cpp.

◆ BatchFile() [2/3]

G::BatchFile::BatchFile ( const Path path,
std::nothrow_t   
)

Constructor that reads from a file that might be missing or empty.

Definition at line 41 of file gbatchfile.cpp.

◆ BatchFile() [3/3]

G::BatchFile::BatchFile ( std::istream &  stream,
const std::string &  stream_name = std::string() 
)
explicit

Constructor that reads from a stream.

Definition at line 52 of file gbatchfile.cpp.

Member Function Documentation

◆ args()

const G::StringArray & G::BatchFile::args ( ) const

Returns the startup command-line broken up into de-quoted pieces.

The first item in the list will be the executable.

Definition at line 150 of file gbatchfile.cpp.

◆ line()

std::string G::BatchFile::line ( ) const

Returns the main command-line from within the batchfile, with normalised spaces, without any "start" prefix, and including quotes.

Definition at line 140 of file gbatchfile.cpp.

◆ lineArgsPos()

std::size_t G::BatchFile::lineArgsPos ( ) const

Returns the position in line() where the arguments start.

Definition at line 155 of file gbatchfile.cpp.

◆ name()

std::string G::BatchFile::name ( ) const

Returns the "start" window name, if any.

Definition at line 145 of file gbatchfile.cpp.

◆ write()

void G::BatchFile::write ( const Path path,
const StringArray args,
const std::string &  start_window_name = std::string() 
)
static

Writes a startup batch file, including a "start" prefix.

If the "start" window name is not supplied then it is derived from the command-line.

Definition at line 190 of file gbatchfile.cpp.


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