xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
file_info.h
Go to the documentation of this file.
1 #pragma once
5 
6 #include "file_system_info.h"
7 #include "stream_reader.h"
8 #include "stream_writer.h"
9 #include <fstream>
10 
12 namespace xtd {
14  namespace io {
16  class directory_info;
18 
38  class core_export_ file_info : public xtd::io::file_system_info {
39  public:
41 
44  static const file_info empty;
46 
48 
62  explicit file_info(const xtd::ustring& file_name);
64 
66 
73 
95  xtd::ustring directory_name() const;
96 
130  bool exists() const override;
131 
200  bool is_read_only() const;
269  void is_read_only(bool value);
270 
325  size_t length() const;
326 
360  xtd::ustring name() const override;
362 
364 
406  xtd::io::stream_writer append_text() const;
407 
518  xtd::io::file_info copy_to(const xtd::ustring& dest_file_name) const;
630  xtd::io::file_info copy_to(const xtd::ustring& dest_file_name, bool overwrite) const;
631 
664  std::ofstream create() const;
665 
675  xtd::io::stream_writer create_text() const;
676 
692  void move_to(const xtd::ustring& dest_file_name);
693 
709  void move_to(const xtd::ustring& dest_file_name, bool overwrite);
710 
721  std::fstream open(std::ios::openmode mode) const;
722 
732  std::ifstream open_read() const;
733 
743  xtd::io::stream_reader open_text() const;
744 
753  std::ofstream open_write() const;
754 
828  void remove() const override;
829 
842  file_info replace(const xtd::ustring& destination_file_name, const xtd::ustring& destination_backup_file_name);
844 
845  private:
846  file_info() = default;
847  };
848  }
849 }
The file is a directory.
Provides the base class for both xtd::io::file_info and xtd::io::directory_info objects.
Definition: file_system_info.h:83
Contains xtd::io::stream_writer class.
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Implements a xtd::io::text_reader that reads characters from a byte stream.
Definition: stream_reader.h:25
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:50
Contains xtd::io::file_system_info class.
static const file_info empty
Represents the uninitialized xtd::io::file_info object. This field is constant.
Definition: file_info.h:44
Exposes instance methods for creating, moving, and enumerating through directories and subdirectories...
Definition: directory_info.h:125
Implements a xtd::io::text_writer for writing characters to a stream.
Definition: stream_writer.h:25
Provides static methods for the creation, copying, deletion, moving, and opening of files...
Definition: file_info.h:38
Contains xtd::io::stream_reader class.