xtd 0.2.0
Loading...
Searching...
No Matches
file_info.h
Go to the documentation of this file.
1
4#pragma once
5#include "file_system_info.h"
6#include "stream_reader.h"
7#include "stream_writer.h"
8#include <fstream>
9
11namespace xtd {
13 namespace io {
15 class directory_info;
17
42 public:
44
47 static const file_info empty;
49
51
65 explicit file_info(const xtd::string& file_name);
67
69
76
99
133 bool exists() const override;
134
203 bool is_read_only() const;
272 void is_read_only(bool value);
273
327 size_t length() const;
328
362 xtd::string name() const override;
364
366
408
517 xtd::io::file_info copy_to(const xtd::string& dest_file_name) const;
627 xtd::io::file_info copy_to(const xtd::string& dest_file_name, bool overwrite) const;
628
660 std::ofstream create() const;
661
672
688 void move_to(const xtd::string& dest_file_name);
689
705 void move_to(const xtd::string& dest_file_name, bool overwrite);
706
717 std::fstream open(std::ios::openmode mode) const;
718
728 std::ifstream open_read() const;
729
740
749 std::ofstream open_write() const;
750
822 void remove() const override;
823
836 file_info replace(const xtd::string& destination_file_name, const xtd::string& destination_backup_file_name);
838
839 private:
840 file_info() = default;
841 };
842 }
843}
Represents text as a sequence of character units.
Definition basic_string.h:79
Exposes instance methods for creating, moving, and enumerating through directories and subdirectories...
Definition directory_info.h:129
Provides static methods for the creation, copying, deletion, moving, and opening of files,...
Definition file_info.h:41
std::ofstream open_write() const
Creates a write-only std::ofstream.
xtd::io::file_info copy_to(const xtd::string &dest_file_name) const
Copies an existing file to a new file, disallowing the overwriting of an existing file.
static const file_info empty
Represents the uninitialized xtd::io::file_info object. This field is constant.
Definition file_info.h:47
std::fstream open(std::ios::openmode mode) const
Opens a file in the specified mode.
std::ofstream create() const
Creates a file.
file_info replace(const xtd::string &destination_file_name, const xtd::string &destination_backup_file_name)
Replaces the contents of a specified file with the file described by the current xtd::io::file_info o...
xtd::io::file_info copy_to(const xtd::string &dest_file_name, bool overwrite) const
Copies an existing file to a new file, allowing the overwriting of an existing file.
bool exists() const override
Gets a value indicating whether a file exists.
void move_to(const xtd::string &dest_file_name, bool overwrite)
Moves a specified file to a new location, providing the options to specify a new file name and to ove...
xtd::io::stream_writer append_text() const
Creates a xtd::io::stream_writer that appends text to the file represented by this instance of the xt...
xtd::io::stream_reader open_text() const
Creates a xtd::io::stream_reader that reads from an existing text file.
xtd::io::directory_info directory() const
Gets an instance of the parent directory.
void move_to(const xtd::string &dest_file_name)
Moves a specified file to a new location, providing the option to specify a new file name.
xtd::string directory_name() const
Gets a string representing the directory's full path.
size_t length() const
Gets the size, in bytes, of the current file.
std::ifstream open_read() const
Creates a read-only std::ifstream.
xtd::io::stream_writer create_text() const
Creates a std::ofstream that writes a new text file.
bool is_read_only() const
Gets a value that determines if the current file is read only.
file_info(const xtd::string &file_name)
Initializes a new instance of the xtd::io::file_info class, which acts as a wrapper for a file path.
xtd::string name() const override
Gets the name of the file.
void is_read_only(bool value)
Sets a value that determines if the current file is read only.
void remove() const override
Permanently deletes a file.
Provides the base class for both xtd::io::file_info and xtd::io::directory_info objects.
Definition file_system_info.h:87
Implements a xtd::io::text_reader that reads characters from a byte stream.
Definition stream_reader.h:28
Implements a xtd::io::text_writer for writing characters to a stream.
Definition stream_writer.h:28
Contains xtd::io::file_system_info class.
#define core_export_
Define shared library export.
Definition core_export.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::io::stream_reader class.
Contains xtd::io::stream_writer class.