libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
Application Class Reference

Application-wide state for the promeki library. More...

#include <application.h>

Inheritance diagram for Application:

Public Member Functions

 Application (int argc, char **argv)
 Constructs and registers an Application instance.
 
 ~Application ()
 Destroys the Application and clears the current instance.
 
 Application (const Application &)=delete
 
 Application (Application &&)=delete
 
Applicationoperator= (const Application &)=delete
 
Applicationoperator= (Application &&)=delete
 

Static Public Member Functions

static const StringListarguments ()
 Returns the command-line arguments.
 
static const UUIDappUUID ()
 Returns the application UUID used as a namespace for UUID v3/v5 generation.
 
static void setAppUUID (const UUID &uuid)
 Sets the application UUID used as a namespace for UUID v3/v5 generation.
 
static const StringappName ()
 Returns the application name used for UUID v3/v5 generation.
 
static void setAppName (const String &name)
 Sets the application name used for UUID v3/v5 generation.
 
static ThreadmainThread ()
 Returns the Thread object for the main (application) thread.
 
static EventLoopmainEventLoop ()
 Returns the EventLoop for the main thread.
 
static IODevicestdinDevice ()
 Returns an IODevice wrapping C stdin.
 
static IODevicestdoutDevice ()
 Returns an IODevice wrapping C stdout.
 
static IODevicestderrDevice ()
 Returns an IODevice wrapping C stderr.
 

Detailed Description

Application-wide state for the promeki library.

Provides global application identity (name, UUID, command-line arguments) used by other parts of the library such as UUID v3/v5 generation.

All accessors are static and work whether or not an instance has been constructed. Optionally, an Application object can be created on the stack in main() to capture argc/argv and register as the current instance (similar to QApplication):

int main(int argc, char **argv) {
// ...
}
Application-wide state for the promeki library.
Definition application.h:47
static void setAppName(const String &name)
Sets the application name used for UUID v3/v5 generation.
Dynamic array container wrapping std::vector.
Definition list.h:40

If no instance is created, the static accessors operate on default-constructed internal state.

Constructor & Destructor Documentation

◆ Application()

Application::Application ( int  argc,
char **  argv 
)

Constructs and registers an Application instance.

Parameters
argcArgument count from main().
argvArgument vector from main().

Stores the command-line arguments and sets this as the current Application. Only one instance should exist at a time.

Member Function Documentation

◆ appName()

static const String & Application::appName ( )
static

Returns the application name used for UUID v3/v5 generation.

Returns
The application name string.

◆ appUUID()

static const UUID & Application::appUUID ( )
static

Returns the application UUID used as a namespace for UUID v3/v5 generation.

Returns
The application namespace UUID.

◆ arguments()

static const StringList & Application::arguments ( )
static

Returns the command-line arguments.

Returns
The arguments passed to the constructor, or an empty list if no instance was created.

◆ mainEventLoop()

static EventLoop * Application::mainEventLoop ( )
static

Returns the EventLoop for the main thread.

Returns
The main thread's EventLoop, or nullptr if the user hasn't created one yet.

◆ mainThread()

static Thread * Application::mainThread ( )
static

Returns the Thread object for the main (application) thread.

Returns
The main thread, or nullptr if no Application was constructed.

◆ setAppName()

static void Application::setAppName ( const String name)
static

Sets the application name used for UUID v3/v5 generation.

Parameters
nameThe application name to use.

◆ setAppUUID()

static void Application::setAppUUID ( const UUID uuid)
static

Sets the application UUID used as a namespace for UUID v3/v5 generation.

Parameters
uuidThe namespace UUID to use.

◆ stderrDevice()

static IODevice * Application::stderrDevice ( )
static

Returns an IODevice wrapping C stderr.

The returned device is a lazy-initialized static local FileIODevice opened for WriteOnly. It does not own the FILE pointer.

Returns
A non-owning IODevice for stderr.

◆ stdinDevice()

static IODevice * Application::stdinDevice ( )
static

Returns an IODevice wrapping C stdin.

The returned device is a lazy-initialized static local FileIODevice opened for ReadOnly. It does not own the FILE pointer.

Returns
A non-owning IODevice for stdin.

◆ stdoutDevice()

static IODevice * Application::stdoutDevice ( )
static

Returns an IODevice wrapping C stdout.

The returned device is a lazy-initialized static local FileIODevice opened for WriteOnly. It does not own the FILE pointer.

Returns
A non-owning IODevice for stdout.

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