cesium-native 0.43.0
Loading...
Searching...
No Matches
Result.h
1#pragma once
2
3#include <CesiumUtility/ErrorList.h>
4#include <CesiumUtility/IntrusivePointer.h>
5
6#include <optional>
7
8namespace CesiumUtility {
9
16template <typename T> struct Result {
22 Result(T value_) noexcept : value(std::move(value_)), errors() {}
23
31 Result(T value_, ErrorList errors_) noexcept
32 : value(std::move(value_)), errors(std::move(errors_)) {}
33
40 Result(ErrorList errors_) noexcept : value(), errors(std::move(errors_)) {}
41
49 std::optional<T> value;
50
59};
60
67template <typename T> struct Result<CesiumUtility::IntrusivePointer<T>> {
75 : pValue(std::move(pValue_)), errors() {}
76
86 : pValue(std::move(pValue_)), errors(std::move(errors_)) {}
87
94 Result(ErrorList errors_) noexcept
95 : pValue(nullptr), errors(std::move(errors_)) {}
96
105
114};
115
122template <typename T> using ResultPointer = Result<IntrusivePointer<T>>;
123
124} // namespace CesiumUtility
A smart pointer that calls addReference and releaseReference on the controlled object.
Utility classes for Cesium.
The container to store the error and warning list when loading a tile or glTF content.
Definition ErrorList.h:17
CesiumUtility::IntrusivePointer< T > pValue
The value, if the operation succeeded to the point where it can provide one.
Definition Result.h:104
Result(CesiumUtility::IntrusivePointer< T > pValue_) noexcept
Creates a Result with the given value and an empty ErrorList.
Definition Result.h:74
ErrorList errors
The errors and warnings that occurred during the operation.
Definition Result.h:113
Result(CesiumUtility::IntrusivePointer< T > pValue_, ErrorList errors_) noexcept
Creates a Result with the given value and ErrorList.
Definition Result.h:85
Result(ErrorList errors_) noexcept
Creates a Result with an empty value and the given ErrorList.
Definition Result.h:94
Holds the result of an operation. If the operation succeeds, it will provide a value....
Definition Result.h:16
Result(ErrorList errors_) noexcept
Creates a Result with an empty value and the given ErrorList.
Definition Result.h:40
ErrorList errors
The errors and warnings that occurred during the operation.
Definition Result.h:58
Result(T value_, ErrorList errors_) noexcept
Creates a Result with the given value and ErrorList.
Definition Result.h:31
std::optional< T > value
The value, if the operation succeeded to the point where it can provide one.
Definition Result.h:49
Result(T value_) noexcept
Creates a Result with the given value and an empty ErrorList.
Definition Result.h:22