| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- //
- // property.h
- // reflection
- //
- // Created by Sam Jaffe on 2/20/23.
- // Copyright © 2023 Sam Jaffe. All rights reserved.
- //
- #pragma once
- #include <string>
- #include <string_view>
- #include <vector>
- #include "reflection/forward.h"
- namespace reflection {
- class Property {
- private:
- std::string context_;
- std::string type_name_;
- std::vector<std::string> path_;
-
- public:
- explicit Property(std::string const &context = "") : context_(context) {}
-
- template <typename C, typename = std::enable_if_t<IS_SCOPE_CONTAINER(C)>>
- Property(std::string const &context, std::string const & type_name, C const & path)
- : context_(context), type_name_(type_name),
- path_(path.begin(), path.end()) {}
-
- template <typename C, typename = std::enable_if_t<IS_SCOPE_CONTAINER(C)>>
- Property(std::string const & type_name, C const & path)
- : Property("", type_name, path) {}
- std::string_view context() const { return context_; }
-
- std::string_view type_name() const { return type_name_; }
-
- auto begin() const { return path_.begin(); }
- auto end() const { return path_.end(); }
- };
- }
|