blob: f6c66ff48712215a7b5d2cb89ae9049514307d31 [file] [log] [blame]
srs569464cbd172011-03-01 22:03:54 -05001/* This program is copyright (c) 2009-2011 by Roderick W. Smith. It is distributed
srs5694221e0872009-08-29 15:00:31 -04002 under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
3
srs5694e7b4ff92009-08-18 13:16:10 -04004#include <stdint.h>
srs56949ddc14b2010-08-22 22:44:42 -04005#include <string>
srs5694e7b4ff92009-08-18 13:16:10 -04006
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
13using namespace std;
14
15class Attributes {
16protected:
srs56940873e9d2010-10-07 13:00:45 -040017 static string atNames[NUM_ATR];
18 static int numAttrs;
19 void Setup(void);
srs5694e7b4ff92009-08-18 13:16:10 -040020 uint64_t attributes;
srs56949ddc14b2010-08-22 22:44:42 -040021
srs5694e7b4ff92009-08-18 13:16:10 -040022public:
srs56940873e9d2010-10-07 13:00:45 -040023 Attributes(void);
24 Attributes(const uint64_t a);
srs5694e7b4ff92009-08-18 13:16:10 -040025 ~Attributes(void);
srs56940873e9d2010-10-07 13:00:45 -040026 void operator=(uint64_t a) {attributes = a;}
27
28 uint64_t GetAttributes(void) const {return attributes;}
srs5694e7b4ff92009-08-18 13:16:10 -040029 void DisplayAttributes(void);
srs56949ddc14b2010-08-22 22:44:42 -040030 void ShowAttributes(const uint32_t partNum);
srs56940873e9d2010-10-07 13:00:45 -040031
32 void ChangeAttributes(void);
srs56949ddc14b2010-08-22 22:44:42 -040033 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);
srs5694e7b4ff92009-08-18 13:16:10 -040037}; // class Attributes
38
srs56940873e9d2010-10-07 13:00:45 -040039ostream & operator<<(ostream & os, const Attributes & data);
40
srs5694e7b4ff92009-08-18 13:16:10 -040041#endif