1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Class Poco::File</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="language" content="en"/>
<meta name="date" content="2009-11-24"/>
<meta name="generator" content="PocoDoc"/>
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
<div class="header">
<h1 class="namespace"><a href="Poco.html" class="namespace">Poco</a></h1>
<h1 class="symbol">class File</h1>
</div>
<div class="body">
<p>
<b>Library:</b> Foundation<br />
<b>Package:</b> Filesystem<br />
<b>Header:</b> Poco/File.h</p>
<h2>Description</h2>
<div class="description">
<p>The <a href="Poco.File.html" title="class Poco::File">File</a> class provides methods for working with a file. </p>
</div>
<h2>Inheritance</h2>
<p><b>Direct Base Classes: </b>FileImpl</p>
<p><b>All Base Classes: </b>FileImpl</p>
<p><b>Known Derived Classes: </b><a href="Poco.TemporaryFile.html" title="class Poco::TemporaryFile">TemporaryFile</a></p>
<h2>Member Summary</h2>
<p><b>Member Functions: </b><a href="Poco.File.html#6930" title="Poco::File::canExecute()">canExecute</a>, <a href="Poco.File.html#6928" title="Poco::File::canRead()">canRead</a>, <a href="Poco.File.html#6929" title="Poco::File::canWrite()">canWrite</a>, <a href="Poco.File.html#6978" title="Poco::File::copyDirectory()">copyDirectory</a>, <a href="Poco.File.html#6949" title="Poco::File::copyTo()">copyTo</a>, <a href="Poco.File.html#6959" title="Poco::File::createDirectories()">createDirectories</a>, <a href="Poco.File.html#6958" title="Poco::File::createDirectory()">createDirectory</a>, <a href="Poco.File.html#6957" title="Poco::File::createFile()">createFile</a>, <a href="Poco.File.html#6936" title="Poco::File::created()">created</a>, <a href="Poco.File.html#6927" title="Poco::File::exists()">exists</a>, <a href="Poco.File.html#6937" title="Poco::File::getLastModified()">getLastModified</a>, <a href="Poco.File.html#6940" title="Poco::File::getSize()">getSize</a>, <a href="Poco.File.html#6976" title="Poco::File::handleLastError()">handleLastError</a>, <a href="Poco.File.html#6934" title="Poco::File::isDevice()">isDevice</a>, <a href="Poco.File.html#6933" title="Poco::File::isDirectory()">isDirectory</a>, <a href="Poco.File.html#6931" title="Poco::File::isFile()">isFile</a>, <a href="Poco.File.html#6935" title="Poco::File::isHidden()">isHidden</a>, <a href="Poco.File.html#6932" title="Poco::File::isLink()">isLink</a>, <a href="Poco.File.html#6960" title="Poco::File::list()">list</a>, <a href="Poco.File.html#6951" title="Poco::File::moveTo()">moveTo</a>, <a href="Poco.File.html#6966" title="Poco::File::operator !=()">operator !=</a>, <a href="Poco.File.html#6968" title="Poco::File::operator <()">operator <</a>, <a href="Poco.File.html#6970" title="Poco::File::operator <=()">operator <=</a>, <a href="Poco.File.html#6916" title="Poco::File::operator =()">operator =</a>, <a href="Poco.File.html#6964" title="Poco::File::operator ==()">operator ==</a>, <a href="Poco.File.html#6972" title="Poco::File::operator >()">operator ></a>, <a href="Poco.File.html#6974" title="Poco::File::operator >=()">operator >=</a>, <a href="Poco.File.html#6926" title="Poco::File::path()">path</a>, <a href="Poco.File.html#6955" title="Poco::File::remove()">remove</a>, <a href="Poco.File.html#6953" title="Poco::File::renameTo()">renameTo</a>, <a href="Poco.File.html#6947" title="Poco::File::setExecutable()">setExecutable</a>, <a href="Poco.File.html#6938" title="Poco::File::setLastModified()">setLastModified</a>, <a href="Poco.File.html#6945" title="Poco::File::setReadOnly()">setReadOnly</a>, <a href="Poco.File.html#6941" title="Poco::File::setSize()">setSize</a>, <a href="Poco.File.html#6943" title="Poco::File::setWriteable()">setWriteable</a>, <a href="Poco.File.html#6924" title="Poco::File::swap()">swap</a></p>
<h2>Types</h2>
<h3><a name="6905">FileSize</a></h3>
<p class="decl">typedef FileSizeImpl <a href="Poco.File.html#6905" title="Poco::File::FileSize">FileSize</a>;</p>
<div class="description">
<p></p>
</div>
<h2>Constructors</h2>
<h3><a name="6906">File</a></h3>
<p class="decl"><a href="Poco.File.html" title="class Poco::File">File</a>();</p>
<div class="description">
<p>Creates the file. </p>
</div>
<h3><a name="6907">File</a></h3>
<p class="decl"><a href="Poco.File.html" title="class Poco::File">File</a>(<br /> const std::string & path<br />);</p>
<div class="description">
<p>Creates the file. </p>
</div>
<h3><a name="6909">File</a></h3>
<p class="decl"><a href="Poco.File.html" title="class Poco::File">File</a>(<br /> const char * path<br />);</p>
<div class="description">
<p>Creates the file. </p>
</div>
<h3><a name="6911">File</a></h3>
<p class="decl"><a href="Poco.File.html" title="class Poco::File">File</a>(<br /> const <a href="Poco.Path.html" title="class Poco::Path">Path</a> & path<br />);</p>
<div class="description">
<p>Creates the file. </p>
</div>
<h3><a name="6913">File</a></h3>
<p class="decl"><a href="Poco.File.html" title="class Poco::File">File</a>(<br /> const <a href="Poco.File.html" title="class Poco::File">File</a> & file<br />);</p>
<div class="description">
<p>Copy constructor. </p>
</div>
<h2>Destructor</h2>
<h3><a name="6915">~File</a> <img src="images/virtual.gif" alt="virtual" title="virtual" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">virtual ~<a href="Poco.File.html" title="class Poco::File">File</a>();</p>
<div class="description">
<p>Destroys the file. </p>
</div>
<h2>Member Functions</h2>
<h3><a name="6930">canExecute</a></h3>
<p class="decl">bool canExecute() const;</p>
<div class="description">
<p>Returns true if and only if the file is executable. </p>
<p>On Windows and OpenVMS, the file must have the extension ".EXE" to be executable. On Unix platforms, the executable permission bit must be set. </p>
</div>
<h3><a name="6928">canRead</a></h3>
<p class="decl">bool canRead() const;</p>
<div class="description">
<p>Returns true if and only if the file is readable. </p>
</div>
<h3><a name="6929">canWrite</a></h3>
<p class="decl">bool canWrite() const;</p>
<div class="description">
<p>Returns true if and only if the file is writeable. </p>
</div>
<h3><a name="6949">copyTo</a></h3>
<p class="decl">void copyTo(<br /> const std::string & path<br />) const;</p>
<div class="description">
<p>Copies the file (or directory) to the given path. The target path can be a directory. </p>
<p>A directory is copied recursively. </p>
</div>
<h3><a name="6959">createDirectories</a></h3>
<p class="decl">void createDirectories();</p>
<div class="description">
<p>Creates a directory (and all parent directories if necessary). </p>
</div>
<h3><a name="6958">createDirectory</a></h3>
<p class="decl">bool createDirectory();</p>
<div class="description">
<p>Creates a directory. Returns true if the directory has been created and false if it already exists. Throws an exception if an error occurs. </p>
</div>
<h3><a name="6957">createFile</a></h3>
<p class="decl">bool createFile();</p>
<div class="description">
<p>Creates a new, empty file in an atomic operation. Returns true if the file has been created and false if the file already exists. Throws an exception if an error occurs. </p>
</div>
<h3><a name="6936">created</a></h3>
<p class="decl"><a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> created() const;</p>
<div class="description">
<p>Returns the creation date of the file. </p>
<p>Not all platforms or filesystems (e.g. Linux and most Unix platforms with the exception of FreeBSD and Mac OS X) maintain the creation date of a file. On such platforms, <a href="Poco.File.html#6936" title="Poco::File::created()">created</a>() returns the time of the last inode modification. </p>
</div>
<h3><a name="6927">exists</a></h3>
<p class="decl">bool exists() const;</p>
<div class="description">
<p>Returns true if and only if the file exists. </p>
</div>
<h3><a name="6937">getLastModified</a></h3>
<p class="decl"><a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> getLastModified() const;</p>
<div class="description">
<p>Returns the modification date of the file. </p>
</div>
<h3><a name="6940">getSize</a></h3>
<p class="decl"><a href="Poco.File.html#6905" title="Poco::File::FileSize">FileSize</a> getSize() const;</p>
<div class="description">
<p>Returns the size of the file in bytes. </p>
</div>
<h3><a name="6976">handleLastError</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">static void handleLastError(<br /> const std::string & path<br />);</p>
<div class="description">
<p>For internal use only. Throws an appropriate exception for the last file-related error. </p>
</div>
<h3><a name="6934">isDevice</a></h3>
<p class="decl">bool isDevice() const;</p>
<div class="description">
<p>Returns true if and only if the file is a device. </p>
</div>
<h3><a name="6933">isDirectory</a></h3>
<p class="decl">bool isDirectory() const;</p>
<div class="description">
<p>Returns true if and only if the file is a directory. </p>
</div>
<h3><a name="6931">isFile</a></h3>
<p class="decl">bool isFile() const;</p>
<div class="description">
<p>Returns true if and only if the file is a regular file. </p>
</div>
<h3><a name="6935">isHidden</a></h3>
<p class="decl">bool isHidden() const;</p>
<div class="description">
<p>Returns true if the file is hidden. </p>
<p>On Windows platforms, the file's hidden attribute is set for this to be true. </p>
<p>On Unix platforms, the file name must begin with a period for this to be true. </p>
</div>
<h3><a name="6932">isLink</a></h3>
<p class="decl">bool isLink() const;</p>
<div class="description">
<p>Returns true if and only if the file is a symbolic link. </p>
</div>
<h3><a name="6960">list</a></h3>
<p class="decl">void list(<br /> std::vector < std::string > & files<br />) const;</p>
<div class="description">
<p>Fills the vector with the names of all files in the directory. </p>
</div>
<h3><a name="6962">list</a></h3>
<p class="decl">void list(<br /> std::vector < <a href="Poco.File.html" title="class Poco::File">File</a> > & files<br />) const;</p>
<div class="description">
<p>Fills the vector with the names of all files in the directory. </p>
</div>
<h3><a name="6951">moveTo</a></h3>
<p class="decl">void moveTo(<br /> const std::string & path<br />);</p>
<div class="description">
<p>Copies the file (or directory) to the given path and removes the original file. The target path can be a directory. </p>
</div>
<h3><a name="6966">operator !=</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">bool operator != (<br /> const <a href="Poco.File.html" title="class Poco::File">File</a> & file<br />) const;</p>
<div class="description">
<p></p>
</div>
<h3><a name="6968">operator <</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">bool operator < (<br /> const <a href="Poco.File.html" title="class Poco::File">File</a> & file<br />) const;</p>
<div class="description">
<p></p>
</div>
<h3><a name="6970">operator <=</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">bool operator <= (<br /> const <a href="Poco.File.html" title="class Poco::File">File</a> & file<br />) const;</p>
<div class="description">
<p></p>
</div>
<h3><a name="6916">operator =</a></h3>
<p class="decl"><a href="Poco.File.html" title="class Poco::File">File</a> & operator = (<br /> const <a href="Poco.File.html" title="class Poco::File">File</a> & file<br />);</p>
<div class="description">
<p>Assignment operator. </p>
</div>
<h3><a name="6918">operator =</a></h3>
<p class="decl"><a href="Poco.File.html" title="class Poco::File">File</a> & operator = (<br /> const std::string & path<br />);</p>
<div class="description">
<p>Assignment operator. </p>
</div>
<h3><a name="6920">operator =</a></h3>
<p class="decl"><a href="Poco.File.html" title="class Poco::File">File</a> & operator = (<br /> const char * path<br />);</p>
<div class="description">
<p>Assignment operator. </p>
</div>
<h3><a name="6922">operator =</a></h3>
<p class="decl"><a href="Poco.File.html" title="class Poco::File">File</a> & operator = (<br /> const <a href="Poco.Path.html" title="class Poco::Path">Path</a> & path<br />);</p>
<div class="description">
<p>Assignment operator. </p>
</div>
<h3><a name="6964">operator ==</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">bool operator == (<br /> const <a href="Poco.File.html" title="class Poco::File">File</a> & file<br />) const;</p>
<div class="description">
<p></p>
</div>
<h3><a name="6972">operator ></a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">bool operator > (<br /> const <a href="Poco.File.html" title="class Poco::File">File</a> & file<br />) const;</p>
<div class="description">
<p></p>
</div>
<h3><a name="6974">operator >=</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">bool operator >= (<br /> const <a href="Poco.File.html" title="class Poco::File">File</a> & file<br />) const;</p>
<div class="description">
<p></p>
</div>
<h3><a name="6926">path</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">const std::string & path() const;</p>
<div class="description">
<p>Returns the path. </p>
</div>
<h3><a name="6955">remove</a></h3>
<p class="decl">void remove(<br /> bool recursive = false<br />);</p>
<div class="description">
<p>Deletes the file. If recursive is true and the file is a directory, recursively deletes all files in the directory. </p>
</div>
<h3><a name="6953">renameTo</a></h3>
<p class="decl">void renameTo(<br /> const std::string & path<br />);</p>
<div class="description">
<p>Renames the file to the new name. </p>
</div>
<h3><a name="6947">setExecutable</a></h3>
<p class="decl">void setExecutable(<br /> bool flag = true<br />);</p>
<div class="description">
<p>Makes the file executable (if flag is true), or non-executable (if flag is false) by setting the file's permission bits accordingly. </p>
<p>Does nothing on Windows and OpenVMS. </p>
</div>
<h3><a name="6938">setLastModified</a></h3>
<p class="decl">void setLastModified(<br /> const <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> & ts<br />);</p>
<div class="description">
<p>Sets the modification date of the file. </p>
</div>
<h3><a name="6945">setReadOnly</a></h3>
<p class="decl">void setReadOnly(<br /> bool flag = true<br />);</p>
<div class="description">
<p>Makes the file non-writeable (if flag is true), or writeable (if flag is false) by setting the file's flags in the filesystem accordingly. </p>
</div>
<h3><a name="6941">setSize</a></h3>
<p class="decl">void setSize(<br /> <a href="Poco.File.html#6905" title="Poco::File::FileSize">FileSize</a> size<br />);</p>
<div class="description">
<p>Sets the size of the file in bytes. Can be used to truncate a file. </p>
</div>
<h3><a name="6943">setWriteable</a></h3>
<p class="decl">void setWriteable(<br /> bool flag = true<br />);</p>
<div class="description">
<p>Makes the file writeable (if flag is true), or non-writeable (if flag is false) by setting the file's flags in the filesystem accordingly. </p>
</div>
<h3><a name="6924">swap</a></h3>
<p class="decl">void swap(<br /> <a href="Poco.File.html" title="class Poco::File">File</a> & file<br />);</p>
<div class="description">
<p>Swaps the file with another one. </p>
</div>
<h3><a name="6978">copyDirectory</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">void copyDirectory(<br /> const std::string & path<br />) const;</p>
<div class="description">
<p>Copies a directory. Used internally by <a href="Poco.File.html#6949" title="Poco::File::copyTo()">copyTo</a>(). </p>
</div>
<p class="footer">POCO C++ Libraries 1.3.6-all<br />
Copyright © 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p>
</div>
</body>
</html>
|