~ubuntu-branches/ubuntu/warty/aqsis/warty

« back to all changes in this revision

Viewing changes to libri2rib/outstream.h

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-08-24 07:25:04 UTC
  • Revision ID: james.westby@ubuntu.com-20040824072504-zf993vnevvisdsvb
Tags: upstream-0.9.1
Import upstream version 0.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- C++ -*-
 
2
// Aqsis
 
3
// Copyright � 1997 - 2001, Paul C. Gregory
 
4
//
 
5
// Contact: pgregory@aqsis.com
 
6
//
 
7
// This library is free software; you can redistribute it and/or
 
8
// modify it under the terms of the GNU Lesser General Public
 
9
// License as published by the Free Software Foundation; either
 
10
// version 2.1 of the License, or (at your option) any later version.
 
11
//
 
12
// This library is distributed in the hope that it will be useful,
 
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
15
// General Public License for more details.
 
16
//
 
17
// You should have received a copy of the GNU General Public
 
18
// License along with this library; if not, write to the Free Software
 
19
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
20
 
 
21
/** \file
 
22
 *  \brief Fstream and Gzip output
 
23
 *  \author Lionel J. Lacour (intuition01@online.fr)
 
24
 */
 
25
 
 
26
#ifndef RI2RIB_OUTSTREAM_H
 
27
#define RI2RIB_OUTSTREAM_H 1
 
28
 
 
29
#include "aqsis.h"
 
30
 
 
31
#include <fstream>
 
32
#include <string>
 
33
#include <zlib.h>
 
34
#include <stdio.h>
 
35
 
 
36
 
 
37
START_NAMESPACE( libri2rib )
 
38
 
 
39
class CqStream
 
40
{
 
41
public:
 
42
    virtual CqStream & operator<<( int i ) = 0;
 
43
    virtual CqStream & operator<<( float f ) = 0;
 
44
    virtual CqStream & operator<<( std::string s ) = 0;
 
45
    virtual CqStream & operator<<( char c ) = 0;
 
46
 
 
47
    CqStream()
 
48
    {}
 
49
    virtual ~CqStream()
 
50
    {}
 
51
 
 
52
    virtual void openFile( const char * ) = 0;
 
53
    virtual void openFile ( int file_descriptor ) = 0;
 
54
    virtual void closeFile() = 0;
 
55
    virtual void flushFile() = 0;
 
56
};
 
57
 
 
58
class CqStreamGzip : public CqStream
 
59
{
 
60
private:
 
61
    gzFile gzf;
 
62
    void error();
 
63
public:
 
64
    CqStream & operator<<( int i );
 
65
    CqStream & operator<<( float f );
 
66
    CqStream & operator<<( std::string s );
 
67
    CqStream & operator<<( char c );
 
68
 
 
69
    CqStreamGzip()
 
70
    {}
 
71
    ~CqStreamGzip()
 
72
    {}
 
73
 
 
74
    void openFile( const char * );
 
75
    void openFile( int );
 
76
    void closeFile();
 
77
    void flushFile();
 
78
};
 
79
 
 
80
 
 
81
class CqStreamFDesc : public CqStream
 
82
{
 
83
private:
 
84
    FILE* fstr;
 
85
    void error();
 
86
public:
 
87
    CqStream & operator<<( int i );
 
88
    CqStream & operator<<( float f );
 
89
    CqStream & operator<<( std::string s );
 
90
    CqStream & operator<<( char c );
 
91
 
 
92
    CqStreamFDesc()
 
93
    {}
 
94
    ~CqStreamFDesc()
 
95
    {}
 
96
 
 
97
    void openFile( const char * );
 
98
    void openFile( int );
 
99
    void closeFile();
 
100
    void flushFile();
 
101
};
 
102
 
 
103
 
 
104
END_NAMESPACE( libri2rib )
 
105
#endif