LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SystemInfo Class Referencefinal

This class provides some methods to get information from the operating system. More...

#include <systeminfo.h>

+ Collaboration diagram for SystemInfo:

Public Member Functions

 SystemInfo ()=delete
 

Static Public Member Functions

static const QString & getUsername () noexcept
 Get the name of the user which is logged in (like "homer") More...
 
static const QString & getFullUsername () noexcept
 Get the full name of the user which is logged in (like "Homer Simpson") More...
 
static const QString & getHostname () noexcept
 Get the hostname of the computer (like "homer-workstation") More...
 
static bool isProcessRunning (qint64 pid)
 Check whether a process with a given PID is running or not. More...
 
static QString getProcessNameByPid (qint64 pid)
 Get the process name of a given PID. More...
 

Static Private Attributes

static QString sUsername
 
static QString sFullUsername
 
static QString sHostname
 

Detailed Description

This class provides some methods to get information from the operating system.

For example, this class is used to get the name of the user which is logged in and the hostname of the computer to create a lock file (see class #DirectoryLock).

Note
Only static methods are available. You cannot create objects of this class.
Author
ubruhin
Date
2014-07-28

Constructor & Destructor Documentation

SystemInfo ( )
delete

Member Function Documentation

const QString & getUsername ( )
staticnoexcept

Get the name of the user which is logged in (like "homer")

Returns
The username (in case of an error, this string can be empty!)

+ Here is the caller graph for this function:

const QString & getFullUsername ( )
staticnoexcept

Get the full name of the user which is logged in (like "Homer Simpson")

Returns
The full user name (can be empty)
Todo:
The implementation of this method is very ugly...

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const QString & getHostname ( )
staticnoexcept

Get the hostname of the computer (like "homer-workstation")

Returns
The hostname (in case of an error, this string can be empty!)

+ Here is the caller graph for this function:

bool isProcessRunning ( qint64  pid)
static

Check whether a process with a given PID is running or not.

Parameters
pidThe process ID to query
Returns
True if the process is running, fals if not
Exceptions
ExceptionIn case of an error.

+ Here is the caller graph for this function:

QString getProcessNameByPid ( qint64  pid)
static

Get the process name of a given PID.

Parameters
pidThe process ID (may be a running process or not)
Returns
The name of the given process ID, or an empty string if no process with the given PID exists.
Exceptions
ExceptionIn case of an error.

+ Here is the caller graph for this function:

Member Data Documentation

QString sUsername
staticprivate
QString sFullUsername
staticprivate
QString sHostname
staticprivate

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