The Battle for Wesnoth  1.15.3+dev
exceptions.cpp
Go to the documentation of this file.
1 //
2 // M A R I A D B + +
3 //
4 // Copyright Sylvain Rochette Langlois 2013,
5 // Frantisek Boranek 2015,
6 // The ViaDuck Project 2016 - 2018.
7 // Distributed under the Boost Software License, Version 1.0.
8 // (See accompanying file LICENSE or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
10 
11 #include <sstream>
12 #include <iomanip>
13 #include <mariadb++/exceptions.hpp>
14 
15 using namespace mariadb;
16 
17 //
18 // Constructors
19 //
20 exception::date_time::date_time(u16 year, u8 month, u8 day, u8 hour, u8 minute, u8 second,
21  u16 millisecond) throw() : base() {
22  std::ostringstream oss;
23  oss << "Invalid date time: " << std::setfill('0') << std::setw(4) << year
24  << "-" << std::setw(2) << int(month)
25  << "-" << std::setw(2) << int(day)
26  << "T" << std::setw(2) << int(hour)
27  << ":" << std::setw(2) << int(minute)
28  << ":" << std::setw(2) << int(second)
29  << "." << std::setw(3) << millisecond;
30 
31  m_error = oss.str();
32 }
33 
34 exception::time::time(u8 hour, u8 minute, u8 second, u16 millisecond) throw() : base() {
35  std::ostringstream oss;
36  oss << "Invalid time: " << std::setfill('0') << std::setw(2) << int(hour)
37  << ":" << std::setw(2) << int(minute)
38  << ":" << std::setw(2) << int(second)
39  << "." << std::setw(3) << millisecond;
40 
41  m_error = oss.str();
42 }
time(u8 hour, u8 minute, u8 second, u16 millisecond)
Definition: exceptions.cpp:34
unsigned char u8
Definition: types.hpp:20
unsigned short u16
Definition: types.hpp:21
date_time(u16 year, u8 month, u8 day, u8 hour, u8 minute, u8 second, u16 millisecond)
Definition: exceptions.cpp:20