다음을 통해 공유


basic_path 클래스

Defines a class that stores an object of template type String that's suitable for use as a file name.

template<class String, class Traits>
class basic_path;

설명

The library defines specializations of this template for two types.

basic_path<string, path_traits>, with the typedef path, uses std::string and the path_traits structure.

basic_path<wstring, wpath_traits>, with the typedef wpath, uses std::wstring and the wpath_traits structure.

You can use an object of type path wherever an argument of type std::string is acceptable as a file name.

std::tr2::sys::path myfile(“abc.txt”);
std::ofstream ofs(myfile);
ofs << “hello\n”;
ofs.close();

Similarly, you can use an object of type wpath wherever an argument of type std::wstring is acceptable as a file name.

A stored file name consists of an optional prefix, followed by an optional root, followed by an optional relative path.

  • A prefix consists of all elements that lead up to and include the first colon.

  • A root consists of one slash.

  • A relative path consists of one or more path elements that are delimited by sequences of slashes.

A file name iterator that is returned by basic_path::begin designates the first filename component.

A filename iterator X implies the following.

  • X == end() indicates the end of the sequence of filename components.

  • *X returns a string that matches the current component.

  • ++X designates the next component, if present.

  • --X designates the preceding component, if present.

멤버

공용 Typedefs

Name

설명

basic_path::const_iterator

basic_path::iterator 의 동의어입니다.

basic_path::external_string_type

Traits::external_string_type 의 동의어입니다.

basic_path::iterator

Describes a filename iterator that can serve as a bi-directional iterator over the components of the stored file name.

basic_path::path_type

basic_path<String, Traits> 의 동의어입니다.

basic_path::string_type

A synonym for the String template parameter.

basic_path::traits_type

A synonym for the Traits template parameter.

basic_path::value_type

String::value_type 의 동의어입니다.

Public 생성자

Name

설명

basic_path::basic_path 생성자

basic_path 개체를 생성합니다.

Public 메서드

Name

설명

basic_path::append 메서드

저장된 파일 이름에 요소를 추가합니다.

basic_path::assign 메서드

Uses a specified set of elements to replace the stored file name.

basic_path::basename 메서드

Returns the substring of leaf up to but not including the rightmost dot.

basic_path::begin 메서드

Specifies the first component of the stored file name.

basic_path::branch_path 메서드

Retrieves the parent path of the basic_path object.

basic_path::clear 메서드

Clears the stored filename string.

basic_path::directory_string 메서드

저장된 파일 이름을 반환합니다.

basic_path::empty 메서드

Specifies whether the filename string is empty.

basic_path::end 메서드

파일 이름으로 저장된 마지막 구성 요소를 넘어서 파일 이름이 반복기 을 반환합니다.

basic_path::extension 메서드

Returns the extension of the stored file name, if it exists.

basic_path::external_directory_string 메서드

Converts the stored directory_string to the external_string_type.

basic_path::external_file_string 메서드

Converts the stored file_string to the external_string_type.

basic_path::file_string 메서드

저장된 파일 이름을 반환합니다.

basic_path::filename 메서드

저장된 파일 이름을 검색합니다.

basic_path::has_branch_path 메서드

Specifies whether the stored file name contains a branch path.

basic_path::has_filename 메서드

Specifies whether the stored string contains a file name.

basic_path::has_leaf 메서드

Specifies whether the stored file name contains a leaf.

basic_path::has_parent_path 메서드

Specifies whether the stored file name contains a parent path.

basic_path::has_relative_path 메서드

Specifies whether the stored file name contains a relative path.

basic_path::has_root_directory 메서드

Specifies whether the stored file name contains a root directory.

basic_path::has_root_name 메서드

Specifies whether the stored file name contains a root name.

basic_path::has_root_path 메서드

Specifies whether the stored file name contains a root path.

basic_path::is_complete 메서드

Specifies whether the stored file name is complete.

basic_path::leaf 메서드

저장된 파일 이름을 검색합니다.

basic_path::parent_path 메서드

Retrieves the parent path of the basic_path object.

basic_path::relative_path 메서드

파일 이름으로 저장된 상대 경로 를 검색합니다.

basic_path::remove_filename 메서드

Removes the last path element in the relative path, if it exists.

basic_path::remove_leaf 메서드

Removes the last path element in the relative path, if it exists.

basic_path::replace_extension 메서드

Replaces the file name extension of the stored file name.

basic_path::root_directory 메서드

존재하는 경우, 루트를 반환합니다.

basic_path::root_name 메서드

존재하는 경우, 접두사를 반환합니다.

basic_path::root_path 메서드

Retrieves the root path of the stored file name.

basic_path::stem 메서드

Returns the substring of leaf up to but not including the rightmost dot.

basic_path::string 메서드

저장된 파일 이름을 반환합니다.

basic_path::swap 메서드

Swaps the stored file name with the file name from a specified basic_path object.

Public 연산자

Name

설명

basic_path::operator string_type 연산자

저장된 파일 이름을 반환합니다.

basic_path::operator/= 연산자

Appends a series of elements to the stored file name.

basic_path::operator= 연산자

Assigns a new value to the stored file name.

요구 사항

헤더: filesystem

네임스페이스: std::tr2::sys

참고 항목

참조

<filesystem>

기타 리소스

C++ 표준 라이브러리 헤더 파일