AnCH Framework 0.1
Another C++ Hack Framework
 
Loading...
Searching...
No Matches
dateFormatter.hpp
1/*
2 ANCH Framework: ANother C++ Hack is a C++ framework based on C++11 standard
3 Copyright (C) 2012 Vincent Lachenal
4
5 This file is part of ANCH Framework.
6
7 ANCH Framework is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 ANCH Framework is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with ANCH Framework. If not, see <http://www.gnu.org/licenses/>.
19*/
20#pragma once
21
22#include <iostream>
23#include <map>
24#include <vector>
25#include <regex>
26
27#include "date/date.hpp"
28#include "date/invalidFormatException.hpp"
29
30
31namespace anch {
32 namespace date {
33
36
59
60 // Attributes +
62 const static std::regex DATE_PATTERN;
63
65 std::vector<anch::date::formatter::IDatePartFormatter*> _formatters;
66
68 size_t _size;
69 // Attributes -
70
71 // Constructors +
72 public:
78 DateFormatter(const std::string& dateFormat) noexcept;
79 // Constructors -
80
81 // Destructor +
82 public:
86 virtual ~DateFormatter() noexcept;
87 // Destructor -
88
89 // Methods +
90 public:
97 static void registerFormatterPart(const std::string& pattern, getInstance instGetter) noexcept;
98
105 void format(const anch::date::Date& date, std::string& output) const noexcept;
106
113 void format(const anch::date::Date& date, std::ostream& output) const noexcept;
114
124 void parse(const std::string& strDate, anch::date::Date& date) const;
125
136 anch::date::Date* parse(const std::string& strDate) const;
137
138 private:
144 void addFormatter(const std::string& strFormatter) noexcept;
145 // Methods -
146
147 };
148
149 }
150}
virtual ~DateFormatter() noexcept
void parse(const std::string &strDate, anch::date::Date &date) const
static void registerFormatterPart(const std::string &pattern, getInstance instGetter) noexcept
DateFormatter(const std::string &dateFormat) noexcept
void format(const anch::date::Date &date, std::string &output) const noexcept
Definition date.hpp:45
Definition iDatePartFormatter.hpp:37
Date namespace.
anch::date::formatter::IDatePartFormatter *(* getInstance)()
Definition dateFormatter.hpp:35
AnCH framework base namespace.
Definition app.hpp:28