Instead of the new_intrusive<T>() functions, use intrusive(new T)

This means we no longer need 8 different functions for different numbers of arguments, and non-const references can now also be passed to constructors without problems.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1443 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2010-07-21 14:32:28 +00:00
parent 8800500d86
commit 51dfed69b4
66 changed files with 304 additions and 353 deletions
+4 -4
View File
@@ -77,7 +77,7 @@ SubLocaleP find_wildcard(map<String,SubLocaleP>& items, const String& name) {
FOR_EACH_CONST(i, items) {
if (i.second && match_wildcard(i.first, name)) return i.second;
}
return new_intrusive<SubLocale>(); // so we don't search again
return intrusive(new SubLocale()); // so we don't search again
}
SubLocaleP find_wildcard_and_set(map<String,SubLocaleP>& items, const String& name) {
return items[name] = find_wildcard(items, name);
@@ -208,12 +208,12 @@ InputStreamP load_resource_text(const String& name) {
char* data = (char *)::LockResource(hData);
if ( !data ) throw InternalError(String::Format(_("Resource cannot be locked: %s"), name));
int len = ::SizeofResource(wxGetInstance(), hResource);
return new_shared2<wxMemoryInputStream>(data, len);
return shared(new wxMemoryInputStream(data, len));
#else
static String path = wxStandardPaths::Get().GetDataDir() + _("/resource/");
static String local_path = wxStandardPaths::Get().GetUserDataDir() + _("/resource/");
if (wxFileExists(path + name)) return new_shared1<wxFileInputStream>(path + name);
else return new_shared1<wxFileInputStream>(local_path + name);
if (wxFileExists(path + name)) return shared(new wxFileInputStream(path + name));
else return shared(new wxFileInputStream(local_path + name));
#endif
}