/usr/include/ThePEG/Utilities/CFile.h is in libthepeg-dev 1.8.0-3build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | // -*- C++ -*-
#ifndef THEPEG_CFile_H
#define THEPEG_CFile_H
//
// This is the declaration of the CFile class.
//
#include "Exception.h"
namespace ThePEG {
/**
* Here is the documentation of the CFile class.
*/
class CFile {
public:
/**
* Type of the file
*/
enum FileType {
undefined, plain, pipe, gzip, bzip2
};
public:
/** @name Standard constructors and destructors. */
//@{
/**
* The default constructor.
*/
CFile(): file(0), fileType(undefined) {}
/**
* Create a CFile given a file name and a mode.
*/
CFile(string filename, string mode)
: file(0), fileType(undefined) {
open(filename, mode);
}
/**
* The destructor.
*/
~CFile() {}
//@}
/**
* Open the file
*/
void open(string filename, string mode);
/**
* Close the file
*/
void close();
/**
* Pointer to the file
*/
operator void * () const {
return fileType != undefined? file: 0;
}
/**
* Exist for file existance
*/
bool operator!() const {
return !(operator void * ());
}
/**
* Get characters
*/
char * gets(char * s, int size);
/**
* Set characters
*/
int puts(const char * s);
/**
* Get the current character
*/
int getc();
/**
* Set the current character
*/
int putc(int c);
/** Pushes the byte specified by \a c (converted to an unsigned char)
* back onto the stream
*/
int ungetc(int c);
/**
* Read
*/
size_t read(void *ptr, size_t size, size_t nmemb = 1);
/**
* Write
*/
size_t write(const void *ptr, size_t size, size_t nmemb = 1);
private:
/**
* Pointer to the file
*/
void * file;
/**
* Type of the file
*/
FileType fileType;
public:
/** @cond EXCEPTIONCLASSES */
/** Exception class used by CFile if reading a file fails. */
class FileError: public Exception {};
/** @endcond */
};
}
#endif /* THEPEG_CFile_H */
|