TFCweb  1.0.4 $Rev: 483 $
TFC Primavera 2012: Nucli d'un servidor web
RespostaHTTP.h
Veure la documentació d'aquest fitxer.
1 #if !defined(_RESPOSTA_HTTP_H_)
2 #define _RESPOSTA_HTTP_H_
3 
10 /*
11  * Copyright (c) 2012 Toni Corvera
12  *
13  * This file is part of TFCWeb.
14  *
15  * TFCWeb is free software: you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation, either version 3 of the License, or
18  * (at your option) any later version.
19  *
20  * TFCWeb is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with TFCWeb. If not, see <http://www.gnu.org/licenses/>.
27  */
28 
29 #include "CapsaleraHTTP.h"
30 #include "CodisEstatHTTP.h"
31 #include "CosResposta.h"
32 #include "Excepcions.h"
33 #include "MissatgeHTTP.h"
34 #include "portabilitat.h"
35 
36 #include <cassert>
37 #include <list>
38 #include <map>
39 #include <memory>
40 #include <ostream>
41 #include <string>
42 #include <boost/static_assert.hpp>
43 
44 namespace tfc {
45 
49 class RespostaHTTP : public MissatgeHTTP<CosResposta> {
50 public:
55  : MissatgeHTTP<CosResposta>(), codi_(codi), cos_()
56  {
57  // buit
58  }
59 
63  {
64  // buit
65  }
66 
67  bool operator==(const RespostaHTTP & r) const {
68  if (this == &r) {
69  return true;
70  }
71  const MissatgeHTTP<CosResposta> * pt = this, * pr = &r;
72 
73  return codi_ == r.codi_ &&
74  cos_ == r.cos_ &&
75  (*pt) == (*pr);
76  }
77 
79  CodiEstatHTTP codi() const { return codi_; }
80 
82  std::string frase() const throw (ErrorMetodeDesconegut) {
84  }
85 
86 private:
89  std::shared_ptr<CosResposta> cos_;
90 
95  friend std::ostream& operator<< (std::ostream & os, const RespostaHTTP & r) {
96  os << "RespostaHTTP {\n" << r.codi() << " " << r.frase() << "\n";
97  //os << static_cast<MissatgeHTTP>(r);
99  return os << "}";
100  }
101 };
102 
103 } // ns tfc
104 
105 #endif // _RESPOSTA_HTTP_H_
106 
107 // vim:set ts=4 et ai: //