1 /* This program is copyright (c) 2009-2011 by Roderick W. Smith. It is distributed
2   under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
3 
4 #include <stdint.h>
5 #include <string>
6 
7 #ifndef __GPT_ATTRIBUTES
8 #define __GPT_ATTRIBUTES
9 
10 #define NUM_ATR 64 /* # of attributes -- 64, since it's a 64-bit field */
11 #define ATR_NAME_SIZE 25 /* maximum size of attribute names */
12 
13 using namespace std;
14 
15 class Attributes {
16 protected:
17    static string atNames[NUM_ATR];
18    static int numAttrs;
19    void Setup(void);
20    uint64_t attributes;
21 
22 public:
23    Attributes(void);
24    Attributes(const uint64_t a);
25    ~Attributes(void);
26    void operator=(uint64_t a) {attributes = a;}
27 
GetAttributes(void)28    uint64_t GetAttributes(void) const {return attributes;}
29    void DisplayAttributes(void);
30    void ShowAttributes(const uint32_t partNum);
31 
32    void ChangeAttributes(void);
33    bool OperateOnAttributes(const uint32_t partNum, const string& attributeOperator, const string& attributeBits);
34 
GetAttributeName(const uint32_t bitNum)35    static const string& GetAttributeName(const uint32_t bitNum) {return atNames [bitNum];}
36    static void ListAttributes(void);
37 }; // class Attributes
38 
39 ostream & operator<<(ostream & os, const Attributes & data);
40 
41 #endif
42