-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBmsReferenceId.hpp
More file actions
52 lines (45 loc) · 1.84 KB
/
BmsReferenceId.hpp
File metadata and controls
52 lines (45 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once
#ifndef LIBBMS_BMS_REFERENCE_ID_HPP_INCLUDED
#define LIBBMS_BMS_REFERENCE_ID_HPP_INCLUDED
#include <cstdint>
#include <functional>
#include <string>
#include "BmsException.hpp"
namespace Bms {
struct BmsReferenceId {
public:
using SelfType = BmsReferenceId;
using UnderlyingType = uint16_t;
public:
BmsReferenceId();
BmsReferenceId(const UnderlyingType &value) throw(BmsException);
BmsReferenceId(const std::string &value) throw(BmsException);
public:
SelfType &operator=(const UnderlyingType &value) throw(BmsException);
SelfType &operator=(const std::string &value) throw(BmsException);
friend bool operator==(const SelfType &lhs, const SelfType &rhs);
friend bool operator!=(const SelfType &lhs, const SelfType &rhs);
friend bool operator<(const SelfType &lhs, const SelfType &rhs);
friend bool operator<=(const SelfType &lhs, const SelfType &rhs);
friend bool operator>(const SelfType &lhs, const SelfType &rhs);
friend bool operator>=(const SelfType &lhs, const SelfType &rhs);
friend std::istream &operator>>(std::istream &in, SelfType &id) throw(BmsException);
friend std::ostream &operator<<(std::ostream &out, const SelfType &id);
public:
static SelfType Min(); // 0, 00, Placeholder
static SelfType Max(); // 1295, ZZ
static SelfType Placeholder(); // 0, 00, Placeholder
bool IsPlaceholder() const;
UnderlyingType UnderlyingValue() const;
std::string StringValue() const;
private:
UnderlyingType _Value = 1;
};
}
template <>
struct std::hash<Bms::BmsReferenceId> {
using argument_type = Bms::BmsReferenceId;
using result_type = size_t;
size_t operator()(const argument_type &key) const;
};
#endif // !LIBBMS_BMS_REFERENCE_ID_HPP_INCLUDED