files.hh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /**
  2. * \class Files
  3. *
  4. * \brief Read Write files
  5. *
  6. * \note nothing to add
  7. *
  8. * \author $Author: Adrien Carteron$
  9. *
  10. * \version $Revision: 1.0 $
  11. *
  12. * \date $Date: 2014/07/11 $
  13. *
  14. * Contact: acarteron@openmailbox.org
  15. *
  16. * Created on: 2011/04/11
  17. *
  18. *
  19. */
  20. #ifndef FILES_HH
  21. #define FILES_HH
  22. //#include <iostream>
  23. #include <sstream>
  24. #include <fstream>
  25. #include <istream>
  26. #include <cstring>
  27. #include <vector>
  28. class Files{
  29. private:
  30. std::string fileName; ///< the file name
  31. std::string ResRead; ///< the line read
  32. std::ifstream curentFile; ///< the reading stream
  33. std::ofstream curentFileO; ///< the writing stream
  34. std::string openingMode; ///< the opening mode
  35. void define_mode(unsigned int);
  36. /// This method creates the input or output stream
  37. void create_File();
  38. public:
  39. /** \brief Void constructor
  40. *
  41. * This only set opening method as in
  42. *
  43. */
  44. Files();
  45. /** \brief One arguement constructor
  46. * \param opening mode
  47. *
  48. * Set opening mode as in if ague is 0
  49. * out else
  50. *
  51. */
  52. Files(unsigned int);
  53. /** \brief One arguement constructor
  54. * \param file name as string
  55. *
  56. * Set opening mode as in
  57. * set file name calling method setFileName
  58. *
  59. */
  60. Files(std::string);
  61. /** \brief Two arguement constructor
  62. * \param file name as string, opening mode as string
  63. *
  64. * Set opening mode
  65. * set file name calling method setFileName
  66. *
  67. */
  68. Files(std::string,std::string);
  69. /** \brief Destructor
  70. *
  71. * Close the file
  72. *
  73. */
  74. virtual ~Files();
  75. /** \brief Method to set file name
  76. * \param file name as string
  77. *
  78. */
  79. virtual void setFileName(std::string);
  80. /** \brief Two arguement constructor
  81. * \param file name as string, opening mode as string
  82. *
  83. * Set opening mode
  84. * set file name calling method setFileName
  85. *
  86. */
  87. virtual int openFile();
  88. virtual int closeFile();
  89. virtual std::string readFile();
  90. virtual std::string readLine();
  91. virtual std::vector<std::string> readLines();
  92. virtual int writeFile(std::string);
  93. };
  94. #endif