Go to the documentation of this file.
5 #ifndef BALL_SYSTEM_FILE_H
6 #define BALL_SYSTEM_FILE_H
8 #ifndef BALL_DATATYPE_STRING_H
12 #ifndef BALL_SYSTEM_FILESYSTEM_H
23 #ifdef BALL_COMPILER_MSVC
25 # define S_ISREG _S_ISREG
28 # define S_ISDIR _S_ISDIR
30 # define S_ISCHR _S_ISCHR
31 # define S_ISBLK _S_ISBLK
32 # define S_ISFIFO _S_ISFIFO
37 #include <sys/types.h>
41 #ifdef BALL_HAS_UNISTD_H
45 #ifdef BALL_COMPILER_MSVC
97 void registerTransformation(
const String& pattern,
const String& command);
100 void unregisterTransformation(
const String& pattern);
135 :
public std::fstream
151 String getFilename()
const;
201 TRANSFORMATION__EXEC = 1,
203 TRANSFORMATION__FILTER = 2,
205 TRANSFORMATION__URL = 3
217 TYPE__CHAR_SPECIAL_FILE = 2,
219 TYPE__BLOCK_SPECIAL_FILE = 3,
221 TYPE__REGULAR_FILE = 4,
223 TYPE__SYMBOLIC_LINK = 5,
227 TYPE__FIFO_SPECIAL_FILE = 7
266 virtual void clear();
321 void setName(
const String& name);
325 const String& getOriginalName()
const;
352 static Type getType(
String name,
bool trace_link);
359 Type getType(
bool trace_link)
const;
369 static bool copy(
String source_name,
String destination_name,
Size buffer_size = 4096);
378 bool copyTo(
const String& destination_name,
Size buffer_size = 4096);
387 static bool move(
const String& source_name,
const String& destination_name);
395 bool moveTo(
const String& destination_name);
401 static bool remove(
String name);
422 bool renameTo(
const String& new_path);
430 static bool truncate(
String path,
Size size = 0);
437 bool truncate(
Size size = 0);
453 std::fstream& getFileStream();
485 static bool isTransformationEnabled(
Transformation transformation);
489 static void registerTransformation(
const String& pattern,
const String& exec);
493 static void unregisterTransformation(
const String& pattern);
520 bool isClosed()
const;
526 static bool isAccessible(
String name);
532 bool isAccessible()
const;
541 bool isCanonized()
const;
548 static bool isReadable(
String name);
554 bool isReadable()
const;
561 static bool isWritable(
String name);
567 bool isWritable()
const;
574 static bool isExecutable(
String name);
580 bool isExecutable()
const;
592 bool isValid()
const;
597 const File& operator = (
const File& file);
612 # ifndef BALL_NO_INLINE_FUNCTIONS
613 # include <BALL/SYSTEM/file.iC>
618 #endif // BALL_SYSTEM_FILE_H
static const String TRANSFORMATION_FTP_PREFIX
Prefix for FTP-transfers "ftp://".
BALL_EXPORT bool operator!=(const String &s1, const String &s2)
static const OpenMode MODE_APP
Append. Seek to end before each write operation.
static const OpenMode MODE_TRUNC
Truncate an existing file.
static const OpenMode MODE_BINARY
Binary mode.
BALL_VIEW_EXPORT String createTemporaryFilename()
Create a temporary filename in the users home dir.
static HashSet< String > created_temp_filenames_
std::ios::openmode OpenMode
static const OpenMode MODE_OUT
Open for output.
std::map< String, String > transformation_methods_
The map containing all transformation methods.
static TransformationManager transformation_manager_
BALL_EXPORT bool operator==(const String &s1, const String &s2)
static const String TRANSFORMATION_FILE_PREFIX
Prefix for files (to mimick URL-like behavior) "file:".
static const OpenMode MODE_ATE
Seek to end directly after opening.
static const String TRANSFORMATION_HTTP_PREFIX
Prefix for HTTP-transfer "http://".
static Size transformation_methods_
static const String TRANSFORMATION_EXEC_PREFIX
Prefix for filenames that are created through the execution of commands "exec:".