1 /* 2 * Copyright (C) 2015-2017 Codership Oy <info@codership.com> 3 */ 4 5 #include "gu_gtid.hpp" 6 #include "gu_throw.hpp" 7 8 #include <cassert> 9 10 void print(std::ostream & os) const11gu::GTID::print(std::ostream& os) const 12 { 13 os << uuid_ << ':' << seqno_; 14 } 15 16 void scan(std::istream & is)17gu::GTID::scan(std::istream& is) 18 { 19 UUID u; 20 char c; 21 seqno_t s; 22 23 try 24 { 25 is >> u >> c >> s; 26 } 27 catch (std::exception& e) 28 { 29 gu_throw_error(EINVAL) << e.what(); 30 } 31 32 if (c != ':') 33 { 34 gu_throw_error(EINVAL) << "Malformed GTID: '" << u << c << s << '\''; 35 } 36 37 uuid_ = u; 38 seqno_ = s; 39 } 40