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
+25 -45
View File
@@ -11,25 +11,29 @@
// ----------------------------------------------------------------------------- : SVN File Manipulation
bool run_svn(const Char** arguments) {
switch (wxExecute(const_cast<Char**>(arguments), wxEXEC_SYNC)) { // Yuck, const_cast
// Success
case 0:
return true;
// Couldn't run SVN
case -1:
handle_error(String(_("Can't run SVN.")));
return false;
// SVN error
default:
handle_error(String(_("SVN encountered an error")));
return false;
}
}
void SubversionVCS::addFile(const wxFileName& filename)
{
String name = filename.GetFullPath();
const Char* name_c[] = {_("svn"), _("add"), name.c_str(), nullptr};
switch (wxExecute(const_cast<Char**>(name_c), wxEXEC_SYNC)) // Yuck, const_cast
{
// Success
case 0:
return;
// Couldn't run SVN
case -1:
handle_error(String(_("Can't run SVN.")));
VCS::addFile(filename);
return;
// SVN error
default:
handle_error(String(_("SVN encountered an error")));
VCS::addFile(filename);
return;
if (!run_svn(name_c)) {
VCS::addFile(filename);
}
}
@@ -37,21 +41,8 @@ void SubversionVCS::moveFile(const wxFileName& source, const wxFileName& dest)
{
String source_name = source.GetFullPath(), dest_name = dest.GetFullPath();
const Char* name_c[] = {_("svn"), _("mv"), source_name.c_str(), dest_name.c_str(), nullptr};
switch (wxExecute(const_cast<Char**>(name_c), wxEXEC_SYNC)) // Once again, yuck
{
// Success
case 0:
return;
// Couldn't run SVN
case -1:
handle_error(String(_("Can't run SVN.")));
VCS::moveFile(source, dest);
return;
// SVN error
default:
handle_error(String(_("SVN encountered an error")));
VCS::moveFile(source, dest);
return;
if (!run_svn(name_c)) {
VCS::moveFile(source, dest);
}
}
@@ -60,22 +51,10 @@ void SubversionVCS::removeFile(const wxFileName& filename)
String name = filename.GetFullPath();
const Char* name_c[] = {_("svn"), _("rm"), name.c_str(), nullptr};
handle_warning(String(name_c[0]) + name_c[1] + name_c[2]);
// TODO: do we really need to remove the file before calling "svn remove"?
VCS::removeFile(filename);
switch (wxExecute(const_cast<Char**>(name_c), wxEXEC_SYNC)) // Once again, yuck
{
// Success
case 0:
return;
// Couldn't run SVN
case -1:
handle_error(String(_("Can't run SVN.")));
VCS::removeFile(filename);
return;
// SVN error
default:
handle_error(String(_("SVN encountered an error")));
VCS::removeFile(filename);
return;
if (!run_svn(name_c)) {
VCS::removeFile(filename);
}
}
@@ -85,4 +64,5 @@ IMPLEMENT_REFLECTION(SubversionVCS) {
REFLECT(type);
}
}
// ----------------------------------------------------------------------------- : EOF