PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
virtual_path_serialization.h
1#pragma once
2
3#include "pixelbullet/filesystem/virtual_path.h"
4#include "pixelbullet/serialization/node.h"
5#include "pixelbullet/serialization/node_reader.h"
6
7#include <utility>
8
9namespace pixelbullet
10{
11inline const Node& operator>>(const Node& node, VirtualPath& path)
12{
13 path = VirtualPath(node.value());
14 return node;
15}
16
17inline Node& operator<<(Node& node, const VirtualPath& path)
18{
19 return node << path.logical_path();
20}
21
22[[nodiscard]] inline bool TryReadNode(const Node& node, VirtualPath& path, serialization::NodeReader& reader)
23{
24 std::string logical_path;
25 if (!serialization::TryReadNode(node, logical_path, reader))
26 {
27 return false;
28 }
29
30 path = VirtualPath(std::move(logical_path));
31 return true;
32}
33} // namespace pixelbullet
Represents a hierarchical node capable of storing various data types and supporting YAML serializatio...
Definition node.h:49
Definition virtual_path.h:10
Definition node_reader.h:48