| srs5694 | 221e087 | 2009-08-29 15:00:31 -0400 | [diff] [blame] | 1 | /* This program is copyright (c) 2009 by Roderick W. Smith. It is distributed |
| 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 { |
| srs5694 | 9ddc14b | 2010-08-22 22:44:42 -0400 | [diff] [blame] | 16 | |
| 17 | private: |
| 18 | class staticInit {public: staticInit (void);}; |
| 19 | static string atNames[NUM_ATR]; |
| 20 | static Attributes::staticInit staticInitializer; |
| 21 | |
| srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 22 | protected: |
| 23 | uint64_t attributes; |
| srs5694 | 9ddc14b | 2010-08-22 22:44:42 -0400 | [diff] [blame] | 24 | |
| srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 25 | public: |
| srs5694 | 9ddc14b | 2010-08-22 22:44:42 -0400 | [diff] [blame] | 26 | Attributes(const uint64_t a = 0) {SetAttributes (a);} |
| srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 27 | ~Attributes(void); |
| srs5694 | 9ddc14b | 2010-08-22 22:44:42 -0400 | [diff] [blame] | 28 | void SetAttributes(const uint64_t a) {attributes = a;} |
| srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 29 | uint64_t GetAttributes(void) {return attributes;} |
| 30 | void DisplayAttributes(void); |
| 31 | void ChangeAttributes(void); |
| srs5694 | 9ddc14b | 2010-08-22 22:44:42 -0400 | [diff] [blame] | 32 | void ShowAttributes(const uint32_t partNum); |
| 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 | |
| 39 | #endif |