srs5694 | 64cbd17 | 2011-03-01 22:03:54 -0500 | [diff] [blame] | 1 | /* This program is copyright (c) 2009-2011 by Roderick W. Smith. It is distributed |
srs5694 | 221e087 | 2009-08-29 15:00:31 -0400 | [diff] [blame] | 2 | under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ |
| 3 | |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 4 | #include <stdint.h> |
srs5694 | 9ddc14b | 2010-08-22 22:44:42 -0400 | [diff] [blame] | 5 | #include <string> |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 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: |
srs5694 | 0873e9d | 2010-10-07 13:00:45 -0400 | [diff] [blame] | 17 | static string atNames[NUM_ATR]; |
| 18 | static int numAttrs; |
| 19 | void Setup(void); |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 20 | uint64_t attributes; |
srs5694 | 9ddc14b | 2010-08-22 22:44:42 -0400 | [diff] [blame] | 21 | |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 22 | public: |
srs5694 | 0873e9d | 2010-10-07 13:00:45 -0400 | [diff] [blame] | 23 | Attributes(void); |
| 24 | Attributes(const uint64_t a); |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 25 | ~Attributes(void); |
srs5694 | 0873e9d | 2010-10-07 13:00:45 -0400 | [diff] [blame] | 26 | void operator=(uint64_t a) {attributes = a;} |
| 27 | |
| 28 | uint64_t GetAttributes(void) const {return attributes;} |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 29 | void DisplayAttributes(void); |
srs5694 | 9ddc14b | 2010-08-22 22:44:42 -0400 | [diff] [blame] | 30 | void ShowAttributes(const uint32_t partNum); |
srs5694 | 0873e9d | 2010-10-07 13:00:45 -0400 | [diff] [blame] | 31 | |
| 32 | void ChangeAttributes(void); |
srs5694 | 9ddc14b | 2010-08-22 22:44:42 -0400 | [diff] [blame] | 33 | bool OperateOnAttributes(const uint32_t partNum, const string& attributeOperator, const string& attributeBits); |
| 34 | |
| 35 | static const string& GetAttributeName(const uint32_t bitNum) {return atNames [bitNum];} |
| 36 | static void ListAttributes(void); |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 37 | }; // class Attributes |
| 38 | |
srs5694 | 0873e9d | 2010-10-07 13:00:45 -0400 | [diff] [blame] | 39 | ostream & operator<<(ostream & os, const Attributes & data); |
| 40 | |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 41 | #endif |