Orcus
global.hpp
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6  */
7 
8 #ifndef INCLUDED_ORCUS_GLOBAL_HPP
9 #define INCLUDED_ORCUS_GLOBAL_HPP
10 
11 #include "types.hpp"
12 #include "env.hpp"
13 
14 #include <memory>
15 #include <functional>
16 
17 #define ORCUS_ASCII(literal) literal, sizeof(literal)-1
18 #define ORCUS_N_ELEMENTS(name) sizeof(name)/sizeof(name[0])
19 
20 namespace orcus {
21 
22 class tokens;
23 
24 void print_element(xmlns_id_t ns, xml_token_t name);
25 
29 void print_attrs(const tokens& tokens, const xml_attrs_t& attrs);
30 
43 date_time_t to_date_time(const pstring& str);
44 
49 template<typename T>
50 struct map_object_deleter : public ::std::unary_function<typename T::value_type, void>
51 {
52  void operator() (typename T::value_type& v)
53  {
54  delete v.second;
55  }
56 };
57 
58 template<typename T, typename ...Args>
59 std::unique_ptr<T> make_unique(Args&& ...args)
60 {
61  return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
62 }
63 
64 }
65 
66 #endif
67 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: global.hpp:50
Definition: base64.hpp:15