thepeg
is hosted by
Hepforge
,
IPPP Durham
ThePEG
2.3.0
Utilities
CFile.h
1
// -*- C++ -*-
2
#ifndef THEPEG_CFile_H
3
#define THEPEG_CFile_H
4
//
5
// This is the declaration of the CFile class.
6
//
7
8
#include "Exception.h"
9
10
namespace
ThePEG
{
11
15
class
CFile
{
16
17
public
:
18
22
enum
FileType
{
23
undefined, plain, pipe, gzip, bzip2
24
};
25
26
public
:
27
33
CFile
():
file
(0),
fileType
(undefined) {}
34
38
CFile
(
string
filename,
string
mode)
39
:
file
(0),
fileType
(undefined) {
40
open
(filename, mode);
41
}
42
46
~CFile
() {}
48
52
void
open
(
string
filename,
string
mode);
53
57
void
close
();
58
62
operator
void
* ()
const
{
63
return
fileType
!= undefined?
file
: 0;
64
}
65
69
bool
operator!
()
const
{
70
return
!(
operator
void
* ());
71
}
72
76
char
*
gets
(
char
* s,
int
size);
77
81
int
puts
(
const
char
* s);
82
86
int
getc
();
87
91
int
putc
(
int
c);
92
96
int
ungetc
(
int
c);
97
101
size_t
read
(
void
*ptr,
size_t
size,
size_t
nmemb = 1);
102
106
size_t
write
(
const
void
*ptr,
size_t
size,
size_t
nmemb = 1);
107
108
private
:
109
113
void
*
file
;
114
118
FileType
fileType
;
119
120
public
:
121
124
class
FileError:
public
Exception
{};
127
};
128
129
}
130
131
132
#endif
/* THEPEG_CFile_H */
ThePEG::CFile
Here is the documentation of the CFile class.
Definition:
CFile.h:15
ThePEG::CFile::~CFile
~CFile()
The destructor.
Definition:
CFile.h:46
ThePEG::CFile::operator!
bool operator!() const
Exist for file existance.
Definition:
CFile.h:69
ThePEG::CFile::gets
char * gets(char *s, int size)
Get characters.
ThePEG::CFile::FileType
FileType
Type of the file.
Definition:
CFile.h:22
ThePEG::CFile::file
void * file
Pointer to the file.
Definition:
CFile.h:113
ThePEG::CFile::getc
int getc()
Get the current character.
ThePEG::CFile::ungetc
int ungetc(int c)
Pushes the byte specified by c (converted to an unsigned char) back onto the stream.
ThePEG::CFile::write
size_t write(const void *ptr, size_t size, size_t nmemb=1)
Write.
ThePEG::CFile::CFile
CFile()
The default constructor.
Definition:
CFile.h:33
ThePEG::CFile::putc
int putc(int c)
Set the current character.
ThePEG::CFile::puts
int puts(const char *s)
Set characters.
ThePEG::CFile::CFile
CFile(string filename, string mode)
Create a CFile given a file name and a mode.
Definition:
CFile.h:38
ThePEG::CFile::fileType
FileType fileType
Type of the file.
Definition:
CFile.h:118
ThePEG::CFile::close
void close()
Close the file.
ThePEG::CFile::read
size_t read(void *ptr, size_t size, size_t nmemb=1)
Read.
ThePEG::CFile::open
void open(string filename, string mode)
Open the file.
ThePEG::Exception
Exception is the base class for all exceptions to be used in ThePEG.
Definition:
Exception.h:44
ThePEG
This is the main namespace within which all identifiers in ThePEG are declared.
Definition:
FactoryBase.h:28
Generated on Thu Jun 20 2024 14:47:00 for ThePEG by
1.9.6