diff --git a/nyan/view.cpp b/nyan/view.cpp index d79faa7..af85116 100644 --- a/nyan/view.cpp +++ b/nyan/view.cpp @@ -1,4 +1,4 @@ -// Copyright 2017-2020 the nyan authors, LGPLv3+. See copying.md for legal info. +// Copyright 2017-2025 the nyan authors, LGPLv3+. See copying.md for legal info. #include "view.h" @@ -25,6 +25,13 @@ Object View::get_object(const fqon_t &fqon) { return Object{fqon, shared_from_this()}; } +const std::shared_ptr View::get_object_ptr(const fqon_t &fqon) { + // test for object existence + this->get_info(fqon); + + return std::make_shared(Object::Restricted{}, fqon, shared_from_this()); +} + const std::shared_ptr &View::get_raw(const fqon_t &fqon, order_t t) const { auto state = this->state.get_obj_state(fqon, t); diff --git a/nyan/view.h b/nyan/view.h index e29375f..a7185db 100644 --- a/nyan/view.h +++ b/nyan/view.h @@ -1,4 +1,4 @@ -// Copyright 2017-2020 the nyan authors, LGPLv3+. See copying.md for legal info. +// Copyright 2017-2025 the nyan authors, LGPLv3+. See copying.md for legal info. #pragma once #include @@ -31,6 +31,7 @@ class View : public std::enable_shared_from_this { View(const std::shared_ptr &database); Object get_object(const fqon_t &fqon); + const std::shared_ptr get_object_ptr(const fqon_t &fqon); const std::shared_ptr &get_raw(const fqon_t &fqon, order_t t = LATEST_T) const;