macdependency/MachO/machocache.cpp
Mike Lischke 972fcb3094 Overhaul of the application to avoid it crashing on macOS Sierra.
- Applied all recommended XCode (8) settings.
- Removed boost and replaced that code by standard functions.
- Implemented name mangling via abi::__cxa_demangle instead of running an external process to use c++filt.
- Enabled C++11. Min deployment target is now OSX 10.7.
- Some code clean up (e.g. formatting, std namespace).
2016-11-19 16:23:39 +01:00

41 lines
749 B
C++

/*
* machocache.cpp
* MachO
*
* Created by Konrad Windszus on 13.07.09.
* Copyright 2009 __MyCompanyName__. All rights reserved.
*
*/
#include "machocache.h"
#include "macho.h"
MachOCache::MachOCache() {
}
MachOCache::~MachOCache() {
// remove all cache entries
for (CacheMapIterator it = cache.begin(); it != cache.end(); it++) {
delete it->second;
}
}
MachO* MachOCache::getFile(const std::string& filename, const MachO* parent) {
CacheMapIterator it = cache.find(filename);
// check if already in cache?
if (it == cache.end()) {
MachO* file = new MachO(filename, parent);
cache[filename] = file;
return file;
}
else {
return it->second;
}
}
unsigned int MachOCache::getNumEntries() {
return cache.size();
}