다음을 통해 공유


directory_entry 클래스

*X에서 반환하는 개체에 대해 설명합니다. 여기서 Xdirectory_iterator 또는 recursive_directory_iterator입니다.

구문

class directory_entry;

설명

클래스는 path 형식의 개체를 저장합니다. 저장된 pathpath 클래스의 인스턴스이거나 path에서 파생된 형식의 인스턴스일 수 있습니다. 또한 두 개의 file_type 값을 저장합니다. 하나의 값은 저장된 파일 이름의 상태 나타냅니다. 다른 하나는 파일 이름의 기호 링크 상태 나타냅니다.

자세한 내용 및 코드 예제를 보려면 파일 시스템 탐색(C++)을 참조하세요.

생성자

생성자 Description
directory_entry 기본 생성자는 예상대로 작동합니다. 네 번째 생성자는 pval, mystat stat_argmysymstat symstat_arg 초기화합니다 mypath.

멤버 함수

멤버 함수 설명
assign 멤버 함수는 pvalmypath에, 통계mystat할당하고, symstat를 에 할당합니다mysymstat.
path 멤버 함수는 mypath를 반환합니다.
replace_filename 멤버 함수는 mypath pval, mypath.parent_path()mystat / stat_arg, symstat_arg mysymstat
status 두 멤버 함수 모두 먼저 변경된 것으로 반환 mystat 됩니다.
symlink_status 두 멤버 함수 모두 먼저 변경된 것으로 반환 mysymstat 됩니다.

연산자

연산자 설명
operator!= 목록의 요소를 다른 목록의 복사본으로 바꿉니다.
operator= 기본 멤버 대입 연산자가 예상대로 작동합니다.
연산자== mypath == right.mypath을(를) 반환합니다.
연산자< mypath < right.mypath을(를) 반환합니다.
operator<= !(right < *this)을(를) 반환합니다.
연산자> right < *this을(를) 반환합니다.
operator>= !(*this < right)을(를) 반환합니다.
연산자 const path_type& mypath을(를) 반환합니다.

요구 사항

헤더:<실험적/파일 시스템>

네임스페이스: std::experimental::filesystem

할당

멤버 함수는 pval을 < a0/&stat_argmystat및 symstat_arg 할당합니다mysymstat.mypath

void assign(const std::experimental::filesystem::path& pval,
    file_status stat_arg = file_status(),
    file_status symstat_arg = file_status());

매개 변수

Pval
저장된 파일 이름 경로입니다.

stat_arg
저장된 파일 이름의 상태.

symstat_arg
저장된 파일 이름의 기호 링크 상태.

directory_entry

기본 생성자는 예상대로 작동합니다. 네 번째 생성자는 pval, mystat stat_argmysymstat symstat_arg 초기화합니다 mypath.

directory_entry() = default;
directory_entry(const directory_entry&) = default;
directory_entry(directory_entry&&) noexcept = default;
explicit directory_entry(const std::experimental::filesystem::path& pval,
    file_status stat_arg = file_status(),
    file_status symstat_arg = file_status());

매개 변수

Pval
저장된 파일 이름 경로입니다.

stat_arg
저장된 파일 이름의 상태.

symstat_arg
저장된 파일 이름의 기호 링크 상태.

operator!=

멤버 함수는 !(*this == right)를 반환합니다.

bool operator!=(const directory_entry& right) const noexcept;

매개 변수

right
directory_entry와 비교할 directory_entry입니다.

operator=

기본 멤버 대입 연산자가 예상대로 작동합니다.

directory_entry& operator=(const directory_entry&) = default;
directory_entry& operator=(directory_entry&&) noexcept = default;

매개 변수

right
directory_entry에 복사되는 directory_entry입니다.

연산자==

멤버 함수는 mypath == right.mypath를 반환합니다.

bool operator==(const directory_entry& right) const noexcept;

매개 변수

right
directory_entry와 비교할 directory_entry입니다.

operator<

멤버 함수는 mypath < right.mypath를 반환합니다.

bool operator<(const directory_entry& right) const noexcept;

매개 변수

right
directory_entry와 비교할 directory_entry입니다.

operator<=

멤버 함수는 !(right < *this)를 반환합니다.

bool operator<=(const directory_entry& right) const noexcept;

매개 변수

right
directory_entry와 비교할 directory_entry입니다.

operator>

멤버 함수는 right < *this를 반환합니다.

bool operator>(const directory_entry& right) const noexcept;

매개 변수

right
directory_entry와 비교할 directory_entry입니다.

operator>=

멤버 함수는 !(*this < right)를 반환합니다.

bool operator>=(const directory_entry& right) const noexcept;

매개 변수

right
directory_entry와 비교할 directory_entry입니다.

operator const path_type&

멤버 연산자는 mypath를 반환합니다.

operator const std::experimental::filesystem::path&() const;

경로

멤버 함수는 mypath를 반환합니다.

const std::experimental::filesystem::path& path() const noexcept;

replace_filename

멤버 함수는 mypath pval, mypath.parent_path()mystat / stat_arg, symstat_arg mysymstat

void replace_filename(
    const std::experimental::filesystem::path& pval,
    file_status stat_arg = file_status(),
    file_status symstat_arg = file_status());

매개 변수

Pval
저장된 파일 이름 경로입니다.

stat_arg
저장된 파일 이름의 상태.

symstat_arg
저장된 파일 이름의 기호 링크 상태.

status

두 멤버 함수 모두 mystat 다음과 같이 먼저 변경될 수 있습니다.

  1. 그런 다음 아무것도하지 않는 경우 status_known(mystat) .

  2. 그렇지 않으면 .!status_known(mysymstat) && !is_symlink(mysymstat)mystat = mysymstat

file_status status() const;
file_status status(error_code& ec) const noexcept;

매개 변수

Ec
상태 오류 코드입니다.

두 멤버 함수 모두 mysymstat 먼저 다음과 같이 변경될 수 있습니다. 이 경우 status_known(mysymstat) 아무 작업도 수행하지 않습니다. 그렇지 않으면 mysymstat = symlink_status(mypval)입니다.

file_status symlink_status() const;
file_status symlink_status(error_code& ec) const noexcept;

매개 변수

Ec
상태 오류 코드입니다.

참고 항목

헤더 파일 참조
<filesystem>