Caffa  1.1.0
C++ Application Framework for Embedded Systems with introspection
cafChildFieldHandle.h
1 // ##################################################################################################
2 //
3 // Caffa
4 // Copyright (C) 2023- Kontur AS
5 //
6 // GNU Lesser General Public License Usage
7 // This library is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU Lesser General Public License as published by
9 // the Free Software Foundation; either version 2.1 of the License, or
10 // (at your option) any later version.
11 //
12 // This library is distributed in the hope that it will be useful, but WITHOUT ANY
13 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 // FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // See the GNU Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
17 // for more details.
18 //
19 // ##################################################################################################
20 #pragma once
21 
22 #include "cafFieldHandle.h"
23 
24 #include <vector>
25 
26 namespace caffa
27 {
28 class ChildFieldAccessor;
29 class Inspector;
30 class ObjectHandle;
31 class Visitor;
32 
33 template <typename DataTypePtr>
34 concept is_pointer = std::is_pointer<DataTypePtr>::value;
35 
37 {
38 public:
43  virtual std::string childClassKeyword() const = 0;
44 
45  virtual std::vector<std::shared_ptr<ObjectHandle>> childObjects() = 0;
46  virtual std::vector<std::shared_ptr<const ObjectHandle>> childObjects() const = 0;
47  virtual bool empty() const = 0;
48 
49  void accept( Inspector* visitor ) const override;
50  void accept( Editor* editor ) override;
51 };
52 
54 {
55 public:
56  virtual void setChildObject( std::shared_ptr<ObjectHandle> object ) = 0;
57 
58  virtual void setAccessor( std::unique_ptr<ChildFieldAccessor> accessor ) = 0;
59  virtual void clear() = 0;
60 };
61 } // namespace caffa
Definition: cafChildFieldHandle.h:53
Definition: cafChildFieldHandle.h:36
void accept(Inspector *visitor) const override
Definition: cafChildFieldHandle.cpp:27
virtual std::string childClassKeyword() const =0
Get the class keyword of the contained child(ren)
Definition: cafVisitor.h:49
Base class for all fields, making it possible to handle them generically.
Definition: cafFieldHandle.h:19
Definition: cafVisitor.h:32
Main Caffa namespace.
Definition: cafApplication.h:30