ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::lang::system Namespace Reference

Description:

This is the reference documentation of sub-namespace system of module ALib BaseCamp.

Type Index:

class  CalendarDate
 
class  CalendarDateTime
 
class  CalendarDuration
 
class  Console
 This class provides system dependent features in respect the console attached to a process. More...
 
struct  EnvironmentVariables
 
class  Path
 
class  ProcessInfo
 This class represents process information. More...
 

Type Definition Index:

using CPathString = strings::TCString<PathCharType>
 The string-type used with this ALib Module.
 
using PathCharType = std::filesystem::path::value_type
 
using PathString = strings::TString<PathCharType>
 The string-type used with this ALib Module.
 
using PathStringMA = strings::TAString<PathCharType, PoolAllocator >
 A mono-allocated string representing a path.
 
using PathStringPA = strings::TAString<PathCharType, PoolAllocator >
 A pool-allocated string representing a path.
 
using PathSubstring = strings::TSubstring<PathCharType>
 The string-type used with this ALib Module.
 

Enumeration Index:

enum class  SystemErrors {
  UNKNOWN = -1 , OK = 0 , None = 0 , eperm = EPERM ,
  enoent = ENOENT , esrch = ESRCH , eintr = EINTR , eio = EIO ,
  enxio = ENXIO , e2Big = E2BIG , enoexec = ENOEXEC , ebadf = EBADF ,
  echild = ECHILD , eagain = EAGAIN , enomem = ENOMEM , eacces = EACCES ,
  efault = EFAULT , ebusy = EBUSY , eexist = EEXIST , exdev = EXDEV ,
  enodev = ENODEV , enotdir = ENOTDIR , eisdir = EISDIR , enfile = ENFILE ,
  emfile = EMFILE , enotty = ENOTTY , efbig = EFBIG , enospc = ENOSPC ,
  espipe = ESPIPE , erofs = EROFS , emlink = EMLINK , epipe = EPIPE ,
  edom = EDOM , edeadlk = EDEADLK , enametoolong = ENAMETOOLONG , enolck = ENOLCK ,
  enosys = ENOSYS , enotempty = ENOTEMPTY , einval = EINVAL , erange = ERANGE ,
  eilseq = EILSEQ , struncate = STRUNCATE , eaddrinuse = EADDRINUSE , eaddrnotavail = EADDRNOTAVAIL ,
  eafnosupport = EAFNOSUPPORT , ealready = EALREADY , ebadmsg = EBADMSG , ecanceled = ECANCELED ,
  econnaborted = ECONNABORTED , econnrefused = ECONNREFUSED , econnreset = ECONNRESET , edestaddrreq = EDESTADDRREQ ,
  ehostunreach = EHOSTUNREACH , eidrm = EIDRM , einprogress = EINPROGRESS , eisconn = EISCONN ,
  eloop = ELOOP , emsgsize = EMSGSIZE , enetdown = ENETDOWN , enetreset = ENETRESET ,
  enetunreach = ENETUNREACH , enobufs = ENOBUFS , enodata = ENODATA , enolink = ENOLINK ,
  enomsg = ENOMSG , enoprotoopt = ENOPROTOOPT , enosr = ENOSR , enostr = ENOSTR ,
  enotconn = ENOTCONN , enotrecoverable = ENOTRECOVERABLE , enotsock = ENOTSOCK , enotsup = ENOTSUP ,
  eopnotsupp = EOPNOTSUPP , eother = 131 , eoverflow = EOVERFLOW , eownerdead = EOWNERDEAD ,
  eproto = EPROTO , eprotonosupport = EPROTONOSUPPORT , eprototype = EPROTOTYPE , etime = ETIME ,
  etimedout = ETIMEDOUT , etxtbsy = ETXTBSY , ewouldblock = EWOULDBLOCK
}
 Denotes result values returned by system functions (glibc, etc). More...
 
enum class  SystemExceptions { OK }
 Denotes exceptions thrown by classes of namespace alib::lang::system. More...
 
enum class  SystemFolders {
  Root , Current , Home , HomeConfig ,
  Module , Temp , VarTemp
}
 

Function Index:

Exception CreateSystemException (const CallerInfo &ci, int errNo)
 
ALIB_API void FFormat_DateTime (const Box &self, const String &formatSpec, NumberFormat &nf, AString &target)
 

Variable Index:

static constexpr PathCharType DIRECTORY_SEPARATOR = '/'
 The standard path separator character. Defaults to '\' on Windows OS, '/' else.
 
static constexpr PathString EMPTY_PATH
 An empty path string.
 
static constexpr PathString NULL_PATH
 A nulled path string.
 

Type Definition Details:

◆ CPathString

The string-type used with this ALib Module.

Definition at line 74 of file path.hpp.

◆ PathCharType

using PathCharType = std::filesystem::path::value_type

The character type that this ALib Module uses for String representations. This is taken from the C++ standard library.

Definition at line 21 of file path.hpp.

◆ PathString

The string-type used with this ALib Module.

Definition at line 71 of file path.hpp.

◆ PathStringMA

A mono-allocated string representing a path.

Definition at line 80 of file path.hpp.

◆ PathStringPA

A pool-allocated string representing a path.

Definition at line 83 of file path.hpp.

◆ PathSubstring

The string-type used with this ALib Module.

Definition at line 77 of file path.hpp.

Enumeration Details:

◆ SystemErrors

enum class SystemErrors
strong

Denotes result values returned by system functions (glibc, etc).

Enumerator
UNKNOWN 

Unknown Error.

OK 

No Error.

None 

No Error (alias for OK)

eperm 

1

enoent 

2

esrch 

