home | help
std::experi...system::path(3)  C++ Standard Libary std::experi...system::path(3)

NAME
     std::experimental::filesystem::path - std::experimental::filesystem::path

Synopsis
	Defined in header <experimental/filesystem>
	class path;				     (filesystem TS)

	Objects of type path represent paths on a filesystem. Only syntactic as-
     pects of
	paths  are  handled:  the  pathname may represent a non-existing path or
     even one that
	is not allowed to exist on the current file system or OS.

	The path name has the following syntax:

	 1. root-name(optional): identifies the root on a filesystem with multi-
     ple roots
	    (such as "C:" or "//myserver". POSIX filesystems have single root.
	 2. root-directory(optional): a directory separator  that,  if	present,
     marks this
	    path as absolute. If it is missing (and the first element other than
     the root
	    name is a file name), then the path is relative and requires another
     path as the
	    starting location to resolve to a file name.
	 3. Zero or more of the following:

	  *  file-name:  sequence of characters that aren't directory separators
     or preferred
	    directory separators (additional limitations may be imposed  by  the
     OS or file
	    system).  This  name  may  identify  a file, a hard link, a symbolic
     link, or a
	    directory. Two special file-names are recognized:

	  * dot: the file name consisting of a single dot character . is  a  di-
     rectory name
	    that refers to the current directory.
	  *  dot-dot: the file name consisting of two dot characters .. is a di-
     rectory name
	    that refers to the parent directory.
	  * directory-separators: the forward slash character / or the	alterna-
     tive character
	    provided  as  path::preferred_separator.  If  this	character is re-
     peated, it is
	    treated as a single directory separator: /usr///////lib is the  same
     as /usr/lib.

	The path can be traversed element-wise via iterators returned by the be-
     gin() and
	end()  functions, which iterates over root name, root directory, and the
     subsequent
	file name elements (directory separators are skipped except the one that
     identifies
	the root directory). If the very last element in the path is a directory
     separator,
	the last iterator will dereference to a file name dot.

	Calling any non-const member function of a path invalidates  all  itera-
     tors referring
	to elements of that object.

	If  the  OS  uses  a  native  syntax that is different from the portable
     generic syntax
	described above, all library functions accept path names  in  both  for-
     mats.

	Paths  are  implicitly convertible to and from std::basic_strings, which
     makes it
	possible to use them with other file APIs, e.g. as an argument to
	std::ifstream::open.

Member types
	Type	       Definition
	value_type     character  type	used  by  the  native  encoding  of  the
     filesystem: char on
		       POSIX, wchar_t on Windows
	string_type    std::basic_string<value_type>
	const_iterator	a constant LegacyBidirectionalIterator with a value_type
     of path
	iterator       an alias to const_iterator

Member constants
			     alternative directory separator which may	be  used
     in addition
	constexpr  value_type  to  the portable /. On Windows, this is the back-
     slash character
	preferred_separator  \. On POSIX, this is the same forward  slash  /  as
     the portable
	[static]	     separator
			     (public static member constant)

Member functions
	constructor	     constructs a path
			     (public member function)
	destructor	     destroys a path object
			     (public member function)
	operator=	     assigns another path
			     (public member function)
	assign		     assigns contents
			     (public member function)
	      Concatenation
	append		     appends elements to the path
	operator/=	     (public member function)
	concat		     concatenates two paths without introducing a direc-
     tory
	operator+=	     separator
			     (public member function)

Modifiers
	clear		     erases the contents
			     (public member function)
	make_preferred	      converts	directory separators to preferred direc-
     tory separator
			     (public member function)
	remove_filename      removes filename path component
			     (public member function)
	replace_filename     replaces the last path component with another path
			     (public member function)
	replace_extension    replaces the extension
			     (public member function)
	swap		     swaps two paths
			     (public member function)
	      Format observers
	c_str		     returns the native version of the path
	native		     (public member function)
	operator string_type
	string
	wstring 	     returns the path in  native  pathname  format  con-
     verted to a
	u8string	     string
	u16string	     (public member function)
	u32string
	generic_string
	generic_wstring       returns  the  path in generic pathname format con-
     verted to a
	generic_u8string     string
	generic_u16string    (public member function)
	generic_u32string
	      Compare
			     compares the lexical representations of two paths
	compare 	     lexicographically
			     (public member function)
	      Decomposition
	root_name	     returns the root-name of the path, if present
			     (public member function)
	root_directory	     returns the root directory of the path, if present
			     (public member function)
	root_path	     returns the root path of the path, if present
			     (public member function)
	relative_path	     returns path relative to the root path
			     (public member function)
	parent_path	     returns the path of the parent path
			     (public member function)
	filename	     returns the filename path component
			     (public member function)
	stem		     returns the stem path component
			     (public member function)
	extension	     returns the file extension path component
			     (public member function)
	      Queries
	empty		     checks if the path is empty
			     (public member function)
	has_root_path
	has_root_name
	has_root_directory
	has_relative_path    checks if the corresponding  path	element  is  not
     empty
	has_parent_path      (public member function)
	has_filename
	has_stem
	has_extension
	is_absolute	     checks if root_path() uniquely identifies file sys-
     tem location
	is_relative	     (public member function)

Iterators
	begin		      iterator	access to the path as a sequence of ele-
     ments
	end		     (public member function)

Non-member functions
	swap(std::experimental::filesystem::path) swaps two paths
						  (function)
	operator==
	operator!=
	operator<				  lexicographically compares two
     paths
	operator<=				  (function)
	operator>
	operator>=
						  concatenates two paths with  a
     directory
	operator/				  separator
						  (function)
	operator<<				  performs stream input and out-
     put on a path
	operator>>				  (function)
	u8path					   creates  a  path from a UTF-8
     encoded source
						  (function)

Category:
	  * Noindexed pages

http://cppreference.com 	   2024.06.10	   std::experi...system::path(3)

home | help