azure-core
Loading...
Searching...
No Matches
operation_status.hpp
Go to the documentation of this file.
1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
10#pragma once
11
12#include "azure/core/dll_import_export.hpp"
14
15#include <string>
16#include <utility> // for std::move
17
18namespace Azure { namespace Core {
19
23 class OperationStatus final {
24 std::string m_value;
25
26 public:
32 explicit OperationStatus(const std::string& value) : m_value(value) {}
33
39 explicit OperationStatus(std::string&& value) : m_value(std::move(value)) {}
40
46 explicit OperationStatus(const char* value) : m_value(value) {}
47
55 bool operator==(const OperationStatus& other) const noexcept
56 {
57 return _internal::StringExtensions::LocaleInvariantCaseInsensitiveEqual(
58 m_value, other.m_value);
59 }
60
68 bool operator!=(const OperationStatus& other) const noexcept { return !(*this == other); }
69
74 const std::string& Get() const noexcept { return m_value; }
75
80 AZ_CORE_DLLEXPORT static const OperationStatus NotStarted;
85 AZ_CORE_DLLEXPORT static const OperationStatus Running;
90 AZ_CORE_DLLEXPORT static const OperationStatus Succeeded;
95 AZ_CORE_DLLEXPORT static const OperationStatus Cancelled;
100 AZ_CORE_DLLEXPORT static const OperationStatus Failed;
101 };
102
103}} // namespace Azure::Core
Long-running operation states.
Definition operation_status.hpp:23
const std::string & Get() const noexcept
Gets the std::string representation of the operation status.
Definition operation_status.hpp:74
static AZ_CORE_DLLEXPORT const OperationStatus Failed
The Azure::Core::Operation Failed.
Definition operation_status.hpp:100
static AZ_CORE_DLLEXPORT const OperationStatus Cancelled
The Azure::Core::Operation was Cancelled.
Definition operation_status.hpp:95
static AZ_CORE_DLLEXPORT const OperationStatus NotStarted
The Azure::Core::Operation is Not Started.
Definition operation_status.hpp:80
OperationStatus(const std::string &value)
Constructs an OperationStatus with value.
Definition operation_status.hpp:32
OperationStatus(std::string &&value)
Constructs an OperationStatus with value.
Definition operation_status.hpp:39
bool operator==(const OperationStatus &other) const noexcept
Compares two OperationStatus objects for equality.
Definition operation_status.hpp:55
OperationStatus(const char *value)
Constructs an OperationStatus with value.
Definition operation_status.hpp:46
static AZ_CORE_DLLEXPORT const OperationStatus Running
The Azure::Core::Operation is Running.
Definition operation_status.hpp:85
static AZ_CORE_DLLEXPORT const OperationStatus Succeeded
The Azure::Core::Operation Succeeded.
Definition operation_status.hpp:90
bool operator!=(const OperationStatus &other) const noexcept
Compares two OperationStatus objects for equality.
Definition operation_status.hpp:68
Compute the hash value for the input binary data, using SHA256, SHA384 and SHA512.
Definition azure_assert.hpp:57
Internal utility functions for strings.