3

eintr 

4

eio 

5

enxio 

6

e2Big 

7

enoexec 

8

ebadf 

9

echild 

10

eagain 

11

enomem 

12

eacces 

13

efault 

14

ebusy 

16

eexist 

17

exdev 

18

enodev 

19

enotdir 

20

eisdir 

21

enfile 

23

emfile 

24

enotty 

25

efbig 

27

enospc 

28

espipe 

29

erofs 

30

emlink 

31

epipe 

32

edom 

33

edeadlk 

36

enametoolong 

38

enolck 

39

enosys 

40

enotempty 

41

einval 

22

erange 

34

eilseq 

42

struncate 

80

eaddrinuse 

100

eaddrnotavail 

101

eafnosupport 

102

ealready 

103

ebadmsg 

104

ecanceled 

105

econnaborted 

106

econnrefused 

107

econnreset 

108

edestaddrreq 

109

ehostunreach 

110

eidrm 

111

einprogress 

112

eisconn 

113

eloop 

114

emsgsize 

115

enetdown 

116

enetreset 

117

enetunreach 

118

enobufs 

119

enodata 

120

enolink 

121

enomsg 

122

enoprotoopt 

123

enosr 

124

enostr 

125

enotconn 

126

enotrecoverable 

127

enotsock 

128

enotsup 

129

eopnotsupp 

130

eother 

131

eoverflow 

132

eownerdead 

133

eproto 

134

eprotonosupport 

135

eprototype 

136

etime 

137

etimedout 

138

etxtbsy 

139

ewouldblock 

140

Definition at line 25 of file systemerrors.hpp.

◆ SystemExceptions

enum class SystemExceptions
strong

Denotes exceptions thrown by classes of namespace alib::lang::system.

Enumerator
OK 

Everything is fine.

Definition at line 278 of file systemerrors.hpp.

◆ SystemFolders

enum class SystemFolders
strong

Enumerates special system folders like "home", "temp", "config", etc. This enumeration is primarily used with class Path and this documentation refers to this type.

Enumerator
Root 

The root directory .

Current 

The current directory of the process.

Home 

The user's home directory.

HomeConfig 

The user's configuration directory. This is evaluated as follows:

  • Using environment variable HOME (under WindowsOS a combination of HOMEDRIVE and HOMEPATH), the home directory is determined.
  • If within this directory ".config" exists, it is used, otherwise
  • if within this the directories "AppData/Roaming" exist, this is used.
Module 

The directory of the executable of the process.

Temp 

A directory to be used for creation of temporary files.

  • On GNU/Linux OS this defaults to /tmp.
  • On Windows OS, environment variables TMP and TEMP are evaluated.

If the directory does not exist, then (on all OS), a new directory named ".tmp" is created in the user's home directory and returned (if not existent already). If this fails, the home directory itself is returned.

Note
With the potential creation of the directory ".tmp" in the user's home directory, a small readme.txt file is created containing the name of the running application and the reason of the creation.

To overrule this behavior, public static variable Path::tempDirEvaluatedOnce may be set arbitrarily before using this enum value.

VarTemp 

A directory to be used for creation of temporary files that survives reboots of the host machine.

  • On GNU/Linux OS this defaults to /var/tmp.
  • On Windows OS, environment variables TMP and TEMP are evaluated (same as with SystemFolders::Temp).

If the directory does not exist, then (on all OS), a new directory named ".var.tmp" is created in the user's home directory and returned (if not existent already). If this fails, the home directory itself is returned.

Note
With the potential creation of the directory ".var.tmp" in the user's home directory, a small readme.txt file is created, containing the name of the running application and the reason of the creation.

To overrule this behavior, public static variable Path::varTempDirEvaluatedOnce may be set arbitrarily before using this enum value.

Definition at line 121 of file path.hpp.

Function Details:

◆ CreateSystemException()

ALIB_API Exception CreateSystemException ( const CallerInfo & ci,
int errNo )

Namespace function that creates an according Exception to a corresponding system error number.

The small challenge here is that arbitrary error numbers (of an unknown) type might occur, that do not have a corresponding enum record. SystemErrors::UNKNOWN is thrown and only the number is displayed in the description text.

Parameters
ciThe source location of the exception creation.
errNoThe system's error number.
Returns
An exception object.

Definition at line 1092 of file basecamp.cpp.

Here is the call graph for this function:

◆ FFormat_DateTime()

ALIB_API void FFormat_DateTime ( const Box & self,
const String & formatSpec,
NumberFormat & nf,
AString & target )

Implementation of FFormat for boxable type DateTime.
Writes the content of box (which is of type DateTime) to the given AString object target using a local instance of class CalendarDateTime and its method CalendarDateTime::Format.

If parameter formatSpec is empty, a default format string defined by string resource of key "FMTDT" is used.

Note
This interface implementation is only available if modules ALib BaseCamp and ALib Time are included in the library distribution.
Parameters
selfThe box that the function was invoked on.
formatSpecThe specification of the format.
nfA copy of the number format of the formatter (allowed to be modified).
targetThe AString object receiving the formatted string.

Variable Details:

◆ DIRECTORY_SEPARATOR

PathCharType DIRECTORY_SEPARATOR = '/'
staticconstexpr

The standard path separator character. Defaults to '\' on Windows OS, '/' else.

Definition at line 99 of file path.hpp.

◆ EMPTY_PATH

PathString EMPTY_PATH
staticconstexpr

An empty path string.

Definition at line 90 of file path.hpp.

◆ NULL_PATH

PathString NULL_PATH
staticconstexpr

A nulled path string.

Definition at line 87 of file path.hpp.