properties.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //
  2. // properties.hpp
  3. // logger
  4. //
  5. // Created by Sam Jaffe on 10/3/15.
  6. //
  7. //
  8. #pragma once
  9. #include <map>
  10. #include <string>
  11. #include <vector>
  12. #include "../../../types/variant/variant.hpp"
  13. namespace logging {
  14. struct properties;
  15. using object_t = std::map<std::string, properties>;
  16. using array_t = std::vector<properties>;
  17. struct properties {
  18. bool contains(std::string const & key) const;
  19. bool contains(std::size_t idx) const;
  20. object_t const & object() const;
  21. array_t const & array() const;
  22. properties const & operator[](std::string const & key) const;
  23. properties const & operator[](char const * key) const {
  24. return operator[](std::string(key));
  25. }
  26. properties const & operator[](std::size_t idx) const;
  27. operator std::string const &() const;
  28. std::string const & str() const;
  29. operator int() const;
  30. operator bool() const;
  31. variant<object_t, array_t, std::string, int, bool> data;
  32. };
  33. extern properties const DEFAULT_APPENDER_SCHEMA;
  34. extern properties const DEFAULT_LOGGER_SCHEMA;
  35. }