GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
PropertiesContainer.h
1 #pragma once
2 #include "EventsFunctionsContainer.h"
3 #include "GDCore/Tools/SerializableWithNameList.h"
4 #include "NamedPropertyDescriptor.h"
5 
6 namespace gd {
7 
17  : public SerializableWithNameList<NamedPropertyDescriptor> {
18  public:
19  PropertiesContainer(EventsFunctionsContainer::FunctionOwner owner)
21 
24  owner(other.owner) {}
25 
26  PropertiesContainer& operator=(const PropertiesContainer& other) {
27  if (this != &other) {
29  owner = other.owner;
30  }
31  return *this;
32  }
33 
34  void ForEachPropertyMatchingSearch(
35  const gd::String& search,
36  std::function<void(const gd::NamedPropertyDescriptor& property)> fn)
37  const {
38  for (const auto& property : elements) {
39  if (property->GetName().FindCaseInsensitive(search) != gd::String::npos)
40  fn(*property);
41  }
42  }
43 
44  EventsFunctionsContainer::FunctionOwner GetOwner() const { return owner; }
45 
46  private:
47  EventsFunctionsContainer::FunctionOwner owner;
48 };
49 
50 } // namespace gd
Used to describe a property shown in a property grid.
Definition: NamedPropertyDescriptor.h:21
const gd::String & GetName() const
Get the name of the property.
Definition: NamedPropertyDescriptor.h:47
A container of properties, used for custom behaviors, custom objects, extensions.....
Definition: PropertiesContainer.h:17
A class template that store a list of elements that can be accessed by their names and serialized.
Definition: SerializableWithNameList.h:33
String represents an UTF8 encoded string.
Definition: String.h:31
size_type FindCaseInsensitive(const String &search, size_type pos=0) const
Do a case-insensitive search.
Definition: String.cpp:661
Definition: CommonTools.h:24