You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

39 lines
768 B

  1. #pragma once
  2. #include <cppcore/misc/exception.h>
  3. #include "types.h"
  4. namespace cpphibernate
  5. {
  6. /* timestamp */
  7. timestamp::timestamp(uint64_t v)
  8. : value(v)
  9. { }
  10. timestamp& timestamp::operator=(const uint64_t& v)
  11. {
  12. value = v;
  13. return *this;
  14. }
  15. timestamp::operator uint64_t() const
  16. { return value; }
  17. /* uuid */
  18. uuid::uuid()
  19. : std::array<uint8_t, 16>::array({ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } })
  20. { }
  21. uuid::uuid(const std::string& str)
  22. : std::array<uint8_t, 16>::array({ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } })
  23. {
  24. if (!from_string(str, *this))
  25. throw ::cppcore::argument_exception("str", "invalid uuid");
  26. }
  27. }