|
BDE 4.14.0 Production release
|
#include <bdls_pathutil.h>
Static Public Member Functions | |
| static int | appendIfValid (bsl::string *path, const bsl::string_view &filename) |
| static int | appendIfValid (std::string *path, const bsl::string_view &filename) |
| static void | appendRaw (bsl::string *path, const char *filename, int length=-1, int rootEnd=-1) |
| static void | appendRaw (std::string *path, const char *filename, int length=-1, int rootEnd=-1) |
| static int | popLeaf (bsl::string *path, int rootEnd=-1) |
| static int | popLeaf (std::string *path, int rootEnd=-1) |
| static int | getBasename (bsl::string *leaf, const bsl::string_view &path, int rootEnd=-1) |
| static int | getBasename (std::string *leaf, const bsl::string_view &path, int rootEnd=-1) |
| static int | getDirname (bsl::string *dirname, const bsl::string_view &path, int rootEnd=-1) |
| static int | getDirname (std::string *dirname, const bsl::string_view &path, int rootEnd=-1) |
| static int | getLeaf (bsl::string *leaf, const bsl::string_view &path, int rootEnd=-1) |
| static int | getLeaf (std::string *leaf, const bsl::string_view &path, int rootEnd=-1) |
| static int | getExtension (bsl::string *extension, const bsl::string_view &path, int rootEnd=-1) |
| static int | getExtension (std::string *extension, const bsl::string_view &path, int rootEnd=-1) |
| static int | getRoot (bsl::string *root, const bsl::string_view &path, int rootEnd=-1) |
| static int | getRoot (std::string *root, const bsl::string_view &path, int rootEnd=-1) |
| static void | splitFilename (bsl::string_view *head, bsl::string_view *tail, const bsl::string_view &path, int rootEnd=-1) |
| static bool | isAbsolute (const bsl::string_view &path, int rootEnd=-1) |
| static bool | isRelative (const bsl::string_view &path, int rootEnd=-1) |
| static bool | hasLeaf (const bsl::string_view &path, int rootEnd=-1) |
| static int | getRootEnd (const bsl::string_view &path) |
Static Public Attributes | |
| static const char | k_SEPARATOR |
This struct contains utility methods for platform-independent manipulation of filesystem paths. No method of this struct provides any filesystem operations or accesses the filesystem as part of its implementation.
|
static |
|
static |
Append the specified filename to the end of the specified path if filename represents a relative path. Return 0 on success, and a non-zero value otherwise. Note that any filesystem separator characters at the end of filename or path will be discarded. See Terminology for the definition of separator.
|
static |
|
static |
Append the specified filename up to the optionally specified length to the end of the specified path. If length is negative, append the entire string. If the optionally specified rootEnd offset is non-negative, it is taken as the position in path of the character following the root. The behavior is undefined if filename represents an absolute path or if either filename or path ends with the filesystem separator character. The behavior is also undefined if filename points to any part of path (i.e., filename may not be an alias for path). See Parsing and Performance .
|
inlinestatic |
|
inlinestatic |
Load into the specified leaf the value of the rightmost name in the specified path that follows the root; that is, the leaf element. If the optionally specified rootEnd offset is non-negative, it is taken as the position in path of the character following the root. Return 0 on success, and a non-zero value otherwise; in particular, return nonzero if path does not have a leaf. Note that getBasename is a synonym for getLeaf. See Parsing and Performance . See also Terminology for the definition of leaf and root.
|
static |
|
static |
Load into the specified dirname the value of the directory part of the specified path, that is, the root if it exists and all the filenames except the last one (the leaf). If the optionally specified rootEnd offset is non-negative, it is taken as the position in path of the character following the root. Return 0 on success, and a non-zero value otherwise; in particular, return a nonzero value if path does not have a leaf. Note that in the case of a relative path with a single filename, the function will succeed and dirname will be the empty string. See Parsing and Performance . See also Terminology for the definition of directories and root.
|
static |
|
static |
Load into the specified extension the extension of path. If the optionally specified rootEnd offset is non-negative, it is taken as the position in path of the character following the root. Return 0 if the path has an extension, and a non-zero value otherwise. See bdls_pathutil-parsing-and-performance-see-also-ref-bdls_pathutil-terminology for the definition of leaf and root.
|
static |
|
static |
Load into the specified leaf the value of the rightmost name in the specified path that follows the root; that is, the leaf element. If the optionally specified rootEnd offset is non-negative, it is taken as the position in path of the character following the root. Return 0 on success, and a non-zero value otherwise; in particular, return nonzero if path does not have a leaf. Note that getBasename is a synonym for getLeaf. See Parsing and Performance . See also Terminology for the definition of leaf and root.
|
static |
|
static |
Load into the specified 'root' the value of the root part of the specified 'path'. If the optionally specified 'rootEnd' offset is non-negative, it is taken as the position in 'path' of the character following the root. Return 0 on success, and a non-zero value otherwise; in particular, return a nonzero value if 'path' is relative. Note that the meaning of the root part is platform-dependent. See bdls_pathutil-parsing-and-performance-see-also-ref-bdls_pathutil-terminology for the definition of root.
|
static |
Return the 0-based position in the specified path of the character following the root. Note that a return value of 0 indicates a relative path. See bdls_pathutil-parsing-and-performance-see-also-ref-bdls_pathutil-terminology for the definition of root.
|
static |
Return true if the specified path has a filename following the root, and false otherwise. If the optionally specified rootEnd offset is non-negative, it is taken as the position in path of the character following the root. See Parsing and Performance . See also Terminology for the definition of root.
|
static |
Return true if the specified path is absolute (has a root), and false otherwise. If the optionally specified rootEnd offset is non-negative, it is taken as the position in path of the character following the root. See Parsing and Performance . See also Terminology for the definition of root.
|
static |
Return true if the specified path is relative (lacks a root), and false otherwise. If the optionally specified rootEnd offset is non-negative, it is taken as the position in path of the character following the root. See Parsing and Performance . See also Terminology for the definition of root.
|
static |
|
static |
Remove from the specified path the rightmost filename following the root; that is, remove the leaf element. If the optionally specified rootEnd offset is non-negative, it is taken as the position in path of the character following the root. Return 0 on success, and a nonzero value otherwise; in particular, return a nonzero value if path does not have a leaf. See Parsing and Performance . See also Terminology for the definition of leaf and root.
|
static |
Load the last pathname component from the specified path into the specified tail and everything leading up to that to the specified head. If the optionally specified rootEnd offset is non-negative, it is taken as the position in path of the character following the root. The tail part never contains a slash; if path ends in a slash, tail is empty. If there is no slash in path, head is empty. If path is empty, both head and tail are empty. Trailing slashes are stripped from head unless it is the root.
See {Terminology} for the definition of root. The behavior is undefined unless head != tail and INT_MAX >= path.length(). Note that head or tail may point to the path object when the method is called.
|
static |