std::string LocalError::errorTypeName(ErrorType forType) { std::string errorName("<UNKNOWN>"); lock_guard<recursive_mutex> lock(s_nextErrorLock); TypeNameMap::const_iterator f; switch (forType) { case etWindowsError: errorName = "<WIN32>"; break; case etHRESULT: errorName = "<HRESULT>"; break; case etLocalError: errorName = "<LocalError>"; break; case etUNIXError: errorName = "<UNIX>"; break; default: f = s_typeNames.find(forType); if (f != s_typeNames.end()) { errorName = f->second; } break; } return errorName; }
const introspection::Type &lookupType(std::string const &name) { typedef std::map<std::string, const introspection::Type *> TypeNameMap; static TypeNameMap usedTypes; TypeNameMap::iterator it = usedTypes.find(name); if (it != usedTypes.end()) { return *(it->second); } const introspection::Type &type = introspection::Reflection::getType(name); usedTypes.insert(std::make_pair(name, &type)); return type; }