Gator Library
An implementation of the Red-Black Tree and Priority queue data structure in C++.
Loading...
Searching...
No Matches
utilities.hpp
Go to the documentation of this file.
1
7#pragma once
8
9#include <string>
10
12#define Yes "Yes"
13
15#define No "No"
16
17
19#define INVALID_STATUS "Invalid Status"
20
21using namespace std;
22
32
38{
39private:
40 /* data */
41public:
48 static const string status_tostring(BookAvailability status)
49 {
50 if (status == YES)
51 {
52 return Yes;
53 }
54 else if (status == NO)
55 {
56 return No;
57 }
58 else
59 {
60 throw INVALID_STATUS;
61 }
62 }
63
70 static const BookAvailability status_toenum(string status)
71 {
72 if (status == Yes)
73 {
74 return YES;
75 }
76 else if (status == No)
77 {
78 return NO;
79 }
80 else
81 {
82 throw INVALID_STATUS;
83 }
84 }
85};
A utility class providing conversion functions for the BookAvailability enum.
Definition utilities.hpp:38
static const BookAvailability status_toenum(string status)
Converts a string representation of a BookAvailability enum value to the corresponding enum value.
Definition utilities.hpp:70
static const string status_tostring(BookAvailability status)
Converts a BookAvailability enum value to its corresponding string representation.
Definition utilities.hpp:48
#define INVALID_STATUS
String representation of the NO enum value.
Definition utilities.hpp:19
#define No
String representation of the NO enum value.
Definition utilities.hpp:15
BookAvailability
Enum representing the availability status of a book.
Definition utilities.hpp:28
@ NO
Definition utilities.hpp:30
@ YES
Definition utilities.hpp:29
#define Yes
String representation of the YES enum value.
Definition utilities.hpp:12