Notitie
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen u aan te melden of de directory te wijzigen.
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen de mappen te wijzigen.
Deze gratis functies in de <filesystem> header wijzigen en querybewerkingen uitvoeren op paden, bestanden, symlinks, mappen en volumes. Zie Bestandssysteemnavigatie (C++) voor meer informatie en codevoorbeelden.
absolute
path absolute(const path& pval, const path& base = current_path());
De functie retourneert de absolute padnaam die overeenkomt met pval ten opzichte van de padnaam base:
Als
pval.has_root_name() && pval.has_root_directory()de functie retourneertpval.Als
pval.has_root_name() && !pval.has_root_directory()de functie retourneertpval.root_name()/absolute(base).root_directory()/absolute(base).relative_path()/pval.relative_path().Als
!pval.has_root_name() && pval.has_root_directory()de functie retourneertabsolute(base).root_name()/pval.Als
!pval.has_root_name() && !pval.has_root_directory()de functie retourneertabsolute(base)/pval.
begin
const directory_iterator& begin(const directory_iterator& iter) noexcept;
const recursive_directory_iterator&
begin(const recursive_directory_iterator& iter) noexcept;
Beide functies retourneren iter.
canonical
path canonical(const path& pval, const path& base = current_path());
path canonical(const path& pval, error_code& ec);
path canonical(const path& pval, const path& base, error_code& ec);
De functies vormen allemaal een absolute padnaam pabs = absolute(pval, base) (of pabs = absolute(pval) voor de overbelasting zonder basisparameter), en reduceer het vervolgens tot een canonieke vorm in de volgende reeks stappen:
Elk padonderdeel
Xwaarvooris_symlink(X)wordttruevervangen doorread_symlink(X).Elk padonderdeel
.(punt is de huidige map die is ingesteld door vorige padonderdelen) wordt verwijderd.Elk paar padonderdelen
X/..(dot-dot is de bovenliggende map die is ingesteld door vorige padonderdelen) wordt verwijderd.
De functie retourneert pabsvervolgens .
copy
void copy(const path& from, const path& to);
void copy(const path& from, const path& to, error_code& ec) noexcept;
void copy(const path& from, const path& to, copy_options opts);
void copy(const path& from, const path& to, copy_options opts, error_code& ec) noexcept;
De functies kopiëren of koppelen allemaal een of meer bestanden vannaar onder controle van opts, die wordt genomen als copy_options::none voor de overbelastingen zonder opts parameter.
opts bevat ten hoogste een van de volgende:
skip_existing,overwrite_existingofupdate_existingcopy_symlinksofskip_symlinksdirectories_only,create_symlinksofcreate_hard_links
De functies bepalen eerst de file_status waarden f voor van en tnaar:
indien
opts & (copy_options::create_symlinks | copy_options::skip_symlinks), door te bellensymlink_statusanders, door te bellen
statusAnders meldt u een fout.
Als !exists(f) || equivalent(f, t) || is_other(f) || is_other(t) || is_directory(f)&& is_regular_file(t), dan melden ze een fout (en doen niets anders).
Als dat niet het volgende is_symlink(f) gebeurt:
Als
options & copy_options::skip_symlinks, doe dan niets.Anders, als
!exists(t)&& options & copy_options::copy_symlinks, dancopy_symlink(from, to, opts).Anders meldt u een fout.
Anders, als is_regular_file(f), dan:
Als
opts & copy_options::directories_only, doe dan niets.Anders, als
opts & copy_options::create_symlinks, dancreate_symlink(to, from).Anders, als
opts & copy_options::create_hard_links, dancreate_hard_link(to, from).Anders, als
is_directory(f), dancopy_file(from, to/from.filename(), opts).Anders
copy_file(from, to, opts).
Anders, als is_directory(f) && (opts & copy_options::recursive || !opts), dan:
if (!exists(t))
{ // copy directory contents recursively
create_directory(to, from, ec);
for (directory_iterator next(from), end; ec == error_code() && next != end; ++next)
{
copy(next->path(), to / next->path().filename(), opts, ec);
}
}
Doe anders niets.
copy_file
bool copy_file(const path& from, const path& to);
bool copy_file(const path& from, const path& to, error_code& ec) noexcept;
bool copy_file(const path& from, const path& to, copy_options opts);
bool copy_file(const path& from, const path& to, copy_options opts, error_code& ec) noexcept;
De functies kopiëren het bestand mogelijk vannaar onder controle van opts, wat wordt genomen als copy_options::none voor de overbelastingen zonder opts parameter.
opts bevat ten hoogste één van skip_existing, overwrite_existingof update_existing.
Als exists(to) && !(opts & (copy_options::skip_existing | copy_options::overwrite_existing | copy_options::update_existing)), dan rapporteren als een fout dat het bestand al bestaat.
Als u dat niet doet, !exists(to) || opts & copy_options::overwrite_existing || opts & copy_options::update_existing&& last_write_time(to) < last_write_time(from) || !(opts & (copy_options::skip_existing | copy_options::overwrite_existing | copy_options::update_existing))probeert u de inhoud en kenmerken van het bestand van naar het bestand te kopiëren. Meld dit als een fout als de kopieerpoging mislukt.
De functies retourneren true als de kopie wordt geprobeerd en slaagt, anders false.
copy_symlink
void copy_symlink(const path& from, const path& to);
void copy_symlink(const path& from, const path& to, error_code& ec) noexcept;
Als is_directory(from), roept de functie create_directory_symlink(from, to)aan. Anders wordt het aanroepen create_symlink(from, to).
create_directories
bool create_directories(const path& pval);
bool create_directories(const path& pval, error_code& ec) noexcept;
Voor een padnaam zoals a\/b\/c, maakt de functie mappen a en a\/b indien nodig, zodat deze de map a\/b\/c indien nodig kan maken. Het retourneert true alleen als de map pvaldaadwerkelijk wordt gemaakt.
create_directory
bool create_directory(const path& pval);
bool create_directory(const path& pval, error_code& ec) noexcept;
bool create_directory(const path& pval, const path& attr);
bool create_directory(const path& pval, const path& attr, error_code& ec) noexcept;
De functie maakt indien nodig de map pval . Het retourneert true alleen als de map pvaldaadwerkelijk wordt gemaakt, in welk geval machtigingen van het bestaande bestand attrworden gekopieerd of wordt gebruikt perms::all voor de overbelastingen zonder attr parameter.
create_directory_symlink
void create_directory_symlink(const path& to, const path& link);
void create_directory_symlink(const path& to, const path& link, error_code& ec) noexcept;
De functie maakt een koppeling als een symlink naar de map.
create_hard_link
void create_hard_link(const path& to, const path& link);
void create_hard_link(const path& to, const path& link, error_code& ec) noexcept;
De functie maakt een koppeling als een harde koppeling naar de map of het bestand.
create_symlink
void create_symlink(const path& to, const path& link);
void create_symlink(const path& to, const path& link, error_code& ec) noexcept;
De functie wordt gemaakt link als een symlink naar het bestand.
current_path
path current_path();
path current_path(error_code& ec);
void current_path(const path& pval);
void current_path(const path& pval, error_code& ec) noexcept;
De functies zonder parameter pval retourneren de padnaam voor de huidige map. De resterende functies stellen de huidige map in op pval.
end
directory_iterator& end(const directory_iterator& iter) noexcept;
recursive_directory_iterator& end(const recursive_directory_iterator& iter) noexcept;
De eerste functie retourneert directory_iterator() en de tweede functie retourneert recursive_directory_iterator()
equivalent
bool equivalent(const path& left, const path& right);
bool equivalent(const path& left, const path& right, error_code& ec) noexcept;
De functies retourneren true alleen als links en rechts dezelfde bestandssysteementiteit kiezen.
exists
bool exists(file_status stat) noexcept;
bool exists(const path& pval);
bool exists(const path& pval, error_code& ec) noexcept;
De eerste functie retourneert status_known && stat.type() != file_not_found. De tweede en derde functie retourneren exists(status(pval)).
file_size
uintmax_t file_size(const path& pval);
uintmax_t file_size(const path& pval, error_code& ec) noexcept;
De functies retourneren de grootte in bytes van het bestand dat is gekozen door pval, als exists(pval) && is_regular_file(pval) en de bestandsgrootte kan worden bepaald. Anders melden ze een fout en retourneren uintmax_t(-1)ze.
hard_link_count
uintmax_t hard_link_count(const path& pval);
uintmax_t hard_link_count(const path& pval, error_code& ec) noexcept;
De functie retourneert het aantal vaste koppelingen voor pvalof -1 als er een fout optreedt.
hash_value
size_t hash_value(const path& pval) noexcept;
De functie retourneert een hash-waarde voor pval.native().
is_block_file
bool is_block_file(file_status stat) noexcept;
bool is_block_file(const path& pval);
bool is_block_file(const path& pval, error_code& ec) noexcept;
De eerste functie retourneert stat.type() == file_type::block. De resterende functies retourneren is_block_file(status(pval)).
is_character_file
bool is_character_file(file_status stat) noexcept;
bool is_character_file(const path& pval);
bool is_character_file(const path& pval, error_code& ec) noexcept;
De eerste functie retourneert stat.type() == file_type::character. De resterende functies retourneren is_character_file(status(pval)).
is_directory
bool is_directory(file_status stat) noexcept;
bool is_directory(const path& pval);
bool is_directory(const path& pval, error_code& ec) noexcept;
De eerste functie retourneert stat.type() == file_type::directory. De resterende functies retourneren is_directory_file(status(pval)).
is_empty
bool is_empty(file_status stat) noexcept;
bool is_empty(const path& pval);
bool is_empty(const path& pval, error_code& ec) noexcept;
Als is_directory(pval), dan retourneert directory_iterator(pval) == directory_iterator()de functie ; anders wordt deze geretourneerd file_size(pval) == 0.
is_fifo
bool is_fifo(file_status stat) noexcept;
bool is_fifo(const path& pval);
bool is_fifo(const path& pval, error_code& ec) noexcept;
De eerste functie retourneert stat.type() == file_type::fifo. De resterende functies retourneren is_fifo(status(pval)).
is_other
bool is_other(file_status stat) noexcept;
bool is_other(const path& pval);
bool is_other(const path& pval, error_code& ec) noexcept;
De eerste functie retourneert stat.type() == file_type::other. De resterende functies retourneren is_other(status(pval)).
is_regular_file
bool is_regular_file(file_status stat) noexcept;
bool is_regular_file(const path& pval);
bool is_regular_file(const path& pval, error_code& ec) noexcept;
De eerste functie retourneert stat.type() == file_type::regular. De resterende functies retourneren is_regular_file(status(pval)).
is_socket
bool is_socket(file_status stat) noexcept;
bool is_socket(const path& pval);
bool is_socket(const path& pval, error_code& ec) noexcept;
De eerste functie retourneert stat.type() == file_type::socket. De resterende functies retourneren is_socket(status(pval)).
is_symlink
bool is_symlink(file_status stat) noexcept;
bool is_symlink(const path& pval);
bool is_symlink(const path& pval, error_code& ec) noexcept;
De eerste functie retourneert stat.type() == file_type::symlink. De resterende functies retourneren is_symlink(status(pval)).
last_write_time
file_time_type last_write_time(const path& pval);
file_time_type last_write_time(const path& pval, error_code& ec) noexcept;
void last_write_time(const path& pval, file_time_type new_time);
void last_write_time(const path& pval, file_time_type new_time, error_code& ec) noexcept;
De eerste twee functies retourneren de tijd van laatste wijziging van gegevens voor pval, of file_time_type(-1) als er een fout optreedt. Met de laatste twee functies wordt de tijd van laatste wijziging van gegevens ingesteld op pvalnew_time.
permissions
void permissions(const path& pval, perms mask);
void permissions(const path& pval, perms mask, error_code& ec) noexcept;
De functies stellen de machtigingen in voor de padnaam die is gekozen door pval onder mask & perms::mask controle van perms & (perms::add_perms | perms::remove_perms).
mask bevat ten hoogste één van perms::add_perms en perms::remove_perms.
Als mask & perms::add_perms, de functies stellen de machtigingen in op status(pval).permissions() | mask & perms::mask.
mask & perms::remove_permsAnders stellen de functies de machtigingen in op status(pval).permissions() & ~(mask & perms::mask). Anders stellen de functies de machtigingen in op mask & perms::mask.
proximate
path proximate(const path& p, error_code& ec);
path proximate(const path& p, const path& base = current_path());
path proximate(const path& p, const path& base, error_code& ec);
read_symlink
path read_symlink(const path& pval);
path read_symlink(const path& pval, error_code& ec);
De functies rapporteren een fout en retourneren path() als !is_symlink(pval). Anders retourneren de functies een object van het type path dat de symbolische koppeling bevat.
relative
path relative(const path& p, error_code& ec);
path relative(const path& p, const path& base = current_path());
path relative(const path& p, const path& base, error_code& ec);
remove
bool remove(const path& pval);
bool remove(const path& pval, error_code& ec) noexcept;
De functies retourneren true alleen als exists(symlink_status(pval)) en het bestand is verwijderd. Een symlink wordt zelf verwijderd, niet het bestand dat het kiest.
remove_all
uintmax_t remove_all(const path& pval);
uintmax_t remove_all(const path& pval, error_code& ec) noexcept;
Als pval dit een map is, verwijdert de functies recursief alle mapvermeldingen en vervolgens de vermelding zelf. Anders roepen removede functies aan. Ze retourneren een telling van alle elementen die zijn verwijderd.
rename
void rename(const path& from, const path& to);
void rename(const path& from, const path& to, error_code& ec) noexcept;
De functies worden gewijzigd vanin. De naam van een symlink wordt zelf gewijzigd, niet het bestand dat wordt gekozen.
resize_file
void resize(const path& pval, uintmax_t size);
void resize(const path& pval, uintmax_t size, error_code& ec) noexcept;
De functies wijzigen de grootte van een bestand zodanig dat file_size(pval) == size
space
space_info space(const path& pval);
space_info space(const path& pval, error_code& ec) noexcept;
De functie retourneert informatie over het volume dat is gekozen door pval, in een structuur van het type space_info. De structuur bevat uintmax_t(-1) voor een waarde die niet kan worden bepaald.
status
file_status status(const path& pval);
file_status status(const path& pval, error_code& ec) noexcept;
De functies retourneren de padnaamstatus, het bestandstype en de machtigingen die zijn gekoppeld aan pval. Een symlink wordt zelf niet getest, maar het bestand dat het kiest.
status_known
bool status_known(file_status stat) noexcept;
De functie retourneert stat.type() != file_type::none
swap
void swap(path& left, path& right) noexcept;
De functie wisselt de inhoud van links en rechts uit.
symlink_status
file_status symlink_status(const path& pval);
file_status symlink_status(const path& pval, error_code& ec) noexcept;
De functies retourneren de symlinkstatus van het pad, het bestandstype en de machtigingen die zijn gekoppeld aan pval. De functies gedragen zich hetzelfde als status(pval) behalve dat een symlink zelf wordt getest, niet het bestand dat het kiest.
system_complete
path system_complete(const path& pval);
path system_complete(const path& pval, error_code& ec);
De functies retourneren zo nodig een absolute padnaam die rekening houdt met de huidige map die is gekoppeld aan de hoofdnaam. (Voor POSIX retourneren absolute(pval)de functies ).
temp_directory_path
path temp_directory_path();
path temp_directory_path(error_code& ec);
De functies retourneren een padnaam voor een map die geschikt is voor het bevatten van tijdelijke bestanden.
u8path
template <class Source>
path u8path(const Source& source);
template <class InIt>
path u8path(InIt first, InIt last);
De eerste functie gedraagt zich hetzelfde als path(source) en de tweede functie gedraagt zich hetzelfde als path(first, last) de gekozen bron in elk geval wordt genomen als een reeks tekenelementen die zijn gecodeerd als UTF-8, ongeacht het bestandssysteem.
weakly_canonical
path weakly_canonical(const path& p);
path weakly_canonical(const path& p, error_code& ec);