|
CppCommon 1.0.5.0
C++ Common Library
|
Filesystem symlink. More...
#include <symlink.h>
Public Member Functions | |
| Symlink () | |
| Initialize symbolic link with an empty path. | |
| Symlink (const Path &path) | |
| Initialize symbolic link with a given path. | |
| Symlink (const Symlink &)=default | |
| Symlink (Symlink &&)=default | |
| ~Symlink ()=default | |
| Symlink & | operator= (const Path &path) |
| Symlink & | operator= (const Symlink &)=default |
| Symlink & | operator= (Symlink &&)=default |
| operator bool () const noexcept | |
| Check if the symlink is present. | |
| Path | target () const |
| Read symlink target path. | |
| bool | IsSymlinkExists () const |
| Is the symlink exists? | |
| bool | IsTargetExists () const |
| Is the target exists? | |
| void | swap (Symlink &symlink) noexcept |
| Swap two instances. | |
Public Member Functions inherited from CppCommon::Path | |
| Path () | |
| Initialize path with an empty value. | |
| Path (const char *path) | |
| Initialize path with a given C-string value. | |
| Path (const std::string &path) | |
| Initialize path with a given string value. | |
| Path (const wchar_t *path) | |
| Initialize path with a given wide C-string value. | |
| Path (const std::wstring &path) | |
| Initialize path with a given wide string value. | |
| Path (const Path &)=default | |
| Path (Path &&)=default | |
| ~Path ()=default | |
| Path & | operator= (const Path &)=default |
| Path & | operator= (Path &&)=default |
| operator bool () const noexcept | |
| Check if the path is not empty. | |
| Path & | operator/= (const Path &path) |
| Path & | operator+= (const Path &path) |
| const std::string & | string () const noexcept |
| Get the path value as UTF-8 string. | |
| std::wstring | wstring () const |
| Get the path value as a wide string. | |
| Path | root () const |
| Decompose root path from the current path. | |
| Path | relative () const |
| Decompose relative path from the current path. | |
| Path | parent () const |
| Decompose parent path from the current path. | |
| Path | filename () const |
| Decompose filename from the current path. | |
| Path | stem () const |
| Decompose stem from the current path. | |
| Path | extension () const |
| Decompose extension from the current path. | |
| Path | absolute () const |
| Transform the current path to the real path on a filesystem. | |
| Path | canonical () const |
| Transform the current path and replace all '.' and '..' properly. | |
| Path | validate (char placeholder='_') const |
| Transform the current path and replace all deprecated characters with a given placeholder (default is '_') | |
| FileType | type () const |
| Get the path file type. | |
| Flags< FileAttributes > | attributes () const |
| Get the path file attributes. | |
| Flags< FilePermissions > | permissions () const |
| Get the path file permissions. | |
| UtcTimestamp | created () const |
| Get the path created UTC timestamp. | |
| UtcTimestamp | modified () const |
| Get the path modified UTC timestamp. | |
| size_t | hardlinks () const |
| Get the path count of hardlinks. | |
| SpaceInfo | space () const |
| Get the path space information. | |
| bool | empty () const noexcept |
| Is the path empty? | |
| bool | HasRoot () const |
| Has root path? | |
| bool | HasRelative () const |
| Has relative path? | |
| bool | HasParent () const |
| Has parent path? | |
| bool | HasFilename () const |
| Has filename? | |
| bool | HasStem () const |
| Has stem? | |
| bool | HasExtension () const |
| Has extension? | |
| bool | IsAbsolute () const |
| Is absolute path? | |
| bool | IsRelative () const |
| Is relative path? | |
| bool | IsExists () const |
| Is the path exists? | |
| bool | IsRegularFile () const |
| Is the path points to regular file? | |
| bool | IsDirectory () const |
| Is the path points to directory? | |
| bool | IsSymlink () const |
| Is the path points to symbolic link? | |
| bool | IsOther () const |
| Is the path points to special file (block, character, FIFO, socket)? | |
| bool | IsEquivalent (const Path &path) const |
| Is the current path is equivalent to the given one (points to the same node on a filesystem)? | |
| void | Clear () noexcept |
| Clear the path content. | |
| Path & | Assign (const Path &path) |
| Assign the given path to the current one. | |
| Path & | Append (const Path &path) |
| Append the given path to the current one. | |
| Path & | Concat (const Path &path) |
| Concatenate the given path to the current one. | |
| Path & | MakePreferred () |
| Convert all path separators to system ones ('\' for Windows or '/' for Unix) | |
| Path & | ReplaceFilename (const Path &filename) |
| Replace the current path filename with a given one. | |
| Path & | ReplaceExtension (const Path &extension) |
| Replace the current path extension with a given one. | |
| Path & | RemoveFilename () |
| Remove the current path filename. | |
| Path & | RemoveExtension () |
| Remove the current path extension. | |
| Path & | RemoveTrailingSeparators () |
| Remove all trailing separators form the current path. | |
| void | swap (Path &path) noexcept |
| Swap two instances. | |
Static Public Member Functions | |
| static Symlink | CreateSymlink (const Path &src, const Path &dst) |
| Create a new symlink. | |
| static Path | CreateHardlink (const Path &src, const Path &dst) |
| Create a new hardlink. | |
| static Symlink | CopySymlink (const Path &src, const Path &dst) |
| Copy the current symlink to another destination path. | |
Static Public Member Functions inherited from CppCommon::Path | |
| static bool | deprecated (char character) noexcept |
| Is the given character is deprecated by the filesystem? | |
| static bool | deprecated (wchar_t character) noexcept |
| Is the given wide character is deprecated by the filesystem? | |
| static std::string | deprecated () |
| Get filesystem deprecated characters ('\', '/', '?', '', '*', ':', '|', '"', '<', '>') | |
| static char | separator () noexcept |
| Get the system path separator character ('\' for Windows or '/' for Unix) | |
| static Path | initial () |
| Get the initial path of the process. | |
| static Path | current () |
| Get the current path of the process. | |
| static Path | executable () |
| Get the executable path of the process. | |
| static Path | home () |
| Get the home path of the process. | |
| static Path | temp () |
| Get the temporary path of the process. | |
| static Path | unique () |
| Get the unique filename in UUID format "00000000-0000-0000-0000-000000000000". | |
| static Path | Copy (const Path &src, const Path &dst, bool overwrite=false) |
| Copy the given source path to destination path (file, empty directory, symlink, etc) | |
| static Path | CopyIf (const Path &src, const Path &dst, const std::string &pattern="", bool overwrite=false) |
| Copy all matched files from the the given source path to destination path (files, directories, symlinks, etc) | |
| static Path | CopyAll (const Path &src, const Path &dst, bool overwrite=false) |
| Recursively copy the given source path to destination path (files, directories, symlinks, etc) | |
| static Path | Rename (const Path &src, const Path &dst) |
| Rename the given source path to destination path (file, empty directory, symlink, etc) | |
| static Path | Remove (const Path &path) |
| Remove the given path (file, empty directory, symlink, etc) from the filesystem. | |
| static Path | RemoveAll (const Path &path) |
| Recursively remove the given path (file, empty directory, symlink, etc) from the filesystem. | |
| static Path | RemoveIf (const Path &path, const std::string &pattern="") |
| Recursively remove the given path matched to the given pattern (file, empty directory, symlink, etc) from the filesystem. | |
| static void | SetAttributes (const Path &path, const Flags< FileAttributes > &attributes) |
| Set file attributes for the given path. | |
| static void | SetPermissions (const Path &path, const Flags< FilePermissions > &permissions) |
| Set file permissions for the given path. | |
| static void | SetCreated (const Path &path, const UtcTimestamp ×tamp) |
| Set created UTC timestamp for the given path. | |
| static void | SetModified (const Path &path, const UtcTimestamp ×tamp) |
| Set modified UTC timestamp for the given path. | |
| static void | SetCurrent (const Path &path) |
| Set the given path of the process as a current one. | |
| static void | Touch (const Path &path) |
| Touch the given path and set its modified UTC timestamp to the current value. | |
Friends | |
| void | swap (Symlink &symlink1, Symlink &symlink2) noexcept |
Additional Inherited Members | |
Protected Attributes inherited from CppCommon::Path | |
| std::string | _path |
| Path string. | |
Filesystem symlink.
Filesystem symlink wraps link management operations (create symlink, read symlink target, copy symlink, create hardlink).
Not thread-safe.
|
inline |
|
inline |
|
default |
|
default |
|
default |
Copy the current symlink to another destination path.
If the source path is a symlink then a new destination symlink will be created based on its target. Otherwise symlink will be created explicitly based on the source path.
| src | - Source path |
| dst | - Destination path |
Create a new hardlink.
| src | - Source path |
| dst | - Destination path |
Definition at line 168 of file symlink.cpp.
Create a new symlink.
| src | - Source path |
| dst | - Destination path |
Definition at line 142 of file symlink.cpp.
| bool CppCommon::Symlink::IsSymlinkExists | ( | ) | const |
Is the symlink exists?
Definition at line 116 of file symlink.cpp.
|
inline |
|
inlineexplicitnoexcept |
|
inlinenoexcept |
Swap two instances.
Definition at line 11 of file symlink.inl.
| Path CppCommon::Symlink::target | ( | ) | const |
Read symlink target path.
Definition at line 66 of file symlink.cpp.
Definition at line 17 of file symlink.inl.