2009-09-17 13:06:04 +00:00
|
|
|
#ifndef MACHO_H
|
|
|
|
#define MACHO_H
|
|
|
|
|
|
|
|
#include "macho_global.h"
|
|
|
|
#include <CoreFoundation/CoreFoundation.h>
|
|
|
|
|
|
|
|
class MachOFile;
|
|
|
|
class MachOArchitecture;
|
|
|
|
class DynamicLoader;
|
|
|
|
|
2009-09-29 15:01:48 +00:00
|
|
|
class EXPORT MachO {
|
2009-09-17 13:06:04 +00:00
|
|
|
private:
|
2016-11-19 16:23:39 +01:00
|
|
|
typedef std::list<MachOArchitecture*> MachOArchitectures;
|
2009-09-17 13:06:04 +00:00
|
|
|
public:
|
2016-11-19 16:23:39 +01:00
|
|
|
MachO(const std::string& fileName, const MachO* parent = 0);
|
|
|
|
~MachO();
|
|
|
|
|
|
|
|
std::string getFileName() const;
|
|
|
|
|
|
|
|
typedef MachOArchitectures::iterator MachOArchitecturesIterator;
|
|
|
|
typedef MachOArchitectures::const_iterator MachOArchitecturesConstIterator;
|
|
|
|
MachOArchitecturesIterator getArchitecturesBegin();
|
|
|
|
MachOArchitecturesIterator getArchitecturesEnd();
|
|
|
|
MachOArchitecture* getCompatibleArchitecture(MachOArchitecture* destArchitecture) const;
|
|
|
|
MachOArchitecture* getHostCompatibleArchitecture() const;
|
|
|
|
unsigned long long getSize() const;
|
|
|
|
time_t getLastModificationTime() const;
|
|
|
|
std::string getVersion() const;
|
|
|
|
std::string getName() const;
|
|
|
|
const MachO* getParent() { return parent;}
|
|
|
|
static DynamicLoader* dynamicLoader;
|
|
|
|
static int referenceCounter;
|
2009-09-17 13:06:04 +00:00
|
|
|
private:
|
2016-11-19 16:23:39 +01:00
|
|
|
const MachO* parent;
|
|
|
|
MachOFile* file;
|
|
|
|
MachOArchitectures architectures;
|
|
|
|
CFBundleRef bundle;
|
|
|
|
|
|
|
|
std::string getApplicationInBundle(const std::string& bundlePath);
|
|
|
|
static std::string extractStringFromCFStringRef(CFStringRef cfStringRef);
|
|
|
|
void init(const std::string& fileName, const MachO* parent);
|
|
|
|
|
2009-09-17 13:06:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MACHO_H
|