Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef TIME_H
- #define TIME_H
- #include <string>
- #include <sstream>
- class Time{
- public:
- Time();
- Time(int h, int m, int s);
- Time(std::string const& t);
- Time(Time const& other);
- int hour() const noexcept; //Getter
- int minute() const noexcept; //Getter
- int second() const noexcept; //Getter
- void check_boundary(int const h, int const m, int const s) const;
- bool is_am() const;
- std::string to_string() const;
- std::string to_string(bool format) const;
- operator std::string() const;
- bool operator==(Time const& rhs) const;
- bool operator!=(Time const& rhs) const;
- bool operator<(Time const& rhs) const;
- bool operator>(Time const& rhs) const;
- bool operator<=(Time const& rhs) const;
- bool operator>=(Time const& rhs) const;
- Time operator+(int const rhs) const;
- Time operator-(int const rhs) const;
- Time& operator++();
- Time& operator--();
- Time operator++(int);
- Time operator--(int);
- private:
- int h;
- int m;
- int s;
- };
- std::ostream& operator<<(std::ostream& lhs, Time const& rhs);
- std::istream& operator>>(std::istream& lhs, Time& rhs);
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement