started with object proxy

This commit is contained in:
Sascha Kühl 2025-02-20 18:20:23 +01:00
parent dfb0d7c56a
commit 0eb1ae9fe8
4 changed files with 59 additions and 0 deletions

View File

@ -0,0 +1,17 @@
#ifndef COLLECTION_HPP
#define COLLECTION_HPP
#include <vector>
namespace matador::object {
template < class Type >
class collection {
public:
private:
};
}
#endif //COLLECTION_HPP

View File

@ -0,0 +1,14 @@
#ifndef DICTIONARY_HPP
#define DICTIONARY_HPP
namespace matador::object {
template < class Key, class Value >
class dictionary {
public:
private:
};
}
#endif //DICTIONARY_HPP

View File

@ -0,0 +1,26 @@
#ifndef OBJECT_PROXY_HPP
#define OBJECT_PROXY_HPP
#include <memory>
namespace matador::object {
class basic_object_proxy {
public:
virtual ~basic_object_proxy() = default;
virtual void *get() const = 0;
};
template<class Type>
class object_proxy : public basic_object_proxy {
public:
void *get() const override { return static_cast<Type *>(this)->get(); }
Type* operator->() const { return obj_.get(); }
private:
std::shared_ptr<Type> obj_{};
};
}
#endif //OBJECT_PROXY_HPP

View File

@ -6,6 +6,8 @@ add_library(matador-core STATIC
../../include/matador/object/many_to_many_relation.hpp
../../include/matador/object/object_definition.hpp
../../include/matador/object/object_info.hpp
../../include/matador/object/object_proxy.hpp
../../include/matador/object/object_ptr.hpp
../../include/matador/object/schema.hpp
../../include/matador/object/schema_node.hpp
../../include/matador/object/schema_node_iterator.hpp