Veethree D7 SDK
Loading...
Searching...
No Matches
vsdk::utils Namespace Reference

Detailed Description

Any entities that belong to the utils library.

Concepts

concept  StringLike
 Type constraint for string-like types.

Typedefs

template<typename T>
using unique_ptr_free = std::unique_ptr<T, decltype([](T* t) { free(t); })>
 Convenience wrapper on top of std::unique_ptr that uses free() instead of delete() for managing objects allocated by malloc/calloc/etc Useful when receiving pointers allocated by C libraries (e.g. libuboot)

Functions

std::string path_separator (const StringLike auto &base)
 Utility for prepending OS-specific path separator. Needed for the path_join function.
template<StringLike... Components>
std::string 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 by with backslashes (), everywhere else with forward slashed (/).
std::errc file_remove (const std::string &path)
 Remove a file.
std::errc mkdir (const std::string &path)
 Make a directory. This behaves as mkdir -p. It will create intermediary path components automatically.
std::errc rmdir (const std::string &path)
 Delete a directory recursively. Behaves as rm -rf.
std::string canonical_path (const std::string &path)
 Get the canonical path. The canonical path will not contain dot, dotdot or symlinks.
std::string temp_directory_path ()
 Get the path for the temp directory on the OS. Similar semantics to std::filesystem::temp_directory_path.
bool 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 print (fmt::format_string< Args... > fmt, Args &&...args) noexcept
 Exception-safe fmt::print wrapper.
template<typename T, size_t N>
T & at (T(&arr)[N], size_t index)
 Return a reference to an array element.
template<typename T, size_t N>
size_t array_size (T(&arr)[N])
 Return the size of a fixed size array.
int open (const std::string &path, int flags)
 Wrapper implementation that deals with C++ linter (clang-tidy)
template<typename... Args>
int ioctl (Args &&... args)
 Wrapper implementation that deals with C++ linter (clang-tidy)
int system (const std::string &cmd)
 Wrapper implementation that deals with C++ linter (clang-tidy)
std::string errno_string (int err)
 Wrapper for strerror that returns a std::string.
template<typename... Args>
int fcntl (int fd, int cmd, Args &&... args)
 Wrapper for fcntl that deals with C++ linter (clang-tidy)
std::string version ()
 Get the VSDK version used to build the application.
std::string 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.

Detailed Description

Any entities that belong to the utils library.