HTTPHeader.h
Go to the documentation of this file.
1/* -*-mode:c++; c-file-style: "gnu";-*- */
2/*
3 * $Id: HTTPHeader.h,v 1.10 2014/04/23 20:55:08 sebdiaz Exp $
4 *
5 * Copyright (C) 1996 - 2004 Stephen F. Booth <sbooth@gnu.org>
6 * 2007 Sebastien DIAZ <sebastien.diaz@gmail.com>
7 * Part of the GNU cgicc library, http://www.gnu.org/software/cgicc
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 3 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
22 */
23
24#ifndef _HTTPHEADER_H_
25#define _HTTPHEADER_H_ 1
26
27#ifdef __GNUG__
28# pragma interface
29#endif
30
36#include <string>
37#include <vector>
38
39#include "MStreamable.h"
40#include "HTTPCookie.h"
41
42namespace cgicc {
43
44 // ============================================================
45 // Class HTTPHeader
46 // ============================================================
47
52 class CGICC_API HTTPHeader : public MStreamable
53 {
54 public:
55
58
63 HTTPHeader(const std::string& data);
64
69 HTTPHeader(const HTTPHeader& header);
70
75 virtual ~HTTPHeader();
77
78 // ============================================================
79
82
87 inline HTTPHeader&
88 setCookie(const HTTPCookie& cookie)
89 { fCookies.push_back(cookie); return *this; }
90
95 inline const std::vector<HTTPCookie>&
96 getCookies() const
97 { return fCookies; }
99
100 // ============================================================
101
104
109 inline std::string
110 getData() const
111 { return fData; }
113
114 // ============================================================
115
118
125 virtual void
126 render(std::ostream& out) const = 0;
128
129 private:
130 HTTPHeader();
131
132 std::string fData;
133 std::vector<HTTPCookie> fCookies;
134 };
135
136} // namespace cgicc
137
138#endif /* ! _HTTPHEADER_H_ */
An HTTP Cookie.
Abstract base class for all streamable objects.
An HTTP cookie.
Definition: HTTPCookie.h:59
Abstract base class for all simple HTTP response headers.
Definition: HTTPHeader.h:53
HTTPHeader(const HTTPHeader &header)
Copy constructor.
HTTPHeader & setCookie(const HTTPCookie &cookie)
Set a cookie to go out with this HTTPResponseHeader.
Definition: HTTPHeader.h:88
virtual void render(std::ostream &out) const =0
Write this HTTPHeader to a stream.
HTTPHeader(const std::string &data)
Constructor.
virtual ~HTTPHeader()
Destructor.
std::string getData() const
Definition: HTTPHeader.h:110
const std::vector< HTTPCookie > & getCookies() const
Get a list of all cookies associated with this header.
Definition: HTTPHeader.h:96
Mix-in streamable interface.
Definition: MStreamable.h:67
The namespace containing the cgicc library.
Definition: Cgicc.h:52

GNU cgicc - A C++ class library for writing CGI applications
Copyright © 1996 - 2004 Stephen F. Booth
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front Cover Texts, and with no Back-Cover Texts.
Documentation generated Fri Mar 1 2024 08:39:41 for cgicc by doxygen 1.9.6