ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/GoogleTron/Zlib/Error.hpp
(Generate patch)

Comparing:
GoogleTron/GzipWriter.hpp (file contents), Revision 674 by douglas, 2006-03-02T23:47:54-08:00 vs.
GoogleTron/Zlib/Error.hpp (file contents), Revision 697 by douglas, 2006-03-10T04:17:42-08:00

# Line 1 | Line 1
1 < // Gzip Writer
1 > // Zlib Error
2   //
3   // Douglas Thrift
4   //
5   // $Id$
6  
7 < #ifndef _GzipWriter_hpp_
8 < #define _GzipWriter_hpp_
7 > #ifndef _Zlib_Error_hpp_
8 > #define _Zlib_Error_hpp_
9  
10   #include <cxx/platform.hpp>
11  
# Line 14 | Line 14
14   #endif
15  
16   #include <api/error.hpp>
17 #include <ios/streams.hpp>
17  
18   #include <errno.h>
19   #include <zlib.h>
20  
21 + namespace Zlib
22 + {
23 +
24   class Error : public api::Error
25   {
26          int code;
# Line 26 | Line 28 | class Error : public api::Error
28   public:
29          Error(gzFile file) : message(::gzerror(file, &code))
30          {
31 < //              if (code == Z_ERRNO)
31 >                if (code == Z_ERRNO)
32 > #if defined(API_HAS_POSIX)
33 >                        throw api::Posix::Error();
34 > #endif
35          }
36  
37          virtual int GetNumber() const
# Line 36 | Line 41 | public:
41  
42          virtual cse::String GetMessage() const
43          {
44 <                return message;
44 >                return _S<ios::String>() << "Zlib[#" << code << "] " << message;
45          }
46   };
47  
# Line 56 | Line 61 | _finline int CheckError(int status, gzFi
61          return status;
62   }
63  
64 < class GzipWriter : public ios::Writer
60 < {
61 <        gzFile file;
62 < public:
63 <        GzipWriter(const cse::String &path);
64 <        virtual ~GzipWriter();
65 <        virtual size_t Write(const byte_t *data, size_t length);
66 <        virtual void Flush();
67 < };
64 > }
65  
66 < #endif//_GzipWriter_hpp_
66 > #endif//_Zlib_Error_hpp_

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines