PhoenixPresentation  2.0.0
Set of cmake function to automate presentation generation
PStream.cpp
Go to the documentation of this file.
1 /***************************************
2  Auteur : Pierre Aubert
3  Mail : pierre.aubert@lapp.in2p3.fr
4  Licence : CeCILL-C
5 ****************************************/
6 
7 
8 #include "PStream.h"
9 
13 }
14 
17  close();
18 }
19 
21 
25 bool PStream::open(const PPath & fileName, const PString & mode){
26  close();
27  p_fp = fopen(fileName.c_str(), mode.c_str());
28  return isOpen();
29 }
30 
33  if(isOpen()){
34  fclose(p_fp);
35  p_fp = NULL;
36  }
37 }
38 
40 
42 bool PStream::isOpen() const{
43  return p_fp != NULL;
44 }
45 
48  p_fp = NULL;
49 }
50 
51 
52 
53 
54 
Path of a directory or a file.
Definition: PPath.h:17
void initialisationPStream()
Initialisation function of the class PStream.
Definition: PStream.cpp:47
PStream()
Default constructor of PStream.
Definition: PStream.cpp:11
FILE * p_fp
Pointer to the main stream.
Definition: PStream.h:51
virtual ~PStream()
Destructor of PStream.
Definition: PStream.cpp:16
bool isOpen() const
Say if the stream is opened.
Definition: PStream.cpp:42
bool open(const PPath &fileName, const PString &mode="r")
Open the current stream.
Definition: PStream.cpp:25
void close()
Close the stream.
Definition: PStream.cpp:32
Extends the std::string.
Definition: PString.h:16