Deskflow 1.22.0.197
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
ArchDaemonNone Class Reference

Dummy implementation of IArchDaemon. More...

#include <ArchDaemonNone.h>

Inheritance diagram for ArchDaemonNone:
Collaboration diagram for ArchDaemonNone:

Public Member Functions

 ArchDaemonNone ()=default
 ~ArchDaemonNone () override=default
void installDaemon (const char *name, const char *description, const char *pathname, const char *commandLine, const char *dependencies) override
 Install daemon.
void uninstallDaemon (const char *name) override
 Uninstall daemon.
int daemonize (const char *name, DaemonFunc const &func) override
 Daemonize the process.
bool canInstallDaemon (const char *name) override
 Check if user has permission to install the daemon.
bool isDaemonInstalled (const char *name) override
 Check if the daemon is installed.
void installDaemon () override
 Install daemon.
void uninstallDaemon () override
 Uninstall daemon.
std::string commandLine () const override
 Get the command line.
Public Member Functions inherited from IArchDaemon
Public Member Functions inherited from IInterface
virtual ~IInterface ()=default
 Interface destructor does nothing.

Additional Inherited Members

Public Types inherited from IArchDaemon
using DaemonFunc = std::function<int(int, const char **)>

Detailed Description

Dummy implementation of IArchDaemon.

This class implements IArchDaemon for a platform that does not have daemons. The install and uninstall functions do nothing, the query functions return false, and daemonize() simply calls the passed function and returns its result.

Constructor & Destructor Documentation

◆ ArchDaemonNone()

ArchDaemonNone::ArchDaemonNone ( )
default

◆ ~ArchDaemonNone()

ArchDaemonNone::~ArchDaemonNone ( )
overridedefault

Member Function Documentation

◆ canInstallDaemon()

bool ArchDaemonNone::canInstallDaemon ( const char * name)
overridevirtual

Check if user has permission to install the daemon.

Returns true iff the caller has permission to install or uninstall the daemon. Note that even if this method returns true it's possible that installing/uninstalling the service may still fail. This method ignores whether or not the service is already installed.

Implements IArchDaemon.

◆ commandLine()

std::string ArchDaemonNone::commandLine ( ) const
overridevirtual

Get the command line.

Gets the command line with which the application was started.

Implements IArchDaemon.

◆ daemonize()

int ArchDaemonNone::daemonize ( const char * name,
DaemonFunc const & func )
overridevirtual

Daemonize the process.

Daemonize. Throw XArchDaemonFailed on error. name is the name of the daemon. Once daemonized, func is invoked and daemonize returns when and what it does.

Exactly what happens when daemonizing depends on the platform.

  • unix: Detaches from terminal. func gets passed one argument, the name passed to daemonize().
  • win32: Becomes a service. Argument 0 is the name of the service and the rest are the arguments passed to StartService(). func is only called when the service is actually started. func must call ArchMiscWindows::runDaemon() to finally becoming a service. The runFunc function passed to runDaemon() must call ArchMiscWindows::daemonRunning(true) when it enters the main loop (i.e. after initialization) and ArchMiscWindows::daemonRunning(false) when it leaves the main loop. The stopFunc function passed to runDaemon() is called when the daemon must exit the main loop and it must cause runFunc to return. func should return what runDaemon() returns. func or runFunc can call ArchMiscWindows::daemonFailed() to indicate startup failure.

Implements IArchDaemon.

Reimplemented in ArchDaemonUnix.

◆ installDaemon() [1/2]

void ArchDaemonNone::installDaemon ( )
overridevirtual

Install daemon.

Installs the default daemon.

Implements IArchDaemon.

◆ installDaemon() [2/2]

void ArchDaemonNone::installDaemon ( const char * name,
const char * description,
const char * pathname,
const char * commandLine,
const char * dependencies )
overridevirtual

Install daemon.

Install a daemon. name is the name of the daemon passed to the system and description is a short human readable description of the daemon. pathname is the path to the daemon executable. commandLine should not include the name of program as the first argument. If allUsers is true then the daemon will be installed to start at boot time, otherwise it will be installed to start when the current user logs in. If dependencies is not nullptr then it's a concatenation of NUL terminated other daemon names followed by a NUL; the daemon will be configured to startup after the listed daemons. Throws an XArchDaemon exception on failure.

Implements IArchDaemon.

◆ isDaemonInstalled()

bool ArchDaemonNone::isDaemonInstalled ( const char * name)
overridevirtual

Check if the daemon is installed.

Returns true iff the daemon is installed.

Implements IArchDaemon.

◆ uninstallDaemon() [1/2]

void ArchDaemonNone::uninstallDaemon ( )
overridevirtual

Uninstall daemon.

Uninstalls the default daemon.

Implements IArchDaemon.

◆ uninstallDaemon() [2/2]

void ArchDaemonNone::uninstallDaemon ( const char * name)
overridevirtual

Uninstall daemon.

Uninstall a daemon. Throws an XArchDaemon on failure.

Implements IArchDaemon.


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