1 #ifndef CGI___FCGIBUF__HPP
2 #define CGI___FCGIBUF__HPP
3 
4 /*  $Id: fcgibuf.hpp 258493 2011-03-21 18:52:34Z grichenk $
5  * ===========================================================================
6  *
7  *                            PUBLIC DOMAIN NOTICE
8  *               National Center for Biotechnology Information
9  *
10  *  This software/database is a "United States Government Work" under the
11  *  terms of the United States Copyright Act.  It was written as part of
12  *  the author's official duties as a United States Government employee and
13  *  thus cannot be copyrighted.  This software/database is freely available
14  *  to the public for use. The National Library of Medicine and the U.S.
15  *  Government have not placed any restriction on its use or reproduction.
16  *
17  *  Although all reasonable efforts have been taken to ensure the accuracy
18  *  and reliability of the software and data, the NLM and the U.S.
19  *  Government do not and cannot warrant the performance or results that
20  *  may be obtained by using this software or data. The NLM and the U.S.
21  *  Government disclaim all warranties, express or implied, including
22  *  warranties of performance, merchantability or fitness for any particular
23  *  purpose.
24  *
25  *  Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Author: Eugene Vasilchenko
30  *
31  * File Description:
32  *   Adapter class between C++ and FastCGI streams.
33  *
34  */
35 
36 #include <corelib/ncbistd.hpp>
37 
38 
39 struct FCGX_Stream;
40 
41 
42 BEGIN_NCBI_SCOPE
43 
44 
45 class CCgiObuffer : public IO_PREFIX::streambuf
46 {
47 public:
48     CCgiObuffer(FCGX_Stream* out);
49     virtual ~CCgiObuffer(void);
50 
51     virtual CT_INT_TYPE overflow(CT_INT_TYPE c);
52     virtual int         sync(void);
53 
GetCount(void) const54     Uint8 GetCount(void) const { return m_cnt; }
55 
56 private:
57     FCGX_Stream* m_out;
58     Uint8 m_cnt;
59 };
60 
61 
62 class CCgiIbuffer : public IO_PREFIX::streambuf
63 {
64 public:
65     CCgiIbuffer(FCGX_Stream* in);
66 
67     virtual CT_INT_TYPE underflow(void);
68 
GetCount(void) const69     Uint8 GetCount(void) const { return m_cnt; }
70 
71 private:
72     void x_Setg(void);
73 
74     FCGX_Stream* m_in;
75     Uint8 m_cnt;
76 };
77 
78 
79 END_NCBI_SCOPE
80 
81 #endif  /* CGI___FCGIBUF__HPP */
82