c_iostream.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: c_iostream.h /main/4 1996/08/21 15:54:57 drk $ */
  24. #ifndef _xostream_h
  25. #define _xostream_h
  26. #include "utility/c_ios.h"
  27. class istream : public virtual ios
  28. {
  29. protected:
  30. istream& _getline(char* b, int lim, int delim, int fill_zero);
  31. int eatw(); // return EOF if no char available.
  32. // Otherwise, return the first no white char.
  33. // The char is still in the buffer.
  34. public:
  35. istream(streambuf* sb);
  36. virtual ~istream() {};
  37. istream& seekg(streampos delta, ios::seek_dir d) ;
  38. int get();
  39. istream& get(char& c);
  40. istream& putback(char c);
  41. istream& getline(char* b, int lim, char delim='\n');
  42. istream& read(char* s,int n);
  43. int gcount() ;
  44. istream& operator>>(unsigned short& c);
  45. istream& operator>>(unsigned int& c);
  46. istream& operator>>(int& c);
  47. istream& operator>>(long& c);
  48. istream& operator>>(char* s);
  49. istream& operator>>(char& c);
  50. };
  51. class ostream : virtual public ios
  52. {
  53. public:
  54. ostream(streambuf* sb);
  55. virtual ~ostream() {};
  56. ostream& operator<<(void*);
  57. ostream& operator<<(const char*);
  58. ostream& operator<<(char c);
  59. ostream& operator<<(int);
  60. ostream& operator<<(unsigned int);
  61. ostream& operator<<(long);
  62. ostream& operator<< (ostream& (*f)(ostream&));
  63. ostream& put(char);
  64. ostream& flush() ;
  65. ostream& write(const char* s,int n);
  66. };
  67. //class iostream : public istream, public ostream
  68. class iostream : public istream, public ostream
  69. {
  70. public:
  71. iostream(streambuf* sb);
  72. virtual ~iostream() {};
  73. };
  74. ostream& endl(ostream& i) ;
  75. #ifndef STREAM_DEBUG
  76. #define cout (*cout_ptr)
  77. #define cin (*cin_ptr)
  78. #define cerr (*cerr_ptr)
  79. extern ostream *cout_ptr;
  80. extern istream *cin_ptr;
  81. extern ostream *cerr_ptr;
  82. #endif
  83. #endif