Load the leaf element of a path.

Synopsis

Declared in <bdls_pathutil.h>

static
int
getLeaf(
    bsl::string* leaf,
    std::string_view const& path,
    int rootEnd = ‐1);

Description

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 []and Performance). See also for the definition of leaf and root.

Return Value

0 on success, and a non‐zero value otherwise

Parameters

Name

Description

leaf

receives the leaf element of path

path

filesystem path to examine

rootEnd

if non‐negative, position in path of the character following the root

Created with MrDocs