MCPcopy Create free account
hub / github.com/Xtra-Computing/thundersvm / OS

Class OS

include/thundersvm/util/log.h:1192–1232  ·  view source on GitHub ↗

@brief Operating System helper static class used internally. You should not use it.

Source from the content-addressed store, hash-verified

1190 };
1191/// @brief Operating System helper static class used internally. You should not use it.
1192 class OS : base::StaticClass {
1193 public:
1194#if ELPP_OS_WINDOWS
1195 /// @brief Gets environment variables for Windows based OS.
1196 /// We are not using <code>getenv(const char*)</code> because of CRT deprecation
1197 /// @param varname Variable name to get environment variable value for
1198 /// @return If variable exist the value of it otherwise nullptr
1199 static const char* getWindowsEnvironmentVariable(const char* varname);
1200#endif // ELPP_OS_WINDOWS
1201#if ELPP_OS_ANDROID
1202 /// @brief Reads android property value
1203 static std::string getProperty(const char* prop);
1204
1205 /// @brief Reads android device name
1206 static std::string getDeviceName(void);
1207#endif // ELPP_OS_ANDROID
1208
1209 /// @brief Runs command on terminal and returns the output.
1210 ///
1211 /// @detail This is applicable only on unix based systems, for all other OS, an empty string is returned.
1212 /// @param command Bash command
1213 /// @return Result of bash output or empty string if no result found.
1214 static const std::string getBashOutput(const char* command);
1215
1216 /// @brief Gets environment variable. This is cross-platform and CRT safe (for VC++)
1217 /// @param variableName Environment variable name
1218 /// @param defaultVal If no environment variable or value found the value to return by default
1219 /// @param alternativeBashCommand If environment variable not found what would be alternative bash command
1220 /// in order to look for value user is looking for. E.g, for 'user' alternative command will 'whoami'
1221 static std::string getEnvironmentVariable(const char* variableName, const char* defaultVal,
1222 const char* alternativeBashCommand = nullptr);
1223 /// @brief Gets current username.
1224 static std::string currentUser(void);
1225
1226 /// @brief Gets current host name or computer name.
1227 ///
1228 /// @detail For android systems this is device name with its manufacturer and model seperated by hyphen
1229 static std::string currentHost(void);
1230 /// @brief Whether or not terminal supports colors
1231 static bool termSupportsColor(void);
1232 };
1233/// @brief Contains utilities for cross-platform date/time. This class make use of el::base::utils::Str
1234 class DateTime : base::StaticClass {
1235 public:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected