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