libcrn  3.9.5
A document image processing library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Static Public Member Functions | List of all members
crn::IO Class Reference

General purpose IO class. More...

#include <CRNIO.h>

Classes

class  Directory
 A handler to the content of a directory. More...
 

Public Types

enum  { EXISTS, READ, WRITE, EXECUTE }
 IO modes (use with IO::Access()) More...
 

Static Public Member Functions

static void Debug (const String &msg)
 Prints debug messages. Please use CRNDebug() macro instead. More...
 
static void Warning (const String &msg)
 Prints warning messages. Please use CRNWarning() macro instead. More...
 
static void Verbose (const String &msg)
 Prints verbose messages. Please use CRNVerbose() macro instead. More...
 
static void Error (const String &msg)
 Prints error messages. Please use CRNError() macro instead. More...
 
static std::shared_ptr
< Messenger > & 
CurrentMessenger ()
 Delegate that will print the messages. More...
 
static bool & IsQuiet ()
 If true, Debug, Warning, Verbose and Error don't print anything. More...
 
static bool & IsVerbose ()
 Controls whether CRNVerbose prints something or not. More...
 
static void Mkdir (const Path &name)
 Creates a directory. More...
 
static void Rm (const Path &name)
 Removes a file. More...
 
static void ShieldRm (const Path &name)
 Removes a file and protects it with mutex. More...
 
static void Rmdir (const Path &name)
 Recursively removes a directory. More...
 
static bool Access (const Path &name, int mode)
 Checks rights on a file. More...
 
static void Copy (const Path &src, const Path &dst)
 Copies a file. More...
 
static void ShieldCopy (const Path &src, const Path &dst)
 Copies a file and protects source and destination with mutex. More...
 

Detailed Description

General purpose IO class.

This class contains methods to send messages to the end-user via the console or Gtk objects.

Author
Yann LEYDIER
Date
June 2009

Definition at line 43 of file CRNIO.h.

Member Enumeration Documentation

anonymous enum

IO modes (use with IO::Access())

Enumerator
EXISTS 
READ 
WRITE 
EXECUTE 

Definition at line 79 of file CRNIO.h.

Member Function Documentation

bool IO::Access ( const Path name,
int  mode 
)
static

Checks rights on a file.

Checks accessibility of a file or directory

Parameters
[in]namethe path
[in]modewhat to check (IO::EXISTS, IO::READ, IO::WRITE, IO::EXECUTE)
Returns
true if success, false else

Definition at line 161 of file CRNIO.cpp.

void IO::Copy ( const Path src,
const Path dst 
)
static

Copies a file.

Copies a file

Exceptions
ExceptionInvalidArgumentsource and destination are equal
ExceptionIOcannot open source or destination file
Parameters
[in]srcthe source file
[in]dstthe destination file

Definition at line 263 of file CRNIO.cpp.

std::shared_ptr< Messenger > & IO::CurrentMessenger ( )
static

Delegate that will print the messages.

Delegate that will print the messages

Returns
a reference to the delegate

Definition at line 68 of file CRNIO.cpp.

void IO::Debug ( const String msg)
static

Prints debug messages. Please use CRNDebug() macro instead.

Prints a message with a "Debug" flag

Parameters
[in]msgThe message to print

Definition at line 80 of file CRNIO.cpp.

void IO::Error ( const String msg)
static

Prints error messages. Please use CRNError() macro instead.

Prints a message with a "Error" flag

Parameters
[in]msgThe message to print

Definition at line 122 of file CRNIO.cpp.

bool & IO::IsQuiet ( )
static

If true, Debug, Warning, Verbose and Error don't print anything.

If true, Debug, Warning, Verbose and Error don't print anything.

Returns
a reference to the configuration variable

Definition at line 48 of file CRNIO.cpp.

bool & IO::IsVerbose ( )
static

Controls whether CRNVerbose prints something or not.

Controls whether CRNVerbose prints something or not

Returns
a reference to the configuration variable

Definition at line 58 of file CRNIO.cpp.

void IO::Mkdir ( const Path name)
static

Creates a directory.

Creates a directory.

Exceptions
ExceptionIOcannot create directory
Parameters
[in]namethe name of the directory

Definition at line 137 of file CRNIO.cpp.

void IO::Rm ( const Path name)
static

Removes a file.

Removes a file

Exceptions
ExceptionIOcannot remove file
Parameters
[in]namethe name of the file

Definition at line 175 of file CRNIO.cpp.

void IO::Rmdir ( const Path name)
static

Recursively removes a directory.

Removes a directory and its content

Parameters
[in]namethe name of the directory
Exceptions
ExceptionIOcannot remove file or directory

Definition at line 205 of file CRNIO.cpp.

void IO::ShieldCopy ( const Path src,
const Path dst 
)
static

Copies a file and protects source and destination with mutex.

Copies a file and protects source and destination with mutex

Exceptions
ExceptionInvalidArgumentsource and destination are equal
ExceptionIOcannot open source or destination file
Parameters
[in]srcthe source file
[in]dstthe destination file

Definition at line 295 of file CRNIO.cpp.

void IO::ShieldRm ( const Path name)
static

Removes a file and protects it with mutex.

Removes a file and protects it with mutex

Exceptions
ExceptionIOcannot remove file
Parameters
[in]namethe name of the file

Definition at line 193 of file CRNIO.cpp.

void IO::Verbose ( const String msg)
static

Prints verbose messages. Please use CRNVerbose() macro instead.

Prints a information message

Parameters
[in]msgThe message to print

Definition at line 108 of file CRNIO.cpp.

void IO::Warning ( const String msg)
static

Prints warning messages. Please use CRNWarning() macro instead.

Prints a message with a "Warning" flag

Parameters
[in]msgThe message to print

Definition at line 94 of file CRNIO.cpp.


The documentation for this class was generated from the following files: