home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 Mobile / Chip_Mobile_2001.iso / palm / business / printcar / printcar.exe / src / Util / DataInputStream.h < prev    next >
C/C++ Source or Header  |  2000-06-03  |  734b  |  36 lines

  1. //
  2. //  $Id: DataInputStream.h,v 1.1.1.1 2000/06/02 22:23:02 sergey Exp $
  3. //
  4.  
  5. #ifndef _DataInputStream_h_
  6. #define _DataInputStream_h_
  7.  
  8. #include "InputStream.h"
  9.  
  10.  
  11. namespace Util
  12. {
  13.     //
  14.     // Abstract base stream class, oriented to read concrete data types.
  15.     //
  16.     class DataInputStream: public InputStream
  17.     {
  18.     public:
  19.         int readAsString(char* string, int length) const   { return readData(string, length); }
  20.  
  21.         template <typename T>
  22.         T readAs() const;
  23.     };
  24.  
  25.     template <typename T>
  26.     T DataInputStream::readAs() const
  27.     {
  28.         T value = T();
  29.         readData(&value, sizeof(T));
  30.         return value;
  31.     }
  32. }
  33. // namespace Util
  34.  
  35. #endif // _DataInputStream_h_
  36.