xref: /third_party/gptfdisk/gptcl.h (revision cf200d32)
1/*
2    Implementation of GPTData class derivative with popt-based command
3    line processing
4    Copyright (C) 2010-2022 Roderick W. Smith
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License along
17    with this program; if not, write to the Free Software Foundation, Inc.,
18    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20*/
21
22#ifndef __GPTCL_H
23#define __GPTCL_H
24
25#include "gpt.h"
26#include <popt.h>
27
28class GPTDataCL : public GPTData {
29   protected:
30      // Following are variables associated with popt parameters....
31      char *attributeOperation, *backupFile, *partName, *hybrids;
32      char *newPartInfo, *mbrParts, *twoParts, *outDevice, *typeCode;
33      char *partGUID, *diskGUID;
34      int alignment, deletePartNum, infoPartNum, largestPartNum, bsdPartNum;
35      bool alignEnd;
36      uint32_t tableSize;
37      poptContext poptCon;
38
39      int BuildMBR(char* argument, int isHybrid);
40   public:
41      GPTDataCL(void);
42      GPTDataCL(std::string filename);
43      ~GPTDataCL(void);
44      void LoadBackupFile(std::string backupFile, int &saveData, int &neverSaveData);
45      int DoOptions(int argc, char* argv[]);
46}; // class GPTDataCL
47
48int CountColons(char* argument);
49uint64_t GetInt(const std::string & argument, int itemNum);
50std::string GetString(std::string argument, int itemNum);
51
52#endif
53