NAP
componentresourcepath.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4 
5 #pragma once
6 
7 #include "utility/errorstate.h"
8 #include <string>
9 #include <vector>
10 
11 namespace nap
12 {
13  class Entity;
14 
19  {
20  public:
21  ComponentResourcePath() = default;
22 
23  ComponentResourcePath(const Entity& root);
24 
28  const Entity& getRoot() const { return *mRoot; }
29 
34  void push(int childIndex);
35 
39  void pop();
40 
45  void pushComponent(const std::string& component);
46 
50  void popComponent();
51 
60  static bool fromString(const Entity& root, const std::string& path, ComponentResourcePath& resolvedPath, utility::ErrorState& errorState);
61 
66  bool operator==(const ComponentResourcePath& other) const;
67 
68  private:
69  const Entity* mRoot = nullptr;
70  std::vector<int> mPath;
71  std::string mCurrentComponent;
72  };
73 }
nap::ComponentResourcePath::push
void push(int childIndex)
nap::ComponentResourcePath::popComponent
void popComponent()
nap::utility::ErrorState
Definition: errorstate.h:19
nap::ComponentResourcePath::ComponentResourcePath
ComponentResourcePath()=default
nap::ComponentResourcePath::getRoot
const Entity & getRoot() const
Definition: componentresourcepath.h:28
nap::ComponentResourcePath::pop
void pop()
nap::ComponentResourcePath::pushComponent
void pushComponent(const std::string &component)
nap
Definition: templateapp.h:17
nap::ComponentResourcePath::fromString
static bool fromString(const Entity &root, const std::string &path, ComponentResourcePath &resolvedPath, utility::ErrorState &errorState)
nap::ComponentResourcePath::operator==
bool operator==(const ComponentResourcePath &other) const
nap::Entity
Definition: entity.h:339
nap::ComponentResourcePath
Definition: componentresourcepath.h:18