// // io.cxx // dice // // Created by Sam Jaffe on 1/16/21. // Copyright © 2021 Sam Jaffe. All rights reserved. // #include #include #include "dice-roll/die.h" #include "dice-roll/io.h" #include "dice-roll/parser.h" #include "dice-roll/roll.h" namespace dice { std::ostream & operator<<(std::ostream & out, sign s) { return ::dice::template operator<<(out, s); } std::ostream & operator<<(std::ostream & out, dice const & d) { return ::dice::template operator<<(out, d); } std::ostream & operator<<(std::ostream & out, dice_roll const & r) { return ::dice::template operator<<(out, r); } std::istream & operator>>(std::istream & in, dice & d) { d = parser(in).parse(); return in; } dice from_string(std::string const & str) { std::stringstream ss(str); return parser(ss).parse(); } }