You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.3 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * Turbo Vision - Version 2.0
  3. *
  4. * Copyright (c) 1994 by Borland International
  5. * All Rights Reserved.
  6. *
  7. Modified by Robert H�hne to be used for RHIDE.
  8. Modified to compile with gcc v3.x by Salvador E. Tropea, with the help of
  9. Andris Pavenis and Christoph Bauer.
  10. SET: I introduced an important change: now buf is a pointer to a filebuf
  11. and not a filebuf. This is much more convenient to make the code
  12. compilable with gcc 3.x without breaking compatibility.
  13. SET: Added a filebuf wrapper to get access to protected members needed
  14. to open associate a filebuf with a C stream/file handle. Andris proposed
  15. this idea. This is needed for gcc 3.1 and we don't know how long this
  16. trick will be used.
  17. *
  18. *
  19. */
  20. /* ------------------------------------------------------------------------*/
  21. /* */
  22. /* class fpbase */
  23. /* */
  24. /* Base class for handling streamable objects on file streams */
  25. /* */
  26. /* ------------------------------------------------------------------------*/
  27. #if defined( Uses_fpbase ) && !defined( __fpbase )
  28. #define __fpbase
  29. #ifdef CLY_DefineSpecialFileBuf
  30. class CLY_int_filebuf: public CLY_filebuf
  31. {
  32. public:
  33. CLY_int_filebuf() : CLY_filebuf() {};
  34. CLY_int_filebuf(FILE *f, std::ios_base::openmode mode)
  35. { open(f,mode); };
  36. CLY_int_filebuf(int h, std::ios_base::openmode mode)
  37. { open(h,mode); };
  38. CLY_int_filebuf *open(FILE *f, std::ios_base::openmode);
  39. CLY_int_filebuf *open(int h, std::ios_base::openmode);
  40. CLY_filebuf *open(const char *file, std::ios_base::openmode mode)
  41. { return CLY_filebuf::open(file,mode); };
  42. };
  43. #endif
  44. class fpbase : virtual public pstream
  45. {
  46. public:
  47. fpbase();
  48. fpbase( const char *, CLY_OpenModeT, int = CLY_FBOpenProtDef );
  49. fpbase( int );
  50. fpbase( int, char *, int );
  51. ~fpbase();
  52. void open( const char *, CLY_OpenModeT, int = CLY_FBOpenProtDef );
  53. #ifdef CLY_HaveFBAttach
  54. void attach( int );
  55. #endif
  56. void close();
  57. void setbuf( char *, int );
  58. CLY_filebuf * rdbuf();
  59. private:
  60. CLY_int_filebuf *buf;
  61. };
  62. #endif // Uses_fpbase