TFCweb  1.0.4 $Rev: 483 $
TFC Primavera 2012: Nucli d'un servidor web
DataHTTP.h
Veure la documentació d'aquest fitxer.
1 #if !defined(_DATA_HTTP_H_)
2 #define _DATA_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 "Excepcions.h"
30 #include "portabilitat.h"
31 
32 #include <ctime>
33 #include <locale>
34 #include <sstream>
35 #include <string>
36 #include <boost/date_time.hpp>
37 
38 namespace tfc {
39 
41 public:
42  explicit ErrorFormatDataIncorrecte(const std::string & w = "Format de data/hora incorrecte")
43  : ErrorTFC(w)
44  {
45  // buit
46  }
47 };
48 
62 std::string data_http(std::time_t t);
63  // Dreçera
67 inline std::string data_http(const boost::posix_time::ptime & pt) {
68  std::tm t(boost::posix_time::to_tm(pt));
69  return data_http(std::mktime(&t));
70 }
71 
76 std::string data_http();
77 
91 time_t llegeix_data_http(const std::string & s) throw (ErrorFormatDataIncorrecte);
92 
93 } // ns tfc
94 
95 #endif // _DATA_HTTP_H_
96 
97 // vim:set ts=4 et ai: //