5 #ifndef BALL_SYSTEM_FILE_H
6 #define BALL_SYSTEM_FILE_H
8 #ifndef BALL_DATATYPE_REGULAREXPRESSION_H
12 #ifndef BALL_DATATYPE_STRING_H
16 #ifndef BALL_SYSTEM_FILESYSTEM_H
27 #ifdef BALL_COMPILER_MSVC
29 # define S_ISREG _S_ISREG
32 # define S_ISDIR _S_ISDIR
34 # define S_ISCHR _S_ISCHR
35 # define S_ISBLK _S_ISBLK
36 # define S_ISFIFO _S_ISFIFO
37 # define access _access
42 #include <sys/types.h>
46 #ifdef BALL_HAS_UNISTD_H
50 #ifdef BALL_COMPILER_MSVC
100 void registerTransformation(
const String& pattern,
const String& command);
103 void unregisterTransformation(
const String& pattern);
138 :
public std::fstream
154 String getFilename()
const;
204 TRANSFORMATION__EXEC = 1,
206 TRANSFORMATION__FILTER = 2,
208 TRANSFORMATION__URL = 3
220 TYPE__CHAR_SPECIAL_FILE = 2,
222 TYPE__BLOCK_SPECIAL_FILE = 3,
224 TYPE__REGULAR_FILE = 4,
226 TYPE__SYMBOLIC_LINK = 5,
230 TYPE__FIFO_SPECIAL_FILE = 7
269 virtual void clear();
324 void setName(
const String& name);
328 const String& getOriginalName()
const;
355 static Type getType(
String name,
bool trace_link);
362 Type getType(
bool trace_link)
const;
372 static bool copy(
String source_name,
String destination_name,
Size buffer_size = 4096);
381 bool copyTo(
const String& destination_name,
Size buffer_size = 4096);
390 static bool move(
const String& source_name,
const String& destination_name);
398 bool moveTo(
const String& destination_name);
404 static bool remove(
String name);
425 bool renameTo(
const String& new_path);
433 static bool truncate(
String path,
Size size = 0);
440 bool truncate(
Size size = 0);
456 std::fstream& getFileStream();
488 static bool isTransformationEnabled(
Transformation transformation);
492 static void registerTransformation(
const String& pattern,
const String& exec);
496 static void unregisterTransformation(
const String& pattern);
523 bool isClosed()
const;
529 static bool isAccessible(
String name);
535 bool isAccessible()
const;
544 bool isCanonized()
const;
551 static bool isReadable(
String name);
557 bool isReadable()
const;
564 static bool isWritable(
String name);
570 bool isWritable()
const;
577 static bool isExecutable(
String name);
583 bool isExecutable()
const;
595 bool isValid()
const;
600 const File& operator = (
const File& file);
615 # ifndef BALL_NO_INLINE_FUNCTIONS
616 # include <BALL/SYSTEM/file.iC>
621 #endif // BALL_SYSTEM_FILE_H
BALL_VIEW_EXPORT String createTemporaryFilename()
Create a temporary filename in the users home dir.
static HashSet< String > created_temp_filenames_
static const String TRANSFORMATION_EXEC_PREFIX
Prefix for filenames that are created through the execution of commands "exec:".
static const OpenMode MODE_OUT
Open for output.
static const String TRANSFORMATION_FILE_PREFIX
Prefix for files (to mimick URL-like behavior) "file:".
std::ios::openmode OpenMode
static const OpenMode MODE_APP
Append. Seek to end before each write operation.
static const String TRANSFORMATION_FTP_PREFIX
Prefix for FTP-transfers "ftp://".
static const OpenMode MODE_TRUNC
Truncate an existing file.
BALL_EXPORT bool operator!=(const String &s1, const String &s2)
BALL_EXPORT bool operator==(const String &s1, const String &s2)
static const OpenMode MODE_ATE
Seek to end directly after opening.
static Size transformation_methods_
static const OpenMode MODE_BINARY
Binary mode.
static TransformationManager transformation_manager_
static const String TRANSFORMATION_HTTP_PREFIX
Prefix for HTTP-transfer "http://".