UnivesalDisassembler(2003)
|
00001 // sections.h 00002 // 00003 // uda - universal disassembler 00004 // Date: 2003-05-04 00005 // 00006 // Copyright (c) 2002-2003 Ales Smrcka 00007 // 00008 // This program is licensed under GNU Library GPL. See the file COPYING. 00009 // 00010 // This module is an interface for BinaryFile and Section class. It is used as 00011 // gateway to binary file. 00012 // 00013 00014 #ifndef sectionsH 00015 #define sectionsH 00016 00017 #include <map> 00018 #include <string> 00019 #include "udaclasses.h" 00020 using namespace std; 00021 00022 #include "plugins.h" 00023 #include "shared.h" 00024 00025 class BinaryFile; 00026 class Section; 00027 00028 typedef map<string, Section> MSections; 00029 00031 class BinaryFile { 00032 BinaryFile(); 00033 public: 00034 BinFileData bfdata; 00035 MSections sections; 00036 00037 BinaryFile(string Name); 00038 ~BinaryFile(); 00041 int Init(); 00043 bool ScanAddress(Address addr); 00045 void Free(); 00046 Section &operator [](const string index); 00047 }; 00048 00050 class Section { 00051 public: 00052 SectionData *data; 00053 Section() { data=NULL; } 00054 Section(SectionData *sec); 00055 00057 bool defined() { return data!=NULL; } 00059 bool ValidAddress(Address addr); 00061 byte &operator [](Address addr); 00062 SectionData *operator ->() { return data; } 00063 operator SectionData&() { return *data; } 00064 }; 00065 00066 #endif