|
Veethree D7 SDK
|
Utility functions and templates for common operations.
Concepts | |
| concept | vsdk::utils::StringLike |
| Type constraint for string-like types. | |
Functions | |
| std::string | vsdk::utils::path_separator (const StringLike auto &base) |
| Utility for prepending OS-specific path separator. Needed for the path_join function. | |
| template<StringLike... Components> | |
| std::string | vsdk::utils::path_join (const StringLike auto &base, Components... comp) |
| Utility to construct OS-aware paths. Similar to Python's os.path.join(). On Windows the path components will be joined with backslashes (), everywhere else with forward slashed (/). | |
| std::errc | vsdk::utils::file_remove (const std::string &path) |
| Remove a file. | |
| std::errc | vsdk::utils::mkdir (const std::string &path) |
| Make a directory. This behaves as mkdir -p. It will create intermediary path components automatically. | |
| std::errc | vsdk::utils::rmdir (const std::string &path) |
| Delete a directory recursively. Behaves as rm -rf. | |
| std::string | vsdk::utils::canonical_path (const std::string &path) |
| Get the canonical path. The canonical path will not contain dot, dotdot or symlinks. | |
| std::string | vsdk::utils::temp_directory_path () |
| Get the path for the temp directory on the OS. Similar semantics to std::filesystem::temp_directory_path. | |
| bool | vsdk::utils::file_exists (const std::string &path) |
| Utility to check if a path exists. Same semantics as std::filesystem::exists, but won't do character conversion on Windows. | |
| template<typename... Args> | |
| void | vsdk::utils::print (fmt::format_string< Args... > fmt, Args &&...args) noexcept |
| Exception-safe fmt::print wrapper. | |
| template<typename T, size_t N> | |
| T & | vsdk::utils::at (T(&arr)[N], size_t index) |
| Return a reference to an array element. | |
| template<typename T, size_t N> | |
| size_t | vsdk::utils::array_size (T(&arr)[N]) |
| Return the size of a fixed size array. | |
| int | vsdk::utils::open (const std::string &path, int flags) |
| Wrapper implementation that deals with C++ linter (clang-tidy) | |
| template<typename... Args> | |
| int | vsdk::utils::ioctl (Args &&... args) |
| Wrapper implementation that deals with C++ linter (clang-tidy) | |
| int | vsdk::utils::system (const std::string &cmd) |
| Wrapper implementation that deals with C++ linter (clang-tidy) | |
| std::string | vsdk::utils::errno_string (int err) |
| Wrapper for strerror that returns a std::string. | |
| template<typename... Args> | |
| int | vsdk::utils::fcntl (int fd, int cmd, Args &&... args) |
| Wrapper for fcntl that deals with C++ linter (clang-tidy) | |
| std::string | vsdk::utils::version () |
| Get the VSDK version used to build the application. | |
| std::string | vsdk::utils::platform_version () |
| Return the installed SDK version. Reads from /etc/vsdk-version.txt on target. Failing that, reads relative to OECORE_NATIVE_SYSROOT, to support host. | |
Utility functions and templates for common operations.
| size_t vsdk::utils::array_size | ( | T(&) | arr[N] | ) |
Return the size of a fixed size array.
| arr | A fixed size array. |
| T & vsdk::utils::at | ( | T(&) | arr[N], |
| size_t | index ) |
Return a reference to an array element.
| arr | A fixed size array. |
| index | The index of the element. |
| std::string vsdk::utils::canonical_path | ( | const std::string & | path | ) |
Get the canonical path. The canonical path will not contain dot, dotdot or symlinks.
| path | The path to canonicalize. |
| std::string vsdk::utils::errno_string | ( | int | err | ) |
Wrapper for strerror that returns a std::string.
| err | The error code |
| int vsdk::utils::fcntl | ( | int | fd, |
| int | cmd, | ||
| Args &&... | args ) |
Wrapper for fcntl that deals with C++ linter (clang-tidy)
| Args |
| fd | The file descriptor to modify |
| cmd | The command to execute on the file descriptor |
| args | The arguments for the command |
|
inline |
Utility to check if a path exists. Same semantics as std::filesystem::exists, but won't do character conversion on Windows.
| path | The path to check |
| std::errc vsdk::utils::file_remove | ( | const std::string & | path | ) |
Remove a file.
| path | The path to the file to remove. See also rmdir. |
| int vsdk::utils::ioctl | ( | Args &&... | args | ) |
Wrapper implementation that deals with C++ linter (clang-tidy)
| args | Same arguments as standard ioctl call. (man 2 ioctl for reference) |
| std::errc vsdk::utils::mkdir | ( | const std::string & | path | ) |
Make a directory. This behaves as mkdir -p. It will create intermediary path components automatically.
| path | The path to create. |
| int vsdk::utils::open | ( | const std::string & | path, |
| int | flags ) |
Wrapper implementation that deals with C++ linter (clang-tidy)
| path | Path to file to be opened. |
| flags | Flags for the standard open call. (man 2 open for reference) |
| std::string vsdk::utils::path_join | ( | const StringLike auto & | base, |
| Components... | comp ) |
Utility to construct OS-aware paths. Similar to Python's os.path.join(). On Windows the path components will be joined with backslashes (), everywhere else with forward slashed (/).
| base | The first component of the resulting path |
| comp | The rest of the component paths. |
| std::string vsdk::utils::path_separator | ( | const StringLike auto & | base | ) |
Utility for prepending OS-specific path separator. Needed for the path_join function.
| base | StringLike component to prepend the separator to. |
|
noexcept |
Exception-safe fmt::print wrapper.
| fmt | Format string as defined by fmtlib documentation |
| args | Any arguments usually used by fmt::print |
| std::errc vsdk::utils::rmdir | ( | const std::string & | path | ) |
Delete a directory recursively. Behaves as rm -rf.
| path | The path to remove. |
| int vsdk::utils::system | ( | const std::string & | cmd | ) |
Wrapper implementation that deals with C++ linter (clang-tidy)
| cmd | Command to be executed |