|
Blender V5.3
|
#include <asset_index.hh>
Public Types | |
| enum class | Type { Success , Failure , Cancelled } |
Public Member Functions | |
| ReadingResult (Type type) | |
| bool | is_success () const |
| bool | is_failure () const |
| bool | is_cancelled () const |
| bool | has_warnings () const |
| template<typename U> | |
| void | move_warnings_from (ReadingResult< U > &other) |
| ReadingResult | without_success_value () const |
| template<typename U = T> requires (!std::is_same_v<U, std::monostate>) | |
| T & | operator* () |
| template<typename U = T> requires (!std::is_same_v<U, std::monostate>) | |
| const T & | operator* () const |
| template<typename U = T> requires (!std::is_same_v<U, std::monostate>) | |
| T * | operator-> () |
| template<typename U = T> requires (!std::is_same_v<U, std::monostate>) | |
| const T * | operator-> () const |
| template<typename U> | |
| ReadingResult (const ReadingResult< U > &other) | |
Static Public Member Functions | |
| template<typename U = T> requires (std::is_same_v<U, std::monostate>) | |
| static ReadingResult | Success () |
| template<typename U = T> requires (!std::is_same_v<U, std::monostate>) | |
| static ReadingResult | Success (T value) |
| static ReadingResult | Failure (const StringRef failure_reason) |
| static ReadingResult | Cancelled () |
Public Attributes | |
| Type | type |
| std::string | failure_reason |
| std::optional< T > | success_value |
| Vector< std::string > | warnings |
Result of reading a remote listing.
Can be in any of these three states:
type=Success: has a 'success value' of type T, and a vector of warnings (strings; may be empty).
type=Failure: has a 'failure message' (may be empty, but for good UX better to always use).
type=Cancelled: has no extra info, because this was in response to a user cancelling an operation (and so this happening should be expected).
Definition at line 48 of file asset_index.hh.
|
strong |
| Enumerator | |
|---|---|
| Success | |
| Failure | |
| Cancelled | |
Definition at line 50 of file asset_index.hh.
|
inlineexplicit |
Construct a ReadingResult with the given type.
NOTE: Do not use this function, use one of the above functions instead. It's public only because it's needed in internal code of this class, but across differently-templated versions of this class (which C++ considers to be unrelated, and thus cannot access each other's private members).
Definition at line 125 of file asset_index.hh.
References type.
Referenced by Cancelled(), Failure(), move_warnings_from(), ReadingResult(), Success(), Success(), and without_success_value().
|
inline |
Conversion constructor from any other ReadingResult.
Definition at line 226 of file asset_index.hh.
References failure_reason, ReadingResult(), Success, success_value, and type.
|
inlinestatic |
Construct a cancelled result.
Callback functions passed to index::read_remote_listing() can return false to indicate the loading should be cancelled.
Definition at line 112 of file asset_index.hh.
References Cancelled, and ReadingResult().
Referenced by blender::ed::asset::index::listing_entries_from_root(), and blender::ed::asset::index::read_remote_listing_v1().
|
inlinestatic |
Construct a failure result. The ReadingResult copies the failure reason, so the StringRef can refer to temporary data.
NOTE: Don't forget to wrap the string in N_(...) for translation tagging.
Definition at line 100 of file asset_index.hh.
References Failure, failure_reason, ReadingResult(), and blender::result.
|
inline |
Definition at line 143 of file asset_index.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::is_empty().
Referenced by blender::ed::asset::index::read_remote_listing_v1().
|
inline |
Return whether this result indicates cancellation.
Definition at line 138 of file asset_index.hh.
References Cancelled.
Referenced by blender::ed::asset::index::listing_entries_from_root(), and blender::ed::asset::index::read_remote_listing_v1().
|
inline |
Return whether this result indicates a failure.
Definition at line 133 of file asset_index.hh.
References Failure.
Referenced by blender::ed::asset::index::listing_entries_from_root(), and blender::ed::asset::index::read_remote_listing_v1().
|
inline |
Return whether this result indicates a success.
Definition at line 128 of file asset_index.hh.
References Success.
Referenced by blender::ed::asset::index::listing_entries_from_root(), blender::ed::asset::index::listing_entry_from_asset_dictionary(), move_warnings_from(), operator*(), operator*(), blender::ed::asset::index::read_remote_listing(), and blender::ed::asset::index::read_remote_listing_v1().
|
inline |
Move the warnings from another result into this one.
Definition at line 151 of file asset_index.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), BLI_assert_msg, is_success(), ReadingResult(), and warnings.
|
inline |
Get a reference to the result's success value, similar to std::optional<T>. Only valid if this result is successful and there is an actual success value.
Definition at line 178 of file asset_index.hh.
References BLI_assert_msg, is_success(), success_value, and T.
|
inline |
Get a reference to the result's success value, similar to std::optional<T>. Only valid if this result is successful and there is an actual success value.
Definition at line 191 of file asset_index.hh.
References BLI_assert_msg, is_success(), success_value, T, and blender::U.
|
inline |
Get a pointer to the result's success value, similar to std::optional<T>. Only valid if this result is successful and there is an actual success value.
Definition at line 204 of file asset_index.hh.
References success_value, and T.
|
inline |
Get a pointer to the result's success value, similar to std::optional<T>. Only valid if this result is successful and there is an actual success value.
Definition at line 216 of file asset_index.hh.
References success_value, T, and blender::U.
|
inlinestatic |
Construct a valueless success result. Only enabled if T == std::monostate.
Definition at line 75 of file asset_index.hh.
References ReadingResult(), and Success.
Referenced by blender::ed::asset::index::blender_version_matches(), blender::ed::asset::index::choose_api_version(), blender::ed::asset::index::listing_entries_from_root(), blender::ed::asset::index::listing_entry_from_asset_dictionary(), blender::ed::asset::index::listing_file_from_asset_dictionary(), blender::ed::asset::index::AssetLibraryMeta::read(), and blender::ed::asset::index::read_remote_listing_v1().
|
inlinestatic |
Construct a valued success result. Only enabled if T != std::monostate.
Definition at line 86 of file asset_index.hh.
References ReadingResult(), blender::result, Success, and T.
|
inline |
Return this ReadingResult, but without its success value.
The result type, failure message, and warnings are copied.
Definition at line 164 of file asset_index.hh.
References failure_reason, ReadingResult(), success_value, and warnings.
Referenced by blender::ed::asset::index::read_remote_listing().
| std::string blender::ed::asset::index::ReadingResult< T >::failure_reason |
Definition at line 56 of file asset_index.hh.
Referenced by Failure(), blender::ed::asset::index::listing_entries_from_root(), blender::ed::asset::index::listing_entry_from_asset_dictionary(), blender::ed::asset::index::read_remote_listing_v1(), ReadingResult(), and without_success_value().
| std::optional<T> blender::ed::asset::index::ReadingResult< T >::success_value |
Definition at line 57 of file asset_index.hh.
Referenced by operator*(), operator*(), operator->(), operator->(), ReadingResult(), and without_success_value().
| Type blender::ed::asset::index::ReadingResult< T >::type |
Definition at line 55 of file asset_index.hh.
Referenced by ReadingResult(), and ReadingResult().
| Vector<std::string> blender::ed::asset::index::ReadingResult< T >::warnings |
Even when an operation was performed successfully, there could have been warnings. These are only intended to be used on success status; on failure, only failure_reason is expected to be set. On cancellation, no reason needs to be given (as it is in response to the user cancelling the operation).
Definition at line 68 of file asset_index.hh.
Referenced by blender::ed::asset::index::listing_entries_from_root(), move_warnings_from(), blender::ed::asset::index::read_remote_listing_v1(), and without_success_value().