Faker C++
Loading...
Searching...
No Matches
faker::system Namespace Reference

Classes

struct  CronOptions
 
struct  NetworkInterfaceOptions
 

Enumerations

enum class  FileType {
  Application , Audio , Image , Text ,
  Video
}
 

Functions

FAKER_CXX_EXPORT std::string fileName ()
 Returns a random file name with extension.
 
FAKER_CXX_EXPORT std::string fileExtension (const std::optional< FileType > &mimeType=std::nullopt)
 Returns a file extension.
 
FAKER_CXX_EXPORT std::string commonFileName ()
 Returns a random file name with a given extension or a commonly used extension.
 
FAKER_CXX_EXPORT std::string_view commonFileExtension ()
 Returns a commonly used file extension.
 
FAKER_CXX_EXPORT std::string_view mimeType ()
 Returns a mime-type.
 
FAKER_CXX_EXPORT std::string_view fileType ()
 Returns a commonly used file type.
 
FAKER_CXX_EXPORT std::string_view directoryPath ()
 Returns a directory path.
 
FAKER_CXX_EXPORT std::string filePath ()
 Returns a file path.
 
FAKER_CXX_EXPORT std::string semver ()
 Returns a semantic version.
 
FAKER_CXX_EXPORT std::string networkInterface (const std::optional< NetworkInterfaceOptions > &options={})
 Returns a random network interface.
 
FAKER_CXX_EXPORT std::string cron (const CronOptions &options={})
 Returns a random cron expression.
 

Enumeration Type Documentation

◆ FileType

enum class faker::system::FileType
strong
Enumerator
Application 
Audio 
Image 
Text 
Video 

Function Documentation

◆ commonFileExtension()

FAKER_CXX_EXPORT std::string_view faker::system::commonFileExtension ( )

Returns a commonly used file extension.

Returns
A commonly used file extension.
FAKER_CXX_EXPORT std::string_view commonFileExtension()
Returns a commonly used file extension.

◆ commonFileName()

FAKER_CXX_EXPORT std::string faker::system::commonFileName ( )

Returns a random file name with a given extension or a commonly used extension.

Returns
A random file name with a given extension or a commonly used extension.
FAKER_CXX_EXPORT std::string commonFileName()
Returns a random file name with a given extension or a commonly used extension.

◆ cron()

FAKER_CXX_EXPORT std::string faker::system::cron ( const CronOptions & options = {})

Returns a random cron expression.

Parameters
optionsThe options to use. Defaults to an empty options structure
See also
CronOptions.h.
Parameters
options.includeYearWhether to include a year in the generated expression. Defaults to `false`.
options.includeNonStandardWhether to include a @yearly, @monthly, @daily, etc text labels in the generated expression. Defaults to `false`.
Returns
A random cron expression.
system.cron() // "22 * ? * ?"
CronOptions options
options.includeYear = true
std::string cronExpr = faker::system::cron(options) // "16 14 * 11 2 2038"
CronOptions options
options.includeYear = false
std::string cronExpr = faker::system::cron(options) // "16 14 * 11 2"
CronOptions options
options.includeNonStandard = false
std::string cronExpr = faker::system::cron(options) // 34 2 ? 8 *
CronOptions options
options.includeNonStandard = true
std::string cronExpr = faker::system::cron(options) // "@reboot"
FAKER_CXX_EXPORT std::string cron(const CronOptions &options={})
Returns a random cron expression.
Definition system.h:21
bool includeNonStandard
Definition system.h:23
bool includeYear
Definition system.h:22

◆ directoryPath()

FAKER_CXX_EXPORT std::string_view faker::system::directoryPath ( )

Returns a directory path.

Returns
A directory path.
FAKER_CXX_EXPORT std::string_view directoryPath()
Returns a directory path.

◆ fileExtension()

FAKER_CXX_EXPORT std::string faker::system::fileExtension ( const std::optional< FileType > & mimeType = std::nullopt)

Returns a file extension.

Parameters
mimeTypevalue of MimeType enum.
Returns
A file extension.
faker::system::fileExtension(MimeType::Image) // "png"
FAKER_CXX_EXPORT std::string fileExtension(const std::optional< FileType > &mimeType=std::nullopt)
Returns a file extension.

◆ fileName()

FAKER_CXX_EXPORT std::string faker::system::fileName ( )

Returns a random file name with extension.

Returns
Random file name with extension.
faker::system::fileName() // "injustice.mpeg"
FAKER_CXX_EXPORT std::string fileName()
Returns a random file name with extension.

◆ filePath()

FAKER_CXX_EXPORT std::string faker::system::filePath ( )

Returns a file path.

Returns
A file path.
faker::system::filePath() // "/usr/local/src/money.dotx"
FAKER_CXX_EXPORT std::string filePath()
Returns a file path.

◆ fileType()

FAKER_CXX_EXPORT std::string_view faker::system::fileType ( )

Returns a commonly used file type.

Returns
A commonly used file type.
FAKER_CXX_EXPORT std::string_view fileType()
Returns a commonly used file type.

◆ mimeType()

FAKER_CXX_EXPORT std::string_view faker::system::mimeType ( )

Returns a mime-type.

Returns
A mime-type.
faker::system::mimeType() // "video/vnd.vivo"
FAKER_CXX_EXPORT std::string_view mimeType()
Returns a mime-type.

◆ networkInterface()

FAKER_CXX_EXPORT std::string faker::system::networkInterface ( const std::optional< NetworkInterfaceOptions > & options = {})

Returns a random network interface.

Parameters
optionsThe options to use. Defaults to an empty options structure
See also
NetworkInterfaceOptions.h.
Parameters
options.interfaceTypeThe interface type. Can be one of `en`, `wl`, `ww`.
options.interfaceSchemaThe interface schema. Can be one of `index`, `slot`, `mac`, `pci`.
Returns
A random network interface.
options.interfaceType = "wl";
faker::system::networkInterface(options) // "wlsf4d2"
options.interfaceSchema = "mac";
faker::system::networkInterface(options) // "enxd17705ed394f"
options.interfaceType = "en";
options.interfaceSchema = "pci";
faker::system::networkInterface(options) // "enp1s9f1d2"
FAKER_CXX_EXPORT std::string networkInterface(const std::optional< NetworkInterfaceOptions > &options={})
Returns a random network interface.
Definition airline.h:9

◆ semver()

FAKER_CXX_EXPORT std::string faker::system::semver ( )

Returns a semantic version.

Returns
A semantic version.
FAKER_CXX_EXPORT std::string semver()
Returns a semantic version.