Unravel Engine C++ Reference
Loading...
Searching...
No Matches
property_path_generator.cpp
Go to the documentation of this file.
2#include <sstream>
3#include <algorithm>
4#include <cctype>
5
6namespace unravel
7{
8
9void property_path_context::push_segment(const std::string& segment)
10{
11 // Directly sanitize here instead of calling private method
12 path_segments_.push_back(segment);
13}
14
16{
17 if (!path_segments_.empty())
18 {
19 path_segments_.pop_back();
20 }
21}
22
24{
25 if (path_segments_.empty())
26 {
27 return "";
28 }
29
30 std::stringstream ss;
31 for (size_t i = 0; i < path_segments_.size(); ++i)
32 {
33 // For array indices, don't add a dot separator
34 if (i > 0 && path_segments_[i][0] != '[')
35 {
36 ss << "/";
37 }
38 ss << path_segments_[i];
39 }
40
41 return ss.str();
42}
43
45{
46 if (component_type_name_.empty())
47 {
48 return get_current_path();
49 }
50 return component_type_name_ + "/" + get_current_path();
51}
52
54{
55 component_type_name_ = type;
56}
57
59{
60 return component_type_name_;
61}
62
63void property_path_context::set_entity_uuid(const hpp::uuid& entity_uuid)
64{
65 entity_uuid_ = entity_uuid;
66}
67
69{
70 return entity_uuid_;
71}
72
73} // namespace unravel
manifold_type type
auto get_current_path_with_component_type() const -> std::string
void push_segment(const std::string &segment)
Push a new path segment onto the context stack.
void set_component_type(const std::string &type)
Set the component type for this context.
auto get_component_type_name() const -> std::string
Get the component type name.
void pop_segment()
Pop the last path segment from the context stack.
auto get_entity_uuid() const -> hpp::uuid
Get the entity UUID.
void set_entity_uuid(const hpp::uuid &entity_uuid)
Set the entity UUID for nested entity tracking.
auto get_current_path() const -> std::string
Get the current full property path.