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
135 :
public std::fstream
154 std::
string filename_;
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
597 const File& operator = (
const File& file);
612 # ifndef BALL_NO_INLINE_FUNCTIONS
613 # include <BALL/SYSTEM/file.iC>
BALL_EXPORT bool operator==(const String &s1, const String &s2)
BALL_EXPORT bool operator!=(const String &s1, const String &s2)
~TransformationManager()
Destructor.
String transform(const String &name)
String findTransformation(const String &name) const
Find a transformation matching a given file name.
void registerTransformation(const String &pattern, const String &command)
Add a new transformation.
std::map< String, String > transformation_methods_
The map containing all transformation methods.
void unregisterTransformation(const String &pattern)
Delete a transformation.
TransformationManager()
Default constructor.
static bool createTemporaryFilename(String &temporary, const String &suffix=".TMP")
static bool copy(String source_name, String destination_name, Size buffer_size=4096)
static void registerTransformation(const String &pattern, const String &exec)
static void enableTransformation(Transformation transformation)
File::OpenMode getOpenMode() const
static bool move(const String &source_name, const String &destination_name)
static bool remove(String name)
bool reopen(File::OpenMode open_mode)
static bool truncate(String path, Size size=0)
static bool isTransformationEnabled(Transformation transformation)
bool isAccessible() const
static Size transformation_methods_
bool isExecutable() const
std::ios::openmode OpenMode
static HashSet< String > created_temp_filenames_
static void disableTransformation(Transformation transformation)
static const String TRANSFORMATION_HTTP_PREFIX
Prefix for HTTP-transfer "http://".
static void unregisterTransformation(const String &pattern)
TransformationManager & getTransformationManager()
static bool isWritable(String name)
static Type getType(String name, bool trace_link)
static const String TRANSFORMATION_EXEC_PREFIX
Prefix for filenames that are created through the execution of commands "exec:".
bool renameTo(const String &new_path)
static bool rename(String old_path, String new_path)
bool open(const String &name, File::OpenMode open_mode=std::ios::in)
bool truncate(Size size=0)
static Size getSize(String name)
static TransformationManager transformation_manager_
static bool isAccessible(String name)
bool copyTo(const String &destination_name, Size buffer_size=4096)
const String & getName() const
std::fstream & getFileStream()
const String & getOriginalName() const
const TransformationManager & getTransformationManager() const
Type getType(bool trace_link) const
static bool isExecutable(String name)
File(const String &name, OpenMode open_mode=std::ios::in)
static const String TRANSFORMATION_FILE_PREFIX
Prefix for files (to mimick URL-like behavior) "file:".
void setName(const String &name)
bool moveTo(const String &destination_name)
static bool isReadable(String name)
static const String TRANSFORMATION_FTP_PREFIX
Prefix for FTP-transfers "ftp://".
CannotWrite(const char *file, int line, const String &filename)