Generated on: Thu Mar 29 07:46:58 PDT 2012 for custom file set
// doxy/ or-tools/ src/ base/

operations_research::File Class Reference

#include <file.h>

List of all members.

Public Member Functions

size_t Read (void *const buff, size_t size)
 Reads "size" bytes to buff from file, buff should be pre-allocated.
void ReadOrDie (void *const buff, size_t size)
 Reads "size" bytes to buff from file, buff should be pre-allocated.
char * ReadLine (char *const output, uint64 max_length)
 Reads a line from file to a string.
int64 ReadToString (std::string *const line, uint64 max_length)
 Reads the whole file to a string, with a maximum length of 'max_length'.
size_t Write (const void *const buff, size_t size)
 Writes "size" bytes of buff to file, buff should be pre-allocated.
void WriteOrDie (const void *const buff, size_t size)
 Writes "size" bytes of buff to file, buff should be pre-allocated.
size_t WriteString (const std::string &line)
 Writse a string to file.
bool WriteLine (const std::string &line)
 Writes a string to file and append a "\n".
bool Close ()
 Closes the file.
bool Flush ()
 Flushes buffer.
size_t Size ()
 Returns file size.
std::string CreateFileName () const
 Returns the file name.
bool Open () const

Static Public Member Functions

static FileOpen (const char *const name, const char *const flag)
 Opens file "name" with flags specified by "flag".
static FileOpen (const std::string &name, const char *const mode)
static FileOpenOrDie (const char *const name, const char *const flag)
 Opens file "name" with flags specified by "flag" If open failed, program will exit.
static void Init ()
 Inits internal data structures.
static bool Delete (char *const name)
 Deletes a file.
static bool Exists (char *const name)
 Tests if a file exists.


Detailed Description

Definition at line 26 of file file.h.


Member Function Documentation

File * operations_research::File::Open ( const char *const   name,
const char *const   flag 
) [static]

Opens file "name" with flags specified by "flag".

Flags are defined by fopen(), that is "r", "r+", "w", "w+". "a", and "a+". no overloading

Definition at line 88 of file file.cc.

static File* operations_research::File::Open ( const std::string &  name,
const char *const   mode 
) [inline, static]

Definition at line 33 of file file.h.

File * operations_research::File::OpenOrDie ( const char *const   name,
const char *const   flag 
) [static]

Opens file "name" with flags specified by "flag" If open failed, program will exit.

Definition at line 78 of file file.cc.

size_t operations_research::File::Read ( void *const   buff,
size_t  size 
)

Reads "size" bytes to buff from file, buff should be pre-allocated.

Definition at line 67 of file file.cc.

void operations_research::File::ReadOrDie ( void *const   buff,
size_t  size 
)

Reads "size" bytes to buff from file, buff should be pre-allocated.

If read failed, program will exit.

Definition at line 63 of file file.cc.

char * operations_research::File::ReadLine ( char *const   output,
uint64  max_length 
)

Reads a line from file to a string.

Each line must be no more than max_length bytes

Definition at line 95 of file file.cc.

int64 operations_research::File::ReadToString ( std::string *const   line,
uint64  max_length 
)

Reads the whole file to a string, with a maximum length of 'max_length'.

Returns the number of bytes read.

Definition at line 99 of file file.cc.

size_t operations_research::File::Write ( const void *const   buff,
size_t  size 
)

Writes "size" bytes of buff to file, buff should be pre-allocated.

Definition at line 74 of file file.cc.

void operations_research::File::WriteOrDie ( const void *const   buff,
size_t  size 
)

Writes "size" bytes of buff to file, buff should be pre-allocated.

If write failed, program will exit.

Definition at line 71 of file file.cc.

size_t operations_research::File::WriteString ( const std::string &  line  ) 

Writse a string to file.

Definition at line 124 of file file.cc.

bool operations_research::File::WriteLine ( const std::string &  line  ) 

Writes a string to file and append a "\n".

Definition at line 128 of file file.cc.

bool operations_research::File::Close (  ) 

Closes the file.

Definition at line 54 of file file.cc.

bool operations_research::File::Flush (  ) 

Flushes buffer.

Definition at line 50 of file file.cc.

size_t operations_research::File::Size (  ) 

Returns file size.

Definition at line 44 of file file.cc.

void operations_research::File::Init (  )  [static]

Inits internal data structures.

Definition at line 141 of file file.cc.

std::string operations_research::File::CreateFileName (  )  const

Returns the file name.

Definition at line 133 of file file.cc.

bool operations_research::File::Delete ( char *const   name  )  [static]

Deletes a file.

Definition at line 36 of file file.cc.

bool operations_research::File::Exists ( char *const   name  )  [static]

Tests if a file exists.

Definition at line 40 of file file.cc.

bool operations_research::File::Open (  )  const

Definition at line 137 of file file.cc.


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