SPH
|
#include "system/Platform.h"
#include "io/FileSystem.h"
#include "objects/containers/StaticArray.h"
#include "objects/wrappers/Finally.h"
#include <fcntl.h>
#include <libgen.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/times.h>
#include <unistd.h>
Go to the source code of this file.
Classes | |
class | CpuUsage |
Functions | |
NAMESPACE_SPH_BEGIN Expected< Path > | getExecutablePath () |
Returns the absolute path to the currently running executable. More... | |
Outcome | sendMail (const std::string &to, const std::string &from, const std::string &subject, const std::string &message) |
Sends a mail with given message. More... | |
Outcome | showNotification (const std::string &title, const std::string &message) |
Shows a notification using 'notify-send' command. More... | |
Outcome | sendPushNotification (const std::string &key, const std::string &title, const std::string &message) |
Sends a push notification to an Android device, using SimplePush API. More... | |
Expected< std::string > | getGitCommit (const Path &pathToGitRoot, const Size prev) |
Returns git commit hash of the current or older commit as string. More... | |
Optional< Float > | getCpuUsage () |
bool | isDebuggerPresent () |
Returns true if the program is running with attached debugger. More... | |
Definition at line 144 of file Platform.cpp.
NAMESPACE_SPH_BEGIN Expected<Path> getExecutablePath | ( | ) |
Returns the absolute path to the currently running executable.
Definition at line 15 of file Platform.cpp.
Returns git commit hash of the current or older commit as string.
If the git repository is not found or command fails, returns error message
pathToGitRoot | Path to where the source code is located |
prev | Number of commits into the history. For 0, the current commit is returned. |
Definition at line 63 of file Platform.cpp.
bool isDebuggerPresent | ( | ) |
Returns true if the program is running with attached debugger.
Definition at line 149 of file Platform.cpp.
Outcome sendMail | ( | const std::string & | to, |
const std::string & | from, | ||
const std::string & | subject, | ||
const std::string & | message | ||
) |
Sends a mail with given message.
Definition at line 26 of file Platform.cpp.
Outcome sendPushNotification | ( | const std::string & | key, |
const std::string & | title, | ||
const std::string & | message | ||
) |
Sends a push notification to an Android device, using SimplePush API.
Requires installed curl on the system.
key | SimplePush key of the Android device. |
title | Title of the notification. |
message | Notification message. |
Definition at line 53 of file Platform.cpp.
Outcome showNotification | ( | const std::string & | title, |
const std::string & | message | ||
) |
Shows a notification using 'notify-send' command.
The function is non-blocking, the notification disappears on timeout or when user hides it.
Definition at line 44 of file Platform.cpp.