#include <dateFormatter.hpp>
Public Member Functions | |
DateFormatter (const std::string &dateFormat) noexcept | |
virtual | ~DateFormatter () noexcept |
void | format (const anch::date::Date &date, std::string &output) const noexcept |
void | format (const anch::date::Date &date, std::ostream &output) const noexcept |
void | parse (const std::string &strDate, anch::date::Date &date) const |
anch::date::Date * | parse (const std::string &strDate) const |
Static Public Member Functions | |
static void | registerFormatterPart (const std::string &pattern, getInstance instGetter) noexcept |
Date string formatter.
Paterns are:
Do not use characters '%' in your string pattern.
Warning: This class is not thread safe.
|
noexcept |
DateFormatter constructor
dateFormat | The date format |
|
virtualnoexcept |
DateFormatter destructor
|
noexcept |
Format date
date | The date to format |
output | The output stream |
|
noexcept |
Format date
date | The date to format |
output | The output string |
anch::date::Date * anch::date::DateFormatter::parse | ( | const std::string & | strDate | ) | const |
Build date from string.
You had to delete Date not to make memory leaks.
strDate | String formatted date |
InvalidFormatException | invalid format |
void anch::date::DateFormatter::parse | ( | const std::string & | strDate, |
anch::date::Date & | date ) const |
Build date from string.
You can build the output Date with Date(false) constructor.
strDate | String formatted date |
date | The output date |
InvalidFormatException | invalid format |
|
staticnoexcept |
Register a new formatter part
pattern | The formatter part pattern |
instGetter | The formatter part new instance getter |