diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:10:11 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:10:11 +0200 |
commit | c0cdb2ad99a1e2a6ade5ce76c91177a79258e669 (patch) | |
tree | 4701a015385d9a6a5a4ba99a8f1f5d400fff26b1 | |
parent | 3.13 (diff) | |
download | FreeFileSync-c0cdb2ad99a1e2a6ade5ce76c91177a79258e669.tar.gz FreeFileSync-c0cdb2ad99a1e2a6ade5ce76c91177a79258e669.tar.bz2 FreeFileSync-c0cdb2ad99a1e2a6ade5ce76c91177a79258e669.zip |
3.14
190 files changed, 28859 insertions, 26748 deletions
diff --git a/Application.cpp b/Application.cpp index 5699a68c..d22a0d8e 100644 --- a/Application.cpp +++ b/Application.cpp @@ -28,9 +28,11 @@ #include <wx/log.h> #ifdef FFS_LINUX +#include <gtkmm/main.h> #include <gtk/gtk.h> #endif + using ffs3::CustomLocale; using ffs3::SwitchToGui; @@ -43,8 +45,8 @@ bool Application::OnInit() returnValue = 0; //do not call wxApp::OnInit() to avoid using default commandline parser -//Note: initialization is done in the FIRST idle event instead of OnInit. Reason: batch mode requires the wxApp eventhandler to be established -//for UI update events. This is not the case at the time of OnInit(). + //Note: initialization is done in the FIRST idle event instead of OnInit. Reason: batch mode requires the wxApp eventhandler to be established + //for UI update events. This is not the case at the time of OnInit(). Connect(wxEVT_IDLE, wxIdleEventHandler(Application::OnStartApplication), NULL, this); return true; @@ -77,6 +79,8 @@ void Application::OnStartApplication(wxIdleEvent&) SetAppName(wxT("FreeFileSync")); #ifdef FFS_LINUX + Gtk::Main::init_gtkmm_internals(); + ::gtk_rc_parse(ffs3::wxToZ(ffs3::getResourceDir()) + "styles.rc"); //remove inner border from bitmap buttons #endif @@ -87,23 +91,21 @@ void Application::OnStartApplication(wxIdleEvent&) wxString cfgFilename; if (argc > 1) { - const wxString filename(argv[1]); - - if (fileExists(wxToZ(filename))) //load file specified by %1 parameter: - cfgFilename = filename; - else if (fileExists(wxToZ(filename + wxT(".ffs_batch")))) - cfgFilename = filename + wxT(".ffs_batch"); - else if (fileExists(wxToZ(filename + wxT(".ffs_gui")))) - cfgFilename = filename + wxT(".ffs_gui"); + const wxString arg1(argv[1]); + + if (fileExists(wxToZ(arg1))) //load file specified by %1 parameter: + cfgFilename = arg1; + else if (fileExists(wxToZ(arg1 + wxT(".ffs_batch")))) + cfgFilename = arg1 + wxT(".ffs_batch"); + else if (fileExists(wxToZ(arg1 + wxT(".ffs_gui")))) + cfgFilename = arg1 + wxT(".ffs_gui"); else { - wxMessageBox(wxString(_("File does not exist:")) + wxT(" \"") + filename + wxT("\""), _("Error"), wxOK | wxICON_ERROR); + wxMessageBox(wxString(_("File does not exist:")) + wxT(" \"") + arg1 + wxT("\""), _("Error"), wxOK | wxICON_ERROR); return; } } - GlobalResources::getInstance().load(); //loads bitmap resources on program startup - #if wxCHECK_VERSION(2, 9, 1) wxToolTip::SetMaxWidth(-1); //disable tooltip wrapping wxToolTip::SetAutoPop(7000); //tooltip visibilty in ms, 5s seems to be default for Windows @@ -135,19 +137,19 @@ void Application::OnStartApplication(wxIdleEvent&) const xmlAccess::XmlType xmlConfigType = xmlAccess::getXmlType(cfgFilename); switch (xmlConfigType) { - case xmlAccess::XML_GUI_CONFIG: //start in GUI mode (configuration file specified) - runGuiMode(cfgFilename, globalSettings); - break; - - case xmlAccess::XML_BATCH_CONFIG: //start in commandline mode - runBatchMode(cfgFilename, globalSettings); - break; - - case xmlAccess::XML_GLOBAL_SETTINGS: - case xmlAccess::XML_REAL_CONFIG: - case xmlAccess::XML_OTHER: - wxMessageBox(wxString(_("The file does not contain a valid configuration:")) + wxT(" \"") + cfgFilename + wxT("\""), _("Error"), wxOK | wxICON_ERROR); - break; + case xmlAccess::XML_GUI_CONFIG: //start in GUI mode (configuration file specified) + runGuiMode(cfgFilename, globalSettings); + break; + + case xmlAccess::XML_BATCH_CONFIG: //start in commandline mode + runBatchMode(cfgFilename, globalSettings); + break; + + case xmlAccess::XML_GLOBAL_SETTINGS: + case xmlAccess::XML_REAL_CONFIG: + case xmlAccess::XML_OTHER: + wxMessageBox(wxString(_("The file does not contain a valid configuration:")) + wxT(" \"") + cfgFilename + wxT("\""), _("Error"), wxOK | wxICON_ERROR); + break; } } else //start in GUI mode (standard) @@ -234,45 +236,38 @@ void Application::runBatchMode(const wxString& filename, xmlAccess::XmlGlobalSet const SwitchToGui switchBatchToGui(batchCfg, globSettings); //prepare potential operational switch //class handling status updates and error messages - std::auto_ptr<BatchStatusHandler> statusHandler; //delete object automatically - if (batchCfg.silent) - statusHandler.reset(new BatchStatusHandler(true, ffs3::extractJobName(filename), &batchCfg.logFileDirectory, batchCfg.handleError, switchBatchToGui, returnValue)); - else - statusHandler.reset(new BatchStatusHandler(false, ffs3::extractJobName(filename), NULL, batchCfg.handleError, switchBatchToGui, returnValue)); + BatchStatusHandler statusHandler(batchCfg.silent, + ffs3::extractJobName(filename), + batchCfg.silent ? &batchCfg.logFileDirectory : NULL, + batchCfg.logFileCountMax, + batchCfg.handleError, + switchBatchToGui, + returnValue); //COMPARE DIRECTORIES ffs3::CompareProcess comparison(batchCfg.mainCfg.handleSymlinks, globSettings.fileTimeTolerance, globSettings.optDialogs, - statusHandler.get()); + &statusHandler); ffs3::FolderComparison folderCmp; comparison.startCompareProcess(ffs3::extractCompareCfg(batchCfg.mainCfg), batchCfg.mainCfg.compareVar, folderCmp); - const bool syncNeeded = synchronizationNeeded(folderCmp); - //START SYNCHRONIZATION ffs3::SyncProcess synchronization( globSettings.optDialogs, globSettings.verifyFileCopy, globSettings.copyLockedFiles, globSettings.copyFilePermissions, - *statusHandler); + statusHandler); const std::vector<ffs3::FolderPairSyncCfg> syncProcessCfg = ffs3::extractSyncCfg(batchCfg.mainCfg); assert(syncProcessCfg.size() == folderCmp.size()); synchronization.startSynchronizationProcess(syncProcessCfg, folderCmp); - //check if there are files/folders to be sync'ed at all - if (!syncNeeded) - { - statusHandler->logInfo(_("Nothing to synchronize according to configuration!")); //inform about this special case - //return; -> disabled: <automatic> mode requires database to be written in any case - } - //play (optional) sound notification after sync has completed if (!batchCfg.silent) { diff --git a/BUILD/Changelog.txt b/BUILD/Changelog.txt index bfe24ff8..3baa6f36 100644 --- a/BUILD/Changelog.txt +++ b/BUILD/Changelog.txt @@ -2,6 +2,26 @@ |FreeFileSync| -------------- +Changelog v3.14 +--------------- +New keyboard shortcuts: F5: compare F6: synchronize +Skip to next folder pair if fatal error occured (instead of abort) +Reload last selected configuration on startup +Abort with error when copying to empty directory field +Full log information after comparison (including file transfer) +Check read access for source file before overwriting target +Fixed possible application crash after comparison +Fixed possible network freeze when comparing +Maximum number of logfiles can be specified +Don't condense whitespace when loading XML configuration +RealtimeSync: Put executable name in quotes when parsing *.ffs_batch file +Large program icons - 256 x 256 +Handle daylight saving time(DST) on FAT network shares +Skip DST handling if drive does not support accurate file times +Many small GUI/usability fixes +Added Korean translation + + Changelog v3.13 --------------- Implemented Advanced User Interface to allow user specified layout customizations diff --git a/BUILD/FreeFileSync.chm b/BUILD/FreeFileSync.chm Binary files differindex fe69506a..700a89ba 100644 --- a/BUILD/FreeFileSync.chm +++ b/BUILD/FreeFileSync.chm diff --git a/BUILD/Help/Table of Contents.hhc b/BUILD/Help/Table of Contents.hhc index 1c23acff..1d5d7237 100644 --- a/BUILD/Help/Table of Contents.hhc +++ b/BUILD/Help/Table of Contents.hhc @@ -57,7 +57,7 @@ <param name="Local" value="html\advanced\SendMail.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> - <param name="Name" value="Exclude via filter"> + <param name="Name" value="Exclude files"> <param name="Local" value="html\advanced\ExcludeSubfolder.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> diff --git a/BUILD/Help/html/advanced/Batch Scripting.html b/BUILD/Help/html/advanced/Batch Scripting.html index c7436792..f7f01a05 100644 --- a/BUILD/Help/html/advanced/Batch Scripting.html +++ b/BUILD/Help/html/advanced/Batch Scripting.html @@ -5,7 +5,7 @@ <TITLE></TITLE> <META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2 (Win32)"> <META NAME="CREATED" CONTENT="20091206;16574000"> - <META NAME="CHANGED" CONTENT="20100807;21103000"> + <META NAME="CHANGED" CONTENT="20110203;19261600"> <META NAME="Info 1" CONTENT=""> <META NAME="Info 2" CONTENT=""> <META NAME="Info 3" CONTENT=""> @@ -35,32 +35,44 @@ some general hints for custom *.cmd and *.bat files.</FONT></P> <P STYLE="margin-bottom: 0cm"><BR> </P> <P STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif"><B>Example:</B> -A simple locking facility – (<SPAN STYLE="font-style: normal"><B>Note:</B></SPAN><I> -FreeFileSync already has a more powerful directory locking mechanism -implemented that allows multiple writers in parallel</I>)</FONT></P> +Shutdown PC after synchronization</FONT></P> <UL> - <P><SPAN ID="Rahmen5" DIR="LTR" STYLE="float: left; width: 80%; height: 0.14cm; border: none; padding: 0cm; background: #e6e6e6"> + <P><SPAN ID="Rahmen2" DIR="LTR" STYLE="float: left; width: 80%; height: 0.14cm; border: none; padding: 0cm; background: #e6e6e6"> + <P ALIGN=LEFT STYLE="margin-left: 0.79cm; margin-right: 0.98cm; margin-bottom: 0cm"> + <FONT COLOR="#808080"><FONT FACE="Courier New, monospace"><I><B>::start + FreeFileSync Batch + Job<BR></B></I></FONT></FONT><FONT FACE="Courier New, monospace">"C:\Users\ZenJu\Desktop\SyncJob.ffs_batch"<BR> </FONT><FONT COLOR="#808080"><FONT FACE="Courier New, monospace"><I><B>::schedule + shutdown after 10 seconds<BR></B></I></FONT></FONT><FONT FACE="Courier New, monospace">shutdown + /s /t 10</FONT></P> + </SPAN><BR CLEAR=LEFT> + </P> +</UL> +<P STYLE="margin-bottom: 0cm"><BR> +</P> +<P STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif"><B>Example:</B> +A simple locking facility – (<SPAN STYLE="font-style: normal"><B>Note:</B></SPAN> +<I>FreeFileSync already has a more powerful directory locking +mechanism implemented that allows multiple writers in parallel</I>)</FONT></P> +<OL> + <P ALIGN=LEFT STYLE="margin-right: 0.98cm; margin-bottom: 0cm"><SPAN ID="Rahmen5" DIR="LTR" STYLE="float: left; width: 80%; height: 0.14cm; border: none; padding: 0cm; background: #e6e6e6"> <P ALIGN=LEFT STYLE="margin-left: 0.79cm; margin-right: 0.98cm; margin-bottom: 0cm"> <FONT FACE="Courier New, monospace">:tryAgain<BR>if not exist \\share\folder\lock (<BR> </FONT><FONT COLOR="#808080"><FONT FACE="Courier New, monospace"><I><B>::create - the lock<BR></B></I></FONT></FONT><FONT COLOR="#808080"> </FONT><FONT FACE="Courier New, monospace">echo + the lock<BR> </B></I></FONT></FONT><FONT FACE="Courier New, monospace">echo This is a lock file > \\share\folder\lock<BR> </FONT><FONT COLOR="#808080"><FONT FACE="Courier New, monospace"><I><B>::execute the synchronization batch job synchronously<BR> </B></I></FONT></FONT><FONT FACE="Courier New, monospace">"C:\Program Files\FreeFileSync\FreeFileSync.exe" "C:\MySyncJob.ffs_batch"<BR> del \\share\folder\lock<BR>) else (<BR> </FONT><FONT COLOR="#808080"><FONT FACE="Courier New, monospace"><I><B>::wait - 5 seconds then try starting sync again:<BR></B></I></FONT></FONT><FONT COLOR="#808080"> </FONT><FONT FACE="Courier New, monospace">choice + 5 seconds then try starting sync again:<BR> </B></I></FONT></FONT><FONT FACE="Courier New, monospace">choice /C:AB /T:5 /D:A > NUL<BR> goto tryAgain<BR>)</FONT></P> - </SPAN><BR CLEAR=LEFT> + </SPAN><BR CLEAR=LEFT><FONT COLOR="#808080"> </FONT> </P> -</UL> -<OL> - <P ALIGN=LEFT STYLE="margin-right: 0.98cm; margin-bottom: 0cm"><FONT COLOR="#808080"> </FONT></P> <LI><P STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif">When starting a batch file from RealtimeSync be sure to make synchronous calls to FreeFileSync only. This will prevent RealtimeSync from detecting changes while synchronization is still in progress.</FONT></P> - <P ALIGN=LEFT STYLE="margin-right: 0.98cm; margin-bottom: 0cm"><FONT COLOR="#808080"> </FONT></P> + <P ALIGN=LEFT STYLE="margin-right: 0.98cm; margin-bottom: 0cm"></P> <LI><P STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif">During execution of a Batch file a black console window is shown. You can hide this window by using the Visual Basic script "Invisible.vbs" @@ -70,7 +82,7 @@ implemented that allows multiple writers in parallel</I>)</FONT></P> <P ALIGN=LEFT STYLE="margin-left: 0.79cm; margin-right: 0.98cm; margin-bottom: 0cm"> <FONT FACE="Courier New, monospace">wscript C:\Program files\FreeFileSync\Invisible.vbs C:\MyBatchFile.cmd</FONT></P> - </SPAN><BR CLEAR=LEFT><FONT COLOR="#808080"> </FONT> + </SPAN><BR CLEAR=LEFT> </P> </OL> <OL START=3> @@ -82,8 +94,8 @@ implemented that allows multiple writers in parallel</I>)</FONT></P> Files\FreeFileSync\FreeFileSync.exe" "H:\Silent_Config.ffs_batch"<BR>if not errorlevel 0 (<BR> </FONT><FONT COLOR="#808080"><FONT FACE="Courier New, monospace"><I><B>::if - something went wrong, add special treatment here<BR></B></I></FONT></FONT><FONT COLOR="#000000"> </FONT><FONT COLOR="#000000"><FONT FACE="Courier New, monospace"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">echo - Errors occurred during synchronization...</SPAN></SPAN></FONT></FONT><FONT COLOR="#808080"><FONT FACE="Courier New, monospace"><I><B><BR></B></I></FONT></FONT> <FONT FACE="Courier New, monospace">pause<BR>)</FONT></P> + something went wrong, add special treatment here<BR> </B></I></FONT></FONT><FONT COLOR="#000000"><FONT FACE="Courier New, monospace"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">echo + Errors occurred during synchronization...</SPAN></SPAN></FONT></FONT><FONT COLOR="#808080"><FONT FACE="Courier New, monospace"><I><B><BR> </B></I></FONT></FONT><FONT FACE="Courier New, monospace">pause<BR>)</FONT></P> </SPAN><BR CLEAR=LEFT> </P> </OL> diff --git a/BUILD/Help/html/advanced/DaylightSavingTime.html b/BUILD/Help/html/advanced/DaylightSavingTime.html index 38f277cb..a15ea521 100644 --- a/BUILD/Help/html/advanced/DaylightSavingTime.html +++ b/BUILD/Help/html/advanced/DaylightSavingTime.html @@ -5,7 +5,7 @@ <TITLE></TITLE> <META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2 (Win32)"> <META NAME="CREATED" CONTENT="20091208;20054200"> - <META NAME="CHANGED" CONTENT="20101219;15552100"> + <META NAME="CHANGED" CONTENT="20110301;19000400"> <META NAME="Info 1" CONTENT=""> <META NAME="Info 2" CONTENT=""> <META NAME="Info 3" CONTENT=""> @@ -62,5 +62,19 @@ only solves all DST issues but also time shifts that occur due to travel between different time zones.</FONT></P> <P STYLE="margin-bottom: 0cm"><BR> </P> +<P STYLE="margin-left: 1.46cm; margin-bottom: 0cm"><SPAN ID="Rahmen3" DIR="LTR" STYLE="float: left; width: 80%; height: 0.14cm; border: 1px solid #000080; padding: 0.05cm; background: #ccccff"> + <P ALIGN=LEFT STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif"><B>Note:</B></FONT></P> + <UL> + <LI><P ALIGN=LEFT STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif">In + order for FreeFileSync to start handling DST and timezone + differences, an initial full synchronization is required. + Subsequent syncs will never show a time difference again.</FONT></P> + <LI><P ALIGN=LEFT STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif">If + a FAT volume is scanned the first time by FreeFileSync this will + take longer than usual since additional meta data is written for + each file.</FONT></P> + </UL> +</SPAN><BR CLEAR=LEFT><BR> +</P> </BODY> </HTML>
\ No newline at end of file diff --git a/BUILD/Help/html/advanced/ExcludeSubfolder.html b/BUILD/Help/html/advanced/ExcludeSubfolder.html index eff2c465..63255f47 100644 --- a/BUILD/Help/html/advanced/ExcludeSubfolder.html +++ b/BUILD/Help/html/advanced/ExcludeSubfolder.html @@ -5,7 +5,7 @@ <TITLE></TITLE> <META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2 (Win32)"> <META NAME="CREATED" CONTENT="20091206;16574000"> - <META NAME="CHANGED" CONTENT="20101114;14355300"> + <META NAME="CHANGED" CONTENT="20110319;19021800"> <META NAME="Info 1" CONTENT=""> <META NAME="Info 2" CONTENT=""> <META NAME="Info 3" CONTENT=""> @@ -23,15 +23,29 @@ </STYLE> </HEAD> <BODY LANG="en-US" DIR="LTR"> -<H3 CLASS="western"><FONT FACE="Tahoma, sans-serif">Exclude via -filter</FONT></H3> +<H3 CLASS="western"><FONT FACE="Tahoma, sans-serif">Exclude files</FONT></H3> <P STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif">Excluding -files and directories woks by specifying a phrase that is compared -against a file or directory path. Only if the file/directory matches -at least one entry in the include list and none of the entries in the -exclude list it passes filtering. The phrase is also a file or -directory name, but it must be relative to the base sync-directory -and may additionally include wildcards like '*' or '?'.</FONT></P> +files and directories works by specifying a phrase that is compared +against a file or directory path. Only if the file or directory +matches at least one entry in the include list and none of the +entries in the exclude list it passes filtering. The phrase is also a +file or directory name, but it must be relative to the base +sync-directory and may additionally include wild cards like '*' or +'?'.</FONT></P> +<P STYLE="margin-bottom: 0cm"><BR> +</P> +<P STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif"><B>Example:</B> +<SPAN STYLE="font-weight: normal">(Exclude all sub directories</SPAN><FONT FACE="Courier New, monospace"><SPAN STYLE="font-weight: normal">)</SPAN></FONT></FONT></P> +<P STYLE="margin-left: 1.46cm; margin-bottom: 0cm"><SPAN ID="Rahmen1" DIR="LTR" STYLE="float: left; width: 80%; height: 0.14cm; border: none; padding: 0cm; background: #e6e6e6"> + <P ALIGN=LEFT STYLE="margin-left: 0.79cm; margin-right: 0.98cm; margin-bottom: 0cm"> + <FONT FACE="Tahoma, sans-serif">Include: <FONT FACE="Courier New, monospace">*</FONT><BR>Exclude: + <FONT FACE="Courier New, monospace">*\</FONT></FONT></P> +</SPAN><BR CLEAR=LEFT><BR> +</P> +<P STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif">This +will exclude all objects within the two directories that end with a +'</FONT><FONT FACE="Courier New, monospace">\</FONT><FONT FACE="Tahoma, sans-serif">' +character, which is interpreted as the end of a directory name.</FONT></P> <P STYLE="margin-bottom: 0cm"><BR> </P> <P STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif"><B>Example:</B> @@ -47,7 +61,7 @@ and may additionally include wildcards like '*' or '?'.</FONT></P> <P STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif"><SPAN STYLE="font-weight: normal">Exclude all </SPAN></FONT><FONT FACE="Courier New, monospace"><SPAN STYLE="font-weight: normal">*.tmp</SPAN></FONT> <FONT FACE="Tahoma, sans-serif"><SPAN STYLE="font-weight: normal">files - beyond </SPAN></FONT><FONT FACE="Courier New, monospace"><SPAN STYLE="font-weight: normal">subfolder</SPAN></FONT><FONT FACE="Tahoma, sans-serif"><SPAN STYLE="font-weight: normal">:<BR></SPAN></FONT> <FONT FACE="Tahoma, sans-serif"><SPAN STYLE="font-weight: normal">Filter: + within </SPAN></FONT><FONT FACE="Courier New, monospace"><SPAN STYLE="font-weight: normal">subfolder</SPAN></FONT><FONT FACE="Tahoma, sans-serif"><SPAN STYLE="font-weight: normal">:<BR></SPAN></FONT> <FONT FACE="Tahoma, sans-serif"><SPAN STYLE="font-weight: normal">Filter: </SPAN></FONT><FONT FACE="Courier New, monospace">\sample\subfolder\*.tmp</FONT></P> <P STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif"><SPAN STYLE="font-weight: normal">Exclude all files and folders named </SPAN></FONT><FONT FACE="Courier New, monospace"><SPAN STYLE="font-weight: normal">CVS</SPAN></FONT> @@ -59,6 +73,10 @@ and may additionally include wildcards like '*' or '?'.</FONT></P> <FONT FACE="Tahoma, sans-serif"><SPAN STYLE="font-weight: normal">as part of their name:<BR></SPAN></FONT> <FONT FACE="Tahoma, sans-serif"><SPAN STYLE="font-weight: normal">Filter: </SPAN></FONT><FONT FACE="Courier New, monospace">*test*</FONT></P> + <P STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif"><SPAN STYLE="font-weight: normal">Exclude + multiple entries; separate by semicolon or newlines:<BR></SPAN></FONT> <FONT FACE="Tahoma, sans-serif"><SPAN STYLE="font-weight: normal">Filter: + </SPAN></FONT><FONT FACE="Courier New, monospace"><SPAN STYLE="font-weight: normal">*.tmp; + *.doc; *.bak</SPAN></FONT></P> </SPAN><BR CLEAR=LEFT><BR> </P> <P STYLE="margin-bottom: 0cm"><BR> @@ -77,26 +95,12 @@ and may additionally include wildcards like '*' or '?'.</FONT></P> </P> <P STYLE="margin-bottom: 0cm"><BR> </P> -<P STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif"><B>Example:</B> -<SPAN STYLE="font-weight: normal">(Exclude all sub folders</SPAN><FONT FACE="Courier New, monospace"><SPAN STYLE="font-weight: normal">)</SPAN></FONT></FONT></P> -<P STYLE="margin-left: 1.46cm; margin-bottom: 0cm"><SPAN ID="Rahmen1" DIR="LTR" STYLE="float: left; width: 80%; height: 0.14cm; border: none; padding: 0cm; background: #e6e6e6"> - <P ALIGN=LEFT STYLE="margin-left: 0.79cm; margin-right: 0.98cm; margin-bottom: 0cm"> - <FONT FACE="Tahoma, sans-serif">Include: <FONT FACE="Courier New, monospace">*</FONT><BR>Exclude: - <FONT FACE="Courier New, monospace">*\</FONT></FONT></P> -</SPAN><BR CLEAR=LEFT><BR> -</P> -<P STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif">This -will exclude all objects within the two directories that end with a -'</FONT><FONT FACE="Courier New, monospace">\</FONT><FONT FACE="Tahoma, sans-serif">' -character, which is interpreted as the end of a directory name.</FONT></P> -<P STYLE="margin-bottom: 0cm"><BR> -</P> <P STYLE="margin-left: 1.46cm; margin-bottom: 0cm"><SPAN ID="Rahmen4" DIR="LTR" STYLE="float: left; width: 80%; height: 0.14cm; border: 1px solid #000080; padding: 0.05cm; background: #ccccff"> <P ALIGN=LEFT STYLE="margin-left: 0.79cm; margin-right: 0.98cm; margin-bottom: 0cm"> <FONT FACE="Tahoma, sans-serif"><B>Note:</B><BR>In most cases manually specifying a filter phrase is not necessary! You can - exclude files, directories and even whole lists of both directly on - main grid via context menu.</FONT></P> + exclude files, directories and even complete lists of both directly + on main grid via context menu.</FONT></P> </SPAN><BR CLEAR=LEFT><BR> </P> </BODY> diff --git a/BUILD/Help/html/advanced/RealtimeSync.html b/BUILD/Help/html/advanced/RealtimeSync.html index d5738fb2..6acea5d5 100644 --- a/BUILD/Help/html/advanced/RealtimeSync.html +++ b/BUILD/Help/html/advanced/RealtimeSync.html @@ -5,7 +5,7 @@ <TITLE></TITLE> <META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2 (Win32)"> <META NAME="CREATED" CONTENT="20091206;16574000"> - <META NAME="CHANGED" CONTENT="20110102;20030700"> + <META NAME="CHANGED" CONTENT="20110221;19263900"> <META NAME="Info 1" CONTENT=""> <META NAME="Info 2" CONTENT=""> <META NAME="Info 3" CONTENT=""> @@ -61,6 +61,12 @@ to begin monitoring.</FONT></P> <UL> <P ALIGN=LEFT STYLE="margin-right: 0.98cm; margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif"><B>Note:</B></FONT></P> <LI><P ALIGN=LEFT STYLE="margin-right: 0.98cm; margin-bottom: 0cm"> + <FONT FACE="Tahoma, sans-serif">The command-line must <B>NOT</B> + <B>block</B> the progress. If a FreeFileSync batch file is called + make sure it is operating in "silent-mode" and "error + handling” is set to "ignore errors" or "exit + instantly<U>"</U>.</FONT></P> + <LI><P ALIGN=LEFT STYLE="margin-right: 0.98cm; margin-bottom: 0cm"> <FONT FACE="Tahoma, sans-serif">The settings dialog can be skipped by passing a RealtimeSync configuration file (<FONT FACE="Courier New, monospace">*.ffs_real</FONT>) OR a FreeFileSync batch file (<FONT FACE="Courier New, monospace">*.ffs_batch</FONT>) @@ -71,10 +77,6 @@ to begin monitoring.</FONT></P> restricted to starting FreeFileSync. It can also be used in other scenarios, like sending an email whenever a certain directory is modified.</FONT></P> - <LI><P ALIGN=LEFT STYLE="margin-right: 0.98cm; margin-bottom: 0cm"> - <FONT FACE="Tahoma, sans-serif">The command-line must not block - the progress. If a FreeFileSync batch file is to be called make - sure it is operating in "silent-mode".</FONT></P> </UL> </SPAN><BR CLEAR=LEFT> </P> diff --git a/BUILD/Languages/chinese_simple.lng b/BUILD/Languages/chinese_simple.lng index 9898f0ed..37d3a548 100644 --- a/BUILD/Languages/chinese_simple.lng +++ b/BUILD/Languages/chinese_simple.lng @@ -154,6 +154,10 @@ <符å·è¿žæŽ¥> <multiple selection> <多选> +A directory input field is empty. +有一个目录输入å—段是空的. +A directory will be modified which is part of multiple folder pairs! Please review synchronization settings! +有一个目录将被修改,而它是多个文件夹对的一部分!请é‡æ–°æ£€æŸ¥åŒæ¥è®¾ç½®! A newer version of FreeFileSync is available: FreeFileSync 有新版å¯ç”¨: Abort requested: Waiting for current operation to finish... @@ -370,6 +374,8 @@ Encoding extended time information: %x æ£åœ¨ç¼–ç 扩展时间信æ¯:%x Endless loop when traversing directory: éåŽ†ç›®å½•æ—¶å‡ºçŽ°æ— é™å¾ªçŽ¯: +Equal files/folders that differ in attributes only +相ç‰çš„文件/文件夹仅仅文件属性ä¸åŒ Error 错误 Error changing modification time: @@ -476,8 +482,6 @@ Files that exist on both sides, right one is newer 两侧都有,å³ä¾§è¾ƒæ–°çš„文件 Files that have different content 有ä¸åŒå†…容的文件 -Files/folders that differ in attributes only -文件/文件夹仅属性ä¸åŒ Files/folders that exist on left side only 仅在左侧å˜åœ¨çš„文件/文件夹 Files/folders that exist on right side only @@ -488,8 +492,6 @@ Filter is active 过滤器已激活 Filter settings have changed! 过滤设置已改å˜! -Filter view -过滤查看 Filter: All pairs 过滤器:所有的é…对 Filter: Single pair @@ -506,6 +508,8 @@ Follow è·Ÿéš Free disk space available: å¯ç”¨ç£ç›˜ç©ºé—´: +Free disk space required: +需è¦å¯ç”¨çš„ç£ç›˜ç©ºé—´: FreeFileSync Batch Job FreeFileSync 批处ç†ä½œä¸š FreeFileSync at Sourceforge @@ -600,6 +604,8 @@ Integrate external applications into context menu. The following macros are avai 集æˆå¤–部应用程åºåˆ°å³é”®èœå•. 如下å®å¯ç”¨: Invalid FreeFileSync config file! æ— æ•ˆçš„ FreeFileSync é…置文件! +Last used configurations (press DEL to remove from list) +最åŽä½¿ç”¨çš„é…ç½®(按DEL键将其从列表ä¸ç§»é™¤) Leave as unresolved conflict é—ç•™ä¸ºæœªè§£å†³çš„å†²çª Left @@ -608,8 +614,6 @@ Legend 图例 Load configuration from file ä»Žæ–‡ä»¶åŠ è½½é…ç½® -Load configuration history (press DEL to delete items) -åŠ è½½é…置历å²è®°å½•(按DELé”®åˆ é™¤é¡¹ç›®) Log-messages: 日志信æ¯: Logging @@ -620,12 +624,16 @@ Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit v ä¸æ”¯æŒåœ¨WOW64上使用å·å½±å¤åˆ¶. 请使用 FreeFileSync 64ä½ç‰ˆæœ¬. Match case 匹é…大å°å†™ +Maximum number of logfiles: +最大的日志文件数: +Memory allocation failed! +内å˜åˆ†é…失败! Minimum Idle Time [seconds] 最å°ç©ºé—²æ—¶é—´[秒] Mirror ->> é•œåƒ ->> -Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronization. -左侧文件夹镜åƒå¤‡ä»½: åŒæ¥åŽå³ä¾§æ–‡ä»¶å¤¹å°†è¢«è¦†ç›–并且完全匹é…左边的文件夹. +Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization. +é•œåƒå¤‡ä»½å·¦è¾¹çš„文件夹.åŒæ¥åŽå³è¾¹çš„文件夹被修改为和左边文件夹精确匹é…. Monitoring active... 监视激活... More than 50% of the total number of files will be copied or deleted! @@ -645,7 +653,7 @@ Moving file %x to user-defined directory %y Moving folder %x to user-defined directory %y 移动文件夹 %x 到用户定义目录 %y Multiple... -å€æ•°... +并è”... No change since last synchronization! 自从最åŽä¸€æ¬¡åŒæ¥ä»¥æ¥æ²¡æœ‰å˜åŠ¨! No filter selected @@ -696,8 +704,6 @@ Published under the GNU General Public License: 在GNU通用公共许å¯ä¸‹å‘布: Question 问题 -Re-enable all hidden dialogs? -é‡æ–°å¯ç”¨æ‰€æœ‰éšè—的对è¯æ¡†? RealtimeSync - Automated Synchronization 实时åŒæ¥ - 自动åŒæ¥ RealtimeSync configuration @@ -718,6 +724,8 @@ Reset é‡ç½® Reset view é‡ç½®è§†å›¾ +Restore all hidden dialogs? +æ¢å¤æ‰€æœ‰è¢«éšè—的对è¯æ¡†? Right å³ä¾§ S&ave configuration... @@ -740,6 +748,8 @@ Select logfile directory: 选择日志ä¿å˜ä½ç½®: Select variant: 选择å˜åŒ–çš„: +Select view +选择视图 Set direction: 设置方å‘: Setting default synchronization directions: Old files will be overwritten with newer files. @@ -828,8 +838,6 @@ Synchronize... åŒæ¥... Synchronizing... åŒæ¥ä¸... -System out of memory! -系统内å˜æº¢å‡º! Target directory already existing! ç›®æ ‡ç›®å½•å·²ç»å˜åœ¨! Target file already existing! @@ -850,8 +858,6 @@ Time remaining: 剩余时间: Total amount of data that will be transferred å°†è¢«è½¬ç§»çš„æ€»æ•°æ® -Total required free disk space: -所需å¯ç”¨ç£ç›˜ç©ºé—´æ€»é‡: Total time: 总共时间: Transfer file and directory permissions\n(Requires Administrator rights) @@ -872,14 +878,14 @@ Use Recycle Bin 使用回收站 Use Recycle Bin when deleting or overwriting files å½“åˆ é™¤æˆ–è¦†ç›–æ–‡ä»¶æ—¶ä½¿ç”¨å›žæ”¶ç«™ -User-defined directory -用户定义目录 User-defined directory for deletion was not specified! ç”¨äºŽåˆ é™¤çš„ç”¨æˆ·å®šä¹‰ç›®å½•æ²¡æœ‰æŒ‡å®š! Variant å˜åŒ– Verifying file %x æ ¡éªŒæ–‡ä»¶ %x +Versioning +ä¿ç•™åŽ†å²ç‰ˆæœ¬ Volume name %x not part of filename %y! å·å %x 并éžæ–‡ä»¶å %y 的一部分! Waiting for missing directories... @@ -888,14 +894,12 @@ Waiting while directory is locked (%x)... 由于目录已é”定而æ£åœ¨ç‰å¾…(%x)... Warning è¦å‘Š -Warning: Synchronization failed for %x item(s): -è¦å‘Š:åŒæ¥å¤±è´¥ %x (æŸäº›)项目: When the comparison is started with this option set the following decision tree is processed: 当以æ¤é€‰é¡¹å¼€å§‹æ¯”è¾ƒæ—¶ä»¥ä¸‹å†³å®šæ ‘è¢«å¤„ç†: You can ignore conflicts and continue synchronization. ä½ å¯å¿½ç•¥å†²çªå¹¶ç»§ç»åŒæ¥. -You can ignore the error to consider not existing directories as empty. -您å¯å¿½ç•¥æ¤é”™è¯¯è€Œå°†ä¸å˜åœ¨çš„目录视为空. +You can ignore this error to consider the directory as empty. +ä½ å¯ä»¥å¿½ç•¥è¿™ä¸ªé”™è¯¯è€Œè®¤ä¸ºç›®å½•æ˜¯ç©ºçš„. You may try to synchronize remaining items again (WITHOUT having to re-compare)! 您å¯èƒ½ä¼šå°è¯•å†æ¬¡åŒæ¥å‰©ä½™çš„项目(而ä¸å¿…é‡æ–°æ¯”较)! different diff --git a/BUILD/Languages/chinese_traditional.lng b/BUILD/Languages/chinese_traditional.lng index fc07f62b..e00a8b06 100644 --- a/BUILD/Languages/chinese_traditional.lng +++ b/BUILD/Languages/chinese_traditional.lng @@ -154,6 +154,10 @@ <符號連çµ> <multiple selection> <多é‡é¸æ“‡> +A directory input field is empty. +目錄輸入的欄ä½ç‚ºç©º +A directory will be modified which is part of multiple folder pairs! Please review synchronization settings! +一個目錄將被修改,這是多å°è³‡æ–™å¤¾çš„一部份ï¼è«‹æª¢é–±åŒæ¥è¨ç½®ï¼ A newer version of FreeFileSync is available: 有較新版本的 FreeFileSync å¯ç”¨ï¼š Abort requested: Waiting for current operation to finish... @@ -202,6 +206,8 @@ Cannot determine sync-direction: 無法判斷åŒæ¥æ–¹å‘: Cannot find %x 找ä¸åˆ° %x +Cannot write to empty directory path! + Category 分類 Clear filter settings @@ -370,6 +376,8 @@ Encoding extended time information: %x 編碼延長時間資訊:%x Endless loop when traversing directory: 當éæ·ç›®éŒ„時無é™å¾ªç’°ï¼š +Equal files/folders that differ in attributes only +åŒç‰æª”案/資料夾åªåœ¨æ–¼å±¬æ€§ä¸åŒ Error 錯誤 Error changing modification time: @@ -425,7 +433,7 @@ Error when monitoring directories. Error writing file: 寫入檔案錯誤: Error writing security context: -寫入安全上內文錯誤: +寫入安全性內容錯誤: Error writing to synchronization database: 寫入åŒæ¥è³‡æ–™åº«éŒ¯èª¤ï¼š Example @@ -476,8 +484,6 @@ Files that exist on both sides, right one is newer 檔案å˜åœ¨æ–¼å…©é‚Šï¼Œå³é‚Šæª”案較新 Files that have different content 具有ä¸åŒå…§å®¹çš„檔案 -Files/folders that differ in attributes only -檔案/資料夾åªæœ‰å±¬æ€§ä¸åŒ Files/folders that exist on left side only åªå˜åœ¨æ–¼å·¦é‚Šçš„檔案/資料夾 Files/folders that exist on right side only @@ -488,8 +494,6 @@ Filter is active 篩é¸å™¨ç‚ºå•Ÿå‹• Filter settings have changed! 篩é¸å™¨è¨å®šå·²æ›´æ”¹ï¼ -Filter view -篩é¸æª¢è¦– Filter: All pairs 篩é¸å™¨ï¼šæ‰€æœ‰å° Filter: Single pair @@ -505,7 +509,9 @@ Folder pairs Follow 跟隨 Free disk space available: -å¯ç”¨çš„ç£ç¢Ÿç©ºé–“: +å¯ç”¨ç£ç¢Ÿç©ºé–“: +Free disk space required: +所需è¦çš„å¯ç”¨ç£ç¢Ÿç©ºé–“: FreeFileSync Batch Job FreeFileSync 批次處ç†ä½œæ¥ FreeFileSync at Sourceforge @@ -600,6 +606,8 @@ Integrate external applications into context menu. The following macros are avai æ•´åˆä¸Šä¸‹æ–‡åŠŸèƒ½è¡¨ä¸çš„外部應用程å¼ã€‚å¯ä»¥ä½¿ç”¨ä¸‹é¢çš„巨集: Invalid FreeFileSync config file! 無效的 FreeFileSync é…ç½®æª”æ¡ˆï¼ +Last used configurations (press DEL to remove from list) +上次使用的é…ç½®(按DELéµï¼Œå¾žæ¸…å–®ä¸ç§»é™¤) Leave as unresolved conflict ä¿ç•™çµ¦æœªè§£æ±ºçš„è¡çª Left @@ -608,8 +616,6 @@ Legend 圖例 Load configuration from file 從檔案載入é…ç½® -Load configuration history (press DEL to delete items) -載入é…置的æ·å²è¨˜éŒ„(按DELéµåˆªé™¤é …ç›®) Log-messages: 日誌訊æ¯ï¼š Logging @@ -620,12 +626,16 @@ Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit v ä¸æ”¯æ´è£½ä½œ WOW64 上的å·å½±å‰¯æœ¬ã€‚請使用 FreeFileSync 64ä½å…ƒç‰ˆæœ¬ã€‚ Match case å€åˆ†å¤§å°å¯« +Maximum number of logfiles: +日誌檔的最大數目: +Memory allocation failed! +記憶體分é…å¤±æ•—ï¼ Minimum Idle Time [seconds] 最å°é–’置時間 [秒] Mirror ->> é¡åƒ ->> -Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronization. -左邊資料夾的é¡åƒå‚™ä»½ï¼šåŒæ¥ä¹‹å¾Œï¼Œå³é‚Šè³‡æ–™å¤¾å°‡è¢«è¦†è“‹ï¼Œå®Œå…¨å’Œå·¦é‚Šè³‡æ–™å¤¾ä¸€æ¨¡ä¸€æ¨£ã€‚ +Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization. +é¡åƒå‚™ä»½çš„左邊的資料夾。åŒæ¥å¾Œï¼Œå³é‚Šçš„資料夾進行修改以完全相é…左邊的資料夾。 Monitoring active... 監測活動... More than 50% of the total number of files will be copied or deleted! @@ -696,8 +706,6 @@ Published under the GNU General Public License: 在GNU通用公共許å¯è‰ä¸‹ç™¼ä½ˆï¼š Question å•é¡Œ -Re-enable all hidden dialogs? -é‡æ–°å•Ÿç”¨æ‰€æœ‰éš±è—çš„å°è©±æ¡†å—Žï¼Ÿ RealtimeSync - Automated Synchronization å³æ™‚åŒæ¥ - 自動åŒæ¥ RealtimeSync configuration @@ -718,6 +726,8 @@ Reset é‡ç½® Reset view é‡ç½®æª¢è¦– +Restore all hidden dialogs? +è¦é‚„原全部隱è—çš„å°è©±æ¡†å—Žï¼Ÿ Right å³é‚Š S&ave configuration... @@ -740,6 +750,8 @@ Select logfile directory: é¸æ“‡æ—¥èªŒæª”目錄: Select variant: é¸æ“‡è®Šæ•¸ï¼š +Select view +é¸æ“‡æª¢è¦– Set direction: è¨å®šæ–¹å‘: Setting default synchronization directions: Old files will be overwritten with newer files. @@ -828,8 +840,6 @@ Synchronize... åŒæ¥... Synchronizing... æ£åœ¨åŒæ¥... -System out of memory! -系統記憶體ä¸è¶³ï¼ Target directory already existing! 目標目錄已å˜åœ¨ï¼ Target file already existing! @@ -850,8 +860,6 @@ Time remaining: 剩餘時間: Total amount of data that will be transferred å°‡è¦å‚³è¼¸çš„å…¨éƒ¨è³‡æ–™é‡ -Total required free disk space: -全部所需è¦çš„å¯ç”¨ç£ç¢Ÿç©ºé–“: Total time: 全部時間: Transfer file and directory permissions\n(Requires Administrator rights) @@ -872,14 +880,14 @@ Use Recycle Bin 使用資æºå›žæ”¶ç’ Use Recycle Bin when deleting or overwriting files 當刪除或覆蓋檔案時使用資æºå›žæ”¶ç’ -User-defined directory -自定義目錄 User-defined directory for deletion was not specified! 未指定è¦åˆªé™¤çš„è‡ªå®šç¾©ç›®éŒ„ï¼ Variant 變數 Verifying file %x é©—è‰æª” %x +Versioning +版本控制 Volume name %x not part of filename %y! å·å %x 並éžæª”å %y çš„ä¸€éƒ¨ä»½ï¼ Waiting for missing directories... @@ -888,14 +896,12 @@ Waiting while directory is locked (%x)... ç‰å¾…目錄被鎖定(%x)... Warning è¦å‘Š -Warning: Synchronization failed for %x item(s): -è¦å‘Šï¼šåŒæ¥å¤±æ•—çš„å稱為 %x é …ç›®ï¼š When the comparison is started with this option set the following decision tree is processed: 當比å°é–‹å§‹ï¼Œä½¿ç”¨æ¤é¸é …è¨å®šæ™‚,以下決ç–樹將被處ç†ï¼š You can ignore conflicts and continue synchronization. ä½ å¯ä»¥å¿½ç•¥è¡çªï¼Œä¸¦ç¹¼çºŒåŒæ¥ã€‚ -You can ignore the error to consider not existing directories as empty. -ä½ å¯ä»¥å¿½ç•¥è©²éŒ¯èª¤è€Œå°‡ä¸å˜åœ¨çš„目錄視為空目錄。 +You can ignore this error to consider the directory as empty. +您å¯ä»¥å¿½ç•¥æ¤éŒ¯èª¤ï¼Œè€ƒæ…®è©²ç›®éŒ„為空。 You may try to synchronize remaining items again (WITHOUT having to re-compare)! 您å¯èƒ½æœƒå˜—試å†æ¬¡åŒæ¥å‰©é¤˜é …ç›®(ä¸ç”¨é‡æ–°æ¯”å°)ï¼ different diff --git a/BUILD/Languages/czech.lng b/BUILD/Languages/czech.lng index 8067567e..dbfa5de0 100644 --- a/BUILD/Languages/czech.lng +++ b/BUILD/Languages/czech.lng @@ -154,8 +154,12 @@ soubor: 1 <Symlink> <multiple selection> <vÃcenásobný výbÄ›r> +A directory input field is empty. +Nenà zadán vstupnà adresář. +A directory will be modified which is part of multiple folder pairs! Please review synchronization settings! +Bude zmÄ›nÄ› adresář, který je souÄástà adresářového páru vÃcenásobného porovnánÃ! ProsÃm zkontrolujte si nastavenà synchronizace! A newer version of FreeFileSync is available: -je dostupná novÄ›jÅ¡Ã verze FreeFileSync: +Je dostupná novÄ›jÅ¡Ã verze FreeFileSync: Abort requested: Waiting for current operation to finish... Požadavek na pÅ™eruÅ¡enÃ: ÄŒekánà na ukonÄenà aktuálnà operace... Abort synchronization immediately @@ -370,6 +374,8 @@ Encoding extended time information: %x Zpracovánà rozÅ¡ÃÅ™ené informace o Äase: %x Endless loop when traversing directory: Zacyklenà pÅ™i procházenà adresáře: +Equal files/folders that differ in attributes only +Stejné soubory/adresáře, které se liÅ¡Ã pouze ve vlastnostech Error Chyba Error changing modification time: @@ -476,8 +482,6 @@ Files that exist on both sides, right one is newer Soubory, které existujà na obou stranách, z nichž vpravo je novÄ›jÅ¡Ã Files that have different content Soubory, které majà rozdÃlný obsah -Files/folders that differ in attributes only -Soubory, ketré se liÅ¡Ã pouze ve vlastnostech Files/folders that exist on left side only Soubory/adresáře, které existujà pouze vlevo Files/folders that exist on right side only @@ -488,8 +492,6 @@ Filter is active Filtr je zapnutý Filter settings have changed! Nastavenà filtru bylo zmÄ›nÄ›no! -Filter view -Filtrovat seznam Filter: All pairs Filtr: VÅ¡echny páry Filter: Single pair @@ -506,6 +508,8 @@ Follow PoužÃt cÃl Free disk space available: Volné mÃsto k dispozici: +Free disk space required: +Požadované volné mÃsto na disku: FreeFileSync Batch Job FreeFileSync Dávkové zpracovánà FreeFileSync at Sourceforge @@ -600,6 +604,8 @@ Integrate external applications into context menu. The following macros are avai Integrace externà aplikace do kontextového menu. K dispozici jsou následujÃcà makra: Invalid FreeFileSync config file! Chybný konfiguraÄnà soubor FreeFileSync! +Last used configurations (press DEL to remove from list) +PoslednÄ› použité konfigurace (pomocà DEL můžete položku smazat) Leave as unresolved conflict Ponechat jako nevyÅ™eÅ¡ený konflikt Left @@ -608,8 +614,6 @@ Legend Legenda Load configuration from file NaÄÃst konfiguraci ze souboru -Load configuration history (press DEL to delete items) -NaÄÃst historii konfigurace (pomocà DEL můžete položku smazat) Log-messages: Záznamy: Logging @@ -620,12 +624,16 @@ Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit v Vytvářenà stÃnových kopià na WOW64 nenà podporováno. ProsÃm použijte 64 bitovou verzi FreeFileSync. Match case RozliÅ¡ovat malá a velká pÃsmena +Maximum number of logfiles: +Maximálnà poÄet záznamových soubor +Memory allocation failed! +Chyba pÅ™idÄ›lenà pamÄ›ti! Minimum Idle Time [seconds] Minimálnà Äas prodlevy [v sekundách] Mirror ->> Zrcadlenà ->> -Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronization. -Zrcadlenà levého adresáře: Pravý adresář bude pÅ™epsán a po synchronizaci bude totožný s levým. +Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization. +Zrcadlenà levého adresáře. Pravý adresář bude zmÄ›nÄ›n tak, aby po synchronizaci byl totožný s levým. Monitoring active... Sledovánà zapnuto... More than 50% of the total number of files will be copied or deleted! @@ -696,8 +704,6 @@ Published under the GNU General Public License: Vydáno podle GNU General Public License (GPL): Question Otázky -Re-enable all hidden dialogs? -Znovu povolit skryté dialogy? RealtimeSync - Automated Synchronization RealtimeSync - Automatická synchronizace RealtimeSync configuration @@ -718,6 +724,8 @@ Reset Resetovat Reset view Výchozà zobrazenà +Restore all hidden dialogs? +Obnovit vÅ¡echny skryté dialogy? Right Pravý S&ave configuration... @@ -737,9 +745,11 @@ Vyberte adresář Select alternate synchronization settings Vyberte alternativnà nastavenà synchronizace Select logfile directory: -Vyberte adresář pro záznamy: +Vyberte adresář pro záznamové soubory: Select variant: Vyberte variantu: +Select view +Vyberte zobrazenà Set direction: Nastavit adresář: Setting default synchronization directions: Old files will be overwritten with newer files. @@ -795,7 +805,7 @@ Rychlost: Start Start Start minimized and write status information to a logfile -Spustit minimalizovaný a zapisovat informace do souboru +Spustit minimalizovaný a zapisovat informace do záznamového souboru Start synchronization Start synchronizace Statistics @@ -828,8 +838,6 @@ Synchronize... Synchronizace Synchronizing... Synchronizuji... -System out of memory! -Nedostatek pamÄ›ti! Target directory already existing! CÃlový adresář již existuje! Target file already existing! @@ -850,8 +858,6 @@ Time remaining: ZbývajÃcà Äas: Total amount of data that will be transferred Celkový objem dat, který bude pÅ™enesen -Total required free disk space: -Požadované volné mÃsto na disku: Total time: Celkový Äas: Transfer file and directory permissions\n(Requires Administrator rights) @@ -872,14 +878,14 @@ Use Recycle Bin PoužÃt KoÅ¡ Use Recycle Bin when deleting or overwriting files PoužÃt KoÅ¡ pÅ™i mazánà nebo pÅ™episu souborů -User-defined directory -Uživatelsky definovaný adresář User-defined directory for deletion was not specified! Uživatelsky definovaný adresář pro mazánà nebyl zadán! Variant Varianta Verifying file %x Kontroluji soubor %x +Versioning +Verzovánà Volume name %x not part of filename %y! Disk %x nenà souÄástà jména souboru %y! Waiting for missing directories... @@ -888,14 +894,12 @@ Waiting while directory is locked (%x)... ÄŒekánà na uzamÄenà adresáře (%x) Warning Varovánà -Warning: Synchronization failed for %x item(s): -VarovánÃ: Synchronizace se nepovedla pro \"%x\" položek: When the comparison is started with this option set the following decision tree is processed: Když je zahájeno porovnávánà s tÃmto nastavenÃm, je použito následujÃcà schéma rozhodovánÃ: You can ignore conflicts and continue synchronization. Je možné konflikt ignorovat a pokraÄovat v synchronizaci. -You can ignore the error to consider not existing directories as empty. -Pro považovánà neexistujÃcÃch adresářů jako prázdných můžete chybu ignorovat. +You can ignore this error to consider the directory as empty. +Tuto chybu můžete ignorovat a považovat neexistujÃcà adresář jako prázdný. You may try to synchronize remaining items again (WITHOUT having to re-compare)! Můžete se pokusit synchronizovat zbývajÃcà položky (BEZ nutnosti znovuporovnávánÃ)! different diff --git a/BUILD/Languages/dutch.lng b/BUILD/Languages/dutch.lng index bbd949a5..82e21fb4 100644 --- a/BUILD/Languages/dutch.lng +++ b/BUILD/Languages/dutch.lng @@ -154,6 +154,10 @@ <Symlink> <multiple selection> <veelvoudige selectie> +A directory input field is empty. +Een tekstveld over de map is leeg. +A directory will be modified which is part of multiple folder pairs! Please review synchronization settings! +Een map wordt bewerkt die deel is van meerdere mappen! Controleer de synchronisatie instellingen! A newer version of FreeFileSync is available: Een nieuwe versie van FreeFileSync is beschikbaar: Abort requested: Waiting for current operation to finish... @@ -370,6 +374,8 @@ Encoding extended time information: %x Coderen uitgebreide tijd informatie: %x Endless loop when traversing directory: Oneindige lus bij het nalopen van locatie: +Equal files/folders that differ in attributes only +Alleen gelijke bestanden/mappen die verschillen van attributen Error Fout Error changing modification time: @@ -476,8 +482,6 @@ Files that exist on both sides, right one is newer Bestanden die aan beide kanten bestaan, maar waarvan de rechterkant nieuwer is Files that have different content Bestanden dat andere inhoud hebben -Files/folders that differ in attributes only -Alleen bestanden/mappen die anders zijn dan attributen Files/folders that exist on left side only Bestanden/mappen die alleen aan de linkerkant bestaan Files/folders that exist on right side only @@ -488,8 +492,6 @@ Filter is active Filer is actief Filter settings have changed! Filter instellingen opgeslagen! -Filter view -Bekijk het filter Filter: All pairs Filter: Alle paren Filter: Single pair @@ -506,6 +508,8 @@ Follow Volg Free disk space available: Beschikbare vrije schijfruimte : +Free disk space required: +Vrije ruimte op harde schrijf nodig: FreeFileSync Batch Job FreeFileSync batchjob FreeFileSync at Sourceforge @@ -573,7 +577,7 @@ Identificeer en verwerk verandereringen aan beide kanten dmv een database. Versc Idle time between detection of last change and execution of command line in seconds Inactieve tijd tussen de detectie van de laatste verandering en het uitvoeren van een command in seconden If you like FFS -Als het programma FreeFileSync u bevalt +Als het FreeFileSync u bevalt Ignore Negeer Ignore errors @@ -600,6 +604,8 @@ Integrate external applications into context menu. The following macros are avai Integreer externe applicaties in het context menu. De volgende macros zijn beschikbaar: Invalid FreeFileSync config file! FreeFileSync config bestand klopt niet! +Last used configurations (press DEL to remove from list) +Laatst gebruikte instellingen (druk op DEL om iets te verwijderen) Leave as unresolved conflict Beschouwen als onopgelost conflict Left @@ -608,8 +614,6 @@ Legend Legenda Load configuration from file Laad configuratie uit bestand -Load configuration history (press DEL to delete items) -Laad configuratiegeschiedenis (druk op DEL om items te verwijderen) Log-messages: Logberichten: Logging @@ -620,12 +624,16 @@ Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit v Schaduw kopieen op WOW64 worden niet ondersteund. Gebruik alstublieft de 64-bit versie van FreeFileSync. Match case Hoofdlettergevoelig +Maximum number of logfiles: +Maximale aantal van logbestanden: +Memory allocation failed! +RAM geheugen error! Minimum Idle Time [seconds] Minimale inactieve tijd [seconden] Mirror ->> Spiegelen ->> -Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronization. -Spiegel backup van de linkerkant: de rechterkant wordt overschreven en komt na synchronisatie exact overeen met de linkerkant. +Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization. +Spiegel backup van linker map. Rechter map is bewerk om precies hetzelfde te hebben na synchronisatie. Monitoring active... Observeren actief... More than 50% of the total number of files will be copied or deleted! @@ -696,8 +704,6 @@ Published under the GNU General Public License: Gepubliceerd onder de GNU General Public License: Question Vraag -Re-enable all hidden dialogs? -Herstellen van alle verborgen dialogen? RealtimeSync - Automated Synchronization RealtimeSync - Automatische Synchronisatie RealtimeSync configuration @@ -718,6 +724,8 @@ Reset Reset Reset view Scherm resetten +Restore all hidden dialogs? +Alle verborgen dialogen herstellen? Right Rechts S&ave configuration... @@ -740,6 +748,8 @@ Select logfile directory: Selecteer een map voor het logbestand: Select variant: Selecteer een variant: +Select view +Kies kijk Set direction: Selecteer map: Setting default synchronization directions: Old files will be overwritten with newer files. @@ -828,8 +838,6 @@ Synchronize... Synchroniseer... Synchronizing... Aan het synchroniseren... -System out of memory! -Systeem heeft te weinig geheugen Target directory already existing! Doellocatie bestaal al! Target file already existing! @@ -850,8 +858,6 @@ Time remaining: Benodigde tijd: Total amount of data that will be transferred Hoeveelheid data die verplaatst word -Total required free disk space: -Benodigde hoeveelheid vrije schijfruimte: Total time: Totale tijd: Transfer file and directory permissions\n(Requires Administrator rights) @@ -872,14 +878,14 @@ Use Recycle Bin Gebruik de prullenbak Use Recycle Bin when deleting or overwriting files Gebruik de prullenbak bij verwijderen of overschrijven van bestanden -User-defined directory -Door de gebruiker te definiëren locatie User-defined directory for deletion was not specified! Door de gebruiker te definiëren locatie voor verwijderen was niet opgegeven! Variant Variant Verifying file %x Verifiëren bestand %x +Versioning +Versieën Volume name %x not part of filename %y! Volume naam %x maakt niet deel uit van bestandsnaam %y! Waiting for missing directories... @@ -888,14 +894,12 @@ Waiting while directory is locked (%x)... Wachten totdat map is beveiligd (%x)... Warning Attentie -Warning: Synchronization failed for %x item(s): -Let op: %x item(s) konden niet worden gesynchroniseerd: When the comparison is started with this option set the following decision tree is processed: Wanneer met deze optie aan de vergelijking wordt gestart zal de volgende vergelijkingsboom worden gebruikt: You can ignore conflicts and continue synchronization. U kunt de conflicten negeren en doorgaan met synchroniseren. -You can ignore the error to consider not existing directories as empty. -U kunt de fout negeren om niet bestaande locaties als leeg te beschouwen. +You can ignore this error to consider the directory as empty. +Je kan deze error negeren als de map leeg is. You may try to synchronize remaining items again (WITHOUT having to re-compare)! U kunt proberen om de resterende bestanden opnieuw te synchroniseren (ZONDER opnieuw te hoeven vergelijken)! different diff --git a/BUILD/Languages/english_uk.lng b/BUILD/Languages/english_uk.lng index 5144a57b..ae242d82 100644 --- a/BUILD/Languages/english_uk.lng +++ b/BUILD/Languages/english_uk.lng @@ -154,6 +154,10 @@ <Symlink> <multiple selection> <multiple selection> +A directory input field is empty. +A directory input field is empty. +A directory will be modified which is part of multiple folder pairs! Please review synchronization settings! +A directory will be modified which is part of multiple folder pairs! Please review synchronisation settings! A newer version of FreeFileSync is available: A newer version of FreeFileSync is available: Abort requested: Waiting for current operation to finish... @@ -370,6 +374,8 @@ Encoding extended time information: %x Encoding extended time information: %x Endless loop when traversing directory: Endless loop when traversing directory: +Equal files/folders that differ in attributes only +Equal files/folders that differ in attributes only Error Error Error changing modification time: @@ -476,8 +482,6 @@ Files that exist on both sides, right one is newer Files that exist on both sides, right one is newer Files that have different content Files that have different content -Files/folders that differ in attributes only -Files/folders that differ in attributes only Files/folders that exist on left side only Files/folders that exist on left side only Files/folders that exist on right side only @@ -488,8 +492,6 @@ Filter is active Filter is active Filter settings have changed! Filter settings have changed! -Filter view -Filter view Filter: All pairs Filter: All pairs Filter: Single pair @@ -506,6 +508,8 @@ Follow Follow Free disk space available: Free disk space available: +Free disk space required: +Free disk space required: FreeFileSync Batch Job FreeFileSync Batch Job FreeFileSync at Sourceforge @@ -600,6 +604,8 @@ Integrate external applications into context menu. The following macros are avai Integrate external applications into context menu. The following macros are available: Invalid FreeFileSync config file! Invalid FreeFileSync config file! +Last used configurations (press DEL to remove from list) +Last used configurations (press DEL to remove from list) Leave as unresolved conflict Leave as unresolved conflict Left @@ -608,8 +614,6 @@ Legend Legend Load configuration from file Load configuration from file -Load configuration history (press DEL to delete items) -Load configuration history (press DEL to delete items) Log-messages: Log-messages: Logging @@ -620,12 +624,16 @@ Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit v Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit version. Match case Match case +Maximum number of logfiles: +Maximum number of logfiles: +Memory allocation failed! +Memory allocation failed! Minimum Idle Time [seconds] Minimum Idle Time [seconds] Mirror ->> Mirror ->> -Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronization. -Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronisation. +Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization. +Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronisation. Monitoring active... Monitoring active... More than 50% of the total number of files will be copied or deleted! @@ -696,8 +704,6 @@ Published under the GNU General Public License: Published under the GNU General Public Licence: Question Question -Re-enable all hidden dialogs? -Re-enable all hidden dialogues? RealtimeSync - Automated Synchronization RealtimeSync - Automated Synchronisation RealtimeSync configuration @@ -718,6 +724,8 @@ Reset Reset Reset view Reset view +Restore all hidden dialogs? +Restore all hidden dialogs? Right Right S&ave configuration... @@ -740,6 +748,8 @@ Select logfile directory: Select logfile directory: Select variant: Select variant: +Select view +Select view Set direction: Set direction: Setting default synchronization directions: Old files will be overwritten with newer files. @@ -828,8 +838,6 @@ Synchronize... Synchronise... Synchronizing... Synchronising... -System out of memory! -System out of memory! Target directory already existing! Target directory already existing! Target file already existing! @@ -850,8 +858,6 @@ Time remaining: Time remaining: Total amount of data that will be transferred Total amount of data that will be transferred -Total required free disk space: -Total required free disk space: Total time: Total time: Transfer file and directory permissions\n(Requires Administrator rights) @@ -872,14 +878,14 @@ Use Recycle Bin Use Recycle Bin Use Recycle Bin when deleting or overwriting files Use Recycle Bin when deleting or overwriting files -User-defined directory -User-defined directory User-defined directory for deletion was not specified! User-defined directory for deletion was not specified! Variant Variant Verifying file %x Verifying file %x +Versioning +Versioning Volume name %x not part of filename %y! Volume name %x not part of filename %y! Waiting for missing directories... @@ -888,14 +894,12 @@ Waiting while directory is locked (%x)... Waiting while directory is locked (%x)... Warning Warning -Warning: Synchronization failed for %x item(s): -Warning: Synchronisation failed for %x item(s): When the comparison is started with this option set the following decision tree is processed: When the comparison is started with this option set the following decision tree is processed: You can ignore conflicts and continue synchronization. You can ignore conflicts and continue synchronisation. -You can ignore the error to consider not existing directories as empty. -You can ignore the error to consider not existing directories as empty. +You can ignore this error to consider the directory as empty. +You can ignore this error to consider the directory as empty. You may try to synchronize remaining items again (WITHOUT having to re-compare)! You may try to synchronise remaining items again (WITHOUT having to re-compare)! different diff --git a/BUILD/Languages/finnish.lng b/BUILD/Languages/finnish.lng index 314d0baf..2fd6b6d0 100644 --- a/BUILD/Languages/finnish.lng +++ b/BUILD/Languages/finnish.lng @@ -154,6 +154,10 @@ Asetusten &lataus... <Symlinkki> <multiple selection> <monivalinta> +A directory input field is empty. +Hekemistokenttä on tyhjä. +A directory will be modified which is part of multiple folder pairs! Please review synchronization settings! +Moniosaisen hakemistoparin hakemisto muutetaan! Tarkista täsmäytys asetuksia! A newer version of FreeFileSync is available: FreeFileSync:n uusi versio on saatavilla: Abort requested: Waiting for current operation to finish... @@ -202,6 +206,8 @@ Cannot determine sync-direction: Täsmäytys suuntä tuntematon: Cannot find %x En löydä %x +Cannot write to empty directory path! + Category Luokka Clear filter settings @@ -370,6 +376,8 @@ Encoding extended time information: %x Tulkitaan laajennettua aikatietoa: %x Endless loop when traversing directory: Suorita hakemiston läpikulku jatkuvana: +Equal files/folders that differ in attributes only +Tiedostot/hakemistot ovat samat, atribuutit poikkeaa Error Virhe Error changing modification time: @@ -476,8 +484,6 @@ Files that exist on both sides, right one is newer Tiedosto löytyy molemmilla puolilla, oikea on uudempi Files that have different content Tiedostoja joissa eri sisältö -Files/folders that differ in attributes only -Tiedostoja/hakemistoja poikkeama vain ominaisuuksissa Files/folders that exist on left side only Tiedostoja/hakemistoja vain vasemmalla Files/folders that exist on right side only @@ -488,8 +494,6 @@ Filter is active Suodin aktivoitu Filter settings have changed! Suodinasetukset muutettu! -Filter view -Näytä suodattimet Filter: All pairs Suodata: kaikki parit Filter: Single pair @@ -506,6 +510,8 @@ Follow Seuraa Free disk space available: Levytilaa jäljellä: +Free disk space required: +Tarvittava vapaa levytila: FreeFileSync Batch Job FreeFileSync Eräajo FreeFileSync at Sourceforge @@ -600,6 +606,8 @@ Integrate external applications into context menu. The following macros are avai Liitä ulkoinen sovellus viitekehysvalikkoon. Seuraavat makrot ovat valittavissa: Invalid FreeFileSync config file! Virheellinen FreeFileSync asetustiedosto! +Last used configurations (press DEL to remove from list) +Viimeksi käytetty asetus (poista listalta paina DEL) Leave as unresolved conflict Jätä ratkaisemattomana virheenä Left @@ -608,8 +616,6 @@ Legend Selite Load configuration from file Lataa asetuksia tiedostosta -Load configuration history (press DEL to delete items) -Lataa asetusten historia (DEL poistaa osia - paina DEL) Log-messages: Lokin viestit: Logging @@ -620,12 +626,16 @@ Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit v WOW64 varjokopiointia ei tueta. Käytä FreeFileSync 64-bittistä versiota. Match case Täsmää kirjainkoko +Maximum number of logfiles: +Lokitiedostojen enimmäismäärä: +Memory allocation failed! +Muistin varaus epäonnistui! Minimum Idle Time [seconds] Minimi joutoaika [sekuntteja] Mirror ->> Peilaava ->> -Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronization. -Vasemman hakemiston varmuuskopio: Oikea ylikirjoitetaan ja on täsmäytyksen jälkeen vasemman tarkka kopio. +Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization. +Peilaava varmuuskopio. Oikeanpuoleinen hakemisto muutetaan täsmäytyksessä vastaamaan tarkasti vasenta. Monitoring active... Seuranta käynnissä... More than 50% of the total number of files will be copied or deleted! @@ -696,8 +706,6 @@ Published under the GNU General Public License: Julkaistu lisenssillä GNU General Public License: Question Kysymys -Re-enable all hidden dialogs? -Ota uudestaan käyttöön piilotetut? RealtimeSync - Automated Synchronization RealtimeSync - Automaattinen täsmäytys RealtimeSync configuration @@ -718,6 +726,8 @@ Reset Palauta Reset view Palauta näkymä +Restore all hidden dialogs? +Palauttetaanko kaikki piilodialoogit? Right Oikea S&ave configuration... @@ -740,6 +750,8 @@ Select logfile directory: Hakemisto lokitiedostoille: Select variant: Valitse vaihtoehto: +Select view +Valitse näkymä Set direction: Aseta suunta: Setting default synchronization directions: Old files will be overwritten with newer files. @@ -828,8 +840,6 @@ Synchronize... Täsmäytä... Synchronizing... Täsmäytetään... -System out of memory! -Järjestelmän muisti loppui! Target directory already existing! Haluttu tiedosto on jo olemassa! Target file already existing! @@ -850,8 +860,6 @@ Time remaining: Aikaa jäljellä: Total amount of data that will be transferred Siirrettävän datan määrä -Total required free disk space: -Vaadittu vapaa levytila: Total time: Kokonaisaika: Transfer file and directory permissions\n(Requires Administrator rights) @@ -867,19 +875,19 @@ Päivittävä -> Updating attributes of %x Päivita %x:n ominaisuudet Usage: -Käyttöaste: +Käyttö: Use Recycle Bin Käytä Roskakoria Use Recycle Bin when deleting or overwriting files Käytä Roskakoria kun poistat tai ylikirjoitat tiedostoja -User-defined directory -Käytä valittua hakemistoa User-defined directory for deletion was not specified! Hakemistoa ei valittu poistolle! Variant Vaihtoehto Verifying file %x Tarkistan tiedosto %x +Versioning +Versiointi Volume name %x not part of filename %y! Osan nimi %x ei esiinny tiedostonimessä %y! Waiting for missing directories... @@ -888,14 +896,12 @@ Waiting while directory is locked (%x)... Odotan hakemiston lukitusta (%x)... Warning Varoitus -Warning: Synchronization failed for %x item(s): -Varoitus: täsmäytys epäonnistui %x kohdassa: When the comparison is started with this option set the following decision tree is processed: Käynnistäessä täsmäytystä näillä asetuksilla ottaa käyttöön tämä päätöspuu: You can ignore conflicts and continue synchronization. Voit jatkaa poikkeamista huolimatta täsmäytystä. -You can ignore the error to consider not existing directories as empty. -Sivuta virhe ja kohtele puuttuvat hakemistot tyhjinä. +You can ignore this error to consider the directory as empty. +Voit jättää tämä virhe huomiotta ja tulkita hakemisto tyhjäksi. You may try to synchronize remaining items again (WITHOUT having to re-compare)! Yritä täsmäytystä lopuille uudestaan (ILMAN uutta vertailua)! different diff --git a/BUILD/Languages/french.lng b/BUILD/Languages/french.lng index 132225fb..b7ad6729 100644 --- a/BUILD/Languages/french.lng +++ b/BUILD/Languages/french.lng @@ -154,6 +154,10 @@ <Lien symbolique> <multiple selection> <sélection multiple> +A directory input field is empty. +Un champ répertoire est vide +A directory will be modified which is part of multiple folder pairs! Please review synchronization settings! +Un répertoire faisant partie de paires multiples doit être modifié ! Vérifiez les paramètres de la synchronisation ! A newer version of FreeFileSync is available: Une version plus récente de FreeFileSync est disponible : Abort requested: Waiting for current operation to finish... @@ -261,7 +265,7 @@ Copier uniquement les attributs de gauche à droite Copy attributes only from right to left Copier uniquement les attributs de droite à gauche Copy filesystem permissions -Copie des attributs de fichiers +Copie des droits d'accès Copy from left to right Copie de gauche à droite Copy from left to right overwriting @@ -370,6 +374,8 @@ Encoding extended time information: %x Codage de l'heure au format étendu : %x Endless loop when traversing directory: Boucle sans fin lors du parcours du répertoire : +Equal files/folders that differ in attributes only +Fichiers/Dossiers identiques dont seuls les attributs diffèrent Error Erreur Error changing modification time: @@ -476,8 +482,6 @@ Files that exist on both sides, right one is newer Fichiers existants des deux côtés, celui de droite est plus récent Files that have different content Fichiers ayant un contenu différent -Files/folders that differ in attributes only -Fichiers/Dossiers dont seuls les attributs diffèrent Files/folders that exist on left side only Fichiers/répertoires existant seulement à gauche Files/folders that exist on right side only @@ -488,8 +492,6 @@ Filter is active Le filtre est actif Filter settings have changed! La configuration du filtre a changé ! -Filter view -Filtrage de la vue Filter: All pairs Filtre : Toutes les paires Filter: Single pair @@ -506,6 +508,8 @@ Follow Suivre Free disk space available: Espace disque disponible : +Free disk space required: +Espace disque nécessaire : FreeFileSync Batch Job FreeFileSync Fichier de commandes FreeFileSync at Sourceforge @@ -600,6 +604,8 @@ Integrate external applications into context menu. The following macros are avai Inclure les applications externes dans le menu contextuel. Les macros suivantes sont disponibles : Invalid FreeFileSync config file! Fichier de configuration FreeFileSync invalide ! +Last used configurations (press DEL to remove from list) +Dernière configuration utilisée (Appuyez sur SUPPR pour l'enlever de la liste) Leave as unresolved conflict Abandonner en tant que conflit non résolu Left @@ -608,8 +614,6 @@ Legend Légende Load configuration from file Charger la configuration à partir du fichier -Load configuration history (press DEL to delete items) -Charger l'historique des configurations (appuyez sur Suppr pour supprimer des éléments) Log-messages: Messages log : Logging @@ -620,12 +624,16 @@ Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit v La copie en tâche de fond sur WOW64 n'est pas possible. Utilisez pour cela la version 64 bits de FreeFileSync. Match case Respecter la casse +Maximum number of logfiles: +Nombre maximum de fichiers Log +Memory allocation failed! +Erreur d'allocation de mémoire! Minimum Idle Time [seconds] Délai minimum (secondes) Mirror ->> Miroir ->> -Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronization. -Sauvegarde miroir du répertoire de gauche : Le répertoire de droite sera écrasé et totalement identique au répertoire de gauche après la synchronisation. +Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization. +Copie miroir du dossier de gauche. Le dossier de droite est modifié pour être strictement identique après la synchronisation. Monitoring active... Surveillance en cours... More than 50% of the total number of files will be copied or deleted! @@ -696,8 +704,6 @@ Published under the GNU General Public License: Publié sous licence GNU General Public License : Question Question -Re-enable all hidden dialogs? -Réactiver les boîtes de dialogues masquées ? RealtimeSync - Automated Synchronization RealtimeSync - Synchronisation Automatisée RealtimeSync configuration @@ -718,6 +724,8 @@ Reset Réinitialiser Reset view Réinitialiser la vue +Restore all hidden dialogs? +Restaurer toutes les boîtes de dialogue cachées ? Right Droite S&ave configuration... @@ -740,6 +748,8 @@ Select logfile directory: Choisissez un dossier pour le fichier .log : Select variant: Choisissez une variante : +Select view +Choisissez une vue Set direction: Choix de la direction : Setting default synchronization directions: Old files will be overwritten with newer files. @@ -828,8 +838,6 @@ Synchronize... Synchroniser... Synchronizing... Synchronisation en cours... -System out of memory! -Plus de mémoire disponible dans le système ! Target directory already existing! Le répertoire de destination existe déjà ! Target file already existing! @@ -850,8 +858,6 @@ Time remaining: Temps restant : Total amount of data that will be transferred Volume de données à transférer -Total required free disk space: -Espace disque nécessaire : Total time: Durée totale : Transfer file and directory permissions\n(Requires Administrator rights) @@ -872,14 +878,14 @@ Use Recycle Bin Utiliser la Corbeille Use Recycle Bin when deleting or overwriting files Utiliser la Corbeille lors de la suppression ou du remplacement d'un fichier -User-defined directory -Répertoire défini par l'utilisateur User-defined directory for deletion was not specified! Le répertoire défini par l'utilisateur pour la suppression n'a pas été indiqué ! Variant Variante Verifying file %x Contrôle du fichier %x +Versioning +Choisir un dossier Volume name %x not part of filename %y! Le nom de volume %x ne fait pas partie du nom de fichier %y ! Waiting for missing directories... @@ -888,14 +894,12 @@ Waiting while directory is locked (%x)... En attente tant que le répertoire est verrouillé (%x)... Warning Attention -Warning: Synchronization failed for %x item(s): -Attention : La synchronisation a échoué pour %x élément(s) : When the comparison is started with this option set the following decision tree is processed: Lorsque la comparaison démarre avec cette option, l'arbre de décision suivant est exécuté : You can ignore conflicts and continue synchronization. Vous pouvez ignorer ces conflits et continuer la synchronisation. -You can ignore the error to consider not existing directories as empty. -Vous pouvez ignorer l'erreur considérant qu'un dossier inexistant est vide. +You can ignore this error to consider the directory as empty. +Vous pouvez ignorer cette erreur en considérant le répertoire comme vide. You may try to synchronize remaining items again (WITHOUT having to re-compare)! Vous pouvez essayer de synchroniser à nouveau les éléments restants (SANS avoir à les comparer à nouveau) ! different diff --git a/BUILD/Languages/german.lng b/BUILD/Languages/german.lng index 7fbeb87c..6620c893 100644 --- a/BUILD/Languages/german.lng +++ b/BUILD/Languages/german.lng @@ -154,6 +154,8 @@ Konfiguration &laden... <Symlink> <multiple selection> <Mehrfachauswahl> +A directory input field is empty. +Ein Verzeichniseingabefeld ist leer. A directory will be modified which is part of multiple folder pairs! Please review synchronization settings! Es wird ein Verzeichnis verändert werden, das Teil mehrerer Verzeichnispaare ist! Bitte die Synchronisationseinstellungen prüfen! A newer version of FreeFileSync is available: @@ -372,6 +374,8 @@ Encoding extended time information: %x Speichere erweiterte Zeitinformation: %x Endless loop when traversing directory: Endlosschleife beim Lesen des Verzeichnisses: +Equal files/folders that differ in attributes only +Gleiche Dateien/Verzeichnisse mit unterschiedlichen Attributen Error Fehler Error changing modification time: @@ -478,8 +482,6 @@ Files that exist on both sides, right one is newer Auf beiden Seiten existierende Dateien; rechte Datei ist neuer Files that have different content Dateien mit verschiedenem Inhalt -Files/folders that differ in attributes only -Dateien/Verzeichnisse mit unterschiedlichen Attributen Files/folders that exist on left side only Nur links exisitierende Dateien/Verzeichnisse Files/folders that exist on right side only @@ -490,8 +492,6 @@ Filter is active Filter ist aktiv Filter settings have changed! Die Filtereinstellungen wurden geändert! -Filter view -Ansicht filtern Filter: All pairs Filter: Alle Verzeichnispaare Filter: Single pair @@ -508,6 +508,8 @@ Follow Folgen Free disk space available: Verfügbarer freier Speicherplatz: +Free disk space required: +Benötigter freier Speicherplatz: FreeFileSync Batch Job FreeFileSync Batch-Job FreeFileSync at Sourceforge @@ -602,6 +604,8 @@ Integrate external applications into context menu. The following macros are avai Integriert externe Anwendungen in das Kontextmenu. Die folgenden Makros stehen zur Verfügung: Invalid FreeFileSync config file! Ungültige FreeFileSync Konfigurationsdatei! +Last used configurations (press DEL to remove from list) +Zuletzt benutzte Konfigurationen (DEL-Taste löscht Einträge) Leave as unresolved conflict Als unbehandelten Konflikt belassen Left @@ -610,8 +614,6 @@ Legend Legende Load configuration from file Konfiguration aus Datei laden -Load configuration history (press DEL to delete items) -Lade Konfigurationshistorie (DEL-Taste löscht Einträge) Log-messages: Meldungen: Logging @@ -622,12 +624,16 @@ Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit v Das Erstellen von Schattenkopien unter WOW64 wird nicht unterstützt. Bitte benutzen Sie die FreeFileSync 64-Bit Version. Match case Groß-/Kleinschreibung +Maximum number of logfiles: +Maximale Anzahl an Logdateien: +Memory allocation failed! +Speicherallokation fehlgeschlagen! Minimum Idle Time [seconds] Minimale Ruhezeit [Sekunden] Mirror ->> Spiegeln ->> -Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronization. -Spiegelkopie des linken Verzeichnisses erstellen: Das rechte Verzeichnis wird dabei überschrieben und nach der Synchronisation dem linken exakt entsprechen. +Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization. +Spiegelkopie des linken Verzeichnisses erstellen. Das rechte Verzeichnis wird dem linken exakt angeglichen. Monitoring active... Ãœberwachung aktiv... More than 50% of the total number of files will be copied or deleted! @@ -698,8 +704,6 @@ Published under the GNU General Public License: Veröffentlicht unter der GNU General Public License: Question Frage -Re-enable all hidden dialogs? -Alle versteckten Dialoge wieder anzeigen? RealtimeSync - Automated Synchronization RealtimeSync - Automatisierte Synchronisation RealtimeSync configuration @@ -720,6 +724,8 @@ Reset Zurücksetzen Reset view Ansicht zurücksetzen +Restore all hidden dialogs? +Alle versteckten Dialoge wieder anzeigen? Right Rechts S&ave configuration... @@ -742,6 +748,8 @@ Select logfile directory: Verzeichnis für Logdatei wählen: Select variant: Variante auswählen: +Select view +Ansicht auswählen Set direction: Setze Richtung: Setting default synchronization directions: Old files will be overwritten with newer files. @@ -830,8 +838,6 @@ Synchronize... Synchronisieren Synchronizing... Synchronisiere... -System out of memory! -Zu wenig freier Arbeitsspeicher! Target directory already existing! Zielverzeichnis existiert bereits! Target file already existing! @@ -852,8 +858,6 @@ Time remaining: Verbleibende Zeit: Total amount of data that will be transferred Gesamtmenge der zu übertragenden Daten -Total required free disk space: -Insgesamt benötigter freier Speicherplatz: Total time: Gesamtzeit: Transfer file and directory permissions\n(Requires Administrator rights) @@ -874,14 +878,14 @@ Use Recycle Bin Papierkorb verwenden Use Recycle Bin when deleting or overwriting files Papierkorb für zu löschende oder zu überschreibende Dateien nutzen -User-defined directory -Benutzerdefiniertes Verzeichnis User-defined directory for deletion was not specified! Kein benutzerdefiniertes Verzeichnis zum Löschen angegeben! Variant Variante Verifying file %x Verifiziere Datei %x +Versioning +Versionierung Volume name %x not part of filename %y! Laufwerksname %x ist kein Teil des Dateinamens %y! Waiting for missing directories... @@ -890,14 +894,12 @@ Waiting while directory is locked (%x)... Warte während Verzeichnis gesperrt ist (%x)... Warning Warnung -Warning: Synchronization failed for %x item(s): -Warnung: Synchronisation fehlgeschlagen für %x Element(e): When the comparison is started with this option set the following decision tree is processed: Wenn der Vergleich mit dieser Option gestartet wurde, wird folgender Entscheidungsbaum abgearbeitet: You can ignore conflicts and continue synchronization. Die Konflikte können ignoriert und die Synchronisation fortgesetzt werden. -You can ignore the error to consider not existing directories as empty. -Dieser Fehler kann ignoriert werden, um nicht existierende Verzeichnisse als leer anzusehen. +You can ignore this error to consider the directory as empty. +Dieser Fehler kann ignoriert werden, um das Verzeichnis als leer anzusehen. You may try to synchronize remaining items again (WITHOUT having to re-compare)! Verbliebene Elemente können nochmals synchronisiert werden (OHNE dass ein erneuter Vergleich notwendig ist)! different diff --git a/BUILD/Languages/greek.lng b/BUILD/Languages/greek.lng index b3584f1f..70483147 100644 --- a/BUILD/Languages/greek.lng +++ b/BUILD/Languages/greek.lng @@ -13,17 +13,17 @@ %x TB %x TB %x day(s) -%x ημÎÏα/ημÎÏες +%x ημÎÏα/ες %x directories %x υποκατάλογοι %x files %x αÏχεία %x hour(s) -%x ÏŽÏα/ÏŽÏες +%x ÏŽÏα/ες %x kB %x kB %x min -%x λεπτό/λεπτά +%x λεπτό/ά %x of %y rows in view %x από τις %y φανεÏÎÏ‚ γÏαμμÎÏ‚ %x of 1 row in view @@ -154,6 +154,10 @@ <Συμβολικός δεσμός> <multiple selection> <πολλαπλή επιλογή> +A directory input field is empty. +Ένα πεδίο εισόδου είναι κενό. +A directory will be modified which is part of multiple folder pairs! Please review synchronization settings! +Θα Ï„Ïοποποιηθεί Îνας υποκατάλογος που ανήκει σε πολλαπλά ζεÏγη υποκαταλόγων! ΠαÏακαλώ αναθεωÏείστε τις Ïυθμίσεις συγχÏονισμοÏ. A newer version of FreeFileSync is available: Μια νεότεÏη Îκδοση του FreeFileSync είναι διαθÎσιμη: Abort requested: Waiting for current operation to finish... @@ -370,6 +374,8 @@ Encoding extended time information: %x Κωδικοποίηση εκτεταμÎνων πληÏοφοÏιών για την ÏŽÏα: %x Endless loop when traversing directory: ΑτÎÏμονος βÏόχος κατά την την ανάλυση του υποκαταλόγου: +Equal files/folders that differ in attributes only +Ίδια αÏχεία/υποκατάλογοι που διαφÎÏουν μόνο στα χαÏακτηÏιστικά αÏχείου Error Σφάλμα Error changing modification time: @@ -476,8 +482,6 @@ Files that exist on both sides, right one is newer ΑÏχεία που υπάÏχουν και στις δυο πλευÏÎÏ‚, δεξιά είναι πιο Ï€Ïόσφατα Files that have different content ΑÏχεία που Îχουν διαφοÏετικό πεÏιεχόμενο -Files/folders that differ in attributes only -ΑÏχεία/υποκατάλογοι που διαφÎÏουν μόνο στα χαÏακτηÏιστικά αÏχείου Files/folders that exist on left side only ΑÏχεία/υποκατάλογοι που υπάÏχουν μόνο στα αÏιστεÏά Files/folders that exist on right side only @@ -488,8 +492,6 @@ Filter is active Το φίλτÏο είναι ενεÏγό Filter settings have changed! Οι Ïυθμίσεις φίλτÏου Îχουν αλλάξει! -Filter view -Επιλογή εμφάνισης Filter: All pairs ΦίλτÏο: Όλα τα ζεÏγη Filter: Single pair @@ -505,7 +507,9 @@ Folder pairs Follow Ως πεÏιεχόμενο Free disk space available: -Espace disque disponible : +ΔιαθÎσιμος ελεÏθεÏος χώÏος δίσκου: +Free disk space required: +ΑπαιτοÏμενος ελεÏθεÏος χώÏος δίσκου: FreeFileSync Batch Job FreeFileSync ΔÎσμη ΕνεÏγειών FreeFileSync at Sourceforge @@ -600,6 +604,8 @@ Integrate external applications into context menu. The following macros are avai Ένταξη εξωτεÏικών εφαÏμογών στο Î¼ÎµÎ½Î¿Ï Ï€ÎµÏιβάλλοντος. Οι ακόλουθες μακÏοεντολÎÏ‚ είναι διαθÎσιμες: Invalid FreeFileSync config file! Μη ÎγκυÏο αÏχείο διάταξης του FreeFileSync! +Last used configurations (press DEL to remove from list) +Διατάξεις που χÏησιμοποιήθηκαν τελευταία (πατήστε DEL για διαγÏαφή από τη λίστα) Leave as unresolved conflict ΠαÏάβλεψη ως ανεπίλυτη διÎνεξη Left @@ -608,8 +614,6 @@ Legend Εξήγηση των συμβόλων για κάθε κατηγοÏία Load configuration from file Άνοιγμα διάταξης από αÏχείο -Load configuration history (press DEL to delete items) -Άνοιγμα του ιστοÏÎ¹ÎºÎ¿Ï Ï„Ï‰Î½ διατάξεων (πατήστε DEL για να σβήσετε καταχωÏήσεις) Log-messages: ΑποθηκευμÎνα μηνÏματα: Logging @@ -620,12 +624,16 @@ Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit v Δεν είναι δυνατή η δημιουÏγία σκιώδους αντίγÏαφου σε WOW64. ΧÏησιμοποιείστε την 64-bit Îκδοση του FreeFileSync. Match case Αντιστοίχιση πεζών-κεφαλαίων +Maximum number of logfiles: +ÎœÎγιστος αÏιθμός αÏχείων καταγÏαφής: +Memory allocation failed! +Η δÎσμευση χώÏου μνήμης απÎτυχε! Minimum Idle Time [seconds] Ελάχιστος ΧÏόνος Αναμονής [δευτεÏόλεπτα] Mirror ->> ΚατοπτÏισμός ->> -Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronization. -ΚατοπτÏικό αντίγÏαφο του αÏιστεÏÎ¿Ï Ï…Ï€Î¿ÎºÎ±Ï„Î±Î»ÏŒÎ³Î¿Ï…: Ο υποκατάλογος δεξιά θα αντικατασταθεί και θα αντιστοιχεί εξολοκλήÏου στον αÏιστεÏÏŒ μετά το συγχÏονισμό. +Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization. +ΚατοπτÏικό αντίγÏαφο του αÏιστεÏÎ¿Ï Ï…Ï€Î¿ÎºÎ±Ï„Î±Î»ÏŒÎ³Î¿Ï…. Ο υποκατάλογος δεξιά θα Ï„Ïοποποιηθεί και θα αντιστοιχεί εξολοκλήÏου στον αÏιστεÏÏŒ μετά το συγχÏονισμό Monitoring active... ΕνεÏγή παÏακολοÏθηση... More than 50% of the total number of files will be copied or deleted! @@ -696,8 +704,6 @@ Published under the GNU General Public License: ΔιανÎμεται υπό την Γενική Άδεια Δημόσιας ΧÏήσης GNU: Question ΕÏώτηση -Re-enable all hidden dialogs? -Επανεμφάνιση όλων των κÏυμμÎνων παÏαθÏÏων διαλόγου; RealtimeSync - Automated Synchronization RealtimeSync - ΑυτοματοποιημÎνος ΣυγχÏονισμός RealtimeSync configuration @@ -718,6 +724,8 @@ Reset Επανεμφάνιση Reset view ΕπαναφοÏά αÏχικής εμφάνισης +Restore all hidden dialogs? +Επανεμφάνιση των κÏυμμÎνων παÏαθÏÏων διαλόγου; Right Δεξιά S&ave configuration... @@ -740,6 +748,8 @@ Select logfile directory: ΕπιλÎξτε Îναν κατάλογο για το αÏχείο καταγÏαφής: Select variant: ΕπιλÎξτε μια μÎθοδο: +Select view +Επιλογή εμφάνισης Set direction: Επιλογή κατεÏθυνσης: Setting default synchronization directions: Old files will be overwritten with newer files. @@ -828,8 +838,6 @@ Synchronize... ΣυγχÏονισμός... Synchronizing... Γίνεται συγχÏονισμός... -System out of memory! -ΑνεπαÏκής μνήμη συστήματος! Target directory already existing! Ο υποκατάλογος Ï€ÏοοÏÎ¹ÏƒÎ¼Î¿Ï Ï…Ï€Î¬Ïχει ήδη! Target file already existing! @@ -845,13 +853,11 @@ This variant evaluates two equally named files as being equal when they have the Time ÎÏα Time elapsed: -ΧÏόνος που Ï€ÎÏασε: +Î ÎÏασε χÏόνος: Time remaining: -ΧÏόνος που απομÎνει: +ΑπομÎνει χÏόνος: Total amount of data that will be transferred Συνολικός όγκος δεδομÎνων που θα μεταφεÏθοÏν -Total required free disk space: -Συνολικός απαιτοÏμενος χώÏος στο δίσκο: Total time: Συνολική διάÏκεια: Transfer file and directory permissions\n(Requires Administrator rights) @@ -872,14 +878,14 @@ Use Recycle Bin ΧÏήση του Κάδου ΑνακÏκλωσης Use Recycle Bin when deleting or overwriting files ΧÏήση του Κάδου ΑνακÏκλωσης κατά τη διαγÏαφή ή αντικατάσταση αÏχείων -User-defined directory -Υποκατάλογος που οÏίζεται από το χÏήστη User-defined directory for deletion was not specified! Δεν οÏίστηκε από τον χÏήστη υποκατάλογος για τα αÏχεία Ï€Ïος διαγÏαφή! Variant ÎœÎθοδος Verifying file %x ΕπικÏÏωση του αÏχείου %x +Versioning +ΔιατήÏηση παλιών εκδόσεων Volume name %x not part of filename %y! Το όνομα τόμου %x δεν είναι μÎÏος του ονόματος του αÏχείου %y! Waiting for missing directories... @@ -888,14 +894,12 @@ Waiting while directory is locked (%x)... Αναμονή μÎχÏι να κλειδωθεί ο υποκατάλογος (%x)... Warning Î Ïοσοχή -Warning: Synchronization failed for %x item(s): -Î Ïοσοχή: Ο συγχÏονισμός απÎτυχε σε %x στοιχείο/στοιχεία: When the comparison is started with this option set the following decision tree is processed: Εάν γίνει σÏγκÏιση με αυτήν την επιλογή, ακολουθείται το παÏακάτω δÎνδÏο απόφασης: You can ignore conflicts and continue synchronization. ΜποÏείτε να αγνοήσετε τις διενÎξεις και να συνεχίσετε το συγχÏονισμό. -You can ignore the error to consider not existing directories as empty. -ΜποÏείτε να αγνοήσετε το σφάλμα, θεωÏώντας ότι ο υποκατάλογος που δεν υπάÏχει είναι κενός. +You can ignore this error to consider the directory as empty. +ΜποÏείτε να αγνοήσετε αυτό το σφάλμα και να θεωÏήσετε τον υποκατάλογο κενό. You may try to synchronize remaining items again (WITHOUT having to re-compare)! ΜποÏείτε να Ï€Ïοσπαθήσετε να συγχÏονίσετε τα υπόλοιπα στοιχεία (ΧΩΡΙΣ να χÏειάζεται να τα ξανασυγκÏίνετε)! different diff --git a/BUILD/Languages/hebrew.lng b/BUILD/Languages/hebrew.lng index 43916285..89f23af4 100644 --- a/BUILD/Languages/hebrew.lng +++ b/BUILD/Languages/hebrew.lng @@ -154,6 +154,10 @@ <multiple selection> <בחירה מרובה> +A directory input field is empty. + +A directory will be modified which is part of multiple folder pairs! Please review synchronization settings! + A newer version of FreeFileSync is available: יותר קיימת ×’×¨×¡× ×—×“×©×”: Abort requested: Waiting for current operation to finish... @@ -370,6 +374,8 @@ Encoding extended time information: %x Endless loop when traversing directory: × ×•×¦×¨×ª לול××” ××™× ×¡×•×¤×™×ª בחצית מחיצות +Equal files/folders that differ in attributes only + Error טעות Error changing modification time: @@ -476,8 +482,6 @@ Files that exist on both sides, right one is newer ×§×‘×¦×™× ×”× ×ž×¦××™× ×‘×©× ×™ ×”×¦×“×“×™× -×”×™×ž× ×™ חדש יותר Files that have different content ×§×‘×¦×™× ×‘×¢×œ×™ תוכן ×©×•× ×” -Files/folders that differ in attributes only - Files/folders that exist on left side only ×§×‘×¦×™× ×•×ª×™×§×™×•×ª ×”× ×ž×¦××™× ×‘×¢×ž×•×“×” השמ×לית בלבד Files/folders that exist on right side only @@ -488,8 +492,6 @@ Filter is active ×ž×¡× ×Ÿ פעיל Filter settings have changed! קביעת ×”×ž×¡× ×Ÿ ×©×•× ×•! -Filter view -תצוגה ×ž×¡×•× × ×ª Filter: All pairs כל הזוגות :×ž×¡×•× ×Ÿ Filter: Single pair @@ -506,6 +508,8 @@ Follow Free disk space available: ×ž×§×•× ×¤× ×•×™ בדיסק: +Free disk space required: + FreeFileSync Batch Job FreeFileSync עבודת ×צווה FreeFileSync at Sourceforge @@ -600,6 +604,8 @@ Integrate external applications into context menu. The following macros are avai :הטמע ×ª×•×›× ×•×ª ×—×™×¦×•× ×™×•×ª לתפריט המקרו הב××™× ×ž×•×›× ×™× Invalid FreeFileSync config file! +Last used configurations (press DEL to remove from list) + Leave as unresolved conflict הש×ר ×›×§×•× ×¤×œ×™×§×˜ ×œ× ×ž×˜×•×¤×œ Left @@ -608,8 +614,6 @@ Legend ×ž×§×¨× Load configuration from file טען ×§×•× ×¤×™×’×•×¨×¦×™×” מקובץ -Load configuration history (press DEL to delete items) -טען היסטורית ×§×•× ×¤×™×’×•×¨×¦×™×•×ª לחץ DEL Log-messages: הודעת יומן: Logging @@ -620,12 +624,16 @@ Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit v ×œ× × ×ª×ž×›×ª בגרסה ×–×ת ×× × ×”×ª×§×Ÿ גרסה 64 WOW64 העתקת צל ב Match case ×ותיות הת×× +Maximum number of logfiles: + +Memory allocation failed! + Minimum Idle Time [seconds] Mirror ->> מר××” ->> -Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronization. -גיבוי מר××” של העמודה השמ×לית העמודה ×”×™×ž× ×™×ª תדרס ותהיה העתק מדויק של העמודה השמ×לית ל×חר ×¡× ×›×¨×•×Ÿ +Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization. + Monitoring active... × ×˜×¨ ×רכיב... More than 50% of the total number of files will be copied or deleted! @@ -696,8 +704,6 @@ Published under the GNU General Public License: GNU ×ž×¤×•×¨×¡× ×‘×ž×¡×’×¨×ª: Question ש×לה -Re-enable all hidden dialogs? -הפעל מחדש די××œ×•×’×™× × ×¡×ª×¨×™×? RealtimeSync - Automated Synchronization RealtimeSync - ×¡×™× ×›×¨×•×Ÿ ×וטומטי RealtimeSync configuration @@ -718,6 +724,8 @@ Reset ×פס Reset view +Restore all hidden dialogs? + Right ימין S&ave configuration... @@ -740,6 +748,8 @@ Select logfile directory: בחר מחיצה לתיקית-יומן Select variant: בחר ×ž×©×ª× ×”: +Select view + Set direction: בחר כוון: Setting default synchronization directions: Old files will be overwritten with newer files. @@ -828,8 +838,6 @@ Synchronize... ...×¡× ×›×¨×Ÿ Synchronizing... ×ž×¡× ×›×¨×Ÿ... -System out of memory! -מחסור בזכרון מערכת! Target directory already existing! מחיצת מטרה כבר קיימת! Target file already existing! @@ -850,8 +858,6 @@ Time remaining: זמן × ×•×ª×¨: Total amount of data that will be transferred סך הכל × ×ª×•× ×™× ×œ×”×¢×‘×¨×” -Total required free disk space: -זכרון ×¤× ×•×™ כללי × ×“×¨×© Total time: זמן מקומי: Transfer file and directory permissions\n(Requires Administrator rights) @@ -872,14 +878,14 @@ Use Recycle Bin השתמש בסל המיחזור Use Recycle Bin when deleting or overwriting files השתמש בסל המיחזור ×›×שר מוחק ×ו דורס ×§×‘×¦×™× -User-defined directory -מחיצה מות×מת ×ישית User-defined directory for deletion was not specified! מחיצה מות×מת ×ישית למחיקה ×œ× ×ž×•×’×“×¨×ª! Variant ×ž×©×ª× ×” Verifying file %x מ×מת קובץ %x +Versioning + Volume name %x not part of filename %y! ×›× ×•× ×Ÿ %x ×œ× ×‘× ×ª×™×‘ של קובץ %y! Waiting for missing directories... @@ -888,14 +894,12 @@ Waiting while directory is locked (%x)... Warning ×זהרה -Warning: Synchronization failed for %x item(s): -×¢×¦×ž×™× %x ×זהרה ×¡× ×›×¨×•×Ÿ × ×›×©×œ לגבי When the comparison is started with this option set the following decision tree is processed: :×›×שר ההשוו××” מתחילה בעזרת הבחירות ×”× ×‘×—×¨×•×ª ×¢×¥ ההחלטות ×”×‘× ×ž×ª×‘×¦×¢ You can ignore conflicts and continue synchronization. ב×פשרותך ×œ×”×ª×¢×œ× ×ž×”×§×•× ×¤×œ×™×§×˜×™× ×•×œ×”×ž×©×™×š ×‘×¡× ×›×¨×•×Ÿ -You can ignore the error to consider not existing directories as empty. -!ב×פשרותך ×œ×”×ª×¢×œ× ×ž×”×©×’×™××” ולהחשיב ×ת המחיצות החסרות כריקות +You can ignore this error to consider the directory as empty. + You may try to synchronize remaining items again (WITHOUT having to re-compare)! !ב×פשרותך ×œ× ×¡×•×ª ×œ×¡× ×›×¨×Ÿ ×ת ×”×¢×¦×ž×™× ×”× ×•×ª×¨×™× ×ž×‘×œ×™ להשוות מחדש different diff --git a/BUILD/Languages/hungarian.lng b/BUILD/Languages/hungarian.lng index c19b94d9..545d3b29 100644 --- a/BUILD/Languages/hungarian.lng +++ b/BUILD/Languages/hungarian.lng @@ -3,7 +3,7 @@ %x / %y objects deleted successfully %X / %Y objektum sikeresen törölve %x Bytes - +%x bájt %x GB %x GB %x MB @@ -154,6 +154,10 @@ <Symlink> <multiple selection> <többszörös kijelölés> +A directory input field is empty. +Valamelyik mappa megadására szolgáló mezÅ‘ üres. +A directory will be modified which is part of multiple folder pairs! Please review synchronization settings! +Egy olyan mappa kerül módosÃtásra, amely tagja több mappa párosnak! Kérjük, nézd át a szinkronizációs beállÃtásokat! A newer version of FreeFileSync is available: ElérhetÅ‘ a FreeFileSync egy újabb verziója: Abort requested: Waiting for current operation to finish... @@ -257,9 +261,9 @@ Folytatás Conversion error: Konverziós hiba: Copy attributes only from left to right - +Attribútumok másolása kizárólag balról jobbra Copy attributes only from right to left - +Attribútumok másolása kizárólag jobbról balra Copy filesystem permissions Fájlrendszer jogosultságok másolása Copy from left to right @@ -370,6 +374,8 @@ Encoding extended time information: %x KibÅ‘vÃtett idÅ‘információk kódolása: %x Endless loop when traversing directory: Végtelen hurok a mappák bejárásakor: +Equal files/folders that differ in attributes only +Egyforma fájlok/mappák, melyek csak attribútumaikban különböznek Error Hiba Error changing modification time: @@ -476,8 +482,6 @@ Files that exist on both sides, right one is newer Mindkét oldalon létezÅ‘ fájlok, de a jobb oldali újabb Files that have different content Fájlok, amelyeknek különbözÅ‘ a tartalmuk: -Files/folders that differ in attributes only - Files/folders that exist on left side only Csak a bal oldalon létezÅ‘ fájlok/mappák Files/folders that exist on right side only @@ -488,8 +492,6 @@ Filter is active A szűrÅ‘ aktÃv Filter settings have changed! A szűrÅ‘beállÃtások megváltoztak! -Filter view -SzűrÅ‘ nézet Filter: All pairs SzűrÅ‘: Minden pár Filter: Single pair @@ -501,11 +503,13 @@ Mit keresünk: Folder Comparison and Synchronization Mappa összehasonlÃtás és szinkronizáció Folder pairs - +Mappa párok Follow Követés Free disk space available: Szabad lemezterület: +Free disk space required: +Szükséges szabad lemezterület: FreeFileSync Batch Job FreeFileSync kötegelt feladat FreeFileSync at Sourceforge @@ -600,6 +604,8 @@ Integrate external applications into context menu. The following macros are avai KülsÅ‘ alkalmazás integrálása a helyi menübe. Az elérhetÅ‘ makrók a következÅ‘k: Invalid FreeFileSync config file! Érvénytelen a FreeFileSync beállÃtásait tartalmazó fájl! +Last used configurations (press DEL to remove from list) +Utoljára használt beállÃtások (DEL billentyűvel törölhetÅ‘ a listából) Leave as unresolved conflict Feloldatlan ütközésként hagyni Left @@ -608,24 +614,26 @@ Legend ElÅ‘zmény Load configuration from file BeállÃtások betöltése fájlból -Load configuration history (press DEL to delete items) -BeállÃtások elÅ‘zményeinek a betöltése (Nyomja meg a DEL gombot a törléshez) Log-messages: Naplóbejegyzések: Logging Naplózás Main bar - +FÅ‘ panel Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit version. A Shadow Copy a WOW64-en nem támogatott. Kérjük, használja a 64-bites FreeFileSync-et. Match case Kis-/nagybetű egyezés +Maximum number of logfiles: +Naplófájlok maximális száma: +Memory allocation failed! +Sikertelen memóriafoglalás! Minimum Idle Time [seconds] - +Minimális tétlenségi idÅ‘ (másodpercek) Mirror ->> Tükrözés ->> -Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronization. -A bal oldali mappa tükrözött másolata: A jobb oldali mappa felülÃródik és pontosan megegyezik majd a bal oldalival a szinkronizálás után. +Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization. +A bal oldali mappa tükrözött másolata. A jobb oldali mappa úgy lesz megváltoztatva, hogy a szinkronizáció után pontosan megegyezzen a bal oldalival. Monitoring active... Figyelés aktÃv... More than 50% of the total number of files will be copied or deleted! @@ -696,8 +704,6 @@ Published under the GNU General Public License: Kiadva a GNU General Public License alatt: Question Kérdés -Re-enable all hidden dialogs? -Engedélyezzük újra az összes rejtett párbeszédablakot? RealtimeSync - Automated Synchronization RealtimeSync - Automatikus szinkronizálás RealtimeSync configuration @@ -717,7 +723,9 @@ FordÃtói hiba bejelentése Reset HelyreállÃtás Reset view - +Nézet visszaállÃtása +Restore all hidden dialogs? +Az összes rejtett párbeszédablakot visszaállÃtsuk? Right Jobb oldal S&ave configuration... @@ -740,12 +748,14 @@ Select logfile directory: Naplófájl mappájának kiválasztása: Select variant: Változat kiválasztása: +Select view +Nézet kiválasztása Set direction: Irány Setting default synchronization directions: Old files will be overwritten with newer files. Alapértelmezett szinkronizációs irányok beállÃtása: a régebbi fájlok felülÃródnak az újabbakkal. Show \"%x\" - +\"%x\" mutatása Show conflicts Ãœtközések mutatása Show files that are different @@ -828,8 +838,6 @@ Synchronize... Szinkronizálás Synchronizing... Szinkronizálás folyamatban... -System out of memory! -Nincs elég rendszermemória! Target directory already existing! A célmappa már létezik! Target file already existing! @@ -850,8 +858,6 @@ Time remaining: HátralévÅ‘ idÅ‘: Total amount of data that will be transferred A mozgatandó adatok összmérete -Total required free disk space: -Összes igényelt szabad lemezterület: Total time: Becsült idÅ‘: Transfer file and directory permissions\n(Requires Administrator rights) @@ -865,37 +871,35 @@ Feloldatlan ütközések vannak! Update -> FrissÃtés -> Updating attributes of %x - +A(z) %x attribútumainak frissÃtése Usage: Használat: Use Recycle Bin Lomtár (Recycle Bin) használata Use Recycle Bin when deleting or overwriting files A Lomtár (Recycle Bin) használata fájlok törlésénél vagy felülÃrásánál -User-defined directory -Felhasználó által megadott mappa User-defined directory for deletion was not specified! A törléshez nem lett mappa megadva a felhasználó által! Variant Variáns Verifying file %x %x fájl ellenÅ‘rzése +Versioning +Verziókövetés Volume name %x not part of filename %y! A(z) %x kötetnevet nem tartalmazza a(z) %y fájlnév! Waiting for missing directories... - +Várakozás a hiányzó mappákra... Waiting while directory is locked (%x)... Várakozás a mappa zárolásának a feloldására (%x)... Warning Figyelem -Warning: Synchronization failed for %x item(s): -Figyelem: A következÅ‘ %x elem szinkronizálása sikertelen: When the comparison is started with this option set the following decision tree is processed: Ha az összehasonlÃtás ezekkel a beállÃtásokkal lesz elindÃtva, akkor a következÅ‘ döntési fa érvényesül: You can ignore conflicts and continue synchronization. Figyelmen kÃvül hagyhatod az ütközéseket és folytathatod a szinkronizálást. -You can ignore the error to consider not existing directories as empty. -Figyelmen kÃvül hagyhatja a hibákat a nem létezÅ‘ mappákat üresnek tekintve. +You can ignore this error to consider the directory as empty. +Figyelmen kÃvül hagyhatod ezt a hibát, üresnek tekintve a mappát. You may try to synchronize remaining items again (WITHOUT having to re-compare)! Meg lehet próbálni újra a megmaradt elemek szinkronizálását (az összehasonlÃtás újbóli elvégzése NÉLKÃœL)! different diff --git a/BUILD/Languages/italian.lng b/BUILD/Languages/italian.lng index 6f48299f..4c465335 100644 --- a/BUILD/Languages/italian.lng +++ b/BUILD/Languages/italian.lng @@ -3,7 +3,7 @@ %x / %y objects deleted successfully %x / %y oggetti cancellati con successo %x Bytes - +%x Bytes %x GB %x GB %x MB @@ -154,6 +154,10 @@ <Symlink> <multiple selection> <selezione multipla> +A directory input field is empty. +Un campo directory di input è vuoto. +A directory will be modified which is part of multiple folder pairs! Please review synchronization settings! +Una directory che fa parte di più coppie di cartelle sarà modificata! Ricontrolla le impostazioni di sincronizzazione! A newer version of FreeFileSync is available: E' disponibile una nuova versione di FreeFileSync: Abort requested: Waiting for current operation to finish... @@ -257,9 +261,9 @@ Continua Conversion error: Errore di conversione: Copy attributes only from left to right - +Copia attributi solo da sinistra a destra Copy attributes only from right to left - +Copia attributi solo da destra a sinistra Copy filesystem permissions Copia permessi del filesystem Copy from left to right @@ -370,6 +374,8 @@ Encoding extended time information: %x Codifica estesa informazioni orario: %x Endless loop when traversing directory: Loop senza fine attraverso le directory: +Equal files/folders that differ in attributes only +Considera uguali file/cartelle che differiscono solo per gli attributi Error Errore Error changing modification time: @@ -476,8 +482,6 @@ Files that exist on both sides, right one is newer Files esistenti su entrambi i lati, più recenti a destra Files that have different content Files con contenuto differente -Files/folders that differ in attributes only - Files/folders that exist on left side only Files/cartelle esistenti solo a sinistra Files/folders that exist on right side only @@ -488,8 +492,6 @@ Filter is active Il filtro e' attivo Filter settings have changed! Le impostazioni del filtro sono cambiate! -Filter view -Filtro della vista Filter: All pairs Filtro: Tutte le coppie Filter: Single pair @@ -501,11 +503,13 @@ Trova cosa: Folder Comparison and Synchronization Comparazione di Cartelle e Sincronizzazione Folder pairs - +Coppia di cartelle Follow Segui Free disk space available: Spazio libero su disco disponibile: +Free disk space required: +Spazio libero su disco richiesto: FreeFileSync Batch Job FreeFileSync Batch Job FreeFileSync at Sourceforge @@ -600,6 +604,8 @@ Integrate external applications into context menu. The following macros are avai Integra applicazioni esterne nel menu contestuale. Sono disponibili le seguenti macro: Invalid FreeFileSync config file! File di configurazione FreeFileSync non valido! +Last used configurations (press DEL to remove from list) +Ultima configurazione utilizzata (premi DEL per rimuovere dalla lista) Leave as unresolved conflict Lascia come conflitti irrisolti Left @@ -608,24 +614,26 @@ Legend Legenda Load configuration from file Carica configurazione da file -Load configuration history (press DEL to delete items) -Carica la cronologia delle configurazioni (premi DEL per eliminare elementi) Log-messages: Log-messages: Logging Logging Main bar - +Barra principale Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit version. La creazione di copie shadow su WOW64 non e' supportata. Utilizzare FreeFileSync in versione 64-bit. Match case Corrispondenza +Maximum number of logfiles: +Numero massimo di logfiles: +Memory allocation failed! +Allocazione di memoria fallita! Minimum Idle Time [seconds] - +Tempo minimo di attesa [seconds] Mirror ->> Mirror ->> -Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronization. -Mirror backup della cartella di sinistra: La cartella di destra sarà sovrascritta e resa identica alla cartella di sinistra dopo la sincronizzazione. +Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization. +Mirror backup della cartella di sinistra. La cartella destra verrà modificata per corrispondere esattamente alla cartella di sinistra dopo la sincronizzazione. Monitoring active... Monitoraggio attivo... More than 50% of the total number of files will be copied or deleted! @@ -696,8 +704,6 @@ Published under the GNU General Public License: Pubblicato sotto licenza GNU General Public: Question Domanda -Re-enable all hidden dialogs? -Ripristinare tutti i messaggi nascosti? RealtimeSync - Automated Synchronization RealtimeSync - Sincronizzazione Automatizzata RealtimeSync configuration @@ -717,7 +723,9 @@ Segnala errori di traduzione Reset Reset Reset view - +Resetta vista +Restore all hidden dialogs? +Ripristinare tutti i dialoghi nascosti? Right Destra S&ave configuration... @@ -740,12 +748,14 @@ Select logfile directory: Seleziona cartella per il file di log: Select variant: Selezionare una variante: +Select view +Seleziona vista Set direction: Imposta direzione: Setting default synchronization directions: Old files will be overwritten with newer files. Imposta direzioni di sincronizzazione di default: I vecchi file saranno sovrascritti dai nuovi. Show \"%x\" - +Mostra \"%x\" Show conflicts Mostra conflitti Show files that are different @@ -828,8 +838,6 @@ Synchronize... Sincronizza... Synchronizing... Sincronizzazione in corso... -System out of memory! -Memoria di sistema esaurita! Target directory already existing! Directory di destinazione già esistente! Target file already existing! @@ -850,8 +858,6 @@ Time remaining: Tempo rimanente: Total amount of data that will be transferred Volume dei dati che verranno trasferiti -Total required free disk space: -Spazio libero su disco richiesto: Total time: Tempo totale: Transfer file and directory permissions\n(Requires Administrator rights) @@ -865,37 +871,35 @@ Sono presenti conflitti irrisolti! Update -> Aggiorna -> Updating attributes of %x - +Aggiornamento attributi di %x Usage: Uso: Use Recycle Bin Usa il Cestino Use Recycle Bin when deleting or overwriting files Usa il Cestino quando si cancella o sovrascrive un file -User-defined directory -Directory personalizzata User-defined directory for deletion was not specified! Directory personalizzata per la cancellazione non specificata! Variant Variante Verifying file %x Verifica di file %x +Versioning +Versioning Volume name %x not part of filename %y! Il nome volume %x non è parte del nome file %y! Waiting for missing directories... - +In attesa delle directory mancanti... Waiting while directory is locked (%x)... Attendi mentre la directory è bloccata (%x)... Warning Attenzione -Warning: Synchronization failed for %x item(s): -Attenzione: Sincronizzazione fallita per %x elementi: When the comparison is started with this option set the following decision tree is processed: Quando questo set di opzioni viene selezionato per la comparazione viene processato il seguente albero di decisioni: You can ignore conflicts and continue synchronization. Puoi ignorare i conflitti e continuare la sincronizzazione. -You can ignore the error to consider not existing directories as empty. -Puoi ignorare l'errore per considerare directory inesistenti come vuote. +You can ignore this error to consider the directory as empty. +Puoi ignorare questo errore per considerare la directory come vuota. You may try to synchronize remaining items again (WITHOUT having to re-compare)! Puoi provare a sincronizzare di nuovo gli elementi restanti (SENZA doverli ri-comparare) ! different diff --git a/BUILD/Languages/japanese.lng b/BUILD/Languages/japanese.lng index ed6a4653..eb020dc6 100644 --- a/BUILD/Languages/japanese.lng +++ b/BUILD/Languages/japanese.lng @@ -154,6 +154,10 @@ <シンボリックリンク> <multiple selection> <複数é¸æŠž> +A directory input field is empty. +ディレクトリãŒå…¥åŠ›ã•ã‚Œã¦ã„ã¾ã›ã‚“ +A directory will be modified which is part of multiple folder pairs! Please review synchronization settings! +複数ペアã®ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªè¨å®šéƒ¨åˆ†ã«å¤‰æ›´ã•ã‚ŒãŸç®‡æ‰€ãŒã‚ã‚Šã¾ã™! åŒæœŸè¨å®šã‚’å†ç¢ºèªã—ã¦ã¿ã¦ãã ã•ã„! A newer version of FreeFileSync is available: FreeFileSync ã®æ–°ã—ã„ãƒãƒ¼ã‚¸ãƒ§ãƒ³ãŒåˆ©ç”¨å¯èƒ½ã§ã™: Abort requested: Waiting for current operation to finish... @@ -370,6 +374,8 @@ Encoding extended time information: %x æ‹¡å¼µã•ã‚ŒãŸæ™‚é–“æƒ…å ±ã®ã‚¨ãƒ³ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°: %x Endless loop when traversing directory: ディレクトリ移動ä¸ã«ç„¡é™ãƒ«ãƒ¼ãƒ—ãŒç™ºç”Ÿ: +Equal files/folders that differ in attributes only +åŒæ§˜ã®ãƒ•ã‚¡ã‚¤ãƒ«/フォルダã§ã€å±žæ€§ã®ã¿ç•°ãªã‚‹ Error エラー Error changing modification time: @@ -476,8 +482,6 @@ Files that exist on both sides, right one is newer 両å´ã«å˜åœ¨ã™ã‚‹ãŒã€å³å´ã®æ–¹ãŒã‚ˆã‚Šæ–°ã—ã„ Files that have different content 内容ãŒç•°ãªã‚‹ãƒ•ã‚¡ã‚¤ãƒ« -Files/folders that differ in attributes only -属性ã®ã¿ç•°ãªã‚‹ãƒ•ã‚¡ã‚¤ãƒ«/フォルダ Files/folders that exist on left side only å·¦å´ã®ã¿ã«å˜åœ¨ã™ã‚‹ãƒ•ã‚¡ã‚¤ãƒ«/フォルダ Files/folders that exist on right side only @@ -488,8 +492,6 @@ Filter is active フィルターを有効化 Filter settings have changed! フィルターè¨å®šã¯å¤‰æ›´ã•ã‚Œã¦ã„ã¾ã™! -Filter view -表示フィルター Filter: All pairs フィルター:ã™ã¹ã¦ã®ãƒšã‚¢ Filter: Single pair @@ -506,6 +508,8 @@ Follow フォãƒãƒ¼ Free disk space available: 利用å¯èƒ½ãªãƒ‡ã‚£ã‚¹ã‚¯ç©ºã容é‡: +Free disk space required: +å¿…è¦ãªãƒ‡ã‚£ã‚¹ã‚¯ç©ºã容é‡: FreeFileSync Batch Job FreeFileSync 一括ジョブ FreeFileSync at Sourceforge @@ -600,6 +604,8 @@ Integrate external applications into context menu. The following macros are avai 外部ã®ã‚¢ãƒ—リケーションをコンテã‚ストメニューã«çµ±åˆã€ä»¥ä¸‹ã®ãƒžã‚¯ãƒãŒåˆ©ç”¨ã§ãã¾ã™: Invalid FreeFileSync config file! 無効㪠FreeFileSync 構æˆãƒ•ã‚¡ã‚¤ãƒ«ã§ã™! +Last used configurations (press DEL to remove from list) +å‰å›žä½¿ç”¨ã—ãŸæ§‹æˆè¨å®š(DEL ã‚ーã§ãƒªã‚¹ãƒˆã‹ã‚‰é™¤åŽ»ã—ã¾ã™) Leave as unresolved conflict 未解決ã®ç«¶åˆã¯ãã®ã¾ã¾æ®‹ã™ Left @@ -608,8 +614,6 @@ Legend 凡例 Load configuration from file 外部ファイルã‹ã‚‰æ§‹æˆè¨å®šã‚’èªã¿è¾¼ã¿ã¾ã™ -Load configuration history (press DEL to delete items) -構æˆè¨å®šå±¥æ´ã®èªã¿è¾¼ã¿(DELã‚ーã§ã‚¢ã‚¤ãƒ†ãƒ を削除) Log-messages: ãƒã‚°ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸: Logging @@ -620,12 +624,16 @@ Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit v WOW64 ã§ã¯ã€ãƒœãƒªãƒ¥ãƒ¼ãƒ シャドウコピーã«å¯¾å¿œã—ã¦ã„ã¾ã›ã‚“ã€FreeFileSync 64-bit 版をãŠè©¦ã—ãã ã•ã„。 Match case æ–‡å—種を区別 +Maximum number of logfiles: +ãƒã‚°ãƒ•ã‚¡ã‚¤ãƒ«ã®æœ€å¤§æ•°: +Memory allocation failed! +メモリ割り当ã¦ã«å¤±æ•—! Minimum Idle Time [seconds] 最å°å¾…機時間[秒] Mirror ->> ミラー >> -Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronization. -å·¦å´ãƒ•ã‚©ãƒ«ãƒ€ã‚’ミラーリングãƒãƒƒã‚¯ã‚¢ãƒƒãƒ—: åŒæœŸå®Œäº†å¾Œã¯ã€å·¦å´ãƒ•ã‚©ãƒ«ãƒ€ã«åˆã‚ã›ã¦å³å´ãƒ•ã‚©ãƒ«ãƒ€ã¯ä¸Šæ›¸ãã•ã‚Œã¾ã™ã€‚ +Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization. +å·¦å´ã«åˆã‚ã›ã¦ãƒãƒƒã‚¯ã‚¢ãƒƒãƒ—. å³å´ã®ãƒ•ã‚©ãƒ«ãƒ€å†…容ãŒåŒæœŸå‡¦ç†å¾Œã«å·¦å´ã¨åŒã˜ã«ãªã‚‹ã‚ˆã†ã«ã—ã¾ã™ã€‚ Monitoring active... 監視を開始ã—ã¾ã™... More than 50% of the total number of files will be copied or deleted! @@ -696,8 +704,6 @@ Published under the GNU General Public License: Published under the GNU General Public License: Question è³ªå• -Re-enable all hidden dialogs? -ã™ã¹ã¦ã®éžè¡¨ç¤ºãƒ€ã‚¤ã‚¢ãƒã‚°ã‚’有効ã«ã—ã¾ã™ã‹? RealtimeSync - Automated Synchronization リアルタイムåŒæœŸ - 自動åŒæœŸ RealtimeSync configuration @@ -718,6 +724,8 @@ Reset リセット Reset view 表示リセット +Restore all hidden dialogs? +éžè¡¨ç¤ºãƒ€ã‚¤ã‚¢ãƒã‚°ã‚’ã™ã¹ã¦æˆ»ã—ã¾ã™ã‹? Right å³å´ S&ave configuration... @@ -740,6 +748,8 @@ Select logfile directory: ãƒã‚°ãƒ•ã‚¡ã‚¤ãƒ«ã®ä¿å˜å…ˆã‚’é¸æŠž: Select variant: 変数をé¸æŠž: +Select view +表示é¸æŠž Set direction: æ–¹å‘ã®è¨å®š: Setting default synchronization directions: Old files will be overwritten with newer files. @@ -828,8 +838,6 @@ Synchronize... åŒæœŸå‡¦ç†... Synchronizing... åŒæœŸå‡¦ç†ä¸... -System out of memory! -メモリãŒä¸è¶³ã—ã¦ã„ã¾ã™! Target directory already existing! 対象ディレクトリã¯ã™ã§ã«å˜åœ¨ã—ã¾ã™! Target file already existing! @@ -850,8 +858,6 @@ Time remaining: 残り時間: Total amount of data that will be transferred 転é€ã•ã‚ŒãŸãƒ‡ãƒ¼ã‚¿ã®ç·é‡ -Total required free disk space: -å¿…è¦ãªåˆè¨ˆãƒ‡ã‚£ã‚¹ã‚¯ç©ºã容é‡: Total time: åˆè¨ˆæ™‚é–“: Transfer file and directory permissions\n(Requires Administrator rights) @@ -872,14 +878,14 @@ Use Recycle Bin ゴミ箱を使用 Use Recycle Bin when deleting or overwriting files ファイルã®å‰Šé™¤ã€ä¸Šæ›¸ã時ã«ã‚´ãƒŸç®±ã‚’使用ã™ã‚‹ -User-defined directory -ユーã§å®šç¾©ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒª User-defined directory for deletion was not specified! ユーザ定義ディレクトリãŒæŒ‡å®šã•ã‚Œã¦ã„ã¾ã›ã‚“! Variant 変化 Verifying file %x ファイル %x ã®æ¤œè¨¼ä¸ +Versioning +ãƒãƒ¼ã‚¸ãƒ§ãƒ³ä»˜ã‘ Volume name %x not part of filename %y! ボリュームå %x ã«ãƒ•ã‚¡ã‚¤ãƒ«å %y ã¯ã‚ã‚Šã¾ã›ã‚“! Waiting for missing directories... @@ -888,14 +894,12 @@ Waiting while directory is locked (%x)... 待機時間ä¸ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã¯ãƒãƒƒã‚¯ã•ã‚Œã¾ã™(%x)... Warning è¦å‘Š -Warning: Synchronization failed for %x item(s): -è¦å‘Š: %x アイテムã®åŒæœŸã«å¤±æ•—ã—ã¾ã—ãŸ: When the comparison is started with this option set the following decision tree is processed: ã“ã®ã‚ªãƒ—ションã§æ¯”較を開始ã—ãŸå ´åˆã¯ã€ä»¥ä¸‹ã®ãƒ„リーã«å¾“ã£ã¦å‡¦ç†ãŒè¡Œã‚ã‚Œã¾ã™: You can ignore conflicts and continue synchronization. ã“ã®ä¸ä¸€è‡´ã‚’無視ã—ã¦åŒæœŸã‚’続行ã™ã‚‹ã“ã¨ãŒå‡ºæ¥ã¾ã™ã€‚ -You can ignore the error to consider not existing directories as empty. -æ—¢å˜ã®ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªãŒç©ºã§ã¯ãªã„ã¨ã„ã†ã‚¨ãƒ©ãƒ¼ã¯ç„¡è¦–ã§ãã¾ã™ã€‚ +You can ignore this error to consider the directory as empty. +ディレクトリãŒç©ºã¨è€ƒæ…®ã™ã‚‹å ´åˆã€ã“ã®ã‚¨ãƒ©ãƒ¼ã¯ç„¡è¦–ã§ãã¾ã™ã€‚ You may try to synchronize remaining items again (WITHOUT having to re-compare)! 残ã£ã¦ã„るファイルã¯ã€å†ã³åŒæœŸã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ (å†æ¯”較ã¨ã¯åˆ¥ã®å‹•ä½œ)! different diff --git a/BUILD/Languages/korean.lng b/BUILD/Languages/korean.lng new file mode 100644 index 00000000..6de32f72 --- /dev/null +++ b/BUILD/Languages/korean.lng @@ -0,0 +1,912 @@ + MinGW \t- Windows port of GNU Compiler Collection\n wxWidgets \t- Open-Source GUI framework\n wxFormBuilder\t- wxWidgets GUI-builder\n CodeBlocks \t- Open-Source IDE + MinGW \t- Windows port of GNU Compiler Collection\n wxWidgets \t- Open-Source GUI framework\n wxFormBuilder\t- wxWidgets GUI-builder\n CodeBlocks \t- Open-Source IDE +%x / %y objects deleted successfully +%x / %y ê°œì˜ ê°œì²´ ì‚ì œ 성공 +%x Bytes +%x ë°”ì´íŠ¸ +%x GB +%x GB +%x MB +%x MB +%x PB +%x PB +%x TB +%x TB +%x day(s) +%x ì¼ +%x directories +%x ë””ë ‰í† ë¦¬ +%x files +%x íŒŒì¼ +%x hour(s) +%x 시간 +%x kB +%x kB +%x min +%x 분 +%x of %y rows in view +%x / %y í–‰ 표시 +%x of 1 row in view +%x / 1 í–‰ 표시 +%x sec +%x ì´ˆ +%x% +%x% +&Abort +ìž‘ì—… 중지(&A) +&About... +ìƒì„¸ ì •ë³´(&A) +&Advanced +ê³ ê¸‰ 옵션(&A) +&Cancel +취소(&C) +&Check for new version +ë²„ì „ ì—…ë°ì´íŠ¸ 확ì¸(&C) +&Content +ë„ì›€ë§ ë‚´ìš© +&Create batch job... +ì¼ê´„ìž‘ì—…[Batch Job] ìƒì„±(&C) +&Default +기본 ì„¤ì •/ê°’(&D) +&Exit +나가기(&E) +&Export file list... +íŒŒì¼ ë¦¬ìŠ¤íŠ¸ 내보내기(&E) +&File +파ì¼(&F) +&Find next +ë‹¤ìŒ ê²€ìƒ‰(&F) +&Global settings... +ì „ì²´ ì„¤ì •(&G) +&Help +ë„움ë§(&H) +&Ignore +무시(&I) +&Language +언어 ì„ íƒ(&L) +&Load +로드(&L) +&Load configuration... +ì„¤ì • 로드 +&New +ì‹ ê·œ ìž‘ì—… +&No +아니오(&N) +&OK +&OK +&Pause +ì¼ì‹œì •ì§€(&P) +&Program +프로그램(&P) +&Quit +종료 +&Restore +ë³µì›(&R) +&Retry +다시 ì‹œë„(&R) +&Save +ì €ìž¥(&S) +&Switch +ì „í™˜[Switch](&S) +&Yes +예(&Y) +(Build: %x) +(빌드: %x) +(Requires an Internet connection!) +(ì¸í„°ë„· ì—°ê²°ì´ í•„ìš”í•©ë‹ˆë‹¤!) +- Other side's counterpart to %dir +- %dir ì˜ ë°˜ëŒ€ì¸¡ ëŒ€ìƒ +- Other side's counterpart to %name +- %name ì˜ ë°˜ëŒ€ì¸¡ ëŒ€ìƒ +- conflict +- 충ëŒ/불ì¼ì¹˜ +- conflict (same date, different size) +- 충ëŒ/불ì¼ì¹˜ (ë‚ ì§œëŠ” 같으나, í¬ê¸°ê°€ 다름) +- different +- 다름 +- directory part only +- ë””ë ‰í† ë¦¬ 부분만 +- equal +- ê°™ìŒ +- exists left only +- 좌측ì—만 존재함 +- exists right only +- 우측ì—만 존재함 +- full file or directory name +- ì „ì²´ íŒŒì¼ ë˜ëŠ” ë””ë ‰í† ë¦¬ ì´ë¦„ +- left +- 좌측 +- left newer +- ì¢Œì¸¡ì´ ë” ìµœì‹ +- right +- 우측 +- right newer +- ìš°ì¸¡ì´ ë” ìµœì‹ +/sec +/ì´ˆ +1 directory +1 ë””ë ‰í† ë¦¬ +1 file +1 íŒŒì¼ +1. &Compare +1. ë¹„êµ +1. Enter relative file or directory names separated by ';' or a new line. +1. ê´€ë ¨ 파ì¼ì´ë‚˜ ë””ë ‰í† ë¦¬ ì´ë¦„ì„ ';'ë¡œ 구분하거나, ì¤„ì„ ë°”ê¿” ìž…ë ¥í•˜ì„¸ìš”. +1. Select directories to monitor. +1. 모니터 í• ë””ë ‰í† ë¦¬ë¥¼ ì„ íƒí•˜ì„¸ìš”. +2. &Synchronize... +2. ë™ê¸°í™” +2. Enter a command line. +2. ëª…ë ¹ 줄(커맨드ë¼ì¸)ì„ ìž…ë ¥í•˜ì„¸ìš”. +2. Use wildcard characters '*' and '?'. +2. 와ì¼ë“œì¹´ë“œ ë¬¸ìž '*' ë° '?' ì„ ì‚¬ìš©í•©ë‹ˆë‹¤. +3. Exclude files directly on main grid via context menu. +3. 컨í…스트 메뉴ì—ì„œ ì§ì ‘ 파ì¼ì„ ì œì™¸í•©ë‹ˆë‹¤. +3. Press 'Start'. +3. '시작'ì„ ëˆ„ë¥´ì„¸ìš”. +<Automatic> +<ìžë™> +<Directory> +<ë””ë ‰í† ë¦¬> +<Last session> +<마지막 세션> +<Symlink> +<심 ë§í¬> +<multiple selection> +<복수 ì„ íƒ> +A directory input field is empty. +ë””ë ‰í† ë¦¬ ìž…ë ¥ 필드가 비어 있습니다. +A directory will be modified which is part of multiple folder pairs! Please review synchronization settings! +다중 í´ë” íŽ˜ì–´ì˜ ì¼ë¶€ì¸ ë””ë ‰í† ë¦¬ê°€ 변경 ë©ë‹ˆë‹¤. ë™ê¸°í™” ì„¤ì •ì„ ìž¬ê²€í† í•´ 주세요. +A newer version of FreeFileSync is available: +새로운 ë²„ì „ì˜ FreeFileSyncê°€ 나왔습니다. +Abort requested: Waiting for current operation to finish... +사용ìžì— ì˜í•œ ìž‘ì—… 중지 : 현재 ìž‘ì—… 종료 대기 중... +Abort synchronization immediately +ë™ê¸°í™” ìž‘ì—… 즉시 중단 +Aborted +ì¤‘ì§€ë¨ +About +ìƒì„¸ì •ë³´ +Action +실행 +Add folder +í´ë” 추가 +Add folder pair +í’€ë” íŽ˜ì–´(ì§) 추가 +All directories in sync! +ëª¨ë“ ë””ë ‰í† ë¦¬ ë™ê¸°í™”! +An exception occurred! +예외 ë°œìƒ! +As a result the files are separated into the following categories: +파ì¼ì€ 다ìŒê³¼ ê°™ì€ ì¹´í…Œê³ ë¦¬ë¡œ 분류ë©ë‹ˆë‹¤ : +As the name suggests, two files which share the same name are marked as equal if and only if they have the same content. This option is useful for consistency checks rather than backup operations. Therefore the file times are not taken into account at all.\n\nWith this option enabled the decision tree is smaller: +ì´ ì˜µì…˜ì—서는 2ê°œì˜ íŒŒì¼ì´ ê°™ì€ ì´ë¦„ì„ ê°–ëŠ” 경우, ë‚´ìš©ë„ ì •í™•ížˆ ë™ì¼í• ì‹œì—만 ê°™ì€ íŒŒì¼ë¡œ 간주합니다. 백업 작업보다는 파ì¼ë“¤ì˜ ì¼ê´€ì„± ì²´í¬ì— ë” ìœ ìš©í•œ 옵션으로ì¨, íŒŒì¼ ë‚ ì§œ ë° ì‹œê°„ì€ ì „í˜€ ê³ ë ¤ë˜ì§€ 않습니다. \n\në˜í•œ í™œì„±í™”ëœ ì˜ì‚¬ê²°ì • íŠ¸ë¦¬ë„ ë‹¤ìŒê³¼ ê°™ì´ ì¢€ ë” ìž‘ì•„ì§‘ë‹ˆë‹¤ : +Assemble a batch file for automated synchronization. To start in batch mode simply pass the name of the file to the FreeFileSync executable: FreeFileSync.exe <batchfile>. This can also be scheduled in your operating system's task planner. +ìžë™ ë™ê¸°í™” ì¼ê´„ìž‘ì—…ì„ ìœ„í•´ Batch Fileì„ ìƒì„±í•©ë‹ˆë‹¤. ì¼ê´„ 모드를 시작하기 ìœ„í•´ì„ , 실행 가능한 FreeFileSync í˜•ì‹ : FreeFileSync.exe <batchfile>ë¡œ íŒŒì¼ ì´ë¦„ì„ ì§€ì •í•´ 주기만 하면 ë©ë‹ˆë‹¤. ì´ ìž‘ì—…ì€ O/S(ìš´ì˜ì²´ì œ)ì˜ ìž‘ì—…ê´€ë¦¬ìžì—ì„œë„ ì‹¤í–‰ 가능합니다. +At least one directory input field is empty. +최소 1ê°œì˜ ë””ë ‰í† ë¦¬ ìž…ë ¥ ì˜ì—ì´ ë¹„ì—ˆìŠµë‹ˆë‹¤. +Auto-adjust columns +ì—´ ìžë™ì •ë ¬ +Batch execution +ì¼ê´„ìž‘ì—… 실행 +Batch file created successfully! +ì¼ê´„ìž‘ì—… íŒŒì¼ [Batch File] ìƒì„± 성공! +Batch job +ì¼ê´„처리 ìž‘ì—… +Big thanks for localizing FreeFileSync goes out to: +FreeFileSync 현지화 ìž‘ì—… í˜‘ì¡°ì— ê¹Šì€ ê°ì‚¬ 드립니다 : +Both sides have changed since last synchronization! +마지막 ë™ê¸°í™” ìž‘ì—… ì´í›„, 양측 ëª¨ë‘ ë³€ê²½ ë˜ì—ˆìŠµë‹ˆë‹¤! +Browse +브ë¼ìš°ì¦ˆ +Browse directory +ë””ë ‰í† ë¦¬ 브ë¼ìš°ì¦ˆ +Cannot determine sync-direction: +ë™ê¸°í™” ë°©í–¥ì„ ê²°ì •í• ìˆ˜ 없습니다 : +Cannot find %x +%x ì„(를) ì°¾ì„ ìˆ˜ 없습니다. +Cannot write to empty directory path! + +Category +ì¹´í…Œê³ ë¦¬ +Clear filter settings +í•„í„° ì„¤ì • 지우기 +Comma separated list +콤마 분리 ëª©ë¡ +Command line +ëª…ë ¹ 줄 (커맨드ë¼ì¸) +Command line is empty! +ëª…ë ¹ 줄 (커맨드ë¼ì¸)ì´ ë¹„ì–´ 있습니다! +Compare +비 êµ +Compare both sides +양측 ë¹„êµ +Compare by \"File content\" +\"íŒŒì¼ ë‚´ìš©\" 별 ë¹„êµ +Compare by \"File size and date\" +\"íŒŒì¼ í¬ê¸° ë° ë‚ ì§œ\" 별 ë¹„êµ +Compare by... +ëŒ€ìƒ ë³„ 비êµ... +Comparing content of files %x +íŒŒì¼ %x ë‚´ìš© 별 ë¹„êµ ì¤‘ +Comparing content... +ë‚´ìš© ë¹„êµ ì¤‘... +Comparing files by content failed. +ë‚´ìš© 별 íŒŒì¼ ë¹„êµ ì‹¤íŒ¨ +Comparison Result +ë¹„êµ ê²°ê³¼ +Comparison settings +ë¹„êµ ì„¤ì • +Completed +완료 +Configuration +구성 ì„¤ì • +Configuration loaded! +ì„¤ì • 로드 완료! +Configuration overview: +êµ¬ì„±ì„¤ì • 개요 : +Configuration saved! +ì„¤ì • ì €ìž¥ 완료! +Configure filter +ì„¤ì • í•„í„° +Configure your own synchronization rules. +ê°œì¸ ë™ê¸°í™” 규칙 ì„¤ì • +Confirm +í™•ì¸ +Conflict detected: +íƒì§€ëœ 충ëŒ/불ì¼ì¹˜ : +Conflicts/files that cannot be categorized +ë¶„ë¥˜í• ìˆ˜ 없는 충ëŒ/íŒŒì¼ +Continue +ê³„ì† +Conversion error: +변환 오류 : +Copy attributes only from left to right +ì†ì„±ë§Œ 좌측ì—ì„œ 우측으로 복사 +Copy attributes only from right to left +ì†ì„±ë§Œ 우측ì—ì„œ 좌측으로 복사 +Copy filesystem permissions +íŒŒì¼ ì‹œìŠ¤í…œ 권한 복사 +Copy from left to right +좌측ì—ì„œ 우측으로 복사 +Copy from left to right overwriting +좌측ì—ì„œ 우측으로 ë®ì–´ì“°ê¸° 복사 +Copy from right to left +우측ì—ì„œ 좌측으로 복사 +Copy from right to left overwriting +우측ì—ì„œ 좌측으로 ë®ì–´ì“°ê¸° 복사 +Copy locked files +ë½ ê±¸ë¦° íŒŒì¼ ë³µì‚¬ +Copy new or updated files to right folder. +ì‹ ê·œ ë˜ëŠ” ê°±ì‹ íŒŒì¼ì„ 우측 í´ë”ë¡œ 복사 +Copy shared or locked files using Volume Shadow Copy Service\n(Requires Administrator rights) +Volume Shadow Copy를 사용하여 ê³µìœ ë˜ëŠ” ë½ ê±¸ë¦° 파ì¼ì„ 복사\n(ê´€ë¦¬ìž ê¶Œí•œ í•„ìš”) +Copy to clipboard\tCTRL+C +í´ë¦½ë³´ë“œì— 복사\tCTRL+C +Copying new Symbolic Link %x to %y +ì‹ ê·œ ì‹¬ë³¼ë¦ ë§í¬ %x ì„(를) %y (으)ë¡œ 복사 중 +Copying new file %x to %y +ì‹ ê·œ íŒŒì¼ %x ì„(를) %y (으)ë¡œ 복사 중 +Could not determine volume name for file: +íŒŒì¼ ë³¼ë¥¨ ì´ë¦„ì„ ê²°ì •í• ìˆ˜ 없습니다 : +Could not initialize directory monitoring: +ë””ë ‰í† ë¦¬ 모니터ë§ì„ 초기화 í• ìˆ˜ 없습니다 : +Could not load a required DLL: +필요한 DLLì„ ë¡œë“œí• ìˆ˜ 없습니다 : +Could not read values for the following XML nodes: +ë‹¤ìŒ XML 노드 ê°’ì„ ì½ì–´ ë“¤ì¼ ìˆ˜ 없습니다 : +Create a batch job +ì¼ê´„ìž‘ì—…[Batch Job] ìƒì„± +Creating folder %x +í´ë” %x ìƒì„± 중 +Custom +ê°œì¸ ì„¤ì • +Customize columns +ê°œì¸ ì„¤ì • - ì—´ ì¡°ì • +Customize... +ê°œì¸ ì„¤ì •í™”... +D-Click +D-í´ë¦ +DECISION TREE +[ì˜ì‚¬ê²°ì • 트리] +Data verification error: Source and target file have different content! +ë°ì´í„° í™•ì¸ ì˜¤ë¥˜ : 소스 ë° íƒ€ê²Ÿ 파ì¼ì˜ ë‚´ìš©ì´ ë‹¤ë¦…ë‹ˆë‹¤! +Date +ë‚ ì§œ +Delete files/folders existing on left side only +좌측ì—만 존재하는 파ì¼/í´ë” ì‚ì œ +Delete files/folders existing on right side only +우측ì—만 존재하는 파ì¼/í´ë” ì‚ì œ +Delete files\tDEL +íŒŒì¼ ì‚ì œ\tDEL +Delete on both sides +양측 ëª¨ë‘ ì‚ì œ +Delete on both sides even if the file is selected on one side only +ì–´ëŠ í•œìª½ì˜ íŒŒì¼ë§Œ ì„ íƒí•˜ë”ë¼ë„ 양측 ëª¨ë‘ ì‚ì œ +Delete or overwrite files permanently +íŒŒì¼ ì˜êµ¬ ì‚ì œ ë˜ëŠ” ë®ì–´ì“°ê¸° +Delete permanently +ì˜êµ¬ ì‚ì œ +Deleting Symbolic Link %x +ì‹¬ë³¼ë¦ ë§í¬ %x ì‚ì œ 중 +Deleting file %x +íŒŒì¼ %x ì‚ì œ 중 +Deleting folder %x +í´ë” %x ì‚ì œ 중 +Deletion handling +ì‚ì œ 처리 중 +Description +설명 +Direct +다ì´ë ‰íŠ¸ +Directories are dependent! Be careful when setting up synchronization rules: +ë””ë ‰í† ë¦¬ê°€ ì˜ì¡´ ê´€ê³„ì— ìžˆìŠµë‹ˆë‹¤. ë™ê¸°í™” 규칙 ì„¤ì • ì‹œ, ì£¼ì˜ í•˜ì‹ì‹œì˜¤. +Directories to watch +ê°ì‹œ ëŒ€ìƒ ë””ë ‰í† ë¦¬ +Directory +ë””ë ‰í† ë¦¬ +Directory does not exist: +ë””ë ‰í† ë¦¬ê°€ 존재하지 않습니다 : +Do not show this dialog again +다ìŒë¶€í„° 표시하지 ì•ŠìŒ +Do nothing +아무 ê²ƒë„ í•˜ì§€ ì•ŠìŒ +Do you really want to delete the following object(s)? +ë‹¤ìŒ ê°œì²´ë¥¼ ì •ë§ë¡œ ì‚ì œí•˜ê¸¸ ì›í•˜ì‹ë‹ˆê¹Œ? +Do you really want to move the following object(s) to the Recycle Bin? +ë‹¤ìŒ ê°œì²´ë¥¼ ì •ë§ë¡œ 휴지통으로 ì´ë™í•˜ê¸¸ ì›í•˜ì‹ë‹ˆê¹Œ? +Do you want FreeFileSync to automatically check for updates every week? +FreeFileSyncê°€ 매주 ìžë™ìœ¼ë¡œ ì—…ë°ì´íŠ¸ë¥¼ 확ì¸í•˜ë„ë¡ í•˜ì‹œê² ìŠµë‹ˆê¹Œ? +Donate with PayPal +PayPalë¡œ 기부하기 +Download now? +지금 다운로드 í•˜ì‹œê² ìŠµë‹ˆê¹Œ? +Drag && drop +드래그 && ë“œëž +Elements found: +ë°œê²¬ëœ ìš”ì†Œ : +Elements processed: +ì²˜ë¦¬ëœ ìš”ì†Œ : +Elements remaining: +ë‚¨ì€ ìš”ì†Œ : +Email +ì´ë©”ì¼ +Encoding extended time information: %x +ì¸ì½”딩 확장 시간 ì •ë³´ : %x +Endless loop when traversing directory: +ë””ë ‰í† ë¦¬ ì´ë™ 중 무한 루프 ë°œìƒ : +Equal files/folders that differ in attributes only +ì†ì„±ë§Œ 다른 ë™ì¼ 파ì¼/í´ë” +Error +오류 +Error changing modification time: +시간 ìˆ˜ì • 중 ë°œìƒí•œ 오류 : +Error copying file permissions: +íŒŒì¼ ê¶Œí•œ 복사 중 ë°œìƒí•œ 오류 : +Error copying file: +íŒŒì¼ ë³µì‚¬ 중 ë°œìƒí•œ 오류 : +Error copying locked file %x! +복사 실패! íŒŒì¼ %x ì— ë½ì´ ê±¸ë ¤ 있습니다. +Error copying symbolic link: +ì‹¬ë³¼ë¦ ë§í¬ 복사 중 ë°œìƒí•œ 오류 : +Error creating directory: +ë””ë ‰í† ë¦¬ ìƒì„± 중 ë°œìƒí•œ 오류 : +Error deleting directory: +ë””ë ‰í† ë¦¬ ì‚ì œ 중 ë°œìƒí•œ 오류 : +Error deleting file: +íŒŒì¼ ì‚ì œ 중 ë°œìƒí•œ 오류 : +Error handling +처리 ê³¼ì • 중 ë°œìƒí•œ 오류 : +Error loading library function: +ë¼ì´ë¸ŒëŸ¬ë¦¬ 기능 로드 중 ë°œìƒí•œ 오류 : +Error moving directory: +ë””ë ‰í† ë¦¬ ì´ë™ 중 ë°œìƒí•œ 오류 : +Error moving file: +íŒŒì¼ ì´ë™ 중 ë°œìƒí•œ 오류 : +Error moving to Recycle Bin: +휴지통으로 ì´ë™ 중 ë°œìƒí•œ 오류 : +Error opening file: +파ì¼ì„ ì—´ë˜ ì¤‘ ë°œìƒí•œ 오류 : +Error parsing configuration file: +ì„¤ì •íŒŒì¼ ë¶„ì„ ì¤‘ ë°œìƒí•œ 오류 : +Error reading file attributes: +íŒŒì¼ ì†ì„±ì„ ì½ë˜ 중 ë°œìƒí•œ 오류 : +Error reading file: +파ì¼ì„ ì½ë˜ 중 ë°œìƒí•œ 오류 : +Error reading from synchronization database: +ë™ê¸°í™” ë°ì´í„°ë² ì´ìŠ¤ë¡œë¶€í„° ì½ì–´ 들ì´ë˜ 중 ë°œìƒí•œ 오류 : +Error reading security context: +보안 컨í…스트를 ì½ë˜ 중 ë°œìƒí•œ 오류 : +Error resolving symbolic link: +ì‹¬ë³¼ë¦ ë§í¬ë¥¼ í•´ê²°í•˜ë˜ ì¤‘ ë°œìƒí•œ 오류 : +Error setting directory lock: +ë””ë ‰í† ë¦¬ ë½ ì„¤ì • 중 ë°œìƒí•œ 오류 : +Error setting privilege: +특권(프리빌리지) ì„¤ì • 중 ë°œìƒí•œ 오류 : +Error starting Volume Shadow Copy Service! +Volume Shadow Copy Service 시작 중 오류 ë°œìƒ! +Error traversing directory: +ë””ë ‰í† ë¦¬ ì´ë™ 중 ë°œìƒí•œ 오류 : +Error when monitoring directories. +ë””ë ‰í† ë¦¬ ëª¨ë‹ˆí„°ë§ ì¤‘ ë°œìƒí•œ 오류 : +Error writing file: +파ì¼ì„ ì“°ë˜ ì¤‘ ë°œìƒí•œ 오류 : +Error writing security context: +보안 컨í…스트를 ì“°ë˜ ì¤‘ ë°œìƒí•œ 오류 : +Error writing to synchronization database: +ë™ê¸°í™” ë°ì´í„°ë² ì´ìŠ¤ì— ì“°ë˜ ì¤‘ ë°œìƒí•œ 오류 : +Example +보기/예 +Exclude +ì œì™¸ +Exclude all rows +ì „ì²´ í–‰(로우) ì œì™¸ +Exclude temporarily +ìž„ì‹œ ì œì™¸ +Exclude via filter: +필터를 통하여 ì œì™¸ +Exit instantly +즉시 종료 +Extension +í™•ìž¥ìž +External applications +외부 ì• í”Œë¦¬ì¼€ì´ì…˜ +Fatal Error +치명ì 오류 +Feedback and suggestions are welcome at: +피드백 ë° ì œì•ˆì‚¬í•ì€ 아래로 ë³´ë‚´ 주ì‹ì‹œì˜¤ : +File %x has an invalid date! +íŒŒì¼ %x ì˜ ë‚ ì§œê°€ ìœ íš¨í•˜ì§€ 않습니다! +File already exists. Overwrite? +파ì¼ì´ ì´ë¯¸ 존재합니다. ë®ì–´ ì“°ì‹œê² ìŠµë‹ˆê¹Œ? +File content +íŒŒì¼ ë‚´ìš© +File does not exist: +파ì¼ì´ 존재하지 않습니다 : +File list exported! +íŒŒì¼ ë¦¬ìŠ¤íŠ¸ 내보내기 완료! +File size and date +íŒŒì¼ í¬ê¸° ë° ë‚ ì§œ +Filename +íŒŒì¼ ì´ë¦„ +Files %x have the same date but a different size! +íŒŒì¼ %x ì˜ ë‚ ì§œëŠ” 같으나, í¬ê¸°ê°€ 다릅니다! +Files are found equal if\n - file content\nis the same +ë§Œì¼ \n - íŒŒì¼ ë‚´ìš©\n ì´ ê°™ì„ ê²½ìš°, ë™ì¼í•œ 파ì¼ë¡œ 간주 +Files are found equal if\n - filesize\n - last write time and date\nare the same +ë§Œì¼ \n - íŒŒì¼ í¬ê¸°\n - 최종 기입 시간 ë° ì¼ìž\n ì´ ê°™ì„ ê²½ìš°, ë™ì¼í•œ 파ì¼ë¡œ 간주 +Files that are equal on both sides +양측 ëª¨ë‘ ë™ì¼í•œ íŒŒì¼ +Files that exist on both sides, left one is newer +파ì¼ì´ 양측 ëª¨ë‘ ì¡´ìž¬í•˜ì§€ë§Œ, ì¢Œì¸¡ì´ ë” ì‹ ê·œì¸ íŒŒì¼. +Files that exist on both sides, right one is newer +파ì¼ì´ 양측 ëª¨ë‘ ì¡´ìž¬í•˜ì§€ë§Œ, ìš°ì¸¡ì´ ë” ì‹ ê·œì¸ íŒŒì¼. +Files that have different content +ë‚´ìš©ì´ ë‹¤ë¥¸ íŒŒì¼ +Files/folders that exist on left side only +좌측ì—만 존재하는 파ì¼/í´ë” +Files/folders that exist on right side only +우측ì—만 존재하는 파ì¼/í´ë” +Filter files +íŒŒì¼ í•„í„° +Filter is active +í•„í„° 활성화 ìƒíƒœ +Filter settings have changed! +í•„í„° ì„¤ì •ì´ ë³€ê²½ ë습니다! +Filter: All pairs +í•„í„° : ëª¨ë“ íŽ˜ì–´(ì§) +Filter: Single pair +í•„í„° : ë‹¨ì¼ íŽ˜ì–´(ì§) +Find +검색 +Find what: +검색어 : +Folder Comparison and Synchronization +í´ë” ë¹„êµ ë° ë™ê¸°í™” +Folder pairs +í´ë” 페어(ì§) +Follow +팔로우 +Free disk space available: +사용 가능한 ë””ìŠ¤í¬ ì—¬ìœ ê³µê°„ : +Free disk space required: +필요한 ë””ìŠ¤í¬ ì—¬ìœ ê³µê°„ : +FreeFileSync Batch Job +FreeFileSync ì¼ê´„ ìž‘ì—… [Batch Job] +FreeFileSync at Sourceforge +FreeFileSync at Sourceforge [오픈소스 보기] +FreeFileSync batch file +FreeFileSync 뱃치 íŒŒì¼ +FreeFileSync configuration +FreeFileSync 구성 ì„¤ì • +FreeFileSync is up to date! +FreeFileSync 는 현재 ìµœì‹ ë²„ì „ ìƒíƒœìž…니다! +Full path +ì „ì²´ 경로 +Generating database... +ë°ì´í„°ë² ì´ìŠ¤ ìƒì„± 중... +Generating file list... +íŒŒì¼ ë¦¬ìŠ¤íŠ¸ ìƒì„± 중... +Global settings +ì „ì²´ ì„¤ì • +Help +ë„ì›€ë§ +Hidden dialogs: +다ì´ì–¼ë¡œê·¸ 숨기기 +Hide all error and warning messages +ëª¨ë“ ì˜¤ë¥˜/ê²½ê³ ë©”ì„¸ì§€ 숨기기 +Hide conflicts +ì¶©ëŒ ë‚´ìš© 숨기기 +Hide excluded items +ì œì™¸ ì•„ì´í…œ 숨기기 +Hide files that are different +ë‚´ìš©ì´ ë‹¤ë¥¸ íŒŒì¼ ìˆ¨ê¸°ê¸° +Hide files that are equal +ë‚´ìš©ì´ ê°™ì€ íŒŒì¼ ìˆ¨ê¸°ê¸° +Hide files that are newer on left +ì¢Œì¸¡ì´ ë” ì‹ ê·œì¸ íŒŒì¼ ìˆ¨ê¸°ê¸° +Hide files that are newer on right +ìš°ì¸¡ì´ ë” ì‹ ê·œì¸ íŒŒì¼ ìˆ¨ê¸°ê¸° +Hide files that exist on left side only +좌측ì—만 존재하는 íŒŒì¼ ìˆ¨ê¸°ê¸° +Hide files that exist on right side only +우측ì—만 존재하는 íŒŒì¼ ìˆ¨ê¸°ê¸° +Hide files that will be created on the left side +ì¢Œì¸¡ì— ìƒì„±ë íŒŒì¼ ìˆ¨ê¸°ê¸° +Hide files that will be created on the right side +ìš°ì¸¡ì— ìƒì„±ë íŒŒì¼ ìˆ¨ê¸°ê¸° +Hide files that will be deleted on the left side +좌측ì—ì„œ ì‚ì œë íŒŒì¼ ìˆ¨ê¸°ê¸° +Hide files that will be deleted on the right side +우측ì—ì„œ ì‚ì œë íŒŒì¼ ìˆ¨ê¸°ê¸° +Hide files that will be overwritten on left side +ì¢Œì¸¡ì— ë®ì–´ì“°ì—¬ì§ˆ íŒŒì¼ ìˆ¨ê¸°ê¸° +Hide files that will be overwritten on right side +ìš°ì¸¡ì— ë®ì–´ì“°ì—¬ì§ˆ íŒŒì¼ ìˆ¨ê¸°ê¸° +Hide files that won't be copied +복사ë˜ì§€ ì•Šì„ íŒŒì¼ ìˆ¨ê¸°ê¸° +Hide filtered or temporarily excluded files +í•„í„°ë§ ë˜ê±°ë‚˜ ìž„ì‹œ ì œì™¸ë íŒŒì¼ ìˆ¨ê¸°ê¸° +Hide further error messages during the current process +현재 ì²˜ë¦¬ê³¼ì • ë™ì•ˆ 추가오류 메세지 숨기기 +Hints: +힌트 : +Homepage +홈페ì´ì§€ +Identify and propagate changes on both sides using a database. Deletions and conflicts are detected automatically. +ë°ì´í„°ë² ì´ìŠ¤ë¥¼ 사용하여, 양측 변경사í•ì„ 확ì¸í•©ë‹ˆë‹¤. ì‚ì œ ë° ì¶©ëŒ ë‚´ì—ì€ ìžë™ ê°ì§€ë©ë‹ˆë‹¤. +Idle time between detection of last change and execution of command line in seconds +마지막 변경내용 ê°ì§€ë¡œë¶€í„° ë‹¤ìŒ ì»¤ë©˜ë“œë¼ì¸ 실행까지 대기시간 (ì´ˆ) +If you like FFS +기부하기^^ +Ignore +무시 +Ignore errors +오류 무시 +Ignore subsequent errors +ì´í›„ 오류 무시 +Include +í¬í•¨ +Include all rows +ëª¨ë“ í–‰(로우) í¬í•¨ +Include temporarily +ìž„ì‹œ í¬í•¨ +Include: *.doc;*.zip;*.exe\nExclude: \\stuff\\temp\\* +í¬í•¨ : *.doc;*.zip;*.exe\nì œì™¸: \\stuff\\temp\\* +Incompatible synchronization database format: +호환ë˜ì§€ 않는 ë™ê¸°í™” ë°ì´í„°ë² ì´ìŠ¤ í˜•ì‹ : +Info +ì •ë³´ +Information +ì¸í¬ë©”ì´ì…˜ (ì •ë³´) +Initial synchronization: +초기 ë™ê¸°í™” : +Integrate external applications into context menu. The following macros are available: +외부 ì• í”Œë¦¬ì¼€ì´ì…˜ì„ Context Menuì— í†µí•©. ë‹¤ìŒ ë§¤í¬ë¡œê°€ 사용 가능합니다 : +Invalid FreeFileSync config file! +ìœ íš¨í•˜ì§€ ì•Šì€ FreeFileSync ì„¤ì • 파ì¼! +Last used configurations (press DEL to remove from list) +마지막으로 사용한 ì„¤ì • (DEL 키를 누르면 리스트ì—ì„œ ì‚ì œ) +Leave as unresolved conflict +í•´ê²°ë˜ì§€ ì•Šì€ ì¶©ëŒë¡œ 놔ë‘기 +Left +좌측 +Legend +범례 +Load configuration from file +외부 파ì¼ë¡œë¶€í„° ì„¤ì • 로드 +Log-messages: +로그 메세지 : +Logging +로그 +Main bar +ë©”ì¸ ë°” +Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit version. +WOW64 ì—ì„œì˜ Shadow Copy 는 지ì›í•˜ì§€ 않습니다. FreeFileSync 64-bit ë²„ì „ì„ ì‚¬ìš©í•˜ì„¸ìš”. +Match case +대문ìž/ì†Œë¬¸ìž êµ¬ë¶„ +Maximum number of logfiles: +최대 ë¡œê·¸íŒŒì¼ ê°œìˆ˜ : +Memory allocation failed! +메모리 í• ë‹¹ 실패! +Minimum Idle Time [seconds] +최소 대기시간 [ì´ˆ] +Mirror ->> +미러 ->> +Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization. +좌측 í´ë” 백업 미러. ë™ê¸°í™” ì´í›„ 우측 í´ë”는 좌측 í´ë”와 ì™„ì „ížˆ ë˜‘ê°™ì´ ë§¤ì¹˜ ë˜ë„ë¡ ë³€ê²½ ë©ë‹ˆë‹¤. +Monitoring active... +ëª¨ë‹ˆí„°ë§ í™œì„±í™”... +More than 50% of the total number of files will be copied or deleted! +ì´ íŒŒì¼ ê°œìˆ˜ì˜ 50% ì´ìƒì´ 복사ë˜ê±°ë‚˜ ì‚ì œ ë©ë‹ˆë‹¤! +Move column down +ì—´(컬럼) 아래로 ì´ë™ +Move column up +ì—´(컬럼) 위로 ì´ë™ +Move files into a time-stamped subdirectory +파ì¼ì„ 타임 스탬프 ëœ ì„œë¸Œ í´ë”ë¡œ ì´ë™ +Moving %x to Recycle Bin +%x ì„(를) 휴지통으로 ì´ë™ 중 +Moving Symbolic Link %x to user-defined directory %y +ì‹¬ë³¼ë¦ ë§í¬ %x ì„(를) ì‚¬ìš©ìž ì§€ì • ë””ë ‰í† ë¦¬ %y ë¡œ ì´ë™ 중 +Moving file %x to user-defined directory %y +íŒŒì¼ %x ì„(를) ì‚¬ìš©ìž ì§€ì • ë””ë ‰í† ë¦¬ %y ë¡œ ì´ë™ 중 +Moving folder %x to user-defined directory %y +í´ë” %x ì„(를) ì‚¬ìš©ìž ì§€ì • ë””ë ‰í† ë¦¬ %y ë¡œ ì´ë™ 중 +Multiple... +다중처리 (멀티플) ìž‘ì—…... +No change since last synchronization! +마지막 ë™ê¸°í™” ì´í›„ ë³€ê²½ì‚¬í• ì—†ìŒ! +No filter selected +ì„ íƒí•œ í•„í„°ê°€ ì—†ìŒ +Not enough free disk space available in: +사용 가능한 ë””ìŠ¤í¬ ì—¬ìœ ê³µê°„ì´ ë¶€ì¡±í•©ë‹ˆë‹¤ : +Nothing to synchronize according to configuration! +êµ¬ì„±ì„¤ì •ì— ë”°ë¼ ë™ê¸°í™” í• ë‚´ìš©ì´ ì—†ìŠµë‹ˆë‹¤! +Number of files and directories that will be created +ìƒì„±ë íŒŒì¼ ë° ë””ë ‰í† ë¦¬ 개수 +Number of files and directories that will be deleted +ì‚ì œë íŒŒì¼ ë° ë””ë ‰í† ë¦¬ 개수 +Number of files that will be overwritten +ë®ì–´ 씌어질 íŒŒì¼ ê°œìˆ˜ +One of the FreeFileSync database entries within the following file is not yet existing: +ë‹¤ìŒ íŒŒì¼ ë‚´ì— ìžˆëŠ” FreeFileSync ë°ì´í„°ë² ì´ìŠ¤ 엔트리 중 하나가 ì•„ì§ ì¡´ìž¬í•˜ì§€ 않습니다 : +One of the FreeFileSync database files is not yet existing: +FreeFileSync ë°ì´í„°ë² ì´ìŠ¤ íŒŒì¼ ì¤‘ 하나가 ì•„ì§ ì¡´ìž¬í•˜ì§€ 않습니다 : +Only files/directories that pass filtering will be selected for synchronization. The filter will be applied to the name relative(!) to the base synchronization directories. +í•„í„°ë§ì„ 통과하는 파ì¼/ë””ë ‰í† ë¦¬ ë§Œì˜ ë™ê¸°í™”를 위해 ì„ íƒí•©ë‹ˆë‹¤. 기준 ë™ê¸°í™” ë””ë ‰í† ë¦¬ 대ìƒ(!) ì´ë¦„ì„ í•„í„°ëŠ” ì 용합니다. +Open with Explorer +ìµìŠ¤í”Œë¡œëŸ¬ë¡œ 열기 +Open with default application +기본값 ì• í”Œë¦¬ì¼€ì´ì…˜ìœ¼ë¡œ 열기 +Operation aborted! +ìž‘ì—… 중지! +Operation: +ìž‘ì—… : +Overview +개요 +Overwriting Symbolic Link %x in %y +ì‹¬ë³¼ë¦ ë§í¬ %x 를 %y ì— ë®ì–´ì“°ëŠ” 중 +Overwriting file %x in %y +íŒŒì¼ %x 를 %y ì— ë®ì–´ì“°ëŠ” 중 +Pause +ì¼ì‹œì •ì§€ +Paused +ì¼ì‹œì •ì§€ 중 +Planned directory deletion is in conflict with its subdirectories and -files! +ë””ë ‰í† ë¦¬ë¥¼ ì‚ì œí•˜ë©´ ì„œë¸Œë””ë ‰í† ë¦¬ ë° íŒŒì¼ê³¼ 충ëŒí•˜ê²Œ ë©ë‹ˆë‹¤! +Please run a Compare first before synchronizing! +ë™ê¸°í™” ìž‘ì—… ì´ì „ì— ë¹„êµë¥¼ ë¨¼ì € 실행해 주ì‹ì‹œì˜¤! +Press \"Switch\" to open FreeFileSync GUI mode. +FreeFileSync GUI 모드는 \"ì „í™˜\" ì„ ëˆ„ë¥´ë©´ 열립니다. +Processing folder pair: +í´ë” 페어 처리 중 : +Published under the GNU General Public License: +GNU ì¼ë°˜ 공용 ë¼ì´ì„¼ìŠ¤ì— ì˜í•œ 출시 : +Question +질문 +RealtimeSync - Automated Synchronization +실시간 ë™ê¸°í™” - ìžë™ ë™ê¸°í™” +RealtimeSync configuration +실시간 ë™ê¸°í™” ì„¤ì • +Recycle Bin not yet supported for this system! +본 시스템ì—서는 íœ´ì§€í†µì„ ì•„ì§ ì§€ì›í•˜ì§€ 않습니다. +Relative path +ëŒ€ìƒ ê²½ë¡œ +Remove alternate settings +ëŒ€ì²´ì„¤ì • ì œê±° +Remove folder +í´ë” ì œê±° +Remove folder pair +í´ë” 페어(ì§) ì œê±° +Report translation error +ë²ˆì— ê´€ë ¨ 오류 ë³´ê³ +Reset +리셋 +Reset view +보기 리셋 +Restore all hidden dialogs? +ëª¨ë“ ìˆ¨ê¸´ 다ì´ì–¼ë¡œê·¸ë¥¼ ë³µì› í•˜ì‹œê² ìŠµë‹ˆê¹Œ? +Right +우측 +S&ave configuration... +ì„¤ì • ì €ìž¥ +S&witch view +보기 ì „í™˜ +Save changes to current configuration? +현재 ì„¤ì •ì˜ ë³€ê²½ ë‚´ìš©ì„ ì €ìž¥í•˜ì‹œê² ìŠµë‹ˆê¹Œ? +Save current configuration to file +현재 ì„¤ì •ì„ íŒŒì¼ë¡œ ì €ìž¥ +Scanning... +스캔 중... +Scanning: +스캔 : +Select a folder +í´ë” ì„ íƒ +Select alternate synchronization settings +대체 ë™ê¸°í™” ì„¤ì • ì„ íƒ +Select logfile directory: +ë¡œê·¸íŒŒì¼ ë””ë ‰í† ë¦¬ ì„ íƒ : +Select variant: +옵션 ì„ íƒ : +Select view +보기 ì„ íƒ +Set direction: +ë°©í–¥ ì„¤ì • : +Setting default synchronization directions: Old files will be overwritten with newer files. +기본값 ë™ê¸°í™” ë°©í–¥ ì„¤ì • : ì´ì „ 파ì¼ë“¤ì€ ì‹ ê·œ 파ì¼ë“¤ë¡œ ë®ì–´ì“°ì—¬ 집니다. +Show \"%x\" +\"%x\" 표시 +Show conflicts +ì¶©ëŒ í‘œì‹œ +Show files that are different +ë‚´ìš©ì´ ë‹¤ë¥¸ íŒŒì¼ í‘œì‹œ +Show files that are equal +ë‚´ìš©ì´ ê°™ì€ íŒŒì¼ í‘œì‹œ +Show files that are newer on left +ì¢Œì¸¡ì´ ë” ì‹ ê·œì¸ íŒŒì¼ í‘œì‹œ +Show files that are newer on right +ìš°ì¸¡ì´ ë” ì‹ ê·œì¸ íŒŒì¼ í‘œì‹œ +Show files that exist on left side only +좌측ì—만 존재하는 íŒŒì¼ í‘œì‹œ +Show files that exist on right side only +우측ì—만 존재하는 íŒŒì¼ í‘œì‹œ +Show files that will be created on the left side +ì¢Œì¸¡ì— ìƒì„±ë íŒŒì¼ í‘œì‹œ +Show files that will be created on the right side +ìš°ì¸¡ì— ìƒì„±ë íŒŒì¼ í‘œì‹œ +Show files that will be deleted on the left side +좌측ì—ì„œ ì‚ì œë íŒŒì¼ í‘œì‹œ +Show files that will be deleted on the right side +우측ì—ì„œ ì‚ì œë íŒŒì¼ í‘œì‹œ +Show files that will be overwritten on left side +ì¢Œì¸¡ì— ë®ì–´ì“°ì—¬ì§ˆ íŒŒì¼ í‘œì‹œ +Show files that will be overwritten on right side +ìš°ì¸¡ì— ë®ì–´ì“°ì—¬ì§ˆ íŒŒì¼ í‘œì‹œ +Show files that won't be copied +복사ë˜ì§€ ì•Šì„ íŒŒì¼ í‘œì‹œ +Show hidden dialogs +숨긴 다ì´ì–¼ë¡œê·¸ 표시 +Show popup +íŒì—… 표시 +Show popup on errors or warnings +오류/ê²½ê³ ê´€ë ¨ íŒì—… 표시 +Significant difference detected: +중대한 ì°¨ì´ê°€ ê°ì§€ ë습니다 : +Silent mode +사ì¼ëŸ°íŠ¸ 모드 +Size +í¬ê¸° +Source code written completely in C++ utilizing: +소스 코드는 ì „ë¶€ C++ 언어로 아래 íˆ´ì„ ì‚¬ìš©í•˜ì—¬ 작성 ë˜ì—ˆìŠµë‹ˆë‹¤ : +Source directory does not exist anymore: +소스 ë””ë ‰í† ë¦¬ê°€ ë” ì´ìƒ 존재하지 않습니다 : +Speed: +ì†ë„ : +Start +시작 +Start minimized and write status information to a logfile +최소화 ìƒíƒœë¡œ ì‹œìž‘í•˜ê³ , 로그파ì¼ì— ìƒíƒœ ì •ë³´ë¥¼ ê¸°ë¡ +Start synchronization +ë™ê¸°í™” 시작 +Statistics +통계 +Status feedback +ìƒíƒœ 피드백 +Stop +ì •ì§€ +Swap sides +측면 위치 서로 바꾸기 +Switching to FreeFileSync GUI mode... +FreeFileSync GUI 모드로 ì „í™˜ 중... +Symbolic Link handling +ì‹¬ë³¼ë¦ ë§í¬ 처리 +Symlinks %x have the same date but a different target! +Symlinks %x ì˜ ë‚ ì§œëŠ” 같으나, 대ìƒì´ 다릅니다! +Synchronization Preview +ë™ê¸°í™” 미리보기 +Synchronization aborted! +ë™ê¸°í™” 중단! +Synchronization completed successfully! +ë™ê¸°í™”ê°€ 성공ì 으로 완료 ë습니다! +Synchronization completed with errors! +ë™ê¸°í™”ê°€ 완료ë˜ê¸´ 했으나, 오류가 있습니다! +Synchronization settings +ë™ê¸°í™” ì„¤ì • +Synchronize all .doc, .zip and .exe files except everything in subfolder \"temp\". +서브í´ë” \"temp\" ì— ìžˆëŠ” 파ì¼ë“¤ì€ ì œì™¸í•˜ê³ , ì´ì™¸ ëª¨ë“ .doc, .zip, .exe í™•ìž¥ìž íŒŒì¼ ë™ê¸°í™” +Synchronize... +ë™ ê¸° í™” +Synchronizing... +ë™ê¸°í™” ìž‘ì—… 중... +Target directory already existing! +ëŒ€ìƒ ë””ë ‰í† ë¦¬ê°€ ì´ë¯¸ 존재합니다! +Target file already existing! +ëŒ€ìƒ íŒŒì¼ì´ ì´ë¯¸ 존재합니다! +The command line is executed each time:\n- all directories become available (e.g. USB stick insert)\n- files within these directories or subdirectories are modified +ì´ ì»¤ë©˜ë“œë¼ì¸ì€ ë‹¤ìŒ ê²½ìš° 매번 실행 ë©ë‹ˆë‹¤:\n- ëª¨ë“ ë””ë ‰í† ë¦¬ì—ì„œ 사용 ê°€ëŠ¥í• ì‹œ (예. USB 스틱 삽입시) \n- ë””ë ‰í† ë¦¬, ë˜ëŠ” ì„œë¸Œë””ë ‰í† ë¦¬ë‚´ì˜ íŒŒì¼ì€ 변경 ë©ë‹ˆë‹¤. +The file does not contain a valid configuration: +ì´ íŒŒì¼ì€ ìœ íš¨í•œ ì„¤ì • ê°’ì„ ê°–ê³ ìžˆì§€ 않습니다 : +The file was not processed by last synchronization! +ì´ íŒŒì¼ì€ 마지막 ë™ê¸°í™”ì—ì„œ 처리ë˜ì§€ 않았습니다! +This variant evaluates two equally named files as being equal when they have the same file size AND the same last write date and time. +ì´ ì˜µì…˜ì€ ë™ì¼í•œ ì´ë¦„ì˜ 2ê°œì˜ íŒŒì¼ì´ ê°™ì€ í¬ê¸° ë° ê°™ì€ ë§ˆì§€ë§‰ 작성 ì¼ìž/ì‹œê°„ì„ ê°–ì„ ê²½ìš°, ì´ë“¤ 2ê°œ 파ì¼ì„ í‰ê°€í•©ë‹ˆë‹¤. +Time +시간 +Time elapsed: +경과 시간 : +Time remaining: +ë‚¨ì€ ì‹œê°„ : +Total amount of data that will be transferred +ì „ì†¡í•˜ê²Œ ë ì „ì²´ ë°ì´í„° 량 +Total time: +ì „ì²´ 시간 : +Transfer file and directory permissions\n(Requires Administrator rights) +íŒŒì¼ ë° ë””ë ‰í† ë¦¬ 권한 ì „ì†¡\n(ê´€ë¦¬ìž ê¶Œí•œì´ í•„ìš”í•¨) +Unable to connect to sourceforge.net! +Sourceforge.netì— ì ‘ì†í• 수 없습니다! +Unable to create logfile! +ë¡œê·¸íŒŒì¼ ìƒì„±ì„ í• ìˆ˜ 없습니다! +Unresolved conflicts existing! +í•´ê²°ë˜ì§€ ì•Šì€ ì¶©ëŒì´ 있습니다! +Update -> +ì—…ë°ì´íŠ¸ -> +Updating attributes of %x +%x ì†ì„± ì—…ë°ì´íŠ¸ +Usage: +사용 : +Use Recycle Bin +휴지통 사용 +Use Recycle Bin when deleting or overwriting files +파ì¼ì„ ì‚ì œí•˜ê±°ë‚˜ ë®ì–´ì“°ê¸° í• ë•Œ, 휴지통 사용 +User-defined directory for deletion was not specified! +ì‚ì œë¥¼ 위한 ì‚¬ìš©ìž ì§€ì • ë””ë ‰í† ë¦¬ê°€ ì •í•´ì§€ì§€ 않았습니다! +Variant +옵션(변수) +Verifying file %x +íŒŒì¼ %x í™•ì¸ +Versioning +ë²„ì €ë‹ +Volume name %x not part of filename %y! +볼륨 ì´ë¦„ %x ê°€ íŒŒì¼ ì´ë¦„ %y ì˜ ì¼ë¶€ê°€ 아님! +Waiting for missing directories... +ëˆ„ë½ ë””ë ‰í† ë¦¬ 대기 중... +Waiting while directory is locked (%x)... +ë””ë ‰í† ë¦¬ ìž ê¸ˆ 대기 중 (%x)... +Warning +ê²½ê³ +When the comparison is started with this option set the following decision tree is processed: +ì´ ì˜µì…˜ìœ¼ë¡œ 비êµë¥¼ ì‹œìž‘í• ê²½ìš°, 다ìŒê³¼ ê°™ì€ ì˜ì‚¬ê²°ì • 트리 ì„¤ì •ì´ ì²˜ë¦¬ë©ë‹ˆë‹¤ : +You can ignore conflicts and continue synchronization. +충ëŒì„ ë¬´ì‹œí•˜ê³ ë™ê¸°í™”를 계ì†í• 수 있습니다. +You can ignore this error to consider the directory as empty. +ë””ë ‰í† ë¦¬ê°€ 비었다는 오류는 ë¬´ì‹œí• ìˆ˜ 있습니다. +You may try to synchronize remaining items again (WITHOUT having to re-compare)! +잔여 ì•„ì´í…œì— 대한 ë™ê¸°í™”를 (다시 비êµí• 필요없ì´) 재시ë„í• ìˆ˜ 있습니다! +different +다름 +file exists on both sides +양측 모ë‘ì— íŒŒì¼ì´ 존재 +on one side only +한쪽ì—만 diff --git a/BUILD/Languages/polish.lng b/BUILD/Languages/polish.lng index 0e8b400b..7ca5dfc1 100644 --- a/BUILD/Languages/polish.lng +++ b/BUILD/Languages/polish.lng @@ -154,6 +154,10 @@ <DowiÄ…zanie symboliczne> <multiple selection> <zaznaczone elementy> +A directory input field is empty. +Pole ze Å›cieżkÄ… katalogu jest puste. +A directory will be modified which is part of multiple folder pairs! Please review synchronization settings! +Katalog zostanie zmodyfikowany w efekcie synchronizacji wielu par folderów! Zweryfikuj ustawienia synchronizacji! A newer version of FreeFileSync is available: DostÄ™pna jest nowa wersja FreeFileSync: Abort requested: Waiting for current operation to finish... @@ -370,6 +374,8 @@ Encoding extended time information: %x Odkodowywanie rozszerzonych informacji o czasie: %x Endless loop when traversing directory: ZapÄ™tlenie podczas przeglÄ…dania katalogu: +Equal files/folders that differ in attributes only +Pliki/foldery różniÄ…ce siÄ™ tylko atrybutami Error BÅ‚Ä…d Error changing modification time: @@ -476,8 +482,6 @@ Files that exist on both sides, right one is newer Pliki, które istniejÄ… po obu stronach, prawa strona jest nowsza Files that have different content Pliki, które majÄ… różnÄ… zawartość -Files/folders that differ in attributes only -Pliki/foldery różniÄ…ce siÄ™ wyÅ‚Ä…cznie atrybutami Files/folders that exist on left side only Pliki/katalogi istniejÄ…ce tylko po lewej stronie Files/folders that exist on right side only @@ -488,8 +492,6 @@ Filter is active Filtr jest aktywny Filter settings have changed! Ustawienia filtra ulegÅ‚y zmianie! -Filter view -Filtr podglÄ…du Filter: All pairs Filtr: Wszystkie pary Filter: Single pair @@ -506,6 +508,8 @@ Follow PodÄ…rzaj Free disk space available: Wolne miejsce: +Free disk space required: +Wymagane wolne miejsce: FreeFileSync Batch Job FreeFileSync plik wsadowy FreeFileSync at Sourceforge @@ -600,6 +604,8 @@ Integrate external applications into context menu. The following macros are avai DoÅ‚Ä…cz zewnÄ™trznÄ… aplikacjÄ™ do menu kontekstowego. DostÄ™pne macra: Invalid FreeFileSync config file! NieprawidÅ‚owy plik konfiguracyjny! +Last used configurations (press DEL to remove from list) +Ostatnio użyta konfiguracja (naciÅ›nij DEL żeby usunąć z listy) Leave as unresolved conflict Zostaw jako nierozwiÄ…zany konflikt Left @@ -608,8 +614,6 @@ Legend Legenda Load configuration from file Wczytaj konfiguracjÄ™ z pliku -Load configuration history (press DEL to delete items) -Wczytaj historie konfiguracji (naciÅ›nij Del aby usunąć element) Log-messages: Logi: Logging @@ -620,12 +624,16 @@ Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit v Tworzenie Shadow Copies dla WOW64 nie jest obsÅ‚ugiwane. Zainstaluj 64 bitowÄ… wersjÄ™ FreeFileSync. Match case UwzglÄ™dnij wielkość liter +Maximum number of logfiles: +Maksymalna liczba plików z logami: +Memory allocation failed! +BÅ‚Ä…d alokacji zasobów! Minimum Idle Time [seconds] Minimalny czas bezczynnoÅ›ci [sekundy] Mirror ->> Lustrzana ->> -Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronization. -Kopia lustrzana lewego folderu: Prawy folder bÄ™dzie nadpisany zawartoÅ›ciÄ… lewego folderu. +Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization. +Lustrzana kopia lewego folderu. Prawy folder po synchronizacji jest lustrzanÄ… kopiÄ… lewego folderu. Monitoring active... Monitorowanie aktywne... More than 50% of the total number of files will be copied or deleted! @@ -696,8 +704,6 @@ Published under the GNU General Public License: UdostÄ™pnione na zasadach licencji GNU General Public License: Question Pytanie -Re-enable all hidden dialogs? -Odblokować wszystkie ukryte dialogi? RealtimeSync - Automated Synchronization RealtimeSync - Automatyczna Synchronizacja RealtimeSync configuration @@ -718,6 +724,8 @@ Reset Resetuj Reset view Resetuj widok +Restore all hidden dialogs? +Przywrócić wszystkie ukryte dialogi? Right Prawy S&ave configuration... @@ -740,6 +748,8 @@ Select logfile directory: Wybierz katalog z logami: Select variant: Wybierz wariant: +Select view +OkreÅ›l widok Set direction: Kierunek synchronizacji: Setting default synchronization directions: Old files will be overwritten with newer files. @@ -828,8 +838,6 @@ Synchronize... Synchronizuj... Synchronizing... SynchronizujÄ™... -System out of memory! -Brak pamiÄ™ci! Target directory already existing! Katalog docelowy już istnieje! Target file already existing! @@ -850,8 +858,6 @@ Time remaining: PozostaÅ‚y czas: Total amount of data that will be transferred Liczba danych do przekopiowania -Total required free disk space: -CaÅ‚kowita wymagana przestrzeÅ„ dyskowa: Total time: CaÅ‚kowity czas: Transfer file and directory permissions\n(Requires Administrator rights) @@ -872,14 +878,14 @@ Use Recycle Bin Użyj kosza Use Recycle Bin when deleting or overwriting files Używaj Kosza podczas usuwania lub nadpisywania plików -User-defined directory -Katalog użytkownika User-defined directory for deletion was not specified! Katalog użytkownika dla elementów usuniÄ™tych nie zostaÅ‚ okreÅ›lony! Variant Wariant Verifying file %x Weryfikowanie pliku %x +Versioning +Wersjonowanie Volume name %x not part of filename %y! Dysk %x nie jest częściÄ… pliku %y! Waiting for missing directories... @@ -888,14 +894,12 @@ Waiting while directory is locked (%x)... Blokada katalogu (%x), oczekiwanie... Warning Uwaga -Warning: Synchronization failed for %x item(s): -Uwaga: BÅ‚Ä…d synchronizacji dla \"%x\" elementów: When the comparison is started with this option set the following decision tree is processed: Gdy porównywanie z zaznaczonÄ… opcjÄ… jest w toku, podejmowane sÄ… nastÄ™pujÄ…ce dezyje: You can ignore conflicts and continue synchronization. Możesz je zignorować i kontynuować synchronizacjÄ™. -You can ignore the error to consider not existing directories as empty. -Możesz zignorować ten bÅ‚Ä…d i uznać nieistniejÄ…cy katalog za pusty. +You can ignore this error to consider the directory as empty. +Możesz zignorować ten bÅ‚Ä…d uznająć jeden z katalogów jako pusty. You may try to synchronize remaining items again (WITHOUT having to re-compare)! Możesz spróbować synchronizować pozostaÅ‚e elementy ponownie (bez koniecznoÅ›ci ponownego porównywania)! different diff --git a/BUILD/Languages/portuguese.lng b/BUILD/Languages/portuguese.lng index 9713e47a..ecee1cfa 100644 --- a/BUILD/Languages/portuguese.lng +++ b/BUILD/Languages/portuguese.lng @@ -3,7 +3,7 @@ %x / %y objects deleted successfully %x / %y objectos eliminados com sucesso %x Bytes - +%x Bytes %x GB %x GB %x MB @@ -154,6 +154,10 @@ <Link Simbólico> <multiple selection> <Selecção Múltipla> +A directory input field is empty. +Um campo de directório está vazio. +A directory will be modified which is part of multiple folder pairs! Please review synchronization settings! +Um directório que pertencente a conjunto de vários directórios vai ser alterado! Por favor, verifique as opções de sincronização! A newer version of FreeFileSync is available: Mais recente versão do FreeFileSync disponÃvel: Abort requested: Waiting for current operation to finish... @@ -257,9 +261,9 @@ Continuar Conversion error: Erro de conversão: Copy attributes only from left to right - +Copiar atributos apenas da esquerda para a direita Copy attributes only from right to left - +Copiar atributos apenas da direita para a esquerda Copy filesystem permissions Copiar permissões do sistema de ficheiros Copy from left to right @@ -359,7 +363,7 @@ Fazer download agora? Drag && drop Pegar && largar Elements found: -ELementos encontrados: +Elementos encontrados: Elements processed: Elementos processados: Elements remaining: @@ -370,6 +374,8 @@ Encoding extended time information: %x A codificar dados temporais extendidos: %x Endless loop when traversing directory: Loop infinito ao percorrer directório: +Equal files/folders that differ in attributes only +Ficheiros/Pastas iguais que diferem apenas nos atributos Error Erro Error changing modification time: @@ -476,8 +482,6 @@ Files that exist on both sides, right one is newer Ficheiros existentes dos dois lados, à direita é mais recente Files that have different content Ficheiros com conteúdo diferente -Files/folders that differ in attributes only - Files/folders that exist on left side only Ficheiros/pastas existentes somente à esquerda Files/folders that exist on right side only @@ -488,8 +492,6 @@ Filter is active Filtro activo Filter settings have changed! Opções de filtro alteradas! -Filter view -Filtrar vista Filter: All pairs Filtro: Todos os pares Filter: Single pair @@ -501,11 +503,13 @@ Procurar: Folder Comparison and Synchronization Comparação e Sincronização de pastas Folder pairs - +Par de directório Follow Seguir Free disk space available: Espaço livre em disco: +Free disk space required: +Espaço livre necessário em disco: FreeFileSync Batch Job FreeFileSync Ficheiro batch FreeFileSync at Sourceforge @@ -600,6 +604,8 @@ Integrate external applications into context menu. The following macros are avai Integrar aplicações externas no menu de contexto. As seguintes macros estão disponÃveis: Invalid FreeFileSync config file! Ficheiro de configuração do FreeFileSync inválido! +Last used configurations (press DEL to remove from list) +Última configuração utilizada (pressione DEL para remover da lista) Leave as unresolved conflict Deixar como conflito Left @@ -608,24 +614,26 @@ Legend Legenda Load configuration from file Carregar configuração do ficheiro -Load configuration history (press DEL to delete items) -Carregar histórico de configuração (pressione DEL para apagar itens) Log-messages: Log de mensagens: Logging A escrever em log Main bar - +Barra principal Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit version. Fazer cópias fantasma em WOW64 não é suportado. Por favor usar a versão 64-bit. Match case Correspondência +Maximum number of logfiles: +Número máximo de ficheiros log: +Memory allocation failed! +Alocação de memória falhou! Minimum Idle Time [seconds] - +Tempo de espera [segundos] Mirror ->> Espelhar ->> -Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronization. -Espelhar pasta da esquerda: A pasta da direita vai ser sobreposta e uma cópia exacta da pasta esquerda após sincronização. +Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization. +Cópia de segurança do directório à esquerda. O directório da direita é alterado para ficar igual ao da esquerda após sincronização. Monitoring active... Monitorizar activo... More than 50% of the total number of files will be copied or deleted! @@ -696,8 +704,6 @@ Published under the GNU General Public License: Publicado sobre GNU General Public License: Question Questão -Re-enable all hidden dialogs? -Reactivar todos os diálogos ocultos? RealtimeSync - Automated Synchronization RealtimeSync - Sincronização Automática RealtimeSync configuration @@ -717,7 +723,9 @@ Informar um erro de tradução Reset Reiniciar Reset view - +Restaurar vista +Restore all hidden dialogs? +Restaurar os diálogos escondidos? Right Direita S&ave configuration... @@ -740,12 +748,14 @@ Select logfile directory: Seleccione directório para ficheiro log: Select variant: Seleccione uma variante: +Select view +Seleccionar vista Set direction: Escolher direcção: Setting default synchronization directions: Old files will be overwritten with newer files. Escolher direcção de sincronização por defeito: Os ficheiros antigos serão substituÃdos pelos novos. Show \"%x\" - +Mostrar \"%x\" Show conflicts Mostrar conflitos Show files that are different @@ -828,8 +838,6 @@ Synchronize... Sincronizar... Synchronizing... A sincronizar... -System out of memory! -Sistema sem memória! Target directory already existing! Directório de destino já existe! Target file already existing! @@ -850,8 +858,6 @@ Time remaining: Tempo restante: Total amount of data that will be transferred Volume de dados a ser transferido -Total required free disk space: -Espaço livre necessário: Total time: Tempo total: Transfer file and directory permissions\n(Requires Administrator rights) @@ -865,37 +871,35 @@ Existem conflitos por resolver! Update -> Actualizar -> Updating attributes of %x - +Actualizar atributos de %x Usage: Uso: Use Recycle Bin Utilizar Reciclagem Use Recycle Bin when deleting or overwriting files Utilizar Reciclagem ao apagar ou substituir ficheiros -User-defined directory -Directório definido pelo utilizador User-defined directory for deletion was not specified! Directório para eliminação não foi especificado! Variant Variável Verifying file %x A verificar ficheiro %x +Versioning + Volume name %x not part of filename %y! Nome do volume %x não faz parte do ficheiro %y! Waiting for missing directories... - +Aguardar pelos directórios em falta... Waiting while directory is locked (%x)... -Aguardando enquanto o directório é bloqueado (%x)... +Aguardar enquanto o directório é bloqueado (%x)... Warning Atenção -Warning: Synchronization failed for %x item(s): -Atenção: A sincronização falhou para %x item(s): When the comparison is started with this option set the following decision tree is processed: Usar a seguinte árvore de decisão quando inicia com estas opções de comparação: You can ignore conflicts and continue synchronization. Pode ignorar os conflitos e continuar a sincronização. -You can ignore the error to consider not existing directories as empty. -Pode ignorar o erro para considerar directórios não existentes como vazios. +You can ignore this error to consider the directory as empty. +Pode ignorar este erro para considerar o directório como vazio. You may try to synchronize remaining items again (WITHOUT having to re-compare)! Pode tentar sincronizar os restantes elementos outra vez (SEM TER QUE comparar de novo) ! different diff --git a/BUILD/Languages/portuguese_br.lng b/BUILD/Languages/portuguese_br.lng index f2045bb0..d0e6d266 100644 --- a/BUILD/Languages/portuguese_br.lng +++ b/BUILD/Languages/portuguese_br.lng @@ -154,6 +154,10 @@ C&riar um arquivo batch... <Link Simbólico> <multiple selection> <seleção múltipla> +A directory input field is empty. +Um campo de entrada de diretório está vazio. +A directory will be modified which is part of multiple folder pairs! Please review synchronization settings! +Um diretório será modificado o qual é parte de múltiplos pares de pastas! Por favor revise suas configurações de sincronização! A newer version of FreeFileSync is available: Uma nova versão do FreeFileSync foi encontrada: Abort requested: Waiting for current operation to finish... @@ -202,6 +206,8 @@ Cannot determine sync-direction: Não foi possÃvel determinar a direção de sincronização: Cannot find %x Não foi possÃvel encontrar %x +Cannot write to empty directory path! + Category Categoria Clear filter settings @@ -370,6 +376,8 @@ Encoding extended time information: %x Codificando informações adicionais de tempo: %x Endless loop when traversing directory: Loop infinito quando percorrendo diretório: +Equal files/folders that differ in attributes only +Arquivos/pastas iguais que diferem apenas nos atributos Error Erro Error changing modification time: @@ -476,8 +484,6 @@ Files that exist on both sides, right one is newer Arquivos que existem nos dois lados, sendo à direita mais recentes Files that have different content Arquivos que possuem conteúdo diferente -Files/folders that differ in attributes only -Arquivos/pastas que diferem somente em atributos Files/folders that exist on left side only Arquivos/pastas que existem somente à esquerda Files/folders that exist on right side only @@ -488,8 +494,6 @@ Filter is active Filtro está ativo Filter settings have changed! As configurações do filtro foram alteradas! -Filter view -Filtrar visualização Filter: All pairs Filtro: Todos os pares Filter: Single pair @@ -506,6 +510,8 @@ Follow Seguir Free disk space available: Espaço livre em disco: +Free disk space required: +Espaço livre em disco requerido: FreeFileSync Batch Job FreeFileSync Arquivo batch FreeFileSync at Sourceforge @@ -600,6 +606,8 @@ Integrate external applications into context menu. The following macros are avai Integrar aplicações externas no menu de contexto. As seguintes macros estão disponÃveis: Invalid FreeFileSync config file! Arquivo de configuração do FreeFileSync inválido! +Last used configurations (press DEL to remove from list) +Últimas configurações usadas (pressione DEL para remover da lista) Leave as unresolved conflict Deixar como conflito não resolvido Left @@ -608,8 +616,6 @@ Legend Legenda Load configuration from file Carregar configuração do arquivo -Load configuration history (press DEL to delete items) -Carregar histórico de configuração (pressione DEL para apagar itens) Log-messages: Log de mensagens: Logging @@ -620,12 +626,16 @@ Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit v Cópias de sombra no WOW64 não são suportadas. Por favor use a versão 64-bits do FreeFileSync. Match case Diferenciar maiúsculas e minúsculas +Maximum number of logfiles: +Número máximo de arquivos de log: +Memory allocation failed! +Alocação de memória falhou! Minimum Idle Time [seconds] MÃnimo Tempo Ocioso [segundos] Mirror ->> Espelhar ->> -Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronization. -Espelhar pasta da esquerda: A pasta da direita vai ser substituÃda por uma cópia exata da pasta da esquerda após a sincronização. +Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization. +Backup espelho da pasta da esquerda. A pasta da direita será modificada para ficar exatamente igual à pasta da esquerda após a sincronização. Monitoring active... Monitoramento ativo... More than 50% of the total number of files will be copied or deleted! @@ -696,8 +706,6 @@ Published under the GNU General Public License: Publicado sobre a GNU General Public License: Question Questão -Re-enable all hidden dialogs? -Reabilitar todos os diálogos ocultos? RealtimeSync - Automated Synchronization RealtimeSync - Sincronização Automátizada RealtimeSync configuration @@ -718,6 +726,8 @@ Reset Restaurar Reset view Restaurar visualização +Restore all hidden dialogs? +Restaurar todos os diálogos ocultados? Right Direita S&ave configuration... @@ -740,6 +750,8 @@ Select logfile directory: Escolha um diretório para salvar o arquivo log: Select variant: Selecione um modo: +Select view +Selecionar visualização Set direction: Configurar direção Setting default synchronization directions: Old files will be overwritten with newer files. @@ -828,8 +840,6 @@ Synchronize... Sincronizar... Synchronizing... Sincronizando... -System out of memory! -Sistema sem memória! Target directory already existing! Diretório de destino já existe! Target file already existing! @@ -850,8 +860,6 @@ Time remaining: Tempo restante: Total amount of data that will be transferred Volume de dados que será transferido -Total required free disk space: -Espaço livre total requerido: Total time: Tempo total: Transfer file and directory permissions\n(Requires Administrator rights) @@ -872,14 +880,14 @@ Use Recycle Bin Utilizar Lixeira Use Recycle Bin when deleting or overwriting files Usar a Lixeira quando apagar ou substituir arquivos -User-defined directory -Diretório especificado User-defined directory for deletion was not specified! Diretório especificado para arquivos apagados não foi definido! Variant Modo Verifying file %x Verificando arquivo %x +Versioning +Controle de versões Volume name %x not part of filename %y! Nome do volume %x não é parte do arquivo %y! Waiting for missing directories... @@ -888,14 +896,12 @@ Waiting while directory is locked (%x)... Esperando enquanto o diretório é travado (%x)... Warning Atenção -Warning: Synchronization failed for %x item(s): -Atenção: A sincronização falhou para %x item(s): When the comparison is started with this option set the following decision tree is processed: Quando a comparação é iniciada com esta opção, a seguinte árvore de decisão é processada: You can ignore conflicts and continue synchronization. Você pode ignorar os conflitos e continuar a sincronização. -You can ignore the error to consider not existing directories as empty. -Você pode ignorar o erro para considerar diretórios não existente como vazios. +You can ignore this error to consider the directory as empty. +Você pode ignorar esse erro para considerar o diretório como vazio. You may try to synchronize remaining items again (WITHOUT having to re-compare)! Você pode tentar sincronizar os elementos restantes outra vez (SEM ter que comparar novamente)! different diff --git a/BUILD/Languages/romanian.lng b/BUILD/Languages/romanian.lng index 448c533b..b27d789a 100644 --- a/BUILD/Languages/romanian.lng +++ b/BUILD/Languages/romanian.lng @@ -154,6 +154,10 @@ ConfiguraÈ›ie &Nouă <Simlegătură> <multiple selection> <selectare multiplă> +A directory input field is empty. +Un cîmp de introducere a dosarului este gol. +A directory will be modified which is part of multiple folder pairs! Please review synchronization settings! +Va fi modificat un dosar care face parte din mai multe perechi de dosare! Reverifică setările de sincronizare! A newer version of FreeFileSync is available: Este disponibilă o versiune nouă de FreeFileSync: Abort requested: Waiting for current operation to finish... @@ -202,6 +206,8 @@ Cannot determine sync-direction: Nu se poate determina sensul de sincronizare: Cannot find %x Nu pot găsi %x +Cannot write to empty directory path! + Category Categorie Clear filter settings @@ -370,6 +376,8 @@ Encoding extended time information: %x Codarea informaÈ›iilor timpului extins: %x Endless loop when traversing directory: Buclă infinită la parcurgerea dosarului: +Equal files/folders that differ in attributes only +File/Dosare identice care diferă doar prin atributele lor Error Eroare Error changing modification time: @@ -476,8 +484,6 @@ Files that exist on both sides, right one is newer File care există în ambele părÈ›i, cea din dreapta fiind mai nouă Files that have different content File care au conÈ›inut diferit -Files/folders that differ in attributes only -File sau dosare care diferă doar la atribute Files/folders that exist on left side only File sau dosare care există doar în partea stîngă Files/folders that exist on right side only @@ -488,8 +494,6 @@ Filter is active Filtrul este activ Filter settings have changed! Setările filtrului au fost schimbate! -Filter view -Filtru de Vedere Filter: All pairs Filtru: Toate perechile Filter: Single pair @@ -506,6 +510,8 @@ Follow UrmăreÈ™te Free disk space available: SpaÈ›iu de stocare disponibil: +Free disk space required: +SpaÈ›iu liber de stocare necesar: FreeFileSync Batch Job Sarcină cu lot de comenzi FreeFileSync FreeFileSync at Sourceforge @@ -600,6 +606,8 @@ Integrate external applications into context menu. The following macros are avai Include aplicaÈ›iile externe în meniul contextual. Sînt disponibile următoarele macrocomenzi: Invalid FreeFileSync config file! Filă de configurare FreeFileSync nevalidă! +Last used configurations (press DEL to remove from list) +Ultimele configuraÈ›ii utilizate (apasă tasta DEL pentru a înlătura din listă) Leave as unresolved conflict Lasă ca Conflict Nerezolvat Left @@ -608,8 +616,6 @@ Legend Legendă Load configuration from file ÃŽncarcă configuraÈ›ia dintr-o filă -Load configuration history (press DEL to delete items) -ÃŽncarcă istoricul configuraÈ›iei (apasă tasta DEL pentru a È™terge itemuri) Log-messages: Mesaje de jurnalizare: Logging @@ -620,12 +626,16 @@ Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit v Realizarea de copii de rezervă prin sistemul WOW64 nu este suportată. FoloseÈ™te versiunea pe 64-biÈ›i a FreeFileSync. Match case PotriveÈ™te MAJ/min +Maximum number of logfiles: +Numărul maxim de file jurnal: +Memory allocation failed! +Alocarea memoriei a eÈ™uat! Minimum Idle Time [seconds] Timp Minim de Inactivitate [secunde] Mirror ->> Clonare =>> -Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronization. -Salvgardează [backup] prin clonare dosarul stîng: dosarul din dreapta va fi suprascris È™i va fi identic după sincronizare cu dosarul din stînga. +Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization. +Salvgardare în oglindă a dosarului stîng. Dosarul drept este modificat pentru a fi identic cu cel stîng după sincronizare. Monitoring active... Monitorizare activă... More than 50% of the total number of files will be copied or deleted! @@ -696,8 +706,6 @@ Published under the GNU General Public License: Publicat sub licenÈ›a GNU GPL: Question ÃŽntrebare -Re-enable all hidden dialogs? -Reactivezi casetele de dialog ascunse? RealtimeSync - Automated Synchronization RealtimeSync - Sincronizare Inteligentă RealtimeSync configuration @@ -718,6 +726,8 @@ Reset Resetează Reset view Resetează Vederea +Restore all hidden dialogs? +Restaurezi toate casetele de dialog ascunse? Right Dreapta S&ave configuration... @@ -740,6 +750,8 @@ Select logfile directory: Selectează un dosar pentru fila .log: Select variant: Selectează Varianta de Sincronizare: +Select view +Selectează Vederea Set direction: Setează AcÈ›iunea ca în Icoana Alăturată: Setting default synchronization directions: Old files will be overwritten with newer files. @@ -828,8 +840,6 @@ Synchronize... Sincronizează Synchronizing... Sincronizare aflată în curs... -System out of memory! -Memoria sistemului a fost epuizată! Target directory already existing! Dosarul È›intă există deja! Target file already existing! @@ -850,8 +860,6 @@ Time remaining: Timp Rămas: Total amount of data that will be transferred Volumul total de date care va fi transferat -Total required free disk space: -SpaÈ›iu de stocare necesar: Total time: Timp Total: Transfer file and directory permissions\n(Requires Administrator rights) @@ -872,14 +880,14 @@ Use Recycle Bin Mută în reciclator Use Recycle Bin when deleting or overwriting files Se foloseÈ™te Reciclatorul [Recycle Bin] cu ocazia È™tergerii sau suprascrierii unei file -User-defined directory -Mută într-un dosar personalizat User-defined directory for deletion was not specified! Dosarul ales de utilizator pentru È™tergere nu a fost specificat ! Variant Varianta Sincronizării Verifying file %x Verific fila %x +Versioning +Versionare Volume name %x not part of filename %y! Numele volumului %x nu face parte din numele filei %y ! Waiting for missing directories... @@ -888,14 +896,12 @@ Waiting while directory is locked (%x)... AÈ™tept ca dosarul să fie zăvorît (%x)... Warning Avertisment -Warning: Synchronization failed for %x item(s): -AtenÈ›ie: Sincronizarea a eÈ™uat pentru %x itemuri: When the comparison is started with this option set the following decision tree is processed: Cînd compararea este pornită cu acest set de opÈ›iuni, este executat următorul arbore de decizie: You can ignore conflicts and continue synchronization. PoÈ›i ignora conflictele pentru a continua cu sincronizarea. -You can ignore the error to consider not existing directories as empty. -PoÈ›i ignora eroarea care consideră că un dosar inexistent este gol. +You can ignore this error to consider the directory as empty. +PoÈ›i ignora această eroare pentru ca dosarul să fie considerat gol. You may try to synchronize remaining items again (WITHOUT having to re-compare)! PoÈ›i încerca să sincronizezi din nou itemurile rămase (FÄ‚RÄ‚ a le recompara) ! different diff --git a/BUILD/Languages/russian.lng b/BUILD/Languages/russian.lng index 318229e6..9eb00e1e 100644 --- a/BUILD/Languages/russian.lng +++ b/BUILD/Languages/russian.lng @@ -154,8 +154,10 @@ <Ð¡Ð¸Ð¼Ð²Ð¾Ð»ÑŒÐ½Ð°Ñ ÑÑылка> <multiple selection> <групповое выделение> +A directory input field is empty. +Поле ввода пути папки пуÑтое. A directory will be modified which is part of multiple folder pairs! Please review synchronization settings! - +Папка, входÑÑ‰Ð°Ñ Ð² неÑколько пар папок, будет изменена. ПожалуйÑта, проверьте наÑтройки Ñинхронизации! A newer version of FreeFileSync is available: ДоÑтупна Ð½Ð¾Ð²Ð°Ñ Ð²ÐµÑ€ÑÐ¸Ñ FreeFileSync: Abort requested: Waiting for current operation to finish... @@ -204,6 +206,8 @@ Cannot determine sync-direction: Ðевозможно определить направление Ñинхронизации: Cannot find %x Ðевозможно найти %x +Cannot write to empty directory path! + Category ÐšÐ°Ñ‚ÐµÐ³Ð¾Ñ€Ð¸Ñ Clear filter settings @@ -237,7 +241,7 @@ Comparison settings Completed Завершено Configuration -ÐаÑтройки Ñинхронизации +ÐаÑтройки Configuration loaded! ÐаÑтройки Ñинхронизации загружены! Configuration overview: @@ -372,6 +376,8 @@ Encoding extended time information: %x Кодирование раÑширенной информации о времени: %x Endless loop when traversing directory: Зацикливание при вÑтрече переÑекающихÑÑ Ð¿ÑƒÑ‚ÐµÐ¹: +Equal files/folders that differ in attributes only +Одинаковые файлы/папки, которые отличаютÑÑ Ñ‚Ð¾Ð»ÑŒÐºÐ¾ атрибутами Error Ошибка Error changing modification time: @@ -478,8 +484,6 @@ Files that exist on both sides, right one is newer Файлы, ÑущеÑтвующие на обоих Ñторонах, правый новее Files that have different content Файлы, имеющие различное Ñодержание -Files/folders that differ in attributes only -Файлы/папки, которые отличаютÑÑ Ñ‚Ð¾Ð»ÑŒÐºÐ¾ атрибутами Files/folders that exist on left side only Файлы/папки, ÑущеÑтвующие только на левой Ñтороне Files/folders that exist on right side only @@ -490,8 +494,6 @@ Filter is active Фильтр активен Filter settings have changed! ÐаÑтройки фильтра были изменены! -Filter view -Вид фильтра Filter: All pairs Фильтр: Ð’Ñе пары Filter: Single pair @@ -508,6 +510,8 @@ Follow ПоÑледовательное Free disk space available: ДоÑтупно Ñвободного меÑта на диÑке: +Free disk space required: +Требуемое Ñвободное меÑто на диÑке: FreeFileSync Batch Job Пакетное задание FreeFileSync FreeFileSync at Sourceforge @@ -602,6 +606,8 @@ Integrate external applications into context menu. The following macros are avai Интегрирует внешние Ð¿Ñ€Ð¸Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð² контекÑтное меню.\nСледующие команды доÑтупны: Invalid FreeFileSync config file! Ðеверный файл конфигурации FreeFileSync! +Last used configurations (press DEL to remove from list) +ПоÑледние иÑпользованные наÑтройки Ñинхронизации\n(нажмите DEL Ð´Ð»Ñ ÑƒÐ´Ð°Ð»ÐµÐ½Ð¸Ñ Ð¸Ð· ÑпиÑка) Leave as unresolved conflict ОÑтавить как нерешенный конфликт Left @@ -610,8 +616,6 @@ Legend Легенда Load configuration from file Загрузить наÑтройки Ñинхронизации из файла -Load configuration history (press DEL to delete items) -Выбрать наÑтройки Ñинхронизации из ÑпиÑка\n(нажмите DEL Ð´Ð»Ñ ÑƒÐ´Ð°Ð»ÐµÐ½Ð¸Ñ Ð¿ÑƒÐ½ÐºÑ‚Ð¾Ð²) Log-messages: Лог-ÑообщениÑ: Logging @@ -622,12 +626,16 @@ Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit v Создание теневых копий на WOW64 не поддерживаетÑÑ. ПожалуйÑта, иÑпользуйте FreeFileSync 64-разрÑдной верÑии. Match case Учитывать региÑÑ‚Ñ€ +Maximum number of logfiles: +МакÑимальное количеÑтво лог-файлов: +Memory allocation failed! +Ошибка Ð²Ñ‹Ð´ÐµÐ»ÐµÐ½Ð¸Ñ Ð¿Ð°Ð¼Ñти! (Ðе хватает памÑти) Minimum Idle Time [seconds] Минимальное Ð²Ñ€ÐµÐ¼Ñ Ð¿Ñ€Ð¾ÑÑ‚Ð¾Ñ [Ñекунд] Mirror ->> Зеркало ->> -Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronization. -Ð ÐµÐ·ÐµÑ€Ð²Ð½Ð°Ñ ÐºÐ¾Ð¿Ð¸Ñ Ð»ÐµÐ²Ð¾Ð¹ папки: Ð¿Ñ€Ð°Ð²Ð°Ñ Ð¿Ð°Ð¿ÐºÐ° будет перезапиÑана и поÑле Ñинхронизации будет точно ÑоответÑтвовать левой папке. +Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization. +Ð—ÐµÑ€ÐºÐ°Ð»ÑŒÐ½Ð°Ñ (резервнаÑ) ÐºÐ¾Ð¿Ð¸Ñ Ð»ÐµÐ²Ð¾Ð¹ чаÑти. Ð’ результате Ñинхронизации Ð¿Ñ€Ð°Ð²Ð°Ñ Ð¿Ð°Ð¿ÐºÐ° будет изменена до полного ÑоответÑÑ‚Ð²Ð¸Ñ Ð»ÐµÐ²Ð¾Ð¹. Monitoring active... Мониторинг включен... More than 50% of the total number of files will be copied or deleted! @@ -637,7 +645,7 @@ Move column down Move column up ПеремеÑтить вверх Move files into a time-stamped subdirectory -ПеремеÑтить файлы во временно-отмеченную подпапку +Перемещать файлы в заданную папку (можно Ñоздавать архивные верÑии удаленных файлов) Moving %x to Recycle Bin Отправка %x в "Корзину" Moving Symbolic Link %x to user-defined directory %y @@ -698,8 +706,6 @@ Published under the GNU General Public License: ИздаетÑÑ Ð¿Ð¾Ð´ лицензией GNU General Public License: Question Ð’Ð¾Ð¿Ñ€Ð¾Ñ -Re-enable all hidden dialogs? -Показать вÑе Ñкрытые диалоги? RealtimeSync - Automated Synchronization RealtimeSync - ÐвтоматичеÑÐºÐ°Ñ ÑÐ¸Ð½Ñ…Ñ€Ð¾Ð½Ð¸Ð·Ð°Ñ†Ð¸Ñ RealtimeSync configuration @@ -720,6 +726,8 @@ Reset СброÑить Reset view Ð¡Ð±Ñ€Ð¾Ñ Ð½Ð°Ñтроек вида +Restore all hidden dialogs? +Отображать вÑе Ñкрытые диалоговые окна? Right Справа S&ave configuration... @@ -742,6 +750,8 @@ Select logfile directory: Выберите папку Ð´Ð»Ñ Ð»Ð¾Ð³-файлов: Select variant: Выберите вариант: +Select view +СпиÑок файлов Set direction: Выберите направление: Setting default synchronization directions: Old files will be overwritten with newer files. @@ -830,8 +840,6 @@ Synchronize... Синхронизировать Synchronizing... СинхронизациÑ... -System out of memory! -Ðехватка памÑти! Target directory already existing! ÐšÐ¾Ð½ÐµÑ‡Ð½Ð°Ñ Ð¿Ð°Ð¿ÐºÐ° уже ÑущеÑтвует! Target file already existing! @@ -852,8 +860,6 @@ Time remaining: Времени оÑталоÑÑŒ: Total amount of data that will be transferred Общий объем данных, который будет передаватьÑÑ -Total required free disk space: -Общее требуемое Ñвободное диÑковое проÑтранÑтво: Total time: Общее времÑ: Transfer file and directory permissions\n(Requires Administrator rights) @@ -874,14 +880,14 @@ Use Recycle Bin ИÑпользовать "Корзину" Use Recycle Bin when deleting or overwriting files ИÑпользовать "Корзину" при удалении или перезапиÑи файлов -User-defined directory -ИÑпользовать заданную пользователем папку User-defined directory for deletion was not specified! ПользовательÑÐºÐ°Ñ Ð¿Ð°Ð¿ÐºÐ° Ð´Ð»Ñ ÑƒÐ´Ð°Ð»ÐµÐ½Ð¸Ñ Ð½Ðµ была указана! Variant Вариант Verifying file %x Проверка файла %x +Versioning +Перемещать удалÑемые файлы в заданную папку Volume name %x not part of filename %y! Ð˜Ð¼Ñ Ñ‚Ð¾Ð¼Ð° %x не ÑвлÑетÑÑ Ñ‡Ð°Ñтью имени файла %y! Waiting for missing directories... @@ -890,14 +896,12 @@ Waiting while directory is locked (%x)... Ожидание ÑнÑÑ‚Ð¸Ñ Ð±Ð»Ð¾ÐºÐ¸Ñ€Ð¾Ð²ÐºÐ¸ Ñ Ð¿Ð°Ð¿ÐºÐ¸ (%x)... Warning Внимание -Warning: Synchronization failed for %x item(s): -Внимание: Ð¡Ð¸Ð½Ñ…Ñ€Ð¾Ð½Ð¸Ð·Ð°Ñ†Ð¸Ñ Ð¿Ñ€Ð¾Ð²Ð°Ð»ÐµÐ½Ð° Ð´Ð»Ñ %x When the comparison is started with this option set the following decision tree is processed: Когда Ñравнение запущено Ñ Ñтими критериÑми, алгоритм Ñледующий: You can ignore conflicts and continue synchronization. Ð’Ñ‹ можете проигнорировать их и продолжить Ñинхронизацию. -You can ignore the error to consider not existing directories as empty. -Ð’Ñ‹ можете проигнорировать ошибку, принÑв неÑущеÑтвующие папки за пуÑтые. +You can ignore this error to consider the directory as empty. +Ð’Ñ‹ можете проигнорировать ошибку, принÑв папку за пуÑтую. You may try to synchronize remaining items again (WITHOUT having to re-compare)! Ð’Ñ‹ можете попытатьÑÑ Ñинхронизировать оÑтавшиеÑÑ Ð¿ÑƒÐ½ÐºÑ‚Ñ‹ Ñнова (без повторного ÑравнениÑ)! different diff --git a/BUILD/Languages/slovenian.lng b/BUILD/Languages/slovenian.lng index c1006eba..fbe0a03d 100644 --- a/BUILD/Languages/slovenian.lng +++ b/BUILD/Languages/slovenian.lng @@ -154,6 +154,10 @@ Na&loži konfiguracijo... <SimboliÄna povezava> <multiple selection> <mnogokratna izbira> +A directory input field is empty. +Vpisno polje za imenik je prazno. +A directory will be modified which is part of multiple folder pairs! Please review synchronization settings! +Imenik bo spremenjen, kar je del veÄkratnih parov map! Prosimo preglejte nastavitve sinhronizacije! A newer version of FreeFileSync is available: Na voljo je nova razliÄica FreeFileSync: Abort requested: Waiting for current operation to finish... @@ -370,6 +374,8 @@ Encoding extended time information: %x Podrobne informacije o Äasu enkodiranja: %x Endless loop when traversing directory: NeskonÄna zanka pri prehodu imenika: +Equal files/folders that differ in attributes only +Enake datoteke/mape, ki se razlikujejo samo v atributih Error Napaka Error changing modification time: @@ -476,8 +482,6 @@ Files that exist on both sides, right one is newer Datoteke, ki obstajajo na obeh straneh, desna je novejÅ¡a Files that have different content Datoteke, ki imajo razliÄno vsebino -Files/folders that differ in attributes only -Datoteke/mape, ki se razlikujejo samo v atributih Files/folders that exist on left side only Datoteke/mape, ki obstajajo samo na levi strani Files/folders that exist on right side only @@ -488,8 +492,6 @@ Filter is active Filterj je aktiven Filter settings have changed! Nastavitve filtra so bile spremenjene! -Filter view -Filtriran pogled Filter: All pairs Filtriraj: Vse pare Filter: Single pair @@ -506,6 +508,8 @@ Follow Sledi Free disk space available: Prosti disk, ki je na voljo: +Free disk space required: +Potreben prostor na disku: FreeFileSync Batch Job FreeFileSync Batch opravilo FreeFileSync at Sourceforge @@ -600,6 +604,8 @@ Integrate external applications into context menu. The following macros are avai Integriraj zunanje aplikacije v kontekstni menu. Na voljo so naslednji makri: Invalid FreeFileSync config file! Neveljavna FreeFileSync nastavitvena datoteka! +Last used configurations (press DEL to remove from list) +Zadnje uporabljene konfiguracije (pritisite DEL za odstranitev s seznama) Leave as unresolved conflict Pusti kot nereÅ¡eni spor Left @@ -608,8 +614,6 @@ Legend Legenda Load configuration from file Naloži konfiguracijo iz datoteke -Load configuration history (press DEL to delete items) -Naloži zgodovino konfiguracije (pritisnite DEL za brisanje predmetov) Log-messages: SporoÄila beleženja: Logging @@ -620,12 +624,16 @@ Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit v Ustvarjanje senÄnih kopij na WOW63 ni podprto. Prosimo uporabite 64-bitno FreeFileSync razliÄico. Match case Ujemaj se s primerom +Maximum number of logfiles: +Maksimalno Å¡tevilo datotek beleženja: +Memory allocation failed! +NeuspeÅ¡no dodeljevanje pomnilnika! Minimum Idle Time [seconds] Minimalen Äas nedejavnosti [sekunde] Mirror ->> Zrcalno ->> -Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronization. -Zrcalna kopija leve mape: Desna mapa bo prepisana in se bo natanÄno ujemala z levo mapo po sinhronizaciji. +Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization. +Zrcalna varnostna kopija leve mape. Desna mapa bo spremenjena, da se bo natanÄno ujemala z levo mapo po sinhronizaciji. Monitoring active... Nadziranje aktivno... More than 50% of the total number of files will be copied or deleted! @@ -696,8 +704,6 @@ Published under the GNU General Public License: Objavljeno pod licenco GNU General Public: Question VpraÅ¡anje -Re-enable all hidden dialogs? -Ponovno omogoÄim skrite pogovore? RealtimeSync - Automated Synchronization RealtimeSync - Avtomatizirana sinhronizacija RealtimeSync configuration @@ -718,6 +724,8 @@ Reset Ponastavi Reset view Ponastavi pogled +Restore all hidden dialogs? +Obnovim vse skrite pogovore? Right Desno S&ave configuration... @@ -740,6 +748,8 @@ Select logfile directory: Izberite imenik za datoteko beleženja: Select variant: Izberite varianto: +Select view +Izberite pogled Set direction: Nastavi smer: Setting default synchronization directions: Old files will be overwritten with newer files. @@ -828,8 +838,6 @@ Synchronize... Sinhroniziraj... Synchronizing... Sinhroniziram... -System out of memory! -Sistemu je zmanjkalo pomnilnika! Target directory already existing! Ciljni imenik že obstaja! Target file already existing! @@ -850,8 +858,6 @@ Time remaining: Preostali Äas: Total amount of data that will be transferred KoliÄina podatkov, ki bo preneÅ¡ena -Total required free disk space: -Skupno zahtevani prosti prostor na disku: Total time: Celoten Äas: Transfer file and directory permissions\n(Requires Administrator rights) @@ -872,14 +878,14 @@ Use Recycle Bin Uporabi KoÅ¡ Use Recycle Bin when deleting or overwriting files Uporabi KoÅ¡ pri brisanju ali prepisovanju datotek -User-defined directory -UporabniÅ¡ko-doloÄen imenik User-defined directory for deletion was not specified! UporabniÅ¡ko-doloÄen imenik za brisanje ni bil naveden! Variant RazliÄica Verifying file %x Preverjam datoteko %x +Versioning +Ustvarjanje razliÄiÄ Volume name %x not part of filename %y! Ime volumna %x ni del imena datoteke %y! Waiting for missing directories... @@ -888,14 +894,12 @@ Waiting while directory is locked (%x)... ÄŒakam, medtem ko se zaklepa imenik (%x)... Warning Pozor -Warning: Synchronization failed for %x item(s): -Pozor: Sinhronizacija ni uspela za %x predmetov: When the comparison is started with this option set the following decision tree is processed: Ko se primerjava zažene s tem setom možnosti, se obdela naslednje drevo odloÄitev: You can ignore conflicts and continue synchronization. Lahko ignorirate spore in nadaljujete s sinhronizacijo. -You can ignore the error to consider not existing directories as empty. -Ignoriraj napako za smatranje neobstojeÄih imenikov kot praznih. +You can ignore this error to consider the directory as empty. +To napako z obravnavanjem imenika kot praznega lahko ignorirate. You may try to synchronize remaining items again (WITHOUT having to re-compare)! Naslednje predmete lahko ponovno poskusite sinhronizirati (BREZ ponovne primerjave) ! different diff --git a/BUILD/Languages/spanish.lng b/BUILD/Languages/spanish.lng index 4bb360fa..9d40c389 100644 --- a/BUILD/Languages/spanish.lng +++ b/BUILD/Languages/spanish.lng @@ -154,6 +154,10 @@ <Enlace simbólico> <multiple selection> <selección múltiple> +A directory input field is empty. +Un campo de directorio está vacÃo. +A directory will be modified which is part of multiple folder pairs! Please review synchronization settings! +Un directorio será modificado, el cual es parte de mútiples pares de carpetas. ¡Por favor, revise la configuración de la sincronización! A newer version of FreeFileSync is available: Una nueva versión de FreeFileSync está disponible: Abort requested: Waiting for current operation to finish... @@ -177,7 +181,7 @@ An exception occurred! As a result the files are separated into the following categories: Como resultado, los archivos están separados en las siguientes categorÃas: As the name suggests, two files which share the same name are marked as equal if and only if they have the same content. This option is useful for consistency checks rather than backup operations. Therefore the file times are not taken into account at all.\n\nWith this option enabled the decision tree is smaller: -Como el tÃtulo sugiere, dos archivos que comparten el mismo nombre son marcados como iguales sólo si tienen el mismo contenido. Esta opción es útil para las comprobaciones de consistencia más que en operaciones de backup. Por lo tanto, las fechas de los archivos no se tienen en cuenta.\n\nCon esta opción habilitada el árbol de decisiones se reduce a: +Como el tÃtulo sugiere, dos archivos que comparten el mismo nombre son marcados como iguales sólo si tienen el mismo contenido. Esta opción es útil para las comprobaciones de consistencia más que en operaciones de copia de seguridad. Por lo tanto, las fechas de los archivos no se tienen en cuenta.\n\nCon esta opción habilitada el árbol de decisiones se reduce a: Assemble a batch file for automated synchronization. To start in batch mode simply pass the name of the file to the FreeFileSync executable: FreeFileSync.exe <batchfile>. This can also be scheduled in your operating system's task planner. Crear un archivo batch para una sincronización automática. Para empezar en modo batch simplemente pasar el nombre del archivo por el ejecutable FreeFileSync en la ventana de comandos (CMD): FreeFileSync.exe <archivo batch>. También se puede planificar en el administrador de tareas de su sistema operativo. At least one directory input field is empty. @@ -370,6 +374,8 @@ Encoding extended time information: %x Información temporal extendida de la codificación: %x Endless loop when traversing directory: Bucle infinito al buscar en el directorio: +Equal files/folders that differ in attributes only +Archivos/Carpetas iguales que sólo difieren en los atributos Error Error Error changing modification time: @@ -476,8 +482,6 @@ Files that exist on both sides, right one is newer Archivos que existen en ambos lados, el de la derecha es más reciente Files that have different content Archivos que tienen un contenido diferente -Files/folders that differ in attributes only -Archivos/carpetas que se diferencian sólo en atributos Files/folders that exist on left side only Archivos/carpetas que existen sólo en el lado izquierdo Files/folders that exist on right side only @@ -488,8 +492,6 @@ Filter is active Filtro activo Filter settings have changed! ¡Las opciones de filtrado han cambiado! -Filter view -Vista del filtro Filter: All pairs Filtro: Todos los pares Filter: Single pair @@ -506,6 +508,8 @@ Follow Seguir Free disk space available: Espacio de disco disponible: +Free disk space required: +Espacio de disco necesario: FreeFileSync Batch Job Tarea batch de FreeFileSync FreeFileSync at Sourceforge @@ -600,6 +604,8 @@ Integrate external applications into context menu. The following macros are avai Integrar aplicaciones externas en el menú de contexto. Los siguientes macros están disponibles: Invalid FreeFileSync config file! ¡Archivo de configuración de FreeFileSync inválido! +Last used configurations (press DEL to remove from list) +Últimas configuraciones usadas (Pulsar DEL para quitar de la lista) Leave as unresolved conflict Dejar como conflicto sin resolver Left @@ -608,8 +614,6 @@ Legend Leyenda Load configuration from file Cargar configuración desde archivo -Load configuration history (press DEL to delete items) -Cargar historial de configuración (presionar DEL para borrar elementos) Log-messages: Registro de mensajes: Logging @@ -620,12 +624,16 @@ Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit v La realización de copias shadow en WOW64 no está soportado. Por favor, use la versión 64-bit de FreeFileSync. Match case Distinción entre mayúsculas y minúsculas +Maximum number of logfiles: +Número máximo de archivos de registro: +Memory allocation failed! +¡La asignación de memoria ha fallado! Minimum Idle Time [seconds] Tiempo mÃnimo de espera [segundos] Mirror ->> Espejo ->> -Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronization. -Copia de seguridad de la carpeta de la izquierda: La carpeta de la derecha será sustituÃda y coincidirá exactamente con la carpeta de la izquierda después de la sincronización. +Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization. +Copia de seguridad en espejo de la carpeta izquierda. La carpeta derecha es modificada exactamente como la carpeta izquierda después de la sincronización. Monitoring active... Visualización activa... More than 50% of the total number of files will be copied or deleted! @@ -696,8 +704,6 @@ Published under the GNU General Public License: Publicado bajo "GNU General Public License": Question Pregunta -Re-enable all hidden dialogs? -¿Reactivar todos los diálogos ocultos? RealtimeSync - Automated Synchronization RealtimeSync - Sincronización Automática RealtimeSync configuration @@ -718,6 +724,8 @@ Reset Reiniciar Reset view Reiniciar vista +Restore all hidden dialogs? +¿Restaurar diálogos ocultos? Right Derecha S&ave configuration... @@ -740,6 +748,8 @@ Select logfile directory: Seleccione directorio para el archivo de registro: Select variant: Seleccione un tipo: +Select view +Sellecione vista Set direction: Indicar dirección: Setting default synchronization directions: Old files will be overwritten with newer files. @@ -828,8 +838,6 @@ Synchronize... Sincronizar... Synchronizing... Sincronizando... -System out of memory! -¡Sistema sin memoria! Target directory already existing! ¡El directorio de destino ya existe! Target file already existing! @@ -850,8 +858,6 @@ Time remaining: Tiempo restante: Total amount of data that will be transferred Cantidad total de datos que serán transferidos -Total required free disk space: -Espacio total de disco necesario: Total time: Tiempo total: Transfer file and directory permissions\n(Requires Administrator rights) @@ -872,14 +878,14 @@ Use Recycle Bin Utilizar Papelera de Reciclaje Use Recycle Bin when deleting or overwriting files Utilitzar Papelera de Reciclaje al eliminar o sobreescribir archivos -User-defined directory -Directorio definido por el usuario User-defined directory for deletion was not specified! ¡No se ha indicado el directorio definido por el usuario para el borrado! Variant Tipo Verifying file %x Verificación del archivo %x +Versioning +Control de versiones Volume name %x not part of filename %y! El nombre del volumen %x no es una parte del nombre de archivo %y Waiting for missing directories... @@ -888,14 +894,12 @@ Waiting while directory is locked (%x)... Esperando mientras el directorio se encuentre bloqueado (%x)... Warning Atención -Warning: Synchronization failed for %x item(s): -Atención: La sincronización falló para %x elemento(s): When the comparison is started with this option set the following decision tree is processed: Cuando la comparación se inicia con este conjunto de opciones se procesa el siguiente árbol de decisiones: You can ignore conflicts and continue synchronization. Puede ignorar conflictos y continuar con la sincronización. -You can ignore the error to consider not existing directories as empty. -Puede ignorar el error al considerar que no existen directorios vacÃos. +You can ignore this error to consider the directory as empty. +Puede ignorar este error al considerar el directorio como vacÃo. You may try to synchronize remaining items again (WITHOUT having to re-compare)! ¡Puede intentar sincronizar los elementos restantes otra vez (SIN tener que volver a comparar)! different diff --git a/BUILD/Languages/swedish.lng b/BUILD/Languages/swedish.lng index f12608ef..b245a7c9 100644 --- a/BUILD/Languages/swedish.lng +++ b/BUILD/Languages/swedish.lng @@ -154,6 +154,10 @@ <Symboliska länkar> <multiple selection> <flerval> +A directory input field is empty. +Ett katalogfält är tomt +A directory will be modified which is part of multiple folder pairs! Please review synchronization settings! +En katalog som är en del av flera katalogpar kommer att ändras! Kontrollera synkroniseringsinställningarna A newer version of FreeFileSync is available: En nyare version av FreeFileSync finns tillgänglig: Abort requested: Waiting for current operation to finish... @@ -370,6 +374,8 @@ Encoding extended time information: %x Kodar utökad tidsinformation: %x Endless loop when traversing directory: Oändlig loop vid accessförsök pÃ¥ katalog: +Equal files/folders that differ in attributes only +Lika filer/kataloger som endast skiljer sig i attribut Error Fel Error changing modification time: @@ -476,8 +482,6 @@ Files that exist on both sides, right one is newer Filer som finns pÃ¥ bÃ¥da sidor, höger är nyare Files that have different content Filer som har olika innehÃ¥ll -Files/folders that differ in attributes only -Filer/Kataloger som endast skiljer i attribut Files/folders that exist on left side only Filer/kataloger som finns pÃ¥ vänster sida enbart Files/folders that exist on right side only @@ -488,8 +492,6 @@ Filter is active Filter är aktiverat Filter settings have changed! Filterinställningar har ändrats! -Filter view -Filtervy Filter: All pairs Filter: Generella undantag Filter: Single pair @@ -506,6 +508,8 @@ Follow Följ Free disk space available: Ledigt diskutrymme: +Free disk space required: +Krav pÃ¥ ledigt diskutrymme: FreeFileSync Batch Job FreeFileSync Batch-jobb FreeFileSync at Sourceforge @@ -600,6 +604,8 @@ Integrate external applications into context menu. The following macros are avai Integrera externa program i högerklicksmeny. Följande variabler finns tillgängliga: Invalid FreeFileSync config file! Felaktig FreeFileSync konfigurationsfil! +Last used configurations (press DEL to remove from list) +Senast använda konfigurationer (Tryck DEL för att ta bort) Leave as unresolved conflict Ignorera konflikt Left @@ -608,8 +614,6 @@ Legend Förklaring Load configuration from file Hämta inställningar frÃ¥n fil -Load configuration history (press DEL to delete items) -Konfigurationshistoria (Tryck DEL för att ta bort objekt) Log-messages: Log-meddelanden: Logging @@ -620,12 +624,16 @@ Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit v Skuggkopior av wow64 stöds ej. Använd FreeFileSync x64 istället! Match case Matcha gemener/VERSALER +Maximum number of logfiles: +Max antal loggfiler: +Memory allocation failed! +Minnesallokering misslyckades! Minimum Idle Time [seconds] Minsta ledig tid [sekunder] Mirror ->> Spegla ->> -Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronization. -Speglad kopia av vänster sida: Höger sida kommer att skrivas över med en exakt kopia av vänster sida. +Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization. +Speglar säkerhetskopia av vänster katalog. Höger katalog ändras för att exakt matcha vänster efter synkroniseringen. Monitoring active... Övervakning aktiverad... More than 50% of the total number of files will be copied or deleted! @@ -696,8 +704,6 @@ Published under the GNU General Public License: Publiserad under GNU General Public License: Question FrÃ¥ga -Re-enable all hidden dialogs? -Ã…teraktivera alla dolda meddelanden? RealtimeSync - Automated Synchronization RealtimeSync - Automatiserad synkronisering RealtimeSync configuration @@ -718,6 +724,8 @@ Reset Ã…terställ Reset view Ã…terställ vy +Restore all hidden dialogs? +Vill du Ã¥terställa alla dolda dialoger? Right Höger S&ave configuration... @@ -740,6 +748,8 @@ Select logfile directory: Välj loggfilskatalog: Select variant: Välj variant: +Select view +Välj vy Set direction: Ange riktning: Setting default synchronization directions: Old files will be overwritten with newer files. @@ -828,8 +838,6 @@ Synchronize... Synkronisera Synchronizing... Synkroniserar... -System out of memory! -Systemminnet är fullt! Target directory already existing! MÃ¥lkatalogen finns redan! Target file already existing! @@ -850,8 +858,6 @@ Time remaining: Kvarvarande tid: Total amount of data that will be transferred Total mängd data som kommer att överföras -Total required free disk space: -Ledigt diskutrymme som krävs: Total time: Total tid: Transfer file and directory permissions\n(Requires Administrator rights) @@ -872,14 +878,14 @@ Use Recycle Bin Använd papperskorgen Use Recycle Bin when deleting or overwriting files Use Volume Shadow Copy Service to copy locked or shared files -User-defined directory -Användardefinierad katalog User-defined directory for deletion was not specified! Katalog för borttagning ej specifiserad! Variant Variant Verifying file %x Verifierar %x +Versioning +Versionshantering Volume name %x not part of filename %y! Volymnamn %x saknas i filnamn %y! Waiting for missing directories... @@ -888,14 +894,12 @@ Waiting while directory is locked (%x)... Väntar medan katalogen lÃ¥ses (%x)... Warning Varning -Warning: Synchronization failed for %x item(s): -Varning: Synkronisering misslyckades för %x objekt: When the comparison is started with this option set the following decision tree is processed: När jämförelse startas med detta alternativ aktiverat, processas följande beslutsträd: You can ignore conflicts and continue synchronization. Du kan ignorera konflikter och fortsätta synkroniseringen. -You can ignore the error to consider not existing directories as empty. -Du kan ignorera felet att inte betrakta befintliga kataloger som tomma. +You can ignore this error to consider the directory as empty. +Du kan bortse frÃ¥n det här felet och utgÃ¥ ifrÃ¥n att katalogen är tom You may try to synchronize remaining items again (WITHOUT having to re-compare)! Du kan försöka synkronisera Ã¥terstÃ¥ende objekt igen (utan att trycka \"Jämför\")! different diff --git a/BUILD/Languages/turkish.lng b/BUILD/Languages/turkish.lng index 0054b44e..65576d6e 100644 --- a/BUILD/Languages/turkish.lng +++ b/BUILD/Languages/turkish.lng @@ -154,6 +154,10 @@ Ge&ri yükle <SmblkbaÄŸlantı> <multiple selection> <çoklu seçim> +A directory input field is empty. +Bir klasör giriÅŸ alanı boÅŸ +A directory will be modified which is part of multiple folder pairs! Please review synchronization settings! +Çoklu klasör çiftlerinin bir parçası olduÄŸan bir klasör düzenlenecek! Lütfen eÅŸleÅŸtirme ayarlarınızı gözden geçirin! A newer version of FreeFileSync is available: FreeFileSync programının yeni bir sürümü yayınlanmış: Abort requested: Waiting for current operation to finish... @@ -370,6 +374,8 @@ Encoding extended time information: %x Uzatılmış zaman bilgisi kodlanıyor: %x Endless loop when traversing directory: Klasörlerde dolaşırken sonsuz döngü: +Equal files/folders that differ in attributes only +Yalnızca öznitelikleri farklı olan dosya ya da klasörleri eÅŸitle Error Hata Error changing modification time: @@ -476,8 +482,6 @@ Files that exist on both sides, right one is newer Her iki yanda da bulunup, saÄŸda daha yeni olan dosyalar Files that have different content Farklı içeriÄŸe sahip dosyalar -Files/folders that differ in attributes only -Yalnız öznitelikleri farklı dosya ve klasörler Files/folders that exist on left side only Yalnız sol yanda bulunan dosya ve klasörler Files/folders that exist on right side only @@ -488,8 +492,6 @@ Filter is active Etkin süzgeç Filter settings have changed! Süzgeç ayarları deÄŸiÅŸtirildi! -Filter view -Görünümü süz Filter: All pairs Süzgeç: Tüm çiftler Filter: Single pair @@ -506,6 +508,8 @@ Follow Ä°zle Free disk space available: Kullanılabilir disk alanı: +Free disk space required: +Gereken boÅŸ disk alanı: FreeFileSync Batch Job FreeFileSync Toplu Komut Ä°ÅŸi FreeFileSync at Sourceforge @@ -600,6 +604,8 @@ Integrate external applications into context menu. The following macros are avai Dış uygulamaları saÄŸ tuÅŸ menüsüne ekler. Åžu makrolar kullanılabilir: Invalid FreeFileSync config file! Geçersiz FreeFileSync yapılandırma dosyası! +Last used configurations (press DEL to remove from list) +Son kullanılan yapılandırmalar (listeden silmek için DEL tuÅŸuna basın) Leave as unresolved conflict ÇözülmemiÅŸ tutarsızlık olarak bırak Left @@ -608,8 +614,6 @@ Legend Gösterge Load configuration from file Dosyadan yapılandırmayı yükle -Load configuration history (press DEL to delete items) -GeçmiÅŸteki yapılandırmalardan yükle (Listedeki öğeleri silmek için DEL’e basın) Log-messages: Günlük iletileri: Logging @@ -620,12 +624,16 @@ Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit v WOW64 üzerinde gölge kopyalama desteklenmiyor. FreeFileSync 64-bit sürümünü kullanın Match case Büyük/küçük harf uydur +Maximum number of logfiles: +En fazla günlük dosyası sayısı: +Memory allocation failed! +Bellek ayrılamadı! Minimum Idle Time [seconds] En az boÅŸta bekleme süresi [saniye] Mirror ->> Yansı ->> -Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronization. -Sol klasörü yansıtır. Sol klasör tam olarak saÄŸ klasörün üzerine yazılır ve klasörler tümüyle eÅŸit olur. +Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization. +Sol klasörün yansı yedeÄŸi. EÅŸleÅŸtirmeden sonra saÄŸ klasör, sol klasörün tamamen aynısı olacak. Monitoring active... Ä°zleme etkin... More than 50% of the total number of files will be copied or deleted! @@ -696,8 +704,6 @@ Published under the GNU General Public License: GNU Genel Kamu Lisansına ÅŸartları altında yayınlanmıştır: Question Soru -Re-enable all hidden dialogs? -Tüm gizlenmiÅŸ iletiler yeniden görünür olsun mu? RealtimeSync - Automated Synchronization RealtimeSync - KendiliÄŸinden EÅŸleÅŸtirme RealtimeSync configuration @@ -718,6 +724,8 @@ Reset Sıfırla Reset view Görünümü sıfırla +Restore all hidden dialogs? +Tüm gizlenmiÅŸ iletiler gösterilsin mi? Right SaÄŸ S&ave configuration... @@ -740,6 +748,8 @@ Select logfile directory: Kayıt dosyası klasörünü seçin: Select variant: DeÄŸiÅŸkeni seçin: +Select view +Görünümü seçin Set direction: Yönü seçin: Setting default synchronization directions: Old files will be overwritten with newer files. @@ -828,8 +838,6 @@ Synchronize... EÅŸleÅŸtir... Synchronizing... EÅŸleÅŸtiriliyor... -System out of memory! -Sistem belleÄŸi yetersiz! Target directory already existing! Hedef klasör zaten var! Target file already existing! @@ -850,8 +858,6 @@ Time remaining: Kalan zaman: Total amount of data that will be transferred Aktarılacak toplam veri miktarı -Total required free disk space: -Toplam gereken boÅŸ disk alanı: Total time: Toplam zaman: Transfer file and directory permissions\n(Requires Administrator rights) @@ -872,14 +878,14 @@ Use Recycle Bin Geri Dönüşüm Kutusu'nu kullan Use Recycle Bin when deleting or overwriting files Dosya silme ve üzerine yazma sırasında Geri Dönüşüm Kutusu'nu kullanır -User-defined directory -Kullanıcının belirttiÄŸi klasöre taşı User-defined directory for deletion was not specified! Silme için kullanıcının belirttiÄŸi dizin belirtilmemiÅŸ! Variant DeÄŸiÅŸken Verifying file %x %x dosyası doÄŸrulanıyor +Versioning +Sürümlendirme Volume name %x not part of filename %y! %x birim adı, %y dosya adının parçası deÄŸil! Waiting for missing directories... @@ -888,14 +894,12 @@ Waiting while directory is locked (%x)... Klasör kilitli olduÄŸundan bekleniyor (%x)... Warning Uyarı -Warning: Synchronization failed for %x item(s): -Uyarı: %x öğe için eÅŸleÅŸtirme yapılamadı: When the comparison is started with this option set the following decision tree is processed: Bu seçenekle karşılaÅŸtırma yapıldığında, ÅŸu karar aÄŸacı iÅŸlenir: You can ignore conflicts and continue synchronization. ÇeliÅŸkileri yoksayıp eÅŸleÅŸtirmeyi sürdürebilirsiniz. -You can ignore the error to consider not existing directories as empty. -Bulunamayan klasörleri boÅŸ olarak kabul ederek hatayı yoksayabilirsiniz. +You can ignore this error to consider the directory as empty. +Bu hatayı, klasörü boÅŸ sayacak ÅŸekilde yok sayabilirsiniz. You may try to synchronize remaining items again (WITHOUT having to re-compare)! Kalan öğeleri yeniden eÅŸleÅŸtirmeyi deneyebilirsiniz (Tekrar kaşılaÅŸtırma yapmadan)! different diff --git a/BUILD/Resources.dat b/BUILD/Resources.dat Binary files differindex 4b617b7c..163a6572 100644 --- a/BUILD/Resources.dat +++ b/BUILD/Resources.dat diff --git a/Cleanup.cmd b/Cleanup.cmd index c224ad0b..8c0c5550 100644 --- a/Cleanup.cmd +++ b/Cleanup.cmd @@ -5,18 +5,23 @@ ::clean codeblocks garbage del FreeFileSync.layout del FreeFileSync.depend +del FreeFileSync-Linux.layout +del FreeFileSync-Linux.depend del RealtimeSync\RealtimeSync.layout del RealtimeSync\RealtimeSync.depend ::clean Visual C++ garbage +del FreeFileSync.vcxproj.user del FreeFileSync.ncb del RealtimeSync\RealtimeSync.ncb +del "FreeFileSync - wxWidgets v2.9.1 Beta.vcxproj.user" attrib FreeFileSync.suo -h del FreeFileSync.suo attrib RealtimeSync\RealtimeSync.suo -h del RealtimeSync\RealtimeSync.suo del FreeFileSync.sdf del RealtimeSync\RealtimeSync.sdf +del RealtimeSync\RealtimeSync.vcxproj.user del BUILD\FreeFileSync*.pdb del BUILD\FreeFileSync*.ilk diff --git a/FreeFileSync - wxWidgets v2.9.1 Beta.vcxproj b/FreeFileSync - wxWidgets v2.9.1 Beta.vcxproj index c201cbdf..3ccf78f5 100644 --- a/FreeFileSync - wxWidgets v2.9.1 Beta.vcxproj +++ b/FreeFileSync - wxWidgets v2.9.1 Beta.vcxproj @@ -116,7 +116,7 @@ <GenerateDebugInformation>true</GenerateDebugInformation> <SuppressStartupBanner>true</SuppressStartupBanner> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> - <AdditionalDependencies>wxmsw29ud_adv.lib;wxmsw29ud_core.lib;wxbase29ud.lib;wxpngd.lib;wxzlibd.lib;wxbase29ud_net.lib;comctl32.lib;ws2_32.lib;Rpcrt4.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>wxmsw29ud_aui.lib;wxmsw29ud_adv.lib;wxmsw29ud_core.lib;wxbase29ud.lib;wxpngd.lib;wxzlibd.lib;wxbase29ud_net.lib;comctl32.lib;ws2_32.lib;Rpcrt4.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalLibraryDirectories>C:\Programme\C++\wxWidgets-2.9.1\lib\vc_lib;C:\Program Files\C++\Boost\stage\lib</AdditionalLibraryDirectories> <LinkStatus> </LinkStatus> @@ -186,7 +186,7 @@ <EnableCOMDATFolding>true</EnableCOMDATFolding> <OptimizeReferences>true</OptimizeReferences> <SuppressStartupBanner>true</SuppressStartupBanner> - <AdditionalDependencies>wxmsw29u_adv.lib;wxmsw29u_core.lib;wxbase29u.lib;wxpng.lib;wxzlib.lib;wxbase29u_net.lib;comctl32.lib;ws2_32.lib;winmm.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>wxmsw29u_aui.lib;wxmsw29u_adv.lib;wxmsw29u_core.lib;wxbase29u.lib;wxpng.lib;wxzlib.lib;wxbase29u_net.lib;comctl32.lib;ws2_32.lib;winmm.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> <AdditionalLibraryDirectories>C:\Programme\C++\wxWidgets-2.9.1\lib\vc_lib;C:\Program Files\C++\Boost\stage\lib</AdditionalLibraryDirectories> <LinkStatus> @@ -271,6 +271,7 @@ <ClCompile Include="shared\help_provider.cpp" /> <ClCompile Include="shared\localization.cpp" /> <ClCompile Include="shared\long_path_prefix.cpp" /> + <ClCompile Include="shared\mouse_move_dlg.cpp" /> <ClCompile Include="shared\privilege.cpp" /> <ClCompile Include="shared\recycler.cpp" /> <ClCompile Include="shared\serialize.cpp" /> @@ -295,7 +296,6 @@ <ClCompile Include="ui\gui_status_handler.cpp" /> <ClCompile Include="ui\main_dlg.cpp" /> <ClCompile Include="ui\msg_popup.cpp" /> - <ClCompile Include="ui\mouse_move_dlg.cpp" /> <ClCompile Include="ui\progress_indicator.cpp" /> <ClCompile Include="ui\search.cpp" /> <ClCompile Include="ui\small_dlgs.cpp" /> diff --git a/FreeFileSync.cbp b/FreeFileSync.cbp index 17baf847..39e2a15c 100644 --- a/FreeFileSync.cbp +++ b/FreeFileSync.cbp @@ -29,7 +29,7 @@ <Add library="libwxpng.a" /> <Add library="libwxzlib.a" /> <Add library="libwxbase28u_net.a" /> - <Add library="libboost_thread-mgw45-mt-s-1_45.a" /> + <Add library="libboost_thread-mgw45-mt-s-1_46_1.a" /> <Add directory="C:\Programme\C++\wxWidgets\lib\gcc_lib" /> </Linker> </Target> @@ -55,7 +55,7 @@ <Add library="libwxbase28ud.a" /> <Add library="libwxpngd.a" /> <Add library="libwxzlibd.a" /> - <Add library="libboost_thread-mgw45-mt-sd-1_45.a" /> + <Add library="libboost_thread-mgw45-mt-sd-1_46_1.a" /> <Add directory="C:\Programme\C++\wxWidgets\lib\gcc_dll" /> </Linker> </Target> @@ -79,7 +79,7 @@ <Add library="libwxbase28ud.a" /> <Add library="libwxbase28ud_net.a" /> <Add library="libwxmsw28ud_aui.a" /> - <Add library="libboost_thread-mgw45-mt-sd-1_45.a" /> + <Add library="libboost_thread-mgw45-mt-sd-1_46_1.a" /> <Add directory="C:\Programme\C++\wxWidgets\lib\gcc_dll" /> </Linker> </Target> @@ -295,6 +295,10 @@ <Unit filename="shared\localization.h" /> <Unit filename="shared\long_path_prefix.cpp" /> <Unit filename="shared\long_path_prefix.h" /> + <Unit filename="shared\mouse_move_dlg.cpp"> + <Option target="Release" /> + <Option target="Debug-DLL" /> + </Unit> <Unit filename="shared\privilege.cpp" /> <Unit filename="shared\privilege.h" /> <Unit filename="shared\recycler.cpp" /> @@ -398,8 +402,6 @@ <Unit filename="ui\main_dlg.h"> <Option target="<{~None~}>" /> </Unit> - <Unit filename="ui\mouse_move_dlg.cpp" /> - <Unit filename="ui\mouse_move_dlg.h" /> <Unit filename="ui\msg_popup.cpp"> <Option target="Release" /> <Option target="Debug-DLL" /> diff --git a/FreeFileSync.vcxproj b/FreeFileSync.vcxproj index 5fd7ed8a..d0fcb00e 100644 --- a/FreeFileSync.vcxproj +++ b/FreeFileSync.vcxproj @@ -273,6 +273,7 @@ <ClCompile Include="shared\help_provider.cpp" /> <ClCompile Include="shared\localization.cpp" /> <ClCompile Include="shared\long_path_prefix.cpp" /> + <ClCompile Include="shared\mouse_move_dlg.cpp" /> <ClCompile Include="shared\privilege.cpp" /> <ClCompile Include="shared\recycler.cpp" /> <ClCompile Include="shared\serialize.cpp" /> @@ -297,7 +298,6 @@ <ClCompile Include="ui\gui_status_handler.cpp" /> <ClCompile Include="ui\main_dlg.cpp" /> <ClCompile Include="ui\msg_popup.cpp" /> - <ClCompile Include="ui\mouse_move_dlg.cpp" /> <ClCompile Include="ui\progress_indicator.cpp" /> <ClCompile Include="ui\search.cpp" /> <ClCompile Include="ui\small_dlgs.cpp" /> diff --git a/RealtimeSync/RealtimeSync.cbp b/RealtimeSync/RealtimeSync.cbp index 3bf0f88e..cfbdc19e 100644 --- a/RealtimeSync/RealtimeSync.cbp +++ b/RealtimeSync/RealtimeSync.cbp @@ -27,7 +27,7 @@ <Add library="libwxbase28u.a" /> <Add library="libwxpng.a" /> <Add library="libwxzlib.a" /> - <Add library="libboost_thread-mgw45-mt-s-1_45.a" /> + <Add library="libboost_thread-mgw45-mt-s-1_46_1.a" /> <Add directory="C:\Programme\C++\wxWidgets\lib\gcc_lib" /> </Linker> </Target> @@ -51,7 +51,7 @@ <Add library="libwxbase28ud.a" /> <Add library="libwxpngd.a" /> <Add library="libwxzlibd.a" /> - <Add library="libboost_thread-mgw45-mt-sd-1_45.a" /> + <Add library="libboost_thread-mgw45-mt-sd-1_46_1.a" /> <Add directory="C:\Program Files\C++\wxWidgets\lib\gcc_dll" /> </Linker> </Target> @@ -144,6 +144,7 @@ <Unit filename="..\shared\localization.h" /> <Unit filename="..\shared\long_path_prefix.cpp" /> <Unit filename="..\shared\long_path_prefix.h" /> + <Unit filename="..\shared\mouse_move_dlg.cpp" /> <Unit filename="..\shared\privilege.cpp" /> <Unit filename="..\shared\shadow.cpp" /> <Unit filename="..\shared\standard_paths.cpp" /> diff --git a/RealtimeSync/RealtimeSync.ico b/RealtimeSync/RealtimeSync.ico Binary files differindex 8e4e556e..d9fc30ac 100644 --- a/RealtimeSync/RealtimeSync.ico +++ b/RealtimeSync/RealtimeSync.ico diff --git a/RealtimeSync/RealtimeSync.vcxproj b/RealtimeSync/RealtimeSync.vcxproj index e16e892f..c250a421 100644 --- a/RealtimeSync/RealtimeSync.vcxproj +++ b/RealtimeSync/RealtimeSync.vcxproj @@ -238,6 +238,7 @@ <ClCompile Include="..\shared\help_provider.cpp" /> <ClCompile Include="..\shared\localization.cpp" /> <ClCompile Include="..\shared\long_path_prefix.cpp" /> + <ClCompile Include="..\shared\mouse_move_dlg.cpp" /> <ClCompile Include="..\shared\privilege.cpp" /> <ClCompile Include="..\shared\shadow.cpp" /> <ClCompile Include="..\shared\standard_paths.cpp" /> diff --git a/RealtimeSync/application.cpp b/RealtimeSync/application.cpp index 55e46fc6..dffd8970 100644 --- a/RealtimeSync/application.cpp +++ b/RealtimeSync/application.cpp @@ -24,10 +24,10 @@ IMPLEMENT_APP(Application); bool Application::OnInit() { -//do not call wxApp::OnInit() to avoid using default commandline parser + //do not call wxApp::OnInit() to avoid using default commandline parser -//Note: initialization is done in the FIRST idle event instead of OnInit. Reason: Commandline mode requires the wxApp eventhandler to be established -//for UI update events. This is not the case at the time of OnInit(). + //Note: initialization is done in the FIRST idle event instead of OnInit. Reason: Commandline mode requires the wxApp eventhandler to be established + //for UI update events. This is not the case at the time of OnInit(). Connect(wxEVT_IDLE, wxIdleEventHandler(Application::OnStartApplication), NULL, this); return true; diff --git a/RealtimeSync/main_dlg.cpp b/RealtimeSync/main_dlg.cpp index d832b0aa..a1db4b74 100644 --- a/RealtimeSync/main_dlg.cpp +++ b/RealtimeSync/main_dlg.cpp @@ -22,11 +22,12 @@ #include "../shared/build_info.h" #include "../shared/help_provider.h" #include "../shared/util.h" +#include "../shared/mouse_move_dlg.h" using namespace ffs3; -MainDialog::MainDialog(wxDialog *dlg, const wxString& cfgFileName) +MainDialog::MainDialog(wxDialog* dlg, const wxString& cfgFileName) : MainDlgGenerated(dlg) { wxWindowUpdateLocker dummy(this); //avoid display distortion @@ -44,6 +45,13 @@ MainDialog::MainDialog(wxDialog *dlg, const wxString& cfgFileName) //prepare drag & drop dirNameFirst.reset(new ffs3::DirectoryName(m_panelMainFolder, m_dirPickerMain, m_txtCtrlDirectoryMain)); + +#ifdef FFS_WIN + new MouseMoveWindow(*this, //allow moving main dialog by clicking (nearly) anywhere... + m_panelMain); //ownership passed to "this" +#endif + + //--------------------------- load config values ------------------------------------ xmlAccess::XmlRealConfig newConfig; @@ -99,13 +107,13 @@ MainDialog::~MainDialog() } -void MainDialog::OnClose(wxCloseEvent &event) +void MainDialog::OnClose(wxCloseEvent& event) { Destroy(); } -void MainDialog::OnQuit(wxCommandEvent &event) +void MainDialog::OnQuit(wxCommandEvent& event) { Destroy(); } @@ -172,15 +180,15 @@ void MainDialog::OnStart(wxCommandEvent& event) switch (rts::startDirectoryMonitor(currentCfg, ffs3::extractJobName(currentConfigFileName))) { - case rts::QUIT: - { - Destroy(); - return; - } - break; - - case rts::RESUME: + case rts::QUIT: + { + Destroy(); + return; + } break; + + case rts::RESUME: + break; } Show(); @@ -256,7 +264,7 @@ void MainDialog::setLastUsedConfig(const wxString& filename) } else { - SetTitle(wxString(wxT("RealtimeSync - ")) + filename); + SetTitle(filename); currentConfigFileName = filename; } } @@ -265,8 +273,8 @@ void MainDialog::setLastUsedConfig(const wxString& filename) void MainDialog::OnLoadConfig(wxCommandEvent& event) { wxFileDialog* filePicker = new wxFileDialog(this, wxEmptyString, wxEmptyString, wxEmptyString, - wxString(_("RealtimeSync configuration")) + wxT(" (*.ffs_real;*.ffs_batch)|*.ffs_real;*.ffs_batch"), - wxFD_OPEN); + wxString(_("RealtimeSync configuration")) + wxT(" (*.ffs_real;*.ffs_batch)|*.ffs_real;*.ffs_batch"), + wxFD_OPEN); if (filePicker->ShowModal() == wxID_OK) loadConfig(filePicker->GetPath()); } diff --git a/RealtimeSync/main_dlg.h b/RealtimeSync/main_dlg.h index 7f052e39..a6d2c935 100644 --- a/RealtimeSync/main_dlg.h +++ b/RealtimeSync/main_dlg.h @@ -44,7 +44,7 @@ private: class MainDialog: public MainDlgGenerated { public: - MainDialog(wxDialog *dlg, const wxString& cfgFileName); + MainDialog(wxDialog* dlg, const wxString& cfgFileName); ~MainDialog(); void loadConfig(const wxString& filename); diff --git a/RealtimeSync/notify.cpp b/RealtimeSync/notify.cpp index 182b7cd0..8029da6f 100644 --- a/RealtimeSync/notify.cpp +++ b/RealtimeSync/notify.cpp @@ -199,7 +199,7 @@ public: { const DWORD lastError = ::GetLastError(); if (lastError != ERROR_CALL_NOT_IMPLEMENTED && //fail on SAMBA share: this shouldn't be a showstopper! - lastError != ERROR_SERVICE_SPECIFIC_ERROR) //neither should be fail for "Pogoplug" mapped network drives + lastError != ERROR_SERVICE_SPECIFIC_ERROR) //neither should be fail for "Pogoplug" mapped network drives throw ffs3::FileError(wxString(wxT("Could not register device removal notifications:")) + wxT("\n\n") + ffs3::getLastErrorFormatted(lastError)); } else @@ -243,15 +243,15 @@ private: if (notifications.find(requestNotification) != notifications.end()) //is it for one of our notifications we registered? switch (wParam) { - case DBT_DEVICEQUERYREMOVE: - parent_.onRequestRemoval(body->dbch_handle); - break; - case DBT_DEVICEQUERYREMOVEFAILED: - parent_.onRemovalFinished(body->dbch_handle, false); - break; - case DBT_DEVICEREMOVECOMPLETE: - parent_.onRemovalFinished(body->dbch_handle, true); - break; + case DBT_DEVICEQUERYREMOVE: + parent_.onRequestRemoval(body->dbch_handle); + break; + case DBT_DEVICEQUERYREMOVEFAILED: + parent_.onRemovalFinished(body->dbch_handle, false); + break; + case DBT_DEVICEREMOVECOMPLETE: + parent_.onRemovalFinished(body->dbch_handle, true); + break; } } } diff --git a/RealtimeSync/notify.h b/RealtimeSync/notify.h index 1f7a204a..47f6c3cb 100644 --- a/RealtimeSync/notify.h +++ b/RealtimeSync/notify.h @@ -8,7 +8,7 @@ #define NOTIFY_H_INCLUDED #ifndef FFS_WIN -use in windows build only +#error use in windows build only #endif #include <wx/msw/wrapwin.h> //includes "windows.h" diff --git a/RealtimeSync/pch.h b/RealtimeSync/pch.h index 9894b1c5..b3412782 100644 --- a/RealtimeSync/pch.h +++ b/RealtimeSync/pch.h @@ -12,18 +12,18 @@ do NOT use in release build! #endif -//##################################################### -// basic wxWidgets headers + //##################################################### + // basic wxWidgets headers #ifndef WX_PRECOMP #define WX_PRECOMP #endif #include <wx/wxprec.h> -//##################################################### -// #include other rarely changing headers here + //##################################################### + // #include other rarely changing headers here -//STL headers + //STL headers #include <string> #include <algorithm> #include <vector> @@ -38,7 +38,7 @@ do NOT use in release build! #include <utime.h> #endif //FFS_LINUX -//other wxWidgets headers + //other wxWidgets headers #include <wx/grid.h> #include <wx/animate.h> #include <wx/app.h> @@ -91,13 +91,13 @@ do NOT use in release build! #include <wx/scrolwin.h> #include <wx/notebook.h> -//other + //other #include "../shared/tinyxml/tinyxml.h" #include <sys/stat.h> #ifdef FFS_WIN #include <wx/msw/wrapwin.h> //includes "windows.h" #endif //FFS_WIN -//##################################################### + //##################################################### #endif //RTS_PRECOMPILED_HEADER
\ No newline at end of file diff --git a/RealtimeSync/resources.cpp b/RealtimeSync/resources.cpp index f966d4fa..64de4700 100644 --- a/RealtimeSync/resources.cpp +++ b/RealtimeSync/resources.cpp @@ -80,8 +80,8 @@ void GlobalResources::load() const const wxBitmap& GlobalResources::getImageByName(const wxString& imageName) const { const std::map<wxString, wxBitmap*>::const_iterator bmp = imageName.Find(wxChar('.')) == wxNOT_FOUND ? //assume .png ending if nothing else specified - bitmapResource.find(imageName + wxT(".png")) : - bitmapResource.find(imageName); + bitmapResource.find(imageName + wxT(".png")) : + bitmapResource.find(imageName); if (bmp != bitmapResource.end()) return *bmp->second; diff --git a/RealtimeSync/tray_menu.cpp b/RealtimeSync/tray_menu.cpp index c85df169..4123664c 100644 --- a/RealtimeSync/tray_menu.cpp +++ b/RealtimeSync/tray_menu.cpp @@ -172,36 +172,36 @@ void TrayIconHolder::OnContextMenuSelection(wxCommandEvent& event) const int eventId = event.GetId(); switch (static_cast<Selection>(eventId)) { - case CONTEXT_ABORT: - requestAbort(); - break; - case CONTEXT_RESTORE: - OnRequestResume(event); //just remember: never throw exceptions through a C-Layer (GUI) ;) - break; - case CONTEXT_ABOUT: - { - //build information - wxString build = __TDATE__; + case CONTEXT_ABORT: + requestAbort(); + break; + case CONTEXT_RESTORE: + OnRequestResume(event); //just remember: never throw exceptions through a C-Layer (GUI) ;) + break; + case CONTEXT_ABOUT: + { + //build information + wxString build = __TDATE__; #if wxUSE_UNICODE - build += wxT(" - Unicode"); + build += wxT(" - Unicode"); #else - build += wxT(" - ANSI"); + build += wxT(" - ANSI"); #endif //wxUSE_UNICODE - //compile time info about 32/64-bit build - if (util::is64BitBuild) - build += wxT(" x64"); - else - build += wxT(" x86"); - assert_static(util::is32BitBuild || util::is64BitBuild); + //compile time info about 32/64-bit build + if (util::is64BitBuild) + build += wxT(" x64"); + else + build += wxT(" x86"); + assert_static(util::is32BitBuild || util::is64BitBuild); - wxString buildFormatted = _("(Build: %x)"); - buildFormatted.Replace(wxT("%x"), build); + wxString buildFormatted = _("(Build: %x)"); + buildFormatted.Replace(wxT("%x"), build); - wxMessageDialog aboutDlg(NULL, wxString(wxT("RealtimeSync")) + wxT("\n\n") + buildFormatted, _("About"), wxOK); - aboutDlg.ShowModal(); - } - break; + wxMessageDialog aboutDlg(NULL, wxString(wxT("RealtimeSync")) + wxT("\n\n") + buildFormatted, _("About"), wxOK); + aboutDlg.ShowModal(); + } + break; } } @@ -322,14 +322,14 @@ rts::MonitorResponse rts::startDirectoryMonitor(const xmlAccess::XmlRealConfig& //wait for changes (and for all directories to become available) switch (waitForChanges(dirList, &callback)) { - case CHANGE_DIR_MISSING: //don't execute the commandline before all directories are available! - callback.scheduleNextSync(std::numeric_limits<long>::max()); //next sync not scheduled (yet) - callback.notifyDirectoryMissing(); - waitForMissingDirs(dirList, &callback); - callback.notifyAllDirectoriesExist(); - break; - case CHANGE_DETECTED: - break; + case CHANGE_DIR_MISSING: //don't execute the commandline before all directories are available! + callback.scheduleNextSync(std::numeric_limits<long>::max()); //next sync not scheduled (yet) + callback.notifyDirectoryMissing(); + waitForMissingDirs(dirList, &callback); + callback.notifyAllDirectoriesExist(); + break; + case CHANGE_DETECTED: + break; } callback.scheduleNextSync(wxGetLocalTime() + static_cast<long>(config.delay)); diff --git a/RealtimeSync/watcher.cpp b/RealtimeSync/watcher.cpp index 029b2d00..d28c4488 100644 --- a/RealtimeSync/watcher.cpp +++ b/RealtimeSync/watcher.cpp @@ -19,6 +19,8 @@ #include <wx/msw/wrapwin.h> //includes "windows.h" #include "../shared/long_path_prefix.h" #include <boost/shared_ptr.hpp> +#include "../shared/loki/ScopeGuard.h" +#include <boost/scoped_array.hpp> #elif defined FFS_LINUX #include "../shared/inotify/inotify-cxx.h" @@ -110,8 +112,73 @@ private: }; + rts::WaitResult rts::waitForChanges(const std::vector<Zstring>& dirNames, WaitCallback* statusHandler) //throw(FileError) { + /* + #warning cleanup + { + const Zstring formattedDir = ffs3::getFormattedDirectoryName(dirNames.front()); + + //SE_BACKUP_NAME and SE_RESTORE_NAME <- required by FILE_FLAG_BACKUP_SEMANTICS??? + + //open the directory to watch.... + HANDLE hDir = ::CreateFile(ffs3::applyLongPathPrefix(formattedDir).c_str(), + FILE_LIST_DIRECTORY, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, //leaving out last flag may prevent files to be deleted WITHIN monitored dir (http://qualapps.blogspot.com/2010/05/understanding-readdirectorychangesw_19.html) + NULL, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, + NULL); + if (hDir == INVALID_HANDLE_VALUE) + { + const DWORD lastError = ::GetLastError(); + if ( lastError == ERROR_FILE_NOT_FOUND || //no need to check this condition any earlier! + lastError == ERROR_BAD_NETPATH) // + return CHANGE_DIR_MISSING; + + const wxString errorMessage = wxString(_("Could not initialize directory monitoring:")) + wxT("\n\"") + zToWx(formattedDir) + wxT("\""); + throw ffs3::FileError(errorMessage + wxT("\n\n") + ffs3::getLastErrorFormatted()); + } + + Loki::ScopeGuard dummy = Loki::MakeGuard(::CloseHandle, hDir); + (void)dummy; //silence warning "unused variable" + + + const size_t bufferSize = sizeof(FILE_NOTIFY_INFORMATION); + boost::scoped_array<char> tmp(new char[bufferSize]); + FILE_NOTIFY_INFORMATION& notifyInfo = reinterpret_cast<FILE_NOTIFY_INFORMATION&>(*tmp.get()); + + DWORD bytesWritten = 0; + + if (!::ReadDirectoryChangesW( + hDir, //__in HANDLE hDirectory, + ¬ifyInfo, //__out LPVOID lpBuffer, + bufferSize, //__in DWORD nBufferLength, + true, //__in BOOL bWatchSubtree, + FILE_NOTIFY_CHANGE_FILE_NAME | //__in DWORD dwNotifyFilter, + FILE_NOTIFY_CHANGE_DIR_NAME | + FILE_NOTIFY_CHANGE_SIZE | + FILE_NOTIFY_CHANGE_LAST_WRITE, + &bytesWritten, //__out_opt LPDWORD lpBytesReturned, + NULL, //__inout_opt LPOVERLAPPED lpOverlapped, + NULL)) //__in_opt LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine + { + const wxString errorMessage = wxString(_("Could not initialize directory monitoring:")) + wxT("\n\"") + zToWx(formattedDir) + wxT("\""); + throw ffs3::FileError(errorMessage + wxT("\n\n") + ffs3::getLastErrorFormatted()); + } + return CHANGE_DETECTED; + } + */ + + + + + + + + + if (dirNames.empty()) //pathological case, but check is needed nevertheless throw ffs3::FileError(_("At least one directory input field is empty.")); @@ -146,7 +213,7 @@ rts::WaitResult rts::waitForChanges(const std::vector<Zstring>& dirNames, WaitCa lastError == ERROR_BAD_NETPATH) // return CHANGE_DIR_MISSING; - const wxString errorMessage = wxString(_("Could not initialize directory monitoring:")) + wxT("\n\"") + zToWx(*i) + wxT("\""); + const wxString errorMessage = wxString(_("Could not initialize directory monitoring:")) + wxT("\n\"") + zToWx(formattedDir) + wxT("\""); throw ffs3::FileError(errorMessage + wxT("\n\n") + ffs3::getLastErrorFormatted()); } diff --git a/RealtimeSync/xml_ffs.cpp b/RealtimeSync/xml_ffs.cpp index be798efc..1c98cc57 100644 --- a/RealtimeSync/xml_ffs.cpp +++ b/RealtimeSync/xml_ffs.cpp @@ -45,21 +45,23 @@ xmlAccess::XmlRealConfig convertBatchToReal(const xmlAccess::XmlBatchConfig& bat //additional folders for (std::vector<ffs3::FolderPairEnh>::const_iterator i = batchCfg.mainCfg.additionalPairs.begin(); - i != batchCfg.mainCfg.additionalPairs.end(); ++i) + i != batchCfg.mainCfg.additionalPairs.end(); ++i) { uniqueFolders.insert(zToWx(i->leftDirectory)); uniqueFolders.insert(zToWx(i->rightDirectory)); } + uniqueFolders.erase(wxString()); + output.directories.insert(output.directories.end(), uniqueFolders.begin(), uniqueFolders.end()); - output.commandline = ffs3::getBinaryDir() + + output.commandline = wxT("\"") + ffs3::getBinaryDir() + #ifdef FFS_WIN wxT("FreeFileSync.exe") + #elif defined FFS_LINUX wxT("FreeFileSync") + #endif - wxT(" \"") + filename + wxT("\""); + wxT("\" \"") + filename + wxT("\""); return output; } diff --git a/algorithm.cpp b/algorithm.cpp index ec3944ee..85c557b3 100644 --- a/algorithm.cpp +++ b/algorithm.cpp @@ -84,36 +84,36 @@ private: { switch (fileObj.getCategory()) { - case FILE_LEFT_SIDE_ONLY: - if (fileObj.getFullName<LEFT_SIDE>().EndsWith(ffs3::TEMP_FILE_ENDING)) - fileObj.setSyncDir(SYNC_DIR_LEFT); //schedule potentially existing temporary files for deletion - else - fileObj.setSyncDir(config.exLeftSideOnly); - break; - case FILE_RIGHT_SIDE_ONLY: - if (fileObj.getFullName<RIGHT_SIDE>().EndsWith(ffs3::TEMP_FILE_ENDING)) - fileObj.setSyncDir(SYNC_DIR_RIGHT); //schedule potentially existing temporary files for deletion - else - fileObj.setSyncDir(config.exRightSideOnly); - break; - case FILE_RIGHT_NEWER: - fileObj.setSyncDir(config.rightNewer); - break; - case FILE_LEFT_NEWER: - fileObj.setSyncDir(config.leftNewer); - break; - case FILE_DIFFERENT: - fileObj.setSyncDir(config.different); - break; - case FILE_CONFLICT: - fileObj.setSyncDir(config.conflict); - break; - case FILE_EQUAL: - fileObj.setSyncDir(SYNC_DIR_NONE); - break; - case FILE_DIFFERENT_METADATA: - fileObj.setSyncDir(config.conflict); //use setting from "conflict/cannot categorize" - break; + case FILE_LEFT_SIDE_ONLY: + if (fileObj.getFullName<LEFT_SIDE>().EndsWith(ffs3::TEMP_FILE_ENDING)) + fileObj.setSyncDir(SYNC_DIR_LEFT); //schedule potentially existing temporary files for deletion + else + fileObj.setSyncDir(config.exLeftSideOnly); + break; + case FILE_RIGHT_SIDE_ONLY: + if (fileObj.getFullName<RIGHT_SIDE>().EndsWith(ffs3::TEMP_FILE_ENDING)) + fileObj.setSyncDir(SYNC_DIR_RIGHT); //schedule potentially existing temporary files for deletion + else + fileObj.setSyncDir(config.exRightSideOnly); + break; + case FILE_RIGHT_NEWER: + fileObj.setSyncDir(config.rightNewer); + break; + case FILE_LEFT_NEWER: + fileObj.setSyncDir(config.leftNewer); + break; + case FILE_DIFFERENT: + fileObj.setSyncDir(config.different); + break; + case FILE_CONFLICT: + fileObj.setSyncDir(config.conflict); + break; + case FILE_EQUAL: + fileObj.setSyncDir(SYNC_DIR_NONE); + break; + case FILE_DIFFERENT_METADATA: + fileObj.setSyncDir(config.conflict); //use setting from "conflict/cannot categorize" + break; } } @@ -121,30 +121,30 @@ private: { switch (linkObj.getLinkCategory()) { - case SYMLINK_LEFT_SIDE_ONLY: - linkObj.setSyncDir(config.exLeftSideOnly); - break; - case SYMLINK_RIGHT_SIDE_ONLY: - linkObj.setSyncDir(config.exRightSideOnly); - break; - case SYMLINK_LEFT_NEWER: - linkObj.setSyncDir(config.leftNewer); - break; - case SYMLINK_RIGHT_NEWER: - linkObj.setSyncDir(config.rightNewer); - break; - case SYMLINK_CONFLICT: - linkObj.setSyncDir(config.conflict); - break; - case SYMLINK_DIFFERENT: - linkObj.setSyncDir(config.different); - break; - case SYMLINK_EQUAL: - linkObj.setSyncDir(SYNC_DIR_NONE); - break; - case SYMLINK_DIFFERENT_METADATA: - linkObj.setSyncDir(config.conflict); //use setting from "conflict/cannot categorize" - break; + case SYMLINK_LEFT_SIDE_ONLY: + linkObj.setSyncDir(config.exLeftSideOnly); + break; + case SYMLINK_RIGHT_SIDE_ONLY: + linkObj.setSyncDir(config.exRightSideOnly); + break; + case SYMLINK_LEFT_NEWER: + linkObj.setSyncDir(config.leftNewer); + break; + case SYMLINK_RIGHT_NEWER: + linkObj.setSyncDir(config.rightNewer); + break; + case SYMLINK_CONFLICT: + linkObj.setSyncDir(config.conflict); + break; + case SYMLINK_DIFFERENT: + linkObj.setSyncDir(config.different); + break; + case SYMLINK_EQUAL: + linkObj.setSyncDir(SYNC_DIR_NONE); + break; + case SYMLINK_DIFFERENT_METADATA: + linkObj.setSyncDir(config.conflict); //use setting from "conflict/cannot categorize" + break; } } @@ -153,18 +153,18 @@ private: { switch (dirObj.getDirCategory()) { - case DIR_LEFT_SIDE_ONLY: - dirObj.setSyncDir(config.exLeftSideOnly); - break; - case DIR_RIGHT_SIDE_ONLY: - dirObj.setSyncDir(config.exRightSideOnly); - break; - case DIR_EQUAL: - dirObj.setSyncDir(SYNC_DIR_NONE); - break; - case DIR_DIFFERENT_METADATA: - dirObj.setSyncDir(config.conflict); //use setting from "conflict/cannot categorize" - break; + case DIR_LEFT_SIDE_ONLY: + dirObj.setSyncDir(config.exLeftSideOnly); + break; + case DIR_RIGHT_SIDE_ONLY: + dirObj.setSyncDir(config.exRightSideOnly); + break; + case DIR_EQUAL: + dirObj.setSyncDir(SYNC_DIR_NONE); + break; + case DIR_DIFFERENT_METADATA: + dirObj.setSyncDir(config.conflict); //use setting from "conflict/cannot categorize" + break; } //recursion @@ -528,20 +528,20 @@ public: { switch (fsObj.getSyncOperation()) { - case SO_CREATE_NEW_LEFT: - case SO_CREATE_NEW_RIGHT: - case SO_UNRESOLVED_CONFLICT: - return true; - - case SO_DELETE_LEFT: - case SO_DELETE_RIGHT: - case SO_OVERWRITE_LEFT: - case SO_OVERWRITE_RIGHT: - case SO_DO_NOTHING: - case SO_EQUAL: - case SO_COPY_METADATA_TO_LEFT: - case SO_COPY_METADATA_TO_RIGHT: - ; + case SO_CREATE_NEW_LEFT: + case SO_CREATE_NEW_RIGHT: + case SO_UNRESOLVED_CONFLICT: + return true; + + case SO_DELETE_LEFT: + case SO_DELETE_RIGHT: + case SO_OVERWRITE_LEFT: + case SO_OVERWRITE_RIGHT: + case SO_DO_NOTHING: + case SO_EQUAL: + case SO_COPY_METADATA_TO_LEFT: + case SO_COPY_METADATA_TO_RIGHT: + ; } return false; } @@ -568,8 +568,8 @@ public: //try to load sync-database files std::pair<DirInfoPtr, DirInfoPtr> dirInfo = loadDBFile(baseDirectory); - if ( dirInfo.first.get() == NULL || - dirInfo.second.get() == NULL) + if (dirInfo.first.get() == NULL || + dirInfo.second.get() == NULL) { //use standard settings: SyncConfiguration defaultSync; @@ -725,11 +725,11 @@ private: fileObj.setSyncDirConflict(txtBothSidesChanged); //set syncDir = SYNC_DIR_INT_CONFLICT else { -// if (cat == FILE_LEFT_SIDE_ONLY) -// fileObj.setSyncDir(SYNC_DIR_RIGHT); -// else if (cat == FILE_RIGHT_SIDE_ONLY) -// fileObj.setSyncDir(SYNC_DIR_LEFT); -// else + // if (cat == FILE_LEFT_SIDE_ONLY) + // fileObj.setSyncDir(SYNC_DIR_RIGHT); + // else if (cat == FILE_RIGHT_SIDE_ONLY) + // fileObj.setSyncDir(SYNC_DIR_LEFT); + // else fileObj.setSyncDirConflict(txtLastSyncFail); //set syncDir = SYNC_DIR_INT_CONFLICT } } @@ -859,17 +859,17 @@ private: dirObj.setSyncDirConflict(txtBothSidesChanged); //set syncDir = SYNC_DIR_INT_CONFLICT else { -// switch (cat) -// { -// case DIR_LEFT_SIDE_ONLY: -// dirObj.setSyncDir(SYNC_DIR_RIGHT); -// break; -// case DIR_RIGHT_SIDE_ONLY: -// dirObj.setSyncDir(SYNC_DIR_LEFT); -// break; -// case DIR_EQUAL: -// assert(false); -// } + // switch (cat) + // { + // case DIR_LEFT_SIDE_ONLY: + // dirObj.setSyncDir(SYNC_DIR_RIGHT); + // break; + // case DIR_RIGHT_SIDE_ONLY: + // dirObj.setSyncDir(SYNC_DIR_LEFT); + // break; + // case DIR_EQUAL: + // assert(false); + // } dirObj.setSyncDirConflict(txtLastSyncFail); //set syncDir = SYNC_DIR_INT_CONFLICT } @@ -881,8 +881,8 @@ private: //if a directory is to be deleted on one side, ensure that directions of sub-elements are "d’accord" const SyncOperation syncOp = dirObj.getSyncOperation(); - if ( syncOp == SO_DELETE_LEFT || - syncOp == SO_DELETE_RIGHT) + if (syncOp == SO_DELETE_LEFT || + syncOp == SO_DELETE_RIGHT) { if (FindDeleteDirConflictNonRec().conflictFound(dirObj)) dirObj.setSyncDirConflict(txtDirDeleteConflict); @@ -1055,24 +1055,25 @@ void ffs3::setActiveStatus(bool newStatus, ffs3::FolderComparison& folderCmp) void ffs3::setActiveStatus(bool newStatus, ffs3::FileSystemObject& fsObj) { fsObj.setActive(newStatus); - -//process subdirectories also! - struct Recurse: public FSObjectVisitor - { - Recurse(bool newStat) : newStatus_(newStat) {} - virtual void visit(const FileMapping& fileObj) {} - virtual void visit(const SymLinkMapping& linkObj) {} - virtual void visit(const DirMapping& dirObj) + /* + //process subdirectories also! + struct Recurse: public FSObjectVisitor { - if (newStatus_) - InOrExcludeAllRows<true>().execute(const_cast<DirMapping&>(dirObj)); //object is not physically const here anyway - else - InOrExcludeAllRows<false>().execute(const_cast<DirMapping&>(dirObj)); // - } - private: - const bool newStatus_; - } recurse(newStatus); - fsObj.accept(recurse); + Recurse(bool newStat) : newStatus_(newStat) {} + virtual void visit(const FileMapping& fileObj) {} + virtual void visit(const SymLinkMapping& linkObj) {} + virtual void visit(const DirMapping& dirObj) + { + if (newStatus_) + InOrExcludeAllRows<true>().execute(const_cast<DirMapping&>(dirObj)); //object is not physically const here anyway + else + InOrExcludeAllRows<false>().execute(const_cast<DirMapping&>(dirObj)); // + } + private: + const bool newStatus_; + } recurse(newStatus); + fsObj.accept(recurse); + */ } namespace @@ -1184,9 +1185,9 @@ void ffs3::applyFiltering(const MainConfiguration& currentMainCfg, FolderCompari BaseDirMapping& baseDirectory = folderCmp[i - allPairs.begin()]; FilterData<STRATEGY_ALL>(*combineFilters(globalFilter, - BaseFilter::FilterRef(new NameFilter( - i->localFilter.includeFilter, - i->localFilter.excludeFilter)))).execute(baseDirectory); + BaseFilter::FilterRef(new NameFilter( + i->localFilter.includeFilter, + i->localFilter.excludeFilter)))).execute(baseDirectory); } } @@ -1305,12 +1306,12 @@ void deleteFromGridAndHDOneSide(std::vector<FileSystemObject*>& rowsToDeleteOneS { switch (linkObj.getLinkType<side>()) { - case LinkDescriptor::TYPE_DIR: - ffs3::removeDirectory(linkObj.getFullName<side>(), NULL); - break; - case LinkDescriptor::TYPE_FILE: - ffs3::removeFile(linkObj.getFullName<side>()); - break; + case LinkDescriptor::TYPE_DIR: + ffs3::removeDirectory(linkObj.getFullName<side>(), NULL); + break; + case LinkDescriptor::TYPE_FILE: + ffs3::removeFile(linkObj.getFullName<side>()); + break; } } @@ -1493,7 +1494,7 @@ void ffs3::checkForDSTChange(const FileCompareResult& gridData, const FileDescrLine& leftFile = j->fileDescrLeft; const FileDescrLine& rightFile = j->fileDescrRight; - if ( leftFile.objType == FileDescrLine::TYPE_FILE && rightFile.objType == FileDescrLine::TYPE_FILE && + if (leftFile.objType == FileDescrLine::TYPE_FILE && rightFile.objType == FileDescrLine::TYPE_FILE && leftFile.fileSize == rightFile.fileSize && leftFile.directory.CmpNoCase(i->leftDirectory.c_str()) == 0 && //Windows does NOT distinguish between upper/lower-case rightFile.directory.CmpNoCase(i->rightDirectory.c_str()) == 0) // diff --git a/algorithm.h b/algorithm.h index 4e3a5e83..2e642f63 100644 --- a/algorithm.h +++ b/algorithm.h @@ -33,7 +33,7 @@ void applyFiltering(const MainConfiguration& currentMainCfg, FolderComparison& f void addExcludeFiltering(const Zstring& excludeFilter, FolderComparison& folderCmp); //exclude additional entries only void setActiveStatus(bool newStatus, FolderComparison& folderCmp); //activate or deactivate all rows -void setActiveStatus(bool newStatus, FileSystemObject& fsObj); //activate or deactivate row: works recursively! +void setActiveStatus(bool newStatus, FileSystemObject& fsObj); //activate or deactivate row: (not recursively anymore) //manual deletion of files on main grid diff --git a/comparison.cpp b/comparison.cpp index 7e4c00c9..80ecacc0 100644 --- a/comparison.cpp +++ b/comparison.cpp @@ -55,8 +55,8 @@ std::vector<ffs3::FolderPairCfg> ffs3::extractCompareCfg(const MainConfiguration combineFilters(globalFilter, BaseFilter::FilterRef( new NameFilter( - i->localFilter.includeFilter, - i->localFilter.excludeFilter))), + i->localFilter.includeFilter, + i->localFilter.excludeFilter))), i->altSyncConfig.get() ? i->altSyncConfig->syncConfiguration : mainCfg.syncConfiguration)); @@ -129,10 +129,10 @@ void DirCallback::onFile(const Zchar* shortName, const Zstring& fullName, const if (pos != Zstring::npos) { const Zchar* ending = shortName + pos + 1; //(returns the whole string if ch not found) - // if ( EqualFilename()(ending, SYNC_DB_FILE_ENDING) || + // if (EqualFilename()(ending, SYNC_DB_FILE_ENDING) || // EqualFilename()(ending, LOCK_FILE_ENDING)) //let's hope this premature performance optimization doesn't bite back! - if ( ending == SYNC_DB_FILE_ENDING || // - ending == LOCK_FILE_ENDING) + if (ending == SYNC_DB_FILE_ENDING || // + ending == LOCK_FILE_ENDING) return; } @@ -147,7 +147,7 @@ void DirCallback::onFile(const Zchar* shortName, const Zstring& fullName, const //update UI/commandline status information statusHandler->reportInfo(statusText); -//------------------------------------------------------------------------------------ + //------------------------------------------------------------------------------------ //apply filter before processing (use relative name!) if (!baseCallback_->filterInstance->passFileFilter(relNameParentPf_ + fileNameShort)) { @@ -159,11 +159,11 @@ void DirCallback::onFile(const Zchar* shortName, const Zstring& fullName, const //therefore only large files (that take advantage of detection of renaming when synchronizing) should be evaluated! //testcase: scanning only files larger than 1 MB results in performance loss of 6% -//#warning this call is NOT acceptable for Linux! -// //Linux: retrieveFileID takes about 50% longer in VM! (avoidable because of redundant stat() call!) -// const util::FileID fileIdentifier = details.fileSize >= baseCallback_->detectRenameThreshold_ ? -// util::retrieveFileID(fullName) : -// util::FileID(); + //#warning this call is NOT acceptable for Linux! + // //Linux: retrieveFileID takes about 50% longer in VM! (avoidable because of redundant stat() call!) + // const util::FileID fileIdentifier = details.fileSize >= baseCallback_->detectRenameThreshold_ ? + // util::retrieveFileID(fullName) : + // util::FileID(); output_.addSubFile(fileNameShort, FileDescriptor(details.lastWriteTimeRaw, details.fileSize)); @@ -189,7 +189,7 @@ void DirCallback::onSymlink(const Zchar* shortName, const Zstring& fullName, con //update UI/commandline status information statusHandler->reportInfo(statusText); -//------------------------------------------------------------------------------------ + //------------------------------------------------------------------------------------ const Zstring& relName = relNameParentPf_ + shortName; //apply filter before processing (use relative name!) @@ -222,7 +222,7 @@ TraverseCallback::ReturnValDir DirCallback::onDir(const Zchar* shortName, const //update UI/commandline status information statusHandler->reportInfo(statusText); -//------------------------------------------------------------------------------------ + //------------------------------------------------------------------------------------ const Zstring& relName = relNameParentPf_ + shortName; //apply filter before processing (use relative name!) @@ -255,10 +255,10 @@ void DirCallback::onError(const wxString& errorText) { switch (statusHandler->reportError(errorText)) { - case ErrorHandler::IGNORE_ERROR: - return; - case ErrorHandler::RETRY: - break; //I have to admit "retry" is a bit of a fake here... at least the user has opportunity to abort! + case ErrorHandler::IGNORE_ERROR: + return; + case ErrorHandler::RETRY: + break; //I have to admit "retry" is a bit of a fake here... at least the user has opportunity to abort! } } } @@ -356,15 +356,15 @@ DirContainer& CompareProcess::DirectoryBuffer::insertIntoBuffer(const DirBufferK bool followSymlinks = false; switch (handleSymlinks_) { - case SYMLINK_IGNORE: - followSymlinks = false; //=> symlinks will be reported via onSymlink() where they are excluded - break; - case SYMLINK_USE_DIRECTLY: - followSymlinks = false; - break; - case SYMLINK_FOLLOW_LINK: - followSymlinks = true; - break; + case SYMLINK_IGNORE: + followSymlinks = false; //=> symlinks will be reported via onSymlink() where they are excluded + break; + case SYMLINK_USE_DIRECTLY: + followSymlinks = false; + break; + case SYMLINK_FOLLOW_LINK: + followSymlinks = true; + break; } std::auto_ptr<ffs3::DstHackCallback> dstCallback; @@ -401,15 +401,15 @@ void foldersAreValidForComparison(const std::vector<FolderPairCfg>& folderPairsF bool nonEmptyPairFound = false; //check if user entered at least one folder pair bool partiallyFilledPairFound = false; - const wxString additionalInfo = _("You can ignore the error to consider not existing directories as empty."); + const wxString additionalInfo = _("You can ignore this error to consider the directory as empty."); for (std::vector<FolderPairCfg>::const_iterator i = folderPairsForm.begin(); i != folderPairsForm.end(); ++i) { if (!i->leftDirectory.empty() || !i->rightDirectory.empty()) //may be partially filled though nonEmptyPairFound = true; - if ( (i->leftDirectory.empty() && !i->rightDirectory.empty()) || - (!i->leftDirectory.empty() && i->rightDirectory.empty())) + if ((i->leftDirectory.empty() && !i->rightDirectory.empty()) || + (!i->leftDirectory.empty() && i->rightDirectory.empty())) partiallyFilledPairFound = true; //check if folders exist @@ -417,8 +417,8 @@ void foldersAreValidForComparison(const std::vector<FolderPairCfg>& folderPairsF while (!ffs3::dirExists(i->leftDirectory)) { ErrorHandler::Response rv = statusUpdater->reportError(wxString(_("Directory does not exist:")) + wxT(" \n") + - wxT("\"") + zToWx(i->leftDirectory) + wxT("\"") + wxT("\n\n") + - additionalInfo + wxT(" ") + ffs3::getLastErrorFormatted()); + wxT("\"") + zToWx(i->leftDirectory) + wxT("\"") + wxT("\n\n") + + additionalInfo + wxT(" ") + ffs3::getLastErrorFormatted()); if (rv == ErrorHandler::IGNORE_ERROR) break; else if (rv == ErrorHandler::RETRY) @@ -431,8 +431,8 @@ void foldersAreValidForComparison(const std::vector<FolderPairCfg>& folderPairsF while (!ffs3::dirExists(i->rightDirectory)) { ErrorHandler::Response rv = statusUpdater->reportError(wxString(_("Directory does not exist:")) + wxT("\n") + - wxT("\"") + zToWx(i->rightDirectory) + wxT("\"") + wxT("\n\n") + - additionalInfo + wxT(" ") + ffs3::getLastErrorFormatted()); + wxT("\"") + zToWx(i->rightDirectory) + wxT("\"") + wxT("\n\n") + + additionalInfo + wxT(" ") + ffs3::getLastErrorFormatted()); if (rv == ErrorHandler::IGNORE_ERROR) break; else if (rv == ErrorHandler::RETRY) @@ -447,8 +447,8 @@ void foldersAreValidForComparison(const std::vector<FolderPairCfg>& folderPairsF { while (true) { - const ErrorHandler::Response rv = statusUpdater->reportError(wxString(_("At least one directory input field is empty.")) + wxT(" \n\n") + - + wxT("(") + additionalInfo + wxT(")")); + const ErrorHandler::Response rv = statusUpdater->reportError(wxString(_("A directory input field is empty.")) + wxT(" \n\n") + + + wxT("(") + additionalInfo + wxT(")")); if (rv == ErrorHandler::IGNORE_ERROR) break; else if (rv == ErrorHandler::RETRY) @@ -534,13 +534,12 @@ bool filesHaveSameContentUpdating(const Zstring& filename1, const Zstring& filen bool sameContent = true; try { - sameContent = filesHaveSameContent(filename1, filename2, callback); + sameContent = filesHaveSameContent(filename1, filename2, callback); //throw FileError } catch (...) { //error situation: undo communication of processed amount of data handler->updateProcessedData(0, bytesComparedLast * -1); - throw; } @@ -633,16 +632,16 @@ CompareProcess::CompareProcess(SymLinkHandling handleSymlinks, void CompareProcess::startCompareProcess(const std::vector<FolderPairCfg>& directoryPairs, - const CompareVariant cmpVar, - FolderComparison& output) + const CompareVariant cmpVar, + FolderComparison& output) { #ifdef NDEBUG wxLogNull noWxLogs; //hide wxWidgets log messages in release build #endif -// #ifdef FFS_WIN -// PERF_START; -// #endif + // #ifdef FFS_WIN + //PERF_START; + // #endif //init process: keep at beginning so that all gui elements are initialized properly @@ -711,12 +710,12 @@ void CompareProcess::startCompareProcess(const std::vector<FolderPairCfg>& direc FolderComparison output_tmp; //write to output not before END of process! switch (cmpVar) { - case CMP_BY_TIME_SIZE: - compareByTimeSize(directoryPairsFormatted, output_tmp); - break; - case CMP_BY_CONTENT: - compareByContent(directoryPairsFormatted, output_tmp); - break; + case CMP_BY_TIME_SIZE: + compareByTimeSize(directoryPairsFormatted, output_tmp); + break; + case CMP_BY_CONTENT: + compareByContent(directoryPairsFormatted, output_tmp); + break; } @@ -763,7 +762,7 @@ void CompareProcess::startCompareProcess(const std::vector<FolderPairCfg>& direc } catch (const std::bad_alloc& e) { - statusUpdater->reportFatalError(wxString(_("System out of memory!")) + wxT(" ") + wxString::FromAscii(e.what())); + statusUpdater->reportFatalError(wxString(_("Memory allocation failed!")) + wxT(" ") + wxString::FromAscii(e.what())); } catch (const std::exception& e) { @@ -799,9 +798,9 @@ void makeSameLength(wxString& first, wxString& second) wxString getConflictSameDateDiffSize(const FileMapping& fileObj) { //some beautification... -// wxString left = wxString(_("Left")) + wxT(": "); -// wxString right = wxString(_("Right")) + wxT(": "); -// makeSameLength(left, right); + // wxString left = wxString(_("Left")) + wxT(": "); + // wxString right = wxString(_("Right")) + wxT(": "); + // makeSameLength(left, right); const wxString left = wxT("<-- "); const wxString right = wxT("--> "); @@ -831,9 +830,9 @@ void CompareProcess::categorizeSymlinkByTime(SymLinkMapping* linkObj) const linkObj->getTargetPath<LEFT_SIDE>() == linkObj->getTargetPath<RIGHT_SIDE>()) { //symlinks have same "content" - if ( linkObj->getShortName<LEFT_SIDE>() == linkObj->getShortName<RIGHT_SIDE>() && - timeCmp.getResult(linkObj->getLastWriteTime<LEFT_SIDE>(), - linkObj->getLastWriteTime<RIGHT_SIDE>()) == CmpFileTime::TIME_EQUAL) + if (linkObj->getShortName<LEFT_SIDE>() == linkObj->getShortName<RIGHT_SIDE>() && + timeCmp.getResult(linkObj->getLastWriteTime<LEFT_SIDE>(), + linkObj->getLastWriteTime<RIGHT_SIDE>()) == CmpFileTime::TIME_EQUAL) linkObj->setCategory<SYMLINK_EQUAL>(); else linkObj->setCategory<SYMLINK_DIFFERENT_METADATA>(); @@ -843,41 +842,41 @@ void CompareProcess::categorizeSymlinkByTime(SymLinkMapping* linkObj) const switch (timeCmp.getResult(linkObj->getLastWriteTime<LEFT_SIDE>(), linkObj->getLastWriteTime<RIGHT_SIDE>())) { - case CmpFileTime::TIME_EQUAL: - if ( + case CmpFileTime::TIME_EQUAL: + if ( #ifdef FFS_WIN //type of symbolic link is relevant for Windows only - linkObj->getLinkType<LEFT_SIDE>() == linkObj->getLinkType<RIGHT_SIDE>() && + linkObj->getLinkType<LEFT_SIDE>() == linkObj->getLinkType<RIGHT_SIDE>() && #endif - linkObj->getTargetPath<LEFT_SIDE>() == linkObj->getTargetPath<RIGHT_SIDE>()) //may both be empty if following link failed - { - if ( linkObj->getShortName<LEFT_SIDE>() == linkObj->getShortName<RIGHT_SIDE>()) - linkObj->setCategory<SYMLINK_EQUAL>(); + linkObj->getTargetPath<LEFT_SIDE>() == linkObj->getTargetPath<RIGHT_SIDE>()) //may both be empty if following link failed + { + if (linkObj->getShortName<LEFT_SIDE>() == linkObj->getShortName<RIGHT_SIDE>()) + linkObj->setCategory<SYMLINK_EQUAL>(); + else + linkObj->setCategory<SYMLINK_DIFFERENT_METADATA>(); + } else - linkObj->setCategory<SYMLINK_DIFFERENT_METADATA>(); - } - else - { - wxString conflictMsg = wxString(_("Conflict detected:")) + wxT("\n") + _("Symlinks %x have the same date but a different target!"); - conflictMsg.Replace(wxT("%x"), wxString(wxT("\"")) + zToWx(linkObj->getRelativeName<LEFT_SIDE>()) + wxT("\"")); - linkObj->setCategoryConflict(conflictMsg); - } - break; + { + wxString conflictMsg = wxString(_("Conflict detected:")) + wxT("\n") + _("Symlinks %x have the same date but a different target!"); + conflictMsg.Replace(wxT("%x"), wxString(wxT("\"")) + zToWx(linkObj->getRelativeName<LEFT_SIDE>()) + wxT("\"")); + linkObj->setCategoryConflict(conflictMsg); + } + break; - case CmpFileTime::TIME_LEFT_NEWER: - linkObj->setCategory<SYMLINK_LEFT_NEWER>(); - break; + case CmpFileTime::TIME_LEFT_NEWER: + linkObj->setCategory<SYMLINK_LEFT_NEWER>(); + break; - case CmpFileTime::TIME_RIGHT_NEWER: - linkObj->setCategory<SYMLINK_RIGHT_NEWER>(); - break; + case CmpFileTime::TIME_RIGHT_NEWER: + linkObj->setCategory<SYMLINK_RIGHT_NEWER>(); + break; - case CmpFileTime::TIME_LEFT_INVALID: - linkObj->setCategoryConflict(getConflictInvalidDate(linkObj->getFullName<LEFT_SIDE>(), linkObj->getLastWriteTime<LEFT_SIDE>())); - break; + case CmpFileTime::TIME_LEFT_INVALID: + linkObj->setCategoryConflict(getConflictInvalidDate(linkObj->getFullName<LEFT_SIDE>(), linkObj->getLastWriteTime<LEFT_SIDE>())); + break; - case CmpFileTime::TIME_RIGHT_INVALID: - linkObj->setCategoryConflict(getConflictInvalidDate(linkObj->getFullName<RIGHT_SIDE>(), linkObj->getLastWriteTime<RIGHT_SIDE>())); - break; + case CmpFileTime::TIME_RIGHT_INVALID: + linkObj->setCategoryConflict(getConflictInvalidDate(linkObj->getFullName<RIGHT_SIDE>(), linkObj->getLastWriteTime<RIGHT_SIDE>())); + break; } } @@ -912,33 +911,33 @@ void CompareProcess::compareByTimeSize(const std::vector<FolderPairCfg>& directo switch (timeCmp.getResult(line->getLastWriteTime<LEFT_SIDE>(), line->getLastWriteTime<RIGHT_SIDE>())) { - case CmpFileTime::TIME_EQUAL: - if (line->getFileSize<LEFT_SIDE>() == line->getFileSize<RIGHT_SIDE>()) - { - if (line->getShortName<LEFT_SIDE>() == line->getShortName<RIGHT_SIDE>()) - line->setCategory<FILE_EQUAL>(); + case CmpFileTime::TIME_EQUAL: + if (line->getFileSize<LEFT_SIDE>() == line->getFileSize<RIGHT_SIDE>()) + { + if (line->getShortName<LEFT_SIDE>() == line->getShortName<RIGHT_SIDE>()) + line->setCategory<FILE_EQUAL>(); + else + line->setCategory<FILE_DIFFERENT_METADATA>(); + } else - line->setCategory<FILE_DIFFERENT_METADATA>(); - } - else - line->setCategoryConflict(getConflictSameDateDiffSize(*line)); //same date, different filesize - break; + line->setCategoryConflict(getConflictSameDateDiffSize(*line)); //same date, different filesize + break; - case CmpFileTime::TIME_LEFT_NEWER: - line->setCategory<FILE_LEFT_NEWER>(); - break; + case CmpFileTime::TIME_LEFT_NEWER: + line->setCategory<FILE_LEFT_NEWER>(); + break; - case CmpFileTime::TIME_RIGHT_NEWER: - line->setCategory<FILE_RIGHT_NEWER>(); - break; + case CmpFileTime::TIME_RIGHT_NEWER: + line->setCategory<FILE_RIGHT_NEWER>(); + break; - case CmpFileTime::TIME_LEFT_INVALID: - line->setCategoryConflict(getConflictInvalidDate(line->getFullName<LEFT_SIDE>(), line->getLastWriteTime<LEFT_SIDE>())); - break; + case CmpFileTime::TIME_LEFT_INVALID: + line->setCategoryConflict(getConflictInvalidDate(line->getFullName<LEFT_SIDE>(), line->getLastWriteTime<LEFT_SIDE>())); + break; - case CmpFileTime::TIME_RIGHT_INVALID: - line->setCategoryConflict(getConflictInvalidDate(line->getFullName<RIGHT_SIDE>(), line->getLastWriteTime<RIGHT_SIDE>())); - break; + case CmpFileTime::TIME_RIGHT_INVALID: + line->setCategoryConflict(getConflictInvalidDate(line->getFullName<RIGHT_SIDE>(), line->getLastWriteTime<RIGHT_SIDE>())); + break; } } } @@ -968,9 +967,9 @@ void CompareProcess::categorizeSymlinkByContent(SymLinkMapping* linkObj) const linkObj->getTargetPath<LEFT_SIDE>() == linkObj->getTargetPath<RIGHT_SIDE>()) { //symlinks have same "content" - if ( linkObj->getShortName<LEFT_SIDE>() == linkObj->getShortName<RIGHT_SIDE>() && - timeCmp.getResult(linkObj->getLastWriteTime<LEFT_SIDE>(), - linkObj->getLastWriteTime<RIGHT_SIDE>()) == CmpFileTime::TIME_EQUAL) + if (linkObj->getShortName<LEFT_SIDE>() == linkObj->getShortName<RIGHT_SIDE>() && + timeCmp.getResult(linkObj->getLastWriteTime<LEFT_SIDE>(), + linkObj->getLastWriteTime<RIGHT_SIDE>()) == CmpFileTime::TIME_EQUAL) linkObj->setCategory<SYMLINK_EQUAL>(); else linkObj->setCategory<SYMLINK_DIFFERENT_METADATA>(); @@ -1052,9 +1051,9 @@ void CompareProcess::compareByContent(const std::vector<FolderPairCfg>& director line->getFileSize<LEFT_SIDE>() * 2, statusUpdater)) { - if ( line->getShortName<LEFT_SIDE>() == line->getShortName<RIGHT_SIDE>() && - timeCmp.getResult(line->getLastWriteTime<LEFT_SIDE>(), - line->getLastWriteTime<RIGHT_SIDE>()) == CmpFileTime::TIME_EQUAL) + if (line->getShortName<LEFT_SIDE>() == line->getShortName<RIGHT_SIDE>() && + timeCmp.getResult(line->getLastWriteTime<LEFT_SIDE>(), + line->getLastWriteTime<RIGHT_SIDE>()) == CmpFileTime::TIME_EQUAL) line->setCategory<FILE_EQUAL>(); else line->setCategory<FILE_DIFFERENT_METADATA>(); @@ -1190,7 +1189,7 @@ void MergeSides::execute(const DirContainer& leftSide, const DirContainer& right } -//----------------------------------------------------------------------------------------------- + //----------------------------------------------------------------------------------------------- for (DirContainer::LinkList::const_iterator i = leftSide.links.begin(); i != leftSide.links.end(); ++i) { DirContainer::LinkList::const_iterator rightLink = rightSide.links.find(i->first); @@ -1219,7 +1218,7 @@ void MergeSides::execute(const DirContainer& leftSide, const DirContainer& right } -//----------------------------------------------------------------------------------------------- + //----------------------------------------------------------------------------------------------- for (DirContainer::DirList::const_iterator i = leftSide.dirs.begin(); i != leftSide.dirs.end(); ++i) { DirContainer::DirList::const_iterator rightDir = rightSide.dirs.find(i->first); @@ -1264,8 +1263,8 @@ void CompareProcess::performBaseComparison(BaseDirMapping& output, std::vector<F output.getFilter()); const DirContainer& directoryRight = directoryBuffer->getDirectoryDescription( - output.getBaseDir<RIGHT_SIDE>(), - output.getFilter()); + output.getBaseDir<RIGHT_SIDE>(), + output.getFilter()); statusUpdater->reportInfo(wxToZ(_("Generating file list..."))); diff --git a/file_hierarchy.cpp b/file_hierarchy.cpp index 179aa1c5..1681da22 100644 --- a/file_hierarchy.cpp +++ b/file_hierarchy.cpp @@ -122,80 +122,80 @@ SyncOperation FileSystemObject::getSyncOperation( switch (cmpResult) { - case FILE_LEFT_SIDE_ONLY: - switch (syncDir) - { - case SYNC_DIR_INT_LEFT: - return SO_DELETE_LEFT; //delete files on left - case SYNC_DIR_INT_RIGHT: - return SO_CREATE_NEW_RIGHT; //copy files to right - case SYNC_DIR_INT_NONE: - return SO_DO_NOTHING; - case SYNC_DIR_INT_CONFLICT: - return SO_UNRESOLVED_CONFLICT; - } - break; - - case FILE_RIGHT_SIDE_ONLY: - switch (syncDir) - { - case SYNC_DIR_INT_LEFT: - return SO_CREATE_NEW_LEFT; //copy files to left - case SYNC_DIR_INT_RIGHT: - return SO_DELETE_RIGHT; //delete files on right - case SYNC_DIR_INT_NONE: - return SO_DO_NOTHING; - case SYNC_DIR_INT_CONFLICT: - return SO_UNRESOLVED_CONFLICT; - } - break; - - case FILE_LEFT_NEWER: - case FILE_RIGHT_NEWER: - case FILE_DIFFERENT: - switch (syncDir) - { - case SYNC_DIR_INT_LEFT: - return SO_OVERWRITE_LEFT; //copy from right to left - case SYNC_DIR_INT_RIGHT: - return SO_OVERWRITE_RIGHT; //copy from left to right - case SYNC_DIR_INT_NONE: - return SO_DO_NOTHING; - case SYNC_DIR_INT_CONFLICT: - return SO_UNRESOLVED_CONFLICT; - } - break; - - case FILE_CONFLICT: - switch (syncDir) - { - case SYNC_DIR_INT_LEFT: - return SO_OVERWRITE_LEFT; //copy from right to left - case SYNC_DIR_INT_RIGHT: - return SO_OVERWRITE_RIGHT; //copy from left to right - case SYNC_DIR_INT_NONE: - case SYNC_DIR_INT_CONFLICT: - return SO_UNRESOLVED_CONFLICT; - } - break; - - case FILE_DIFFERENT_METADATA: - switch (syncDir) - { - case SYNC_DIR_INT_LEFT: - return SO_COPY_METADATA_TO_LEFT; - case SYNC_DIR_INT_RIGHT: - return SO_COPY_METADATA_TO_RIGHT; - case SYNC_DIR_INT_NONE: - return SO_DO_NOTHING; - case SYNC_DIR_INT_CONFLICT: - return SO_UNRESOLVED_CONFLICT; - } - break; - - case FILE_EQUAL: - assert(syncDir == SYNC_DIR_INT_NONE); - return SO_EQUAL; + case FILE_LEFT_SIDE_ONLY: + switch (syncDir) + { + case SYNC_DIR_INT_LEFT: + return SO_DELETE_LEFT; //delete files on left + case SYNC_DIR_INT_RIGHT: + return SO_CREATE_NEW_RIGHT; //copy files to right + case SYNC_DIR_INT_NONE: + return SO_DO_NOTHING; + case SYNC_DIR_INT_CONFLICT: + return SO_UNRESOLVED_CONFLICT; + } + break; + + case FILE_RIGHT_SIDE_ONLY: + switch (syncDir) + { + case SYNC_DIR_INT_LEFT: + return SO_CREATE_NEW_LEFT; //copy files to left + case SYNC_DIR_INT_RIGHT: + return SO_DELETE_RIGHT; //delete files on right + case SYNC_DIR_INT_NONE: + return SO_DO_NOTHING; + case SYNC_DIR_INT_CONFLICT: + return SO_UNRESOLVED_CONFLICT; + } + break; + + case FILE_LEFT_NEWER: + case FILE_RIGHT_NEWER: + case FILE_DIFFERENT: + switch (syncDir) + { + case SYNC_DIR_INT_LEFT: + return SO_OVERWRITE_LEFT; //copy from right to left + case SYNC_DIR_INT_RIGHT: + return SO_OVERWRITE_RIGHT; //copy from left to right + case SYNC_DIR_INT_NONE: + return SO_DO_NOTHING; + case SYNC_DIR_INT_CONFLICT: + return SO_UNRESOLVED_CONFLICT; + } + break; + + case FILE_CONFLICT: + switch (syncDir) + { + case SYNC_DIR_INT_LEFT: + return SO_OVERWRITE_LEFT; //copy from right to left + case SYNC_DIR_INT_RIGHT: + return SO_OVERWRITE_RIGHT; //copy from left to right + case SYNC_DIR_INT_NONE: + case SYNC_DIR_INT_CONFLICT: + return SO_UNRESOLVED_CONFLICT; + } + break; + + case FILE_DIFFERENT_METADATA: + switch (syncDir) + { + case SYNC_DIR_INT_LEFT: + return SO_COPY_METADATA_TO_LEFT; + case SYNC_DIR_INT_RIGHT: + return SO_COPY_METADATA_TO_RIGHT; + case SYNC_DIR_INT_NONE: + return SO_DO_NOTHING; + case SYNC_DIR_INT_CONFLICT: + return SO_UNRESOLVED_CONFLICT; + } + break; + + case FILE_EQUAL: + assert(syncDir == SYNC_DIR_INT_NONE); + return SO_EQUAL; } return SO_DO_NOTHING; //dummy diff --git a/file_hierarchy.h b/file_hierarchy.h index f4d9537a..5b630c9f 100644 --- a/file_hierarchy.h +++ b/file_hierarchy.h @@ -794,18 +794,18 @@ void FileSystemObject::synchronizeSides() { switch (syncDir) { - case SYNC_DIR_INT_LEFT: - shortNameLeft_ = shortNameRight_; - copyToL(); - break; - case SYNC_DIR_INT_RIGHT: - shortNameRight_ = shortNameLeft_; - copyToR(); - break; - case SYNC_DIR_INT_NONE: - case SYNC_DIR_INT_CONFLICT: - assert(!"if nothing's todo then why arrive here?"); - break; + case SYNC_DIR_INT_LEFT: + shortNameLeft_ = shortNameRight_; + copyToL(); + break; + case SYNC_DIR_INT_RIGHT: + shortNameRight_ = shortNameLeft_; + copyToR(); + break; + case SYNC_DIR_INT_NONE: + case SYNC_DIR_INT_CONFLICT: + assert(!"if nothing's todo then why arrive here?"); + break; } syncDir = SYNC_DIR_INT_NONE; @@ -968,15 +968,15 @@ void DirMapping::swap() //swap compare result switch (cmpResult) { - case DIR_LEFT_SIDE_ONLY: - cmpResult = DIR_RIGHT_SIDE_ONLY; - break; - case DIR_RIGHT_SIDE_ONLY: - cmpResult = DIR_LEFT_SIDE_ONLY; - break; - case DIR_EQUAL: - case DIR_DIFFERENT_METADATA: - break; + case DIR_LEFT_SIDE_ONLY: + cmpResult = DIR_RIGHT_SIDE_ONLY; + break; + case DIR_RIGHT_SIDE_ONLY: + cmpResult = DIR_LEFT_SIDE_ONLY; + break; + case DIR_EQUAL: + case DIR_DIFFERENT_METADATA: + break; } } @@ -1055,23 +1055,23 @@ void FileMapping::swap() //swap compare result switch (cmpResult) { - case FILE_LEFT_SIDE_ONLY: - cmpResult = FILE_RIGHT_SIDE_ONLY; - break; - case FILE_RIGHT_SIDE_ONLY: - cmpResult = FILE_LEFT_SIDE_ONLY; - break; - case FILE_LEFT_NEWER: - cmpResult = FILE_RIGHT_NEWER; - break; - case FILE_RIGHT_NEWER: - cmpResult = FILE_LEFT_NEWER; - break; - case FILE_DIFFERENT: - case FILE_EQUAL: - case FILE_DIFFERENT_METADATA: - case FILE_CONFLICT: - break; + case FILE_LEFT_SIDE_ONLY: + cmpResult = FILE_RIGHT_SIDE_ONLY; + break; + case FILE_RIGHT_SIDE_ONLY: + cmpResult = FILE_LEFT_SIDE_ONLY; + break; + case FILE_LEFT_NEWER: + cmpResult = FILE_RIGHT_NEWER; + break; + case FILE_RIGHT_NEWER: + cmpResult = FILE_LEFT_NEWER; + break; + case FILE_DIFFERENT: + case FILE_EQUAL: + case FILE_DIFFERENT_METADATA: + case FILE_CONFLICT: + break; } std::swap(dataLeft, dataRight); @@ -1257,23 +1257,23 @@ void SymLinkMapping::swap() //swap compare result switch (cmpResult) { - case SYMLINK_LEFT_SIDE_ONLY: - cmpResult = SYMLINK_RIGHT_SIDE_ONLY; - break; - case SYMLINK_RIGHT_SIDE_ONLY: - cmpResult = SYMLINK_LEFT_SIDE_ONLY; - break; - case SYMLINK_LEFT_NEWER: - cmpResult = SYMLINK_RIGHT_NEWER; - break; - case SYMLINK_RIGHT_NEWER: - cmpResult = SYMLINK_LEFT_NEWER; - break; - case SYMLINK_EQUAL: - case SYMLINK_DIFFERENT_METADATA: - case SYMLINK_DIFFERENT: - case SYMLINK_CONFLICT: - break; + case SYMLINK_LEFT_SIDE_ONLY: + cmpResult = SYMLINK_RIGHT_SIDE_ONLY; + break; + case SYMLINK_RIGHT_SIDE_ONLY: + cmpResult = SYMLINK_LEFT_SIDE_ONLY; + break; + case SYMLINK_LEFT_NEWER: + cmpResult = SYMLINK_RIGHT_NEWER; + break; + case SYMLINK_RIGHT_NEWER: + cmpResult = SYMLINK_LEFT_NEWER; + break; + case SYMLINK_EQUAL: + case SYMLINK_DIFFERENT_METADATA: + case SYMLINK_DIFFERENT: + case SYMLINK_CONFLICT: + break; } std::swap(dataLeft, dataRight); diff --git a/library/Batch.ico b/library/Batch.ico Binary files differindex 580be81f..7b33067a 100644 --- a/library/Batch.ico +++ b/library/Batch.ico diff --git a/library/FreeFileSync.ico b/library/FreeFileSync.ico Binary files differindex bfa8ffc4..b87789a7 100644 --- a/library/FreeFileSync.ico +++ b/library/FreeFileSync.ico diff --git a/library/SyncDB.ico b/library/SyncDB.ico Binary files differindex e70a3a16..eee91c14 100644 --- a/library/SyncDB.ico +++ b/library/SyncDB.ico diff --git a/library/custom_grid.cpp b/library/custom_grid.cpp index 274ef778..7b853138 100644 --- a/library/custom_grid.cpp +++ b/library/custom_grid.cpp @@ -68,8 +68,8 @@ public: } -//########################################################################### -//grid standard input output methods, redirected directly to gridData to improve performance + //########################################################################### + //grid standard input output methods, redirected directly to gridData to improve performance virtual int GetNumberRows() { @@ -150,7 +150,7 @@ public: } lastNrCols = currentNrCols; } -//########################################################################### + //########################################################################### virtual wxGridCellAttr* GetAttr(int row, int col, wxGridCellAttr::wxAttrKind kind) @@ -277,27 +277,27 @@ protected: { switch (colType_) { - case xmlAccess::FULL_PATH: - value = zToWx(fileObj.getFullName<side>().BeforeLast(common::FILE_NAME_SEPARATOR)); - break; - case xmlAccess::FILENAME: //filename - value = zToWx(fileObj.getShortName<side>()); - break; - case xmlAccess::REL_PATH: //relative path - value = zToWx(fileObj.getParentRelativeName()); - break; - case xmlAccess::DIRECTORY: - value = zToWx(fileObj.getBaseDirPf<side>()); - break; - case xmlAccess::SIZE: //file size - value = ffs3::numberToStringSep(fileObj.getFileSize<side>()); - break; - case xmlAccess::DATE: //date - value = ffs3::utcTimeToLocalString(fileObj.getLastWriteTime<side>()); - break; - case xmlAccess::EXTENSION: //file extension - value = zToWx(fileObj.getExtension<side>()); - break; + case xmlAccess::FULL_PATH: + value = zToWx(fileObj.getFullName<side>().BeforeLast(common::FILE_NAME_SEPARATOR)); + break; + case xmlAccess::FILENAME: //filename + value = zToWx(fileObj.getShortName<side>()); + break; + case xmlAccess::REL_PATH: //relative path + value = zToWx(fileObj.getParentRelativeName()); + break; + case xmlAccess::DIRECTORY: + value = zToWx(fileObj.getBaseDirPf<side>()); + break; + case xmlAccess::SIZE: //file size + value = ffs3::numberToStringSep(fileObj.getFileSize<side>()); + break; + case xmlAccess::DATE: //date + value = ffs3::utcTimeToLocalString(fileObj.getLastWriteTime<side>()); + break; + case xmlAccess::EXTENSION: //file extension + value = zToWx(fileObj.getExtension<side>()); + break; } } @@ -305,27 +305,27 @@ protected: { switch (colType_) { - case xmlAccess::FULL_PATH: - value = zToWx(linkObj.getFullName<side>().BeforeLast(common::FILE_NAME_SEPARATOR)); - break; - case xmlAccess::FILENAME: //filename - value = zToWx(linkObj.getShortName<side>()); - break; - case xmlAccess::REL_PATH: //relative path - value = zToWx(linkObj.getParentRelativeName()); - break; - case xmlAccess::DIRECTORY: - value = zToWx(linkObj.getBaseDirPf<side>()); - break; - case xmlAccess::SIZE: //file size - value = _("<Symlink>"); - break; - case xmlAccess::DATE: //date - value = ffs3::utcTimeToLocalString(linkObj.getLastWriteTime<side>()); - break; - case xmlAccess::EXTENSION: //file extension - value = wxEmptyString; - break; + case xmlAccess::FULL_PATH: + value = zToWx(linkObj.getFullName<side>().BeforeLast(common::FILE_NAME_SEPARATOR)); + break; + case xmlAccess::FILENAME: //filename + value = zToWx(linkObj.getShortName<side>()); + break; + case xmlAccess::REL_PATH: //relative path + value = zToWx(linkObj.getParentRelativeName()); + break; + case xmlAccess::DIRECTORY: + value = zToWx(linkObj.getBaseDirPf<side>()); + break; + case xmlAccess::SIZE: //file size + value = _("<Symlink>"); + break; + case xmlAccess::DATE: //date + value = ffs3::utcTimeToLocalString(linkObj.getLastWriteTime<side>()); + break; + case xmlAccess::EXTENSION: //file extension + value = wxEmptyString; + break; } } @@ -333,27 +333,27 @@ protected: { switch (colType_) { - case xmlAccess::FULL_PATH: - value = zToWx(dirObj.getFullName<side>()); - break; - case xmlAccess::FILENAME: - value = zToWx(dirObj.getShortName<side>()); - break; - case xmlAccess::REL_PATH: - value = zToWx(dirObj.getParentRelativeName()); - break; - case xmlAccess::DIRECTORY: - value = zToWx(dirObj.getBaseDirPf<side>()); - break; - case xmlAccess::SIZE: //file size - value = _("<Directory>"); - break; - case xmlAccess::DATE: //date - value = wxEmptyString; - break; - case xmlAccess::EXTENSION: //file extension - value = wxEmptyString; - break; + case xmlAccess::FULL_PATH: + value = zToWx(dirObj.getFullName<side>()); + break; + case xmlAccess::FILENAME: + value = zToWx(dirObj.getShortName<side>()); + break; + case xmlAccess::REL_PATH: + value = zToWx(dirObj.getParentRelativeName()); + break; + case xmlAccess::DIRECTORY: + value = zToWx(dirObj.getBaseDirPf<side>()); + break; + case xmlAccess::SIZE: //file size + value = _("<Directory>"); + break; + case xmlAccess::DATE: //date + value = wxEmptyString; + break; + case xmlAccess::EXTENSION: //file extension + value = wxEmptyString; + break; } } xmlAccess::ColumnTypes colType_; @@ -477,7 +477,7 @@ public: class CustomGridTableMiddle : public CustomGridTable { public: -//middle grid is created (first wxWidgets internal call to GetNumberCols()) with one column + //middle grid is created (first wxWidgets internal call to GetNumberCols()) with one column CustomGridTableMiddle() : CustomGridTable(0, GetNumberCols()), //attention: static binding to virtual GetNumberCols() in a Constructor! syncPreviewActive(false) {} @@ -529,43 +529,43 @@ private: { switch (fsObj->getSyncOperation()) //evaluate comparison result and sync direction { - case SO_CREATE_NEW_LEFT: - case SO_DELETE_LEFT: - case SO_OVERWRITE_LEFT: - return COLOR_SYNC_BLUE; - case SO_COPY_METADATA_TO_LEFT: - return COLOR_SYNC_BLUE_LIGHT; - case SO_CREATE_NEW_RIGHT: - case SO_DELETE_RIGHT: - case SO_OVERWRITE_RIGHT: - return COLOR_SYNC_GREEN; - case SO_COPY_METADATA_TO_RIGHT: - return COLOR_SYNC_GREEN_LIGHT; - case SO_UNRESOLVED_CONFLICT: - return COLOR_YELLOW; - case SO_DO_NOTHING: - case SO_EQUAL: - return *wxWHITE; + case SO_CREATE_NEW_LEFT: + case SO_DELETE_LEFT: + case SO_OVERWRITE_LEFT: + return COLOR_SYNC_BLUE; + case SO_COPY_METADATA_TO_LEFT: + return COLOR_SYNC_BLUE_LIGHT; + case SO_CREATE_NEW_RIGHT: + case SO_DELETE_RIGHT: + case SO_OVERWRITE_RIGHT: + return COLOR_SYNC_GREEN; + case SO_COPY_METADATA_TO_RIGHT: + return COLOR_SYNC_GREEN_LIGHT; + case SO_UNRESOLVED_CONFLICT: + return COLOR_YELLOW; + case SO_DO_NOTHING: + case SO_EQUAL: + return *wxWHITE; } } else //comparison results view { switch (fsObj->getCategory()) { - case FILE_LEFT_SIDE_ONLY: - case FILE_RIGHT_SIDE_ONLY: - return COLOR_CMP_GREEN; - case FILE_LEFT_NEWER: - case FILE_RIGHT_NEWER: - return COLOR_CMP_BLUE; - case FILE_DIFFERENT: - return COLOR_CMP_RED; - case FILE_EQUAL: - return *wxWHITE; - case FILE_CONFLICT: - return COLOR_YELLOW; - case FILE_DIFFERENT_METADATA: - return COLOR_YELLOW_LIGHT; + case FILE_LEFT_SIDE_ONLY: + case FILE_RIGHT_SIDE_ONLY: + return COLOR_CMP_GREEN; + case FILE_LEFT_NEWER: + case FILE_RIGHT_NEWER: + return COLOR_CMP_BLUE; + case FILE_DIFFERENT: + return COLOR_CMP_RED; + case FILE_EQUAL: + return *wxWHITE; + case FILE_CONFLICT: + return COLOR_YELLOW; + case FILE_DIFFERENT_METADATA: + return COLOR_YELLOW_LIGHT; } } } @@ -580,11 +580,11 @@ private: //######################################################################################################## -CustomGrid::CustomGrid(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, +CustomGrid::CustomGrid(wxWindow* parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, const wxString& name) : wxGrid(parent, id, pos, size, style, name), m_gridLeft(NULL), @@ -664,7 +664,7 @@ void CustomGrid::OnPaintGrid(wxEvent& event) } -void moveCursorWhileSelecting(const int anchor, const int oldPos, const int newPos, wxGrid* grid) +void moveCursorWhileSelecting(int anchor, int oldPos, int newPos, wxGrid* grid) { //note: all positions are valid in this context! @@ -693,8 +693,8 @@ void moveCursorWhileSelecting(const int anchor, const int oldPos, const int newP void execGridCommands(wxEvent& event, wxGrid* grid) { static int anchorRow = 0; - if ( grid->GetNumberRows() == 0 || - grid->GetNumberCols() == 0) + if (grid->GetNumberRows() == 0 || + grid->GetNumberCols() == 0) return; const wxKeyEvent* keyEvent = dynamic_cast<const wxKeyEvent*> (&event); @@ -705,139 +705,184 @@ void execGridCommands(wxEvent& event, wxGrid* grid) const int cursorOldColumn = std::max(std::min(grid->GetGridCursorCol(), grid->GetNumberCols() - 1), 0); const bool shiftPressed = keyEvent->ShiftDown(); - const bool altPressed = keyEvent->AltDown(); const bool ctrlPressed = keyEvent->ControlDown(); - const bool noModPressed = !shiftPressed && !altPressed && !ctrlPressed; const int keyCode = keyEvent->GetKeyCode(); - //SHIFT + X - if (shiftPressed && keyCode == WXK_UP) - { - const int cursorNewPos = std::max(cursorOldPos - 1, 0); - moveCursorWhileSelecting(anchorRow, cursorOldPos, cursorNewPos, grid); - return; //no event.Skip() - } - else if (shiftPressed && keyCode == WXK_DOWN) - { - const int cursorNewPos = std::min(cursorOldPos + 1, grid->GetNumberRows() - 1); - moveCursorWhileSelecting(anchorRow, cursorOldPos, cursorNewPos, grid); - return; //no event.Skip() - } - else if (shiftPressed && keyCode == WXK_LEFT) - { - const int cursorColumn = std::max(cursorOldColumn - 1, 0); - grid->SetGridCursor(cursorOldPos, cursorColumn); - grid->MakeCellVisible(cursorOldPos, cursorColumn); - return; //no event.Skip() - } - else if (shiftPressed && keyCode == WXK_RIGHT) - { - const int cursorColumn = std::min(cursorOldColumn + 1, grid->GetNumberCols() - 1); - grid->SetGridCursor(cursorOldPos, cursorColumn); - grid->MakeCellVisible(cursorOldPos, cursorColumn); - return; //no event.Skip() - } - else if (shiftPressed && (keyCode == WXK_PAGEUP || keyCode == WXK_NUMPAD_PAGEUP)) - { - const int rowsPerPage = grid->GetGridWindow()->GetSize().GetHeight() / grid->GetDefaultRowSize(); - const int cursorNewPos = std::max(cursorOldPos - rowsPerPage, 0); - moveCursorWhileSelecting(anchorRow, cursorOldPos, cursorNewPos, grid); - return; //no event.Skip() - } - else if (shiftPressed && (keyCode == WXK_PAGEDOWN || keyCode == WXK_NUMPAD_PAGEDOWN)) - { - const int rowsPerPage = grid->GetGridWindow()->GetSize().GetHeight() / grid->GetDefaultRowSize(); - const int cursorNewPos = std::min(cursorOldPos + rowsPerPage, grid->GetNumberRows() - 1); - moveCursorWhileSelecting(anchorRow, cursorOldPos, cursorNewPos, grid); - return; //no event.Skip() - } - else if (shiftPressed && (keyCode == WXK_HOME || keyCode == WXK_NUMPAD_HOME)) - { - const int cursorNewPos = 0; - moveCursorWhileSelecting(anchorRow, cursorOldPos, cursorNewPos, grid); - return; //no event.Skip() - } - else if (shiftPressed && (keyCode == WXK_END || keyCode == WXK_NUMPAD_END)) - { - const int cursorNewPos = grid->GetNumberRows() - 1; - moveCursorWhileSelecting(anchorRow, cursorOldPos, cursorNewPos, grid); - return; //no event.Skip() - } + if (shiftPressed) + switch (keyCode) + { + case WXK_UP: + case WXK_NUMPAD_UP: + { + const int cursorNewPos = std::max(cursorOldPos - 1, 0); + moveCursorWhileSelecting(anchorRow, cursorOldPos, cursorNewPos, grid); + return; //no event.Skip() + } + case WXK_DOWN: + case WXK_NUMPAD_DOWN: + { + const int cursorNewPos = std::min(cursorOldPos + 1, grid->GetNumberRows() - 1); + moveCursorWhileSelecting(anchorRow, cursorOldPos, cursorNewPos, grid); + return; //no event.Skip() + } + case WXK_LEFT: + case WXK_NUMPAD_LEFT: + { + const int cursorColumn = std::max(cursorOldColumn - 1, 0); + grid->SetGridCursor(cursorOldPos, cursorColumn); + grid->MakeCellVisible(cursorOldPos, cursorColumn); + return; //no event.Skip() + } + case WXK_RIGHT: + case WXK_NUMPAD_RIGHT: + { + const int cursorColumn = std::min(cursorOldColumn + 1, grid->GetNumberCols() - 1); + grid->SetGridCursor(cursorOldPos, cursorColumn); + grid->MakeCellVisible(cursorOldPos, cursorColumn); + return; //no event.Skip() + } + case WXK_PAGEUP: + case WXK_NUMPAD_PAGEUP: + { + const int rowsPerPage = grid->GetGridWindow()->GetSize().GetHeight() / grid->GetDefaultRowSize(); + const int cursorNewPos = std::max(cursorOldPos - rowsPerPage, 0); + moveCursorWhileSelecting(anchorRow, cursorOldPos, cursorNewPos, grid); + return; //no event.Skip() + } + case WXK_PAGEDOWN: + case WXK_NUMPAD_PAGEDOWN: + { + const int rowsPerPage = grid->GetGridWindow()->GetSize().GetHeight() / grid->GetDefaultRowSize(); + const int cursorNewPos = std::min(cursorOldPos + rowsPerPage, grid->GetNumberRows() - 1); + moveCursorWhileSelecting(anchorRow, cursorOldPos, cursorNewPos, grid); + return; //no event.Skip() + } + case WXK_HOME: + case WXK_NUMPAD_HOME: + { + const int cursorNewPos = 0; + moveCursorWhileSelecting(anchorRow, cursorOldPos, cursorNewPos, grid); + return; //no event.Skip() + } + case WXK_END: + case WXK_NUMPAD_END: + { + const int cursorNewPos = grid->GetNumberRows() - 1; + moveCursorWhileSelecting(anchorRow, cursorOldPos, cursorNewPos, grid); + return; //no event.Skip() + } + } //CTRL + X - else if (ctrlPressed && keyCode == WXK_LEFT) - { - grid->SetGridCursor(grid->GetGridCursorRow(), 0); - grid->MakeCellVisible(grid->GetGridCursorRow(), 0); - return; //no event.Skip() - } - else if (ctrlPressed && keyCode == WXK_RIGHT) - { - grid->SetGridCursor(grid->GetGridCursorRow(), grid->GetNumberCols() - 1); - grid->MakeCellVisible(grid->GetGridCursorRow(), grid->GetNumberCols() - 1); - return; //no event.Skip() - } - else if ((ctrlPressed && keyCode == WXK_UP) || - ((noModPressed || ctrlPressed) && (keyCode == WXK_HOME || keyCode == WXK_NUMPAD_HOME))) - { - grid->SetGridCursor(0, grid->GetGridCursorCol()); - grid->MakeCellVisible(0, grid->GetGridCursorCol()); - return; //no event.Skip() - } - else if ((ctrlPressed && keyCode == WXK_DOWN) || - ((noModPressed || ctrlPressed) && (keyCode == WXK_END || keyCode == WXK_NUMPAD_END))) + if (ctrlPressed) + switch (keyCode) + { + case WXK_UP: + case WXK_NUMPAD_UP: + { + grid->SetGridCursor(0, grid->GetGridCursorCol()); + grid->MakeCellVisible(0, grid->GetGridCursorCol()); + return; //no event.Skip() + } + case WXK_DOWN: + case WXK_NUMPAD_DOWN: + { + grid->SetGridCursor(grid->GetNumberRows() - 1, grid->GetGridCursorCol()); + grid->MakeCellVisible(grid->GetNumberRows() - 1, grid->GetGridCursorCol()); + return; //no event.Skip() + } + case WXK_LEFT: + case WXK_NUMPAD_LEFT: + { + grid->SetGridCursor(grid->GetGridCursorRow(), 0); + grid->MakeCellVisible(grid->GetGridCursorRow(), 0); + return; //no event.Skip() + } + case WXK_RIGHT: + case WXK_NUMPAD_RIGHT: + { + grid->SetGridCursor(grid->GetGridCursorRow(), grid->GetNumberCols() - 1); + grid->MakeCellVisible(grid->GetGridCursorRow(), grid->GetNumberCols() - 1); + return; //no event.Skip() + } + } + + //button with or without control keys pressed + switch (keyCode) { - grid->SetGridCursor(grid->GetNumberRows() - 1, grid->GetGridCursorCol()); - grid->MakeCellVisible(grid->GetNumberRows() - 1, grid->GetGridCursorCol()); - return; //no event.Skip() + case WXK_HOME: + case WXK_NUMPAD_HOME: + { + grid->SetGridCursor(0, grid->GetGridCursorCol()); + grid->MakeCellVisible(0, grid->GetGridCursorCol()); + return; //no event.Skip() + } + case WXK_END: + case WXK_NUMPAD_END: + { + grid->SetGridCursor(grid->GetNumberRows() - 1, grid->GetGridCursorCol()); + grid->MakeCellVisible(grid->GetNumberRows() - 1, grid->GetGridCursorCol()); + return; //no event.Skip() + } + + case WXK_PAGEUP: + case WXK_NUMPAD_PAGEUP: + { + const int rowsPerPage = grid->GetGridWindow()->GetSize().GetHeight() / grid->GetDefaultRowSize(); + const int cursorNewPos = std::max(cursorOldPos - rowsPerPage, 0); + grid->SetGridCursor(cursorNewPos, grid->GetGridCursorCol()); + grid->MakeCellVisible(cursorNewPos, grid->GetGridCursorCol()); + return; //no event.Skip() + } + case WXK_PAGEDOWN: + case WXK_NUMPAD_PAGEDOWN: + { + const int rowsPerPage = grid->GetGridWindow()->GetSize().GetHeight() / grid->GetDefaultRowSize(); + const int cursorNewPos = std::min(cursorOldPos + rowsPerPage, grid->GetNumberRows() - 1); + grid->SetGridCursor(cursorNewPos, grid->GetGridCursorCol()); + grid->MakeCellVisible(cursorNewPos, grid->GetGridCursorCol()); + return; //no event.Skip() + } } //button without additonal control keys pressed - else if (noModPressed && keyCode == WXK_UP) - { - const int cursorNewPos = std::max(cursorOldPos - 1, 0); - grid->SetGridCursor(cursorNewPos, grid->GetGridCursorCol()); - grid->MakeCellVisible(cursorNewPos, grid->GetGridCursorCol()); - return; //no event.Skip() - } - else if (noModPressed && keyCode == WXK_DOWN) - { - const int cursorNewPos = std::min(cursorOldPos + 1, grid->GetNumberRows() - 1); - grid->SetGridCursor(cursorNewPos, grid->GetGridCursorCol()); - grid->MakeCellVisible(cursorNewPos, grid->GetGridCursorCol()); - return; //no event.Skip() - } - else if (noModPressed && keyCode == WXK_LEFT) - { - const int cursorColumn = std::max(cursorOldColumn - 1, 0); - grid->SetGridCursor(cursorOldPos, cursorColumn); - grid->MakeCellVisible(cursorOldPos, cursorColumn); - return; //no event.Skip() - } - else if (noModPressed && keyCode == WXK_RIGHT) - { - const int cursorColumn = std::min(cursorOldColumn + 1, grid->GetNumberCols() - 1); - grid->SetGridCursor(cursorOldPos, cursorColumn); - grid->MakeCellVisible(cursorOldPos, cursorColumn); - return; //no event.Skip() - } - else if ((noModPressed || ctrlPressed) && (keyCode == WXK_PAGEUP || keyCode == WXK_NUMPAD_PAGEUP)) - { - const int rowsPerPage = grid->GetGridWindow()->GetSize().GetHeight() / grid->GetDefaultRowSize(); - const int cursorNewPos = std::max(cursorOldPos - rowsPerPage, 0); - grid->SetGridCursor(cursorNewPos, grid->GetGridCursorCol()); - grid->MakeCellVisible(cursorNewPos, grid->GetGridCursorCol()); - return; //no event.Skip() - } - else if ((noModPressed || ctrlPressed) && (keyCode == WXK_PAGEDOWN || keyCode == WXK_NUMPAD_PAGEDOWN)) - { - const int rowsPerPage = grid->GetGridWindow()->GetSize().GetHeight() / grid->GetDefaultRowSize(); - const int cursorNewPos = std::min(cursorOldPos + rowsPerPage, grid->GetNumberRows() - 1); - grid->SetGridCursor(cursorNewPos, grid->GetGridCursorCol()); - grid->MakeCellVisible(cursorNewPos, grid->GetGridCursorCol()); - return; //no event.Skip() - } + if (keyEvent->GetModifiers() == wxMOD_NONE) + switch (keyCode) + { + case WXK_UP: + case WXK_NUMPAD_UP: + { + const int cursorNewPos = std::max(cursorOldPos - 1, 0); + grid->SetGridCursor(cursorNewPos, grid->GetGridCursorCol()); + grid->MakeCellVisible(cursorNewPos, grid->GetGridCursorCol()); + return; //no event.Skip() + } + case WXK_DOWN: + case WXK_NUMPAD_DOWN: + { + const int cursorNewPos = std::min(cursorOldPos + 1, grid->GetNumberRows() - 1); + grid->SetGridCursor(cursorNewPos, grid->GetGridCursorCol()); + grid->MakeCellVisible(cursorNewPos, grid->GetGridCursorCol()); + return; //no event.Skip() + } + case WXK_LEFT: + case WXK_NUMPAD_LEFT: + { + const int cursorColumn = std::max(cursorOldColumn - 1, 0); + grid->SetGridCursor(cursorOldPos, cursorColumn); + grid->MakeCellVisible(cursorOldPos, cursorColumn); + return; //no event.Skip() + } + case WXK_RIGHT: + case WXK_NUMPAD_RIGHT: + { + const int cursorColumn = std::min(cursorOldColumn + 1, grid->GetNumberCols() - 1); + grid->SetGridCursor(cursorOldPos, cursorColumn); + grid->MakeCellVisible(cursorOldPos, cursorColumn); + return; //no event.Skip() + } + } } anchorRow = grid->GetGridCursorRow(); @@ -869,23 +914,29 @@ bool gridsShouldBeCleared(const wxEvent& event) switch (keyEvent->GetKeyCode()) { - case WXK_TAB: - case WXK_RETURN: - case WXK_ESCAPE: - case WXK_NUMPAD_ENTER: - case WXK_LEFT: - case WXK_UP: - case WXK_RIGHT: - case WXK_DOWN: - case WXK_PAGEUP: - case WXK_PAGEDOWN: - case WXK_NUMPAD_PAGEUP: - case WXK_NUMPAD_PAGEDOWN: - case WXK_HOME: - case WXK_END: - case WXK_NUMPAD_HOME: - case WXK_NUMPAD_END: - return true; + //default navigation keys + case WXK_UP: + case WXK_DOWN: + case WXK_LEFT: + case WXK_RIGHT: + case WXK_PAGEUP: + case WXK_PAGEDOWN: + case WXK_HOME: + case WXK_END: + case WXK_NUMPAD_UP: + case WXK_NUMPAD_DOWN: + case WXK_NUMPAD_LEFT: + case WXK_NUMPAD_RIGHT: + case WXK_NUMPAD_PAGEUP: + case WXK_NUMPAD_PAGEDOWN: + case WXK_NUMPAD_HOME: + case WXK_NUMPAD_END: + //other keys + case WXK_TAB: + case WXK_RETURN: + case WXK_NUMPAD_ENTER: + case WXK_ESCAPE: + return true; } return false; @@ -901,9 +952,9 @@ void CustomGrid::onGridAccess(wxEvent& event) if (!isLeading) { //notify other grids of new user focus - m_gridLeft->isLeading = m_gridLeft == this; + m_gridLeft ->isLeading = m_gridLeft == this; m_gridMiddle->isLeading = m_gridMiddle == this; - m_gridRight->isLeading = m_gridRight == this; + m_gridRight ->isLeading = m_gridRight == this; wxGrid::SetFocus(); } @@ -911,13 +962,13 @@ void CustomGrid::onGridAccess(wxEvent& event) //clear grids if (gridsShouldBeCleared(event)) { - m_gridLeft->ClearSelection(); + m_gridLeft ->ClearSelection(); m_gridMiddle->ClearSelection(); - m_gridRight->ClearSelection(); + m_gridRight ->ClearSelection(); } //update row labels NOW (needed when scrolling if buttons keep being pressed) - m_gridLeft->GetGridRowLabelWindow()->Update(); + m_gridLeft ->GetGridRowLabelWindow()->Update(); m_gridRight->GetGridRowLabelWindow()->Update(); //support for custom short-cuts (overwriting wxWidgets functionality!) @@ -935,8 +986,8 @@ void CustomGrid::adjustGridHeights(wxEvent& event) int y3 = 0; int dummy = 0; - m_gridLeft->GetViewStart(&dummy, &y1); - m_gridRight->GetViewStart(&dummy, &y2); + m_gridLeft ->GetViewStart(&dummy, &y1); + m_gridRight ->GetViewStart(&dummy, &y2); m_gridMiddle->GetViewStart(&dummy, &y3); if (y1 != y2 || y2 != y3) @@ -958,8 +1009,8 @@ void CustomGrid::adjustGridHeights(wxEvent& event) else if (y3 < yMax) m_gridMiddle->SetMargins(0, 30); - m_gridLeft->ForceRefresh(); - m_gridRight->ForceRefresh(); + m_gridLeft ->ForceRefresh(); + m_gridRight ->ForceRefresh(); m_gridMiddle->ForceRefresh(); } } @@ -985,9 +1036,9 @@ void CustomGrid::DrawColLabel(wxDC& dc, int col) if (col == m_marker.first) { if (m_marker.second == ASCENDING) - dc.DrawBitmap(GlobalResources::getInstance().getImageByName(wxT("smallUp")), GetColRight(col) - 16 - 2, 2, true); //respect 2-pixel border + dc.DrawBitmap(GlobalResources::instance().getImage(wxT("smallUp")), GetColRight(col) - 16 - 2, 2, true); //respect 2-pixel border else - dc.DrawBitmap(GlobalResources::getInstance().getImageByName(wxT("smallDown")), GetColRight(col) - 16 - 2, 2, true); //respect 2-pixel border + dc.DrawBitmap(GlobalResources::instance().getImage(wxT("smallDown")), GetColRight(col) - 16 - 2, 2, true); //respect 2-pixel border } } @@ -1081,8 +1132,8 @@ public: { //############## show windows explorer file icons ###################### - if ( showFileIcons && //evaluate at compile time - m_gridDataTable->getTypeAtPos(col) == xmlAccess::FILENAME) + if (showFileIcons && //evaluate at compile time + m_gridDataTable->getTypeAtPos(col) == xmlAccess::FILENAME) { if (rect.GetWidth() >= IconBuffer::ICON_SIZE) { @@ -1117,37 +1168,42 @@ public: { wxIcon icon; bool iconDrawnFully = false; - const bool iconLoaded = IconBuffer::getInstance().requestFileIcon(fileName, &icon); //returns false if icon is not in buffer - if (iconLoaded) { - dc.DrawIcon(icon, rectShrinked.GetX() + LEFT_BORDER, rectShrinked.GetY()); - - //----------------------------------------------------------------------------------------------- - //only mark as successful if icon was drawn fully! - //(attention: when scrolling, rows get partially updated, which can result in the upper half being blank!) + const bool loadSuccess = IconBuffer::getInstance().requestFileIcon(fileName, &icon); //returns false if icon is not in buffer + if (loadSuccess) + { + //----------------------------------------------------------------------------------------------- + //only mark as successful if icon was drawn fully! + //(attention: when scrolling, rows get partially updated, which can result in the upper half being blank!) - //rect where icon was placed - wxRect iconRect(rect); //unscrolled - iconRect.x += LEFT_BORDER; - iconRect.SetWidth(IconBuffer::ICON_SIZE); + //rect where icon was placed + wxRect iconRect(rect); //unscrolled + iconRect.x += LEFT_BORDER; + iconRect.SetWidth(IconBuffer::ICON_SIZE); - //convert to scrolled coordinates - grid.CalcScrolledPosition(iconRect.x, iconRect.y, &iconRect.x, &iconRect.y); + //convert to scrolled coordinates + grid.CalcScrolledPosition(iconRect.x, iconRect.y, &iconRect.x, &iconRect.y); - wxRegionIterator regionsInv(grid.GetGridWindow()->GetUpdateRegion()); - while (regionsInv) - { - if (regionsInv.GetRect().Contains(iconRect)) + wxRegionIterator regionsInv(grid.GetGridWindow()->GetUpdateRegion()); + while (regionsInv) { - iconDrawnFully = true; - break; + if (regionsInv.GetRect().Contains(iconRect)) + { + iconDrawnFully = true; + break; + } + ++regionsInv; } - ++regionsInv; } + else + icon = IconBuffer::getFileIcon(); //better than nothing } + + dc.DrawIcon(icon, rectShrinked.GetX() + LEFT_BORDER, rectShrinked.GetY()); + //----------------------------------------------------------------------------------------------- //save status of last icon load -> used for async. icon loading - m_loadIconSuccess[row] = iconLoaded && iconDrawnFully; + m_loadIconSuccess[row] = iconDrawnFully; } } return; @@ -1164,8 +1220,8 @@ public: wxDC& dc, int row, int col) { - if ( showFileIcons && //evaluate at compile time - m_gridDataTable->getTypeAtPos(col) == xmlAccess::FILENAME) + if (showFileIcons && //evaluate at compile time + m_gridDataTable->getTypeAtPos(col) == xmlAccess::FILENAME) { wxSize rv = wxGridCellStringRenderer::GetBestSize(grid, attr, dc, row, col); rv.SetWidth(rv.GetWidth() + LEFT_BORDER + IconBuffer::ICON_SIZE); @@ -1186,7 +1242,7 @@ private: //---------------------------------------------------------------------------------------- -CustomGridRim::CustomGridRim(wxWindow *parent, +CustomGridRim::CustomGridRim(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, @@ -1374,7 +1430,7 @@ void CustomGridRim::setColumnAttributes(const xmlAccess::ColumnAttributes& attr) SetColAttr(i, cellAttributes); break; } -//---------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------- columnSettings.clear(); if (attr.size() == 0) @@ -1422,7 +1478,7 @@ void CustomGridRim::setColumnAttributes(const xmlAccess::ColumnAttributes& attr) for (size_t i = 0; i < newPositions.size(); ++i) SetColSize(static_cast<int>(i), columnSettings[i].width); -//-------------------------------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------------------------------- //set special alignment for column "size" if (GetLayoutDirection() != wxLayout_RightToLeft) //don't change for RTL languages for (int i = 0; i < GetNumberCols(); ++i) @@ -1452,20 +1508,20 @@ wxString CustomGridRim::getTypeName(xmlAccess::ColumnTypes colType) { switch (colType) { - case xmlAccess::FULL_PATH: - return _("Full path"); - case xmlAccess::FILENAME: - return _("Filename"); - case xmlAccess::REL_PATH: - return _("Relative path"); - case xmlAccess::DIRECTORY: - return _("Directory"); - case xmlAccess::SIZE: - return _("Size"); - case xmlAccess::DATE: - return _("Date"); - case xmlAccess::EXTENSION: - return _("Extension"); + case xmlAccess::FULL_PATH: + return _("Full path"); + case xmlAccess::FILENAME: + return _("Filename"); + case xmlAccess::REL_PATH: + return _("Relative path"); + case xmlAccess::DIRECTORY: + return _("Directory"); + case xmlAccess::SIZE: + return _("Size"); + case xmlAccess::DATE: + return _("Date"); + case xmlAccess::EXTENSION: + return _("Extension"); } return wxEmptyString; //dummy @@ -1648,7 +1704,7 @@ void IconUpdater::loadIconsAsynchronously(wxEvent& event) //loads all (not yet) //merge vectors newLoad.insert(newLoad.end(), iconsLeft.begin(), iconsLeft.end()); - ffs3::IconBuffer::getInstance().setWorkload(newLoad); //attention: newLoad is invalidated after this call!!! + ffs3::IconBuffer::getInstance().setWorkload(newLoad); //event.Skip(); } @@ -1656,7 +1712,7 @@ void IconUpdater::loadIconsAsynchronously(wxEvent& event) //loads all (not yet) //---------------------------------------------------------------------------------------- -CustomGridLeft::CustomGridLeft(wxWindow *parent, +CustomGridLeft::CustomGridLeft(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, @@ -1706,7 +1762,7 @@ CustomGridTable* CustomGridLeft::getGridDataTable() const //---------------------------------------------------------------------------------------- -CustomGridRight::CustomGridRight(wxWindow *parent, +CustomGridRight::CustomGridRight(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, @@ -1784,7 +1840,7 @@ const int CHECK_BOX_WIDTH = CHECK_BOX_IMAGE + 3; //width of first block // ---------------------------------- -CustomGridMiddle::CustomGridMiddle(wxWindow *parent, +CustomGridMiddle::CustomGridMiddle(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, @@ -1918,35 +1974,35 @@ void CustomGridMiddle::showToolTip(int rowNumber, wxPoint pos) const SyncOperation syncOp = fsObj->getSyncOperation(); switch (syncOp) { - case SO_CREATE_NEW_LEFT: - toolTip->show(getDescription(syncOp), pos, &GlobalResources::getInstance().getImageByName(wxT("syncCreateLeftAct"))); - break; - case SO_CREATE_NEW_RIGHT: - toolTip->show(getDescription(syncOp), pos, &GlobalResources::getInstance().getImageByName(wxT("syncCreateRightAct"))); - break; - case SO_DELETE_LEFT: - toolTip->show(getDescription(syncOp), pos, &GlobalResources::getInstance().getImageByName(wxT("syncDeleteLeftAct"))); - break; - case SO_DELETE_RIGHT: - toolTip->show(getDescription(syncOp), pos, &GlobalResources::getInstance().getImageByName(wxT("syncDeleteRightAct"))); - break; - case SO_OVERWRITE_LEFT: - case SO_COPY_METADATA_TO_LEFT: - toolTip->show(getDescription(syncOp), pos, &GlobalResources::getInstance().getImageByName(wxT("syncDirLeftAct"))); - break; - case SO_OVERWRITE_RIGHT: - case SO_COPY_METADATA_TO_RIGHT: - toolTip->show(getDescription(syncOp), pos, &GlobalResources::getInstance().getImageByName(wxT("syncDirRightAct"))); - break; - case SO_DO_NOTHING: - toolTip->show(getDescription(syncOp), pos, &GlobalResources::getInstance().getImageByName(wxT("syncDirNoneAct"))); - break; - case SO_EQUAL: - toolTip->show(getDescription(syncOp), pos, &GlobalResources::getInstance().getImageByName(wxT("equalAct"))); - break; - case SO_UNRESOLVED_CONFLICT: - toolTip->show(fsObj->getSyncOpConflict(), pos, &GlobalResources::getInstance().getImageByName(wxT("conflictAct"))); - break; + case SO_CREATE_NEW_LEFT: + toolTip->show(getDescription(syncOp), pos, &GlobalResources::instance().getImage(wxT("syncCreateLeftAct"))); + break; + case SO_CREATE_NEW_RIGHT: + toolTip->show(getDescription(syncOp), pos, &GlobalResources::instance().getImage(wxT("syncCreateRightAct"))); + break; + case SO_DELETE_LEFT: + toolTip->show(getDescription(syncOp), pos, &GlobalResources::instance().getImage(wxT("syncDeleteLeftAct"))); + break; + case SO_DELETE_RIGHT: + toolTip->show(getDescription(syncOp), pos, &GlobalResources::instance().getImage(wxT("syncDeleteRightAct"))); + break; + case SO_OVERWRITE_LEFT: + case SO_COPY_METADATA_TO_LEFT: + toolTip->show(getDescription(syncOp), pos, &GlobalResources::instance().getImage(wxT("syncDirLeftAct"))); + break; + case SO_OVERWRITE_RIGHT: + case SO_COPY_METADATA_TO_RIGHT: + toolTip->show(getDescription(syncOp), pos, &GlobalResources::instance().getImage(wxT("syncDirRightAct"))); + break; + case SO_DO_NOTHING: + toolTip->show(getDescription(syncOp), pos, &GlobalResources::instance().getImage(wxT("syncDirNoneAct"))); + break; + case SO_EQUAL: + toolTip->show(getDescription(syncOp), pos, &GlobalResources::instance().getImage(wxT("equalAct"))); + break; + case SO_UNRESOLVED_CONFLICT: + toolTip->show(fsObj->getSyncOpConflict(), pos, &GlobalResources::instance().getImage(wxT("conflictAct"))); + break; }; } else @@ -1954,30 +2010,30 @@ void CustomGridMiddle::showToolTip(int rowNumber, wxPoint pos) const CompareFilesResult cmpRes = fsObj->getCategory(); switch (cmpRes) { - case FILE_LEFT_SIDE_ONLY: - toolTip->show(getDescription(cmpRes), pos, &GlobalResources::getInstance().getImageByName(wxT("leftOnlyAct"))); - break; - case FILE_RIGHT_SIDE_ONLY: - toolTip->show(getDescription(cmpRes), pos, &GlobalResources::getInstance().getImageByName(wxT("rightOnlyAct"))); - break; - case FILE_LEFT_NEWER: - toolTip->show(getDescription(cmpRes), pos, &GlobalResources::getInstance().getImageByName(wxT("leftNewerAct"))); - break; - case FILE_RIGHT_NEWER: - toolTip->show(getDescription(cmpRes), pos, &GlobalResources::getInstance().getImageByName(wxT("rightNewerAct"))); - break; - case FILE_DIFFERENT: - toolTip->show(getDescription(cmpRes), pos, &GlobalResources::getInstance().getImageByName(wxT("differentAct"))); - break; - case FILE_EQUAL: - toolTip->show(getDescription(cmpRes), pos, &GlobalResources::getInstance().getImageByName(wxT("equalAct"))); - break; - case FILE_DIFFERENT_METADATA: - toolTip->show(getDescription(cmpRes), pos, &GlobalResources::getInstance().getImageByName(wxT("conflictAct"))); - break; - case FILE_CONFLICT: - toolTip->show(fsObj->getCatConflict(), pos, &GlobalResources::getInstance().getImageByName(wxT("conflictAct"))); - break; + case FILE_LEFT_SIDE_ONLY: + toolTip->show(getDescription(cmpRes), pos, &GlobalResources::instance().getImage(wxT("leftOnlyAct"))); + break; + case FILE_RIGHT_SIDE_ONLY: + toolTip->show(getDescription(cmpRes), pos, &GlobalResources::instance().getImage(wxT("rightOnlyAct"))); + break; + case FILE_LEFT_NEWER: + toolTip->show(getDescription(cmpRes), pos, &GlobalResources::instance().getImage(wxT("leftNewerAct"))); + break; + case FILE_RIGHT_NEWER: + toolTip->show(getDescription(cmpRes), pos, &GlobalResources::instance().getImage(wxT("rightNewerAct"))); + break; + case FILE_DIFFERENT: + toolTip->show(getDescription(cmpRes), pos, &GlobalResources::instance().getImage(wxT("differentAct"))); + break; + case FILE_EQUAL: + toolTip->show(getDescription(cmpRes), pos, &GlobalResources::instance().getImage(wxT("equalAct"))); + break; + case FILE_DIFFERENT_METADATA: + toolTip->show(getDescription(cmpRes), pos, &GlobalResources::instance().getImage(wxT("conflictAct"))); + break; + case FILE_CONFLICT: + toolTip->show(fsObj->getCatConflict(), pos, &GlobalResources::instance().getImage(wxT("conflictAct"))); + break; } } } @@ -1998,34 +2054,34 @@ void CustomGridMiddle::OnLeftMouseUp(wxMouseEvent& event) { switch (selectionPos) { - case BLOCKPOS_CHECK_BOX: - { - //create a custom event - FFSCheckRowsEvent evt(selectionRowBegin, rowEndFiltering); - AddPendingEvent(evt); - } - break; - case BLOCKPOS_LEFT: - { - //create a custom event - FFSSyncDirectionEvent evt(selectionRowBegin, rowEndFiltering, SYNC_DIR_LEFT); - AddPendingEvent(evt); - } - break; - case BLOCKPOS_MIDDLE: - { - //create a custom event - FFSSyncDirectionEvent evt(selectionRowBegin, rowEndFiltering, SYNC_DIR_NONE); - AddPendingEvent(evt); - } - break; - case BLOCKPOS_RIGHT: - { - //create a custom event - FFSSyncDirectionEvent evt(selectionRowBegin, rowEndFiltering, SYNC_DIR_RIGHT); - AddPendingEvent(evt); - } - break; + case BLOCKPOS_CHECK_BOX: + { + //create a custom event + FFSCheckRowsEvent evt(selectionRowBegin, rowEndFiltering); + AddPendingEvent(evt); + } + break; + case BLOCKPOS_LEFT: + { + //create a custom event + FFSSyncDirectionEvent evt(selectionRowBegin, rowEndFiltering, SYNC_DIR_LEFT); + AddPendingEvent(evt); + } + break; + case BLOCKPOS_MIDDLE: + { + //create a custom event + FFSSyncDirectionEvent evt(selectionRowBegin, rowEndFiltering, SYNC_DIR_NONE); + AddPendingEvent(evt); + } + break; + case BLOCKPOS_RIGHT: + { + //create a custom event + FFSSyncDirectionEvent evt(selectionRowBegin, rowEndFiltering, SYNC_DIR_RIGHT); + AddPendingEvent(evt); + } + break; } } selectionRowBegin = -1; @@ -2057,9 +2113,9 @@ int CustomGridMiddle::mousePosToRow(wxPoint pos, BlockPosition* block) if (row >= 0) { const FileSystemObject* const fsObj = getGridDataTableMiddle()->getRawData(row); - if ( fsObj != NULL && //if valid row... - getGridDataTableMiddle()->syncPreviewIsActive() && - fsObj->getSyncOperation() != SO_EQUAL) //in sync-preview equal files shall be treated as in cmp result, i.e. as full checkbox + if (fsObj != NULL && //if valid row... + getGridDataTableMiddle()->syncPreviewIsActive() && + fsObj->getSyncOperation() != SO_EQUAL) //in sync-preview equal files shall be treated as in cmp result, i.e. as full checkbox { // cell: // ---------------------------------- @@ -2125,19 +2181,19 @@ void GridCellRendererMiddle::Draw(wxGrid& grid, rectShrinked.SetX(rect.GetX() + 1); //HIGHLIGHTNING (checkbox): - if ( rowIsHighlighted && - m_gridMiddle.highlightedPos == CustomGridMiddle::BLOCKPOS_CHECK_BOX) + if (rowIsHighlighted && + m_gridMiddle.highlightedPos == CustomGridMiddle::BLOCKPOS_CHECK_BOX) { if (fsObj->isActive()) - dc.DrawLabel(wxEmptyString, GlobalResources::getInstance().getImageByName(wxT("checkboxTrueFocus")), rectShrinked, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); + dc.DrawLabel(wxEmptyString, GlobalResources::instance().getImage(wxT("checkboxTrueFocus")), rectShrinked, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); else - dc.DrawLabel(wxEmptyString, GlobalResources::getInstance().getImageByName(wxT("checkboxFalseFocus")), rectShrinked, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); + dc.DrawLabel(wxEmptyString, GlobalResources::instance().getImage(wxT("checkboxFalseFocus")), rectShrinked, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); } //default else if (fsObj->isActive()) - dc.DrawLabel(wxEmptyString, GlobalResources::getInstance().getImageByName(wxT("checkboxTrue")), rectShrinked, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); + dc.DrawLabel(wxEmptyString, GlobalResources::instance().getImage(wxT("checkboxTrue")), rectShrinked, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); else - dc.DrawLabel(wxEmptyString, GlobalResources::getInstance().getImageByName(wxT("checkboxFalse")), rectShrinked, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); + dc.DrawLabel(wxEmptyString, GlobalResources::instance().getImage(wxT("checkboxFalse")), rectShrinked, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); //clean remaining block of rect that will receive image of checkbox/directions rectShrinked.SetWidth(rect.GetWidth() - CHECK_BOX_WIDTH); @@ -2150,21 +2206,21 @@ void GridCellRendererMiddle::Draw(wxGrid& grid, //print sync direction into second block //HIGHLIGHTNING (sync direction): - if ( rowIsHighlighted && - m_gridMiddle.highlightedPos != CustomGridMiddle::BLOCKPOS_CHECK_BOX) //don't allow changing direction for "=="-files + if (rowIsHighlighted && + m_gridMiddle.highlightedPos != CustomGridMiddle::BLOCKPOS_CHECK_BOX) //don't allow changing direction for "=="-files switch (m_gridMiddle.highlightedPos) { - case CustomGridMiddle::BLOCKPOS_CHECK_BOX: - break; - case CustomGridMiddle::BLOCKPOS_LEFT: - dc.DrawLabel(wxEmptyString, getSyncOpImage(fsObj->testSyncOperation(true, SYNC_DIR_LEFT)), rectShrinked, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); - break; - case CustomGridMiddle::BLOCKPOS_MIDDLE: - dc.DrawLabel(wxEmptyString, getSyncOpImage(fsObj->testSyncOperation(true, SYNC_DIR_NONE)), rectShrinked, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); - break; - case CustomGridMiddle::BLOCKPOS_RIGHT: - dc.DrawLabel(wxEmptyString, getSyncOpImage(fsObj->testSyncOperation(true, SYNC_DIR_RIGHT)), rectShrinked, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); - break; + case CustomGridMiddle::BLOCKPOS_CHECK_BOX: + break; + case CustomGridMiddle::BLOCKPOS_LEFT: + dc.DrawLabel(wxEmptyString, getSyncOpImage(fsObj->testSyncOperation(true, SYNC_DIR_LEFT)), rectShrinked, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); + break; + case CustomGridMiddle::BLOCKPOS_MIDDLE: + dc.DrawLabel(wxEmptyString, getSyncOpImage(fsObj->testSyncOperation(true, SYNC_DIR_NONE)), rectShrinked, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); + break; + case CustomGridMiddle::BLOCKPOS_RIGHT: + dc.DrawLabel(wxEmptyString, getSyncOpImage(fsObj->testSyncOperation(true, SYNC_DIR_RIGHT)), rectShrinked, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + break; } else //default { @@ -2176,28 +2232,28 @@ void GridCellRendererMiddle::Draw(wxGrid& grid, { switch (fsObj->getCategory()) { - case FILE_LEFT_SIDE_ONLY: - dc.DrawLabel(wxEmptyString, GlobalResources::getInstance().getImageByName(wxT("leftOnlySmall")), rectShrinked, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); - break; - case FILE_RIGHT_SIDE_ONLY: - dc.DrawLabel(wxEmptyString, GlobalResources::getInstance().getImageByName(wxT("rightOnlySmall")), rectShrinked, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); - break; - case FILE_LEFT_NEWER: - dc.DrawLabel(wxEmptyString, GlobalResources::getInstance().getImageByName(wxT("leftNewerSmall")), rectShrinked, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); - break; - case FILE_RIGHT_NEWER: - dc.DrawLabel(wxEmptyString, GlobalResources::getInstance().getImageByName(wxT("rightNewerSmall")), rectShrinked, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); - break; - case FILE_DIFFERENT: - dc.DrawLabel(wxEmptyString, GlobalResources::getInstance().getImageByName(wxT("differentSmall")), rectShrinked, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); - break; - case FILE_EQUAL: - dc.DrawLabel(wxEmptyString, GlobalResources::getInstance().getImageByName(wxT("equalSmall")), rectShrinked, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); - break; - case FILE_CONFLICT: - case FILE_DIFFERENT_METADATA: - dc.DrawLabel(wxEmptyString, GlobalResources::getInstance().getImageByName(wxT("conflictSmall")), rectShrinked, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); - break; + case FILE_LEFT_SIDE_ONLY: + dc.DrawLabel(wxEmptyString, GlobalResources::instance().getImage(wxT("leftOnlySmall")), rectShrinked, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); + break; + case FILE_RIGHT_SIDE_ONLY: + dc.DrawLabel(wxEmptyString, GlobalResources::instance().getImage(wxT("rightOnlySmall")), rectShrinked, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); + break; + case FILE_LEFT_NEWER: + dc.DrawLabel(wxEmptyString, GlobalResources::instance().getImage(wxT("leftNewerSmall")), rectShrinked, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); + break; + case FILE_RIGHT_NEWER: + dc.DrawLabel(wxEmptyString, GlobalResources::instance().getImage(wxT("rightNewerSmall")), rectShrinked, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); + break; + case FILE_DIFFERENT: + dc.DrawLabel(wxEmptyString, GlobalResources::instance().getImage(wxT("differentSmall")), rectShrinked, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); + break; + case FILE_EQUAL: + dc.DrawLabel(wxEmptyString, GlobalResources::instance().getImage(wxT("equalSmall")), rectShrinked, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); + break; + case FILE_CONFLICT: + case FILE_DIFFERENT_METADATA: + dc.DrawLabel(wxEmptyString, GlobalResources::instance().getImage(wxT("conflictSmall")), rectShrinked, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); + break; } } @@ -2231,9 +2287,9 @@ void CustomGridMiddle::DrawColLabel(wxDC& dc, int col) const wxRect rect(GetColLeft(col), 0, GetColWidth(col), GetColLabelSize()); if (getGridDataTableMiddle()->syncPreviewIsActive()) - dc.DrawLabel(wxEmptyString, GlobalResources::getInstance().getImageByName(wxT("syncViewSmall")), rect, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL); + dc.DrawLabel(wxEmptyString, GlobalResources::instance().getImage(wxT("syncViewSmall")), rect, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL); else - dc.DrawLabel(wxEmptyString, GlobalResources::getInstance().getImageByName(wxT("cmpViewSmall")), rect, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL); + dc.DrawLabel(wxEmptyString, GlobalResources::instance().getImage(wxT("cmpViewSmall")), rect, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL); } @@ -2241,26 +2297,26 @@ const wxBitmap& ffs3::getSyncOpImage(SyncOperation syncOp) { switch (syncOp) //evaluate comparison result and sync direction { - case SO_CREATE_NEW_LEFT: - return GlobalResources::getInstance().getImageByName(wxT("createLeftSmall")); - case SO_CREATE_NEW_RIGHT: - return GlobalResources::getInstance().getImageByName(wxT("createRightSmall")); - case SO_DELETE_LEFT: - return GlobalResources::getInstance().getImageByName(wxT("deleteLeftSmall")); - case SO_DELETE_RIGHT: - return GlobalResources::getInstance().getImageByName(wxT("deleteRightSmall")); - case SO_OVERWRITE_RIGHT: - case SO_COPY_METADATA_TO_RIGHT: - return GlobalResources::getInstance().getImageByName(wxT("syncDirRightSmall")); - case SO_OVERWRITE_LEFT: - case SO_COPY_METADATA_TO_LEFT: - return GlobalResources::getInstance().getImageByName(wxT("syncDirLeftSmall")); - case SO_DO_NOTHING: - return GlobalResources::getInstance().getImageByName(wxT("syncDirNoneSmall")); - case SO_EQUAL: - return GlobalResources::getInstance().getImageByName(wxT("equalSmall")); - case SO_UNRESOLVED_CONFLICT: - return GlobalResources::getInstance().getImageByName(wxT("conflictSmall")); + case SO_CREATE_NEW_LEFT: + return GlobalResources::instance().getImage(wxT("createLeftSmall")); + case SO_CREATE_NEW_RIGHT: + return GlobalResources::instance().getImage(wxT("createRightSmall")); + case SO_DELETE_LEFT: + return GlobalResources::instance().getImage(wxT("deleteLeftSmall")); + case SO_DELETE_RIGHT: + return GlobalResources::instance().getImage(wxT("deleteRightSmall")); + case SO_OVERWRITE_RIGHT: + case SO_COPY_METADATA_TO_RIGHT: + return GlobalResources::instance().getImage(wxT("syncDirRightSmall")); + case SO_OVERWRITE_LEFT: + case SO_COPY_METADATA_TO_LEFT: + return GlobalResources::instance().getImage(wxT("syncDirLeftSmall")); + case SO_DO_NOTHING: + return GlobalResources::instance().getImage(wxT("syncDirNoneSmall")); + case SO_EQUAL: + return GlobalResources::instance().getImage(wxT("equalSmall")); + case SO_UNRESOLVED_CONFLICT: + return GlobalResources::instance().getImage(wxT("conflictSmall")); } return wxNullBitmap; //dummy diff --git a/library/custom_grid.h b/library/custom_grid.h index 1517230b..e8138bfc 100644 --- a/library/custom_grid.h +++ b/library/custom_grid.h @@ -54,7 +54,7 @@ CustomGridLeft CustomGridRight CustomGridMiddle class CustomGrid : public wxGrid { public: - CustomGrid(wxWindow *parent, + CustomGrid(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, @@ -97,12 +97,13 @@ protected: virtual CustomGridTable* getGridDataTable() const = 0; private: + void onGridAccess(wxEvent& event); + //this method is called when grid view changes: useful for parallel updating of multiple grids void OnPaintGrid(wxEvent& event); virtual void alignOtherGrids(CustomGrid* gridLeft, CustomGrid* gridMiddle, CustomGrid* gridRight) = 0; - void onGridAccess(wxEvent& event); void adjustGridHeights(wxEvent& event); CustomGrid* m_gridLeft; @@ -144,7 +145,7 @@ class CustomGridRim : public CustomGrid friend class GridCellRenderer; public: - CustomGridRim(wxWindow *parent, + CustomGridRim(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, @@ -201,7 +202,7 @@ private: class CustomGridLeft : public CustomGridRim { public: - CustomGridLeft(wxWindow *parent, + CustomGridLeft(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, @@ -224,7 +225,7 @@ private: class CustomGridRight : public CustomGridRim { public: - CustomGridRight(wxWindow *parent, + CustomGridRight(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, @@ -249,7 +250,7 @@ class CustomGridMiddle : public CustomGrid friend class GridCellRendererMiddle; public: - CustomGridMiddle(wxWindow *parent, + CustomGridMiddle(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, diff --git a/library/detect_renaming.cpp b/library/detect_renaming.cpp index 3c491ae3..0e19451c 100644 --- a/library/detect_renaming.cpp +++ b/library/detect_renaming.cpp @@ -126,7 +126,7 @@ void FindDBAssoc::recurse(const DirContainer& leftSide, const DirContainer& righ } } -//----------------------------------------------------------------------------------------------- + //----------------------------------------------------------------------------------------------- for (DirContainer::SubDirList::const_iterator i = leftSide.getSubDirs().begin(); i != leftSide.getSubDirs().end(); ++i) { const DirContainer::SubDirList::const_iterator j = rightSide.getSubDirs().find(i->first); @@ -172,35 +172,35 @@ private: { switch (fileObj.getSyncOperation()) //evaluate comparison result and sync direction { - case SO_CREATE_NEW_LEFT: - if (!fileObj.getFileID<RIGHT_SIDE>().isNull()) //fileIdentifier may be NULL - createLeft[FindDBAssoc::AssocKey(fileObj.getFileID<RIGHT_SIDE>(), - fileObj.getLastWriteTime<RIGHT_SIDE>(), - fileObj.getFileSize<RIGHT_SIDE>())] = &fileObj; - break; - - case SO_CREATE_NEW_RIGHT: - if (!fileObj.getFileID<LEFT_SIDE>().isNull()) //fileIdentifier may be NULL - createRight.push_back(&fileObj); - break; - - case SO_DELETE_LEFT: - if (!fileObj.getFileID<LEFT_SIDE>().isNull()) //fileIdentifier may be NULL - deleteLeft.push_back(&fileObj); - break; - - case SO_DELETE_RIGHT: - if (!fileObj.getFileID<RIGHT_SIDE>().isNull()) //fileIdentifier may be NULL - deleteRight[FindDBAssoc::AssocKey(fileObj.getFileID<RIGHT_SIDE>(), - fileObj.getLastWriteTime<RIGHT_SIDE>(), - fileObj.getFileSize<RIGHT_SIDE>())] = &fileObj; - break; - - case SO_OVERWRITE_RIGHT: - case SO_OVERWRITE_LEFT: - case SO_DO_NOTHING: - case SO_UNRESOLVED_CONFLICT: - break; + case SO_CREATE_NEW_LEFT: + if (!fileObj.getFileID<RIGHT_SIDE>().isNull()) //fileIdentifier may be NULL + createLeft[FindDBAssoc::AssocKey(fileObj.getFileID<RIGHT_SIDE>(), + fileObj.getLastWriteTime<RIGHT_SIDE>(), + fileObj.getFileSize<RIGHT_SIDE>())] = &fileObj; + break; + + case SO_CREATE_NEW_RIGHT: + if (!fileObj.getFileID<LEFT_SIDE>().isNull()) //fileIdentifier may be NULL + createRight.push_back(&fileObj); + break; + + case SO_DELETE_LEFT: + if (!fileObj.getFileID<LEFT_SIDE>().isNull()) //fileIdentifier may be NULL + deleteLeft.push_back(&fileObj); + break; + + case SO_DELETE_RIGHT: + if (!fileObj.getFileID<RIGHT_SIDE>().isNull()) //fileIdentifier may be NULL + deleteRight[FindDBAssoc::AssocKey(fileObj.getFileID<RIGHT_SIDE>(), + fileObj.getLastWriteTime<RIGHT_SIDE>(), + fileObj.getFileSize<RIGHT_SIDE>())] = &fileObj; + break; + + case SO_OVERWRITE_RIGHT: + case SO_OVERWRITE_LEFT: + case SO_DO_NOTHING: + case SO_UNRESOLVED_CONFLICT: + break; } } @@ -208,11 +208,11 @@ private: std::vector<FileMapping*> createRight; //pointer always bound! std::vector<FileMapping*> deleteLeft; // -// | -// \|/ + // | + // \|/ std::map<FindDBAssoc::AssocKey, Utility::FileID> assocDBLeftToRight; -// | -// \|/ + // | + // \|/ std::map<FindDBAssoc::AssocKey, FileMapping*> deleteRight; //pointer always bound! std::map<FindDBAssoc::AssocKey, FileMapping*> createLeft; // @@ -225,8 +225,8 @@ void FindRenameCandidates::getRenameCandidates( std::vector<std::pair<FileMapping*, FileMapping*> >& renameOnRight) { for (std::vector<FileMapping*>::const_iterator crRightIter = createRight.begin(); - crRightIter != createRight.end(); - ++crRightIter) + crRightIter != createRight.end(); + ++crRightIter) { const FindDBAssoc::AssocKey assocDbKey((*crRightIter)->getFileID<LEFT_SIDE>(), (*crRightIter)->getLastWriteTime<LEFT_SIDE>(), @@ -239,8 +239,8 @@ void FindRenameCandidates::getRenameCandidates( { std::map<FindDBAssoc::AssocKey, FileMapping*>::const_iterator delRightIter = deleteRight.find(FindDBAssoc::AssocKey(assocDBIter->second, //FileID of right side - assocDbKey.lastWriteTimeRaw_, - assocDbKey.fileSize_)); + assocDbKey.lastWriteTimeRaw_, + assocDbKey.fileSize_)); if (delRightIter != deleteRight.end()) { @@ -250,8 +250,8 @@ void FindRenameCandidates::getRenameCandidates( } //------------------------------------------------------------------------------------------------ for (std::vector<FileMapping*>::const_iterator delLeftIter = deleteLeft.begin(); - delLeftIter != deleteLeft.end(); - ++delLeftIter) + delLeftIter != deleteLeft.end(); + ++delLeftIter) { const FindDBAssoc::AssocKey assocDbKey((*delLeftIter)->getFileID<LEFT_SIDE>(), (*delLeftIter)->getLastWriteTime<LEFT_SIDE>(), @@ -264,8 +264,8 @@ void FindRenameCandidates::getRenameCandidates( { std::map<FindDBAssoc::AssocKey, FileMapping*>::const_iterator createLeftIter = createLeft.find(FindDBAssoc::AssocKey(assocDBIter->second, //FileID of right side - assocDbKey.lastWriteTimeRaw_, - assocDbKey.fileSize_)); + assocDbKey.lastWriteTimeRaw_, + assocDbKey.fileSize_)); if (createLeftIter != createLeft.end()) { diff --git a/library/dir_lock.cpp b/library/dir_lock.cpp index 3d443b11..ba515a31 100644 --- a/library/dir_lock.cpp +++ b/library/dir_lock.cpp @@ -85,8 +85,11 @@ public: const char buffer[1] = {' '}; #ifdef FFS_WIN + //ATTENTION: setting file pointer IS required! => use CreateFile/FILE_GENERIC_WRITE + SetFilePointerEx! + //although CreateFile/FILE_APPEND_DATA without SetFilePointerEx works locally, it MAY NOT work on some network shares creating a 4 gig file!!! + const HANDLE fileHandle = ::CreateFile(applyLongPathPrefix(lockfilename_.c_str()).c_str(), - FILE_APPEND_DATA, + FILE_GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, @@ -98,8 +101,11 @@ public: Loki::ScopeGuard dummy = Loki::MakeGuard(::CloseHandle, fileHandle); (void)dummy; //silence warning "unused variable" - const DWORD fpLow = ::SetFilePointer(fileHandle, 0, NULL, FILE_END); - if (fpLow == INVALID_SET_FILE_POINTER) + const LARGE_INTEGER moveDist = {}; + if (!::SetFilePointerEx(fileHandle, //__in HANDLE hFile, + moveDist, //__in LARGE_INTEGER liDistanceToMove, + NULL, //__out_opt PLARGE_INTEGER lpNewFilePointer, + FILE_END)) //__in DWORD dwMoveMethod return; DWORD bytesWritten = 0; @@ -158,8 +164,8 @@ wxULongLong getLockFileSize(const Zstring& filename) //throw (FileError, ErrorNo const DWORD lastError = ::GetLastError(); const wxString errorMessage = wxString(_("Error reading file attributes:")) + wxT("\n\"") + zToWx(filename) + wxT("\"") + wxT("\n\n") + getLastErrorFormatted(lastError); - if ( lastError == ERROR_FILE_NOT_FOUND || - lastError == ERROR_PATH_NOT_FOUND) + if (lastError == ERROR_FILE_NOT_FOUND || + lastError == ERROR_PATH_NOT_FOUND) throw ErrorNotExisting(errorMessage); else throw FileError(errorMessage); @@ -253,9 +259,9 @@ struct LockInformation char formatDescr[sizeof(LOCK_FORMAT_DESCR)] = {}; stream.Read(formatDescr, sizeof(LOCK_FORMAT_DESCR)); //file format header const int lockFileVersion = util::readNumber<boost::int32_t>(stream); // - (void)lockFileVersion; + (void)lockFileVersion; - //some format checking here? + //some format checking here? lockId = readString(stream); procDescr.processId = static_cast<ProcessId>(util::readNumber<boost::uint64_t>(stream)); //possible loss of precision (32/64 bit process) covered by buildId @@ -299,8 +305,8 @@ enum ProcessStatus }; ProcessStatus getProcessStatus(const LockInformation::ProcessDescription& procDescr) { - if ( procDescr.computerId != getComputerId() || - procDescr.computerId.empty()) //both names are empty + if (procDescr.computerId != getComputerId() || + procDescr.computerId.empty()) //both names are empty return PROC_STATUS_NO_IDEA; //lock owned by different computer #ifdef FFS_WIN @@ -310,7 +316,8 @@ ProcessStatus getProcessStatus(const LockInformation::ProcessDescription& procDe 0); //__in DWORD th32ProcessID if (snapshot == INVALID_HANDLE_VALUE) return PROC_STATUS_NO_IDEA; - boost::shared_ptr<void> dummy(snapshot, ::CloseHandle); + Loki::ScopeGuard dummy = Loki::MakeGuard(::CloseHandle, snapshot); + (void)dummy; //silence warning "unused variable" PROCESSENTRY32 processEntry = {}; processEntry.dwSize = sizeof(processEntry); @@ -386,8 +393,8 @@ void waitOnDirLock(const Zstring& lockfilename, DirLockCallback* callback) //thr lockSilentStart = currentTime; } - if ( lockOwnderDead || //no need to wait any longer... - currentTime - lockSilentStart > DETECT_EXITUS_INTERVAL) + if (lockOwnderDead || //no need to wait any longer... + currentTime - lockSilentStart > DETECT_EXITUS_INTERVAL) { DirLock dummy(deleteAbandonedLockName(lockfilename), callback); //throw (FileError) diff --git a/library/error_log.cpp b/library/error_log.cpp index 4f7c5847..1549c6b5 100644 --- a/library/error_log.cpp +++ b/library/error_log.cpp @@ -12,46 +12,74 @@ using ffs3::ErrorLogging; -void ErrorLogging::logInfo(const wxString& infoMessage) +void ErrorLogging::logMsg(const wxString& message, ffs3::MessageType type) { - const wxString prefix = wxString(wxT("[")) + wxDateTime::Now().FormatTime() + wxT("] ") + _("Info") + wxT(": "); - formattedMessages.push_back(assembleMessage(prefix, infoMessage)); -} + Entry newEntry; + newEntry.type = type; + newEntry.time = wxDateTime::GetTimeNow(); + newEntry.message = message; + messages.push_back(newEntry); -void ErrorLogging::logWarning(const wxString& warningMessage) -{ - const wxString prefix = wxString(wxT("[")) + wxDateTime::Now().FormatTime() + wxT("] ") + _("Warning") + wxT(": "); - formattedMessages.push_back(assembleMessage(prefix, warningMessage)); + ++statistics[type]; } -void ErrorLogging::logError(const wxString& errorMessage) +int ErrorLogging::typeCount(int types) const { - ++errorCount; + int count = 0; + + if (types & TYPE_INFO) + count += statistics[TYPE_INFO]; + if (types & TYPE_WARNING) + count += statistics[TYPE_WARNING]; + if (types & TYPE_ERROR) + count += statistics[TYPE_ERROR]; + if (types & TYPE_FATAL_ERROR) + count += statistics[TYPE_FATAL_ERROR]; - const wxString prefix = wxString(wxT("[")) + wxDateTime::Now().FormatTime() + wxT("] ") + _("Error") + wxT(": "); - formattedMessages.push_back(assembleMessage(prefix, errorMessage)); + return count; } -void ErrorLogging::logFatalError(const wxString& errorMessage) +std::vector<wxString> ErrorLogging::getFormattedMessages(int types) const { - ++errorCount; + std::vector<wxString> output; - const wxString prefix = wxString(wxT("[")) + wxDateTime::Now().FormatTime() + wxT("] ") + _("Fatal Error") + wxT(": "); - formattedMessages.push_back(assembleMessage(prefix, errorMessage)); + for (std::vector<Entry>::const_iterator i = messages.begin(); i != messages.end(); ++i) + if (i->type & types) + output.push_back(formatMessage(*i)); + + return output; } -wxString ErrorLogging::assembleMessage(const wxString& prefix, const wxString& message) +wxString ErrorLogging::formatMessage(const Entry& msg) { - const size_t prefixLength = prefix.size(); + wxString typeName; + switch (msg.type) + { + case TYPE_INFO: + typeName = _("Info"); + break; + case TYPE_WARNING: + typeName = _("Warning"); + break; + case TYPE_ERROR: + typeName = _("Error"); + break; + case TYPE_FATAL_ERROR: + typeName = _("Fatal Error"); + break; + } + + const wxString prefix = wxString(wxT("[")) + wxDateTime(msg.time).FormatTime() + wxT("] ") + typeName + wxT(": "); + wxString formattedText = prefix; - for (wxString::const_iterator i = message.begin(); i != message.end(); ++i) + for (wxString::const_iterator i = msg.message.begin(); i != msg.message.end(); ++i) if (*i == wxChar('\n')) { - formattedText += wxString(wxChar('\n')).Pad(prefixLength, wxChar(' '), true); + formattedText += wxString(wxChar('\n')).Pad(prefix.size(), wxChar(' '), true); while (*++i == wxChar('\n')) //remove duplicate newlines ; --i; diff --git a/library/error_log.h b/library/error_log.h index d5696f80..ff4d3aee 100644 --- a/library/error_log.h +++ b/library/error_log.h @@ -9,37 +9,42 @@ #include <wx/string.h> #include <vector> +#include <map> #include "../shared/zstring.h" namespace ffs3 { +enum MessageType +{ + TYPE_INFO = 1, + TYPE_WARNING = 2, + TYPE_ERROR = 4, + TYPE_FATAL_ERROR = 8, +}; + class ErrorLogging { public: - ErrorLogging() : errorCount(0) {} + void logMsg(const wxString& message, MessageType type); - void logInfo( const wxString& infoMessage); - void logWarning( const wxString& warningMessage); - void logError( const wxString& errorMessage); - void logFatalError(const wxString& errorMessage); + int typeCount(int types = TYPE_INFO | TYPE_WARNING | TYPE_ERROR | TYPE_FATAL_ERROR) const; - int errorsTotal() - { - return errorCount; - } + std::vector<wxString> getFormattedMessages(int types = TYPE_INFO | TYPE_WARNING | TYPE_ERROR | TYPE_FATAL_ERROR) const; - typedef std::vector<wxString> MessageEntry; - const MessageEntry& getFormattedMessages() const +private: + struct Entry { - return formattedMessages; - } + MessageType type; + time_t time; + wxString message; + }; -private: - wxString assembleMessage(const wxString& prefix, const wxString& message); + static wxString formatMessage(const Entry& msg); + + std::vector<Entry> messages; //list of non-resolved errors and warnings - MessageEntry formattedMessages; //list of non-resolved errors and warnings - int errorCount; + mutable std::map<MessageType, int> statistics; }; } diff --git a/library/filter.cpp b/library/filter.cpp index 789a5d81..70933b13 100644 --- a/library/filter.cpp +++ b/library/filter.cpp @@ -88,7 +88,7 @@ void addFilterEntry(const Zstring& filtername, std::set<Zstring>& fileFilter, st static const Zstring asteriskSep = Zstring(Zchar('*')) + common::FILE_NAME_SEPARATOR; static const Zstring questionMarkSep = Zstring(Zchar('?')) + common::FILE_NAME_SEPARATOR; -//-------------------------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------------------------- //add some syntactic sugar: handle beginning of filtername if (filterFormatted.StartsWith(common::FILE_NAME_SEPARATOR)) { @@ -101,7 +101,7 @@ void addFilterEntry(const Zstring& filtername, std::set<Zstring>& fileFilter, st addFilterEntry(Zstring(filterFormatted.c_str() + 1), fileFilter, directoryFilter); //prevent further recursion by prefix } -//-------------------------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------------------------- //even more syntactic sugar: handle end of filtername if (filterFormatted.EndsWith(common::FILE_NAME_SEPARATOR)) { @@ -149,35 +149,35 @@ bool matchesMask(const Zchar* string, const Zchar* mask) { switch (ch) { - case Zchar('?'): - if (*string == 0) - return false; - break; - - case Zchar('*'): - //advance to next non-*/? char - do - { - ++mask; - ch = *mask; - } - while (ch == Zchar('*') || ch == Zchar('?')); - //if match ends with '*': - if (ch == 0) - return true; - - ++mask; - while ((string = cStringFind(string, ch)) != NULL) - { - ++string; - if (matchesMask(string, mask)) + case Zchar('?'): + if (*string == 0) + return false; + break; + + case Zchar('*'): + //advance to next non-*/? char + do + { + ++mask; + ch = *mask; + } + while (ch == Zchar('*') || ch == Zchar('?')); + //if match ends with '*': + if (ch == 0) return true; - } - return false; - default: - if (*string != ch) + ++mask; + while ((string = cStringFind(string, ch)) != NULL) + { + ++string; + if (matchesMask(string, mask)) + return true; + } return false; + + default: + if (*string != ch) + return false; } } return *string == 0; @@ -194,15 +194,15 @@ bool matchesMaskBegin(const Zchar* string, const Zchar* mask) switch (ch) { - case Zchar('?'): - break; + case Zchar('?'): + break; - case Zchar('*'): - return true; + case Zchar('*'): + return true; - default: - if (*string != ch) - return false; + default: + if (*string != ch) + return false; } } return *string == 0; diff --git a/library/icon_buffer.cpp b/library/icon_buffer.cpp index e03ec8c4..e346e4be 100644 --- a/library/icon_buffer.cpp +++ b/library/icon_buffer.cpp @@ -38,7 +38,7 @@ IconBuffer::BasicString IconBuffer::getFileExtension(const BasicString& filename //test for extension for icons that physically have to be retrieved from disc bool IconBuffer::isPriceyExtension(const IconBuffer::BasicString& extension) { - static std::set<BasicString, LessFilename> exceptions; + static std::set<BasicString, LessFilename> exceptions; //not thread-safe, but called from worker thread only! if (exceptions.empty()) { exceptions.insert(Zstr("exe")); @@ -70,9 +70,9 @@ public: //icon holder has value semantics! IconHolder(const IconHolder& other) : handle_(other.handle_ == 0 ? 0 : #ifdef FFS_WIN - ::CopyIcon(other.handle_) + ::CopyIcon(other.handle_) #elif defined FFS_LINUX - gdk_pixbuf_copy(other.handle_) //create new Pix buf with reference count 1 or return 0 on error + gdk_pixbuf_copy(other.handle_) //create new Pix buf with reference count 1 or return 0 on error #endif ) {} @@ -99,20 +99,20 @@ public: wxIcon toWxIcon() const //copy HandleType, caller needs to take ownership! { + if (handle_ == 0) + return wxNullIcon; + IconHolder clone(*this); - if (clone.handle_ != 0) - { - wxIcon newIcon; //attention: wxIcon uses reference counting! + + wxIcon newIcon; //attention: wxIcon uses reference counting! #ifdef FFS_WIN - newIcon.SetHICON(clone.handle_); // - newIcon.SetSize(IconBuffer::ICON_SIZE, IconBuffer::ICON_SIZE); //icon is actually scaled to this size (just in case referenced HICON differs) -#elif defined FFS_LINUX // - newIcon.SetPixbuf(clone.handle_); // transfer ownership!! -#endif // - clone.handle_ = 0; // - return newIcon; - } - return wxNullIcon; + newIcon.SetHICON(clone.handle_); // + newIcon.SetSize(IconBuffer::ICON_SIZE, IconBuffer::ICON_SIZE); //icon is actually scaled to this size (just in case referenced HICON differs) +#elif defined FFS_LINUX // + newIcon.SetPixbuf(clone.handle_); // transfer ownership!! +#endif // + clone.handle_ = 0; // + return newIcon; } private: @@ -124,23 +124,22 @@ const wxIcon& IconBuffer::getDirectoryIcon() //one folder icon should be suffici { static wxIcon folderIcon; - static bool isInitalized = false; + static bool isInitalized = false; //not thread-safe, but called from GUI thread only! if (!isInitalized) { isInitalized = true; #ifdef FFS_WIN - SHFILEINFO fileInfo; - fileInfo.hIcon = 0; //initialize hIcon + SHFILEINFO fileInfo = {}; //initialize hIcon - //NOTE: CoInitializeEx()/CoUninitialize() implicitly called by wxWidgets on program startup! + //NOTE: CoInitializeEx()/CoUninitialize() needs to be called for THIS thread! if (::SHGetFileInfo(Zstr("dummy"), //Windows Seven doesn't like this parameter to be an empty string FILE_ATTRIBUTE_DIRECTORY, &fileInfo, sizeof(fileInfo), SHGFI_ICON | SHGFI_SMALLICON | SHGFI_USEFILEATTRIBUTES) && - fileInfo.hIcon != 0) //fix for weird error: SHGetFileInfo() might return successfully WITHOUT filling fileInfo.hIcon!! + fileInfo.hIcon != 0) //fix for weird error: SHGetFileInfo() might return successfully WITHOUT filling fileInfo.hIcon!! { folderIcon.SetHICON(fileInfo.hIcon); //transfer ownership! folderIcon.SetSize(IconBuffer::ICON_SIZE, IconBuffer::ICON_SIZE); @@ -154,17 +153,61 @@ const wxIcon& IconBuffer::getDirectoryIcon() //one folder icon should be suffici } +const wxIcon& IconBuffer::getFileIcon() //in case one folder icon is sufficient... +{ + static wxIcon fileIcon; + + static bool isInitalized = false; //not thread-safe, but called from GUI thread only! + if (!isInitalized) + { + isInitalized = true; + +#ifdef FFS_WIN + SHFILEINFO fileInfo = {}; //initialize hIcon + + //NOTE: CoInitializeEx()/CoUninitialize() needs to be called for THIS thread! + if (::SHGetFileInfo(Zstr("dummy"), //Windows Seven doesn't like this parameter to be an empty string + FILE_ATTRIBUTE_NORMAL, + &fileInfo, + sizeof(fileInfo), + SHGFI_ICON | SHGFI_SMALLICON | SHGFI_USEFILEATTRIBUTES) && + + fileInfo.hIcon != 0) //fix for weird error: SHGetFileInfo() might return successfully WITHOUT filling fileInfo.hIcon!! + { + fileIcon.SetHICON(fileInfo.hIcon); //transfer ownership! + fileIcon.SetSize(IconBuffer::ICON_SIZE, IconBuffer::ICON_SIZE); + } + +#elif defined FFS_LINUX + try + { + Glib::RefPtr<Gtk::IconTheme> iconTheme = Gtk::IconTheme::get_default(); + if (iconTheme) + { + Glib::RefPtr<Gdk::Pixbuf> iconPixbuf = iconTheme->load_icon("misc", ICON_SIZE, Gtk::ICON_LOOKUP_USE_BUILTIN); + if (!iconPixbuf) + iconPixbuf = iconTheme->load_icon("text-x-generic", ICON_SIZE, Gtk::ICON_LOOKUP_USE_BUILTIN); + if (iconPixbuf) + fileIcon.SetPixbuf(iconPixbuf->gobj_copy()); // transfer ownership!! + } + } + catch (const Glib::Error&) {} +#endif + } + return fileIcon; +} + + IconBuffer::IconHolder IconBuffer::getAssociatedIcon(const BasicString& filename) { #ifdef FFS_WIN //despite what docu says about SHGetFileInfo() it can't handle all relative filenames, e.g. "\DirName" //but no problem, directory formatting takes care that filenames are always absolute! - SHFILEINFO fileInfo; - fileInfo.hIcon = 0; //initialize hIcon -> fix for weird error: SHGetFileInfo() might return successfully WITHOUT filling fileInfo.hIcon!! + SHFILEINFO fileInfo = {}; //initialize hIcon -> fix for weird error: SHGetFileInfo() might return successfully WITHOUT filling fileInfo.hIcon!! //bug report: https://sourceforge.net/tracker/?func=detail&aid=2768004&group_id=234430&atid=1093080 - //NOTE: CoInitializeEx()/CoUninitialize() implicitly called by wxWidgets on program startup! + //NOTE: CoInitializeEx()/CoUninitialize() needs to be called for THIS thread! ::SHGetFileInfo(filename.c_str(), //ffs3::removeLongPathPrefix(fileName), //::SHGetFileInfo() can't handle \\?\-prefix! 0, &fileInfo, @@ -174,14 +217,7 @@ IconBuffer::IconHolder IconBuffer::getAssociatedIcon(const BasicString& filename return IconHolder(fileInfo.hIcon); //pass icon ownership (may be 0) #elif defined FFS_LINUX - static struct RunOnce - { - RunOnce() - { - Gtk::Main::init_gtkmm_internals(); - } - } dummy; - + //call Gtk::Main::init_gtkmm_internals() on application startup!! try { Glib::RefPtr<Gio::File> fileObj = Gio::File::create_for_path(filename.c_str()); //never fails @@ -229,8 +265,7 @@ IconBuffer::IconHolder IconBuffer::getAssociatedIcon(const BasicString& filename #ifdef FFS_WIN IconBuffer::IconHolder IconBuffer::getAssociatedIconByExt(const BasicString& extension) { - SHFILEINFO fileInfo; - fileInfo.hIcon = 0; //initialize hIcon -> fix for weird error: SHGetFileInfo() might return successfully WITHOUT filling fileInfo.hIcon!! + SHFILEINFO fileInfo = {}; //initialize hIcon -> fix for weird error: SHGetFileInfo() might return successfully WITHOUT filling fileInfo.hIcon!! //no read-access to disk! determine icon by extension ::SHGetFileInfo((Zstr("dummy.") + extension).c_str(), //Windows Seven doesn't like this parameter to be without short name @@ -244,6 +279,28 @@ IconBuffer::IconHolder IconBuffer::getAssociatedIconByExt(const BasicString& ext #endif +namespace +{ +//failure to initialize COM for each thread is a source of hard to reproduce bugs: https://sourceforge.net/tracker/?func=detail&aid=3160472&group_id=234430&atid=1093080 +struct ThreadInitializer +{ + ThreadInitializer() + { +#ifdef FFS_WIN + ::CoInitializeEx(NULL, COINIT_MULTITHREADED); +#endif + } + + ~ThreadInitializer() + { +#ifdef FFS_WIN + ::CoUninitialize(); +#endif + } +}; +} + + class IconBuffer::WorkerThread { public: @@ -257,7 +314,7 @@ public: private: void doWork(); -//---------------------- Shared Data ------------------------- + //---------------------- Shared Data ------------------------- typedef BasicString FileName; struct SharedData @@ -266,7 +323,7 @@ private: boost::mutex mutex; boost::condition_variable condition; //signal event: data for processing available } shared; -//------------------------------------------------------------ + //------------------------------------------------------------ IconBuffer& iconBuffer; @@ -296,7 +353,7 @@ void IconBuffer::WorkerThread::setWorkload(const std::vector<Zstring>& load) //( shared.workload.clear(); for (std::vector<Zstring>::const_iterator i = load.begin(); i != load.end(); ++i) - shared.workload.push_back(FileName(i->c_str())); //make DEEP COPY from Zstring + shared.workload.push_back(FileName(i->c_str(), i->size())); //make DEEP COPY from Zstring } shared.condition.notify_one(); @@ -306,6 +363,8 @@ void IconBuffer::WorkerThread::setWorkload(const std::vector<Zstring>& load) //( void IconBuffer::WorkerThread::operator()() //thread entry { + ThreadInitializer dummy1; + try { while (true) @@ -320,10 +379,18 @@ void IconBuffer::WorkerThread::operator()() //thread entry doWork(); //no need to lock the complete method! } } + catch (boost::thread_interrupted&) + { + throw; //this is the only reasonable exception! + } catch (const std::exception& e) //exceptions must be catched per thread { wxSafeShowMessage(wxString(_("An exception occurred!")) + wxT("(Icon buffer)"), wxString::FromAscii(e.what())); //simple wxMessageBox won't do for threads } + catch (...) //exceptions must be catched per thread + { + wxSafeShowMessage(wxString(_("An exception occurred!")) + wxT("(Icon buffer2)"), wxT("Unknown exception in icon thread!")); //simple wxMessageBox won't do for threads + } } diff --git a/library/icon_buffer.h b/library/icon_buffer.h index d273a970..b00a566d 100644 --- a/library/icon_buffer.h +++ b/library/icon_buffer.h @@ -21,6 +21,7 @@ class IconBuffer { public: static const wxIcon& getDirectoryIcon(); //one folder icon should be sufficient... + static const wxIcon& getFileIcon(); //in case one folder icon is sufficient... static IconBuffer& getInstance(); bool requestFileIcon(const Zstring& fileName, wxIcon* icon = NULL); //returns false if icon is not in buffer @@ -42,10 +43,10 @@ private: class IconHolder; class IconDbSequence; -//--------------------------------------------------------------------------------------------------- + //--------------------------------------------------------------------------------------------------- typedef Zbase<Zchar, StorageDeepCopy> BasicString; //thread safe string class -//avoid reference-counted objects for shared data: NOT THREADSAFE!!! (implicitly shared variable: ref-count) -//--------------------------------------------------------------------------------------------------- + //avoid reference-counted objects for shared data: NOT THREADSAFE!!! (implicitly shared variable: ref-count) + //--------------------------------------------------------------------------------------------------- //methods used by worker thread void insertIntoBuffer(const BasicString& entryName, const IconHolder& icon); @@ -58,11 +59,11 @@ private: static bool isPriceyExtension(const BasicString& extension); #endif -//---------------------- Shared Data ------------------------- + //---------------------- Shared Data ------------------------- boost::mutex lockIconDB; std::auto_ptr<IconDB> buffer; //use synchronisation when accessing this! std::auto_ptr<IconDbSequence> bufSequence; //save sequence of buffer entry to delete oldest elements -//------------------------------------------------------------ + //------------------------------------------------------------ class WorkerThread; std::auto_ptr<WorkerThread> worker; diff --git a/library/pch.h b/library/pch.h index a8d6ae30..fa384ce5 100644 --- a/library/pch.h +++ b/library/pch.h @@ -12,8 +12,8 @@ do NOT use in release build! #endif -//##################################################### -// basic wxWidgets headers + //##################################################### + // basic wxWidgets headers #ifndef WX_PRECOMP #define WX_PRECOMP #endif @@ -24,10 +24,10 @@ do NOT use in release build! #include <wx/wxprec.h> -//##################################################### -// #include other rarely changing headers here + //##################################################### + // #include other rarely changing headers here -//STL headers + //STL headers #include <string> #include <vector> #include <set> @@ -48,7 +48,7 @@ do NOT use in release build! #include <new> #include <stdexcept> -//other wxWidgets headers + //other wxWidgets headers #include <wx/log.h> #include <wx/grid.h> #include <wx/animate.h> @@ -104,11 +104,11 @@ do NOT use in release build! #include <wx/help.h> #include <wx/event.h> -//other + //other #include "../shared/tinyxml/tinyxml.h" #include <sys/stat.h> -//Boost + //Boost #include <boost/shared_ptr.hpp> #include <boost/scoped_array.hpp> diff --git a/library/process_xml.cpp b/library/process_xml.cpp index c4e80d17..79d233fc 100644 --- a/library/process_xml.cpp +++ b/library/process_xml.cpp @@ -271,7 +271,7 @@ void FfsXmlParser::readXmlLocalConfig(const TiXmlElement& folderPair, FolderPair readXmlElementLogging("Right", &folderPair, enhPair.rightDirectory); -//########################################################### + //########################################################### //alternate sync configuration const TiXmlElement* altSyncConfig = TiXmlHandleConst(&folderPair).FirstChild("AlternateSyncConfig").ToElement(); if (altSyncConfig) @@ -296,7 +296,7 @@ void FfsXmlParser::readXmlLocalConfig(const TiXmlElement& folderPair, FolderPair readXmlElementLogging("CustomDeletionFolder", miscSettings, altSyncCfg->customDeletionDirectory); } -//########################################################### + //########################################################### //alternate filter configuration const TiXmlElement* filterCfg = TiXmlHandleConst(&folderPair).FirstChild("LocalFilter").ToElement(); if (filterCfg) @@ -312,7 +312,7 @@ void FfsXmlParser::readXmlMainConfig(MainConfiguration& mainCfg) { TiXmlHandleConst hRoot(getRoot()); //custom const handle: TiXml API seems broken in this regard -//########################################################### + //########################################################### const TiXmlElement* cmpSettings = hRoot.FirstChild("MainConfig").FirstChild("Comparison").ToElement(); //read compare variant @@ -321,7 +321,7 @@ void FfsXmlParser::readXmlMainConfig(MainConfiguration& mainCfg) //include symbolic links at all? readXmlElementLogging("HandleSymlinks", cmpSettings, mainCfg.handleSymlinks); -//########################################################### + //########################################################### const TiXmlElement* syncCfg = hRoot.FirstChild("MainConfig").FirstChild("Synchronization").ToElement(); const TiXmlElement* syncDirections = TiXmlHandleConst(syncCfg).FirstChild("Directions").ToElement(); @@ -334,13 +334,13 @@ void FfsXmlParser::readXmlMainConfig(MainConfiguration& mainCfg) readXmlElementLogging("Different", syncDirections, mainCfg.syncConfiguration.different); readXmlElementLogging("Conflict", syncDirections, mainCfg.syncConfiguration.conflict); -//########################################################### + //########################################################### const TiXmlElement* miscSettings = hRoot.FirstChild("MainConfig").FirstChild("Miscellaneous").ToElement(); //misc readXmlElementLogging("DeletionPolicy", miscSettings, mainCfg.handleDeletion); readXmlElementLogging("CustomDeletionFolder", miscSettings, mainCfg.customDeletionDirectory); -//########################################################### + //########################################################### const TiXmlElement* filter = TiXmlHandleConst(miscSettings).FirstChild("Filter").ToElement(); //read filter settings @@ -351,7 +351,7 @@ void FfsXmlParser::readXmlMainConfig(MainConfiguration& mainCfg) mainCfg.globalFilter = FilterConfig(includeFilter, excludeFilter); -//########################################################### + //########################################################### const TiXmlElement* pairs = hRoot.FirstChild("MainConfig").FirstChild("FolderPairs").FirstChild("Pair").ToElement(); //read all folder pairs @@ -403,6 +403,7 @@ void FfsXmlParser::readXmlBatchConfig(xmlAccess::XmlBatchConfig& outputCfg) readXmlElementLogging("Silent", batchConfig, outputCfg.silent); readXmlElementLogging("LogfileDirectory", batchConfig, outputCfg.logFileDirectory); + readXmlElementLogging("LogfileCountMax", batchConfig, outputCfg.logFileCountMax); readXmlElementLogging("HandleError", batchConfig, outputCfg.handleError); } @@ -471,7 +472,7 @@ void FfsXmlParser::readXmlGlobalSettings(xmlAccess::XmlGlobalSettings& outputCfg if (folderPairMax != 0) //if reading fails, leave at default outputCfg.gui.addFolderPairCountMax = std::max(static_cast<size_t>(2), folderPairMax) - 1; //map folderPairMax to additionalFolderPairMax -//########################################################### + //########################################################### //read column attributes readXmlAttributeLogging("AutoAdjust", TiXmlHandleConst(mainWindow).FirstChild("LeftColumns").ToElement(), outputCfg.gui.autoAdjustColumnsLeft); readXmlAttributeLogging("ShowFileIcons", TiXmlHandleConst(mainWindow).FirstChild("LeftColumns").ToElement(), outputCfg.gui.showFileIconsLeft); @@ -545,6 +546,7 @@ void FfsXmlParser::readXmlGlobalSettings(xmlAccess::XmlGlobalSettings& outputCfg const TiXmlElement* cfgHistory = TiXmlHandleConst(gui).FirstChild("ConfigHistory").ToElement(); //load config history elements + readXmlAttributeLogging("LastUsed", cfgHistory, outputCfg.gui.lastUsedConfigFile); readXmlElementLogging("File", cfgHistory, outputCfg.gui.cfgFileHistory); //last update check @@ -560,12 +562,12 @@ void addXmlElement(const std::string& name, const CompareVariant variant, TiXmlE { switch (variant) { - case ffs3::CMP_BY_TIME_SIZE: - xmlAccess::addXmlElement(name, std::string("ByTimeAndSize"), parent); - break; - case ffs3::CMP_BY_CONTENT: - xmlAccess::addXmlElement(name, std::string("ByContent"), parent); - break; + case ffs3::CMP_BY_TIME_SIZE: + xmlAccess::addXmlElement(name, std::string("ByTimeAndSize"), parent); + break; + case ffs3::CMP_BY_CONTENT: + xmlAccess::addXmlElement(name, std::string("ByContent"), parent); + break; } } @@ -574,15 +576,15 @@ void addXmlElement(const std::string& name, const SyncDirection value, TiXmlElem { switch (value) { - case SYNC_DIR_LEFT: - xmlAccess::addXmlElement(name, std::string("left"), parent); - break; - case SYNC_DIR_RIGHT: - xmlAccess::addXmlElement(name, std::string("right"), parent); - break; - case SYNC_DIR_NONE: - xmlAccess::addXmlElement(name, std::string("none"), parent); - break; + case SYNC_DIR_LEFT: + xmlAccess::addXmlElement(name, std::string("left"), parent); + break; + case SYNC_DIR_RIGHT: + xmlAccess::addXmlElement(name, std::string("right"), parent); + break; + case SYNC_DIR_NONE: + xmlAccess::addXmlElement(name, std::string("none"), parent); + break; } } @@ -591,15 +593,15 @@ void addXmlElement(const std::string& name, const xmlAccess::OnError value, TiXm { switch (value) { - case xmlAccess::ON_ERROR_IGNORE: - xmlAccess::addXmlElement(name, std::string("Ignore"), parent); - break; - case xmlAccess::ON_ERROR_EXIT: - xmlAccess::addXmlElement(name, std::string("Exit"), parent); - break; - case xmlAccess::ON_ERROR_POPUP: - xmlAccess::addXmlElement(name, std::string("Popup"), parent); - break; + case xmlAccess::ON_ERROR_IGNORE: + xmlAccess::addXmlElement(name, std::string("Ignore"), parent); + break; + case xmlAccess::ON_ERROR_EXIT: + xmlAccess::addXmlElement(name, std::string("Exit"), parent); + break; + case xmlAccess::ON_ERROR_POPUP: + xmlAccess::addXmlElement(name, std::string("Popup"), parent); + break; } } @@ -608,15 +610,15 @@ void addXmlElement(const std::string& name, const ffs3::DeletionPolicy value, Ti { switch (value) { - case ffs3::DELETE_PERMANENTLY: - xmlAccess::addXmlElement(name, std::string("DeletePermanently"), parent); - break; - case ffs3::MOVE_TO_RECYCLE_BIN: - xmlAccess::addXmlElement(name, std::string("MoveToRecycleBin"), parent); - break; - case ffs3::MOVE_TO_CUSTOM_DIRECTORY: - xmlAccess::addXmlElement(name, std::string("MoveToCustomDirectory"), parent); - break; + case ffs3::DELETE_PERMANENTLY: + xmlAccess::addXmlElement(name, std::string("DeletePermanently"), parent); + break; + case ffs3::MOVE_TO_RECYCLE_BIN: + xmlAccess::addXmlElement(name, std::string("MoveToRecycleBin"), parent); + break; + case ffs3::MOVE_TO_CUSTOM_DIRECTORY: + xmlAccess::addXmlElement(name, std::string("MoveToCustomDirectory"), parent); + break; } } @@ -625,15 +627,15 @@ void addXmlElement(const std::string& name, const ffs3::SymLinkHandling value, T { switch (value) { - case ffs3::SYMLINK_IGNORE: - xmlAccess::addXmlElement(name, std::string("Ignore"), parent); - break; - case ffs3::SYMLINK_USE_DIRECTLY: - xmlAccess::addXmlElement(name, std::string("UseDirectly"), parent); - break; - case ffs3::SYMLINK_FOLLOW_LINK: - xmlAccess::addXmlElement(name, std::string("FollowLink"), parent); - break; + case ffs3::SYMLINK_IGNORE: + xmlAccess::addXmlElement(name, std::string("Ignore"), parent); + break; + case ffs3::SYMLINK_USE_DIRECTLY: + xmlAccess::addXmlElement(name, std::string("UseDirectly"), parent); + break; + case ffs3::SYMLINK_FOLLOW_LINK: + xmlAccess::addXmlElement(name, std::string("FollowLink"), parent); + break; } } @@ -692,7 +694,7 @@ void writeXmlLocalConfig(const FolderPairEnh& enhPair, TiXmlElement& parent) addXmlElement("CustomDeletionFolder", altSyncConfig->customDeletionDirectory, miscSettings); } -//########################################################### + //########################################################### //alternate filter configuration TiXmlElement* filterCfg = new TiXmlElement("LocalFilter"); newfolderPair->LinkEndChild(filterCfg); @@ -711,7 +713,7 @@ bool writeXmlMainConfig(const MainConfiguration& mainCfg, TiXmlDocument& doc) TiXmlElement* settings = new TiXmlElement("MainConfig"); root->LinkEndChild(settings); -//########################################################### + //########################################################### TiXmlElement* cmpSettings = new TiXmlElement("Comparison"); settings->LinkEndChild(cmpSettings); @@ -721,7 +723,7 @@ bool writeXmlMainConfig(const MainConfiguration& mainCfg, TiXmlDocument& doc) //include symbolic links at all? addXmlElement("HandleSymlinks", mainCfg.handleSymlinks, cmpSettings); -//########################################################### + //########################################################### TiXmlElement* syncSettings = new TiXmlElement("Synchronization"); settings->LinkEndChild(syncSettings); @@ -738,7 +740,7 @@ bool writeXmlMainConfig(const MainConfiguration& mainCfg, TiXmlDocument& doc) addXmlElement("Different", mainCfg.syncConfiguration.different, syncDirections); addXmlElement("Conflict", mainCfg.syncConfiguration.conflict, syncDirections); -//########################################################### + //########################################################### TiXmlElement* miscSettings = new TiXmlElement("Miscellaneous"); settings->LinkEndChild(miscSettings); @@ -753,7 +755,7 @@ bool writeXmlMainConfig(const MainConfiguration& mainCfg, TiXmlDocument& doc) addXmlElement("DeletionPolicy", mainCfg.handleDeletion, miscSettings); addXmlElement("CustomDeletionFolder", mainCfg.customDeletionDirectory, miscSettings); -//########################################################### + //########################################################### TiXmlElement* pairs = new TiXmlElement("FolderPairs"); settings->LinkEndChild(pairs); @@ -806,6 +808,7 @@ bool writeXmlBatchConfig(const xmlAccess::XmlBatchConfig& inputCfg, TiXmlDocumen addXmlElement("Silent", inputCfg.silent, batchConfig); addXmlElement("LogfileDirectory", inputCfg.logFileDirectory, batchConfig); + addXmlElement("LogfileCountMax", inputCfg.logFileCountMax, batchConfig); addXmlElement("HandleError", inputCfg.handleError, batchConfig); return true; @@ -962,9 +965,9 @@ bool writeXmlGlobalSettings(const xmlAccess::XmlGlobalSettings& inputCfg, TiXmlD TiXmlElement* cfgHistory = new TiXmlElement("ConfigHistory"); gui->LinkEndChild(cfgHistory); + addXmlAttribute("LastUsed", inputCfg.gui.lastUsedConfigFile, cfgHistory); addXmlElement("File", inputCfg.gui.cfgFileHistory, cfgHistory); - //last update check addXmlElement("LastUpdateCheck", inputCfg.gui.lastUpdateCheck, gui); @@ -1034,18 +1037,18 @@ xmlAccess::MergeType xmlAccess::getMergeType(const std::vector<wxString>& filena { switch (xmlAccess::getXmlType(*i)) //throw() { - case XML_GUI_CONFIG: - guiCfgExists = true; - break; - - case XML_BATCH_CONFIG: - batchCfgExists = true; - break; - - case XML_GLOBAL_SETTINGS: - case XML_REAL_CONFIG: - case XML_OTHER: - return MERGE_OTHER; + case XML_GUI_CONFIG: + guiCfgExists = true; + break; + + case XML_BATCH_CONFIG: + batchCfgExists = true; + break; + + case XML_GLOBAL_SETTINGS: + case XML_REAL_CONFIG: + case XML_OTHER: + return MERGE_OTHER; } } @@ -1097,18 +1100,18 @@ void mergeConfigFilesImpl(const std::vector<wxString>& filenames, XmlCfg& config { switch (getXmlType(*i)) { - case XML_GUI_CONFIG: - mainCfgs.push_back(loadCfgImpl<XmlGuiConfig>(*i, savedException).mainCfg); //throw (xmlAccess::XmlError) - break; - - case XML_BATCH_CONFIG: - mainCfgs.push_back(loadCfgImpl<XmlBatchConfig>(*i, savedException).mainCfg); //throw (xmlAccess::XmlError) - break; - - case XML_GLOBAL_SETTINGS: - case XML_REAL_CONFIG: - case XML_OTHER: - break; + case XML_GUI_CONFIG: + mainCfgs.push_back(loadCfgImpl<XmlGuiConfig>(*i, savedException).mainCfg); //throw (xmlAccess::XmlError) + break; + + case XML_BATCH_CONFIG: + mainCfgs.push_back(loadCfgImpl<XmlBatchConfig>(*i, savedException).mainCfg); //throw (xmlAccess::XmlError) + break; + + case XML_GLOBAL_SETTINGS: + case XML_REAL_CONFIG: + case XML_OTHER: + break; } } @@ -1124,7 +1127,7 @@ void mergeConfigFilesImpl(const std::vector<wxString>& filenames, XmlCfg& config config.mainCfg = merge(mainCfgs); if (savedException.get()) //"re-throw" exception - throw *savedException; + throw* savedException; } } diff --git a/library/process_xml.h b/library/process_xml.h index 92d94d14..dcd80327 100644 --- a/library/process_xml.h +++ b/library/process_xml.h @@ -77,12 +77,16 @@ struct XmlGuiConfig struct XmlBatchConfig { - XmlBatchConfig() : silent(false), handleError(ON_ERROR_POPUP) {} + XmlBatchConfig() : + silent(false), + logFileCountMax(200), + handleError(ON_ERROR_POPUP) {} ffs3::MainConfiguration mainCfg; bool silent; wxString logFileDirectory; + size_t logFileCountMax; OnError handleError; //reaction on error situation during synchronization }; @@ -114,7 +118,7 @@ wxString getGlobalConfigFile(); struct XmlGlobalSettings { -//--------------------------------------------------------------------- + //--------------------------------------------------------------------- //Shared (GUI/BATCH) settings XmlGlobalSettings() : programLanguage(retrieveSystemLanguage()), @@ -132,7 +136,7 @@ struct XmlGlobalSettings OptionalDialogs optDialogs; -//--------------------------------------------------------------------- + //--------------------------------------------------------------------- struct _Gui { _Gui() : @@ -160,14 +164,14 @@ struct XmlGlobalSettings //default external apps will be translated "on the fly"!!! #ifdef FFS_WIN externelApplications.push_back(std::make_pair(wxT("Open with Explorer"), //mark for extraction: _("Open with Explorer") - wxT("explorer /select, \"%name\""))); + wxT("explorer /select, \"%name\""))); externelApplications.push_back(std::make_pair(wxT("Open with default application"), //mark for extraction: _("Open with default application") - wxT("cmd /c start \"\" \"%name\""))); + wxT("cmd /c start \"\" \"%name\""))); #elif defined FFS_LINUX externelApplications.push_back(std::make_pair(wxT("Browse directory"), //mark for extraction: _("Browse directory") - wxT("xdg-open \"%dir\""))); + wxT("xdg-open \"%dir\""))); externelApplications.push_back(std::make_pair(wxT("Open with default application"), //mark for extraction: _("Open with default application") - wxT("xdg-open \"%name\""))); + wxT("xdg-open \"%name\""))); #endif } @@ -186,6 +190,7 @@ struct XmlGlobalSettings ExternalApps externelApplications; std::vector<wxString> cfgFileHistory; + wxString lastUsedConfigFile; std::vector<wxString> folderHistoryLeft; unsigned int folderHistLeftMax; @@ -205,7 +210,7 @@ struct XmlGlobalSettings wxString guiPerspectiveLast; //used by wxAuiManager } gui; -//--------------------------------------------------------------------- + //--------------------------------------------------------------------- //struct _Batch }; diff --git a/library/resources.cpp b/library/resources.cpp index 5ef33826..d07e66a8 100644 --- a/library/resources.cpp +++ b/library/resources.cpp @@ -18,7 +18,7 @@ using namespace ffs3; -const GlobalResources& GlobalResources::getInstance() +const GlobalResources& GlobalResources::instance() { static GlobalResources instance; return instance; @@ -31,6 +31,8 @@ GlobalResources::GlobalResources() animationMoney = new wxAnimation(wxNullAnimation); animationSync = new wxAnimation(wxNullAnimation); programIcon = new wxIcon(wxNullIcon); + + load(); } @@ -65,7 +67,7 @@ void loadAnimFromZip(wxZipInputStream& zipInput, wxAnimation* animation) } -void GlobalResources::load() const +void GlobalResources::load() { wxFFileInputStream input(ffs3::getResourceDir() + wxT("Resources.dat")); if (input.IsOk()) //if not... we don't want to react too harsh here @@ -104,16 +106,16 @@ void GlobalResources::load() const //*programIcon = wxIcon(FreeFileSync_xpm); //use big logo bitmap for better quality - programIcon->CopyFromBitmap(getImageByName(wxT("FreeFileSync.png"))); + programIcon->CopyFromBitmap(getImage(wxT("FreeFileSync.png"))); #endif } -const wxBitmap& GlobalResources::getImageByName(const wxString& imageName) const +const wxBitmap& GlobalResources::getImage(const wxString& imageName) const { const std::map<wxString, wxBitmap*>::const_iterator bmp = imageName.Find(wxChar('.')) == wxNOT_FOUND ? //assume .png ending if nothing else specified - bitmapResource.find(imageName + wxT(".png")) : - bitmapResource.find(imageName); + bitmapResource.find(imageName + wxT(".png")) : + bitmapResource.find(imageName); if (bmp != bitmapResource.end()) return *bmp->second; diff --git a/library/resources.h b/library/resources.h index 776fe785..691d5a6b 100644 --- a/library/resources.h +++ b/library/resources.h @@ -16,23 +16,23 @@ class GlobalResources { public: - static const GlobalResources& getInstance(); + static const GlobalResources& instance(); - const wxBitmap& getImageByName(const wxString& imageName) const; + const wxBitmap& getImage(const wxString& imageName) const; //global image resource objects wxAnimation* animationMoney; wxAnimation* animationSync; wxIcon* programIcon; - void load() const; //loads bitmap resources on program startup: logical const! - private: + void load(); //loads bitmap resources on program startup + GlobalResources(); ~GlobalResources(); //resource mapping - mutable std::map<wxString, wxBitmap*> bitmapResource; + std::map<wxString, wxBitmap*> bitmapResource; }; #endif // RESOURCES_H_INCLUDED diff --git a/library/soft_filter.h b/library/soft_filter.h index ad81ea44..4e6732a3 100644 --- a/library/soft_filter.h +++ b/library/soft_filter.h @@ -28,7 +28,7 @@ public: timeWindow_(timeWindow), currentTime(wxGetUTCTime()) {} -// typedef boost::shared_ptr<const SoftFilter> FilterRef; //always bound by design! + // typedef boost::shared_ptr<const SoftFilter> FilterRef; //always bound by design! bool passFilter(const FileMapping& fileMap) const; bool passFilter(const DirMapping& dirMap) const; diff --git a/library/statistics.cpp b/library/statistics.cpp index 7a77740c..c0bb2b25 100644 --- a/library/statistics.cpp +++ b/library/statistics.cpp @@ -168,7 +168,7 @@ wxString Statistics::getRemainingTime() const --windowBegin; //one point before window begin in order to handle "measurement holes" const TimeRecordMap::value_type& frontRecord = *windowBegin; -//----------------------------------------------------------------------------------------------- + //----------------------------------------------------------------------------------------------- const double timeDelta = backRecord.first - frontRecord.first; const double dataDelta = backRecord.second.data - frontRecord.second.data; @@ -194,7 +194,7 @@ wxString Statistics::getBytesPerSecond() const --windowBegin; //one point before window begin in order to handle "measurement holes" const TimeRecordMap::value_type& frontRecord = *windowBegin; -//----------------------------------------------------------------------------------------------- + //----------------------------------------------------------------------------------------------- const double timeDelta = backRecord.first - frontRecord.first; const double dataDelta = backRecord.second.data - frontRecord.second.data; diff --git a/library/status_handler.h b/library/status_handler.h index d89c4f5b..2dde4fd9 100644 --- a/library/status_handler.h +++ b/library/status_handler.h @@ -41,7 +41,7 @@ public: StatusHandler() : abortRequested(false) {} virtual ~StatusHandler() {} - //identifiers of different processes + //identifiers of different phases enum Process { PROCESS_NONE = 10, @@ -101,5 +101,4 @@ bool StatusHandler::abortIsRequested() return abortRequested; } - #endif // STATUSHANDLER_H_INCLUDED diff --git a/shared/IFileOperation/dll_main.cpp b/shared/IFileOperation/dll_main.cpp index d23e5c48..ab387012 100644 --- a/shared/IFileOperation/dll_main.cpp +++ b/shared/IFileOperation/dll_main.cpp @@ -15,11 +15,11 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, { switch (fdwReason) { - case DLL_PROCESS_ATTACH: - case DLL_PROCESS_DETACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - break; + case DLL_PROCESS_ATTACH: + case DLL_PROCESS_DETACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + break; } return TRUE; } diff --git a/shared/IFileOperation/file_op.cpp b/shared/IFileOperation/file_op.cpp index b1b7f4cd..fc942f44 100644 --- a/shared/IFileOperation/file_op.cpp +++ b/shared/IFileOperation/file_op.cpp @@ -36,10 +36,10 @@ bool fileop::moveToRecycleBin(const wchar_t* fileNames[], // Create the IFileOperation interface ComPtr<IFileOperation> fileOp; - hr = CoCreateInstance(CLSID_FileOperation, - NULL, - CLSCTX_ALL, - IID_PPV_ARGS(fileOp.init())); + hr = ::CoCreateInstance(CLSID_FileOperation, + NULL, + CLSCTX_ALL, + IID_PPV_ARGS(fileOp.init())); if (FAILED(hr)) { lastErrorMessage = generateErrorMsg(L"Error calling \"CoCreateInstance\".", hr); @@ -70,6 +70,10 @@ bool fileop::moveToRecycleBin(const wchar_t* fileNames[], IID_PPV_ARGS(psiFile.init())); if (FAILED(hr)) { + if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || //file not existing anymore + hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)) + continue; + std::wstring message(L"Error calling \"SHCreateItemFromParsingName\" for file:\n"); message += std::wstring(L"\"") + fileNames[i] + L"\"."; @@ -122,10 +126,10 @@ bool fileop::copyFile(const wchar_t* sourceFile, // Create the IFileOperation interface ComPtr<IFileOperation> fileOp; - hr = CoCreateInstance(CLSID_FileOperation, - NULL, - CLSCTX_ALL, - IID_PPV_ARGS(fileOp.init())); + hr = ::CoCreateInstance(CLSID_FileOperation, + NULL, + CLSCTX_ALL, + IID_PPV_ARGS(fileOp.init())); if (FAILED(hr)) { lastErrorMessage = generateErrorMsg(L"Error calling \"CoCreateInstance\".", hr); @@ -148,9 +152,9 @@ bool fileop::copyFile(const wchar_t* sourceFile, //create source object ComPtr<IShellItem> psiSourceFile; - hr = SHCreateItemFromParsingName(sourceFile, - NULL, - IID_PPV_ARGS(psiSourceFile.init())); + hr = ::SHCreateItemFromParsingName(sourceFile, + NULL, + IID_PPV_ARGS(psiSourceFile.init())); if (FAILED(hr)) { std::wstring message(L"Error calling \"SHCreateItemFromParsingName\" for file:\n"); @@ -171,9 +175,9 @@ bool fileop::copyFile(const wchar_t* sourceFile, //create target folder object ComPtr<IShellItem> psiTargetFolder; - hr = SHCreateItemFromParsingName(targetFolder.c_str(), - NULL, - IID_PPV_ARGS(psiTargetFolder.init())); + hr = ::SHCreateItemFromParsingName(targetFolder.c_str(), + NULL, + IID_PPV_ARGS(psiTargetFolder.init())); if (FAILED(hr)) { std::wstring message(L"Error calling \"SHCreateItemFromParsingName\" for folder:\n"); diff --git a/shared/IFileOperation/file_op.h b/shared/IFileOperation/file_op.h index 9842f0d6..a7b0434f 100644 --- a/shared/IFileOperation/file_op.h +++ b/shared/IFileOperation/file_op.h @@ -16,6 +16,10 @@ namespace fileop { +/*-------------- + |declarations| + --------------*/ + //COM needs to be initialized before calling any of these functions! CoInitializeEx/CoUninitialize FILE_OP_DLL_API @@ -30,13 +34,17 @@ bool copyFile(const wchar_t* sourceFile, FILE_OP_DLL_API void getLastError(wchar_t* errorMessage, size_t errorBufferLen); - -//function typedefs +/*---------- + |typedefs| + ----------*/ typedef bool (*MoveToRecycleBinFct)(const wchar_t* fileNames[], size_t fileNo); typedef bool (*CopyFileFct)(const wchar_t* sourceFile, const wchar_t* targetFile); typedef void (*GetLastErrorFct)(wchar_t* errorMessage, size_t errorBufferLen); -//function names (use const pointers to ensure internal linkage) +/*-------------- + |symbol names| + --------------*/ +//(use const pointers to ensure internal linkage) const char* const moveToRecycleBinFctName = "moveToRecycleBin"; const char* const copyFileFctName = "copyFile"; const char* const getLastErrorFctName = "getLastError"; diff --git a/shared/ShadowCopy/dll_main.cpp b/shared/ShadowCopy/dll_main.cpp index d23e5c48..ab387012 100644 --- a/shared/ShadowCopy/dll_main.cpp +++ b/shared/ShadowCopy/dll_main.cpp @@ -15,11 +15,11 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, { switch (fdwReason) { - case DLL_PROCESS_ATTACH: - case DLL_PROCESS_DETACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - break; + case DLL_PROCESS_ATTACH: + case DLL_PROCESS_DETACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + break; } return TRUE; } diff --git a/shared/ShadowCopy/shadow.h b/shared/ShadowCopy/shadow.h index 683a4e16..5495633d 100644 --- a/shared/ShadowCopy/shadow.h +++ b/shared/ShadowCopy/shadow.h @@ -16,6 +16,10 @@ namespace shadow { +/*-------------- + |declarations| + --------------*/ + //COM needs to be initialized before calling any of these functions! CoInitializeEx/CoUninitialize typedef size_t ShadowHandle; @@ -38,7 +42,9 @@ void releaseShadowCopy(ShadowHandle handle); //########################################################################################## -//function typedefs +/*---------- + |typedefs| + ----------*/ typedef bool (*CreateShadowCopyFct)(const wchar_t* volumeName, wchar_t* shadowVolName, unsigned int shadowBufferLen, @@ -48,7 +54,10 @@ typedef bool (*CreateShadowCopyFct)(const wchar_t* volumeName, typedef void (*ReleaseShadowCopyFct)(ShadowHandle handle); -//function names +/*-------------- + |symbol names| + --------------*/ +//(use const pointers to ensure internal linkage) const char* const createShadowCopyFctName = "createShadowCopy"; const char* const releaseShadowCopyFctName = "releaseShadowCopy"; } diff --git a/shared/Taskbar_Seven/dll_main.cpp b/shared/Taskbar_Seven/dll_main.cpp index d23e5c48..ab387012 100644 --- a/shared/Taskbar_Seven/dll_main.cpp +++ b/shared/Taskbar_Seven/dll_main.cpp @@ -15,11 +15,11 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, { switch (fdwReason) { - case DLL_PROCESS_ATTACH: - case DLL_PROCESS_DETACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - break; + case DLL_PROCESS_ATTACH: + case DLL_PROCESS_DETACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + break; } return TRUE; } diff --git a/shared/Taskbar_Seven/taskbar.cpp b/shared/Taskbar_Seven/taskbar.cpp index c853eb5d..297a0739 100644 --- a/shared/Taskbar_Seven/taskbar.cpp +++ b/shared/Taskbar_Seven/taskbar.cpp @@ -46,26 +46,26 @@ ComPtr<ITaskbarList3> getInstance() bool tbseven::setStatus(void* hwnd, //HWND: window assciated to the taskbar icon - TaskBarStatus status) + TaskBarStatus status) { TBPFLAG flag = TBPF_NORMAL; switch (status) { - case STATUS_NOPROGRESS: - flag = TBPF_NOPROGRESS; - break; - case STATUS_INDETERMINATE: - flag = TBPF_INDETERMINATE; - break; - case STATUS_NORMAL: - flag = TBPF_NORMAL; - break; - case STATUS_ERROR: - flag = TBPF_ERROR; - break; - case STATUS_PAUSED: - flag = TBPF_PAUSED; - break; + case STATUS_NOPROGRESS: + flag = TBPF_NOPROGRESS; + break; + case STATUS_INDETERMINATE: + flag = TBPF_INDETERMINATE; + break; + case STATUS_NORMAL: + flag = TBPF_NORMAL; + break; + case STATUS_ERROR: + flag = TBPF_ERROR; + break; + case STATUS_PAUSED: + flag = TBPF_PAUSED; + break; } ComPtr<ITaskbarList3> taskbarlist = getInstance(); @@ -73,7 +73,7 @@ bool tbseven::setStatus(void* hwnd, //HWND: window assciated to the taskbar icon return false; HRESULT hr = taskbarlist->SetProgressState(static_cast<HWND>(hwnd), //[in] HWND hwnd, - flag); //[in] TBPFLAG tbpFlags + flag); //[in] TBPFLAG tbpFlags if (FAILED(hr)) { lastErrorMessage = generateErrorMsg(L"Error calling \"SetProgressState\".", hr); @@ -85,8 +85,8 @@ bool tbseven::setStatus(void* hwnd, //HWND: window assciated to the taskbar icon bool tbseven::setProgress(void* hwnd, //HWND: window assciated to the taskbar icon - size_t current, - size_t total) + size_t current, + size_t total) { ComPtr<ITaskbarList3> taskbarlist = getInstance(); if (!taskbarlist) //error msg already set diff --git a/shared/Taskbar_Seven/taskbar.h b/shared/Taskbar_Seven/taskbar.h index 295cdbcd..7b6efbb5 100644 --- a/shared/Taskbar_Seven/taskbar.h +++ b/shared/Taskbar_Seven/taskbar.h @@ -16,6 +16,10 @@ namespace tbseven { +/*-------------- + |declarations| + --------------*/ + enum TaskBarStatus { STATUS_NOPROGRESS, @@ -42,13 +46,17 @@ bool setProgress(void* hwnd, //HWND: window assciated to the taskbar icon DLL_FUNCTION_DECLARATION void getLastError(wchar_t* errorMessage, size_t errorBufferLen); - -//function typedefs +/*---------- + |typedefs| + ----------*/ typedef bool (*SetStatusFct)(void* hwnd, TaskBarStatus status); typedef bool (*SetProgressFct)(void* hwnd, size_t current, size_t total); typedef void (*GetLastErrorFct)(wchar_t* errorMessage, size_t errorBufferLen); -//function names (use const pointers to ensure internal linkage) +/*-------------- + |symbol names| + --------------*/ +//(use const pointers to ensure internal linkage) const char* const setStatusFctName = "setStatus"; const char* const setProgressFctName = "setProgress"; const char* const getLastErrorFctName = "getLastError"; diff --git a/shared/assert_static.h b/shared/assert_static.h index d2bd0a3a..198943cf 100644 --- a/shared/assert_static.h +++ b/shared/assert_static.h @@ -27,10 +27,10 @@ struct CompileTimeError<true> {}; #define LOKI_CONCAT_SUB( X, Y ) X##Y #define assert_static(expr) \ - enum { LOKI_CONCAT(loki_enum_dummy_value, __LINE__) = sizeof(StaticCheckImpl::CompileTimeError<static_cast<bool>(expr) >) } + enum { LOKI_CONCAT(loki_enum_dummy_value, __LINE__) = sizeof(StaticCheckImpl::CompileTimeError<static_cast<bool>(expr) >) } /*#define assert_static(expr) \ - { Loki::CompileTimeError<((expr) != 0)> Static_Assert_Has_Failed; (void)Static_Assert_Has_Failed; } */ +{ Loki::CompileTimeError<((expr) != 0)> Static_Assert_Has_Failed; (void)Static_Assert_Has_Failed; } */ #endif diff --git a/shared/c_dll.h b/shared/c_dll.h index 3941cc0e..a80c419e 100644 --- a/shared/c_dll.h +++ b/shared/c_dll.h @@ -29,11 +29,11 @@ public: T& retrieve(S handle); //return default-constructed object if not found private: - HandleProvider() {} + HandleProvider() {} HandleProvider(const HandleProvider&); HandleProvider& operator=(const HandleProvider&); S generate(); - + std::map<S, T> handleMap; }; /* diff --git a/shared/com_error.h b/shared/com_error.h index 30c7904f..c3f7745b 100644 --- a/shared/com_error.h +++ b/shared/com_error.h @@ -28,13 +28,13 @@ public: } private: - ComException(const ComException&); - ComException& operator=(const ComException&); + ComException(const ComException&); + ComException& operator=(const ComException&); const std::wstring message_; const HRESULT hr_; }; - + diff --git a/shared/com_ptr.h b/shared/com_ptr.h index f8331220..6c7a62ab 100644 --- a/shared/com_ptr.h +++ b/shared/com_ptr.h @@ -46,13 +46,13 @@ public: private: T* ptr; - struct ConversionToBool + struct ConversionToBool { int dummy; }; public: - operator int ConversionToBool::*() const; //use member pointer as implicit conversion to bool (C++ Templates - Vandevoorde/Josuttis; chapter 20) + operator int ConversionToBool::* () const; //use member pointer as implicit conversion to bool (C++ Templates - Vandevoorde/Josuttis; chapter 20) }; @@ -181,7 +181,7 @@ ComPtr<T>::operator bool() const template <class T> inline -ComPtr<T>::operator int ComPtr<T>::ConversionToBool::*() const +ComPtr<T>::operator int ComPtr<T>::ConversionToBool::* () const { return ptr != NULL ? &ConversionToBool::dummy : NULL; } diff --git a/shared/custom_button.cpp b/shared/custom_button.cpp index ea473fc2..de057dc5 100644 --- a/shared/custom_button.cpp +++ b/shared/custom_button.cpp @@ -10,7 +10,7 @@ #include <algorithm> -wxButtonWithImage::wxButtonWithImage(wxWindow *parent, +wxButtonWithImage::wxButtonWithImage(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos, diff --git a/shared/custom_button.h b/shared/custom_button.h index 63875e42..4ebff73c 100644 --- a/shared/custom_button.h +++ b/shared/custom_button.h @@ -14,7 +14,7 @@ class wxButtonWithImage : public wxBitmapButton { public: - wxButtonWithImage(wxWindow *parent, + wxButtonWithImage(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos = wxDefaultPosition, diff --git a/shared/custom_combo_box.cpp b/shared/custom_combo_box.cpp index a1f28b5c..f6084fdf 100644 --- a/shared/custom_combo_box.cpp +++ b/shared/custom_combo_box.cpp @@ -57,11 +57,11 @@ void CustomComboBox::OnKeyEvent(wxKeyEvent& event) const int selectedItem = this->GetCurrentSelection(); if (0 <= selectedItem && selectedItem < static_cast<int>(this->GetCount()) && #if wxCHECK_VERSION(2, 9, 1) - dropDownShown) + dropDownShown) #else - //what a mess...: - (GetValue() != GetString(selectedItem) || //avoid problems when a character shall be deleted instead of list item - GetValue() == wxEmptyString)) //exception: always allow removing empty entry + //what a mess...: + (GetValue() != GetString(selectedItem) || //avoid problems when a character shall be deleted instead of list item + GetValue() == wxEmptyString)) //exception: always allow removing empty entry #endif { //save old (selected) value: deletion seems to have influence on this diff --git a/shared/dir_name.cpp b/shared/dir_name.cpp index 4ae3ef2f..5fd4eab2 100644 --- a/shared/dir_name.cpp +++ b/shared/dir_name.cpp @@ -164,8 +164,8 @@ void DirectoryNameMainDlg::OnFilesDropped(FFSFileDropEvent& event) if (event.filesDropped_.empty()) return; - if ( this->dropWindow1_ == event.dropWindow_ || //file may be dropped on window 1 or 2 - this->dropWindow2_ == event.dropWindow_) + if (this->dropWindow1_ == event.dropWindow_ || //file may be dropped on window 1 or 2 + this->dropWindow2_ == event.dropWindow_) { if (AcceptDrop(event.filesDropped_)) { diff --git a/shared/dst_hack.cpp b/shared/dst_hack.cpp index 87ed6c2f..a2841ce0 100644 --- a/shared/dst_hack.cpp +++ b/shared/dst_hack.cpp @@ -18,22 +18,43 @@ bool dst::isFatDrive(const Zstring& fileName) //throw() const size_t BUFFER_SIZE = MAX_PATH + 1; wchar_t buffer[BUFFER_SIZE]; -//this call is expensive: ~1.5 ms! -// if (!::GetVolumePathName(applyLongPathPrefix(fileName).c_str(), //__in LPCTSTR lpszFileName, -// buffer, //__out LPTSTR lpszVolumePathName, -// BUFFER_SIZE)) //__in DWORD cchBufferLength -// ... -// Zstring volumePath = buffer; -// if (!volumePath.EndsWith(common::FILE_NAME_SEPARATOR)) //a trailing backslash is required -// volumePath += common::FILE_NAME_SEPARATOR; + //this call is expensive: ~1.5 ms! + // if (!::GetVolumePathName(applyLongPathPrefix(fileName).c_str(), //__in LPCTSTR lpszFileName, + // buffer, //__out LPTSTR lpszVolumePathName, + // BUFFER_SIZE)) //__in DWORD cchBufferLength + // ... + // Zstring volumePath = buffer; + // if (!volumePath.EndsWith(common::FILE_NAME_SEPARATOR)) //a trailing backslash is required + // volumePath += common::FILE_NAME_SEPARATOR; //fast ::GetVolumePathName() clone: let's hope it's not too simple (doesn't honor mount points) - const Zstring nameFmt = removeLongPathPrefix(fileName); //throw() - const size_t pos = nameFmt.find(Zstr(":\\")); - if (pos != 1) //expect single letter volume - return false; - const Zstring volumePath(nameFmt.c_str(), 3); - + Zstring volumePath; + { + Zstring nameFmt = removeLongPathPrefix(fileName); //throw() + if (!nameFmt.EndsWith(Zstr("\\"))) + nameFmt += Zstr("\\"); //GetVolumeInformation expects trailing backslash + + if (nameFmt.StartsWith(Zstr("\\\\"))) //UNC path: "\\ComputerName\SharedFolder\" + { + size_t nameSize = nameFmt.size(); + const size_t posFirstSlash = nameFmt.find(Zstr("\\"), 2); + if (posFirstSlash != Zstring::npos) + { + nameSize = posFirstSlash + 1; + const size_t posSecondSlash = nameFmt.find(Zstr("\\"), posFirstSlash + 1); + if (posSecondSlash != Zstring::npos) + nameSize = posSecondSlash + 1; + } + volumePath = Zstring(nameFmt.c_str(), nameSize); //include trailing backslash! + } + else //local path: "C:\Folder\" + { + const size_t pos = nameFmt.find(Zstr(":\\")); + if (pos != 1) //expect single letter volume + return false; + volumePath = Zstring(nameFmt.c_str(), 3); + } + } //suprisingly fast: ca. 0.03 ms per call! if (!::GetVolumeInformation(volumePath.c_str(), //__in_opt LPCTSTR lpRootPathName, NULL, //__out LPTSTR lpVolumeNameBuffer, @@ -62,8 +83,8 @@ FILETIME utcToLocal(const FILETIME& utcTime) //throw (std::runtime_error) //treat binary local time representation (which is invariant under DST time zone shift) as logical UTC: FILETIME localTime = {}; if (!::FileTimeToLocalFileTime( - &utcTime, //__in const FILETIME *lpFileTime, - &localTime)) //__out LPFILETIME lpLocalFileTime + &utcTime, //__in const FILETIME *lpFileTime, + &localTime)) //__out LPFILETIME lpLocalFileTime { const wxString errorMessage = wxString(_("Conversion error:")) + wxT(" FILETIME -> local FILETIME: ") + wxT("(") + wxULongLong(utcTime.dwHighDateTime, utcTime.dwLowDateTime).ToString() + wxT(") ") + wxT("\n\n") + ffs3::getLastErrorFormatted(); @@ -78,8 +99,8 @@ FILETIME localToUtc(const FILETIME& localTime) //throw (std::runtime_error) //treat binary local time representation (which is invariant under DST time zone shift) as logical UTC: FILETIME utcTime = {}; if (!::LocalFileTimeToFileTime( - &localTime, //__in const FILETIME *lpLocalFileTime, - &utcTime)) //__out LPFILETIME lpFileTime + &localTime, //__in const FILETIME *lpLocalFileTime, + &utcTime)) //__out LPFILETIME lpFileTime { const wxString errorMessage = wxString(_("Conversion error:")) + wxT(" local FILETIME -> FILETIME: ") + wxT("(") + wxULongLong(localTime.dwHighDateTime, localTime.dwLowDateTime).ToString() + wxT(") ") + wxT("\n\n") + ffs3::getLastErrorFormatted(); @@ -224,7 +245,7 @@ std::bitset<UTC_LOCAL_OFFSET_BITS> getUtcLocalShift() const int absValue = common::abs(timeShiftQuarter); //MSVC C++0x bug: std::bitset<>(unsigned long) is ambiguous if (std::bitset<UTC_LOCAL_OFFSET_BITS - 1>(absValue).to_ulong() != static_cast<unsigned long>(absValue) || //time shifts that big shouldn't be possible! - timeShiftSec % (60 * 15) != 0) //all known time shift have at least 15 minute granularity! + timeShiftSec % (60 * 15) != 0) //all known time shift have at least 15 minute granularity! { const wxString errorMessage = wxString(_("Conversion error:")) + wxT(" Unexpected UTC <-> local time shift: ") + wxT("(") + wxLongLong(timeShiftSec).ToString() + wxT(") ") + wxT("\n\n") + ffs3::getLastErrorFormatted(); @@ -254,8 +275,8 @@ int convertUtcLocalShift(std::bitset<UTC_LOCAL_OFFSET_BITS> rawShift) bool dst::fatHasUtcEncoded(const RawTime& rawTime) //"createTimeRaw" as retrieved by ::FindFirstFile() and ::GetFileAttributesEx(); throw (std::runtime_error) { - if ( cmpFileTime(rawTime.createTimeRaw, FAT_MIN_TIME) < 0 || - cmpFileTime(FAT_MAX_TIME, rawTime.createTimeRaw) < 0) + if (cmpFileTime(rawTime.createTimeRaw, FAT_MIN_TIME) < 0 || + cmpFileTime(FAT_MAX_TIME, rawTime.createTimeRaw) < 0) { assert(false); //shouldn't be possible according to FAT specification return false; diff --git a/shared/file_handling.cpp b/shared/file_handling.cpp index 10cab5ef..14a4b84c 100644 --- a/shared/file_handling.cpp +++ b/shared/file_handling.cpp @@ -16,7 +16,6 @@ #include "string_conv.h" #include <wx/utils.h> #include <boost/scoped_array.hpp> -#include <boost/shared_ptr.hpp> #include <stdexcept> #include "loki/TypeManip.h" #include "loki/ScopeGuard.h" @@ -128,9 +127,9 @@ bool replaceMacro(wxString& macro) //macro without %-characters, return true if macro.Trim(false); // //remove leading, trailing double-quotes - if ( macro.StartsWith(wxT("\"")) && - macro.EndsWith(wxT("\"")) && - macro.length() >= 2) + if (macro.StartsWith(wxT("\"")) && + macro.EndsWith(wxT("\"")) && + macro.length() >= 2) macro = wxString(macro.c_str() + 1, macro.length() - 2); return true; } @@ -219,7 +218,7 @@ bool ffs3::fileExists(const Zstring& filename) #endif } -#include <wx/msgdlg.h> + bool ffs3::dirExists(const Zstring& dirname) { //symbolic links (broken or not) are also treated as existing directories! @@ -278,7 +277,8 @@ wxULongLong getFileSizeSymlink(const Zstring& linkName) //throw (FileError) NULL); if (hFile != INVALID_HANDLE_VALUE) { - boost::shared_ptr<void> dummy(hFile, ::CloseHandle); + Loki::ScopeGuard dummy = Loki::MakeGuard(::CloseHandle, hFile); + (void)dummy; //silence warning "unused variable" BY_HANDLE_FILE_INFORMATION fileInfoByHandle; if (::GetFileInformationByHandle(hFile, &fileInfoByHandle)) @@ -480,12 +480,12 @@ void renameFileInternal(const Zstring& oldName, const Zstring& newName) //throw } else { - const DWORD errorCode = ::GetLastError(); + Loki::ScopeGuard dummy = Loki::MakeGuard(::SetLastError, ::GetLastError()); //use error code from ::MoveFileEx() + (void)dummy; + //cleanup: (try to) restore file attributes: assume oldName is still existing ::SetFileAttributes(oldNameFmt.c_str(), oldNameAttrib); - - ::SetLastError(errorCode); //set error code from ::MoveFileEx() } } } @@ -514,16 +514,6 @@ void renameFileInternal(const Zstring& oldName, const Zstring& newName) //throw } -void renameFileInternalNoThrow(const Zstring& oldName, const Zstring& newName) //throw () -{ - try - { - ::renameFileInternal(oldName, newName); - } - catch (...) {} -} - - #ifdef FFS_WIN /*small wrapper around ::GetShortPathName() @@ -584,10 +574,10 @@ bool fix8Dot3NameClash(const Zstring& oldName, const Zstring& newName) //throw const Zstring fileNameShort = getFilenameFmt(newName, ::GetShortPathName).AfterLast(common::FILE_NAME_SEPARATOR); //throw() returns empty string on error const Zstring fileNameLong = getFilenameFmt(newName, ::GetLongPathName).AfterLast(common::FILE_NAME_SEPARATOR); //throw() returns empty string on error - if ( !fileNameShort.empty() && - !fileNameLong.empty() && - EqualFilename()(fileNameOrig, fileNameShort) && - !EqualFilename()(fileNameShort, fileNameLong)) + if (!fileNameShort.empty() && + !fileNameLong.empty() && + EqualFilename()(fileNameOrig, fileNameShort) && + !EqualFilename()(fileNameShort, fileNameLong)) { //we detected an event where newName is in shortname format (although it is intended to be a long name) and //writing target file failed because another unrelated file happens to have the same short name @@ -603,7 +593,7 @@ bool fix8Dot3NameClash(const Zstring& oldName, const Zstring& newName) //throw //DON'T call ffs3::renameFile() to avoid reentrance! //schedule cleanup; the file system should assign this unrelated file a new (unique) short name - Loki::ScopeGuard guard = Loki::MakeGuard(renameFileInternalNoThrow, parkedTarget, unrelatedPathLong);//equivalent to Boost.ScopeExit in this case + Loki::ScopeGuard guard = Loki::MakeGuard(renameFileInternal, parkedTarget, unrelatedPathLong);//equivalent to Boost.ScopeExit in this case (void)guard; //silence warning "unused variable" renameFileInternal(oldName, newName); //the short filename name clash is solved, this should work now @@ -645,11 +635,11 @@ public: { switch (moveCallback.requestUiRefresh(sourceFile_)) { - case MoveFileCallback::CONTINUE: - return CopyFileCallback::CONTINUE; + case MoveFileCallback::CONTINUE: + return CopyFileCallback::CONTINUE; - case MoveFileCallback::CANCEL: - return CopyFileCallback::CANCEL; + case MoveFileCallback::CANCEL: + return CopyFileCallback::CANCEL; } return CopyFileCallback::CONTINUE; //dummy return value } @@ -666,11 +656,11 @@ void ffs3::moveFile(const Zstring& sourceFile, const Zstring& targetFile, MoveFi if (callback) switch (callback->requestUiRefresh(sourceFile)) { - case MoveFileCallback::CONTINUE: - break; - case MoveFileCallback::CANCEL: //a user aborted operation IS an error condition! - throw FileError(wxString(_("Error moving file:")) + wxT("\n\"") + zToWx(sourceFile) + wxT("\" ->\n\"") + zToWx(targetFile) + wxT("\"") + - wxT("\n\n") + _("Operation aborted!")); + case MoveFileCallback::CONTINUE: + break; + case MoveFileCallback::CANCEL: //a user aborted operation IS an error condition! + throw FileError(wxString(_("Error moving file:")) + wxT("\n\"") + zToWx(sourceFile) + wxT("\" ->\n\"") + zToWx(targetFile) + wxT("\"") + + wxT("\n\n") + _("Operation aborted!")); } //support case-sensitive renaming @@ -762,11 +752,11 @@ struct RemoveCallbackImpl : public ffs3::RemoveDirCallback { switch (moveCallback_.requestUiRefresh(sourceDir_)) { - case MoveFileCallback::CONTINUE: - break; - case MoveFileCallback::CANCEL: //a user aborted operation IS an error condition! - throw ffs3::FileError(wxString(_("Error moving directory:")) + wxT("\n\"") + ffs3::zToWx(sourceDir_) + wxT("\" ->\n\"") + - ffs3::zToWx(targetDir_) + wxT("\"") + wxT("\n\n") + _("Operation aborted!")); + case MoveFileCallback::CONTINUE: + break; + case MoveFileCallback::CANCEL: //a user aborted operation IS an error condition! + throw ffs3::FileError(wxString(_("Error moving directory:")) + wxT("\n\"") + ffs3::zToWx(sourceDir_) + wxT("\" ->\n\"") + + ffs3::zToWx(targetDir_) + wxT("\"") + wxT("\n\n") + _("Operation aborted!")); } } @@ -786,11 +776,11 @@ void moveDirectoryImpl(const Zstring& sourceDir, const Zstring& targetDir, bool if (callback) switch (callback->requestUiRefresh(sourceDir)) { - case MoveFileCallback::CONTINUE: - break; - case MoveFileCallback::CANCEL: //a user aborted operation IS an error condition! - throw FileError(wxString(_("Error moving directory:")) + wxT("\n\"") + zToWx(sourceDir) + wxT("\" ->\n\"") + - zToWx(targetDir) + wxT("\"") + wxT("\n\n") + _("Operation aborted!")); + case MoveFileCallback::CONTINUE: + break; + case MoveFileCallback::CANCEL: //a user aborted operation IS an error condition! + throw FileError(wxString(_("Error moving directory:")) + wxT("\n\"") + zToWx(sourceDir) + wxT("\" ->\n\"") + + zToWx(targetDir) + wxT("\"") + wxT("\n\n") + _("Operation aborted!")); } //handle symbolic links @@ -915,9 +905,9 @@ void ffs3::removeDirectory(const Zstring& directory, RemoveDirCallback* callback const Zstring directoryFmt = applyLongPathPrefix(directory); //support for \\?\-prefix //initialize file attributes - if (!::SetFileAttributes( // initialize file attributes: actually NEEDED for symbolic links also! - directoryFmt.c_str(), // address of directory name - FILE_ATTRIBUTE_NORMAL)) // attributes to set + if (!::SetFileAttributes( // initialize file attributes: actually NEEDED for symbolic links also! + directoryFmt.c_str(), // address of directory name + FILE_ATTRIBUTE_NORMAL)) // attributes to set { wxString errorMessage = wxString(_("Error deleting directory:")) + wxT("\n\"") + directory.c_str() + wxT("\""); throw FileError(errorMessage + wxT("\n\n") + ffs3::getLastErrorFormatted()); @@ -1010,7 +1000,9 @@ void ffs3::copyFileTimes(const Zstring& sourceObj, const Zstring& targetObj, boo const wxString errorMessage = wxString(_("Error reading file attributes:")) + wxT("\n\"") + zToWx(sourceObj) + wxT("\""); throw FileError(errorMessage + wxT("\n\n") + ffs3::getLastErrorFormatted()); } - boost::shared_ptr<void> dummy(hSource, ::CloseHandle); + + Loki::ScopeGuard dummy = Loki::MakeGuard(::CloseHandle, hSource); + (void)dummy; //silence warning "unused variable" if (!::GetFileTime(hSource, //__in HANDLE hFile, &creationTime, //__out_opt LPFILETIME lpCreationTime, @@ -1028,7 +1020,7 @@ void ffs3::copyFileTimes(const Zstring& sourceObj, const Zstring& targetObj, boo lastWriteTime = sourceAttr.ftLastWriteTime; } -//####################################### DST hack ########################################### + //####################################### DST hack ########################################### if (!isDirectory) //dst hack not (yet) required for directories (symlinks implicitly checked by isFatDrive()) { if (dst::isFatDrive(sourceObj)) //throw() @@ -1048,7 +1040,7 @@ void ffs3::copyFileTimes(const Zstring& sourceObj, const Zstring& targetObj, boo lastWriteTime = encodedTime.writeTimeRaw; } } -//####################################### DST hack ########################################### + //####################################### DST hack ########################################### } @@ -1068,7 +1060,8 @@ void ffs3::copyFileTimes(const Zstring& sourceObj, const Zstring& targetObj, boo wxString errorMessage = wxString(_("Error changing modification time:")) + wxT("\n\"") + zToWx(targetObj) + wxT("\""); throw FileError(errorMessage + wxT("\n\n") + ffs3::getLastErrorFormatted()); } - boost::shared_ptr<void> dummy(hTarget, ::CloseHandle); + Loki::ScopeGuard dummy = Loki::MakeGuard(::CloseHandle, hTarget); + (void)dummy; //silence warning "unused variable" if (!::SetFileTime(hTarget, &creationTime, @@ -1141,6 +1134,28 @@ void ffs3::copyFileTimes(const Zstring& sourceObj, const Zstring& targetObj, boo namespace { +struct TryCleanUp +{ + static void tryDeleteDir(const Zstring& dirname) //throw () + { + try + { + ffs3::removeDirectory(dirname, NULL); + } + catch (...) {} + } + + static void tryDeleteFile(const Zstring& filename) //throw () + { + try + { + ffs3::removeFile(filename); + } + catch (...) {} + } +}; + + #ifdef FFS_WIN Zstring resolveDirectorySymlink(const Zstring& dirLinkName) //get full target path of symbolic link to a directory; throw (FileError) { @@ -1158,7 +1173,8 @@ Zstring resolveDirectorySymlink(const Zstring& dirLinkName) //get full target pa throw FileError(errorMessage + wxT("\n\n") + ffs3::getLastErrorFormatted()); } - boost::shared_ptr<void> dummy(hDir, ::CloseHandle); + Loki::ScopeGuard dummy = Loki::MakeGuard(::CloseHandle, hDir); + (void)dummy; //silence warning "unused variable" const size_t BUFFER_SIZE = 10000; TCHAR targetPath[BUFFER_SIZE]; @@ -1189,13 +1205,39 @@ Zstring resolveDirectorySymlink(const Zstring& dirLinkName) //get full target pa return targetPath; } +#endif - -#elif defined FFS_LINUX -void copySymlinkInternal(const Zstring& sourceLink, const Zstring& targetLink, bool copyFilePermissions) //throw (FileError) +enum SymlinkType +{ + SYMLINK_TYPE_FILE, + SYMLINK_TYPE_DIR +}; +void copySymlinkInternal(const Zstring& sourceLink, const Zstring& targetLink, SymlinkType type, bool copyFilePermissions) //throw (FileError) { using namespace ffs3; +#ifdef FFS_WIN + const Zstring linkPath = getSymlinkRawTargetString(sourceLink); //accept broken symlinks; throw (FileError) + + //dynamically load windows API function + typedef BOOLEAN (WINAPI *CreateSymbolicLinkFunc)( + LPCTSTR lpSymlinkFileName, + LPCTSTR lpTargetFileName, + DWORD dwFlags); + static const CreateSymbolicLinkFunc createSymbolicLink = util::getDllFun<CreateSymbolicLinkFunc>(L"kernel32.dll", "CreateSymbolicLinkW"); + if (createSymbolicLink == NULL) + throw FileError(wxString(_("Error loading library function:")) + wxT("\n\"") + wxT("CreateSymbolicLinkW") + wxT("\"")); + + if (!createSymbolicLink( //seems no long path prefix is required... + targetLink.c_str(), //__in LPTSTR lpSymlinkFileName, + linkPath.c_str(), //__in LPTSTR lpTargetFileName, + (type == SYMLINK_TYPE_DIR ? SYMBOLIC_LINK_FLAG_DIRECTORY : 0))) //__in DWORD dwFlags + { + const wxString errorMessage = wxString(_("Error copying symbolic link:")) + wxT("\n\"") + zToWx(sourceLink) + wxT("\" ->\n\"") + zToWx(targetLink) + wxT("\""); + throw FileError(errorMessage + wxT("\n\n") + ffs3::getLastErrorFormatted()); + } + +#elif defined FFS_LINUX //copy symbolic link const int BUFFER_SIZE = 10000; char buffer[BUFFER_SIZE]; @@ -1214,18 +1256,20 @@ void copySymlinkInternal(const Zstring& sourceLink, const Zstring& targetLink, b const wxString errorMessage = wxString(_("Error copying symbolic link:")) + wxT("\n\"") + zToWx(sourceLink) + wxT("\" ->\n\"") + zToWx(targetLink) + wxT("\""); throw FileError(errorMessage + wxT("\n\n") + ffs3::getLastErrorFormatted()); } +#endif //allow only consistent objects to be created -> don't place before ::symlink, targetLink may already exist - Loki::ScopeGuard guardTargetLink = Loki::MakeGuard(::unlink, targetLink); + Loki::ScopeGuard guardNewDir = type == SYMLINK_TYPE_DIR ? + Loki::MakeGuard(&TryCleanUp::tryDeleteDir, targetLink) : + Loki::MakeGuard(&TryCleanUp::tryDeleteFile, targetLink); copyFileTimes(sourceLink, targetLink, false); //throw (FileError) if (copyFilePermissions) copyObjectPermissions(sourceLink, targetLink, false); //throw FileError() - guardTargetLink.Dismiss(); + guardNewDir.Dismiss(); //target has been created successfully! } -#endif } @@ -1241,14 +1285,15 @@ void copySecurityContext(const Zstring& source, const Zstring& target, bool dere ::lgetfilecon(source.c_str(), &contextSource); if (rv < 0) { - if ( errno == ENODATA || //no security context (allegedly) is not an error condition on SELinux - errno == EOPNOTSUPP) //extended attributes are not supported by the filesystem + if (errno == ENODATA || //no security context (allegedly) is not an error condition on SELinux + errno == EOPNOTSUPP) //extended attributes are not supported by the filesystem return; wxString errorMessage = wxString(_("Error reading security context:")) + wxT("\n\"") + zToWx(source) + wxT("\""); throw FileError(errorMessage + wxT("\n\n") + ffs3::getLastErrorFormatted()); } - boost::shared_ptr<char> dummy1(contextSource, ::freecon); + Loki::ScopeGuard dummy1 = Loki::MakeGuard(::freecon, contextSource); + (void)dummy1; //silence warning "unused variable" { security_context_t contextTarget = NULL; @@ -1263,7 +1308,9 @@ void copySecurityContext(const Zstring& source, const Zstring& target, bool dere } else { - boost::shared_ptr<char> dummy2(contextTarget, ::freecon); + Loki::ScopeGuard dummy2 = Loki::MakeGuard(::freecon, contextTarget); + (void)dummy2; //silence warning "unused variable" + if (::strcmp(contextSource, contextTarget) == 0) //nothing to do return; } @@ -1281,8 +1328,8 @@ void copySecurityContext(const Zstring& source, const Zstring& target, bool dere #endif //HAVE_SELINUX -//copy permissions for files, directories or symbolic links: -void ffs3::copyObjectPermissions(const Zstring& source, const Zstring& target, bool derefSymlinks) //throw FileError(); probably requires admin rights +//copy permissions for files, directories or symbolic links: requires admin rights +void ffs3::copyObjectPermissions(const Zstring& source, const Zstring& target, bool derefSymlinks) //throw FileError(); { #ifdef FFS_WIN //setting privileges requires admin rights! @@ -1315,9 +1362,10 @@ void ffs3::copyObjectPermissions(const Zstring& source, const Zstring& target, b const wxString errorMessage = wxString(_("Error copying file permissions:")) + wxT("\n\"") + zToWx(source) + wxT("\" ->\n\"") + zToWx(target) + wxT("\"") + wxT("\n\n"); throw FileError(errorMessage + ffs3::getLastErrorFormatted() + wxT(" (OR)")); } - boost::shared_ptr<void> dummy(hSource, ::CloseHandle); + Loki::ScopeGuard dummy = Loki::MakeGuard(::CloseHandle, hSource); + (void)dummy; //silence warning "unused variable" -// DWORD rc = ::GetNamedSecurityInfo(const_cast<WCHAR*>(applyLongPathPrefix(source).c_str()), -> does NOT dereference symlinks! + // DWORD rc = ::GetNamedSecurityInfo(const_cast<WCHAR*>(applyLongPathPrefix(source).c_str()), -> does NOT dereference symlinks! DWORD rc = ::GetSecurityInfo( hSource, //__in LPTSTR pObjectName, SE_FILE_OBJECT, //__in SE_OBJECT_TYPE ObjectType, @@ -1332,7 +1380,9 @@ void ffs3::copyObjectPermissions(const Zstring& source, const Zstring& target, b const wxString errorMessage = wxString(_("Error copying file permissions:")) + wxT("\n\"") + zToWx(source) + wxT("\" ->\n\"") + zToWx(target) + wxT("\"") + wxT("\n\n"); throw FileError(errorMessage + ffs3::getLastErrorFormatted(rc) + wxT(" (R)")); } - boost::shared_ptr<void> dummy2(buffer, ::LocalFree); + + Loki::ScopeGuard dummy4 = Loki::MakeGuard(::LocalFree, buffer); + (void)dummy4; //silence warning "unused variable" const Zstring targetFmt = ffs3::applyLongPathPrefix(target); @@ -1340,8 +1390,8 @@ void ffs3::copyObjectPermissions(const Zstring& source, const Zstring& target, b //read-only file attribute may cause trouble: temporarily reset it const DWORD targetAttr = ::GetFileAttributes(targetFmt.c_str()); Loki::ScopeGuard resetAttributes = Loki::MakeGuard(::SetFileAttributes, targetFmt, targetAttr); - if ( targetAttr != INVALID_FILE_ATTRIBUTES && - (targetAttr & FILE_ATTRIBUTE_READONLY)) + if (targetAttr != INVALID_FILE_ATTRIBUTES && + (targetAttr & FILE_ATTRIBUTE_READONLY)) ::SetFileAttributes(targetFmt.c_str(), targetAttr & (~FILE_ATTRIBUTE_READONLY)); //try to... else resetAttributes.Dismiss(); @@ -1359,9 +1409,10 @@ void ffs3::copyObjectPermissions(const Zstring& source, const Zstring& target, b const wxString errorMessage = wxString(_("Error copying file permissions:")) + wxT("\n\"") + zToWx(source) + wxT("\" ->\n\"") + zToWx(target) + wxT("\"") + wxT("\n\n"); throw FileError(errorMessage + ffs3::getLastErrorFormatted() + wxT(" (OW)")); } - boost::shared_ptr<void> dummy3(hTarget, ::CloseHandle); + Loki::ScopeGuard dummy2 = Loki::MakeGuard(::CloseHandle, hTarget); + (void)dummy2; //silence warning "unused variable" -// rc = ::SetNamedSecurityInfo(const_cast<WCHAR*>(applyLongPathPrefix(target).c_str()), //__in LPTSTR pObjectName, -> does NOT dereference symlinks! + // rc = ::SetNamedSecurityInfo(const_cast<WCHAR*>(applyLongPathPrefix(target).c_str()), //__in LPTSTR pObjectName, -> does NOT dereference symlinks! rc = ::SetSecurityInfo( hTarget, //__in LPTSTR pObjectName, SE_FILE_OBJECT, //__in SE_OBJECT_TYPE ObjectType, @@ -1386,9 +1437,9 @@ void ffs3::copyObjectPermissions(const Zstring& source, const Zstring& target, b if (derefSymlinks) { struct stat fileInfo; - if ( ::stat(source.c_str(), &fileInfo) != 0 || - ::chown(target.c_str(), fileInfo.st_uid, fileInfo.st_gid) != 0 || // may require admin rights! - ::chmod(target.c_str(), fileInfo.st_mode) != 0) + if (::stat(source.c_str(), &fileInfo) != 0 || + ::chown(target.c_str(), fileInfo.st_uid, fileInfo.st_gid) != 0 || // may require admin rights! + ::chmod(target.c_str(), fileInfo.st_mode) != 0) { const wxString errorMessage = wxString(_("Error copying file permissions:")) + wxT("\n\"") + zToWx(source) + wxT("\" ->\n\"") + zToWx(target) + wxT("\"") + wxT("\n\n"); throw FileError(errorMessage + ffs3::getLastErrorFormatted() + wxT(" (R)")); @@ -1397,9 +1448,9 @@ void ffs3::copyObjectPermissions(const Zstring& source, const Zstring& target, b else { struct stat fileInfo; - if ( ::lstat(source.c_str(), &fileInfo) != 0 || - ::lchown(target.c_str(), fileInfo.st_uid, fileInfo.st_gid) != 0 || // may require admin rights! - (!symlinkExists(target) && ::chmod(target.c_str(), fileInfo.st_mode) != 0)) //setting access permissions doesn't make sense for symlinks on Linux: there is no lchmod() + if (::lstat(source.c_str(), &fileInfo) != 0 || + ::lchown(target.c_str(), fileInfo.st_uid, fileInfo.st_gid) != 0 || // may require admin rights! + (!symlinkExists(target) && ::chmod(target.c_str(), fileInfo.st_mode) != 0)) //setting access permissions doesn't make sense for symlinks on Linux: there is no lchmod() { const wxString errorMessage = wxString(_("Error copying file permissions:")) + wxT("\n\"") + zToWx(source) + wxT("\" ->\n\"") + zToWx(target) + wxT("\"") + wxT("\n\n"); throw FileError(errorMessage + ffs3::getLastErrorFormatted() + wxT(" (W)")); @@ -1428,40 +1479,31 @@ void createDirectoryRecursively(const Zstring& directory, const Zstring& templat createDirectoryRecursively(dirParent, templateParent, false, copyFilePermissions, level + 1); //don't create symbolic links in recursion! } - struct TryCleanUp - { - static void tryDeleteDir(const Zstring& dirname) //throw () - { - try - { - removeDirectory(dirname, NULL); - } - catch (...) {} - } - }; - //now creation should be possible -#ifdef FFS_WIN - const DWORD templateAttr = templateDir.empty() ? INVALID_FILE_ATTRIBUTES : - ::GetFileAttributes(applyLongPathPrefix(templateDir).c_str()); //returns successful for broken symlinks - if (templateAttr == INVALID_FILE_ATTRIBUTES) //fallback + + if (templateDir.empty() || !somethingExists(templateDir)) { - if (!::CreateDirectory(applyLongPathPrefixCreateDir(directory).c_str(), // pointer to a directory path string - NULL)) + //default directory creation +#ifdef FFS_WIN + if (!::CreateDirectory(applyLongPathPrefixCreateDir(directory).c_str(), NULL))// pointer to a directory path string +#elif defined FFS_LINUX + if (::mkdir(directory.c_str(), 0755) != 0) +#endif { if (level != 0) return; - const wxString errorMessage = wxString(_("Error creating directory:")) + wxT("\n\"") + directory.c_str() + wxT("\""); + wxString errorMessage = wxString(_("Error creating directory:")) + wxT("\n\"") + zToWx(directory) + wxT("\""); throw FileError(errorMessage + wxT("\n\n") + ffs3::getLastErrorFormatted()); } } else { - const bool isSymlink = (templateAttr & FILE_ATTRIBUTE_REPARSE_POINT) != 0; //syntax required to shut MSVC up - +#ifdef FFS_WIN //symbolic link handling - if (isSymlink) + if (symlinkExists(templateDir)) { - if (!copyDirectorySymLinks) //create directory based on target of symbolic link + if (copyDirectorySymLinks) + return copySymlinkInternal(templateDir, directory, SYMLINK_TYPE_DIR, copyFilePermissions); //throw (FileError) + else //create directory based on target of symbolic link { //get target directory of symbolic link Zstring linkPath; @@ -1482,48 +1524,25 @@ void createDirectoryRecursively(const Zstring& directory, const Zstring& templat return; } - if (!::CreateDirectoryEx( // this function automatically copies symbolic links if encountered - applyLongPathPrefix(linkPath).c_str(), // pointer to path string of template directory - applyLongPathPrefixCreateDir(directory).c_str(), // pointer to a directory path string - NULL)) + if (!::CreateDirectoryEx( // this function automatically copies symbolic links if encountered + applyLongPathPrefix(linkPath).c_str(), // pointer to path string of template directory + applyLongPathPrefixCreateDir(directory).c_str(), // pointer to a directory path string + NULL)) { if (level != 0) return; const wxString errorMessage = wxString(_("Error creating directory:")) + wxT("\n\"") + directory.c_str() + wxT("\""); throw FileError(errorMessage + wxT("\n\n") + ffs3::getLastErrorFormatted()); } } - else //copy symbolic link - { - const Zstring linkPath = getSymlinkRawTargetString(templateDir); //accept broken symlinks; throw (FileError) - - //dynamically load windows API function - typedef BOOLEAN (WINAPI *CreateSymbolicLinkFunc)( - LPCTSTR lpSymlinkFileName, - LPCTSTR lpTargetFileName, - DWORD dwFlags); - static const CreateSymbolicLinkFunc createSymbolicLink = util::getDllFun<CreateSymbolicLinkFunc>(L"kernel32.dll", "CreateSymbolicLinkW"); - if (createSymbolicLink == NULL) - throw FileError(wxString(_("Error loading library function:")) + wxT("\n\"") + wxT("CreateSymbolicLinkW") + wxT("\"")); - - if (!createSymbolicLink( //seems no long path prefix is required... - directory.c_str(), //__in LPTSTR lpSymlinkFileName, - linkPath.c_str(), //__in LPTSTR lpTargetFileName, - SYMBOLIC_LINK_FLAG_DIRECTORY)) //__in DWORD dwFlags - { - //if (level != 0) return; - const wxString errorMessage = wxString(_("Error copying symbolic link:")) + wxT("\n\"") + templateDir.c_str() + wxT("\" ->\n\"") + directory.c_str() + wxT("\""); - throw FileError(errorMessage + wxT("\n\n") + ffs3::getLastErrorFormatted()); - } - } } else //no symbolic link { //automatically copies symbolic links if encountered: unfortunately it doesn't copy symlinks over network shares but silently creates empty folders instead (on XP)! //also it isn't able to copy most junctions because of missing permissions (although target path can be retrieved!) if (!::CreateDirectoryEx( - applyLongPathPrefix(templateDir).c_str(), // pointer to path string of template directory - applyLongPathPrefixCreateDir(directory).c_str(), // pointer to a directory path string - NULL)) + applyLongPathPrefix(templateDir).c_str(), // pointer to path string of template directory + applyLongPathPrefixCreateDir(directory).c_str(), // pointer to a directory path string + NULL)) { if (level != 0) return; const wxString errorMessage = wxString(_("Error creating directory:")) + wxT("\n\"") + directory.c_str() + wxT("\""); @@ -1531,42 +1550,30 @@ void createDirectoryRecursively(const Zstring& directory, const Zstring& templat } } - //ensure cleanup: - Loki::ScopeGuard guardNewDir = Loki::MakeGuard(&TryCleanUp::tryDeleteDir, directory); +#elif defined FFS_LINUX + //symbolic link handling + if (copyDirectorySymLinks && + symlinkExists(templateDir)) + //there is no directory-type symlink in Linux! => just copy as file + return copySymlinkInternal(templateDir, directory, SYMLINK_TYPE_DIR, copyFilePermissions); //throw (FileError) + + //default directory creation + if (::mkdir(directory.c_str(), 0755) != 0) + { + if (level != 0) return; + wxString errorMessage = wxString(_("Error creating directory:")) + wxT("\n\"") + zToWx(directory) + wxT("\""); + throw FileError(errorMessage + wxT("\n\n") + ffs3::getLastErrorFormatted()); + } +#endif + Loki::ScopeGuard guardNewDir = Loki::MakeGuard(&TryCleanUp::tryDeleteDir, directory); //ensure cleanup: - if (copyDirectorySymLinks && isSymlink) //we need to copy the Symbolic Link's change date manually - copyFileTimes(templateDir, directory, false); //throw (FileError) + copyFileTimes(templateDir, directory, !copyDirectorySymLinks); //throw (FileError) if (copyFilePermissions) copyObjectPermissions(templateDir, directory, !copyDirectorySymLinks); //throw FileError() guardNewDir.Dismiss(); //target has been created successfully! } - -#elif defined FFS_LINUX - //symbolic link handling - if ( copyDirectorySymLinks && - !templateDir.empty() && - symlinkExists(templateDir)) - //there is no directory-type symlink in Linux! => just copy as file - return copySymlinkInternal(templateDir, directory, copyFilePermissions); //throw (FileError) - - //default directory creation - if (::mkdir(directory.c_str(), 0755) != 0) - { - if (level != 0) return; - wxString errorMessage = wxString(_("Error creating directory:")) + wxT("\n\"") + zToWx(directory) + wxT("\""); - throw FileError(errorMessage + wxT("\n\n") + ffs3::getLastErrorFormatted()); - } - - //ensure cleanup: - Loki::ScopeGuard guardNewDir = Loki::MakeGuard(&TryCleanUp::tryDeleteDir, directory); - - if (!templateDir.empty() && copyFilePermissions) - copyObjectPermissions(templateDir, directory, true); //throw FileError() - - guardNewDir.Dismiss(); //target has been created successfully! -#endif } @@ -1644,10 +1651,10 @@ DWORD CALLBACK copyCallbackInternal( { switch (callback->updateCopyStatus(wxULongLong(totalBytesTransferred.HighPart, totalBytesTransferred.LowPart))) { - case CopyFileCallback::CONTINUE: - break; - case CopyFileCallback::CANCEL: - return PROGRESS_CANCEL; + case CopyFileCallback::CONTINUE: + break; + case CopyFileCallback::CANCEL: + return PROGRESS_CANCEL; } } catch (...) @@ -1719,27 +1726,16 @@ void ffs3::copyFile(const Zstring& sourceFile, const Zstring temporary = createTempName(targetFile); //use temporary file until a correct date has been set - struct TryCleanUp //ensure cleanup if working with temporary failed! - { - static void tryDeleteFile(const Zstring& filename) //throw () - { - try - { - removeFile(filename); - } - catch (...) {} - } - }; - Loki::ScopeGuard guardTempFile = Loki::MakeGuard(&TryCleanUp::tryDeleteFile, temporary); + Loki::ScopeGuard guardTempFile = Loki::MakeGuard(&ffs3::removeFile, temporary); if (!::CopyFileEx( //same performance as CopyFile() - applyLongPathPrefix(sourceFile).c_str(), - applyLongPathPrefix(temporary).c_str(), - callback != NULL ? copyCallbackInternal : NULL, - callback, - NULL, - copyFlags)) + applyLongPathPrefix(sourceFile).c_str(), + applyLongPathPrefix(temporary).c_str(), + callback != NULL ? copyCallbackInternal : NULL, + callback, + NULL, + copyFlags)) { const DWORD lastError = ::GetLastError(); @@ -1747,8 +1743,8 @@ void ffs3::copyFile(const Zstring& sourceFile, //if file is locked (try to) use Windows Volume Shadow Copy Service if (shadowCopyHandler != NULL && - (lastError == ERROR_SHARING_VIOLATION || - lastError == ERROR_LOCK_VIOLATION)) + (lastError == ERROR_SHARING_VIOLATION || + lastError == ERROR_LOCK_VIOLATION)) { //shadowFilename already contains prefix: E.g. "\\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Program Files\FFS\sample.dat" @@ -1772,9 +1768,22 @@ void ffs3::copyFile(const Zstring& sourceFile, NULL, callback); } + //assemble error message... - const wxString errorMessage = wxString(_("Error copying file:")) + wxT("\n\"") + sourceFile.c_str() + wxT("\" ->\n\"") + targetFile.c_str() + wxT("\"") + wxT("\n\n"); - throw FileError(errorMessage + ffs3::getLastErrorFormatted(lastError)); + wxString errorMessage = wxString(_("Error copying file:")) + wxT("\n\"") + sourceFile.c_str() + wxT("\" ->\n\"") + targetFile.c_str() + wxT("\"") + + wxT("\n\n") + ffs3::getLastErrorFormatted(lastError); + + try //add more meaningful message + { + //trying to copy > 4GB file to FAT/FAT32 volume gives obscure ERROR_INVALID_PARAMETER (FAT can indeed handle files up to 4 Gig, tested!) + if (lastError == ERROR_INVALID_PARAMETER && + dst::isFatDrive(targetFile) && + getFilesize(sourceFile) >= (wxULongLong(1024 * 1024 * 1024)*=4)) //throw (FileError) + errorMessage += wxT("\nFAT volume cannot store file larger than 4 gigabyte!"); + } + catch(...) {} + + throw FileError(errorMessage); } //rename temporary file: do not add anything else here (note specific error handing) @@ -1782,14 +1791,14 @@ void ffs3::copyFile(const Zstring& sourceFile, guardTempFile.Dismiss(); //no need to delete temp file anymore - Loki::ScopeGuard guardTargetFile = Loki::MakeGuard(&TryCleanUp::tryDeleteFile, targetFile); - - if (copyFilePermissions) - copyObjectPermissions(sourceFile, targetFile, !copyFileSymLinks); //throw FileError() + Loki::ScopeGuard guardTargetFile = Loki::MakeGuard(&ffs3::removeFile, targetFile); //copy creation date (last modification date is REDUNDANTLY written, too, even for symlinks) copyFileTimes(sourceFile, targetFile, !copyFileSymLinks); //throw (FileError) + if (copyFilePermissions) + copyObjectPermissions(sourceFile, targetFile, !copyFileSymLinks); //throw FileError() + guardTargetFile.Dismiss(); } @@ -1804,10 +1813,10 @@ void ffs3::copyFile(const Zstring& sourceFile, using ffs3::CopyFileCallback; //symbolic link handling - if ( copyFileSymLinks && - symlinkExists(sourceFile)) + if (copyFileSymLinks && + symlinkExists(sourceFile)) { - return copySymlinkInternal(sourceFile, targetFile, copyFilePermissions); //throw (FileError) + return copySymlinkInternal(sourceFile, targetFile, SYMLINK_TYPE_FILE, copyFilePermissions); //throw (FileError) } //begin of regular file copy @@ -1825,7 +1834,8 @@ void ffs3::copyFile(const Zstring& sourceFile, const Zstring temporary = createTempName(targetFile); //use temporary file until a correct date has been set //ensure cleanup (e.g. network drop): call BEFORE creating fileOut object! - Loki::ScopeGuard guardTempFile = Loki::MakeGuard(::unlink, temporary); + Loki::ScopeGuard guardTempFile = Loki::MakeGuard(&ffs3::removeFile, temporary); + FileOutput fileOut(temporary); //throw FileError() @@ -1846,12 +1856,12 @@ void ffs3::copyFile(const Zstring& sourceFile, if (callback != NULL) switch (callback->updateCopyStatus(totalBytesTransferred)) { - case CopyFileCallback::CONTINUE: - break; + case CopyFileCallback::CONTINUE: + break; - case CopyFileCallback::CANCEL: //a user aborted operation IS an error condition! - throw FileError(wxString(_("Error copying file:")) + wxT("\n\"") + zToWx(sourceFile) + wxT("\" ->\n\"") + - zToWx(targetFile) + wxT("\"\n\n") + _("Operation aborted!")); + case CopyFileCallback::CANCEL: //a user aborted operation IS an error condition! + throw FileError(wxString(_("Error copying file:")) + wxT("\n\"") + zToWx(sourceFile) + wxT("\" ->\n\"") + + zToWx(targetFile) + wxT("\"\n\n") + _("Operation aborted!")); } } while (!fileIn.eof()); @@ -1864,7 +1874,7 @@ void ffs3::copyFile(const Zstring& sourceFile, guardTempFile.Dismiss(); //ensure cleanup: - Loki::ScopeGuard guardTargetFile = Loki::MakeGuard(::unlink, targetFile.c_str()); + Loki::ScopeGuard guardTargetFile = Loki::MakeGuard(&ffs3::removeFile, targetFile); //adapt file modification time: copyFileTimes(sourceFile, targetFile, true); //throw (FileError) diff --git a/shared/file_id.cpp b/shared/file_id.cpp index 7b091201..eb3be8d6 100644 --- a/shared/file_id.cpp +++ b/shared/file_id.cpp @@ -9,7 +9,7 @@ #ifdef FFS_WIN #include <wx/msw/wrapwin.h> //includes "windows.h" #include "long_path_prefix.h" -#include <boost/shared_ptr.hpp> +#include "loki/ScopeGuard.h" #elif defined FFS_LINUX #include <sys/stat.h> @@ -33,12 +33,12 @@ std::string util::retrieveFileID(const Zstring& filename) std::string fileID; #ifdef FFS_WIN -//WARNING: CreateFile() is SLOW, while GetFileInformationByHandle() is cheap! -//http://msdn.microsoft.com/en-us/library/aa363788(VS.85).aspx + //WARNING: CreateFile() is SLOW, while GetFileInformationByHandle() is cheap! + //http://msdn.microsoft.com/en-us/library/aa363788(VS.85).aspx - //privilege SE_BACKUP_NAME doesn't seem to be required here at all - //note: setting privileges requires admin rights! + //privilege SE_BACKUP_NAME doesn't seem to be required here at all + //note: setting privileges requires admin rights! const HANDLE hFile = ::CreateFile(ffs3::applyLongPathPrefix(filename).c_str(), 0, @@ -49,7 +49,8 @@ std::string util::retrieveFileID(const Zstring& filename) NULL); if (hFile != INVALID_HANDLE_VALUE) { - boost::shared_ptr<void> dummy(hFile, ::CloseHandle); + Loki::ScopeGuard dummy = Loki::MakeGuard(::CloseHandle, hFile); + (void)dummy; //silence warning "unused variable" BY_HANDLE_FILE_INFORMATION fileInfo = {}; if (::GetFileInformationByHandle(hFile, &fileInfo)) diff --git a/shared/file_io.cpp b/shared/file_io.cpp index b75b8a13..e6de77bb 100644 --- a/shared/file_io.cpp +++ b/shared/file_io.cpp @@ -61,7 +61,7 @@ FileInput::FileInput(const Zstring& filename) : //throw FileError() const DWORD lastError = ::GetLastError(); const wxString& errorMessage = wxString(_("Error opening file:")) + wxT("\n\"") + zToWx(filename_) + wxT("\"") + wxT("\n\n") + ffs3::getLastErrorFormatted(lastError); if (lastError == ERROR_FILE_NOT_FOUND || - lastError == ERROR_PATH_NOT_FOUND) + lastError == ERROR_PATH_NOT_FOUND) throw ErrorNotExisting(errorMessage); else throw FileError(errorMessage); @@ -97,12 +97,12 @@ size_t FileInput::read(void* buffer, size_t bytesToRead) //returns actual number DWORD bytesRead = 0; if (!::ReadFile( - fileHandle, //__in HANDLE hFile, - buffer, //__out LPVOID lpBuffer, - static_cast<DWORD>(bytesToRead), //__in DWORD nNumberOfBytesToRead, - &bytesRead, //__out_opt LPDWORD lpNumberOfBytesRead, - NULL) //__inout_opt LPOVERLAPPED lpOverlapped - || bytesRead > bytesToRead) //must be fulfilled + fileHandle, //__in HANDLE hFile, + buffer, //__out LPVOID lpBuffer, + static_cast<DWORD>(bytesToRead), //__in DWORD nNumberOfBytesToRead, + &bytesRead, //__out_opt LPDWORD lpNumberOfBytesRead, + NULL) //__inout_opt LPOVERLAPPED lpOverlapped + || bytesRead > bytesToRead) //must be fulfilled throw FileError(wxString(_("Error reading file:")) + wxT("\n\"") + zToWx(filename_) + wxT("\"") + wxT("\n\n") + ffs3::getLastErrorFormatted()); @@ -165,12 +165,12 @@ void FileOutput::write(const void* buffer, size_t bytesToWrite) //throw FileErro DWORD bytesWritten = 0; if (!::WriteFile( - fileHandle, //__in HANDLE hFile, - buffer, //__out LPVOID lpBuffer, - static_cast<DWORD>(bytesToWrite), //__in DWORD nNumberOfBytesToRead, - &bytesWritten, //__out_opt LPDWORD lpNumberOfBytesWritten, - NULL) //__inout_opt LPOVERLAPPED lpOverlapped - || bytesWritten != bytesToWrite) //must be fulfilled for synchronous writes! + fileHandle, //__in HANDLE hFile, + buffer, //__out LPVOID lpBuffer, + static_cast<DWORD>(bytesToWrite), //__in DWORD nNumberOfBytesToRead, + &bytesWritten, //__out_opt LPDWORD lpNumberOfBytesWritten, + NULL) //__inout_opt LPOVERLAPPED lpOverlapped + || bytesWritten != bytesToWrite) //must be fulfilled for synchronous writes! throw FileError(wxString(_("Error writing file:")) + wxT("\n\"") + zToWx(filename_) + wxT("\"") + wxT("\n\n") + ffs3::getLastErrorFormatted() + wxT(" (w)")); //w -> distinguish from fopen error message! #elif defined FFS_LINUX diff --git a/shared/file_traverser.cpp b/shared/file_traverser.cpp index 66242fa2..f0777898 100644 --- a/shared/file_traverser.cpp +++ b/shared/file_traverser.cpp @@ -66,7 +66,8 @@ bool setWin32FileInformationFromSymlink(const Zstring& linkName, ffs3::TraverseC if (hFile == INVALID_HANDLE_VALUE) return false; - boost::shared_ptr<void> dummy(hFile, ::CloseHandle); + Loki::ScopeGuard dummy = Loki::MakeGuard(::CloseHandle, hFile); + (void)dummy; //silence warning "unused variable" BY_HANDLE_FILE_INFORMATION fileInfoByHandle; if (!::GetFileInformationByHandle(hFile, &fileInfoByHandle)) @@ -129,7 +130,7 @@ private: directory : directory + common::FILE_NAME_SEPARATOR; - WIN32_FIND_DATA fileMetaData; + WIN32_FIND_DATA fileMetaData = {}; HANDLE searchHandle = ::FindFirstFile(applyLongPathPrefix(directoryFormatted + Zchar('*')).c_str(), //__in LPCTSTR lpFileName &fileMetaData); //__out LPWIN32_FIND_DATA lpFindFileData //no noticable performance difference compared to FindFirstFileEx with FindExInfoBasic, FIND_FIRST_EX_CASE_SENSITIVE and/or FIND_FIRST_EX_LARGE_FETCH @@ -148,15 +149,16 @@ private: return; } - boost::shared_ptr<void> dummy(searchHandle, ::FindClose); + Loki::ScopeGuard dummy = Loki::MakeGuard(::FindClose, searchHandle); + (void)dummy; //silence warning "unused variable" do { //don't return "." and ".." const Zchar* const shortName = fileMetaData.cFileName; - if ( shortName[0] == Zstr('.') && - ((shortName[1] == Zstr('.') && shortName[2] == Zstr('\0')) || - shortName[1] == Zstr('\0'))) + if ( shortName[0] == Zstr('.') && + ((shortName[1] == Zstr('.') && shortName[2] == Zstr('\0')) || + shortName[1] == Zstr('\0'))) continue; const Zstring& fullName = directoryFormatted + shortName; @@ -172,7 +174,7 @@ private: } catch (FileError& e) { - (void)e; + (void)e; #ifndef NDEBUG //show broken symlink / access errors in debug build! sink.onError(e.msg()); #endif @@ -187,12 +189,12 @@ private: const TraverseCallback::ReturnValDir rv = sink.onDir(shortName, fullName); switch (rv.returnCode) { - case TraverseCallback::ReturnValDir::TRAVERSING_DIR_IGNORE: - break; + case TraverseCallback::ReturnValDir::TRAVERSING_DIR_IGNORE: + break; - case TraverseCallback::ReturnValDir::TRAVERSING_DIR_CONTINUE: - traverse<followSymlinks>(fullName, *rv.subDirCb, level + 1); - break; + case TraverseCallback::ReturnValDir::TRAVERSING_DIR_CONTINUE: + traverse<followSymlinks>(fullName, *rv.subDirCb, level + 1); + break; } } else //a file or symlink that is followed... @@ -210,7 +212,7 @@ private: } else { -//####################################### DST hack ########################################### + //####################################### DST hack ########################################### if (isFatFileSystem) { const dst::RawTime rawTime(fileMetaData.ftCreationTime, fileMetaData.ftLastWriteTime); @@ -220,7 +222,7 @@ private: else markForDstHack.push_back(std::make_pair(fullName, fileMetaData.ftLastWriteTime)); } -//####################################### DST hack ########################################### + //####################################### DST hack ########################################### setWin32FileInformation(fileMetaData.ftLastWriteTime, fileMetaData.nFileSizeHigh, fileMetaData.nFileSizeLow, details); } @@ -247,7 +249,8 @@ private: return; } - boost::shared_ptr<DIR> dummy(dirObj, &::closedir); //never close NULL handles! -> crash + Loki::ScopeGuard dummy = Loki::MakeGuard(::closedir, dirObj); //never close NULL handles! -> crash + (void)dummy; //silence warning "unused variable" while (true) { @@ -266,9 +269,9 @@ private: //don't return "." and ".." const Zchar* const shortName = dirEntry->d_name; - if ( shortName[0] == Zstr('.') && - ((shortName[1] == Zstr('.') && shortName[2] == Zstr('\0')) || - shortName[1] == Zstr('\0'))) + if ( shortName[0] == Zstr('.') && + ((shortName[1] == Zstr('.') && shortName[2] == Zstr('\0')) || + shortName[1] == Zstr('\0'))) continue; const Zstring& fullName = directory.EndsWith(common::FILE_NAME_SEPARATOR) ? //e.g. "/" @@ -327,12 +330,12 @@ private: const TraverseCallback::ReturnValDir rv = sink.onDir(shortName, fullName); switch (rv.returnCode) { - case TraverseCallback::ReturnValDir::TRAVERSING_DIR_IGNORE: - break; + case TraverseCallback::ReturnValDir::TRAVERSING_DIR_IGNORE: + break; - case TraverseCallback::ReturnValDir::TRAVERSING_DIR_CONTINUE: - traverse<followSymlinks>(fullName, *rv.subDirCb, level + 1); - break; + case TraverseCallback::ReturnValDir::TRAVERSING_DIR_CONTINUE: + traverse<followSymlinks>(fullName, *rv.subDirCb, level + 1); + break; } } else //a file... (or symlink; pathological!) @@ -349,43 +352,66 @@ private: #ifdef FFS_WIN -//####################################### DST hack ########################################### + //####################################### DST hack ########################################### void applyDstHack(ffs3::DstHackCallback& dstCallback) { + int failedAttempts = 0; + int filesToValidate = 50; //don't let data verification become a performance issue + for (FilenameTimeList::const_iterator i = markForDstHack.begin(); i != markForDstHack.end(); ++i) { + if (failedAttempts >= 10) //some cloud storages don't support changing creation/modification times => don't waste (a lot of) time trying to + return; + dstCallback.requestUiRefresh(i->first); - HANDLE hTarget = ::CreateFile(ffs3::applyLongPathPrefix(i->first).c_str(), - FILE_WRITE_ATTRIBUTES, - FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, - NULL, - OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS, - NULL); - if (hTarget == INVALID_HANDLE_VALUE) - assert(false); //don't throw exceptions due to dst hack here - else + const dst::RawTime encodedTime = dst::fatEncodeUtcTime(i->second); //throw (std::runtime_error) { - boost::shared_ptr<void> dummy2(hTarget, ::CloseHandle); - - const dst::RawTime encodedTime = dst::fatEncodeUtcTime(i->second); //throw (std::runtime_error) + HANDLE hTarget = ::CreateFile(ffs3::applyLongPathPrefix(i->first).c_str(), + FILE_WRITE_ATTRIBUTES, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, + NULL); + if (hTarget == INVALID_HANDLE_VALUE) + { + ++failedAttempts; + assert(false); //don't throw exceptions due to dst hack here + continue; + } + Loki::ScopeGuard dummy = Loki::MakeGuard(::CloseHandle, hTarget); + (void)dummy; //silence warning "unused variable" if (!::SetFileTime(hTarget, &encodedTime.createTimeRaw, NULL, &encodedTime.writeTimeRaw)) + { + ++failedAttempts; assert(false); //don't throw exceptions due to dst hack here + continue; + } + } -#ifndef NDEBUG //dst hack: verify data written; attention: this check may fail for "sync.ffs_lock" + //even at this point it's not sure whether data was written correctly, again cloud storages tend to lie about success status + if (filesToValidate > 0) + { + --filesToValidate; //don't change during check! + + //dst hack: verify data written; attention: this check may fail for "sync.ffs_lock" WIN32_FILE_ATTRIBUTE_DATA debugeAttr = {}; - assert(::GetFileAttributesEx(ffs3::applyLongPathPrefix(i->first).c_str(), //__in LPCTSTR lpFileName, - GetFileExInfoStandard, //__in GET_FILEEX_INFO_LEVELS fInfoLevelId, - &debugeAttr)); //__out LPVOID lpFileInformation + ::GetFileAttributesEx(ffs3::applyLongPathPrefix(i->first).c_str(), //__in LPCTSTR lpFileName, + GetFileExInfoStandard, //__in GET_FILEEX_INFO_LEVELS fInfoLevelId, + &debugeAttr); //__out LPVOID lpFileInformation - assert(::CompareFileTime(&debugeAttr.ftCreationTime, &encodedTime.createTimeRaw) == 0); - assert(::CompareFileTime(&debugeAttr.ftLastWriteTime, &encodedTime.writeTimeRaw) == 0); -#endif + if (::CompareFileTime(&debugeAttr.ftCreationTime, &encodedTime.createTimeRaw) != 0 || + ::CompareFileTime(&debugeAttr.ftLastWriteTime, &encodedTime.writeTimeRaw) != 0) + { + ++failedAttempts; + assert(false); //don't throw exceptions due to dst hack here + continue; + } } } } @@ -393,7 +419,7 @@ private: const bool isFatFileSystem; typedef std::vector<std::pair<Zstring, FILETIME> > FilenameTimeList; FilenameTimeList markForDstHack; -//####################################### DST hack ########################################### + //####################################### DST hack ########################################### #endif }; diff --git a/shared/global_func.cpp b/shared/global_func.cpp index fe741b22..07a68187 100644 --- a/shared/global_func.cpp +++ b/shared/global_func.cpp @@ -17,7 +17,8 @@ size_t common::getDigitCount(size_t number) //count number of digits } //############################################################################ -DebugLog::DebugLog() : +DebugLog::DebugLog(const wxString& filePrefix) : + prefix(filePrefix), lineCount(0), logFile(NULL) { @@ -37,7 +38,7 @@ wxString DebugLog::assembleFileName() { wxString tmp = wxDateTime::Now().FormatISOTime(); tmp.Replace(wxT(":"), wxEmptyString); - return wxString(wxT("DEBUG_")) + wxDateTime::Now().FormatISODate() + wxChar('_') + tmp + wxT(".log"); + return prefix + wxString(wxT("DEBUG_")) + wxDateTime::Now().FormatISODate() + wxChar('_') + tmp + wxT(".log"); } diff --git a/shared/global_func.h b/shared/global_func.h index 169ad611..e0f5434a 100644 --- a/shared/global_func.h +++ b/shared/global_func.h @@ -38,14 +38,14 @@ T abs(const T& d) //absolute value } -//number conversion C++ ANSI/wide char versions +//formatted number conversion C++ ANSI/wide char versions template <class CharType, class T> std::basic_string<CharType> numberToString(const T& number); //convert number to string the C++ way template <class T, class CharType> T stringToNumber(const std::basic_string<CharType>& input); //convert number to string the C++ way -//number conversion wxWidgets +//formatted number conversion wxWidgets template <class T> wxString numberToString(const T& number); template <class T> T stringToNumber(const wxString& input); @@ -78,13 +78,15 @@ class wxFile; class DebugLog { public: - wxDEPRECATED(DebugLog()); + wxDEPRECATED(DebugLog(const wxString& filePrefix = wxString())); ~DebugLog(); void write(const wxString& logText); private: wxString assembleFileName(); + wxString logfileName; + wxString prefix; int lineCount; wxFile* logFile; //logFile.close(); <- not needed }; @@ -130,9 +132,8 @@ template <class T, class CharType> inline T common::stringToNumber(const std::basic_string<CharType>& input) //convert number to string the C++ way { - std::basic_istringstream<CharType> ss(input); - T number; - ss >> number; + T number = 0; + std::basic_istringstream<CharType>(input) >> number; return number; } diff --git a/shared/inotify/inotify-cxx.cpp b/shared/inotify/inotify-cxx.cpp index 689612ac..5a460ec7 100644 --- a/shared/inotify/inotify-cxx.cpp +++ b/shared/inotify/inotify-cxx.cpp @@ -2,11 +2,11 @@ /// inotify C++ interface implementation /** * \file inotify-cxx.cpp - * + * * inotify C++ interface - * + * * Copyright (C) 2006, 2007, 2009 Lukas Jelinek <lukas@aiken.cz> - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of one of the following licenses: * @@ -19,9 +19,9 @@ * * Credits: * Mike Frysinger (cleanup of includes) - * + * */ - + #include <errno.h> #include <unistd.h> @@ -52,590 +52,658 @@ int32_t InotifyEvent::GetDescriptor() const { - return m_pWatch != NULL // if watch exists - ? m_pWatch->GetDescriptor() // return its descriptor - : -1; // else return -1 + return m_pWatch != NULL // if watch exists + ? m_pWatch->GetDescriptor() // return its descriptor + : -1; // else return -1 } uint32_t InotifyEvent::GetMaskByName(const std::string& rName) { - if (rName == "IN_ACCESS") - return IN_ACCESS; - else if (rName == "IN_MODIFY") - return IN_MODIFY; - else if (rName == "IN_ATTRIB") - return IN_ATTRIB; - else if (rName == "IN_CLOSE_WRITE") - return IN_CLOSE_WRITE; - else if (rName == "IN_CLOSE_NOWRITE") - return IN_CLOSE_NOWRITE; - else if (rName == "IN_OPEN") - return IN_OPEN; - else if (rName == "IN_MOVED_FROM") - return IN_MOVED_FROM; - else if (rName == "IN_MOVED_TO") - return IN_MOVED_TO; - else if (rName == "IN_CREATE") - return IN_CREATE; - else if (rName == "IN_DELETE") - return IN_DELETE; - else if (rName == "IN_DELETE_SELF") - return IN_DELETE_SELF; - else if (rName == "IN_UNMOUNT") - return IN_UNMOUNT; - else if (rName == "IN_Q_OVERFLOW") - return IN_Q_OVERFLOW; - else if (rName == "IN_IGNORED") - return IN_IGNORED; - else if (rName == "IN_CLOSE") - return IN_CLOSE; - else if (rName == "IN_MOVE") - return IN_MOVE; - else if (rName == "IN_ISDIR") - return IN_ISDIR; - else if (rName == "IN_ONESHOT") - return IN_ONESHOT; - else if (rName == "IN_ALL_EVENTS") - return IN_ALL_EVENTS; - + if (rName == "IN_ACCESS") + return IN_ACCESS; + else if (rName == "IN_MODIFY") + return IN_MODIFY; + else if (rName == "IN_ATTRIB") + return IN_ATTRIB; + else if (rName == "IN_CLOSE_WRITE") + return IN_CLOSE_WRITE; + else if (rName == "IN_CLOSE_NOWRITE") + return IN_CLOSE_NOWRITE; + else if (rName == "IN_OPEN") + return IN_OPEN; + else if (rName == "IN_MOVED_FROM") + return IN_MOVED_FROM; + else if (rName == "IN_MOVED_TO") + return IN_MOVED_TO; + else if (rName == "IN_CREATE") + return IN_CREATE; + else if (rName == "IN_DELETE") + return IN_DELETE; + else if (rName == "IN_DELETE_SELF") + return IN_DELETE_SELF; + else if (rName == "IN_UNMOUNT") + return IN_UNMOUNT; + else if (rName == "IN_Q_OVERFLOW") + return IN_Q_OVERFLOW; + else if (rName == "IN_IGNORED") + return IN_IGNORED; + else if (rName == "IN_CLOSE") + return IN_CLOSE; + else if (rName == "IN_MOVE") + return IN_MOVE; + else if (rName == "IN_ISDIR") + return IN_ISDIR; + else if (rName == "IN_ONESHOT") + return IN_ONESHOT; + else if (rName == "IN_ALL_EVENTS") + return IN_ALL_EVENTS; + #ifdef IN_DONT_FOLLOW - else if (rName == "IN_DONT_FOLLOW") - return IN_DONT_FOLLOW; + else if (rName == "IN_DONT_FOLLOW") + return IN_DONT_FOLLOW; #endif // IN_DONT_FOLLOW #ifdef IN_ONLYDIR - else if (rName == "IN_ONLYDIR") - return IN_ONLYDIR; + else if (rName == "IN_ONLYDIR") + return IN_ONLYDIR; #endif // IN_ONLYDIR #ifdef IN_MOVE_SELF - else if (rName == "IN_MOVE_SELF") - return IN_MOVE_SELF; + else if (rName == "IN_MOVE_SELF") + return IN_MOVE_SELF; #endif // IN_MOVE_SELF - - return (uint32_t) 0; + + return (uint32_t) 0; } void InotifyEvent::DumpTypes(uint32_t uValue, std::string& rStr) { - rStr = ""; - - if (IsType(uValue, IN_ALL_EVENTS)) { - rStr.append("IN_ALL_EVENTS"); - } - else { - if (IsType(uValue, IN_ACCESS)) { - DUMP_SEP; - rStr.append("IN_ACCESS"); - } - if (IsType(uValue, IN_MODIFY)) { - DUMP_SEP; - rStr.append("IN_MODIFY"); - } - if (IsType(uValue, IN_ATTRIB)) { - DUMP_SEP; - rStr.append("IN_ATTRIB"); - } - if (IsType(uValue, IN_CREATE)) { - DUMP_SEP; - rStr.append("IN_CREATE"); - } - if (IsType(uValue, IN_DELETE)) { - DUMP_SEP; - rStr.append("IN_DELETE"); - } - if (IsType(uValue, IN_DELETE_SELF)) { - DUMP_SEP; - rStr.append("IN_DELETE_SELF"); - } - if (IsType(uValue, IN_OPEN)) { - DUMP_SEP; - rStr.append("IN_OPEN"); - } - if (IsType(uValue, IN_CLOSE)) { - DUMP_SEP; - rStr.append("IN_CLOSE"); + rStr = ""; + + if (IsType(uValue, IN_ALL_EVENTS)) + { + rStr.append("IN_ALL_EVENTS"); } + else + { + if (IsType(uValue, IN_ACCESS)) + { + DUMP_SEP; + rStr.append("IN_ACCESS"); + } + if (IsType(uValue, IN_MODIFY)) + { + DUMP_SEP; + rStr.append("IN_MODIFY"); + } + if (IsType(uValue, IN_ATTRIB)) + { + DUMP_SEP; + rStr.append("IN_ATTRIB"); + } + if (IsType(uValue, IN_CREATE)) + { + DUMP_SEP; + rStr.append("IN_CREATE"); + } + if (IsType(uValue, IN_DELETE)) + { + DUMP_SEP; + rStr.append("IN_DELETE"); + } + if (IsType(uValue, IN_DELETE_SELF)) + { + DUMP_SEP; + rStr.append("IN_DELETE_SELF"); + } + if (IsType(uValue, IN_OPEN)) + { + DUMP_SEP; + rStr.append("IN_OPEN"); + } + if (IsType(uValue, IN_CLOSE)) + { + DUMP_SEP; + rStr.append("IN_CLOSE"); + } #ifdef IN_MOVE_SELF - if (IsType(uValue, IN_MOVE_SELF)) { - DUMP_SEP; - rStr.append("IN_MOVE_SELF"); - } + if (IsType(uValue, IN_MOVE_SELF)) + { + DUMP_SEP; + rStr.append("IN_MOVE_SELF"); + } #endif // IN_MOVE_SELF - - else { - if (IsType(uValue, IN_CLOSE_WRITE)) { + + else + { + if (IsType(uValue, IN_CLOSE_WRITE)) + { + DUMP_SEP; + rStr.append("IN_CLOSE_WRITE"); + } + if (IsType(uValue, IN_CLOSE_NOWRITE)) + { + DUMP_SEP; + rStr.append("IN_CLOSE_NOWRITE"); + } + } + if (IsType(uValue, IN_MOVE)) + { + DUMP_SEP; + rStr.append("IN_MOVE"); + } + else + { + if (IsType(uValue, IN_MOVED_FROM)) + { + DUMP_SEP; + rStr.append("IN_MOVED_FROM"); + } + if (IsType(uValue, IN_MOVED_TO)) + { + DUMP_SEP; + rStr.append("IN_MOVED_TO"); + } + } + } + if (IsType(uValue, IN_UNMOUNT)) + { DUMP_SEP; - rStr.append("IN_CLOSE_WRITE"); - } - if (IsType(uValue, IN_CLOSE_NOWRITE)) { + rStr.append("IN_UNMOUNT"); + } + if (IsType(uValue, IN_Q_OVERFLOW)) + { DUMP_SEP; - rStr.append("IN_CLOSE_NOWRITE"); - } + rStr.append("IN_Q_OVERFLOW"); } - if (IsType(uValue, IN_MOVE)) { - DUMP_SEP; - rStr.append("IN_MOVE"); + if (IsType(uValue, IN_IGNORED)) + { + DUMP_SEP; + rStr.append("IN_IGNORED"); } - else { - if (IsType(uValue, IN_MOVED_FROM)) { + if (IsType(uValue, IN_ISDIR)) + { DUMP_SEP; - rStr.append("IN_MOVED_FROM"); - } - if (IsType(uValue, IN_MOVED_TO)) { + rStr.append("IN_ISDIR"); + } + if (IsType(uValue, IN_ONESHOT)) + { DUMP_SEP; - rStr.append("IN_MOVED_TO"); - } - } - } - if (IsType(uValue, IN_UNMOUNT)) { - DUMP_SEP; - rStr.append("IN_UNMOUNT"); - } - if (IsType(uValue, IN_Q_OVERFLOW)) { - DUMP_SEP; - rStr.append("IN_Q_OVERFLOW"); - } - if (IsType(uValue, IN_IGNORED)) { - DUMP_SEP; - rStr.append("IN_IGNORED"); - } - if (IsType(uValue, IN_ISDIR)) { - DUMP_SEP; - rStr.append("IN_ISDIR"); - } - if (IsType(uValue, IN_ONESHOT)) { - DUMP_SEP; - rStr.append("IN_ONESHOT"); - } - + rStr.append("IN_ONESHOT"); + } + #ifdef IN_DONT_FOLLOW - if (IsType(uValue, IN_DONT_FOLLOW)) { - DUMP_SEP; - rStr.append("IN_DONT_FOLLOW"); - } + if (IsType(uValue, IN_DONT_FOLLOW)) + { + DUMP_SEP; + rStr.append("IN_DONT_FOLLOW"); + } #endif // IN_DONT_FOLLOW - + #ifdef IN_ONLYDIR - if (IsType(uValue, IN_ONLYDIR)) { - DUMP_SEP; - rStr.append("IN_ONLYDIR"); - } + if (IsType(uValue, IN_ONLYDIR)) + { + DUMP_SEP; + rStr.append("IN_ONLYDIR"); + } #endif // IN_ONLYDIR } void InotifyEvent::DumpTypes(std::string& rStr) const { - DumpTypes(m_uMask, rStr); + DumpTypes(m_uMask, rStr); } void InotifyWatch::SetMask(uint32_t uMask) throw (InotifyException) { - IN_WRITE_BEGIN - - if (m_wd != -1) { - int wd = inotify_add_watch(m_pInotify->GetDescriptor(), m_path.c_str(), uMask); - if (wd != m_wd) { - IN_WRITE_END_NOTHROW - throw InotifyException(IN_EXC_MSG("changing mask failed"), wd == -1 ? errno : EINVAL, this); - } - } - - m_uMask = uMask; - - IN_WRITE_END + IN_WRITE_BEGIN + + if (m_wd != -1) + { + int wd = inotify_add_watch(m_pInotify->GetDescriptor(), m_path.c_str(), uMask); + if (wd != m_wd) + { + IN_WRITE_END_NOTHROW + throw InotifyException(IN_EXC_MSG("changing mask failed"), wd == -1 ? errno : EINVAL, this); + } + } + + m_uMask = uMask; + + IN_WRITE_END } void InotifyWatch::SetEnabled(bool fEnabled) throw (InotifyException) { - IN_WRITE_BEGIN - - if (fEnabled == m_fEnabled) { - IN_WRITE_END_NOTHROW - return; - } - - if (m_pInotify != NULL) { - if (fEnabled) { - m_wd = inotify_add_watch(m_pInotify->GetDescriptor(), m_path.c_str(), m_uMask); - if (m_wd == -1) { + IN_WRITE_BEGIN + + if (fEnabled == m_fEnabled) + { IN_WRITE_END_NOTHROW - throw InotifyException(IN_EXC_MSG("enabling watch failed"), errno, this); - } - m_pInotify->m_watches.insert(IN_WATCH_MAP::value_type(m_wd, this)); + return; } - else { - if (inotify_rm_watch(m_pInotify->GetDescriptor(), m_wd) != 0) { - IN_WRITE_END_NOTHROW - throw InotifyException(IN_EXC_MSG("disabling watch failed"), errno, this); - } - m_pInotify->m_watches.erase(m_wd); - m_wd = -1; - } - } - - m_fEnabled = fEnabled; - - IN_WRITE_END + + if (m_pInotify != NULL) + { + if (fEnabled) + { + m_wd = inotify_add_watch(m_pInotify->GetDescriptor(), m_path.c_str(), m_uMask); + if (m_wd == -1) + { + IN_WRITE_END_NOTHROW + throw InotifyException(IN_EXC_MSG("enabling watch failed"), errno, this); + } + m_pInotify->m_watches.insert(IN_WATCH_MAP::value_type(m_wd, this)); + } + else + { + if (inotify_rm_watch(m_pInotify->GetDescriptor(), m_wd) != 0) + { + IN_WRITE_END_NOTHROW + throw InotifyException(IN_EXC_MSG("disabling watch failed"), errno, this); + } + m_pInotify->m_watches.erase(m_wd); + m_wd = -1; + } + } + + m_fEnabled = fEnabled; + + IN_WRITE_END } void InotifyWatch::__Disable() { - IN_WRITE_BEGIN - - if (!m_fEnabled) { - IN_WRITE_END_NOTHROW - throw InotifyException(IN_EXC_MSG("event cannot occur on disabled watch"), EINVAL, this); - } - - if (m_pInotify != NULL) { - m_pInotify->m_watches.erase(m_wd); - m_wd = -1; - } - - m_fEnabled = false; - - IN_WRITE_END + IN_WRITE_BEGIN + + if (!m_fEnabled) + { + IN_WRITE_END_NOTHROW + throw InotifyException(IN_EXC_MSG("event cannot occur on disabled watch"), EINVAL, this); + } + + if (m_pInotify != NULL) + { + m_pInotify->m_watches.erase(m_wd); + m_wd = -1; + } + + m_fEnabled = false; + + IN_WRITE_END } Inotify::Inotify() throw (InotifyException) { - IN_LOCK_INIT - - m_fd = inotify_init(); - if (m_fd == -1) { - IN_LOCK_DONE - throw InotifyException(IN_EXC_MSG("inotify init failed"), errno, NULL); - } + IN_LOCK_INIT + + m_fd = inotify_init(); + if (m_fd == -1) + { + IN_LOCK_DONE + throw InotifyException(IN_EXC_MSG("inotify init failed"), errno, NULL); + } } - + Inotify::~Inotify() { - Close(); - - IN_LOCK_DONE + Close(); + + IN_LOCK_DONE } void Inotify::Close() { - IN_WRITE_BEGIN - - if (m_fd != -1) { - RemoveAll(); - close(m_fd); - m_fd = -1; - } - - IN_WRITE_END + IN_WRITE_BEGIN + + if (m_fd != -1) + { + RemoveAll(); + close(m_fd); + m_fd = -1; + } + + IN_WRITE_END } void Inotify::Add(InotifyWatch* pWatch) throw (InotifyException) { - IN_WRITE_BEGIN - - // invalid descriptor - this case shouldn't occur - go away - if (m_fd == -1) { - IN_WRITE_END_NOTHROW - throw InotifyException(IN_EXC_MSG("invalid file descriptor"), EBUSY, this); - } - - // this path already watched - go away - if (FindWatch(pWatch->GetPath()) != NULL) { - IN_WRITE_END_NOTHROW - throw InotifyException(IN_EXC_MSG("path already watched"), EBUSY, this); - } - - // for enabled watch - if (pWatch->IsEnabled()) { - - // try to add watch to kernel - int wd = inotify_add_watch(m_fd, pWatch->GetPath().c_str(), pWatch->GetMask()); - - // adding failed - go away - if (wd == -1) { - IN_WRITE_END_NOTHROW - throw InotifyException(IN_EXC_MSG("adding watch failed"), errno, this); - } - - // this path already watched (but defined another way) - InotifyWatch* pW = FindWatch(wd); - if (pW != NULL) { - - // try to recover old watch because it may be modified - then go away - if (inotify_add_watch(m_fd, pW->GetPath().c_str(), pW->GetMask()) < 0) { + IN_WRITE_BEGIN + + // invalid descriptor - this case shouldn't occur - go away + if (m_fd == -1) + { IN_WRITE_END_NOTHROW - throw InotifyException(IN_EXC_MSG("watch collision detected and recovery failed"), errno, this); - } - else { - // recovery failed - go away + throw InotifyException(IN_EXC_MSG("invalid file descriptor"), EBUSY, this); + } + + // this path already watched - go away + if (FindWatch(pWatch->GetPath()) != NULL) + { IN_WRITE_END_NOTHROW - throw InotifyException(IN_EXC_MSG("path already watched (but defined another way)"), EBUSY, this); - } - } - - pWatch->m_wd = wd; - m_watches.insert(IN_WATCH_MAP::value_type(pWatch->m_wd, pWatch)); - } - - m_paths.insert(IN_WP_MAP::value_type(pWatch->m_path, pWatch)); - pWatch->m_pInotify = this; - - IN_WRITE_END + throw InotifyException(IN_EXC_MSG("path already watched"), EBUSY, this); + } + + // for enabled watch + if (pWatch->IsEnabled()) + { + + // try to add watch to kernel + int wd = inotify_add_watch(m_fd, pWatch->GetPath().c_str(), pWatch->GetMask()); + + // adding failed - go away + if (wd == -1) + { + IN_WRITE_END_NOTHROW + throw InotifyException(IN_EXC_MSG("adding watch failed"), errno, this); + } + + // this path already watched (but defined another way) + InotifyWatch* pW = FindWatch(wd); + if (pW != NULL) + { + + // try to recover old watch because it may be modified - then go away + if (inotify_add_watch(m_fd, pW->GetPath().c_str(), pW->GetMask()) < 0) + { + IN_WRITE_END_NOTHROW + throw InotifyException(IN_EXC_MSG("watch collision detected and recovery failed"), errno, this); + } + else + { + // recovery failed - go away + IN_WRITE_END_NOTHROW + throw InotifyException(IN_EXC_MSG("path already watched (but defined another way)"), EBUSY, this); + } + } + + pWatch->m_wd = wd; + m_watches.insert(IN_WATCH_MAP::value_type(pWatch->m_wd, pWatch)); + } + + m_paths.insert(IN_WP_MAP::value_type(pWatch->m_path, pWatch)); + pWatch->m_pInotify = this; + + IN_WRITE_END } void Inotify::Remove(InotifyWatch* pWatch) throw (InotifyException) { - IN_WRITE_BEGIN - - // invalid descriptor - this case shouldn't occur - go away - if (m_fd == -1) { - IN_WRITE_END_NOTHROW - throw InotifyException(IN_EXC_MSG("invalid file descriptor"), EBUSY, this); - } - - // for enabled watch - if (pWatch->m_wd != -1) { - - // removing watch failed - go away - if (inotify_rm_watch(m_fd, pWatch->m_wd) == -1) { - IN_WRITE_END_NOTHROW - throw InotifyException(IN_EXC_MSG("removing watch failed"), errno, this); - } - m_watches.erase(pWatch->m_wd); - pWatch->m_wd = -1; - } - - m_paths.erase(pWatch->m_path); - pWatch->m_pInotify = NULL; - - IN_WRITE_END + IN_WRITE_BEGIN + + // invalid descriptor - this case shouldn't occur - go away + if (m_fd == -1) + { + IN_WRITE_END_NOTHROW + throw InotifyException(IN_EXC_MSG("invalid file descriptor"), EBUSY, this); + } + + // for enabled watch + if (pWatch->m_wd != -1) + { + + // removing watch failed - go away + if (inotify_rm_watch(m_fd, pWatch->m_wd) == -1) + { + IN_WRITE_END_NOTHROW + throw InotifyException(IN_EXC_MSG("removing watch failed"), errno, this); + } + m_watches.erase(pWatch->m_wd); + pWatch->m_wd = -1; + } + + m_paths.erase(pWatch->m_path); + pWatch->m_pInotify = NULL; + + IN_WRITE_END } void Inotify::RemoveAll() { - IN_WRITE_BEGIN - - IN_WP_MAP::iterator it = m_paths.begin(); - while (it != m_paths.end()) { - InotifyWatch* pW = (*it).second; - if (pW->m_wd != -1) { - inotify_rm_watch(m_fd, pW->m_wd); - pW->m_wd = -1; - } - pW->m_pInotify = NULL; - it++; - } - - m_watches.clear(); - m_paths.clear(); - - IN_WRITE_END + IN_WRITE_BEGIN + + IN_WP_MAP::iterator it = m_paths.begin(); + while (it != m_paths.end()) + { + InotifyWatch* pW = (*it).second; + if (pW->m_wd != -1) + { + inotify_rm_watch(m_fd, pW->m_wd); + pW->m_wd = -1; + } + pW->m_pInotify = NULL; + it++; + } + + m_watches.clear(); + m_paths.clear(); + + IN_WRITE_END } void Inotify::WaitForEvents(bool fNoIntr) throw (InotifyException) { - ssize_t len = 0; - - do { - len = read(m_fd, m_buf, INOTIFY_BUFLEN); - } while (fNoIntr && len == -1 && errno == EINTR); - - if (len == -1 && !(errno == EWOULDBLOCK || errno == EINTR)) - throw InotifyException(IN_EXC_MSG("reading events failed"), errno, this); - - if (len == -1) - return; - - IN_WRITE_BEGIN - - ssize_t i = 0; - while (i < len) { - struct inotify_event* pEvt = (struct inotify_event*) &m_buf[i]; - InotifyWatch* pW = FindWatch(pEvt->wd); - if (pW != NULL) { - InotifyEvent evt(pEvt, pW); - if ( InotifyEvent::IsType(pW->GetMask(), IN_ONESHOT) - || InotifyEvent::IsType(evt.GetMask(), IN_IGNORED)) - pW->__Disable(); - m_events.push_back(evt); - } - i += INOTIFY_EVENT_SIZE + (ssize_t) pEvt->len; - } - - IN_WRITE_END + ssize_t len = 0; + + do + { + len = read(m_fd, m_buf, INOTIFY_BUFLEN); + } + while (fNoIntr && len == -1 && errno == EINTR); + + if (len == -1 && !(errno == EWOULDBLOCK || errno == EINTR)) + throw InotifyException(IN_EXC_MSG("reading events failed"), errno, this); + + if (len == -1) + return; + + IN_WRITE_BEGIN + + ssize_t i = 0; + while (i < len) + { + struct inotify_event* pEvt = (struct inotify_event*) &m_buf[i]; + InotifyWatch* pW = FindWatch(pEvt->wd); + if (pW != NULL) + { + InotifyEvent evt(pEvt, pW); + if ( InotifyEvent::IsType(pW->GetMask(), IN_ONESHOT) + || InotifyEvent::IsType(evt.GetMask(), IN_IGNORED)) + pW->__Disable(); + m_events.push_back(evt); + } + i += INOTIFY_EVENT_SIZE + (ssize_t) pEvt->len; + } + + IN_WRITE_END } - + bool Inotify::GetEvent(InotifyEvent* pEvt) throw (InotifyException) { - if (pEvt == NULL) - throw InotifyException(IN_EXC_MSG("null pointer to event"), EINVAL, this); - - IN_WRITE_BEGIN - - bool b = !m_events.empty(); - if (b) { - *pEvt = m_events.front(); - m_events.pop_front(); - } - - IN_WRITE_END - - return b; + if (pEvt == NULL) + throw InotifyException(IN_EXC_MSG("null pointer to event"), EINVAL, this); + + IN_WRITE_BEGIN + + bool b = !m_events.empty(); + if (b) + { + *pEvt = m_events.front(); + m_events.pop_front(); + } + + IN_WRITE_END + + return b; } - + bool Inotify::PeekEvent(InotifyEvent* pEvt) throw (InotifyException) { - if (pEvt == NULL) - throw InotifyException(IN_EXC_MSG("null pointer to event"), EINVAL, this); - - IN_READ_BEGIN - - bool b = !m_events.empty(); - if (b) { - *pEvt = m_events.front(); - } - - IN_READ_END - - return b; + if (pEvt == NULL) + throw InotifyException(IN_EXC_MSG("null pointer to event"), EINVAL, this); + + IN_READ_BEGIN + + bool b = !m_events.empty(); + if (b) + { + *pEvt = m_events.front(); + } + + IN_READ_END + + return b; } InotifyWatch* Inotify::FindWatch(int iDescriptor) { - IN_READ_BEGIN - - IN_WATCH_MAP::iterator it = m_watches.find(iDescriptor); - InotifyWatch* pW = it == m_watches.end() ? NULL : (*it).second; - - IN_READ_END - - return pW; + IN_READ_BEGIN + + IN_WATCH_MAP::iterator it = m_watches.find(iDescriptor); + InotifyWatch* pW = it == m_watches.end() ? NULL : (*it).second; + + IN_READ_END + + return pW; } InotifyWatch* Inotify::FindWatch(const std::string& rPath) { - IN_READ_BEGIN - - IN_WP_MAP::iterator it = m_paths.find(rPath); - InotifyWatch* pW = it == m_paths.end() ? NULL : (*it).second; - - IN_READ_END - - return pW; + IN_READ_BEGIN + + IN_WP_MAP::iterator it = m_paths.find(rPath); + InotifyWatch* pW = it == m_paths.end() ? NULL : (*it).second; + + IN_READ_END + + return pW; } - + void Inotify::SetNonBlock(bool fNonBlock) throw (InotifyException) { - IN_WRITE_BEGIN - - if (m_fd == -1) { - IN_WRITE_END_NOTHROW - throw InotifyException(IN_EXC_MSG("invalid file descriptor"), EBUSY, this); - } - - int res = fcntl(m_fd, F_GETFL); - if (res == -1) { - IN_WRITE_END_NOTHROW - throw InotifyException(IN_EXC_MSG("cannot get inotify flags"), errno, this); - } - - if (fNonBlock) { - res |= O_NONBLOCK; - } - else { - res &= ~O_NONBLOCK; - } - - if (fcntl(m_fd, F_SETFL, res) == -1) { - IN_WRITE_END_NOTHROW - throw InotifyException(IN_EXC_MSG("cannot set inotify flags"), errno, this); - } - - IN_WRITE_END + IN_WRITE_BEGIN + + if (m_fd == -1) + { + IN_WRITE_END_NOTHROW + throw InotifyException(IN_EXC_MSG("invalid file descriptor"), EBUSY, this); + } + + int res = fcntl(m_fd, F_GETFL); + if (res == -1) + { + IN_WRITE_END_NOTHROW + throw InotifyException(IN_EXC_MSG("cannot get inotify flags"), errno, this); + } + + if (fNonBlock) + { + res |= O_NONBLOCK; + } + else + { + res &= ~O_NONBLOCK; + } + + if (fcntl(m_fd, F_SETFL, res) == -1) + { + IN_WRITE_END_NOTHROW + throw InotifyException(IN_EXC_MSG("cannot set inotify flags"), errno, this); + } + + IN_WRITE_END } void Inotify::SetCloseOnExec(bool fClOnEx) throw (InotifyException) { - IN_WRITE_BEGIN - - if (m_fd == -1) { - IN_WRITE_END_NOTHROW - throw InotifyException(IN_EXC_MSG("invalid file descriptor"), EBUSY, this); - } - - int res = fcntl(m_fd, F_GETFD); - if (res == -1) { - IN_WRITE_END_NOTHROW - throw InotifyException(IN_EXC_MSG("cannot get inotify flags"), errno, this); - } - - if (fClOnEx) { - res |= FD_CLOEXEC; - } - else { - res &= ~FD_CLOEXEC; - } - - if (fcntl(m_fd, F_SETFD, res) == -1) { - IN_WRITE_END_NOTHROW - throw InotifyException(IN_EXC_MSG("cannot set inotify flags"), errno, this); - } - - IN_WRITE_END + IN_WRITE_BEGIN + + if (m_fd == -1) + { + IN_WRITE_END_NOTHROW + throw InotifyException(IN_EXC_MSG("invalid file descriptor"), EBUSY, this); + } + + int res = fcntl(m_fd, F_GETFD); + if (res == -1) + { + IN_WRITE_END_NOTHROW + throw InotifyException(IN_EXC_MSG("cannot get inotify flags"), errno, this); + } + + if (fClOnEx) + { + res |= FD_CLOEXEC; + } + else + { + res &= ~FD_CLOEXEC; + } + + if (fcntl(m_fd, F_SETFD, res) == -1) + { + IN_WRITE_END_NOTHROW + throw InotifyException(IN_EXC_MSG("cannot set inotify flags"), errno, this); + } + + IN_WRITE_END } uint32_t Inotify::GetCapability(InotifyCapability_t cap) throw (InotifyException) { - FILE* f = fopen(GetCapabilityPath(cap).c_str(), "r"); - if (f == NULL) - throw InotifyException(IN_EXC_MSG("cannot get capability"), errno, NULL); - - unsigned int val = 0; - if (fscanf(f, "%u", &val) != 1) { + FILE* f = fopen(GetCapabilityPath(cap).c_str(), "r"); + if (f == NULL) + throw InotifyException(IN_EXC_MSG("cannot get capability"), errno, NULL); + + unsigned int val = 0; + if (fscanf(f, "%u", &val) != 1) + { + fclose(f); + throw InotifyException(IN_EXC_MSG("cannot get capability"), EIO, NULL); + } + fclose(f); - throw InotifyException(IN_EXC_MSG("cannot get capability"), EIO, NULL); - } - - fclose(f); - - return (uint32_t) val; + + return (uint32_t) val; } void Inotify::SetCapability(InotifyCapability_t cap, uint32_t val) throw (InotifyException) { - FILE* f = fopen(GetCapabilityPath(cap).c_str(), "w"); - if (f == NULL) - throw InotifyException(IN_EXC_MSG("cannot set capability"), errno, NULL); - - if (fprintf(f, "%u", (unsigned int) val) <= 0) { + FILE* f = fopen(GetCapabilityPath(cap).c_str(), "w"); + if (f == NULL) + throw InotifyException(IN_EXC_MSG("cannot set capability"), errno, NULL); + + if (fprintf(f, "%u", (unsigned int) val) <= 0) + { + fclose(f); + throw InotifyException(IN_EXC_MSG("cannot set capability"), EIO, NULL); + } + fclose(f); - throw InotifyException(IN_EXC_MSG("cannot set capability"), EIO, NULL); - } - - fclose(f); } std::string Inotify::GetCapabilityPath(InotifyCapability_t cap) throw (InotifyException) { - std::string path(PROCFS_INOTIFY_BASE); - - switch (cap) { - case IN_MAX_EVENTS: - path.append("max_queued_events"); - break; - case IN_MAX_INSTANCES: - path.append("max_user_instances"); - break; - case IN_MAX_WATCHES: - path.append("max_user_watches"); - break; - default: - throw InotifyException(IN_EXC_MSG("unknown capability type"), EINVAL, NULL); - } - - return path; + std::string path(PROCFS_INOTIFY_BASE); + + switch (cap) + { + case IN_MAX_EVENTS: + path.append("max_queued_events"); + break; + case IN_MAX_INSTANCES: + path.append("max_user_instances"); + break; + case IN_MAX_WATCHES: + path.append("max_user_watches"); + break; + default: + throw InotifyException(IN_EXC_MSG("unknown capability type"), EINVAL, NULL); + } + + return path; } diff --git a/shared/inotify/inotify-cxx.h b/shared/inotify/inotify-cxx.h index 34ae2212..2fb00fc8 100644 --- a/shared/inotify/inotify-cxx.h +++ b/shared/inotify/inotify-cxx.h @@ -2,11 +2,11 @@ /// inotify C++ interface header /** * \file inotify-cxx.h - * + * * inotify C++ interface - * + * * Copyright (C) 2006, 2007, 2009 Lukas Jelinek, <lukas@aiken.cz> - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of one of the following licenses: * @@ -50,12 +50,12 @@ */ #define IN_EXC_MSG(msg) (std::string(__PRETTY_FUNCTION__) + ": " + msg) -/// inotify capability/limit identifiers +/// inotify capability/limit identifiers typedef enum { - IN_MAX_EVENTS = 0, ///< max. events in the kernel queue - IN_MAX_INSTANCES = 1, ///< max. inotify file descriptors per process - IN_MAX_WATCHES = 2 ///< max. watches per file descriptor + IN_MAX_EVENTS = 0, ///< max. events in the kernel queue + IN_MAX_INSTANCES = 1, ///< max. inotify file descriptors per process + IN_MAX_WATCHES = 2 ///< max. watches per file descriptor } InotifyCapability_t; /// inotify-cxx thread safety @@ -63,16 +63,16 @@ typedef enum * If this symbol is defined you can use this interface safely * threaded applications. Remember that it slightly degrades * performance. - * + * * Even if INOTIFY_THREAD_SAFE is defined some classes stay * unsafe. If you must use them (must you?) in more than one * thread concurrently you need to implement explicite locking. - * + * * You need not to define INOTIFY_THREAD_SAFE in that cases * where the application is multithreaded but all the inotify * infrastructure will be managed only in one thread. This is * the recommended way. - * + * * Locking may fail (it is very rare but not impossible). In this * case an exception is thrown. But if unlocking fails in case * of an error it does nothing (this failure is ignored). @@ -95,7 +95,7 @@ typedef enum throw InotifyException(IN_EXC_MSG("cannot initialize lock"), res, this); \ pthread_rwlockattr_destroy(&attr); \ } - + #define IN_LOCK_DONE pthread_rwlock_destroy(&__m_lock); #define IN_READ_BEGIN \ @@ -104,23 +104,23 @@ typedef enum if (res != 0) \ throw InotifyException(IN_EXC_MSG("locking for reading failed"), res, (void*) this); \ } - + #define IN_READ_END \ { \ int res = pthread_rwlock_unlock(&__m_lock); \ if (res != 0) \ throw InotifyException(IN_EXC_MSG("unlocking failed"), res, (void*) this); \ } - + #define IN_READ_END_NOTHROW pthread_rwlock_unlock(&__m_lock); - + #define IN_WRITE_BEGIN \ { \ int res = pthread_rwlock_wrlock(&__m_lock); \ if (res != 0) \ throw InotifyException(IN_EXC_MSG("locking for writing failed"), res, (void*) this); \ } - + #define IN_WRITE_END IN_READ_END #define IN_WRITE_END_NOTHROW IN_READ_END_NOTHROW @@ -151,59 +151,59 @@ class Inotify; * This class allows to acquire information about exceptional * events. It makes easier to log or display error messages * and to identify problematic code locations. - * + * * Although this class is basically thread-safe it is not intended * to be shared between threads. */ class InotifyException { public: - /// Constructor - /** - * \param[in] rMsg message - * \param[in] iErr error number (see errno.h) - * \param[in] pSrc source - */ - InotifyException(const std::string& rMsg = "", int iErr = 0, void* pSrc = NULL) - : m_msg(rMsg), - m_err(iErr) - { - m_pSrc = pSrc; - } - - /// Returns the exception message. - /** - * \return message - */ - inline const std::string& GetMessage() const - { - return m_msg; - } - - /// Returns the exception error number. - /** - * If not applicable this value is 0 (zero). - * - * \return error number (standardized; see errno.h) - */ - inline int GetErrorNumber() const - { - return m_err; - } - - /// Returns the exception source. - /** - * \return source - */ - inline void* GetSource() const - { - return m_pSrc; - } + /// Constructor + /** + * \param[in] rMsg message + * \param[in] iErr error number (see errno.h) + * \param[in] pSrc source + */ + InotifyException(const std::string& rMsg = "", int iErr = 0, void* pSrc = NULL) + : m_msg(rMsg), + m_err(iErr) + { + m_pSrc = pSrc; + } + + /// Returns the exception message. + /** + * \return message + */ + inline const std::string& GetMessage() const + { + return m_msg; + } + + /// Returns the exception error number. + /** + * If not applicable this value is 0 (zero). + * + * \return error number (standardized; see errno.h) + */ + inline int GetErrorNumber() const + { + return m_err; + } + + /// Returns the exception source. + /** + * \return source + */ + inline void* GetSource() const + { + return m_pSrc; + } protected: - std::string m_msg; ///< message - int m_err; ///< error number - mutable void* m_pSrc; ///< source + std::string m_msg; ///< message + int m_err; ///< error number + mutable void* m_pSrc; ///< source }; @@ -211,7 +211,7 @@ protected: /** * It holds all information about inotify event and provides * access to its particular values. - * + * * This class is not (and is not intended to be) thread-safe * and therefore it must not be used concurrently in multiple * threads. @@ -219,157 +219,160 @@ protected: class InotifyEvent { public: - /// Constructor. - /** - * Creates a plain event. - */ - InotifyEvent() - : m_uMask(0), - m_uCookie(0) - { - m_pWatch = NULL; - } - - /// Constructor. - /** - * Creates an event based on inotify event data. - * For NULL pointers it works the same way as InotifyEvent(). - * - * \param[in] pEvt event data - * \param[in] pWatch inotify watch - */ - InotifyEvent(const struct inotify_event* pEvt, InotifyWatch* pWatch) - : m_uMask(0), - m_uCookie(0) - { - if (pEvt != NULL) { - m_uMask = (uint32_t) pEvt->mask; - m_uCookie = (uint32_t) pEvt->cookie; - if (pEvt->name != NULL) { - m_name = pEvt->len > 0 - ? pEvt->name - : ""; - } - m_pWatch = pWatch; - } - else { - m_pWatch = NULL; + /// Constructor. + /** + * Creates a plain event. + */ + InotifyEvent() + : m_uMask(0), + m_uCookie(0) + { + m_pWatch = NULL; } - } - - /// Destructor. - ~InotifyEvent() {} - - /// Returns the event watch descriptor. - /** - * \return watch descriptor - * - * \sa InotifyWatch::GetDescriptor() - */ - int32_t GetDescriptor() const; - - /// Returns the event mask. - /** - * \return event mask - * - * \sa InotifyWatch::GetMask() - */ - inline uint32_t GetMask() const - { - return m_uMask; - } - - /// Checks a value for the event type. - /** - * \param[in] uValue checked value - * \param[in] uType type which is checked for - * \return true = the value contains the given type, false = otherwise - */ - inline static bool IsType(uint32_t uValue, uint32_t uType) - { - return ((uValue & uType) != 0) && ((~uValue & uType) == 0); - } - - /// Checks for the event type. - /** - * \param[in] uType type which is checked for - * \return true = event mask contains the given type, false = otherwise - */ - inline bool IsType(uint32_t uType) const - { - return IsType(m_uMask, uType); - } - - /// Returns the event cookie. - /** - * \return event cookie - */ - inline uint32_t GetCookie() const - { - return m_uCookie; - } - - /// Returns the event name length. - /** - * \return event name length - */ - inline uint32_t GetLength() const - { - return (uint32_t) m_name.length(); - } - - /// Returns the event name. - /** - * \return event name - */ - inline const std::string& GetName() const - { - return m_name; - } - - /// Extracts the event name. - /** - * \param[out] rName event name - */ - inline void GetName(std::string& rName) const - { - rName = GetName(); - } - - /// Returns the source watch. - /** - * \return source watch - */ - inline InotifyWatch* GetWatch() - { - return m_pWatch; - } - - /// Finds the appropriate mask for a name. - /** - * \param[in] rName mask name - * \return mask for name; 0 on failure - */ - static uint32_t GetMaskByName(const std::string& rName); - - /// Fills the string with all types contained in an event mask value. - /** - * \param[in] uValue event mask value - * \param[out] rStr dumped event types - */ - static void DumpTypes(uint32_t uValue, std::string& rStr); - - /// Fills the string with all types contained in the event mask. - /** - * \param[out] rStr dumped event types - */ - void DumpTypes(std::string& rStr) const; - + + /// Constructor. + /** + * Creates an event based on inotify event data. + * For NULL pointers it works the same way as InotifyEvent(). + * + * \param[in] pEvt event data + * \param[in] pWatch inotify watch + */ + InotifyEvent(const struct inotify_event* pEvt, InotifyWatch* pWatch) + : m_uMask(0), + m_uCookie(0) + { + if (pEvt != NULL) + { + m_uMask = (uint32_t) pEvt->mask; + m_uCookie = (uint32_t) pEvt->cookie; + if (pEvt->name != NULL) + { + m_name = pEvt->len > 0 + ? pEvt->name + : ""; + } + m_pWatch = pWatch; + } + else + { + m_pWatch = NULL; + } + } + + /// Destructor. + ~InotifyEvent() {} + + /// Returns the event watch descriptor. + /** + * \return watch descriptor + * + * \sa InotifyWatch::GetDescriptor() + */ + int32_t GetDescriptor() const; + + /// Returns the event mask. + /** + * \return event mask + * + * \sa InotifyWatch::GetMask() + */ + inline uint32_t GetMask() const + { + return m_uMask; + } + + /// Checks a value for the event type. + /** + * \param[in] uValue checked value + * \param[in] uType type which is checked for + * \return true = the value contains the given type, false = otherwise + */ + inline static bool IsType(uint32_t uValue, uint32_t uType) + { + return ((uValue & uType) != 0) && ((~uValue & uType) == 0); + } + + /// Checks for the event type. + /** + * \param[in] uType type which is checked for + * \return true = event mask contains the given type, false = otherwise + */ + inline bool IsType(uint32_t uType) const + { + return IsType(m_uMask, uType); + } + + /// Returns the event cookie. + /** + * \return event cookie + */ + inline uint32_t GetCookie() const + { + return m_uCookie; + } + + /// Returns the event name length. + /** + * \return event name length + */ + inline uint32_t GetLength() const + { + return (uint32_t) m_name.length(); + } + + /// Returns the event name. + /** + * \return event name + */ + inline const std::string& GetName() const + { + return m_name; + } + + /// Extracts the event name. + /** + * \param[out] rName event name + */ + inline void GetName(std::string& rName) const + { + rName = GetName(); + } + + /// Returns the source watch. + /** + * \return source watch + */ + inline InotifyWatch* GetWatch() + { + return m_pWatch; + } + + /// Finds the appropriate mask for a name. + /** + * \param[in] rName mask name + * \return mask for name; 0 on failure + */ + static uint32_t GetMaskByName(const std::string& rName); + + /// Fills the string with all types contained in an event mask value. + /** + * \param[in] uValue event mask value + * \param[out] rStr dumped event types + */ + static void DumpTypes(uint32_t uValue, std::string& rStr); + + /// Fills the string with all types contained in the event mask. + /** + * \param[out] rStr dumped event types + */ + void DumpTypes(std::string& rStr) const; + private: - uint32_t m_uMask; ///< mask - uint32_t m_uCookie; ///< cookie - std::string m_name; ///< name - InotifyWatch* m_pWatch; ///< source watch + uint32_t m_uMask; ///< mask + uint32_t m_uCookie; ///< cookie + std::string m_name; ///< name + InotifyWatch* m_pWatch; ///< source watch }; @@ -378,140 +381,140 @@ private: /** * It holds information about the inotify watch on a particular * inode. - * + * * If the INOTIFY_THREAD_SAFE is defined this class is thread-safe. */ class InotifyWatch { public: - /// Constructor. - /** - * Creates an inotify watch. Because this watch is - * inactive it has an invalid descriptor (-1). - * - * \param[in] rPath watched file path - * \param[in] uMask mask for events - * \param[in] fEnabled events enabled yes/no - */ - InotifyWatch(const std::string& rPath, int32_t uMask, bool fEnabled = true) - : m_path(rPath), - m_uMask(uMask), - m_wd((int32_t) -1), - m_fEnabled(fEnabled) - { - IN_LOCK_INIT - } - - /// Destructor. - ~InotifyWatch() - { - IN_LOCK_DONE - } - - /// Returns the watch descriptor. - /** - * \return watch descriptor; -1 for inactive watch - */ - inline int32_t GetDescriptor() const - { - return m_wd; - } - - /// Returns the watched file path. - /** - * \return file path - */ - inline const std::string& GetPath() const - { - return m_path; - } - - /// Returns the watch event mask. - /** - * \return event mask - */ - inline uint32_t GetMask() const - { - return (uint32_t) m_uMask; - } - - /// Sets the watch event mask. - /** - * If the watch is active (added to an instance of Inotify) - * this method may fail due to unsuccessful re-setting - * the watch in the kernel. - * - * \param[in] uMask event mask - * - * \throw InotifyException thrown if changing fails - */ - void SetMask(uint32_t uMask) throw (InotifyException); - - /// Returns the appropriate inotify class instance. - /** - * \return inotify instance - */ - inline Inotify* GetInotify() - { - return m_pInotify; - } - - /// Enables/disables the watch. - /** - * If the watch is active (added to an instance of Inotify) - * this method may fail due to unsuccessful re-setting - * the watch in the kernel. - * - * Re-setting the current state has no effect. - * - * \param[in] fEnabled set enabled yes/no - * - * \throw InotifyException thrown if enabling/disabling fails - */ - void SetEnabled(bool fEnabled) throw (InotifyException); - - /// Checks whether the watch is enabled. - /** - * \return true = enables, false = disabled - */ - inline bool IsEnabled() const - { - return m_fEnabled; - } - - /// Checks whether the watch is recursive. - /** - * A recursive watch monitors a directory itself and all - * its subdirectories. This watch is a logical object - * which may have many underlying kernel watches. - * - * \return currently always false (recursive watches not yet supported) - * \attention Recursive watches are currently NOT supported. - * They are planned for future versions. - */ - inline bool IsRecursive() const - { - return false; - } - + /// Constructor. + /** + * Creates an inotify watch. Because this watch is + * inactive it has an invalid descriptor (-1). + * + * \param[in] rPath watched file path + * \param[in] uMask mask for events + * \param[in] fEnabled events enabled yes/no + */ + InotifyWatch(const std::string& rPath, int32_t uMask, bool fEnabled = true) + : m_path(rPath), + m_uMask(uMask), + m_wd((int32_t) -1), + m_fEnabled(fEnabled) + { + IN_LOCK_INIT + } + + /// Destructor. + ~InotifyWatch() + { + IN_LOCK_DONE + } + + /// Returns the watch descriptor. + /** + * \return watch descriptor; -1 for inactive watch + */ + inline int32_t GetDescriptor() const + { + return m_wd; + } + + /// Returns the watched file path. + /** + * \return file path + */ + inline const std::string& GetPath() const + { + return m_path; + } + + /// Returns the watch event mask. + /** + * \return event mask + */ + inline uint32_t GetMask() const + { + return (uint32_t) m_uMask; + } + + /// Sets the watch event mask. + /** + * If the watch is active (added to an instance of Inotify) + * this method may fail due to unsuccessful re-setting + * the watch in the kernel. + * + * \param[in] uMask event mask + * + * \throw InotifyException thrown if changing fails + */ + void SetMask(uint32_t uMask) throw (InotifyException); + + /// Returns the appropriate inotify class instance. + /** + * \return inotify instance + */ + inline Inotify* GetInotify() + { + return m_pInotify; + } + + /// Enables/disables the watch. + /** + * If the watch is active (added to an instance of Inotify) + * this method may fail due to unsuccessful re-setting + * the watch in the kernel. + * + * Re-setting the current state has no effect. + * + * \param[in] fEnabled set enabled yes/no + * + * \throw InotifyException thrown if enabling/disabling fails + */ + void SetEnabled(bool fEnabled) throw (InotifyException); + + /// Checks whether the watch is enabled. + /** + * \return true = enables, false = disabled + */ + inline bool IsEnabled() const + { + return m_fEnabled; + } + + /// Checks whether the watch is recursive. + /** + * A recursive watch monitors a directory itself and all + * its subdirectories. This watch is a logical object + * which may have many underlying kernel watches. + * + * \return currently always false (recursive watches not yet supported) + * \attention Recursive watches are currently NOT supported. + * They are planned for future versions. + */ + inline bool IsRecursive() const + { + return false; + } + private: - friend class Inotify; - - std::string m_path; ///< watched file path - uint32_t m_uMask; ///< event mask - int32_t m_wd; ///< watch descriptor - Inotify* m_pInotify; ///< inotify object - bool m_fEnabled; ///< events enabled yes/no - - IN_LOCK_DECL - - /// Disables the watch (due to removing by the kernel). - /** - * This method must be called after receiving an event. - * It ensures the watch object is consistent with the kernel - * data. - */ - void __Disable(); + friend class Inotify; + + std::string m_path; ///< watched file path + uint32_t m_uMask; ///< event mask + int32_t m_wd; ///< watch descriptor + Inotify* m_pInotify; ///< inotify object + bool m_fEnabled; ///< events enabled yes/no + + IN_LOCK_DECL + + /// Disables the watch (due to removing by the kernel). + /** + * This method must be called after receiving an event. + * It ensures the watch object is consistent with the kernel + * data. + */ + void __Disable(); }; @@ -526,360 +529,360 @@ typedef std::map<std::string, InotifyWatch*> IN_WP_MAP; /** * It holds information about the inotify device descriptor * and manages the event queue. - * + * * If the INOTIFY_THREAD_SAFE is defined this class is thread-safe. */ class Inotify { public: - /// Constructor. - /** - * Creates and initializes an instance of inotify communication - * object (opens the inotify device). - * - * \throw InotifyException thrown if inotify isn't available - */ - Inotify() throw (InotifyException); - - /// Destructor. - /** - * Calls Close() due to clean-up. - */ - ~Inotify(); - - /// Removes all watches and closes the inotify device. - void Close(); - - /// Adds a new watch. - /** - * \param[in] pWatch inotify watch - * - * \throw InotifyException thrown if adding failed - */ - void Add(InotifyWatch* pWatch) throw (InotifyException); - - /// Adds a new watch. - /** - * \param[in] rWatch inotify watch - * - * \throw InotifyException thrown if adding failed - */ - inline void Add(InotifyWatch& rWatch) throw (InotifyException) - { - Add(&rWatch); - } - - /// Removes a watch. - /** - * If the given watch is not present it does nothing. - * - * \param[in] pWatch inotify watch - * - * \throw InotifyException thrown if removing failed - */ - void Remove(InotifyWatch* pWatch) throw (InotifyException); - - /// Removes a watch. - /** - * If the given watch is not present it does nothing. - * - * \param[in] rWatch inotify watch - * - * \throw InotifyException thrown if removing failed - */ - inline void Remove(InotifyWatch& rWatch) throw (InotifyException) - { - Remove(&rWatch); - } - - /// Removes all watches. - void RemoveAll(); - - /// Returns the count of watches. - /** - * This is the total count of all watches (regardless whether - * enabled or not). - * - * \return count of watches - * - * \sa GetEnabledCount() - */ - inline size_t GetWatchCount() const - { - IN_READ_BEGIN - size_t n = (size_t) m_paths.size(); - IN_READ_END - return n; - } - - /// Returns the count of enabled watches. - /** - * \return count of enabled watches - * - * \sa GetWatchCount() - */ - inline size_t GetEnabledCount() const - { - IN_READ_BEGIN - size_t n = (size_t) m_watches.size(); - IN_READ_END - return n; - } - - /// Waits for inotify events. - /** - * It waits until one or more events occur. When called - * in nonblocking mode it only retrieves occurred events - * to the internal queue and exits. - * - * \param[in] fNoIntr if true it re-calls the system call after a handled signal - * - * \throw InotifyException thrown if reading events failed - * - * \sa SetNonBlock() - */ - void WaitForEvents(bool fNoIntr = false) throw (InotifyException); - - /// Returns the count of received and queued events. - /** - * This number is related to the events in the queue inside - * this object, not to the events pending in the kernel. - * - * \return count of events - */ - inline size_t GetEventCount() - { - IN_READ_BEGIN - size_t n = (size_t) m_events.size(); - IN_READ_END - return n; - } - - /// Extracts a queued inotify event. - /** - * The extracted event is removed from the queue. - * If the pointer is NULL it does nothing. - * - * \param[in,out] pEvt event object - * - * \throw InotifyException thrown if the provided pointer is NULL - */ - bool GetEvent(InotifyEvent* pEvt) throw (InotifyException); - - /// Extracts a queued inotify event. - /** - * The extracted event is removed from the queue. - * - * \param[in,out] rEvt event object - * - * \throw InotifyException thrown only in very anomalous cases - */ - bool GetEvent(InotifyEvent& rEvt) throw (InotifyException) - { - return GetEvent(&rEvt); - } - - /// Extracts a queued inotify event (without removing). - /** - * The extracted event stays in the queue. - * If the pointer is NULL it does nothing. - * - * \param[in,out] pEvt event object - * - * \throw InotifyException thrown if the provided pointer is NULL - */ - bool PeekEvent(InotifyEvent* pEvt) throw (InotifyException); - - /// Extracts a queued inotify event (without removing). - /** - * The extracted event stays in the queue. - * - * \param[in,out] rEvt event object - * - * \throw InotifyException thrown only in very anomalous cases - */ - bool PeekEvent(InotifyEvent& rEvt) throw (InotifyException) - { - return PeekEvent(&rEvt); - } - - /// Searches for a watch by a watch descriptor. - /** - * It tries to find a watch by the given descriptor. - * - * \param[in] iDescriptor watch descriptor - * \return pointer to a watch; NULL if no such watch exists - */ - InotifyWatch* FindWatch(int iDescriptor); - - /// Searches for a watch by a filesystem path. - /** - * It tries to find a watch by the given filesystem path. - * - * \param[in] rPath filesystem path - * \return pointer to a watch; NULL if no such watch exists - * - * \attention The path must be exactly identical to the one - * used for the searched watch. Be careful about - * absolute/relative and case-insensitive paths. - */ - InotifyWatch* FindWatch(const std::string& rPath); - - /// Returns the file descriptor. - /** - * The descriptor can be used in standard low-level file - * functions (poll(), select(), fcntl() etc.). - * - * \return valid file descriptor or -1 for inactive object - * - * \sa SetNonBlock() - */ - inline int GetDescriptor() const - { - return m_fd; - } - - /// Enables/disables non-blocking mode. - /** - * Use this mode if you want to monitor the descriptor - * (acquired thru GetDescriptor()) in functions such as - * poll(), select() etc. - * - * Non-blocking mode is disabled by default. - * - * \param[in] fNonBlock enable/disable non-blocking mode - * - * \throw InotifyException thrown if setting mode failed - * - * \sa GetDescriptor(), SetCloseOnExec() - */ - void SetNonBlock(bool fNonBlock) throw (InotifyException); - - /// Enables/disables closing on exec. - /** - * Enable this if you want to close the descriptor when - * executing another program. Otherwise, the descriptor - * will be inherited. - * - * Closing on exec is disabled by default. - * - * \param[in] fClOnEx enable/disable closing on exec - * - * \throw InotifyException thrown if setting failed - * - * \sa GetDescriptor(), SetNonBlock() - */ - void SetCloseOnExec(bool fClOnEx) throw (InotifyException); - - /// Acquires a particular inotify capability/limit. - /** - * \param[in] cap capability/limit identifier - * \return capability/limit value - * \throw InotifyException thrown if the given value cannot be acquired - */ - static uint32_t GetCapability(InotifyCapability_t cap) throw (InotifyException); - - /// Modifies a particular inotify capability/limit. - /** - * \param[in] cap capability/limit identifier - * \param[in] val new capability/limit value - * \throw InotifyException thrown if the given value cannot be set - * \attention Using this function requires root privileges. - * Beware of setting extensive values - it may seriously - * affect system performance and/or stability. - */ - static void SetCapability(InotifyCapability_t cap, uint32_t val) throw (InotifyException); - - /// Returns the maximum number of events in the kernel queue. - /** - * \return maximum number of events in the kernel queue - * \throw InotifyException thrown if the given value cannot be acquired - */ - inline static uint32_t GetMaxEvents() throw (InotifyException) - { - return GetCapability(IN_MAX_EVENTS); - } - - /// Sets the maximum number of events in the kernel queue. - /** - * \param[in] val new value - * \throw InotifyException thrown if the given value cannot be set - * \attention Using this function requires root privileges. - * Beware of setting extensive values - the greater value - * is set here the more physical memory may be used for the inotify - * infrastructure. - */ - inline static void SetMaxEvents(uint32_t val) throw (InotifyException) - { - SetCapability(IN_MAX_EVENTS, val); - } - - /// Returns the maximum number of inotify instances per process. - /** - * It means the maximum number of open inotify file descriptors - * per running process. - * - * \return maximum number of inotify instances - * \throw InotifyException thrown if the given value cannot be acquired - */ - inline static uint32_t GetMaxInstances() throw (InotifyException) - { - return GetCapability(IN_MAX_INSTANCES); - } - - /// Sets the maximum number of inotify instances per process. - /** - * \param[in] val new value - * \throw InotifyException thrown if the given value cannot be set - * \attention Using this function requires root privileges. - * Beware of setting extensive values - the greater value - * is set here the more physical memory may be used for the inotify - * infrastructure. - */ - inline static void SetMaxInstances(uint32_t val) throw (InotifyException) - { - SetCapability(IN_MAX_INSTANCES, val); - } - - /// Returns the maximum number of inotify watches per instance. - /** - * It means the maximum number of inotify watches per inotify - * file descriptor. - * - * \return maximum number of inotify watches - * \throw InotifyException thrown if the given value cannot be acquired - */ - inline static uint32_t GetMaxWatches() throw (InotifyException) - { - return GetCapability(IN_MAX_WATCHES); - } - - /// Sets the maximum number of inotify watches per instance. - /** - * \param[in] val new value - * \throw InotifyException thrown if the given value cannot be set - * \attention Using this function requires root privileges. - * Beware of setting extensive values - the greater value - * is set here the more physical memory may be used for the inotify - * infrastructure. - */ - inline static void SetMaxWatches(uint32_t val) throw (InotifyException) - { - SetCapability(IN_MAX_WATCHES, val); - } + /// Constructor. + /** + * Creates and initializes an instance of inotify communication + * object (opens the inotify device). + * + * \throw InotifyException thrown if inotify isn't available + */ + Inotify() throw (InotifyException); + + /// Destructor. + /** + * Calls Close() due to clean-up. + */ + ~Inotify(); + + /// Removes all watches and closes the inotify device. + void Close(); + + /// Adds a new watch. + /** + * \param[in] pWatch inotify watch + * + * \throw InotifyException thrown if adding failed + */ + void Add(InotifyWatch* pWatch) throw (InotifyException); + + /// Adds a new watch. + /** + * \param[in] rWatch inotify watch + * + * \throw InotifyException thrown if adding failed + */ + inline void Add(InotifyWatch& rWatch) throw (InotifyException) + { + Add(&rWatch); + } + + /// Removes a watch. + /** + * If the given watch is not present it does nothing. + * + * \param[in] pWatch inotify watch + * + * \throw InotifyException thrown if removing failed + */ + void Remove(InotifyWatch* pWatch) throw (InotifyException); + + /// Removes a watch. + /** + * If the given watch is not present it does nothing. + * + * \param[in] rWatch inotify watch + * + * \throw InotifyException thrown if removing failed + */ + inline void Remove(InotifyWatch& rWatch) throw (InotifyException) + { + Remove(&rWatch); + } + + /// Removes all watches. + void RemoveAll(); + + /// Returns the count of watches. + /** + * This is the total count of all watches (regardless whether + * enabled or not). + * + * \return count of watches + * + * \sa GetEnabledCount() + */ + inline size_t GetWatchCount() const + { + IN_READ_BEGIN + size_t n = (size_t) m_paths.size(); + IN_READ_END + return n; + } + + /// Returns the count of enabled watches. + /** + * \return count of enabled watches + * + * \sa GetWatchCount() + */ + inline size_t GetEnabledCount() const + { + IN_READ_BEGIN + size_t n = (size_t) m_watches.size(); + IN_READ_END + return n; + } + + /// Waits for inotify events. + /** + * It waits until one or more events occur. When called + * in nonblocking mode it only retrieves occurred events + * to the internal queue and exits. + * + * \param[in] fNoIntr if true it re-calls the system call after a handled signal + * + * \throw InotifyException thrown if reading events failed + * + * \sa SetNonBlock() + */ + void WaitForEvents(bool fNoIntr = false) throw (InotifyException); + + /// Returns the count of received and queued events. + /** + * This number is related to the events in the queue inside + * this object, not to the events pending in the kernel. + * + * \return count of events + */ + inline size_t GetEventCount() + { + IN_READ_BEGIN + size_t n = (size_t) m_events.size(); + IN_READ_END + return n; + } + + /// Extracts a queued inotify event. + /** + * The extracted event is removed from the queue. + * If the pointer is NULL it does nothing. + * + * \param[in,out] pEvt event object + * + * \throw InotifyException thrown if the provided pointer is NULL + */ + bool GetEvent(InotifyEvent* pEvt) throw (InotifyException); + + /// Extracts a queued inotify event. + /** + * The extracted event is removed from the queue. + * + * \param[in,out] rEvt event object + * + * \throw InotifyException thrown only in very anomalous cases + */ + bool GetEvent(InotifyEvent& rEvt) throw (InotifyException) + { + return GetEvent(&rEvt); + } + + /// Extracts a queued inotify event (without removing). + /** + * The extracted event stays in the queue. + * If the pointer is NULL it does nothing. + * + * \param[in,out] pEvt event object + * + * \throw InotifyException thrown if the provided pointer is NULL + */ + bool PeekEvent(InotifyEvent* pEvt) throw (InotifyException); + + /// Extracts a queued inotify event (without removing). + /** + * The extracted event stays in the queue. + * + * \param[in,out] rEvt event object + * + * \throw InotifyException thrown only in very anomalous cases + */ + bool PeekEvent(InotifyEvent& rEvt) throw (InotifyException) + { + return PeekEvent(&rEvt); + } + + /// Searches for a watch by a watch descriptor. + /** + * It tries to find a watch by the given descriptor. + * + * \param[in] iDescriptor watch descriptor + * \return pointer to a watch; NULL if no such watch exists + */ + InotifyWatch* FindWatch(int iDescriptor); + + /// Searches for a watch by a filesystem path. + /** + * It tries to find a watch by the given filesystem path. + * + * \param[in] rPath filesystem path + * \return pointer to a watch; NULL if no such watch exists + * + * \attention The path must be exactly identical to the one + * used for the searched watch. Be careful about + * absolute/relative and case-insensitive paths. + */ + InotifyWatch* FindWatch(const std::string& rPath); + + /// Returns the file descriptor. + /** + * The descriptor can be used in standard low-level file + * functions (poll(), select(), fcntl() etc.). + * + * \return valid file descriptor or -1 for inactive object + * + * \sa SetNonBlock() + */ + inline int GetDescriptor() const + { + return m_fd; + } + + /// Enables/disables non-blocking mode. + /** + * Use this mode if you want to monitor the descriptor + * (acquired thru GetDescriptor()) in functions such as + * poll(), select() etc. + * + * Non-blocking mode is disabled by default. + * + * \param[in] fNonBlock enable/disable non-blocking mode + * + * \throw InotifyException thrown if setting mode failed + * + * \sa GetDescriptor(), SetCloseOnExec() + */ + void SetNonBlock(bool fNonBlock) throw (InotifyException); + + /// Enables/disables closing on exec. + /** + * Enable this if you want to close the descriptor when + * executing another program. Otherwise, the descriptor + * will be inherited. + * + * Closing on exec is disabled by default. + * + * \param[in] fClOnEx enable/disable closing on exec + * + * \throw InotifyException thrown if setting failed + * + * \sa GetDescriptor(), SetNonBlock() + */ + void SetCloseOnExec(bool fClOnEx) throw (InotifyException); + + /// Acquires a particular inotify capability/limit. + /** + * \param[in] cap capability/limit identifier + * \return capability/limit value + * \throw InotifyException thrown if the given value cannot be acquired + */ + static uint32_t GetCapability(InotifyCapability_t cap) throw (InotifyException); + + /// Modifies a particular inotify capability/limit. + /** + * \param[in] cap capability/limit identifier + * \param[in] val new capability/limit value + * \throw InotifyException thrown if the given value cannot be set + * \attention Using this function requires root privileges. + * Beware of setting extensive values - it may seriously + * affect system performance and/or stability. + */ + static void SetCapability(InotifyCapability_t cap, uint32_t val) throw (InotifyException); + + /// Returns the maximum number of events in the kernel queue. + /** + * \return maximum number of events in the kernel queue + * \throw InotifyException thrown if the given value cannot be acquired + */ + inline static uint32_t GetMaxEvents() throw (InotifyException) + { + return GetCapability(IN_MAX_EVENTS); + } + + /// Sets the maximum number of events in the kernel queue. + /** + * \param[in] val new value + * \throw InotifyException thrown if the given value cannot be set + * \attention Using this function requires root privileges. + * Beware of setting extensive values - the greater value + * is set here the more physical memory may be used for the inotify + * infrastructure. + */ + inline static void SetMaxEvents(uint32_t val) throw (InotifyException) + { + SetCapability(IN_MAX_EVENTS, val); + } + + /// Returns the maximum number of inotify instances per process. + /** + * It means the maximum number of open inotify file descriptors + * per running process. + * + * \return maximum number of inotify instances + * \throw InotifyException thrown if the given value cannot be acquired + */ + inline static uint32_t GetMaxInstances() throw (InotifyException) + { + return GetCapability(IN_MAX_INSTANCES); + } + + /// Sets the maximum number of inotify instances per process. + /** + * \param[in] val new value + * \throw InotifyException thrown if the given value cannot be set + * \attention Using this function requires root privileges. + * Beware of setting extensive values - the greater value + * is set here the more physical memory may be used for the inotify + * infrastructure. + */ + inline static void SetMaxInstances(uint32_t val) throw (InotifyException) + { + SetCapability(IN_MAX_INSTANCES, val); + } + + /// Returns the maximum number of inotify watches per instance. + /** + * It means the maximum number of inotify watches per inotify + * file descriptor. + * + * \return maximum number of inotify watches + * \throw InotifyException thrown if the given value cannot be acquired + */ + inline static uint32_t GetMaxWatches() throw (InotifyException) + { + return GetCapability(IN_MAX_WATCHES); + } + + /// Sets the maximum number of inotify watches per instance. + /** + * \param[in] val new value + * \throw InotifyException thrown if the given value cannot be set + * \attention Using this function requires root privileges. + * Beware of setting extensive values - the greater value + * is set here the more physical memory may be used for the inotify + * infrastructure. + */ + inline static void SetMaxWatches(uint32_t val) throw (InotifyException) + { + SetCapability(IN_MAX_WATCHES, val); + } + +private: + int m_fd; ///< file descriptor + IN_WATCH_MAP m_watches; ///< watches (by descriptors) + IN_WP_MAP m_paths; ///< watches (by paths) + unsigned char m_buf[INOTIFY_BUFLEN]; ///< buffer for events + std::deque<InotifyEvent> m_events; ///< event queue + + IN_LOCK_DECL + + friend class InotifyWatch; -private: - int m_fd; ///< file descriptor - IN_WATCH_MAP m_watches; ///< watches (by descriptors) - IN_WP_MAP m_paths; ///< watches (by paths) - unsigned char m_buf[INOTIFY_BUFLEN]; ///< buffer for events - std::deque<InotifyEvent> m_events; ///< event queue - - IN_LOCK_DECL - - friend class InotifyWatch; - - static std::string GetCapabilityPath(InotifyCapability_t cap) throw (InotifyException); + static std::string GetCapabilityPath(InotifyCapability_t cap) throw (InotifyException); }; diff --git a/shared/localization.cpp b/shared/localization.cpp index 678767b9..a412df1e 100644 --- a/shared/localization.cpp +++ b/shared/localization.cpp @@ -13,6 +13,12 @@ #include <map> #include <wx/ffile.h> +#if wxCHECK_VERSION(2, 9, 1) +#include <boost/cstdint.hpp> +#include <wx/translation.h> +#include <cstdlib> +#endif + using ffs3::CustomLocale; using ffs3::LocalizationInfo; @@ -132,13 +138,6 @@ LocalizationInfo::LocalizationInfo() newEntry.languageFlag = wxT("holland.png"); locMapping.push_back(newEntry); - newEntry.languageID = wxLANGUAGE_RUSSIAN; - newEntry.languageName = wxT("PуÑÑкий"); - newEntry.languageFile = wxT("russian.lng"); - newEntry.translatorName = wxT("Fayzullin T.N. aka Svobodniy"); - newEntry.languageFlag = wxT("russia.png"); - locMapping.push_back(newEntry); - newEntry.languageID = wxLANGUAGE_POLISH; newEntry.languageName = wxT("Polski"); newEntry.languageFile = wxT("polish.lng"); @@ -160,6 +159,13 @@ LocalizationInfo::LocalizationInfo() newEntry.languageFlag = wxT("brazil.png"); locMapping.push_back(newEntry); + newEntry.languageID = wxLANGUAGE_RUSSIAN; + newEntry.languageName = wxT("PуÑÑкий"); + newEntry.languageFile = wxT("russian.lng"); + newEntry.translatorName = wxT("Fayzullin T.N. aka Svobodniy"); + newEntry.languageFlag = wxT("russia.png"); + locMapping.push_back(newEntry); + newEntry.languageID = wxLANGUAGE_ROMANIAN; newEntry.languageName = wxT("Română"); newEntry.languageFile = wxT("romanian.lng"); @@ -195,19 +201,19 @@ LocalizationInfo::LocalizationInfo() newEntry.languageFlag = wxT("turkey.png"); locMapping.push_back(newEntry); -// newEntry.languageID = wxLANGUAGE_HEBREW; -// newEntry.languageName = wxT("עִבְרִית"); -// newEntry.languageFile = wxT("hebrew.lng"); -// newEntry.translatorName = wxT("Moshe Olshevsky"); -// newEntry.languageFlag = wxT("isreal.png"); -// locMapping.push_back(newEntry); + // newEntry.languageID = wxLANGUAGE_HEBREW; + // newEntry.languageName = wxT("עִבְרִית"); + // newEntry.languageFile = wxT("hebrew.lng"); + // newEntry.translatorName = wxT("Moshe Olshevsky"); + // newEntry.languageFlag = wxT("isreal.png"); + // locMapping.push_back(newEntry); -// newEntry.languageID = wxLANGUAGE_ARABIC; -// newEntry.languageName = wxT("العربية"); -// newEntry.languageFile = wxT("arabic.lng"); -// newEntry.translatorName = wxT("Yousef Shamshoum"); -// newEntry.languageFlag = wxT("arabic-language.png"); -// locMapping.push_back(newEntry); + // newEntry.languageID = wxLANGUAGE_ARABIC; + // newEntry.languageName = wxT("العربية"); + // newEntry.languageFile = wxT("arabic.lng"); + // newEntry.translatorName = wxT("Yousef Shamshoum"); + // newEntry.languageFlag = wxT("arabic-language.png"); + // locMapping.push_back(newEntry); newEntry.languageID = wxLANGUAGE_JAPANESE; newEntry.languageName = wxT("日本語"); @@ -230,163 +236,140 @@ LocalizationInfo::LocalizationInfo() newEntry.languageFlag = wxT("china.png"); locMapping.push_back(newEntry); + newEntry.languageID = wxLANGUAGE_KOREAN; + newEntry.languageName = wxT("í•œêµì–´"); + newEntry.languageFile = wxT("korean.lng"); + newEntry.translatorName = wxT("Simon Park"); + newEntry.languageFlag = wxT("south_korea.png"); + locMapping.push_back(newEntry); + //std::sort(locMapping.begin(), locMapping.end(), CompareByName()); } -int mapLanguageDialect(const int language) +namespace +{ +int mapLanguageDialect(int language) { switch (language) //map language dialects { - //variants of wxLANGUAGE_GERMAN - case wxLANGUAGE_GERMAN_AUSTRIAN: - case wxLANGUAGE_GERMAN_BELGIUM: - case wxLANGUAGE_GERMAN_LIECHTENSTEIN: - case wxLANGUAGE_GERMAN_LUXEMBOURG: - case wxLANGUAGE_GERMAN_SWISS: - return wxLANGUAGE_GERMAN; - - //variants of wxLANGUAGE_FRENCH - case wxLANGUAGE_FRENCH_BELGIAN: - case wxLANGUAGE_FRENCH_CANADIAN: - case wxLANGUAGE_FRENCH_LUXEMBOURG: - case wxLANGUAGE_FRENCH_MONACO: - case wxLANGUAGE_FRENCH_SWISS: - return wxLANGUAGE_FRENCH; - - //variants of wxLANGUAGE_DUTCH - case wxLANGUAGE_DUTCH_BELGIAN: - return wxLANGUAGE_DUTCH; - - //variants of wxLANGUAGE_ITALIAN - case wxLANGUAGE_ITALIAN_SWISS: - return wxLANGUAGE_ITALIAN; - - //variants of wxLANGUAGE_CHINESE_SIMPLIFIED - case wxLANGUAGE_CHINESE: - case wxLANGUAGE_CHINESE_SINGAPORE: - return wxLANGUAGE_CHINESE_SIMPLIFIED; - - //variants of wxLANGUAGE_CHINESE_TRADITIONAL - case wxLANGUAGE_CHINESE_TAIWAN: - case wxLANGUAGE_CHINESE_HONGKONG: - case wxLANGUAGE_CHINESE_MACAU: - return wxLANGUAGE_CHINESE_TRADITIONAL; - - //variants of wxLANGUAGE_RUSSIAN - case wxLANGUAGE_RUSSIAN_UKRAINE: - return wxLANGUAGE_RUSSIAN; - - //variants of wxLANGUAGE_SPANISH - case wxLANGUAGE_SPANISH_ARGENTINA: - case wxLANGUAGE_SPANISH_BOLIVIA: - case wxLANGUAGE_SPANISH_CHILE: - case wxLANGUAGE_SPANISH_COLOMBIA: - case wxLANGUAGE_SPANISH_COSTA_RICA: - case wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC: - case wxLANGUAGE_SPANISH_ECUADOR: - case wxLANGUAGE_SPANISH_EL_SALVADOR: - case wxLANGUAGE_SPANISH_GUATEMALA: - case wxLANGUAGE_SPANISH_HONDURAS: - case wxLANGUAGE_SPANISH_MEXICAN: - case wxLANGUAGE_SPANISH_MODERN: - case wxLANGUAGE_SPANISH_NICARAGUA: - case wxLANGUAGE_SPANISH_PANAMA: - case wxLANGUAGE_SPANISH_PARAGUAY: - case wxLANGUAGE_SPANISH_PERU: - case wxLANGUAGE_SPANISH_PUERTO_RICO: - case wxLANGUAGE_SPANISH_URUGUAY: - case wxLANGUAGE_SPANISH_US: - case wxLANGUAGE_SPANISH_VENEZUELA: - return wxLANGUAGE_SPANISH; - - //variants of wxLANGUAGE_SWEDISH - case wxLANGUAGE_SWEDISH_FINLAND: - return wxLANGUAGE_SWEDISH; - - //case wxLANGUAGE_CZECH: - //case wxLANGUAGE_FINNISH: - //case wxLANGUAGE_GREEK: - //case wxLANGUAGE_JAPANESE: - //case wxLANGUAGE_POLISH: - //case wxLANGUAGE_SLOVENIAN: - //case wxLANGUAGE_HUNGARIAN: - //case wxLANGUAGE_PORTUGUESE: - //case wxLANGUAGE_PORTUGUESE_BRAZILIAN: - - //variants of wxLANGUAGE_ARABIC (also needed to detect RTL languages) - case wxLANGUAGE_ARABIC_ALGERIA: - case wxLANGUAGE_ARABIC_BAHRAIN: - case wxLANGUAGE_ARABIC_EGYPT: - case wxLANGUAGE_ARABIC_IRAQ: - case wxLANGUAGE_ARABIC_JORDAN: - case wxLANGUAGE_ARABIC_KUWAIT: - case wxLANGUAGE_ARABIC_LEBANON: - case wxLANGUAGE_ARABIC_LIBYA: - case wxLANGUAGE_ARABIC_MOROCCO: - case wxLANGUAGE_ARABIC_OMAN: - case wxLANGUAGE_ARABIC_QATAR: - case wxLANGUAGE_ARABIC_SAUDI_ARABIA: - case wxLANGUAGE_ARABIC_SUDAN: - case wxLANGUAGE_ARABIC_SYRIA: - case wxLANGUAGE_ARABIC_TUNISIA: - case wxLANGUAGE_ARABIC_UAE: - case wxLANGUAGE_ARABIC_YEMEN: - return wxLANGUAGE_ARABIC; - - //variants of wxLANGUAGE_ENGLISH_UK - case wxLANGUAGE_ENGLISH_AUSTRALIA: - case wxLANGUAGE_ENGLISH_NEW_ZEALAND: - case wxLANGUAGE_ENGLISH_TRINIDAD: - case wxLANGUAGE_ENGLISH_CARIBBEAN: - case wxLANGUAGE_ENGLISH_JAMAICA: - case wxLANGUAGE_ENGLISH_BELIZE: - case wxLANGUAGE_ENGLISH_EIRE: - case wxLANGUAGE_ENGLISH_SOUTH_AFRICA: - case wxLANGUAGE_ENGLISH_ZIMBABWE: - case wxLANGUAGE_ENGLISH_BOTSWANA: - case wxLANGUAGE_ENGLISH_DENMARK: - return wxLANGUAGE_ENGLISH_UK; - - default: - return language; + //variants of wxLANGUAGE_GERMAN + case wxLANGUAGE_GERMAN_AUSTRIAN: + case wxLANGUAGE_GERMAN_BELGIUM: + case wxLANGUAGE_GERMAN_LIECHTENSTEIN: + case wxLANGUAGE_GERMAN_LUXEMBOURG: + case wxLANGUAGE_GERMAN_SWISS: + return wxLANGUAGE_GERMAN; + + //variants of wxLANGUAGE_FRENCH + case wxLANGUAGE_FRENCH_BELGIAN: + case wxLANGUAGE_FRENCH_CANADIAN: + case wxLANGUAGE_FRENCH_LUXEMBOURG: + case wxLANGUAGE_FRENCH_MONACO: + case wxLANGUAGE_FRENCH_SWISS: + return wxLANGUAGE_FRENCH; + + //variants of wxLANGUAGE_DUTCH + case wxLANGUAGE_DUTCH_BELGIAN: + return wxLANGUAGE_DUTCH; + + //variants of wxLANGUAGE_ITALIAN + case wxLANGUAGE_ITALIAN_SWISS: + return wxLANGUAGE_ITALIAN; + + //variants of wxLANGUAGE_CHINESE_SIMPLIFIED + case wxLANGUAGE_CHINESE: + case wxLANGUAGE_CHINESE_SINGAPORE: + return wxLANGUAGE_CHINESE_SIMPLIFIED; + + //variants of wxLANGUAGE_CHINESE_TRADITIONAL + case wxLANGUAGE_CHINESE_TAIWAN: + case wxLANGUAGE_CHINESE_HONGKONG: + case wxLANGUAGE_CHINESE_MACAU: + return wxLANGUAGE_CHINESE_TRADITIONAL; + + //variants of wxLANGUAGE_RUSSIAN + case wxLANGUAGE_RUSSIAN_UKRAINE: + return wxLANGUAGE_RUSSIAN; + + //variants of wxLANGUAGE_SPANISH + case wxLANGUAGE_SPANISH_ARGENTINA: + case wxLANGUAGE_SPANISH_BOLIVIA: + case wxLANGUAGE_SPANISH_CHILE: + case wxLANGUAGE_SPANISH_COLOMBIA: + case wxLANGUAGE_SPANISH_COSTA_RICA: + case wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC: + case wxLANGUAGE_SPANISH_ECUADOR: + case wxLANGUAGE_SPANISH_EL_SALVADOR: + case wxLANGUAGE_SPANISH_GUATEMALA: + case wxLANGUAGE_SPANISH_HONDURAS: + case wxLANGUAGE_SPANISH_MEXICAN: + case wxLANGUAGE_SPANISH_MODERN: + case wxLANGUAGE_SPANISH_NICARAGUA: + case wxLANGUAGE_SPANISH_PANAMA: + case wxLANGUAGE_SPANISH_PARAGUAY: + case wxLANGUAGE_SPANISH_PERU: + case wxLANGUAGE_SPANISH_PUERTO_RICO: + case wxLANGUAGE_SPANISH_URUGUAY: + case wxLANGUAGE_SPANISH_US: + case wxLANGUAGE_SPANISH_VENEZUELA: + return wxLANGUAGE_SPANISH; + + //variants of wxLANGUAGE_SWEDISH + case wxLANGUAGE_SWEDISH_FINLAND: + return wxLANGUAGE_SWEDISH; + + //case wxLANGUAGE_CZECH: + //case wxLANGUAGE_FINNISH: + //case wxLANGUAGE_GREEK: + //case wxLANGUAGE_JAPANESE: + //case wxLANGUAGE_POLISH: + //case wxLANGUAGE_SLOVENIAN: + //case wxLANGUAGE_HUNGARIAN: + //case wxLANGUAGE_PORTUGUESE: + //case wxLANGUAGE_PORTUGUESE_BRAZILIAN: + //case wxLANGUAGE_KOREAN: + + //variants of wxLANGUAGE_ARABIC (also needed to detect RTL languages) + case wxLANGUAGE_ARABIC_ALGERIA: + case wxLANGUAGE_ARABIC_BAHRAIN: + case wxLANGUAGE_ARABIC_EGYPT: + case wxLANGUAGE_ARABIC_IRAQ: + case wxLANGUAGE_ARABIC_JORDAN: + case wxLANGUAGE_ARABIC_KUWAIT: + case wxLANGUAGE_ARABIC_LEBANON: + case wxLANGUAGE_ARABIC_LIBYA: + case wxLANGUAGE_ARABIC_MOROCCO: + case wxLANGUAGE_ARABIC_OMAN: + case wxLANGUAGE_ARABIC_QATAR: + case wxLANGUAGE_ARABIC_SAUDI_ARABIA: + case wxLANGUAGE_ARABIC_SUDAN: + case wxLANGUAGE_ARABIC_SYRIA: + case wxLANGUAGE_ARABIC_TUNISIA: + case wxLANGUAGE_ARABIC_UAE: + case wxLANGUAGE_ARABIC_YEMEN: + return wxLANGUAGE_ARABIC; + + //variants of wxLANGUAGE_ENGLISH_UK + case wxLANGUAGE_ENGLISH_AUSTRALIA: + case wxLANGUAGE_ENGLISH_NEW_ZEALAND: + case wxLANGUAGE_ENGLISH_TRINIDAD: + case wxLANGUAGE_ENGLISH_CARIBBEAN: + case wxLANGUAGE_ENGLISH_JAMAICA: + case wxLANGUAGE_ENGLISH_BELIZE: + case wxLANGUAGE_ENGLISH_EIRE: + case wxLANGUAGE_ENGLISH_SOUTH_AFRICA: + case wxLANGUAGE_ENGLISH_ZIMBABWE: + case wxLANGUAGE_ENGLISH_BOTSWANA: + case wxLANGUAGE_ENGLISH_DENMARK: + return wxLANGUAGE_ENGLISH_UK; + + default: + return language; } } -typedef wxString TextOriginal; -typedef wxString TextTranslation; - -class Translation : public std::map<TextOriginal, TextTranslation> {}; - - -CustomLocale& CustomLocale::getInstance() -{ - static CustomLocale instance; - return instance; -} - - -CustomLocale::CustomLocale() : - translationDB(new Translation), - currentLanguage(wxLANGUAGE_ENGLISH) -{ - Init(wxLANGUAGE_DEFAULT); //setting a different language needn't be supported on all systems! - - //actually these two parameters are language dependent, but we take system setting to handle all kinds of language derivations - const lconv* localInfo = localeconv(); - THOUSANDS_SEPARATOR = wxString::FromUTF8(localInfo->thousands_sep); - DECIMAL_POINT = wxString::FromUTF8(localInfo->decimal_point); - - // why not working? - // THOUSANDS_SEPARATOR = std::use_facet<std::numpunct<wchar_t> >(std::locale("")).thousands_sep(); - // DECIMAL_POINT = std::use_facet<std::numpunct<wchar_t> >(std::locale("")).decimal_point(); -} - - -CustomLocale::~CustomLocale() {} //non-inline destructor for std::auto_ptr to work with forward declaration - - inline void exchangeEscapeChars(wxString& data) { @@ -407,20 +390,20 @@ void exchangeEscapeChars(wxString& data) switch (value) { - case wxChar('\\'): - output += wxChar('\\'); - break; - case wxChar('n'): - output += wxChar('\n'); - break; - case wxChar('t'): - output += wxChar('\t'); - break; - case wxChar('\"'): - output += wxChar('\"'); - break; - default: - output += value; + case wxChar('\\'): + output += wxChar('\\'); + break; + case wxChar('n'): + output += wxChar('\n'); + break; + case wxChar('t'): + output += wxChar('\t'); + break; + case wxChar('\"'): + output += wxChar('\"'); + break; + default: + output += value; } } else @@ -432,13 +415,13 @@ void exchangeEscapeChars(wxString& data) } +//workaround to get a FILE* from a unicode filename in a portable way class UnicodeFileReader { public: UnicodeFileReader(const wxString& filename) : inputFile(NULL) { - //workaround to get a FILE* from a unicode filename wxFFile dummyFile(filename, wxT("rb")); if (dummyFile.IsOpened()) { @@ -489,9 +472,182 @@ private: }; +typedef std::map<wxString, wxString> TranslationMap; //map original text |-> translation + +void loadTranslation(const wxString& filename, TranslationMap& trans) //empty translation on error +{ + trans.clear(); + + UnicodeFileReader langFile(ffs3::getResourceDir() + wxT("Languages") + ffs3::zToWx(common::FILE_NAME_SEPARATOR) + filename); + if (langFile.isOkay()) + { + //save encoding info: required by mo file generator + trans.insert(std::make_pair(wxEmptyString, wxT("Content-Type: text/plain; charset=UTF-8\n"))); + + int rowNumber = 0; + wxString original; + wxString tmpString; + while (langFile.getNextLine(tmpString)) + { + exchangeEscapeChars(tmpString); + + if (rowNumber++ % 2 == 0) + original = tmpString; + else + { + const wxString& translation = tmpString; + + if (!original.empty() && !translation.empty()) + trans.insert(std::make_pair(original, translation)); + } + } + } +} +} + + +#if wxCHECK_VERSION(2, 9, 1) +//this whole abomination is required to support language formats other than "mo" in wxWidgets v2.9 +class FFSTranslationLoader : public wxTranslationsLoader +{ +public: + static const wxString domainName() + { + return wxT("FFS"); + } + + FFSTranslationLoader(const TranslationMap& trans, wxLanguage langId) : langId_(langId) + { + //generate mo file: http://www.gnu.org/software/hello/manual/gettext/MO-Files.html + + std::string binaryStream; + + const size_t offsetTableOrig = sizeof(wxMsgCatalogHeader); + const size_t offsetTableTrans = offsetTableOrig + trans.size() * sizeof(wxMsgTableEntry); + const size_t offsetTableString = offsetTableTrans + trans.size() * sizeof(wxMsgTableEntry); + + wxMsgCatalogHeader header = + { + 0x950412de, //magic number (save in this machine's byte order) + 0, //revision + trans.size(), //numStrings + offsetTableOrig, //ofsOrigTable + offsetTableTrans, //ofsTransTable + 0, //nHashSize + 0, //ofsHashTable + }; + writeCobject(binaryStream, header); + + std::string tableOrig; + std::string tableTrans; + std::string stringsList; + for (TranslationMap::const_iterator i = trans.begin(); i != trans.end(); ++i) + { + +#ifndef _MSC_VER +#warning redundant UTF8 conversion!!! +#endif + std::string origString = i->first.ToUTF8(); + const wxMsgTableEntry origEntry = {origString.length(), offsetTableString + stringsList.size()}; + writeCobject(tableOrig, origEntry); + stringsList.append(origString.c_str(), origString.length() + 1); //include NULL-termination + +#ifndef _MSC_VER +#warning redundant UTF8 conversion!!! +#endif + std::string transString = i->second.ToUTF8(); + const wxMsgTableEntry transEntry = {transString.length(), offsetTableString + stringsList.size()}; + writeCobject(tableTrans, transEntry); + stringsList.append(transString.c_str(), transString.length() + 1); //include NULL-termination + } + binaryStream += tableOrig; + binaryStream += tableTrans; + binaryStream += stringsList; + + buffer = wxScopedCharBuffer::CreateOwned(static_cast<char*>(::malloc(binaryStream.size())), binaryStream.size()); //takes buffer ownership, calls ::free() + std::copy(binaryStream.begin(), binaryStream.end(), buffer.data()); + } + + virtual wxMsgCatalog* LoadCatalog(const wxString& domain, const wxString& lang) + { + if (domain != domainName() || lang != wxLocale::GetLanguageCanonicalName(langId_)) //avoid superfluous calls by wxWidgets framework + return NULL; + + return wxMsgCatalog::CreateFromData(buffer, domain); + } + + virtual wxArrayString GetAvailableTranslations(const wxString& domain) const + { + wxArrayString output; + if (domain == domainName()) + output.Add(wxLocale::GetLanguageCanonicalName(langId_)); + return output; + } + +private: + struct wxMsgTableEntry + { + boost::uint32_t nLen, // length of the string + ofsString; // pointer to the string + }; + + // header of a .mo file + struct wxMsgCatalogHeader + { + boost::uint32_t magic, // offset +00: magic id + revision, // +04: revision + numStrings, // +08: number of strings in the file + ofsOrigTable, // +0C: start of original string table + ofsTransTable, // +10: start of translated string table + nHashSize, // +14: hash table size + ofsHashTable; // +18: offset of hash table start + }; + + template <class T> + void writeCobject(std::string& str, T obj) + { + str.append(reinterpret_cast<const char*>(&obj), sizeof(obj)); + } + + wxScopedCharBuffer buffer; //raw data in mo file format + const wxLanguage langId_; +}; +#endif + + +CustomLocale& CustomLocale::getInstance() +{ + static CustomLocale instance; + return instance; +} + + +class Translation : public TranslationMap {}; + + +CustomLocale::CustomLocale() : + translationDB(new Translation), + currentLanguage(wxLANGUAGE_ENGLISH) +{ + Init(wxLANGUAGE_DEFAULT); //setting a different language needn't be supported on all systems! + + //actually these two parameters are language dependent, but we take system setting to handle all kinds of language derivations + const lconv* localInfo = localeconv(); + THOUSANDS_SEPARATOR = wxString::FromUTF8(localInfo->thousands_sep); + DECIMAL_POINT = wxString::FromUTF8(localInfo->decimal_point); + + // why not working? + // THOUSANDS_SEPARATOR = std::use_facet<std::numpunct<wchar_t> >(std::locale("")).thousands_sep(); + // DECIMAL_POINT = std::use_facet<std::numpunct<wchar_t> >(std::locale("")).decimal_point(); +} + + +CustomLocale::~CustomLocale() {} //non-inline destructor for std::auto_ptr to work with forward declaration + + void CustomLocale::setLanguage(int language) { - currentLanguage = language; + currentLanguage = static_cast<wxLanguage>(language); //default: english wxString languageFile; @@ -509,29 +665,8 @@ void CustomLocale::setLanguage(int language) translationDB->clear(); if (!languageFile.empty()) { - UnicodeFileReader langFile(ffs3::getResourceDir() + wxT("Languages") + - zToWx(common::FILE_NAME_SEPARATOR) + languageFile); - if (langFile.isOkay()) - { - int rowNumber = 0; - wxString original; - wxString tmpString; - while (langFile.getNextLine(tmpString)) - { - exchangeEscapeChars(tmpString); - - if (rowNumber++ % 2 == 0) - original = tmpString; - else - { - const wxString& translation = tmpString; - - if (!translation.empty()) - translationDB->insert(std::make_pair(original, translation)); - } - } - } - else + loadTranslation(languageFile, *translationDB); //empty translation on error + if (translationDB->empty()) { wxMessageBox(wxString(_("Error reading file:")) + wxT(" \"") + languageFile + wxT("\""), _("Error"), wxOK | wxICON_ERROR); currentLanguage = wxLANGUAGE_ENGLISH; //reset to english language to show this error just once @@ -539,6 +674,16 @@ void CustomLocale::setLanguage(int language) } else ; //if languageFile is empty texts will be english per default + + + +#if wxCHECK_VERSION(2, 9, 1) + wxTranslations::Set(new wxTranslations); + wxTranslations::Get()->SetLoader(new FFSTranslationLoader(*translationDB, currentLanguage)); //ownership passed + wxTranslations::Get()->SetLanguage(currentLanguage); + wxTranslations::Get()->AddCatalog(FFSTranslationLoader::domainName(), wxLANGUAGE_ENGLISH_US); + //... a little over design going on?!? +#endif } @@ -553,23 +698,3 @@ const wxChar* CustomLocale::GetString(const wxChar* szOrigString, const wxChar* return szOrigString; } - - -/* - -wxWidgets 2.9.1: - -class CustomTranslation : public wxTranslations -{ - virtual const wxString& GetString(const wxString& origString, - const wxString& domain = wxEmptyString) const - { - static const wxString blah = "map origString to translation by some arbitrary means"; - return blah; - } - - wxTranslations::Set(new CustomTranslation); - -}; - -*/ diff --git a/shared/localization.h b/shared/localization.h index 40d71423..3ce7bf24 100644 --- a/shared/localization.h +++ b/shared/localization.h @@ -23,7 +23,7 @@ wxString getDecimalPoint(); struct LocInfoLine { - int languageID; + wxLanguage languageID; wxString languageName; wxString languageFile; wxString translatorName; @@ -63,7 +63,7 @@ private: ~CustomLocale(); //non-inline destructor for std::auto_ptr to work with forward declaration -> superfluous in this case: singleton pattern! std::auto_ptr<Translation> translationDB; //careful with forward-declarations and auto_ptr! save in this case, 'cause full class info available - int currentLanguage; + wxLanguage currentLanguage; }; } diff --git a/shared/loki/AbstractFactory.h b/shared/loki/AbstractFactory.h index 8ff518dc..9a30583b 100644 --- a/shared/loki/AbstractFactory.h +++ b/shared/loki/AbstractFactory.h @@ -2,14 +2,14 @@ // The Loki Library // Copyright (c) 2001 by Andrei Alexandrescu // This code accompanies the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author or Addison-Wesley Longman make no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author or Addison-Wesley Longman make no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_ABSTRACTFACTORY_INC_ @@ -31,7 +31,7 @@ * \ingroup FactoriesGroup * \brief Implements an abstract object factory. */ - + /** * \class AbstractFactory * \ingroup AbstractFactoryGroup @@ -46,137 +46,137 @@ namespace Loki // The building block of an Abstract Factory //////////////////////////////////////////////////////////////////////////////// - template <class T> - class AbstractFactoryUnit - { - public: - virtual T* DoCreate(Type2Type<T>) = 0; - virtual ~AbstractFactoryUnit() {} - }; +template <class T> +class AbstractFactoryUnit +{ +public: + virtual T* DoCreate(Type2Type<T>) = 0; + virtual ~AbstractFactoryUnit() {} +}; //////////////////////////////////////////////////////////////////////////////// // class template AbstractFactory // Defines an Abstract Factory interface starting from a typelist //////////////////////////////////////////////////////////////////////////////// - template - < - class TList, - template <class> class Unit = AbstractFactoryUnit - > - class AbstractFactory : public GenScatterHierarchy<TList, Unit> +template +< +class TList, + template <class> class Unit = AbstractFactoryUnit + > +class AbstractFactory : public GenScatterHierarchy<TList, Unit> +{ +public: + typedef TList ProductList; + + template <class T> T* Create() { - public: - typedef TList ProductList; - - template <class T> T* Create() - { - Unit<T>& unit = *this; - return unit.DoCreate(Type2Type<T>()); - } - }; - + Unit<T>& unit = *this; + return unit.DoCreate(Type2Type<T>()); + } +}; + //////////////////////////////////////////////////////////////////////////////// // class template OpNewFactoryUnit // Creates an object by invoking the new operator //////////////////////////////////////////////////////////////////////////////// - template <class ConcreteProduct, class Base> - class OpNewFactoryUnit : public Base +template <class ConcreteProduct, class Base> +class OpNewFactoryUnit : public Base +{ + typedef typename Base::ProductList BaseProductList; + +protected: + typedef typename BaseProductList::Tail ProductList; + +public: + typedef typename BaseProductList::Head AbstractProduct; + ConcreteProduct* DoCreate(Type2Type<AbstractProduct>) { - typedef typename Base::ProductList BaseProductList; - - protected: - typedef typename BaseProductList::Tail ProductList; - - public: - typedef typename BaseProductList::Head AbstractProduct; - ConcreteProduct* DoCreate(Type2Type<AbstractProduct>) - { - return new ConcreteProduct; - } - }; + return new ConcreteProduct; + } +}; //////////////////////////////////////////////////////////////////////////////// // class template PrototypeFactoryUnit // Creates an object by cloning a prototype // There is a difference between the implementation herein and the one described -// in the book: GetPrototype and SetPrototype use the helper friend +// in the book: GetPrototype and SetPrototype use the helper friend // functions DoGetPrototype and DoSetPrototype. The friend functions avoid // name hiding issues. Plus, GetPrototype takes a reference to pointer // instead of returning the pointer by value. //////////////////////////////////////////////////////////////////////////////// - template <class ConcreteProduct, class Base> - class PrototypeFactoryUnit : public Base +template <class ConcreteProduct, class Base> +class PrototypeFactoryUnit : public Base +{ + typedef typename Base::ProductList BaseProductList; + +protected: + typedef typename BaseProductList::Tail ProductList; + +public: + typedef typename BaseProductList::Head AbstractProduct; + + PrototypeFactoryUnit(AbstractProduct* p = 0) + : pPrototype_(p) + {} + + template <class CP, class Base1> + friend void DoGetPrototype(const PrototypeFactoryUnit<CP, Base1>& me, + typename Base1::ProductList::Head*& pPrototype); + + template <class CP, class Base1> + friend void DoSetPrototype(PrototypeFactoryUnit<CP, Base1>& me, + typename Base1::ProductList::Head* pObj); + + template <class U> + void GetPrototype(U*& p) + { return DoGetPrototype(*this, p); } + + template <class U> + void SetPrototype(U* pObj) + { DoSetPrototype(*this, pObj); } + + AbstractProduct* DoCreate(Type2Type<AbstractProduct>) { - typedef typename Base::ProductList BaseProductList; - - protected: - typedef typename BaseProductList::Tail ProductList; - - public: - typedef typename BaseProductList::Head AbstractProduct; - - PrototypeFactoryUnit(AbstractProduct* p = 0) - : pPrototype_(p) - {} - - template <class CP, class Base1> - friend void DoGetPrototype(const PrototypeFactoryUnit<CP, Base1>& me, - typename Base1::ProductList::Head*& pPrototype); - - template <class CP, class Base1> - friend void DoSetPrototype(PrototypeFactoryUnit<CP, Base1>& me, - typename Base1::ProductList::Head* pObj); - - template <class U> - void GetPrototype(U*& p) - { return DoGetPrototype(*this, p); } - - template <class U> - void SetPrototype(U* pObj) - { DoSetPrototype(*this, pObj); } - - AbstractProduct* DoCreate(Type2Type<AbstractProduct>) - { - assert(pPrototype_); - return pPrototype_->Clone(); - } - - private: - AbstractProduct* pPrototype_; - }; - - template <class CP, class Base> - inline void DoGetPrototype(const PrototypeFactoryUnit<CP, Base>& me, - typename Base::ProductList::Head*& pPrototype) - { pPrototype = me.pPrototype_; } - - template <class CP, class Base> - inline void DoSetPrototype(PrototypeFactoryUnit<CP, Base>& me, - typename Base::ProductList::Head* pObj) - { me.pPrototype_ = pObj; } + assert(pPrototype_); + return pPrototype_->Clone(); + } + +private: + AbstractProduct* pPrototype_; +}; + +template <class CP, class Base> +inline void DoGetPrototype(const PrototypeFactoryUnit<CP, Base>& me, + typename Base::ProductList::Head*& pPrototype) +{ pPrototype = me.pPrototype_; } + +template <class CP, class Base> +inline void DoSetPrototype(PrototypeFactoryUnit<CP, Base>& me, + typename Base::ProductList::Head* pObj) +{ me.pPrototype_ = pObj; } //////////////////////////////////////////////////////////////////////////////// // class template ConcreteFactory // Implements an AbstractFactory interface //////////////////////////////////////////////////////////////////////////////// - template - < - class AbstractFact, - template <class, class> class Creator = OpNewFactoryUnit, - class TList = typename AbstractFact::ProductList - > - class ConcreteFactory - : public GenLinearHierarchy< - typename TL::Reverse<TList>::Result, Creator, AbstractFact> - { - public: - typedef typename AbstractFact::ProductList ProductList; - typedef TList ConcreteProductList; - }; +template +< +class AbstractFact, + template <class, class> class Creator = OpNewFactoryUnit, + class TList = typename AbstractFact::ProductList + > +class ConcreteFactory + : public GenLinearHierarchy< + typename TL::Reverse<TList>::Result, Creator, AbstractFact> +{ +public: + typedef typename AbstractFact::ProductList ProductList; + typedef TList ConcreteProductList; +}; } // namespace Loki diff --git a/shared/loki/Allocator.h b/shared/loki/Allocator.h index a79ee061..39b63912 100644 --- a/shared/loki/Allocator.h +++ b/shared/loki/Allocator.h @@ -2,12 +2,12 @@ // The Loki Library // Copyright (c) 2008 by Rich Sposato // -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author makes no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author makes no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// @@ -35,26 +35,26 @@ namespace Loki */ template < - typename Type, - typename AllocT = Loki::AllocatorSingleton<> -> +typename Type, + typename AllocT = Loki::AllocatorSingleton<> + > class LokiAllocator { public: typedef ::std::size_t size_type; typedef ::std::ptrdiff_t difference_type; - typedef Type * pointer; - typedef const Type * const_pointer; - typedef Type & reference; - typedef const Type & const_reference; + typedef Type* pointer; + typedef const Type* const_pointer; + typedef Type& reference; + typedef const Type& const_reference; typedef Type value_type; /// Default constructor does nothing. inline LokiAllocator( void ) throw() { } /// Copy constructor does nothing. - inline LokiAllocator( const LokiAllocator & ) throw() { } + inline LokiAllocator( const LokiAllocator& ) throw() { } /// Type converting allocator constructor does nothing. template < typename Type1 > @@ -84,10 +84,10 @@ public: @param hint Place where caller thinks allocation should occur. @return Pointer to block of memory. */ - pointer allocate( size_type count, const void * hint = 0 ) + pointer allocate( size_type count, const void* hint = 0 ) { (void)hint; // Ignore the hint. - void * p = AllocT::Instance().Allocate( count * sizeof( Type ), true ); + void* p = AllocT::Instance().Allocate( count * sizeof( Type ), true ); return reinterpret_cast< pointer >( p ); } @@ -108,7 +108,7 @@ public: } /// Construct an element at the pointer. - void construct( pointer p, const Type & value ) + void construct( pointer p, const Type& value ) { // A call to global placement new forces a call to copy constructor. ::new( p ) Type( value ); diff --git a/shared/loki/AssocVector.h b/shared/loki/AssocVector.h index 905e0963..ad43d152 100644 --- a/shared/loki/AssocVector.h +++ b/shared/loki/AssocVector.h @@ -2,14 +2,14 @@ // The Loki Library // Copyright (c) 2001 by Andrei Alexandrescu // This code accompanies the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author or Addison-Wesley Longman make no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author or Addison-Wesley Longman make no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_ASSOCVECTOR_INC_ @@ -30,38 +30,38 @@ namespace Loki // Used by AssocVector //////////////////////////////////////////////////////////////////////////////// - namespace Private - { - template <class Value, class C> - class AssocVectorCompare : public C - { - typedef std::pair<typename C::first_argument_type, Value> - Data; - typedef typename C::first_argument_type first_argument_type; - - public: - AssocVectorCompare() - {} - - AssocVectorCompare(const C& src) : C(src) - {} - - bool operator()(const first_argument_type& lhs, - const first_argument_type& rhs) const - { return C::operator()(lhs, rhs); } - - bool operator()(const Data& lhs, const Data& rhs) const - { return operator()(lhs.first, rhs.first); } - - bool operator()(const Data& lhs, - const first_argument_type& rhs) const - { return operator()(lhs.first, rhs); } - - bool operator()(const first_argument_type& lhs, - const Data& rhs) const - { return operator()(lhs, rhs.first); } - }; - } +namespace Private +{ +template <class Value, class C> +class AssocVectorCompare : public C +{ + typedef std::pair<typename C::first_argument_type, Value> + Data; + typedef typename C::first_argument_type first_argument_type; + +public: + AssocVectorCompare() + {} + + AssocVectorCompare(const C& src) : C(src) + {} + + bool operator()(const first_argument_type& lhs, + const first_argument_type& rhs) const + { return C::operator()(lhs, rhs); } + + bool operator()(const Data& lhs, const Data& rhs) const + { return operator()(lhs.first, rhs.first); } + + bool operator()(const Data& lhs, + const first_argument_type& rhs) const + { return operator()(lhs.first, rhs); } + + bool operator()(const first_argument_type& lhs, + const Data& rhs) const + { return operator()(lhs, rhs.first); } +}; +} //////////////////////////////////////////////////////////////////////////////// // class template AssocVector @@ -75,283 +75,283 @@ namespace Loki //////////////////////////////////////////////////////////////////////////////// - template - < - class K, - class V, - class C = std::less<K>, - class A = std::allocator< std::pair<K, V> > - > - class AssocVector - : private std::vector< std::pair<K, V>, A > - , private Private::AssocVectorCompare<V, C> +template +< +class K, + class V, + class C = std::less<K>, + class A = std::allocator< std::pair<K, V> > + > +class AssocVector + : private std::vector< std::pair<K, V>, A > + , private Private::AssocVectorCompare<V, C> +{ + typedef std::vector<std::pair<K, V>, A> Base; + typedef Private::AssocVectorCompare<V, C> MyCompare; + +public: + typedef K key_type; + typedef V mapped_type; + typedef typename Base::value_type value_type; + + typedef C key_compare; + typedef A allocator_type; + typedef typename A::reference reference; + typedef typename A::const_reference const_reference; + typedef typename Base::iterator iterator; + typedef typename Base::const_iterator const_iterator; + typedef typename Base::size_type size_type; + typedef typename Base::difference_type difference_type; + typedef typename A::pointer pointer; + typedef typename A::const_pointer const_pointer; + typedef typename Base::reverse_iterator reverse_iterator; + typedef typename Base::const_reverse_iterator const_reverse_iterator; + + class value_compare + : public std::binary_function<value_type, value_type, bool> + , private key_compare { - typedef std::vector<std::pair<K, V>, A> Base; - typedef Private::AssocVectorCompare<V, C> MyCompare; + friend class AssocVector; + + protected: + value_compare(key_compare pred) : key_compare(pred) + {} public: - typedef K key_type; - typedef V mapped_type; - typedef typename Base::value_type value_type; - - typedef C key_compare; - typedef A allocator_type; - typedef typename A::reference reference; - typedef typename A::const_reference const_reference; - typedef typename Base::iterator iterator; - typedef typename Base::const_iterator const_iterator; - typedef typename Base::size_type size_type; - typedef typename Base::difference_type difference_type; - typedef typename A::pointer pointer; - typedef typename A::const_pointer const_pointer; - typedef typename Base::reverse_iterator reverse_iterator; - typedef typename Base::const_reverse_iterator const_reverse_iterator; - - class value_compare - : public std::binary_function<value_type, value_type, bool> - , private key_compare - { - friend class AssocVector; - - protected: - value_compare(key_compare pred) : key_compare(pred) - {} - - public: - bool operator()(const value_type& lhs, const value_type& rhs) const - { return key_compare::operator()(lhs.first, rhs.first); } - }; - - // 23.3.1.1 construct/copy/destroy - - explicit AssocVector(const key_compare& comp = key_compare(), - const A& alloc = A()) + bool operator()(const value_type& lhs, const value_type& rhs) const + { return key_compare::operator()(lhs.first, rhs.first); } + }; + + // 23.3.1.1 construct/copy/destroy + + explicit AssocVector(const key_compare& comp = key_compare(), + const A& alloc = A()) : Base(alloc), MyCompare(comp) - {} - - template <class InputIterator> - AssocVector(InputIterator first, InputIterator last, - const key_compare& comp = key_compare(), - const A& alloc = A()) + {} + + template <class InputIterator> + AssocVector(InputIterator first, InputIterator last, + const key_compare& comp = key_compare(), + const A& alloc = A()) : Base(first, last, alloc), MyCompare(comp) - { - MyCompare& me = *this; - std::sort(begin(), end(), me); - } - - AssocVector& operator=(const AssocVector& rhs) - { - AssocVector(rhs).swap(*this); - return *this; - } + { + MyCompare& me = *this; + std::sort(begin(), end(), me); + } - // iterators: - // The following are here because MWCW gets 'using' wrong - iterator begin() { return Base::begin(); } - const_iterator begin() const { return Base::begin(); } - iterator end() { return Base::end(); } - const_iterator end() const { return Base::end(); } - reverse_iterator rbegin() { return Base::rbegin(); } - const_reverse_iterator rbegin() const { return Base::rbegin(); } - reverse_iterator rend() { return Base::rend(); } - const_reverse_iterator rend() const { return Base::rend(); } - - // capacity: - bool empty() const { return Base::empty(); } - size_type size() const { return Base::size(); } - size_type max_size() { return Base::max_size(); } - - // 23.3.1.2 element access: - mapped_type& operator[](const key_type& key) - { return insert(value_type(key, mapped_type())).first->second; } - - // modifiers: - std::pair<iterator, bool> insert(const value_type& val) - { - bool found(true); - iterator i(lower_bound(val.first)); - - if (i == end() || this->operator()(val.first, i->first)) - { - i = Base::insert(i, val); - found = false; - } - return std::make_pair(i, !found); - } - //Section [23.1.2], Table 69 - //http://developer.apple.com/documentation/DeveloperTools/gcc-3.3/libstdc++/23_containers/howto.html#4 - iterator insert(iterator pos, const value_type& val) + AssocVector& operator=(const AssocVector& rhs) + { + AssocVector(rhs).swap(*this); + return *this; + } + + // iterators: + // The following are here because MWCW gets 'using' wrong + iterator begin() { return Base::begin(); } + const_iterator begin() const { return Base::begin(); } + iterator end() { return Base::end(); } + const_iterator end() const { return Base::end(); } + reverse_iterator rbegin() { return Base::rbegin(); } + const_reverse_iterator rbegin() const { return Base::rbegin(); } + reverse_iterator rend() { return Base::rend(); } + const_reverse_iterator rend() const { return Base::rend(); } + + // capacity: + bool empty() const { return Base::empty(); } + size_type size() const { return Base::size(); } + size_type max_size() { return Base::max_size(); } + + // 23.3.1.2 element access: + mapped_type& operator[](const key_type& key) + { return insert(value_type(key, mapped_type())).first->second; } + + // modifiers: + std::pair<iterator, bool> insert(const value_type& val) + { + bool found(true); + iterator i(lower_bound(val.first)); + + if (i == end() || this->operator()(val.first, i->first)) { - if( (pos == begin() || this->operator()(*(pos-1),val)) && - (pos == end() || this->operator()(val, *pos)) ) - { - return Base::insert(pos, val); - } - return insert(val).first; + i = Base::insert(i, val); + found = false; } - - template <class InputIterator> - void insert(InputIterator first, InputIterator last) - { for (; first != last; ++first) insert(*first); } - - void erase(iterator pos) - { Base::erase(pos); } - - size_type erase(const key_type& k) + return std::make_pair(i, !found); + } + //Section [23.1.2], Table 69 + //http://developer.apple.com/documentation/DeveloperTools/gcc-3.3/libstdc++/23_containers/howto.html#4 + iterator insert(iterator pos, const value_type& val) + { + if( (pos == begin() || this->operator()(*(pos-1),val)) && + (pos == end() || this->operator()(val, *pos)) ) { - iterator i(find(k)); - if (i == end()) return 0; - erase(i); - return 1; + return Base::insert(pos, val); } + return insert(val).first; + } - void erase(iterator first, iterator last) - { Base::erase(first, last); } + template <class InputIterator> + void insert(InputIterator first, InputIterator last) + { for (; first != last; ++first) insert(*first); } - void swap(AssocVector& other) - { - Base::swap(other); - MyCompare& me = *this; - MyCompare& rhs = other; - std::swap(me, rhs); - } - - void clear() - { Base::clear(); } + void erase(iterator pos) + { Base::erase(pos); } - // observers: - key_compare key_comp() const - { return *this; } + size_type erase(const key_type& k) + { + iterator i(find(k)); + if (i == end()) return 0; + erase(i); + return 1; + } - value_compare value_comp() const - { - const key_compare& comp = *this; - return value_compare(comp); - } + void erase(iterator first, iterator last) + { Base::erase(first, last); } - // 23.3.1.3 map operations: - iterator find(const key_type& k) - { - iterator i(lower_bound(k)); - if (i != end() && this->operator()(k, i->first)) - { - i = end(); - } - return i; - } + void swap(AssocVector& other) + { + Base::swap(other); + MyCompare& me = *this; + MyCompare& rhs = other; + std::swap(me, rhs); + } - const_iterator find(const key_type& k) const - { - const_iterator i(lower_bound(k)); - if (i != end() && this->operator()(k, i->first)) - { - i = end(); - } - return i; - } + void clear() + { Base::clear(); } - size_type count(const key_type& k) const - { return find(k) != end(); } + // observers: + key_compare key_comp() const + { return *this; } - iterator lower_bound(const key_type& k) - { - MyCompare& me = *this; - return std::lower_bound(begin(), end(), k, me); - } - - const_iterator lower_bound(const key_type& k) const - { - const MyCompare& me = *this; - return std::lower_bound(begin(), end(), k, me); - } + value_compare value_comp() const + { + const key_compare& comp = *this; + return value_compare(comp); + } - iterator upper_bound(const key_type& k) + // 23.3.1.3 map operations: + iterator find(const key_type& k) + { + iterator i(lower_bound(k)); + if (i != end() && this->operator()(k, i->first)) { - MyCompare& me = *this; - return std::upper_bound(begin(), end(), k, me); + i = end(); } + return i; + } - const_iterator upper_bound(const key_type& k) const + const_iterator find(const key_type& k) const + { + const_iterator i(lower_bound(k)); + if (i != end() && this->operator()(k, i->first)) { - const MyCompare& me = *this; - return std::upper_bound(begin(), end(), k, me); + i = end(); } + return i; + } - std::pair<iterator, iterator> equal_range(const key_type& k) - { - MyCompare& me = *this; - return std::equal_range(begin(), end(), k, me); - } + size_type count(const key_type& k) const + { return find(k) != end(); } - std::pair<const_iterator, const_iterator> equal_range( - const key_type& k) const - { - const MyCompare& me = *this; - return std::equal_range(begin(), end(), k, me); - } + iterator lower_bound(const key_type& k) + { + MyCompare& me = *this; + return std::lower_bound(begin(), end(), k, me); + } - template <class K1, class V1, class C1, class A1> - friend bool operator==(const AssocVector<K1, V1, C1, A1>& lhs, - const AssocVector<K1, V1, C1, A1>& rhs); + const_iterator lower_bound(const key_type& k) const + { + const MyCompare& me = *this; + return std::lower_bound(begin(), end(), k, me); + } - bool operator<(const AssocVector& rhs) const - { - const Base& me = *this; - const Base& yo = rhs; - return me < yo; - } + iterator upper_bound(const key_type& k) + { + MyCompare& me = *this; + return std::upper_bound(begin(), end(), k, me); + } - template <class K1, class V1, class C1, class A1> - friend bool operator!=(const AssocVector<K1, V1, C1, A1>& lhs, - const AssocVector<K1, V1, C1, A1>& rhs); + const_iterator upper_bound(const key_type& k) const + { + const MyCompare& me = *this; + return std::upper_bound(begin(), end(), k, me); + } - template <class K1, class V1, class C1, class A1> - friend bool operator>(const AssocVector<K1, V1, C1, A1>& lhs, - const AssocVector<K1, V1, C1, A1>& rhs); + std::pair<iterator, iterator> equal_range(const key_type& k) + { + MyCompare& me = *this; + return std::equal_range(begin(), end(), k, me); + } - template <class K1, class V1, class C1, class A1> - friend bool operator>=(const AssocVector<K1, V1, C1, A1>& lhs, - const AssocVector<K1, V1, C1, A1>& rhs); + std::pair<const_iterator, const_iterator> equal_range( + const key_type& k) const + { + const MyCompare& me = *this; + return std::equal_range(begin(), end(), k, me); + } - template <class K1, class V1, class C1, class A1> - friend bool operator<=(const AssocVector<K1, V1, C1, A1>& lhs, - const AssocVector<K1, V1, C1, A1>& rhs); - }; + template <class K1, class V1, class C1, class A1> + friend bool operator==(const AssocVector<K1, V1, C1, A1>& lhs, + const AssocVector<K1, V1, C1, A1>& rhs); - template <class K, class V, class C, class A> - inline bool operator==(const AssocVector<K, V, C, A>& lhs, - const AssocVector<K, V, C, A>& rhs) + bool operator<(const AssocVector& rhs) const { - const std::vector<std::pair<K, V>, A>& me = lhs; - return me == rhs; + const Base& me = *this; + const Base& yo = rhs; + return me < yo; } - template <class K, class V, class C, class A> - inline bool operator!=(const AssocVector<K, V, C, A>& lhs, - const AssocVector<K, V, C, A>& rhs) - { return !(lhs == rhs); } + template <class K1, class V1, class C1, class A1> + friend bool operator!=(const AssocVector<K1, V1, C1, A1>& lhs, + const AssocVector<K1, V1, C1, A1>& rhs); + + template <class K1, class V1, class C1, class A1> + friend bool operator>(const AssocVector<K1, V1, C1, A1>& lhs, + const AssocVector<K1, V1, C1, A1>& rhs); + + template <class K1, class V1, class C1, class A1> + friend bool operator>=(const AssocVector<K1, V1, C1, A1>& lhs, + const AssocVector<K1, V1, C1, A1>& rhs); + + template <class K1, class V1, class C1, class A1> + friend bool operator<=(const AssocVector<K1, V1, C1, A1>& lhs, + const AssocVector<K1, V1, C1, A1>& rhs); +}; + +template <class K, class V, class C, class A> +inline bool operator==(const AssocVector<K, V, C, A>& lhs, + const AssocVector<K, V, C, A>& rhs) +{ + const std::vector<std::pair<K, V>, A>& me = lhs; + return me == rhs; +} + +template <class K, class V, class C, class A> +inline bool operator!=(const AssocVector<K, V, C, A>& lhs, + const AssocVector<K, V, C, A>& rhs) +{ return !(lhs == rhs); } + +template <class K, class V, class C, class A> +inline bool operator>(const AssocVector<K, V, C, A>& lhs, + const AssocVector<K, V, C, A>& rhs) +{ return rhs < lhs; } - template <class K, class V, class C, class A> - inline bool operator>(const AssocVector<K, V, C, A>& lhs, - const AssocVector<K, V, C, A>& rhs) - { return rhs < lhs; } +template <class K, class V, class C, class A> +inline bool operator>=(const AssocVector<K, V, C, A>& lhs, + const AssocVector<K, V, C, A>& rhs) +{ return !(lhs < rhs); } - template <class K, class V, class C, class A> - inline bool operator>=(const AssocVector<K, V, C, A>& lhs, - const AssocVector<K, V, C, A>& rhs) - { return !(lhs < rhs); } +template <class K, class V, class C, class A> +inline bool operator<=(const AssocVector<K, V, C, A>& lhs, + const AssocVector<K, V, C, A>& rhs) +{ return !(rhs < lhs); } - template <class K, class V, class C, class A> - inline bool operator<=(const AssocVector<K, V, C, A>& lhs, - const AssocVector<K, V, C, A>& rhs) - { return !(rhs < lhs); } +// specialized algorithms: +template <class K, class V, class C, class A> +void swap(AssocVector<K, V, C, A>& lhs, AssocVector<K, V, C, A>& rhs) +{ lhs.swap(rhs); } - // specialized algorithms: - template <class K, class V, class C, class A> - void swap(AssocVector<K, V, C, A>& lhs, AssocVector<K, V, C, A>& rhs) - { lhs.swap(rhs); } - } // namespace Loki #endif // end file guardian diff --git a/shared/loki/CachedFactory.h b/shared/loki/CachedFactory.h index 15c9a801..567b035c 100644 --- a/shared/loki/CachedFactory.h +++ b/shared/loki/CachedFactory.h @@ -4,16 +4,16 @@ // // Code covered by the MIT License // -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. // // The authors make no representations about the suitability of this software // for any purpose. It is provided "as is" without express or implied warranty. // // This code DOES NOT accompany the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. // //////////////////////////////////////////////////////////////////////////////// @@ -32,9 +32,9 @@ #include <loki/Key.h> #ifdef DO_EXTRA_LOKI_TESTS - #define D( x ) x +#define D( x ) x #else - #define D( x ) ; +#define D( x ) ; #endif #if defined(_MSC_VER) || defined(__CYGWIN__) @@ -47,7 +47,7 @@ * \ingroup FactoriesGroup * \brief CachedFactory provides an extension of a Factory with caching * support. - * + * * Once used objects are returned to the CachedFactory that manages its * destruction. * If your code uses lots of "long to construct/destruct objects" using the @@ -60,231 +60,231 @@ namespace Loki * \ingroup CachedFactoryGroup * \brief Defines how the object is returned to the client */ - /** - * \class SimplePointer - * \ingroup EncapsulationPolicyCachedFactoryGroup - * \brief No encaspulation : returns the pointer - * - * This implementation does not make any encapsulation. - * It simply returns the object's pointer. - */ - template<class AbstractProduct> - class SimplePointer - { - protected: - typedef AbstractProduct* ProductReturn; - ProductReturn encapsulate(AbstractProduct* pProduct) - { - return pProduct; - } - - AbstractProduct* release(ProductReturn &pProduct) - { - AbstractProduct* pPointer(pProduct); - pProduct=NULL; - return pPointer; - } - const char* name(){return "pointer";} - }; +/** + * \class SimplePointer + * \ingroup EncapsulationPolicyCachedFactoryGroup + * \brief No encaspulation : returns the pointer + * + * This implementation does not make any encapsulation. + * It simply returns the object's pointer. + */ +template<class AbstractProduct> +class SimplePointer +{ +protected: + typedef AbstractProduct* ProductReturn; + ProductReturn encapsulate(AbstractProduct* pProduct) + { + return pProduct; + } + + AbstractProduct* release(ProductReturn& pProduct) + { + AbstractProduct* pPointer(pProduct); + pProduct=NULL; + return pPointer; + } + const char* name() {return "pointer";} +}; /** * \defgroup CreationPolicyCachedFactoryGroup Creation policies * \ingroup CachedFactoryGroup * \brief Defines a way to limit the creation operation. - * + * * For instance one may want to be alerted (Exception) when * - Cache has created a more than X object within the last x seconds * - Cache creation rate has increased dramatically * . * which may result from bad caching strategy, or critical overload */ - /** - * \class NeverCreate - * \ingroup CreationPolicyCachedFactoryGroup - * \brief Never allows creation. Testing purposes only. - * - * Using this policy will throw an exception. - */ - class NeverCreate - { - protected: - struct Exception : public std::exception - { - const char* what() const throw() { return "NeverFetch Policy : No Fetching allowed"; } - }; - - bool canCreate() - { - throw Exception(); - } - - void onCreate(){} - void onDestroy(){} - const char* name(){return "never";} - }; - - /** - * \class AlwaysCreate - * \ingroup CreationPolicyCachedFactoryGroup - * \brief Always allows creation. - * - * Doesn't limit the creation in any way - */ - class AlwaysCreate - { - protected: - bool canCreate() - { - return true; - } +/** + * \class NeverCreate + * \ingroup CreationPolicyCachedFactoryGroup + * \brief Never allows creation. Testing purposes only. + * + * Using this policy will throw an exception. + */ +class NeverCreate +{ +protected: + struct Exception : public std::exception + { + const char* what() const throw() { return "NeverFetch Policy : No Fetching allowed"; } + }; - void onCreate(){} - void onDestroy(){} - const char* name(){return "always";} - }; + bool canCreate() + { + throw Exception(); + } + void onCreate() {} + void onDestroy() {} + const char* name() {return "never";} +}; - /** - * \class RateLimitedCreation - * \ingroup CreationPolicyCachedFactoryGroup - * \brief Limit in rate. - * - * This implementation will prevent from Creating more than maxCreation objects - * within byTime ms by throwing an exception. - * Could be usefull to detect prevent loads (http connection for instance). - * Use the setRate method to set the rate parameters. - * default is 10 objects in a second. - */ - // !! CAUTION !! - // The std::clock() function is not quite precise - // under linux this policy might not work. - // TODO : get a better implementation (platform dependant) - class RateLimitedCreation - { - private: - typedef std::vector< clock_t > Vector; - Vector m_vTimes; - unsigned maxCreation; - clock_t timeValidity; - clock_t lastUpdate; - - void cleanVector() - { - using namespace std; - clock_t currentTime = clock(); - D( cout << "currentTime = " << currentTime<< endl; ) - D( cout << "currentTime - lastUpdate = " << currentTime - lastUpdate<< endl; ) - if(currentTime - lastUpdate > timeValidity) - { - m_vTimes.clear(); - D( cout << " is less than time validity " << timeValidity; ) - D( cout << " so clearing vector" << endl; ) - } - else - { - D( cout << "Cleaning time less than " << currentTime - timeValidity << endl; ) - D( displayVector(); ) - Vector::iterator newEnd = remove_if(m_vTimes.begin(), m_vTimes.end(), bind2nd(less<clock_t>(), currentTime - timeValidity)); - // this rearrangement might be costly, consider optimization - // by calling cleanVector in less used onCreate function - // ... although it may not be correct - m_vTimes.erase(newEnd, m_vTimes.end()); - D( displayVector(); ) - } - lastUpdate = currentTime; - } -#ifdef DO_EXTRA_LOKI_TESTS - void displayVector() - { - std::cout << "Vector : "; - copy(m_vTimes.begin(), m_vTimes.end(), std::ostream_iterator<clock_t>(std::cout, " ")); - std::cout << std::endl; - } +/** + * \class AlwaysCreate + * \ingroup CreationPolicyCachedFactoryGroup + * \brief Always allows creation. + * + * Doesn't limit the creation in any way + */ +class AlwaysCreate +{ +protected: + bool canCreate() + { + return true; + } + + void onCreate() {} + void onDestroy() {} + const char* name() {return "always";} +}; + + +/** + * \class RateLimitedCreation + * \ingroup CreationPolicyCachedFactoryGroup + * \brief Limit in rate. + * + * This implementation will prevent from Creating more than maxCreation objects + * within byTime ms by throwing an exception. + * Could be usefull to detect prevent loads (http connection for instance). + * Use the setRate method to set the rate parameters. + * default is 10 objects in a second. + */ +// !! CAUTION !! +// The std::clock() function is not quite precise +// under linux this policy might not work. +// TODO : get a better implementation (platform dependant) +class RateLimitedCreation +{ +private: + typedef std::vector< clock_t > Vector; + Vector m_vTimes; + unsigned maxCreation; + clock_t timeValidity; + clock_t lastUpdate; + + void cleanVector() + { + using namespace std; + clock_t currentTime = clock(); + D( cout << "currentTime = " << currentTime<< endl; ) + D( cout << "currentTime - lastUpdate = " << currentTime - lastUpdate<< endl; ) + if(currentTime - lastUpdate > timeValidity) + { + m_vTimes.clear(); + D( cout << " is less than time validity " << timeValidity; ) + D( cout << " so clearing vector" << endl; ) + } + else + { + D( cout << "Cleaning time less than " << currentTime - timeValidity << endl; ) + D( displayVector(); ) + Vector::iterator newEnd = remove_if(m_vTimes.begin(), m_vTimes.end(), bind2nd(less<clock_t>(), currentTime - timeValidity)); + // this rearrangement might be costly, consider optimization + // by calling cleanVector in less used onCreate function + // ... although it may not be correct + m_vTimes.erase(newEnd, m_vTimes.end()); + D( displayVector(); ) + } + lastUpdate = currentTime; + } +#ifdef DO_EXTRA_LOKI_TESTS + void displayVector() + { + std::cout << "Vector : "; + copy(m_vTimes.begin(), m_vTimes.end(), std::ostream_iterator<clock_t>(std::cout, " ")); + std::cout << std::endl; + } #endif - protected: - RateLimitedCreation() : maxCreation(10), timeValidity(CLOCKS_PER_SEC), lastUpdate(clock()) - {} - - struct Exception : public std::exception - { - const char* what() const throw() { return "RateLimitedCreation Policy : Exceeded the authorized creation rate"; } - }; - - bool canCreate() - { - cleanVector(); - if(m_vTimes.size()>maxCreation) - throw Exception(); - else - return true; - } +protected: + RateLimitedCreation() : maxCreation(10), timeValidity(CLOCKS_PER_SEC), lastUpdate(clock()) + {} - void onCreate() - { - m_vTimes.push_back(clock()); - } - - void onDestroy() - { - } - const char* name(){return "rate limited";} - public: - // set the creation rate - // No more than maxCreation within byTime milliseconds - void setRate(unsigned maxCreation, unsigned byTime) - { - assert(byTime>0); - this->maxCreation = maxCreation; - this->timeValidity = static_cast<clock_t>(byTime * CLOCKS_PER_SEC / 1000); - D( std::cout << "Setting no more than "<< maxCreation <<" creation within " << this->timeValidity <<" ms"<< std::endl; ) - } - }; - - /** - * \class AmountLimitedCreation - * \ingroup CreationPolicyCachedFactoryGroup - * \brief Limit by number of objects - * - * This implementation will prevent from Creating more than maxCreation objects - * within byTime ms by calling eviction policy. - * Use the setRate method to set the rate parameters. - * default is 10 objects. - */ - class AmountLimitedCreation - { - private: - unsigned maxCreation; - unsigned created; - - protected: - AmountLimitedCreation() : maxCreation(10), created(0) - {} - - bool canCreate() - { - return !(created>=maxCreation); - } + struct Exception : public std::exception + { + const char* what() const throw() { return "RateLimitedCreation Policy : Exceeded the authorized creation rate"; } + }; + + bool canCreate() + { + cleanVector(); + if(m_vTimes.size()>maxCreation) + throw Exception(); + else + return true; + } + + void onCreate() + { + m_vTimes.push_back(clock()); + } + + void onDestroy() + { + } + const char* name() {return "rate limited";} +public: + // set the creation rate + // No more than maxCreation within byTime milliseconds + void setRate(unsigned maxCreation, unsigned byTime) + { + assert(byTime>0); + this->maxCreation = maxCreation; + this->timeValidity = static_cast<clock_t>(byTime * CLOCKS_PER_SEC / 1000); + D( std::cout << "Setting no more than "<< maxCreation <<" creation within " << this->timeValidity <<" ms"<< std::endl; ) + } +}; + +/** + * \class AmountLimitedCreation + * \ingroup CreationPolicyCachedFactoryGroup + * \brief Limit by number of objects + * + * This implementation will prevent from Creating more than maxCreation objects + * within byTime ms by calling eviction policy. + * Use the setRate method to set the rate parameters. + * default is 10 objects. + */ +class AmountLimitedCreation +{ +private: + unsigned maxCreation; + unsigned created; + +protected: + AmountLimitedCreation() : maxCreation(10), created(0) + {} + + bool canCreate() + { + return !(created>=maxCreation); + } + + void onCreate() + { + ++created; + } + + void onDestroy() + { + --created; + } + const char* name() {return "amount limited";} +public: + // set the creation max amount + void setMaxCreation(unsigned maxCreation) + { + assert(maxCreation>0); + this->maxCreation = maxCreation; + D( std::cout << "Setting no more than " << maxCreation <<" creation" << std::endl; ) + } +}; - void onCreate() - { - ++created; - } - - void onDestroy() - { - --created; - } - const char* name(){return "amount limited";} - public: - // set the creation max amount - void setMaxCreation(unsigned maxCreation) - { - assert(maxCreation>0); - this->maxCreation = maxCreation; - D( std::cout << "Setting no more than " << maxCreation <<" creation" << std::endl; ) - } - }; - /** * \defgroup EvictionPolicyCachedFactoryGroup Eviction policies * \ingroup CachedFactoryGroup @@ -292,875 +292,887 @@ namespace Loki * candidate for eviction. */ - class EvictionException : public std::exception +class EvictionException : public std::exception +{ +public: + const char* what() const throw() { return "Eviction Policy : trying to make room but no objects are available"; } +}; + +// The following class is intented to provide helpers to sort +// the container that will hold an eviction score +template +< +typename ST, // Score type + typename DT // Data type + > +class EvictionHelper +{ +protected: + typedef typename std::map< DT, ST > HitMap; + typedef typename HitMap::iterator HitMapItr; +private: + typedef std::pair< ST, DT > SwappedPair; + typedef std::multimap< ST, DT > SwappedHitMap; + typedef typename SwappedHitMap::iterator SwappedHitMapItr; +protected: + HitMap m_mHitCount; + + // This function sorts the map according to the score + // and returns the lower bound of the sorted container + DT& getLowerBound() { - public: - const char* what() const throw() { return "Eviction Policy : trying to make room but no objects are available"; } - }; + assert(!m_mHitCount.empty()); + // inserting the swapped pair into a multimap + SwappedHitMap copyMap; + for(HitMapItr itr = m_mHitCount.begin(); itr != m_mHitCount.end(); ++itr) + copyMap.insert(SwappedPair((*itr).second, (*itr).first)); + if((*copyMap.rbegin()).first == 0) // the higher score is 0 ... + throw EvictionException(); // there is no key evict + return (*copyMap.begin()).second; + } +}; - // The following class is intented to provide helpers to sort - // the container that will hold an eviction score - template - < - typename ST, // Score type - typename DT // Data type - > - class EvictionHelper - { - protected: - typedef typename std::map< DT, ST > HitMap; - typedef typename HitMap::iterator HitMapItr; - private: - typedef std::pair< ST, DT > SwappedPair; - typedef std::multimap< ST, DT > SwappedHitMap; - typedef typename SwappedHitMap::iterator SwappedHitMapItr; - protected: - HitMap m_mHitCount; - - // This function sorts the map according to the score - // and returns the lower bound of the sorted container - DT& getLowerBound(){ - assert(!m_mHitCount.empty()); - // inserting the swapped pair into a multimap - SwappedHitMap copyMap; - for(HitMapItr itr = m_mHitCount.begin(); itr != m_mHitCount.end(); ++itr) - copyMap.insert(SwappedPair((*itr).second, (*itr).first)); - if((*copyMap.rbegin()).first == 0) // the higher score is 0 ... - throw EvictionException(); // there is no key evict - return (*copyMap.begin()).second; - } - }; - - /** - * \class EvictLRU - * \ingroup EvictionPolicyCachedFactoryGroup - * \brief Evicts least accessed objects first. - * - * Implementation of the Least recent used algorithm as - * described in http://en.wikipedia.org/wiki/Page_replacement_algorithms . - * - * WARNING : If an object is heavily fetched - * (more than ULONG_MAX = UINT_MAX = 4294967295U) - * it could unfortunately be removed from the cache. - */ - template - < - typename DT, // Data Type (AbstractProduct*) - typename ST = unsigned // default data type to use as Score Type - > - class EvictLRU : public EvictionHelper< ST , DT > +/** + * \class EvictLRU + * \ingroup EvictionPolicyCachedFactoryGroup + * \brief Evicts least accessed objects first. + * + * Implementation of the Least recent used algorithm as + * described in http://en.wikipedia.org/wiki/Page_replacement_algorithms . + * + * WARNING : If an object is heavily fetched + * (more than ULONG_MAX = UINT_MAX = 4294967295U) + * it could unfortunately be removed from the cache. + */ +template +< +typename DT, // Data Type (AbstractProduct*) + typename ST = unsigned // default data type to use as Score Type + > +class EvictLRU : public EvictionHelper< ST , DT > +{ +private: + typedef EvictionHelper< ST , DT > EH; +protected: + + virtual ~EvictLRU() {} + + // OnStore initialize the counter for the new key + // If the key already exists, the counter is reseted + void onCreate(const DT& key) { - private: - typedef EvictionHelper< ST , DT > EH; - protected: - - virtual ~EvictLRU(){} - - // OnStore initialize the counter for the new key - // If the key already exists, the counter is reseted - void onCreate(const DT& key) - { - EH::m_mHitCount[key] = 0; - } - - void onFetch(const DT&) - { - } - - // onRelease increments the hit counter associated with the object - void onRelease(const DT& key) - { - ++(EH::m_mHitCount[key]); - } + EH::m_mHitCount[key] = 0; + } - void onDestroy(const DT& key) - { - EH::m_mHitCount.erase(key); - } - - // this function is implemented in Cache and redirected - // to the Storage Policy - virtual void remove(DT const key)=0; - - // LRU Eviction policy - void evict() - { - remove(EH::getLowerBound()); - } - const char* name(){return "LRU";} - }; - - /** - * \class EvictAging - * \ingroup EvictionPolicyCachedFactoryGroup - * \brief LRU aware of the time span of use - * - * Implementation of the Aging algorithm as - * described in http://en.wikipedia.org/wiki/Page_replacement_algorithms . - * - * This method is much more costly than evict LRU so - * if you need extreme performance consider switching to EvictLRU - */ - template - < - typename DT, // Data Type (AbstractProduct*) - typename ST = unsigned // default data type to use as Score Type - > - class EvictAging : public EvictionHelper< ST, DT > + void onFetch(const DT&) { - private: - EvictAging(const EvictAging&); - EvictAging& operator=(const EvictAging&); - typedef EvictionHelper< ST, DT > EH; - typedef typename EH::HitMap HitMap; - typedef typename EH::HitMapItr HitMapItr; - - // update the counter - template<class T> struct updateCounter : public std::unary_function<T, void> - { - updateCounter(const DT& key): key_(key){} - void operator()(T x) - { - x.second = (x.first == key_ ? (x.second >> 1) | ( 1 << ((sizeof(ST)-1)*8) ) : x.second >> 1); - D( std::cout << x.second << std::endl; ) - } - const DT &key_; - updateCounter(const updateCounter& rhs) : key_(rhs.key_){} - private: - updateCounter& operator=(const updateCounter& rhs); - }; - protected: - EvictAging(){} - virtual ~EvictAging(){} - - // OnStore initialize the counter for the new key - // If the key already exists, the counter is reseted - void onCreate(const DT& key){ - EH::m_mHitCount[key] = 0; - } - - void onFetch(const DT&){} - - // onRelease increments the hit counter associated with the object - // Updating every counters by iterating over the map - // If the key is the key of the fetched object : - // the counter is shifted to the right and it's MSB is set to 1 - // else - // the counter is shifted to the left - void onRelease(const DT& key) - { - std::for_each(EH::m_mHitCount.begin(), EH::m_mHitCount.end(), updateCounter< typename HitMap::value_type >(key)); - } - - void onDestroy(const DT& key) - { - EH::m_mHitCount.erase(key); - } + } - // this function is implemented in Cache and redirected - // to the Storage Policy - virtual void remove(DT const key)=0; + // onRelease increments the hit counter associated with the object + void onRelease(const DT& key) + { + ++(EH::m_mHitCount[key]); + } - // LRU with Aging Eviction policy - void evict() - { - remove(EH::getLowerBound()); - } - const char* name(){return "LRU with aging";} - }; - - /** - * \class EvictRandom - * \ingroup EvictionPolicyCachedFactoryGroup - * \brief Evicts a random object - * - * Implementation of the Random algorithm as - * described in http://en.wikipedia.org/wiki/Page_replacement_algorithms . - */ - template - < - typename DT, // Data Type (AbstractProduct*) - typename ST = void // Score Type not used by this policy - > - class EvictRandom + void onDestroy(const DT& key) + { + EH::m_mHitCount.erase(key); + } + + // this function is implemented in Cache and redirected + // to the Storage Policy + virtual void remove(DT const key)=0; + + // LRU Eviction policy + void evict() { + remove(EH::getLowerBound()); + } + const char* name() {return "LRU";} +}; + +/** + * \class EvictAging + * \ingroup EvictionPolicyCachedFactoryGroup + * \brief LRU aware of the time span of use + * + * Implementation of the Aging algorithm as + * described in http://en.wikipedia.org/wiki/Page_replacement_algorithms . + * + * This method is much more costly than evict LRU so + * if you need extreme performance consider switching to EvictLRU + */ +template +< +typename DT, // Data Type (AbstractProduct*) + typename ST = unsigned // default data type to use as Score Type + > +class EvictAging : public EvictionHelper< ST, DT > +{ +private: + EvictAging(const EvictAging&); + EvictAging& operator=(const EvictAging&); + typedef EvictionHelper< ST, DT > EH; + typedef typename EH::HitMap HitMap; + typedef typename EH::HitMapItr HitMapItr; + + // update the counter + template<class T> struct updateCounter : public std::unary_function<T, void> + { + updateCounter(const DT& key): key_(key) {} + void operator()(T x) + { + x.second = (x.first == key_ ? (x.second >> 1) | ( 1 << ((sizeof(ST)-1)*8) ) : x.second >> 1); + D( std::cout << x.second << std::endl; ) + } + const DT& key_; + updateCounter(const updateCounter& rhs) : key_(rhs.key_) {} private: - std::vector< DT > m_vKeys; - typedef typename std::vector< DT >::size_type size_type; - typedef typename std::vector< DT >::iterator iterator; - - protected: - - virtual ~EvictRandom(){} - - void onCreate(const DT&){ - } - - void onFetch(const DT& ){ - } - - void onRelease(const DT& key){ - m_vKeys.push_back(key); - } - - void onDestroy(const DT& key){ - using namespace std; - m_vKeys.erase(remove_if(m_vKeys.begin(), m_vKeys.end(), bind2nd(equal_to< DT >(), key)), m_vKeys.end()); - } - - // Implemented in Cache and redirected to the Storage Policy - virtual void remove(DT const key)=0; - - // Random Eviction policy - void evict() - { - if(m_vKeys.empty()) - throw EvictionException(); - size_type random = static_cast<size_type>((m_vKeys.size()*rand())/(static_cast<size_type>(RAND_MAX) + 1)); - remove(*(m_vKeys.begin()+random)); - } - const char* name(){return "random";} + updateCounter& operator=(const updateCounter& rhs); }; +protected: + EvictAging() {} + virtual ~EvictAging() {} + + // OnStore initialize the counter for the new key + // If the key already exists, the counter is reseted + void onCreate(const DT& key) + { + EH::m_mHitCount[key] = 0; + } + + void onFetch(const DT&) {} + + // onRelease increments the hit counter associated with the object + // Updating every counters by iterating over the map + // If the key is the key of the fetched object : + // the counter is shifted to the right and it's MSB is set to 1 + // else + // the counter is shifted to the left + void onRelease(const DT& key) + { + std::for_each(EH::m_mHitCount.begin(), EH::m_mHitCount.end(), updateCounter< typename HitMap::value_type >(key)); + } + + void onDestroy(const DT& key) + { + EH::m_mHitCount.erase(key); + } + + // this function is implemented in Cache and redirected + // to the Storage Policy + virtual void remove(DT const key)=0; + + // LRU with Aging Eviction policy + void evict() + { + remove(EH::getLowerBound()); + } + const char* name() {return "LRU with aging";} +}; + +/** + * \class EvictRandom + * \ingroup EvictionPolicyCachedFactoryGroup + * \brief Evicts a random object + * + * Implementation of the Random algorithm as + * described in http://en.wikipedia.org/wiki/Page_replacement_algorithms . + */ +template +< +typename DT, // Data Type (AbstractProduct*) + typename ST = void // Score Type not used by this policy + > +class EvictRandom +{ +private: + std::vector< DT > m_vKeys; + typedef typename std::vector< DT >::size_type size_type; + typedef typename std::vector< DT >::iterator iterator; + +protected: + + virtual ~EvictRandom() {} + + void onCreate(const DT&) + { + } + + void onFetch(const DT& ) + { + } + + void onRelease(const DT& key) + { + m_vKeys.push_back(key); + } + + void onDestroy(const DT& key) + { + using namespace std; + m_vKeys.erase(remove_if(m_vKeys.begin(), m_vKeys.end(), bind2nd(equal_to< DT >(), key)), m_vKeys.end()); + } + + // Implemented in Cache and redirected to the Storage Policy + virtual void remove(DT const key)=0; + + // Random Eviction policy + void evict() + { + if(m_vKeys.empty()) + throw EvictionException(); + size_type random = static_cast<size_type>((m_vKeys.size()*rand())/(static_cast<size_type>(RAND_MAX) + 1)); + remove(*(m_vKeys.begin()+random)); + } + const char* name() {return "random";} +}; /** * \defgroup StatisticPolicyCachedFactoryGroup Statistic policies * \ingroup CachedFactoryGroup * \brief Gathers information about the cache. - * + * * For debugging purpose this policy proposes to gather informations * about the cache. This could be useful to determine whether the cache is * mandatory or if the policies are well suited to the application. */ - /** - * \class NoStatisticPolicy - * \ingroup StatisticPolicyCachedFactoryGroup - * \brief Do nothing - * - * Should be used in release code for better performances - */ - class NoStatisticPolicy - { - protected: - void onDebug(){} - void onFetch(){} - void onRelease(){} - void onCreate(){} - void onDestroy(){} - const char* name(){return "no";} - }; - - /** - * \class SimpleStatisticPolicy - * \ingroup StatisticPolicyCachedFactoryGroup - * \brief Simple statistics - * - * Provides the following informations about the cache : - * - Created objects - * - Fetched objects - * - Destroyed objects - * - Cache hit - * - Cache miss - * - Currently allocated - * - Currently out - * - Cache overall efficiency - */ - class SimpleStatisticPolicy +/** + * \class NoStatisticPolicy + * \ingroup StatisticPolicyCachedFactoryGroup + * \brief Do nothing + * + * Should be used in release code for better performances + */ +class NoStatisticPolicy +{ +protected: + void onDebug() {} + void onFetch() {} + void onRelease() {} + void onCreate() {} + void onDestroy() {} + const char* name() {return "no";} +}; + +/** + * \class SimpleStatisticPolicy + * \ingroup StatisticPolicyCachedFactoryGroup + * \brief Simple statistics + * + * Provides the following informations about the cache : + * - Created objects + * - Fetched objects + * - Destroyed objects + * - Cache hit + * - Cache miss + * - Currently allocated + * - Currently out + * - Cache overall efficiency + */ +class SimpleStatisticPolicy +{ +private: + unsigned allocated, created, hit, out, fetched; +protected: + SimpleStatisticPolicy() : allocated(0), created(0), hit(0), out(0), fetched(0) { - private: - unsigned allocated, created, hit, out, fetched; - protected: - SimpleStatisticPolicy() : allocated(0), created(0), hit(0), out(0), fetched(0) - { - } - - void onDebug() + } + + void onDebug() + { + using namespace std; + cout << "############################" << endl; + cout << "## About this cache " << this << endl; + cout << "## + Created objects : " << created << endl; + cout << "## + Fetched objects : " << fetched << endl; + cout << "## + Destroyed objects : " << created - allocated << endl; + cout << "## + Cache hit : " << hit << endl; + cout << "## + Cache miss : " << fetched - hit << endl; + cout << "## + Currently allocated : " << allocated << endl; + cout << "## + Currently out : " << out << endl; + cout << "############################" << endl; + if(fetched!=0) { - using namespace std; - cout << "############################" << endl; - cout << "## About this cache " << this << endl; - cout << "## + Created objects : " << created << endl; - cout << "## + Fetched objects : " << fetched << endl; - cout << "## + Destroyed objects : " << created - allocated << endl; - cout << "## + Cache hit : " << hit << endl; - cout << "## + Cache miss : " << fetched - hit << endl; - cout << "## + Currently allocated : " << allocated << endl; - cout << "## + Currently out : " << out << endl; + cout << "## Overall efficiency " << 100*double(hit)/fetched <<"%"<< endl; cout << "############################" << endl; - if(fetched!=0){ - cout << "## Overall efficiency " << 100*double(hit)/fetched <<"%"<< endl; - cout << "############################" << endl; - } - cout << endl; } - - void onFetch() - { - ++fetched; - ++out; - ++hit; - } - void onRelease() - { - --out; - } - void onCreate() + cout << endl; + } + + void onFetch() + { + ++fetched; + ++out; + ++hit; + } + void onRelease() + { + --out; + } + void onCreate() + { + ++created; + ++allocated; + --hit; + } + void onDestroy() + { + --allocated; + } + + const char* name() {return "simple";} +public: + unsigned getCreated() {return created;} + unsigned getFetched() {return fetched;} + unsigned getHit() {return hit;} + unsigned getMissed() {return fetched - hit;} + unsigned getAllocated() {return allocated;} + unsigned getOut() {return out;} + unsigned getDestroyed() {return created-allocated;} +}; + +/////////////////////////////////////////////////////////////////////////// +// Cache Factory definition +/////////////////////////////////////////////////////////////////////////// +class CacheException : public std::exception +{ +public: + const char* what() const throw() { return "Internal Cache Error"; } +}; + +/** + * \class CachedFactory + * \ingroup CachedFactoryGroup + * \brief Factory with caching support + * + * This class acts as a Factory (it creates objects) + * but also keeps the already created objects to prevent + * long constructions time. + * + * Note this implementation do not retain ownership. + */ +template +< +class AbstractProduct, + typename IdentifierType, + typename CreatorParmTList = NullType, + template<class> class EncapsulationPolicy = SimplePointer, + class CreationPolicy = AlwaysCreate, + template <typename , typename> class EvictionPolicy = EvictRandom, + class StatisticPolicy = NoStatisticPolicy, + template<typename, class> class FactoryErrorPolicy = DefaultFactoryError, + class ObjVector = std::vector<AbstractProduct*> + > +class CachedFactory : + protected EncapsulationPolicy<AbstractProduct>, + public CreationPolicy, public StatisticPolicy, EvictionPolicy< AbstractProduct* , unsigned > +{ +private: + typedef Factory< AbstractProduct, IdentifierType, CreatorParmTList, FactoryErrorPolicy> MyFactory; + typedef FactoryImpl< AbstractProduct, IdentifierType, CreatorParmTList > Impl; + typedef Functor< AbstractProduct* , CreatorParmTList > ProductCreator; + typedef EncapsulationPolicy<AbstractProduct> NP; + typedef CreationPolicy CP; + typedef StatisticPolicy SP; + typedef EvictionPolicy< AbstractProduct* , unsigned > EP; + + typedef typename Impl::Parm1 Parm1; + typedef typename Impl::Parm2 Parm2; + typedef typename Impl::Parm3 Parm3; + typedef typename Impl::Parm4 Parm4; + typedef typename Impl::Parm5 Parm5; + typedef typename Impl::Parm6 Parm6; + typedef typename Impl::Parm7 Parm7; + typedef typename Impl::Parm8 Parm8; + typedef typename Impl::Parm9 Parm9; + typedef typename Impl::Parm10 Parm10; + typedef typename Impl::Parm11 Parm11; + typedef typename Impl::Parm12 Parm12; + typedef typename Impl::Parm13 Parm13; + typedef typename Impl::Parm14 Parm14; + typedef typename Impl::Parm15 Parm15; + +public: + typedef typename NP::ProductReturn ProductReturn; +private: + typedef Key< Impl, IdentifierType > MyKey; + typedef std::map< MyKey, ObjVector > KeyToObjVectorMap; + typedef std::map< AbstractProduct*, MyKey > FetchedObjToKeyMap; + + MyFactory factory; + KeyToObjVectorMap fromKeyToObjVector; + FetchedObjToKeyMap providedObjects; + unsigned outObjects; + + ObjVector& getContainerFromKey(MyKey key) + { + return fromKeyToObjVector[key]; + } + + AbstractProduct* const getPointerToObjectInContainer(ObjVector& entry) + { + if(entry.empty()) // No object available { - ++created; - ++allocated; - --hit; + // the object will be created in the calling function. + // It has to be created in the calling function because of + // the variable number of parameters for CreateObject(...) method + return NULL; } - void onDestroy() + else { - --allocated; + // returning the found object + AbstractProduct* pObject(entry.back()); + assert(pObject!=NULL); + entry.pop_back(); + return pObject; } + } + + bool shouldCreateObject(AbstractProduct* const pProduct) + { + if(pProduct!=NULL) // object already exists + return false; + if(CP::canCreate()==false) // Are we allowed to Create ? + EP::evict(); // calling Eviction Policy to clean up + return true; + } + + void ReleaseObjectFromContainer(ObjVector& entry, AbstractProduct* const object) + { + entry.push_back(object); + } + + void onFetch(AbstractProduct* const pProduct) + { + SP::onFetch(); + EP::onFetch(pProduct); + ++outObjects; + } + + void onRelease(AbstractProduct* const pProduct) + { + SP::onRelease(); + EP::onRelease(pProduct); + --outObjects; + } + + void onCreate(AbstractProduct* const pProduct) + { + CP::onCreate(); + SP::onCreate(); + EP::onCreate(pProduct); + } - const char* name(){return "simple";} - public: - unsigned getCreated(){return created;} - unsigned getFetched(){return fetched;} - unsigned getHit(){return hit;} - unsigned getMissed(){return fetched - hit;} - unsigned getAllocated(){return allocated;} - unsigned getOut(){return out;} - unsigned getDestroyed(){return created-allocated;} - }; - - /////////////////////////////////////////////////////////////////////////// - // Cache Factory definition - /////////////////////////////////////////////////////////////////////////// - class CacheException : public std::exception - { - public: - const char* what() const throw() { return "Internal Cache Error"; } + void onDestroy(AbstractProduct* const pProduct) + { + CP::onDestroy(); + SP::onDestroy(); + EP::onDestroy(pProduct); + } + + // delete the object + template<class T> struct deleteObject : public std::unary_function<T, void> + { + void operator()(T x) { delete x; } }; - - /** - * \class CachedFactory - * \ingroup CachedFactoryGroup - * \brief Factory with caching support - * - * This class acts as a Factory (it creates objects) - * but also keeps the already created objects to prevent - * long constructions time. - * - * Note this implementation do not retain ownership. - */ - template - < - class AbstractProduct, - typename IdentifierType, - typename CreatorParmTList = NullType, - template<class> class EncapsulationPolicy = SimplePointer, - class CreationPolicy = AlwaysCreate, - template <typename , typename> class EvictionPolicy = EvictRandom, - class StatisticPolicy = NoStatisticPolicy, - template<typename, class> class FactoryErrorPolicy = DefaultFactoryError, - class ObjVector = std::vector<AbstractProduct*> - > - class CachedFactory : - protected EncapsulationPolicy<AbstractProduct>, - public CreationPolicy, public StatisticPolicy, EvictionPolicy< AbstractProduct * , unsigned > - { - private: - typedef Factory< AbstractProduct, IdentifierType, CreatorParmTList, FactoryErrorPolicy> MyFactory; - typedef FactoryImpl< AbstractProduct, IdentifierType, CreatorParmTList > Impl; - typedef Functor< AbstractProduct* , CreatorParmTList > ProductCreator; - typedef EncapsulationPolicy<AbstractProduct> NP; - typedef CreationPolicy CP; - typedef StatisticPolicy SP; - typedef EvictionPolicy< AbstractProduct* , unsigned > EP; - - typedef typename Impl::Parm1 Parm1; - typedef typename Impl::Parm2 Parm2; - typedef typename Impl::Parm3 Parm3; - typedef typename Impl::Parm4 Parm4; - typedef typename Impl::Parm5 Parm5; - typedef typename Impl::Parm6 Parm6; - typedef typename Impl::Parm7 Parm7; - typedef typename Impl::Parm8 Parm8; - typedef typename Impl::Parm9 Parm9; - typedef typename Impl::Parm10 Parm10; - typedef typename Impl::Parm11 Parm11; - typedef typename Impl::Parm12 Parm12; - typedef typename Impl::Parm13 Parm13; - typedef typename Impl::Parm14 Parm14; - typedef typename Impl::Parm15 Parm15; - - public: - typedef typename NP::ProductReturn ProductReturn; - private: - typedef Key< Impl, IdentifierType > MyKey; - typedef std::map< MyKey, ObjVector > KeyToObjVectorMap; - typedef std::map< AbstractProduct*, MyKey > FetchedObjToKeyMap; - - MyFactory factory; - KeyToObjVectorMap fromKeyToObjVector; - FetchedObjToKeyMap providedObjects; - unsigned outObjects; - - ObjVector& getContainerFromKey(MyKey key){ - return fromKeyToObjVector[key]; - } - AbstractProduct* const getPointerToObjectInContainer(ObjVector &entry) - { - if(entry.empty()) // No object available - { // the object will be created in the calling function. - // It has to be created in the calling function because of - // the variable number of parameters for CreateObject(...) method - return NULL; - } - else - { // returning the found object - AbstractProduct* pObject(entry.back()); - assert(pObject!=NULL); - entry.pop_back(); - return pObject; - } - } - - bool shouldCreateObject(AbstractProduct * const pProduct){ - if(pProduct!=NULL) // object already exists - return false; - if(CP::canCreate()==false) // Are we allowed to Create ? - EP::evict(); // calling Eviction Policy to clean up - return true; - } - - void ReleaseObjectFromContainer(ObjVector &entry, AbstractProduct * const object) - { - entry.push_back(object); - } - - void onFetch(AbstractProduct * const pProduct) - { - SP::onFetch(); - EP::onFetch(pProduct); - ++outObjects; - } - - void onRelease(AbstractProduct * const pProduct) - { - SP::onRelease(); - EP::onRelease(pProduct); - --outObjects; - } - - void onCreate(AbstractProduct * const pProduct) - { - CP::onCreate(); - SP::onCreate(); - EP::onCreate(pProduct); - } - - void onDestroy(AbstractProduct * const pProduct) + // delete the objects in the vector + template<class T> struct deleteVectorObjects : public std::unary_function<T, void> + { + void operator()(T x) { - CP::onDestroy(); - SP::onDestroy(); - EP::onDestroy(pProduct); + ObjVector& vec(x.second); + std::for_each(vec.begin(), vec.end(), deleteObject< typename ObjVector::value_type>()); } - - // delete the object - template<class T> struct deleteObject : public std::unary_function<T, void> - { - void operator()(T x){ delete x; } - }; - - // delete the objects in the vector - template<class T> struct deleteVectorObjects : public std::unary_function<T, void> - { - void operator()(T x){ - ObjVector &vec(x.second); - std::for_each(vec.begin(), vec.end(), deleteObject< typename ObjVector::value_type>()); - } - }; - - // delete the keys of the map - template<class T> struct deleteMapKeys : public std::unary_function<T, void> - { - void operator()(T x){ delete x.first; } - }; - - protected: - virtual void remove(AbstractProduct * const pProduct) + }; + + // delete the keys of the map + template<class T> struct deleteMapKeys : public std::unary_function<T, void> + { + void operator()(T x) { delete x.first; } + }; + +protected: + virtual void remove(AbstractProduct* const pProduct) + { + typename FetchedObjToKeyMap::iterator fetchedItr = providedObjects.find(pProduct); + if(fetchedItr!=providedObjects.end()) // object is unreleased. + throw CacheException(); + bool productRemoved = false; + typename KeyToObjVectorMap::iterator objVectorItr; + typename ObjVector::iterator objItr; + for(objVectorItr=fromKeyToObjVector.begin(); objVectorItr!=fromKeyToObjVector.end(); ++objVectorItr) { - typename FetchedObjToKeyMap::iterator fetchedItr = providedObjects.find(pProduct); - if(fetchedItr!=providedObjects.end()) // object is unreleased. - throw CacheException(); - bool productRemoved = false; - typename KeyToObjVectorMap::iterator objVectorItr; - typename ObjVector::iterator objItr; - for(objVectorItr=fromKeyToObjVector.begin();objVectorItr!=fromKeyToObjVector.end();++objVectorItr) + ObjVector& v((*objVectorItr).second); + objItr = remove_if(v.begin(), v.end(), std::bind2nd(std::equal_to<AbstractProduct*>(), pProduct)); + if(objItr != v.end()) // we found the vector containing pProduct and removed it { - ObjVector &v((*objVectorItr).second); - objItr = remove_if(v.begin(), v.end(), std::bind2nd(std::equal_to<AbstractProduct*>(), pProduct)); - if(objItr != v.end()) // we found the vector containing pProduct and removed it - { - onDestroy(pProduct); // warning policies we are about to destroy an object - v.erase(objItr, v.end()); // real removing - productRemoved = true; - break; - } + onDestroy(pProduct); // warning policies we are about to destroy an object + v.erase(objItr, v.end()); // real removing + productRemoved = true; + break; } - if(productRemoved==false) - throw CacheException(); // the product is not in the cache ?! - delete pProduct; // deleting it } + if(productRemoved==false) + throw CacheException(); // the product is not in the cache ?! + delete pProduct; // deleting it + } - public: - CachedFactory() : factory(), fromKeyToObjVector(), providedObjects(), outObjects(0) - { - } +public: + CachedFactory() : factory(), fromKeyToObjVector(), providedObjects(), outObjects(0) + { + } - ~CachedFactory() - { - using namespace std; - // debug information - SP::onDebug(); - // cleaning the Cache - for_each(fromKeyToObjVector.begin(), fromKeyToObjVector.end(), - deleteVectorObjects< typename KeyToObjVectorMap::value_type >() - ); - if(!providedObjects.empty()) - { - // The factory is responsible for the creation and destruction of objects. - // If objects are out during the destruction of the Factory : deleting anyway. - // This might not be a good idea. But throwing an exception in a destructor is - // considered as a bad pratice and asserting might be too much. - // What to do ? Leaking memory or corrupting in use pointers ? hmm... - D( cout << "====>> Cache destructor : deleting "<< providedObjects.size()<<" in use objects <<====" << endl << endl; ) - for_each(providedObjects.begin(), providedObjects.end(), - deleteMapKeys< typename FetchedObjToKeyMap::value_type >() + ~CachedFactory() + { + using namespace std; + // debug information + SP::onDebug(); + // cleaning the Cache + for_each(fromKeyToObjVector.begin(), fromKeyToObjVector.end(), + deleteVectorObjects< typename KeyToObjVectorMap::value_type >() ); - } - } - - /////////////////////////////////// - // Acts as the proxy pattern and // - // forwards factory methods // - /////////////////////////////////// - - bool Register(const IdentifierType& id, ProductCreator creator) + if(!providedObjects.empty()) { - return factory.Register(id, creator); - } - - template <class PtrObj, typename CreaFn> - bool Register(const IdentifierType& id, const PtrObj& p, CreaFn fn) - { - return factory.Register(id, p, fn); - } - - bool Unregister(const IdentifierType& id) - { - return factory.Unregister(id); + // The factory is responsible for the creation and destruction of objects. + // If objects are out during the destruction of the Factory : deleting anyway. + // This might not be a good idea. But throwing an exception in a destructor is + // considered as a bad pratice and asserting might be too much. + // What to do ? Leaking memory or corrupting in use pointers ? hmm... + D( cout << "====>> Cache destructor : deleting "<< providedObjects.size()<<" in use objects <<====" << endl << endl; ) + for_each(providedObjects.begin(), providedObjects.end(), + deleteMapKeys< typename FetchedObjToKeyMap::value_type >() + ); } + } - /// Return the registered ID in this Factory - std::vector<IdentifierType>& RegisteredIds() - { - return factory.RegisteredIds(); - } + /////////////////////////////////// + // Acts as the proxy pattern and // + // forwards factory methods // + /////////////////////////////////// - ProductReturn CreateObject(const IdentifierType& id) - { - MyKey key(id); - AbstractProduct *pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); - if(shouldCreateObject(pProduct)) - { - pProduct = factory.CreateObject(key.id); - onCreate(pProduct); - } - onFetch(pProduct); - providedObjects[pProduct] = key; - return NP::encapsulate(pProduct); - } - - ProductReturn CreateObject(const IdentifierType& id, - Parm1 p1) - { - MyKey key(id,p1); - AbstractProduct *pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); - if(shouldCreateObject(pProduct)) - { - pProduct = factory.CreateObject(key.id,key.p1); - onCreate(pProduct); - } - onFetch(pProduct); - providedObjects[pProduct] = key; - return NP::encapsulate(pProduct); - } + bool Register(const IdentifierType& id, ProductCreator creator) + { + return factory.Register(id, creator); + } + + template <class PtrObj, typename CreaFn> + bool Register(const IdentifierType& id, const PtrObj& p, CreaFn fn) + { + return factory.Register(id, p, fn); + } + + bool Unregister(const IdentifierType& id) + { + return factory.Unregister(id); + } - ProductReturn CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2) + /// Return the registered ID in this Factory + std::vector<IdentifierType>& RegisteredIds() + { + return factory.RegisteredIds(); + } + + ProductReturn CreateObject(const IdentifierType& id) + { + MyKey key(id); + AbstractProduct* pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); + if(shouldCreateObject(pProduct)) { - MyKey key(id,p1,p2); - AbstractProduct *pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); - if(shouldCreateObject(pProduct)) - { - pProduct = factory.CreateObject(key.id,key.p1,key.p2); - onCreate(pProduct); - } - onFetch(pProduct); - providedObjects[pProduct] = key; - return NP::encapsulate(pProduct); + pProduct = factory.CreateObject(key.id); + onCreate(pProduct); } + onFetch(pProduct); + providedObjects[pProduct] = key; + return NP::encapsulate(pProduct); + } - ProductReturn CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3) + ProductReturn CreateObject(const IdentifierType& id, + Parm1 p1) + { + MyKey key(id,p1); + AbstractProduct* pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); + if(shouldCreateObject(pProduct)) { - MyKey key(id,p1,p2,p3); - AbstractProduct *pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); - if(shouldCreateObject(pProduct)) - { - pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3); - onCreate(pProduct); - } - onFetch(pProduct); - providedObjects[pProduct] = key; - return NP::encapsulate(pProduct); + pProduct = factory.CreateObject(key.id,key.p1); + onCreate(pProduct); } + onFetch(pProduct); + providedObjects[pProduct] = key; + return NP::encapsulate(pProduct); + } - ProductReturn CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4) + ProductReturn CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2) + { + MyKey key(id,p1,p2); + AbstractProduct* pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); + if(shouldCreateObject(pProduct)) { - MyKey key(id,p1,p2,p3,p4); - AbstractProduct *pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); - if(shouldCreateObject(pProduct)) - { - pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3 - ,key.p4); - onCreate(pProduct); - } - onFetch(pProduct); - providedObjects[pProduct] = key; - return NP::encapsulate(pProduct); + pProduct = factory.CreateObject(key.id,key.p1,key.p2); + onCreate(pProduct); } + onFetch(pProduct); + providedObjects[pProduct] = key; + return NP::encapsulate(pProduct); + } - ProductReturn CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5) + ProductReturn CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3) + { + MyKey key(id,p1,p2,p3); + AbstractProduct* pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); + if(shouldCreateObject(pProduct)) { - MyKey key(id,p1,p2,p3,p4,p5); - AbstractProduct *pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); - if(shouldCreateObject(pProduct)) - { - pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3 - ,key.p4,key.p5); - onCreate(pProduct); - } - onFetch(pProduct); - providedObjects[pProduct] = key; - return NP::encapsulate(pProduct); + pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3); + onCreate(pProduct); } + onFetch(pProduct); + providedObjects[pProduct] = key; + return NP::encapsulate(pProduct); + } - ProductReturn CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6) + ProductReturn CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4) + { + MyKey key(id,p1,p2,p3,p4); + AbstractProduct* pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); + if(shouldCreateObject(pProduct)) { - MyKey key(id,p1,p2,p3,p4,p5,p6); - AbstractProduct *pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); - if(shouldCreateObject(pProduct)) - { - pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3 - ,key.p4,key.p5,key.p6); - onCreate(pProduct); - } - onFetch(pProduct); - providedObjects[pProduct] = key; - return NP::encapsulate(pProduct); + pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3 + ,key.p4); + onCreate(pProduct); } + onFetch(pProduct); + providedObjects[pProduct] = key; + return NP::encapsulate(pProduct); + } - ProductReturn CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7 ) + ProductReturn CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5) + { + MyKey key(id,p1,p2,p3,p4,p5); + AbstractProduct* pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); + if(shouldCreateObject(pProduct)) { - MyKey key(id,p1,p2,p3,p4,p5,p6,p7); - AbstractProduct *pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); - if(shouldCreateObject(pProduct)) - { - pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3 - ,key.p4,key.p5,key.p6,key.p7); - onCreate(pProduct); - } - onFetch(pProduct); - providedObjects[pProduct] = key; - return NP::encapsulate(pProduct); + pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3 + ,key.p4,key.p5); + onCreate(pProduct); } + onFetch(pProduct); + providedObjects[pProduct] = key; + return NP::encapsulate(pProduct); + } - ProductReturn CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8) + ProductReturn CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6) + { + MyKey key(id,p1,p2,p3,p4,p5,p6); + AbstractProduct* pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); + if(shouldCreateObject(pProduct)) { - MyKey key(id,p1,p2,p3,p4,p5,p6,p7,p8); - AbstractProduct *pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); - if(shouldCreateObject(pProduct)) - { - pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3 - ,key.p4,key.p5,key.p6,key.p7,key.p8); - onCreate(pProduct); - } - onFetch(pProduct); - providedObjects[pProduct] = key; - return NP::encapsulate(pProduct); + pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3 + ,key.p4,key.p5,key.p6); + onCreate(pProduct); } + onFetch(pProduct); + providedObjects[pProduct] = key; + return NP::encapsulate(pProduct); + } - ProductReturn CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9) + ProductReturn CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7 ) + { + MyKey key(id,p1,p2,p3,p4,p5,p6,p7); + AbstractProduct* pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); + if(shouldCreateObject(pProduct)) { - MyKey key(id,p1,p2,p3,p4,p5,p6,p7,p8,p9); - AbstractProduct *pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); - if(shouldCreateObject(pProduct)) - { - pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3 - ,key.p4,key.p5,key.p6,key.p7,key.p8,key.p9); - onCreate(pProduct); - } - onFetch(pProduct); - providedObjects[pProduct] = key; - return NP::encapsulate(pProduct); + pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3 + ,key.p4,key.p5,key.p6,key.p7); + onCreate(pProduct); } - - ProductReturn CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9,Parm10 p10) + onFetch(pProduct); + providedObjects[pProduct] = key; + return NP::encapsulate(pProduct); + } + + ProductReturn CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8) + { + MyKey key(id,p1,p2,p3,p4,p5,p6,p7,p8); + AbstractProduct* pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); + if(shouldCreateObject(pProduct)) { - MyKey key(id,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10); - AbstractProduct *pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); - if(shouldCreateObject(pProduct)) - { - pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3 - ,key.p4,key.p5,key.p6,key.p7,key.p8,key.p9,key.p10); - onCreate(pProduct); - } - onFetch(pProduct); - providedObjects[pProduct] = key; - return NP::encapsulate(pProduct); + pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3 + ,key.p4,key.p5,key.p6,key.p7,key.p8); + onCreate(pProduct); } + onFetch(pProduct); + providedObjects[pProduct] = key; + return NP::encapsulate(pProduct); + } - ProductReturn CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, - Parm11 p11) + ProductReturn CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9) + { + MyKey key(id,p1,p2,p3,p4,p5,p6,p7,p8,p9); + AbstractProduct* pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); + if(shouldCreateObject(pProduct)) { - MyKey key(id,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11); - AbstractProduct *pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); - if(shouldCreateObject(pProduct)) - { - pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3 - ,key.p4,key.p5,key.p6,key.p7,key.p8,key.p9,key.p10,key.p11); - onCreate(pProduct); - } - onFetch(pProduct); - providedObjects[pProduct] = key; - return NP::encapsulate(pProduct); + pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3 + ,key.p4,key.p5,key.p6,key.p7,key.p8,key.p9); + onCreate(pProduct); } + onFetch(pProduct); + providedObjects[pProduct] = key; + return NP::encapsulate(pProduct); + } - ProductReturn CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, - Parm11 p11, Parm12 p12) + ProductReturn CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9,Parm10 p10) + { + MyKey key(id,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10); + AbstractProduct* pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); + if(shouldCreateObject(pProduct)) { - MyKey key(id,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12); - AbstractProduct *pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); - if(shouldCreateObject(pProduct)) - { - pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3 - ,key.p4,key.p5,key.p6,key.p7,key.p8,key.p9,key.p10,key.p11,key.p12); - onCreate(pProduct); - } - onFetch(pProduct); - providedObjects[pProduct] = key; - return NP::encapsulate(pProduct); + pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3 + ,key.p4,key.p5,key.p6,key.p7,key.p8,key.p9,key.p10); + onCreate(pProduct); } + onFetch(pProduct); + providedObjects[pProduct] = key; + return NP::encapsulate(pProduct); + } - ProductReturn CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, - Parm11 p11, Parm12 p12, Parm13 p13) + ProductReturn CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, + Parm11 p11) + { + MyKey key(id,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11); + AbstractProduct* pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); + if(shouldCreateObject(pProduct)) { - MyKey key(id,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13); - AbstractProduct *pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); - if(shouldCreateObject(pProduct)) - { - pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3 - ,key.p4,key.p5,key.p6,key.p7,key.p8,key.p9,key.p10,key.p11,key.p12 - ,key.p13); - onCreate(pProduct); - } - onFetch(pProduct); - providedObjects[pProduct] = key; - return NP::encapsulate(pProduct); + pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3 + ,key.p4,key.p5,key.p6,key.p7,key.p8,key.p9,key.p10,key.p11); + onCreate(pProduct); } + onFetch(pProduct); + providedObjects[pProduct] = key; + return NP::encapsulate(pProduct); + } - ProductReturn CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, - Parm11 p11, Parm12 p12, Parm13 p13, Parm14 p14) + ProductReturn CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, + Parm11 p11, Parm12 p12) + { + MyKey key(id,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12); + AbstractProduct* pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); + if(shouldCreateObject(pProduct)) { - MyKey key(id,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14); - AbstractProduct *pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); - if(shouldCreateObject(pProduct)) - { - pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3 - ,key.p4,key.p5,key.p6,key.p7,key.p8,key.p9,key.p10,key.p11,key.p12 - ,key.p13,key.p14); - onCreate(pProduct); - } - onFetch(pProduct); - providedObjects[pProduct] = key; - return NP::encapsulate(pProduct); + pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3 + ,key.p4,key.p5,key.p6,key.p7,key.p8,key.p9,key.p10,key.p11,key.p12); + onCreate(pProduct); } + onFetch(pProduct); + providedObjects[pProduct] = key; + return NP::encapsulate(pProduct); + } - ProductReturn CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, - Parm11 p11, Parm12 p12, Parm13 p13, Parm14 p14, Parm15 p15) + ProductReturn CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, + Parm11 p11, Parm12 p12, Parm13 p13) + { + MyKey key(id,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13); + AbstractProduct* pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); + if(shouldCreateObject(pProduct)) { - MyKey key(id,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15); - AbstractProduct *pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); - if(shouldCreateObject(pProduct)) - { - pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3 - ,key.p4,key.p5,key.p6,key.p7,key.p8,key.p9,key.p10,key.p11,key.p12 - ,key.p13,key.p14,key.p15); - onCreate(pProduct); - } - onFetch(pProduct); - providedObjects[pProduct] = key; - return NP::encapsulate(pProduct); + pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3 + ,key.p4,key.p5,key.p6,key.p7,key.p8,key.p9,key.p10,key.p11,key.p12 + ,key.p13); + onCreate(pProduct); } + onFetch(pProduct); + providedObjects[pProduct] = key; + return NP::encapsulate(pProduct); + } - /// Use this function to release the object - /** - * if execution brakes in this function then you tried - * to release an object that wasn't provided by this Cache - * ... which is bad :-) - */ - void ReleaseObject(ProductReturn &object) + ProductReturn CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, + Parm11 p11, Parm12 p12, Parm13 p13, Parm14 p14) + { + MyKey key(id,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14); + AbstractProduct* pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); + if(shouldCreateObject(pProduct)) { - AbstractProduct* pProduct(NP::release(object)); - typename FetchedObjToKeyMap::iterator itr = providedObjects.find(pProduct); - if(itr == providedObjects.end()) - throw CacheException(); - onRelease(pProduct); - ReleaseObjectFromContainer(getContainerFromKey((*itr).second), pProduct); - providedObjects.erase(itr); + pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3 + ,key.p4,key.p5,key.p6,key.p7,key.p8,key.p9,key.p10,key.p11,key.p12 + ,key.p13,key.p14); + onCreate(pProduct); } - - /// display the cache configuration - void displayCacheType() + onFetch(pProduct); + providedObjects[pProduct] = key; + return NP::encapsulate(pProduct); + } + + ProductReturn CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, + Parm11 p11, Parm12 p12, Parm13 p13, Parm14 p14, Parm15 p15) + { + MyKey key(id,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15); + AbstractProduct* pProduct(getPointerToObjectInContainer(getContainerFromKey(key))); + if(shouldCreateObject(pProduct)) { - using namespace std; - cout << "############################" << endl; - cout << "## Cache configuration" << endl; - cout << "## + Encapsulation " << NP::name() << endl; - cout << "## + Creating " << CP::name() << endl; - cout << "## + Eviction " << EP::name() << endl; - cout << "## + Statistics " << SP::name() << endl; - cout << "############################" << endl; + pProduct = factory.CreateObject(key.id,key.p1,key.p2,key.p3 + ,key.p4,key.p5,key.p6,key.p7,key.p8,key.p9,key.p10,key.p11,key.p12 + ,key.p13,key.p14,key.p15); + onCreate(pProduct); } - }; + onFetch(pProduct); + providedObjects[pProduct] = key; + return NP::encapsulate(pProduct); + } + + /// Use this function to release the object + /** + * if execution brakes in this function then you tried + * to release an object that wasn't provided by this Cache + * ... which is bad :-) + */ + void ReleaseObject(ProductReturn& object) + { + AbstractProduct* pProduct(NP::release(object)); + typename FetchedObjToKeyMap::iterator itr = providedObjects.find(pProduct); + if(itr == providedObjects.end()) + throw CacheException(); + onRelease(pProduct); + ReleaseObjectFromContainer(getContainerFromKey((*itr).second), pProduct); + providedObjects.erase(itr); + } + + /// display the cache configuration + void displayCacheType() + { + using namespace std; + cout << "############################" << endl; + cout << "## Cache configuration" << endl; + cout << "## + Encapsulation " << NP::name() << endl; + cout << "## + Creating " << CP::name() << endl; + cout << "## + Eviction " << EP::name() << endl; + cout << "## + Statistics " << SP::name() << endl; + cout << "############################" << endl; + } +}; } // namespace Loki #endif // end file guardian diff --git a/shared/loki/CheckReturn.h b/shared/loki/CheckReturn.h index fbe63ed0..c0a65aa5 100644 --- a/shared/loki/CheckReturn.h +++ b/shared/loki/CheckReturn.h @@ -65,46 +65,46 @@ namespace Loki template<class T> struct IgnoreReturnValue { - static void run(const T&) - { - /// Do nothing at all. - } + static void run(const T&) + { + /// Do nothing at all. + } }; template<class T> struct ThrowTheValue { - static void run(const T & value ) - { - throw value; - } + static void run(const T& value ) + { + throw value; + } }; template<class T> struct ThrowLogicError { - static void run( const T & ) - { - throw ::std::logic_error( "CheckReturn: return value was not checked.\n" ); - } + static void run( const T& ) + { + throw ::std::logic_error( "CheckReturn: return value was not checked.\n" ); + } }; template<class T> struct TriggerAssert { - static void run(const T&) - { - assert( 0 ); - } + static void run(const T&) + { + assert( 0 ); + } }; template<class T> struct FprintfStderr { - static void run(const T&) - { - fprintf(stderr, "CheckReturn: return value was not checked.\n"); - } + static void run(const T&) + { + fprintf(stderr, "CheckReturn: return value was not checked.\n"); + } }; @@ -114,45 +114,45 @@ class CheckReturn { public: - /// Conversion constructor changes Value type to CheckReturn type. - inline CheckReturn( const Value & value ) : - m_value( value ), m_checked( false ) {} - - /// Copy-constructor allows functions to call another function within the - /// return statement. The other CheckReturn's m_checked flag is set since - /// its duty has been passed to the m_checked flag in this one. - inline CheckReturn( const CheckReturn & that ) : - m_value( that.m_value ), m_checked( false ) - { that.m_checked = true; } - - /// Destructor checks if return value was used. - inline ~CheckReturn( void ) - { - // If m_checked is false, then a function failed to check the - // return value from a function call. - if (!m_checked) - OnError<Value>::run(m_value); - } - - /// Conversion operator changes CheckReturn back to Value type. - inline operator Value ( void ) - { - m_checked = true; - return m_value; - } + /// Conversion constructor changes Value type to CheckReturn type. + inline CheckReturn( const Value& value ) : + m_value( value ), m_checked( false ) {} + + /// Copy-constructor allows functions to call another function within the + /// return statement. The other CheckReturn's m_checked flag is set since + /// its duty has been passed to the m_checked flag in this one. + inline CheckReturn( const CheckReturn& that ) : + m_value( that.m_value ), m_checked( false ) + { that.m_checked = true; } + + /// Destructor checks if return value was used. + inline ~CheckReturn( void ) + { + // If m_checked is false, then a function failed to check the + // return value from a function call. + if (!m_checked) + OnError<Value>::run(m_value); + } + + /// Conversion operator changes CheckReturn back to Value type. + inline operator Value ( void ) + { + m_checked = true; + return m_value; + } private: - /// Default constructor not implemented. - CheckReturn( void ); + /// Default constructor not implemented. + CheckReturn( void ); - /// Copy-assignment operator not implemented. - CheckReturn & operator = ( const CheckReturn & that ); + /// Copy-assignment operator not implemented. + CheckReturn& operator = ( const CheckReturn& that ); - /// Copy of returned value. - Value m_value; + /// Copy of returned value. + Value m_value; - /// Flag for whether calling function checked return value yet. - mutable bool m_checked; + /// Flag for whether calling function checked return value yet. + mutable bool m_checked; }; // ---------------------------------------------------------------------------- diff --git a/shared/loki/Checker.h b/shared/loki/Checker.h index 19350679..64579d2f 100644 --- a/shared/loki/Checker.h +++ b/shared/loki/Checker.h @@ -86,9 +86,9 @@ class CheckForNoThrow { public: - inline explicit CheckForNoThrow( const Host * ) {} + inline explicit CheckForNoThrow( const Host* ) {} - inline bool Check( const Host * ) const + inline bool Check( const Host* ) const { const bool okay = ( !::std::uncaught_exception() ); assert( okay ); @@ -117,13 +117,13 @@ class CheckForNoChange { public: - inline explicit CheckForNoChange( const Host * host ) : + inline explicit CheckForNoChange( const Host* host ) : m_compare( *host ) {} - inline bool Check( const Host * host ) const + inline bool Check( const Host* host ) const { const bool okay = ( !::std::uncaught_exception() ) - || ( m_compare == *host ); + || ( m_compare == *host ); assert( okay ); return okay; } @@ -152,10 +152,10 @@ class CheckForNoChangeOrThrow { public: - inline explicit CheckForNoChangeOrThrow( const Host * host ) : + inline explicit CheckForNoChangeOrThrow( const Host* host ) : m_compare( *host ) {} - inline bool Check( const Host * host ) const + inline bool Check( const Host* host ) const { bool okay = ( !::std::uncaught_exception() ); assert( okay ); @@ -187,10 +187,10 @@ class CheckForEquality { public: - inline explicit CheckForEquality( const Host * host ) : + inline explicit CheckForEquality( const Host* host ) : m_compare( *host ) {} - inline bool Check( const Host * host ) const + inline bool Check( const Host* host ) const { const bool okay = ( m_compare == *host ); assert( okay ); @@ -219,8 +219,8 @@ template < class Host > class CheckForNothing { public: - inline explicit CheckForNothing( const Host * ) {} - inline bool Check( const Host * ) const { return true; } + inline explicit CheckForNothing( const Host* ) {} + inline bool Check( const Host* ) const { return true; } }; // ---------------------------------------------------------------------------- @@ -271,9 +271,9 @@ public: template < - class Host, - template < class > class ExceptionPolicy -> +class Host, + template < class > class ExceptionPolicy + > class ContractChecker : public ExceptionPolicy< Host > { /// Shorthand for the ExceptionPolicy class. @@ -291,8 +291,8 @@ public: @par pre Optional pointer to function that checks pre-conditions. @par post Optional pointer to function that checks post-conditions. */ - inline ContractChecker( const Host * host, Validator validator, - Validator pre = 0, Validator post = 0 ) : + inline ContractChecker( const Host* host, Validator validator, + Validator pre = 0, Validator post = 0 ) : Ep( host ), m_host( host ), m_validator( validator ), @@ -342,12 +342,12 @@ private: /// Default constructor is not implemented. ContractChecker( void ); /// Copy constructor is not implemented. - ContractChecker( const ContractChecker & ); + ContractChecker( const ContractChecker& ); /// Copy-assignment operator is not implemented. - ContractChecker & operator = ( const ContractChecker & ); + ContractChecker& operator = ( const ContractChecker& ); /// Pointer to the host object. - const Host * m_host; + const Host* m_host; /// Pointer to member function that checks Host object's invariants. Validator m_validator; @@ -428,7 +428,7 @@ public: template < - class ExceptionPolicy +class ExceptionPolicy > class StaticChecker : public ExceptionPolicy { @@ -447,7 +447,7 @@ public: @par post Optional pointer to function that checks post-conditions. */ inline explicit StaticChecker( Validator validator, - Validator pre = 0, Validator post = 0 ) : + Validator pre = 0, Validator post = 0 ) : Ep(), m_validator( validator ), m_pre( pre ), @@ -494,9 +494,9 @@ private: /// Default constructor is not implemented. StaticChecker( void ); /// Copy constructor is not implemented. - StaticChecker( const StaticChecker & ); + StaticChecker( const StaticChecker& ); /// Copy-assignment operator is not implemented. - StaticChecker & operator = ( const StaticChecker & ); + StaticChecker& operator = ( const StaticChecker& ); /// Pointer to member function that checks Host object's invariants. Validator m_validator; diff --git a/shared/loki/ConstPolicy.h b/shared/loki/ConstPolicy.h index 74c9e5aa..1adb227a 100644 --- a/shared/loki/ConstPolicy.h +++ b/shared/loki/ConstPolicy.h @@ -2,12 +2,12 @@ // The Loki Library // Copyright (c) 2006 Richard Sposato // Copyright (c) 2006 Peter Kümmel -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The authors make no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The authors make no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_CONST_POLICY_INC_ @@ -32,11 +32,11 @@ namespace Loki /// Don't propagate constness of pointed or referred object. //////////////////////////////////////////////////////////////////////////////// - template< class T > - struct DontPropagateConst - { - typedef T Type; - }; +template< class T > +struct DontPropagateConst +{ + typedef T Type; +}; //////////////////////////////////////////////////////////////////////////////// /// \class PropagateConst @@ -45,11 +45,11 @@ namespace Loki /// Propagate constness of pointed or referred object. //////////////////////////////////////////////////////////////////////////////// - template< class T > - struct PropagateConst - { - typedef const T Type; - }; +template< class T > +struct PropagateConst +{ + typedef const T Type; +}; // default will not break existing code #ifndef LOKI_DEFAULT_CONSTNESS diff --git a/shared/loki/DataGenerators.h b/shared/loki/DataGenerators.h index 1c8e2df0..7ac697af 100644 --- a/shared/loki/DataGenerators.h +++ b/shared/loki/DataGenerators.h @@ -2,7 +2,7 @@ // The Loki Library // Data Generator by Shannon Barber // This code DOES NOT accompany the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. // // Code covered by the MIT License @@ -44,69 +44,69 @@ gendata(std::back_inserter(stuff)); *******************************************************************************/ namespace Loki { - namespace TL - { - template<typename T> - struct nameof_type - { - const char* operator()() - { - return typeid(T).name(); - } - }; - template<typename T> - struct sizeof_type - { - size_t operator()() - { - return sizeof(T); - } - }; - template <class TList, template <class> class GenFunc> - struct IterateTypes; - - template <class T1, class T2, template <class> class GenFunc> - struct IterateTypes<Typelist<T1, T2>, GenFunc> +namespace TL +{ +template<typename T> +struct nameof_type +{ + const char* operator()() + { + return typeid(T).name(); + } +}; +template<typename T> +struct sizeof_type +{ + size_t operator()() { + return sizeof(T); + } +}; +template <class TList, template <class> class GenFunc> +struct IterateTypes; + +template <class T1, class T2, template <class> class GenFunc> +struct IterateTypes<Typelist<T1, T2>, GenFunc> +{ typedef IterateTypes<T1, GenFunc> head_t; head_t head; typedef IterateTypes<T2, GenFunc> tail_t; tail_t tail; template<class II> void operator()(II ii) - { + { head.operator()(ii); tail.operator()(ii); - } - }; - - template <class AtomicType, template <class> class GenFunc> - struct IterateTypes - { + } +}; + +template <class AtomicType, template <class> class GenFunc> +struct IterateTypes +{ template<class II> void operator()(II ii) - { + { GenFunc<AtomicType> genfunc; *ii = genfunc(); ++ii; //Is this even needed? - } - }; - - template <template <class> class GenFunc> - struct IterateTypes<NullType, GenFunc> - { + } +}; + +template <template <class> class GenFunc> +struct IterateTypes<NullType, GenFunc> +{ template<class II> void operator()(II ii) - {} - }; - - template<typename Types, template <class> class UnitFunc, typename II> - void iterate_types(II ii) - { - Loki::TL::IterateTypes<Types, UnitFunc> it; - it(ii); - } - }//ns TL + {} +}; + +template<typename Types, template <class> class UnitFunc, typename II> +void iterate_types(II ii) +{ + Loki::TL::IterateTypes<Types, UnitFunc> it; + it(ii); +} +}//ns TL }//ns Loki #endif // end file guardian diff --git a/shared/loki/EmptyType.h b/shared/loki/EmptyType.h index b228e2e8..0f60c894 100644 --- a/shared/loki/EmptyType.h +++ b/shared/loki/EmptyType.h @@ -2,14 +2,14 @@ // The Loki Library // Copyright (c) 2001 by Andrei Alexandrescu // This code accompanies the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author or Addison-Wesley Longman make no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author or Addison-Wesley Longman make no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_EMPTYTYPE_INC_ @@ -26,23 +26,23 @@ namespace Loki // Useful as a strawman class //////////////////////////////////////////////////////////////////////////////// - class EmptyType {}; - - - inline bool operator==(const EmptyType&, const EmptyType&) - { - return true; - } - - inline bool operator<(const EmptyType&, const EmptyType&) - { - return false; - } - - inline bool operator>(const EmptyType&, const EmptyType&) - { - return false; - } +class EmptyType {}; + + +inline bool operator==(const EmptyType&, const EmptyType&) +{ + return true; +} + +inline bool operator<(const EmptyType&, const EmptyType&) +{ + return false; +} + +inline bool operator>(const EmptyType&, const EmptyType&) +{ + return false; +} } #endif // end file guardian diff --git a/shared/loki/Factory.h b/shared/loki/Factory.h index c4c3b22a..6a1ac6b7 100644 --- a/shared/loki/Factory.h +++ b/shared/loki/Factory.h @@ -33,7 +33,7 @@ * \defgroup FactoryGroup Factory * \ingroup FactoriesGroup * \brief Implements a generic object factory. - * + * * <i>The Factory Method pattern is an object-oriented design pattern. * Like other creational patterns, it deals with the problem of creating objects * (products) without specifying the exact class of object that will be created. @@ -46,7 +46,7 @@ * whose main purpose is creation of objects.</i> * <div ALIGN="RIGHT"><a href="http://en.wikipedia.org/wiki/Factory_method_pattern"> * Wikipedia</a></div> - * + * * Loki proposes a generic version of the Factory. Here is a typical use.<br> * <code><br> * 1. Factory< AbstractProduct, int > aFactory;<br> @@ -62,7 +62,7 @@ * ProductCreator by registering them into the Factory.<br> * A ProductCreator is a just a function that will return the right object. ie <br> * <code> - * Product* createProductNull()<br> + * Product* createProductNull()<br> * {<br> * return new Product<br> * }<br> @@ -80,27 +80,27 @@ namespace Loki * \defgroup FactoryErrorPoliciesGroup Factory Error Policies * \ingroup FactoryGroup * \brief Manages the "Unknown Type" error in an object factory - * + * * \class DefaultFactoryError * \ingroup FactoryErrorPoliciesGroup - * \brief Default policy that throws an exception - * + * \brief Default policy that throws an exception + * */ - template <typename IdentifierType, class AbstractProduct> - struct DefaultFactoryError +template <typename IdentifierType, class AbstractProduct> +struct DefaultFactoryError +{ + struct Exception : public std::exception { - struct Exception : public std::exception - { - const char* what() const throw() { return "Unknown Type"; } - }; - - static AbstractProduct* OnUnknownType(IdentifierType) - { - throw Exception(); - } + const char* what() const throw() { return "Unknown Type"; } }; + static AbstractProduct* OnUnknownType(IdentifierType) + { + throw Exception(); + } +}; + #define LOKI_ENABLE_NEW_FACTORY_CODE #ifdef LOKI_ENABLE_NEW_FACTORY_CODE @@ -110,911 +110,911 @@ namespace Loki // class template FunctorImpl //////////////////////////////////////////////////////////////////////////////// - struct FactoryImplBase - { - typedef EmptyType Parm1; - typedef EmptyType Parm2; - typedef EmptyType Parm3; - typedef EmptyType Parm4; - typedef EmptyType Parm5; - typedef EmptyType Parm6; - typedef EmptyType Parm7; - typedef EmptyType Parm8; - typedef EmptyType Parm9; - typedef EmptyType Parm10; - typedef EmptyType Parm11; - typedef EmptyType Parm12; - typedef EmptyType Parm13; - typedef EmptyType Parm14; - typedef EmptyType Parm15; - }; - - template <typename AP, typename Id, typename TList > - struct FactoryImpl; - - template<typename AP, typename Id> - struct FactoryImpl<AP, Id, NullType> - : public FactoryImplBase - { - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id & id ) = 0; - }; +struct FactoryImplBase +{ + typedef EmptyType Parm1; + typedef EmptyType Parm2; + typedef EmptyType Parm3; + typedef EmptyType Parm4; + typedef EmptyType Parm5; + typedef EmptyType Parm6; + typedef EmptyType Parm7; + typedef EmptyType Parm8; + typedef EmptyType Parm9; + typedef EmptyType Parm10; + typedef EmptyType Parm11; + typedef EmptyType Parm12; + typedef EmptyType Parm13; + typedef EmptyType Parm14; + typedef EmptyType Parm15; +}; + +template <typename AP, typename Id, typename TList > +struct FactoryImpl; + +template<typename AP, typename Id> +struct FactoryImpl<AP, Id, NullType> + : public FactoryImplBase +{ + virtual ~FactoryImpl() {} + virtual AP* CreateObject(const Id& id ) = 0; +}; template <typename AP, typename Id, typename P1 > - struct FactoryImpl<AP,Id, Seq<P1> > - : public FactoryImplBase - { - typedef typename TypeTraits<P1>::ParameterType Parm1; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1 ) = 0; - }; +struct FactoryImpl<AP,Id, Seq<P1> > + : public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + virtual ~FactoryImpl() {} + virtual AP* CreateObject(const Id& id,Parm1 ) = 0; +}; + +template<typename AP, typename Id, typename P1,typename P2 > +struct FactoryImpl<AP, Id, Seq<P1, P2> > + : public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + virtual ~FactoryImpl() {} + virtual AP* CreateObject(const Id& id,Parm1, Parm2 ) = 0; +}; + +template<typename AP, typename Id, typename P1,typename P2,typename P3 > +struct FactoryImpl<AP, Id, Seq<P1, P2, P3> > + : public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + virtual ~FactoryImpl() {} + virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3 ) = 0; +}; + +template<typename AP, typename Id, typename P1,typename P2,typename P3,typename P4 > +struct FactoryImpl<AP, Id, Seq<P1, P2, P3, P4> > + : public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + virtual ~FactoryImpl() {} + virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4 ) = 0; +}; + +template<typename AP, typename Id, + typename P1,typename P2,typename P3,typename P4,typename P5 > +struct FactoryImpl<AP, Id, Seq<P1, P2, P3, P4, P5> > + : public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + virtual ~FactoryImpl() {} + virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5 ) = 0; +}; + +template<typename AP, typename Id, + typename P1,typename P2,typename P3,typename P4,typename P5, + typename P6> +struct FactoryImpl<AP, Id, Seq<P1, P2, P3, P4, P5, P6> > + : public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + virtual ~FactoryImpl() {} + virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, + Parm6 ) + = 0; +}; + +template<typename AP, typename Id, + typename P1,typename P2,typename P3,typename P4,typename P5, + typename P6,typename P7> +struct FactoryImpl<AP, Id, Seq<P1, P2, P3, P4, P5, P6, P7> > + : public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + virtual ~FactoryImpl() {} + virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, + Parm6, Parm7 ) + = 0; +}; + +template<typename AP, typename Id, + typename P1,typename P2,typename P3,typename P4,typename P5, + typename P6,typename P7,typename P8> +struct FactoryImpl<AP, Id, Seq<P1, P2, P3, P4, P5, P6, P7, P8> > + : public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + virtual ~FactoryImpl() {} + virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, + Parm6, Parm7, Parm8) + = 0; +}; + +template<typename AP, typename Id, + typename P1,typename P2,typename P3,typename P4,typename P5, + typename P6,typename P7,typename P8,typename P9> +struct FactoryImpl<AP, Id, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9> > + : public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + virtual ~FactoryImpl() {} + virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, + Parm6, Parm7, Parm8, Parm9) + = 0; +}; + +template<typename AP, typename Id, + typename P1,typename P2,typename P3,typename P4,typename P5, + typename P6,typename P7,typename P8,typename P9,typename P10> +struct FactoryImpl<AP, Id, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10> > + : public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + typedef typename TypeTraits<P10>::ParameterType Parm10; + virtual ~FactoryImpl() {} + virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, + Parm6, Parm7, Parm8, Parm9,Parm10) + = 0; +}; + +template<typename AP, typename Id, + typename P1,typename P2,typename P3,typename P4,typename P5, + typename P6,typename P7,typename P8,typename P9,typename P10, + typename P11> +struct FactoryImpl<AP, Id, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11> > + : public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + typedef typename TypeTraits<P10>::ParameterType Parm10; + typedef typename TypeTraits<P11>::ParameterType Parm11; + virtual ~FactoryImpl() {} + virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, + Parm6, Parm7, Parm8, Parm9,Parm10, + Parm11) + = 0; +}; + +template<typename AP, typename Id, + typename P1,typename P2,typename P3,typename P4,typename P5, + typename P6,typename P7,typename P8,typename P9,typename P10, + typename P11,typename P12> +struct FactoryImpl<AP, Id, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12> > + : public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + typedef typename TypeTraits<P10>::ParameterType Parm10; + typedef typename TypeTraits<P11>::ParameterType Parm11; + typedef typename TypeTraits<P12>::ParameterType Parm12; + virtual ~FactoryImpl() {} + virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, + Parm6, Parm7, Parm8, Parm9,Parm10, + Parm11,Parm12) + = 0; +}; + +template<typename AP, typename Id, + typename P1,typename P2,typename P3,typename P4,typename P5, + typename P6,typename P7,typename P8,typename P9,typename P10, + typename P11,typename P12,typename P13> +struct FactoryImpl<AP, Id, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13> > + : public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + typedef typename TypeTraits<P10>::ParameterType Parm10; + typedef typename TypeTraits<P11>::ParameterType Parm11; + typedef typename TypeTraits<P12>::ParameterType Parm12; + typedef typename TypeTraits<P13>::ParameterType Parm13; + virtual ~FactoryImpl() {} + virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, + Parm6, Parm7, Parm8, Parm9,Parm10, + Parm11,Parm12,Parm13) + = 0; +}; + +template<typename AP, typename Id, + typename P1,typename P2,typename P3,typename P4,typename P5, + typename P6,typename P7,typename P8,typename P9,typename P10, + typename P11,typename P12,typename P13,typename P14> +struct FactoryImpl<AP, Id, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14> > + : public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + typedef typename TypeTraits<P10>::ParameterType Parm10; + typedef typename TypeTraits<P11>::ParameterType Parm11; + typedef typename TypeTraits<P12>::ParameterType Parm12; + typedef typename TypeTraits<P13>::ParameterType Parm13; + typedef typename TypeTraits<P14>::ParameterType Parm14; + virtual ~FactoryImpl() {} + virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, + Parm6, Parm7, Parm8, Parm8,Parm10, + Parm11,Parm12,Parm13,Parm14) + = 0; +}; + +template<typename AP, typename Id, + typename P1,typename P2,typename P3,typename P4,typename P5, + typename P6,typename P7,typename P8,typename P9,typename P10, + typename P11,typename P12,typename P13,typename P14,typename P15 > +struct FactoryImpl<AP, Id, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15> > + : public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + typedef typename TypeTraits<P10>::ParameterType Parm10; + typedef typename TypeTraits<P11>::ParameterType Parm11; + typedef typename TypeTraits<P12>::ParameterType Parm12; + typedef typename TypeTraits<P13>::ParameterType Parm13; + typedef typename TypeTraits<P14>::ParameterType Parm14; + typedef typename TypeTraits<P15>::ParameterType Parm15; + virtual ~FactoryImpl() {} + virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, + Parm6, Parm7, Parm8, Parm9,Parm10, + Parm11,Parm12,Parm13,Parm14,Parm15 ) + = 0; +}; - template<typename AP, typename Id, typename P1,typename P2 > - struct FactoryImpl<AP, Id, Seq<P1, P2> > - : public FactoryImplBase - { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2 ) = 0; - }; +#ifndef LOKI_DISABLE_TYPELIST_MACROS - template<typename AP, typename Id, typename P1,typename P2,typename P3 > - struct FactoryImpl<AP, Id, Seq<P1, P2, P3> > - : public FactoryImplBase - { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3 ) = 0; - }; +template <typename AP, typename Id, typename P1 > +struct FactoryImpl<AP,Id, LOKI_TYPELIST_1( P1 )> +: public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; +virtual ~FactoryImpl() {} +virtual AP* CreateObject(const Id& id,Parm1 ) = 0; +}; + +template<typename AP, typename Id, typename P1,typename P2 > +struct FactoryImpl<AP, Id, LOKI_TYPELIST_2( P1, P2 )> +: public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; +virtual ~FactoryImpl() {} +virtual AP* CreateObject(const Id& id,Parm1, Parm2 ) = 0; +}; + +template<typename AP, typename Id, typename P1,typename P2,typename P3 > +struct FactoryImpl<AP, Id, LOKI_TYPELIST_3( P1, P2, P3 )> +: public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; +virtual ~FactoryImpl() {} +virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3 ) = 0; +}; + +template<typename AP, typename Id, typename P1,typename P2,typename P3,typename P4 > +struct FactoryImpl<AP, Id, LOKI_TYPELIST_4( P1, P2, P3, P4 )> +: public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; +virtual ~FactoryImpl() {} +virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4 ) = 0; +}; + +template<typename AP, typename Id, + typename P1,typename P2,typename P3,typename P4,typename P5 > +struct FactoryImpl<AP, Id, LOKI_TYPELIST_5( P1, P2, P3, P4, P5 )> +: public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; +virtual ~FactoryImpl() {} +virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5 ) = 0; +}; + +template<typename AP, typename Id, + typename P1,typename P2,typename P3,typename P4,typename P5, + typename P6> +struct FactoryImpl<AP, Id, LOKI_TYPELIST_6( P1, P2, P3, P4, P5, P6 )> +: public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; +virtual ~FactoryImpl() {} +virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, + Parm6 ) += 0; +}; + +template<typename AP, typename Id, + typename P1,typename P2,typename P3,typename P4,typename P5, + typename P6,typename P7> +struct FactoryImpl<AP, Id, LOKI_TYPELIST_7( P1, P2, P3, P4, P5, P6, P7 )> +: public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; +virtual ~FactoryImpl() {} +virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, + Parm6, Parm7 ) += 0; +}; + +template<typename AP, typename Id, + typename P1,typename P2,typename P3,typename P4,typename P5, + typename P6,typename P7,typename P8> +struct FactoryImpl<AP, Id, LOKI_TYPELIST_8( P1, P2, P3, P4, P5, P6, P7, P8 )> +: public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; +virtual ~FactoryImpl() {} +virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, + Parm6, Parm7, Parm8) += 0; +}; + +template<typename AP, typename Id, + typename P1,typename P2,typename P3,typename P4,typename P5, + typename P6,typename P7,typename P8,typename P9> +struct FactoryImpl<AP, Id, LOKI_TYPELIST_9( P1, P2, P3, P4, P5, P6, P7, P8, P9 )> +: public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; +virtual ~FactoryImpl() {} +virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, + Parm6, Parm7, Parm8, Parm9) += 0; +}; + +template<typename AP, typename Id, + typename P1,typename P2,typename P3,typename P4,typename P5, + typename P6,typename P7,typename P8,typename P9,typename P10> +struct FactoryImpl<AP, Id, LOKI_TYPELIST_10( P1, P2, P3, P4, P5, P6, P7, P8, P9, P10 )> +: public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + typedef typename TypeTraits<P10>::ParameterType Parm10; +virtual ~FactoryImpl() {} +virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, + Parm6, Parm7, Parm8, Parm9,Parm10) += 0; +}; + +template<typename AP, typename Id, + typename P1,typename P2,typename P3,typename P4,typename P5, + typename P6,typename P7,typename P8,typename P9,typename P10, + typename P11> +struct FactoryImpl<AP, Id, LOKI_TYPELIST_11( P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11 )> +: public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + typedef typename TypeTraits<P10>::ParameterType Parm10; + typedef typename TypeTraits<P11>::ParameterType Parm11; +virtual ~FactoryImpl() {} +virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, + Parm6, Parm7, Parm8, Parm9,Parm10, + Parm11) += 0; +}; + +template<typename AP, typename Id, + typename P1,typename P2,typename P3,typename P4,typename P5, + typename P6,typename P7,typename P8,typename P9,typename P10, + typename P11,typename P12> +struct FactoryImpl<AP, Id, LOKI_TYPELIST_12( P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12 )> +: public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + typedef typename TypeTraits<P10>::ParameterType Parm10; + typedef typename TypeTraits<P11>::ParameterType Parm11; + typedef typename TypeTraits<P12>::ParameterType Parm12; +virtual ~FactoryImpl() {} +virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, + Parm6, Parm7, Parm8, Parm9,Parm10, + Parm11,Parm12) += 0; +}; + +template<typename AP, typename Id, + typename P1,typename P2,typename P3,typename P4,typename P5, + typename P6,typename P7,typename P8,typename P9,typename P10, + typename P11,typename P12,typename P13> +struct FactoryImpl<AP, Id, LOKI_TYPELIST_13( P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13 )> +: public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + typedef typename TypeTraits<P10>::ParameterType Parm10; + typedef typename TypeTraits<P11>::ParameterType Parm11; + typedef typename TypeTraits<P12>::ParameterType Parm12; + typedef typename TypeTraits<P13>::ParameterType Parm13; +virtual ~FactoryImpl() {} +virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, + Parm6, Parm7, Parm8, Parm9,Parm10, + Parm11,Parm12,Parm13) += 0; +}; + +template<typename AP, typename Id, + typename P1,typename P2,typename P3,typename P4,typename P5, + typename P6,typename P7,typename P8,typename P9,typename P10, + typename P11,typename P12,typename P13,typename P14> +struct FactoryImpl<AP, Id, LOKI_TYPELIST_14( P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14 )> +: public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + typedef typename TypeTraits<P10>::ParameterType Parm10; + typedef typename TypeTraits<P11>::ParameterType Parm11; + typedef typename TypeTraits<P12>::ParameterType Parm12; + typedef typename TypeTraits<P13>::ParameterType Parm13; + typedef typename TypeTraits<P14>::ParameterType Parm14; +virtual ~FactoryImpl() {} +virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, + Parm6, Parm7, Parm8, Parm8,Parm10, + Parm11,Parm12,Parm13,Parm14) += 0; +}; + +template<typename AP, typename Id, + typename P1,typename P2,typename P3,typename P4,typename P5, + typename P6,typename P7,typename P8,typename P9,typename P10, + typename P11,typename P12,typename P13,typename P14,typename P15 > +struct FactoryImpl<AP, Id, LOKI_TYPELIST_15( P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15 )> +: public FactoryImplBase +{ + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + typedef typename TypeTraits<P10>::ParameterType Parm10; + typedef typename TypeTraits<P11>::ParameterType Parm11; + typedef typename TypeTraits<P12>::ParameterType Parm12; + typedef typename TypeTraits<P13>::ParameterType Parm13; + typedef typename TypeTraits<P14>::ParameterType Parm14; + typedef typename TypeTraits<P15>::ParameterType Parm15; +virtual ~FactoryImpl() {} +virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, + Parm6, Parm7, Parm8, Parm9,Parm10, + Parm11,Parm12,Parm13,Parm14,Parm15 ) += 0; +}; - template<typename AP, typename Id, typename P1,typename P2,typename P3,typename P4 > - struct FactoryImpl<AP, Id, Seq<P1, P2, P3, P4> > - : public FactoryImplBase - { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4 ) = 0; - }; +#endif //LOKI_DISABLE_TYPELIST_MACROS - template<typename AP, typename Id, - typename P1,typename P2,typename P3,typename P4,typename P5 > - struct FactoryImpl<AP, Id, Seq<P1, P2, P3, P4, P5> > - : public FactoryImplBase - { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5 ) = 0; - }; - template<typename AP, typename Id, - typename P1,typename P2,typename P3,typename P4,typename P5, - typename P6> - struct FactoryImpl<AP, Id, Seq<P1, P2, P3, P4, P5, P6> > - : public FactoryImplBase +//////////////////////////////////////////////////////////////////////////////// +/// \class Factory +/// +/// \ingroup FactoryGroup +/// Implements a generic object factory. +/// +/// Create functions can have up to 15 parameters. +/// +/// \par Singleton lifetime when used with Loki::SingletonHolder +/// Because Factory uses internally Functors which inherits from +/// SmallObject you must use the singleton lifetime +/// \code Loki::LongevityLifetime::DieAsSmallObjectChild \endcode +/// Alternatively you could suppress for Functor the inheritance +/// from SmallObject by defining the macro: +/// \code LOKI_FUNCTOR_IS_NOT_A_SMALLOBJECT \endcode +//////////////////////////////////////////////////////////////////////////////// +template +< +class AbstractProduct, + typename IdentifierType, + typename CreatorParmTList = NullType, + template<typename, class> class FactoryErrorPolicy = DefaultFactoryError + > +class Factory : public FactoryErrorPolicy<IdentifierType, AbstractProduct> +{ + typedef FactoryImpl< AbstractProduct, IdentifierType, CreatorParmTList > Impl; + + typedef typename Impl::Parm1 Parm1; + typedef typename Impl::Parm2 Parm2; + typedef typename Impl::Parm3 Parm3; + typedef typename Impl::Parm4 Parm4; + typedef typename Impl::Parm5 Parm5; + typedef typename Impl::Parm6 Parm6; + typedef typename Impl::Parm7 Parm7; + typedef typename Impl::Parm8 Parm8; + typedef typename Impl::Parm9 Parm9; + typedef typename Impl::Parm10 Parm10; + typedef typename Impl::Parm11 Parm11; + typedef typename Impl::Parm12 Parm12; + typedef typename Impl::Parm13 Parm13; + typedef typename Impl::Parm14 Parm14; + typedef typename Impl::Parm15 Parm15; + + typedef Functor<AbstractProduct*, CreatorParmTList> ProductCreator; + + typedef AssocVector<IdentifierType, ProductCreator> IdToProductMap; + + IdToProductMap associations_; + +public: + + Factory() + : associations_() { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, - Parm6 ) - = 0; - }; + } - template<typename AP, typename Id, - typename P1,typename P2,typename P3,typename P4,typename P5, - typename P6,typename P7> - struct FactoryImpl<AP, Id, Seq<P1, P2, P3, P4, P5, P6, P7> > - : public FactoryImplBase + ~Factory() { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, - Parm6, Parm7 ) - = 0; - }; + associations_.erase(associations_.begin(), associations_.end()); + } - template<typename AP, typename Id, - typename P1,typename P2,typename P3,typename P4,typename P5, - typename P6,typename P7,typename P8> - struct FactoryImpl<AP, Id, Seq<P1, P2, P3, P4, P5, P6, P7, P8> > - : public FactoryImplBase + bool Register(const IdentifierType& id, ProductCreator creator) { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, - Parm6, Parm7, Parm8) - = 0; - }; + return associations_.insert( + typename IdToProductMap::value_type(id, creator)).second != 0; + } - template<typename AP, typename Id, - typename P1,typename P2,typename P3,typename P4,typename P5, - typename P6,typename P7,typename P8,typename P9> - struct FactoryImpl<AP, Id, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9> > - : public FactoryImplBase + template <class PtrObj, typename CreaFn> + bool Register(const IdentifierType& id, const PtrObj& p, CreaFn fn) { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, - Parm6, Parm7, Parm8, Parm9) - = 0; - }; + ProductCreator creator( p, fn ); + return associations_.insert( + typename IdToProductMap::value_type(id, creator)).second != 0; + } - template<typename AP, typename Id, - typename P1,typename P2,typename P3,typename P4,typename P5, - typename P6,typename P7,typename P8,typename P9,typename P10> - struct FactoryImpl<AP, Id, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10> > - : public FactoryImplBase + bool Unregister(const IdentifierType& id) { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - typedef typename TypeTraits<P10>::ParameterType Parm10; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, - Parm6, Parm7, Parm8, Parm9,Parm10) - = 0; - }; + return associations_.erase(id) != 0; + } - template<typename AP, typename Id, - typename P1,typename P2,typename P3,typename P4,typename P5, - typename P6,typename P7,typename P8,typename P9,typename P10, - typename P11> - struct FactoryImpl<AP, Id, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11> > - : public FactoryImplBase + std::vector<IdentifierType> RegisteredIds() { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - typedef typename TypeTraits<P10>::ParameterType Parm10; - typedef typename TypeTraits<P11>::ParameterType Parm11; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, - Parm6, Parm7, Parm8, Parm9,Parm10, - Parm11) - = 0; - }; + std::vector<IdentifierType> ids; + for(typename IdToProductMap::iterator it = associations_.begin(); + it != associations_.end(); ++it) + { + ids.push_back(it->first); + } + return ids; + } - template<typename AP, typename Id, - typename P1,typename P2,typename P3,typename P4,typename P5, - typename P6,typename P7,typename P8,typename P9,typename P10, - typename P11,typename P12> - struct FactoryImpl<AP, Id, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12> > - : public FactoryImplBase + AbstractProduct* CreateObject(const IdentifierType& id) { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - typedef typename TypeTraits<P10>::ParameterType Parm10; - typedef typename TypeTraits<P11>::ParameterType Parm11; - typedef typename TypeTraits<P12>::ParameterType Parm12; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, - Parm6, Parm7, Parm8, Parm9,Parm10, - Parm11,Parm12) - = 0; - }; - - template<typename AP, typename Id, - typename P1,typename P2,typename P3,typename P4,typename P5, - typename P6,typename P7,typename P8,typename P9,typename P10, - typename P11,typename P12,typename P13> - struct FactoryImpl<AP, Id, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13> > - : public FactoryImplBase + typename IdToProductMap::iterator i = associations_.find(id); + if (i != associations_.end()) + return (i->second)( ); + return this->OnUnknownType(id); + } + + AbstractProduct* CreateObject(const IdentifierType& id, + Parm1 p1) { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - typedef typename TypeTraits<P10>::ParameterType Parm10; - typedef typename TypeTraits<P11>::ParameterType Parm11; - typedef typename TypeTraits<P12>::ParameterType Parm12; - typedef typename TypeTraits<P13>::ParameterType Parm13; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, - Parm6, Parm7, Parm8, Parm9,Parm10, - Parm11,Parm12,Parm13) - = 0; - }; - - template<typename AP, typename Id, - typename P1,typename P2,typename P3,typename P4,typename P5, - typename P6,typename P7,typename P8,typename P9,typename P10, - typename P11,typename P12,typename P13,typename P14> - struct FactoryImpl<AP, Id, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14> > - : public FactoryImplBase + typename IdToProductMap::iterator i = associations_.find(id); + if (i != associations_.end()) + return (i->second)( p1 ); + return this->OnUnknownType(id); + } + + AbstractProduct* CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2) { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - typedef typename TypeTraits<P10>::ParameterType Parm10; - typedef typename TypeTraits<P11>::ParameterType Parm11; - typedef typename TypeTraits<P12>::ParameterType Parm12; - typedef typename TypeTraits<P13>::ParameterType Parm13; - typedef typename TypeTraits<P14>::ParameterType Parm14; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, - Parm6, Parm7, Parm8, Parm8,Parm10, - Parm11,Parm12,Parm13,Parm14) - = 0; - }; - - template<typename AP, typename Id, - typename P1,typename P2,typename P3,typename P4,typename P5, - typename P6,typename P7,typename P8,typename P9,typename P10, - typename P11,typename P12,typename P13,typename P14,typename P15 > - struct FactoryImpl<AP, Id, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15> > - : public FactoryImplBase + typename IdToProductMap::iterator i = associations_.find(id); + if (i != associations_.end()) + return (i->second)( p1,p2 ); + return this->OnUnknownType(id); + } + + AbstractProduct* CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3) { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - typedef typename TypeTraits<P10>::ParameterType Parm10; - typedef typename TypeTraits<P11>::ParameterType Parm11; - typedef typename TypeTraits<P12>::ParameterType Parm12; - typedef typename TypeTraits<P13>::ParameterType Parm13; - typedef typename TypeTraits<P14>::ParameterType Parm14; - typedef typename TypeTraits<P15>::ParameterType Parm15; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, - Parm6, Parm7, Parm8, Parm9,Parm10, - Parm11,Parm12,Parm13,Parm14,Parm15 ) - = 0; - }; - -#ifndef LOKI_DISABLE_TYPELIST_MACROS - - template <typename AP, typename Id, typename P1 > - struct FactoryImpl<AP,Id, LOKI_TYPELIST_1( P1 )> - : public FactoryImplBase + typename IdToProductMap::iterator i = associations_.find(id); + if (i != associations_.end()) + return (i->second)( p1,p2,p3 ); + return this->OnUnknownType(id); + } + + AbstractProduct* CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4) { - typedef typename TypeTraits<P1>::ParameterType Parm1; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1 ) = 0; - }; - - template<typename AP, typename Id, typename P1,typename P2 > - struct FactoryImpl<AP, Id, LOKI_TYPELIST_2( P1, P2 )> - : public FactoryImplBase + typename IdToProductMap::iterator i = associations_.find(id); + if (i != associations_.end()) + return (i->second)( p1,p2,p3,p4 ); + return this->OnUnknownType(id); + } + + AbstractProduct* CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5) { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2 ) = 0; - }; - - template<typename AP, typename Id, typename P1,typename P2,typename P3 > - struct FactoryImpl<AP, Id, LOKI_TYPELIST_3( P1, P2, P3 )> - : public FactoryImplBase + typename IdToProductMap::iterator i = associations_.find(id); + if (i != associations_.end()) + return (i->second)( p1,p2,p3,p4,p5 ); + return this->OnUnknownType(id); + } + + AbstractProduct* CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6) { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3 ) = 0; - }; - - template<typename AP, typename Id, typename P1,typename P2,typename P3,typename P4 > - struct FactoryImpl<AP, Id, LOKI_TYPELIST_4( P1, P2, P3, P4 )> - : public FactoryImplBase + typename IdToProductMap::iterator i = associations_.find(id); + if (i != associations_.end()) + return (i->second)( p1,p2,p3,p4,p5,p6 ); + return this->OnUnknownType(id); + } + + AbstractProduct* CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7 ) { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4 ) = 0; - }; - - template<typename AP, typename Id, - typename P1,typename P2,typename P3,typename P4,typename P5 > - struct FactoryImpl<AP, Id, LOKI_TYPELIST_5( P1, P2, P3, P4, P5 )> - : public FactoryImplBase + typename IdToProductMap::iterator i = associations_.find(id); + if (i != associations_.end()) + return (i->second)( p1,p2,p3,p4,p5,p6,p7 ); + return this->OnUnknownType(id); + } + + AbstractProduct* CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8) { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5 ) = 0; - }; - - template<typename AP, typename Id, - typename P1,typename P2,typename P3,typename P4,typename P5, - typename P6> - struct FactoryImpl<AP, Id, LOKI_TYPELIST_6( P1, P2, P3, P4, P5, P6 )> - : public FactoryImplBase + typename IdToProductMap::iterator i = associations_.find(id); + if (i != associations_.end()) + return (i->second)( p1,p2,p3,p4,p5,p6,p7,p8 ); + return this->OnUnknownType(id); + } + + AbstractProduct* CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9) { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, - Parm6 ) - = 0; - }; - - template<typename AP, typename Id, - typename P1,typename P2,typename P3,typename P4,typename P5, - typename P6,typename P7> - struct FactoryImpl<AP, Id, LOKI_TYPELIST_7( P1, P2, P3, P4, P5, P6, P7 )> - : public FactoryImplBase + typename IdToProductMap::iterator i = associations_.find(id); + if (i != associations_.end()) + return (i->second)( p1,p2,p3,p4,p5,p6,p7,p8,p9 ); + return this->OnUnknownType(id); + } + AbstractProduct* CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9,Parm10 p10) { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, - Parm6, Parm7 ) - = 0; - }; - - template<typename AP, typename Id, - typename P1,typename P2,typename P3,typename P4,typename P5, - typename P6,typename P7,typename P8> - struct FactoryImpl<AP, Id, LOKI_TYPELIST_8( P1, P2, P3, P4, P5, P6, P7, P8 )> - : public FactoryImplBase + typename IdToProductMap::iterator i = associations_.find(id); + if (i != associations_.end()) + return (i->second)( p1,p2,p3,p4,p5,p6,p7,p8,p9,p10 ); + return this->OnUnknownType(id); + } + + AbstractProduct* CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, + Parm11 p11) { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, - Parm6, Parm7, Parm8) - = 0; - }; - - template<typename AP, typename Id, - typename P1,typename P2,typename P3,typename P4,typename P5, - typename P6,typename P7,typename P8,typename P9> - struct FactoryImpl<AP, Id, LOKI_TYPELIST_9( P1, P2, P3, P4, P5, P6, P7, P8, P9 )> - : public FactoryImplBase + typename IdToProductMap::iterator i = associations_.find(id); + if (i != associations_.end()) + return (i->second)( p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11 ); + return this->OnUnknownType(id); + } + + AbstractProduct* CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, + Parm11 p11, Parm12 p12) { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, - Parm6, Parm7, Parm8, Parm9) - = 0; - }; - - template<typename AP, typename Id, - typename P1,typename P2,typename P3,typename P4,typename P5, - typename P6,typename P7,typename P8,typename P9,typename P10> - struct FactoryImpl<AP, Id, LOKI_TYPELIST_10( P1, P2, P3, P4, P5, P6, P7, P8, P9, P10 )> - : public FactoryImplBase + typename IdToProductMap::iterator i = associations_.find(id); + if (i != associations_.end()) + return (i->second)( p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12 ); + return this->OnUnknownType(id); + } + + AbstractProduct* CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, + Parm11 p11, Parm12 p12, Parm13 p13) { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - typedef typename TypeTraits<P10>::ParameterType Parm10; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, - Parm6, Parm7, Parm8, Parm9,Parm10) - = 0; - }; - - template<typename AP, typename Id, - typename P1,typename P2,typename P3,typename P4,typename P5, - typename P6,typename P7,typename P8,typename P9,typename P10, - typename P11> - struct FactoryImpl<AP, Id, LOKI_TYPELIST_11( P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11 )> - : public FactoryImplBase + typename IdToProductMap::iterator i = associations_.find(id); + if (i != associations_.end()) + return (i->second)( p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13 ); + return this->OnUnknownType(id); + } + + AbstractProduct* CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, + Parm11 p11, Parm12 p12, Parm13 p13, Parm14 p14) { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - typedef typename TypeTraits<P10>::ParameterType Parm10; - typedef typename TypeTraits<P11>::ParameterType Parm11; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, - Parm6, Parm7, Parm8, Parm9,Parm10, - Parm11) - = 0; - }; - - template<typename AP, typename Id, - typename P1,typename P2,typename P3,typename P4,typename P5, - typename P6,typename P7,typename P8,typename P9,typename P10, - typename P11,typename P12> - struct FactoryImpl<AP, Id, LOKI_TYPELIST_12( P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12 )> - : public FactoryImplBase + typename IdToProductMap::iterator i = associations_.find(id); + if (i != associations_.end()) + return (i->second)( p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14 ); + return this->OnUnknownType(id); + } + + AbstractProduct* CreateObject(const IdentifierType& id, + Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, + Parm11 p11, Parm12 p12, Parm13 p13, Parm14 p14, Parm15 p15) { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - typedef typename TypeTraits<P10>::ParameterType Parm10; - typedef typename TypeTraits<P11>::ParameterType Parm11; - typedef typename TypeTraits<P12>::ParameterType Parm12; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, - Parm6, Parm7, Parm8, Parm9,Parm10, - Parm11,Parm12) - = 0; - }; + typename IdToProductMap::iterator i = associations_.find(id); + if (i != associations_.end()) + return (i->second)( p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15 ); + return this->OnUnknownType(id); + } - template<typename AP, typename Id, - typename P1,typename P2,typename P3,typename P4,typename P5, - typename P6,typename P7,typename P8,typename P9,typename P10, - typename P11,typename P12,typename P13> - struct FactoryImpl<AP, Id, LOKI_TYPELIST_13( P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13 )> - : public FactoryImplBase - { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - typedef typename TypeTraits<P10>::ParameterType Parm10; - typedef typename TypeTraits<P11>::ParameterType Parm11; - typedef typename TypeTraits<P12>::ParameterType Parm12; - typedef typename TypeTraits<P13>::ParameterType Parm13; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, - Parm6, Parm7, Parm8, Parm9,Parm10, - Parm11,Parm12,Parm13) - = 0; - }; +}; - template<typename AP, typename Id, - typename P1,typename P2,typename P3,typename P4,typename P5, - typename P6,typename P7,typename P8,typename P9,typename P10, - typename P11,typename P12,typename P13,typename P14> - struct FactoryImpl<AP, Id, LOKI_TYPELIST_14( P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14 )> - : public FactoryImplBase - { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - typedef typename TypeTraits<P10>::ParameterType Parm10; - typedef typename TypeTraits<P11>::ParameterType Parm11; - typedef typename TypeTraits<P12>::ParameterType Parm12; - typedef typename TypeTraits<P13>::ParameterType Parm13; - typedef typename TypeTraits<P14>::ParameterType Parm14; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, - Parm6, Parm7, Parm8, Parm8,Parm10, - Parm11,Parm12,Parm13,Parm14) - = 0; - }; +#else - template<typename AP, typename Id, - typename P1,typename P2,typename P3,typename P4,typename P5, - typename P6,typename P7,typename P8,typename P9,typename P10, - typename P11,typename P12,typename P13,typename P14,typename P15 > - struct FactoryImpl<AP, Id, LOKI_TYPELIST_15( P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15 )> - : public FactoryImplBase +template +< +class AbstractProduct, + typename IdentifierType, + typename ProductCreator = AbstractProduct* (*)(), + template<typename, class> + class FactoryErrorPolicy = DefaultFactoryError + > +class Factory + : public FactoryErrorPolicy<IdentifierType, AbstractProduct> +{ +public: + bool Register(const IdentifierType& id, ProductCreator creator) { - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - typedef typename TypeTraits<P10>::ParameterType Parm10; - typedef typename TypeTraits<P11>::ParameterType Parm11; - typedef typename TypeTraits<P12>::ParameterType Parm12; - typedef typename TypeTraits<P13>::ParameterType Parm13; - typedef typename TypeTraits<P14>::ParameterType Parm14; - typedef typename TypeTraits<P15>::ParameterType Parm15; - virtual ~FactoryImpl() {} - virtual AP* CreateObject(const Id& id,Parm1, Parm2, Parm3, Parm4, Parm5, - Parm6, Parm7, Parm8, Parm9,Parm10, - Parm11,Parm12,Parm13,Parm14,Parm15 ) - = 0; - }; - -#endif //LOKI_DISABLE_TYPELIST_MACROS - + return associations_.insert( + typename IdToProductMap::value_type(id, creator)).second != 0; + } -//////////////////////////////////////////////////////////////////////////////// -/// \class Factory -/// -/// \ingroup FactoryGroup -/// Implements a generic object factory. -/// -/// Create functions can have up to 15 parameters. -/// -/// \par Singleton lifetime when used with Loki::SingletonHolder -/// Because Factory uses internally Functors which inherits from -/// SmallObject you must use the singleton lifetime -/// \code Loki::LongevityLifetime::DieAsSmallObjectChild \endcode -/// Alternatively you could suppress for Functor the inheritance -/// from SmallObject by defining the macro: -/// \code LOKI_FUNCTOR_IS_NOT_A_SMALLOBJECT \endcode -//////////////////////////////////////////////////////////////////////////////// - template - < - class AbstractProduct, - typename IdentifierType, - typename CreatorParmTList = NullType, - template<typename, class> class FactoryErrorPolicy = DefaultFactoryError - > - class Factory : public FactoryErrorPolicy<IdentifierType, AbstractProduct> + bool Unregister(const IdentifierType& id) { - typedef FactoryImpl< AbstractProduct, IdentifierType, CreatorParmTList > Impl; - - typedef typename Impl::Parm1 Parm1; - typedef typename Impl::Parm2 Parm2; - typedef typename Impl::Parm3 Parm3; - typedef typename Impl::Parm4 Parm4; - typedef typename Impl::Parm5 Parm5; - typedef typename Impl::Parm6 Parm6; - typedef typename Impl::Parm7 Parm7; - typedef typename Impl::Parm8 Parm8; - typedef typename Impl::Parm9 Parm9; - typedef typename Impl::Parm10 Parm10; - typedef typename Impl::Parm11 Parm11; - typedef typename Impl::Parm12 Parm12; - typedef typename Impl::Parm13 Parm13; - typedef typename Impl::Parm14 Parm14; - typedef typename Impl::Parm15 Parm15; - - typedef Functor<AbstractProduct*, CreatorParmTList> ProductCreator; - - typedef AssocVector<IdentifierType, ProductCreator> IdToProductMap; - - IdToProductMap associations_; - - public: - - Factory() - : associations_() - { - } + return associations_.erase(id) != 0; + } - ~Factory() - { - associations_.erase(associations_.begin(), associations_.end()); - } - - bool Register(const IdentifierType& id, ProductCreator creator) - { - return associations_.insert( - typename IdToProductMap::value_type(id, creator)).second != 0; - } - - template <class PtrObj, typename CreaFn> - bool Register(const IdentifierType& id, const PtrObj& p, CreaFn fn) - { - ProductCreator creator( p, fn ); - return associations_.insert( - typename IdToProductMap::value_type(id, creator)).second != 0; - } - - bool Unregister(const IdentifierType& id) - { - return associations_.erase(id) != 0; - } - - std::vector<IdentifierType> RegisteredIds() - { - std::vector<IdentifierType> ids; - for(typename IdToProductMap::iterator it = associations_.begin(); - it != associations_.end(); ++it) - { - ids.push_back(it->first); - } - return ids; - } - - AbstractProduct* CreateObject(const IdentifierType& id) - { - typename IdToProductMap::iterator i = associations_.find(id); - if (i != associations_.end()) - return (i->second)( ); - return this->OnUnknownType(id); - } - - AbstractProduct* CreateObject(const IdentifierType& id, - Parm1 p1) - { - typename IdToProductMap::iterator i = associations_.find(id); - if (i != associations_.end()) - return (i->second)( p1 ); - return this->OnUnknownType(id); - } - - AbstractProduct* CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2) - { - typename IdToProductMap::iterator i = associations_.find(id); - if (i != associations_.end()) - return (i->second)( p1,p2 ); - return this->OnUnknownType(id); - } - - AbstractProduct* CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3) - { - typename IdToProductMap::iterator i = associations_.find(id); - if (i != associations_.end()) - return (i->second)( p1,p2,p3 ); - return this->OnUnknownType(id); - } - - AbstractProduct* CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4) - { - typename IdToProductMap::iterator i = associations_.find(id); - if (i != associations_.end()) - return (i->second)( p1,p2,p3,p4 ); - return this->OnUnknownType(id); - } - - AbstractProduct* CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5) - { - typename IdToProductMap::iterator i = associations_.find(id); - if (i != associations_.end()) - return (i->second)( p1,p2,p3,p4,p5 ); - return this->OnUnknownType(id); - } - - AbstractProduct* CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6) - { - typename IdToProductMap::iterator i = associations_.find(id); - if (i != associations_.end()) - return (i->second)( p1,p2,p3,p4,p5,p6 ); - return this->OnUnknownType(id); - } - - AbstractProduct* CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7 ) - { - typename IdToProductMap::iterator i = associations_.find(id); - if (i != associations_.end()) - return (i->second)( p1,p2,p3,p4,p5,p6,p7 ); - return this->OnUnknownType(id); - } - - AbstractProduct* CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8) - { - typename IdToProductMap::iterator i = associations_.find(id); - if (i != associations_.end()) - return (i->second)( p1,p2,p3,p4,p5,p6,p7,p8 ); - return this->OnUnknownType(id); - } - - AbstractProduct* CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9) - { - typename IdToProductMap::iterator i = associations_.find(id); - if (i != associations_.end()) - return (i->second)( p1,p2,p3,p4,p5,p6,p7,p8,p9 ); - return this->OnUnknownType(id); - } - AbstractProduct* CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9,Parm10 p10) - { - typename IdToProductMap::iterator i = associations_.find(id); - if (i != associations_.end()) - return (i->second)( p1,p2,p3,p4,p5,p6,p7,p8,p9,p10 ); - return this->OnUnknownType(id); - } - - AbstractProduct* CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, - Parm11 p11) - { - typename IdToProductMap::iterator i = associations_.find(id); - if (i != associations_.end()) - return (i->second)( p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11 ); - return this->OnUnknownType(id); - } - - AbstractProduct* CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, - Parm11 p11, Parm12 p12) - { - typename IdToProductMap::iterator i = associations_.find(id); - if (i != associations_.end()) - return (i->second)( p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12 ); - return this->OnUnknownType(id); - } - - AbstractProduct* CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, - Parm11 p11, Parm12 p12, Parm13 p13) - { - typename IdToProductMap::iterator i = associations_.find(id); - if (i != associations_.end()) - return (i->second)( p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13 ); - return this->OnUnknownType(id); - } - - AbstractProduct* CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, - Parm11 p11, Parm12 p12, Parm13 p13, Parm14 p14) - { - typename IdToProductMap::iterator i = associations_.find(id); - if (i != associations_.end()) - return (i->second)( p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14 ); - return this->OnUnknownType(id); - } - - AbstractProduct* CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, - Parm11 p11, Parm12 p12, Parm13 p13, Parm14 p14, Parm15 p15) - { - typename IdToProductMap::iterator i = associations_.find(id); - if (i != associations_.end()) - return (i->second)( p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15 ); - return this->OnUnknownType(id); - } - - }; - -#else - - template - < - class AbstractProduct, - typename IdentifierType, - typename ProductCreator = AbstractProduct* (*)(), - template<typename, class> - class FactoryErrorPolicy = DefaultFactoryError - > - class Factory - : public FactoryErrorPolicy<IdentifierType, AbstractProduct> + AbstractProduct* CreateObject(const IdentifierType& id) { - public: - bool Register(const IdentifierType& id, ProductCreator creator) - { - return associations_.insert( - typename IdToProductMap::value_type(id, creator)).second != 0; - } - - bool Unregister(const IdentifierType& id) + typename IdToProductMap::iterator i = associations_.find(id); + if (i != associations_.end()) { - return associations_.erase(id) != 0; + return (i->second)(); } + return this->OnUnknownType(id); + } - AbstractProduct* CreateObject(const IdentifierType& id) - { - typename IdToProductMap::iterator i = associations_.find(id); - if (i != associations_.end()) - { - return (i->second)(); - } - return this->OnUnknownType(id); - } - - private: - typedef AssocVector<IdentifierType, ProductCreator> IdToProductMap; - IdToProductMap associations_; - }; +private: + typedef AssocVector<IdentifierType, ProductCreator> IdToProductMap; + IdToProductMap associations_; +}; #endif //#define ENABLE_NEW_FACTORY_CODE @@ -1028,51 +1028,51 @@ template <typename AP, typename Id, typename P1 > * \brief Creates a copy from a polymorphic object. */ - template - < - class AbstractProduct, - class ProductCreator = - AbstractProduct* (*)(const AbstractProduct*), - template<typename, class> - class FactoryErrorPolicy = DefaultFactoryError - > - class CloneFactory - : public FactoryErrorPolicy<TypeInfo, AbstractProduct> +template +< +class AbstractProduct, + class ProductCreator = + AbstractProduct* (*)(const AbstractProduct*), + template<typename, class> + class FactoryErrorPolicy = DefaultFactoryError + > +class CloneFactory + : public FactoryErrorPolicy<TypeInfo, AbstractProduct> +{ +public: + bool Register(const TypeInfo& ti, ProductCreator creator) { - public: - bool Register(const TypeInfo& ti, ProductCreator creator) - { - return associations_.insert( - typename IdToProductMap::value_type(ti, creator)).second != 0; - } + return associations_.insert( + typename IdToProductMap::value_type(ti, creator)).second != 0; + } + + bool Unregister(const TypeInfo& id) + { + return associations_.erase(id) != 0; + } - bool Unregister(const TypeInfo& id) + AbstractProduct* CreateObject(const AbstractProduct* model) + { + if (model == NULL) { - return associations_.erase(id) != 0; + return NULL; } - AbstractProduct* CreateObject(const AbstractProduct* model) + typename IdToProductMap::iterator i = + associations_.find(typeid(*model)); + + if (i != associations_.end()) { - if (model == NULL) - { - return NULL; - } - - typename IdToProductMap::iterator i = - associations_.find(typeid(*model)); - - if (i != associations_.end()) - { - return (i->second)(model); - } - return this->OnUnknownType(typeid(*model)); + return (i->second)(model); } + return this->OnUnknownType(typeid(*model)); + } + +private: + typedef AssocVector<TypeInfo, ProductCreator> IdToProductMap; + IdToProductMap associations_; +}; - private: - typedef AssocVector<TypeInfo, ProductCreator> IdToProductMap; - IdToProductMap associations_; - }; - } // namespace Loki diff --git a/shared/loki/Function.h b/shared/loki/Function.h index 2d0ad4bb..f2badfe9 100644 --- a/shared/loki/Function.h +++ b/shared/loki/Function.h @@ -1,12 +1,12 @@ //////////////////////////////////////////////////////////////////////////////// // The Loki Library // Copyright (c) 2005 Peter Kümmel -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author makes no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author makes no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_FUNCTION_INC_ @@ -25,63 +25,63 @@ namespace Loki { - //////////////////////////////////////////////////////////////////////////////// - /// \struct Function - /// - /// \ingroup FunctorGroup - /// Allows a boost/TR1 like usage of Functor. - /// - /// \par Usage - /// - /// - free functions: e.g. \code Function<int(int,int)> f(&freeFunction); - /// \endcode - /// - member functions: e.g \code Function<int()> f(&object,&ObjectType::memberFunction); - /// \endcode - /// - /// see also test/Function/FunctionTest.cpp (the modified test program from boost) - //////////////////////////////////////////////////////////////////////////////// - - template<class R = void()> - struct Function; - - - template<class R> - struct Function<R()> : public Functor<R> - { - typedef Functor<R> FBase; - - Function() : FBase() {} - - Function(const Function& func) : FBase() - { - if( !func.empty()) - FBase::operator=(func); - } - - // test on emptiness - template<class R2> - Function(Function<R2()> func) : FBase() - { - if(!func.empty()) - FBase::operator=(func); - } - - // clear by '= 0' - Function(const int i) : FBase() - { - if(i==0) - FBase::clear(); - else - throw std::runtime_error("Loki::Function(const int i): i!=0"); - } - - template<class Func> - Function(Func func) : FBase(func) {} +//////////////////////////////////////////////////////////////////////////////// +/// \struct Function +/// +/// \ingroup FunctorGroup +/// Allows a boost/TR1 like usage of Functor. +/// +/// \par Usage +/// +/// - free functions: e.g. \code Function<int(int,int)> f(&freeFunction); +/// \endcode +/// - member functions: e.g \code Function<int()> f(&object,&ObjectType::memberFunction); +/// \endcode +/// +/// see also test/Function/FunctionTest.cpp (the modified test program from boost) +//////////////////////////////////////////////////////////////////////////////// + +template<class R = void()> +struct Function; + + +template<class R> +struct Function<R()> : public Functor<R> +{ + typedef Functor<R> FBase; - template<class Host, class Func> - Function(const Host& host, const Func& func) : FBase(host,func) {} + Function() : FBase() {} - }; +Function(const Function& func) : FBase() +{ + if( !func.empty()) + FBase::operator=(func); +} + +// test on emptiness +template<class R2> +Function(Function<R2()> func) : FBase() +{ + if(!func.empty()) + FBase::operator=(func); +} + +// clear by '= 0' +Function(const int i) : FBase() +{ + if(i==0) + FBase::clear(); + else + throw std::runtime_error("Loki::Function(const int i): i!=0"); +} + +template<class Func> +Function(Func func) : FBase(func) {} + +template<class Host, class Func> +Function(const Host& host, const Func& func) : FBase(host,func) {} + +}; //////////////////////////////////////////////////////////////////////////////// @@ -113,7 +113,7 @@ namespace Loki template<class Host, class Func> \ Function(const Host& host, const Func& func): FBase(host,func) {} - + #define LOKI_FUNCTION_R2_CTOR_BODY \ \ : FBase() \ @@ -127,245 +127,245 @@ namespace Loki // repetitions //////////////////////////////////////////////////////////////////////////////// - template<> - struct Function<> +template<> +struct Function<> : public Loki::Functor<> - { - typedef Functor<> FBase; - - template<class R2> - Function(Function<R2()> func) - LOKI_FUNCTION_R2_CTOR_BODY - - LOKI_FUNCTION_BODY // if compilation breaks here then - // Function.h was not included before - // Functor.h, check your include order - // or define LOKI_ENABLE_FUNCTION - }; - - template<class R,class P01> - struct Function<R(P01)> - : public Loki::Functor<R, Seq<P01> > - { - typedef Functor<R, Seq<P01> > FBase; - - template<class R2,class Q01> - Function(Function<R2(Q01)> func) - LOKI_FUNCTION_R2_CTOR_BODY - - LOKI_FUNCTION_BODY - }; - - template<class R,class P01,class P02> - struct Function<R(P01,P02)> - : public Functor<R, Seq<P01,P02> > - { - typedef Functor<R, Seq<P01,P02> > FBase; - - template<class R2,class Q01, class Q02> - Function(Function<R2(Q01,Q02)> func) - LOKI_FUNCTION_R2_CTOR_BODY - - LOKI_FUNCTION_BODY - }; - - template<class R,class P01,class P02, class P03> - struct Function<R(P01,P02,P03)> - : public Functor<R, Seq<P01,P02,P03> > - { - typedef Functor<R, Seq<P01,P02,P03> > FBase; - - template<class R2,class Q01, class Q02,class Q03> - Function(Function<R2(Q01,Q02,Q03)> func) - LOKI_FUNCTION_R2_CTOR_BODY - - LOKI_FUNCTION_BODY - }; - - template<class R,class P01,class P02, class P03,class P04> - struct Function<R(P01,P02,P03,P04)> - : public Functor<R, Seq<P01,P02,P03,P04> > - { - typedef Functor<R, Seq<P01,P02,P03,P04> > FBase; - - template<class R2,class Q01,class Q02, class Q03,class Q04> - Function(Function<R2(Q01,Q02,Q03,Q04)> func) - LOKI_FUNCTION_R2_CTOR_BODY - - LOKI_FUNCTION_BODY - }; - - template<class R,class P01,class P02, class P03,class P04,class P05> - struct Function<R(P01,P02,P03,P04,P05)> - : public Functor<R, Seq<P01,P02,P03,P04,P05> > - { - typedef Functor<R, Seq<P01,P02,P03,P04,P05> > FBase; - - template<class R2,class Q01,class Q02, class Q03,class Q04,class Q05> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05)> func) - LOKI_FUNCTION_R2_CTOR_BODY - - LOKI_FUNCTION_BODY - }; - - template<class R, class P01,class P02, class P03,class P04,class P05, - class P06> - struct Function<R(P01,P02,P03,P04,P05,P06)> - : public Functor<R, Seq<P01,P02,P03,P04,P05,P06> > - { - typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06> > FBase; - - template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, - class Q06> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06)> func) - LOKI_FUNCTION_R2_CTOR_BODY - - LOKI_FUNCTION_BODY - }; - - template<class R, class P01,class P02, class P03,class P04,class P05, - class P06,class P07> - struct Function<R(P01,P02,P03,P04,P05,P06,P07)> - : public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07> > - { - typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07> > FBase; - - template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, - class Q06,class Q07> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07)> func) - LOKI_FUNCTION_R2_CTOR_BODY - - LOKI_FUNCTION_BODY - }; - - template<class R, class P01,class P02, class P03,class P04,class P05, - class P06,class P07, class P08> - struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08)> - : public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08> > - { - typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08> > FBase; - - template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, - class Q06,class Q07, class Q08> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08)> func) - LOKI_FUNCTION_R2_CTOR_BODY - - LOKI_FUNCTION_BODY - }; - - template<class R, class P01,class P02, class P03,class P04,class P05, - class P06,class P07, class P08,class P09> - struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09)> - : public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09> > - { - typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09 > > FBase; - - template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, - class Q06,class Q07, class Q08,class Q09> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09)> func) - LOKI_FUNCTION_R2_CTOR_BODY - - LOKI_FUNCTION_BODY - }; - - template<class R, class P01,class P02, class P03,class P04,class P05, - class P06,class P07, class P08,class P09,class P10> - struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10)> - : public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10> > - { - typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10> > FBase; - - template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, - class Q06,class Q07, class Q08,class Q09,class Q10> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10)> func) - LOKI_FUNCTION_R2_CTOR_BODY - - LOKI_FUNCTION_BODY - }; - - template<class R, class P01,class P02, class P03,class P04,class P05, - class P06,class P07, class P08,class P09,class P10, - class P11> - struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11)> - : public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11> > - { - typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11> >FBase; - - template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, - class Q06,class Q07, class Q08,class Q09,class Q10, - class Q11> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11)> func) - LOKI_FUNCTION_R2_CTOR_BODY - - LOKI_FUNCTION_BODY - }; - - template<class R, class P01,class P02, class P03,class P04,class P05, - class P06,class P07, class P08,class P09,class P10, - class P11,class P12> - struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12)> - : public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12> > - { - typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12> > FBase; - - template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, - class Q06,class Q07, class Q08,class Q09,class Q10, - class Q11,class Q12> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11,Q12)> func) - LOKI_FUNCTION_R2_CTOR_BODY - - LOKI_FUNCTION_BODY - }; - - template<class R, class P01,class P02, class P03,class P04,class P05, - class P06,class P07, class P08,class P09,class P10, - class P11,class P12, class P13> - struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13)> - : public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13> > - { - typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13> > FBase; - - template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, - class Q06,class Q07, class Q08,class Q09,class Q10, - class Q11,class Q12, class Q13> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11,Q12,Q13)> func) - LOKI_FUNCTION_R2_CTOR_BODY - - LOKI_FUNCTION_BODY - }; - - template<class R, class P01,class P02, class P03,class P04,class P05, - class P06,class P07, class P08,class P09,class P10, - class P11,class P12, class P13,class P14> - struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14)> - : public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14> > - { - typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14> > FBase; - template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, - class Q06,class Q07, class Q08,class Q09,class Q10, - class Q11,class Q12, class Q13,class Q14> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11,Q12,Q13,Q14)> func) - LOKI_FUNCTION_R2_CTOR_BODY - - LOKI_FUNCTION_BODY - }; - - template<class R, class P01,class P02, class P03,class P04,class P05, - class P06,class P07, class P08,class P09,class P10, - class P11,class P12, class P13,class P14,class P15> - struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14,P15)> - : public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14,P15> > - { - typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14,P15> > FBase; - - template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, - class Q06,class Q07, class Q08,class Q09,class Q10, - class Q11,class Q12, class Q13,class Q14,class Q15> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11,Q12,Q13,Q14,Q15)> func) - LOKI_FUNCTION_R2_CTOR_BODY - - LOKI_FUNCTION_BODY - }; +{ + typedef Functor<> FBase; + + template<class R2> + Function(Function<R2()> func) + LOKI_FUNCTION_R2_CTOR_BODY + + LOKI_FUNCTION_BODY // if compilation breaks here then + // Function.h was not included before + // Functor.h, check your include order + // or define LOKI_ENABLE_FUNCTION +}; + +template<class R,class P01> +struct Function<R(P01)> +: public Loki::Functor<R, Seq<P01> > +{ + typedef Functor<R, Seq<P01> > FBase; + + template<class R2,class Q01> + Function(Function<R2(Q01)> func) + LOKI_FUNCTION_R2_CTOR_BODY + + LOKI_FUNCTION_BODY +}; + +template<class R,class P01,class P02> +struct Function<R(P01,P02)> +: public Functor<R, Seq<P01,P02> > +{ + typedef Functor<R, Seq<P01,P02> > FBase; + + template<class R2,class Q01, class Q02> + Function(Function<R2(Q01,Q02)> func) + LOKI_FUNCTION_R2_CTOR_BODY + + LOKI_FUNCTION_BODY +}; + +template<class R,class P01,class P02, class P03> +struct Function<R(P01,P02,P03)> +: public Functor<R, Seq<P01,P02,P03> > +{ + typedef Functor<R, Seq<P01,P02,P03> > FBase; + + template<class R2,class Q01, class Q02,class Q03> + Function(Function<R2(Q01,Q02,Q03)> func) + LOKI_FUNCTION_R2_CTOR_BODY + + LOKI_FUNCTION_BODY +}; + +template<class R,class P01,class P02, class P03,class P04> +struct Function<R(P01,P02,P03,P04)> +: public Functor<R, Seq<P01,P02,P03,P04> > +{ + typedef Functor<R, Seq<P01,P02,P03,P04> > FBase; + + template<class R2,class Q01,class Q02, class Q03,class Q04> + Function(Function<R2(Q01,Q02,Q03,Q04)> func) + LOKI_FUNCTION_R2_CTOR_BODY + + LOKI_FUNCTION_BODY +}; + +template<class R,class P01,class P02, class P03,class P04,class P05> +struct Function<R(P01,P02,P03,P04,P05)> +: public Functor<R, Seq<P01,P02,P03,P04,P05> > +{ + typedef Functor<R, Seq<P01,P02,P03,P04,P05> > FBase; + + template<class R2,class Q01,class Q02, class Q03,class Q04,class Q05> + Function(Function<R2(Q01,Q02,Q03,Q04,Q05)> func) + LOKI_FUNCTION_R2_CTOR_BODY + + LOKI_FUNCTION_BODY +}; + +template<class R, class P01,class P02, class P03,class P04,class P05, + class P06> +struct Function<R(P01,P02,P03,P04,P05,P06)> +: public Functor<R, Seq<P01,P02,P03,P04,P05,P06> > +{ + typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06> > FBase; + + template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, + class Q06> + Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06)> func) + LOKI_FUNCTION_R2_CTOR_BODY + + LOKI_FUNCTION_BODY +}; + +template<class R, class P01,class P02, class P03,class P04,class P05, + class P06,class P07> +struct Function<R(P01,P02,P03,P04,P05,P06,P07)> +: public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07> > +{ + typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07> > FBase; + + template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, + class Q06,class Q07> + Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07)> func) + LOKI_FUNCTION_R2_CTOR_BODY + + LOKI_FUNCTION_BODY +}; + +template<class R, class P01,class P02, class P03,class P04,class P05, + class P06,class P07, class P08> +struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08)> +: public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08> > +{ + typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08> > FBase; + + template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, + class Q06,class Q07, class Q08> + Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08)> func) + LOKI_FUNCTION_R2_CTOR_BODY + + LOKI_FUNCTION_BODY +}; + +template<class R, class P01,class P02, class P03,class P04,class P05, + class P06,class P07, class P08,class P09> +struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09)> +: public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09> > +{ + typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09 > > FBase; + + template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, + class Q06,class Q07, class Q08,class Q09> + Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09)> func) + LOKI_FUNCTION_R2_CTOR_BODY + + LOKI_FUNCTION_BODY +}; + +template<class R, class P01,class P02, class P03,class P04,class P05, + class P06,class P07, class P08,class P09,class P10> +struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10)> +: public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10> > +{ + typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10> > FBase; + + template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, + class Q06,class Q07, class Q08,class Q09,class Q10> + Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10)> func) + LOKI_FUNCTION_R2_CTOR_BODY + + LOKI_FUNCTION_BODY +}; + +template<class R, class P01,class P02, class P03,class P04,class P05, + class P06,class P07, class P08,class P09,class P10, + class P11> +struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11)> +: public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11> > +{ + typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11> >FBase; + + template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, + class Q06,class Q07, class Q08,class Q09,class Q10, + class Q11> + Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11)> func) + LOKI_FUNCTION_R2_CTOR_BODY + + LOKI_FUNCTION_BODY +}; + +template<class R, class P01,class P02, class P03,class P04,class P05, + class P06,class P07, class P08,class P09,class P10, + class P11,class P12> +struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12)> +: public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12> > +{ + typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12> > FBase; + + template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, + class Q06,class Q07, class Q08,class Q09,class Q10, + class Q11,class Q12> + Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11,Q12)> func) + LOKI_FUNCTION_R2_CTOR_BODY + + LOKI_FUNCTION_BODY +}; + +template<class R, class P01,class P02, class P03,class P04,class P05, + class P06,class P07, class P08,class P09,class P10, + class P11,class P12, class P13> +struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13)> +: public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13> > +{ + typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13> > FBase; + + template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, + class Q06,class Q07, class Q08,class Q09,class Q10, + class Q11,class Q12, class Q13> + Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11,Q12,Q13)> func) + LOKI_FUNCTION_R2_CTOR_BODY + + LOKI_FUNCTION_BODY +}; + +template<class R, class P01,class P02, class P03,class P04,class P05, + class P06,class P07, class P08,class P09,class P10, + class P11,class P12, class P13,class P14> +struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14)> +: public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14> > +{ + typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14> > FBase; + template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, + class Q06,class Q07, class Q08,class Q09,class Q10, + class Q11,class Q12, class Q13,class Q14> + Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11,Q12,Q13,Q14)> func) + LOKI_FUNCTION_R2_CTOR_BODY + + LOKI_FUNCTION_BODY +}; + +template<class R, class P01,class P02, class P03,class P04,class P05, + class P06,class P07, class P08,class P09,class P10, + class P11,class P12, class P13,class P14,class P15> +struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14,P15)> +: public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14,P15> > +{ + typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14,P15> > FBase; + + template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, + class Q06,class Q07, class Q08,class Q09,class Q10, + class Q11,class Q12, class Q13,class Q14,class Q15> + Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11,Q12,Q13,Q14,Q15)> func) + LOKI_FUNCTION_R2_CTOR_BODY + + LOKI_FUNCTION_BODY +}; }// namespace Loki diff --git a/shared/loki/Functor.h b/shared/loki/Functor.h index bcba855d..a03f87c8 100644 --- a/shared/loki/Functor.h +++ b/shared/loki/Functor.h @@ -2,14 +2,14 @@ // The Loki Library // Copyright (c) 2001 by Andrei Alexandrescu // This code accompanies the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author or Addison-Wesley Longman make no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author or Addison-Wesley Longman make no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_FUNCTOR_INC_ @@ -45,65 +45,66 @@ namespace Loki // class template FunctorImpl (internal) //////////////////////////////////////////////////////////////////////////////// - namespace Private - { - template <typename R, template <class, class> class ThreadingModel> - struct FunctorImplBase +namespace Private +{ +template <typename R, template <class, class> class ThreadingModel> +struct FunctorImplBase #ifdef LOKI_FUNCTOR_IS_NOT_A_SMALLOBJECT - { +{ #else - : public SmallValueObject<ThreadingModel> - { - inline FunctorImplBase() : - SmallValueObject<ThreadingModel>() {} - inline FunctorImplBase(const FunctorImplBase&) : - SmallValueObject<ThreadingModel>() {} + : + public SmallValueObject<ThreadingModel> +{ + inline FunctorImplBase() : + SmallValueObject<ThreadingModel>() {} + inline FunctorImplBase(const FunctorImplBase&) : + SmallValueObject<ThreadingModel>() {} #endif - typedef R ResultType; - typedef FunctorImplBase<R, ThreadingModel> FunctorImplBaseType; - - typedef EmptyType Parm1; - typedef EmptyType Parm2; - typedef EmptyType Parm3; - typedef EmptyType Parm4; - typedef EmptyType Parm5; - typedef EmptyType Parm6; - typedef EmptyType Parm7; - typedef EmptyType Parm8; - typedef EmptyType Parm9; - typedef EmptyType Parm10; - typedef EmptyType Parm11; - typedef EmptyType Parm12; - typedef EmptyType Parm13; - typedef EmptyType Parm14; - typedef EmptyType Parm15; - - - virtual ~FunctorImplBase() - {} - - virtual FunctorImplBase* DoClone() const = 0; - - template <class U> - static U* Clone(U* pObj) - { - if (!pObj) return 0; - U* pClone = static_cast<U*>(pObj->DoClone()); - assert(typeid(*pClone) == typeid(*pObj)); - return pClone; - } + typedef R ResultType; + typedef FunctorImplBase<R, ThreadingModel> FunctorImplBaseType; + + typedef EmptyType Parm1; + typedef EmptyType Parm2; + typedef EmptyType Parm3; + typedef EmptyType Parm4; + typedef EmptyType Parm5; + typedef EmptyType Parm6; + typedef EmptyType Parm7; + typedef EmptyType Parm8; + typedef EmptyType Parm9; + typedef EmptyType Parm10; + typedef EmptyType Parm11; + typedef EmptyType Parm12; + typedef EmptyType Parm13; + typedef EmptyType Parm14; + typedef EmptyType Parm15; + + + virtual ~FunctorImplBase() + {} + + virtual FunctorImplBase* DoClone() const = 0; + + template <class U> + static U* Clone(U* pObj) + { + if (!pObj) return 0; + U* pClone = static_cast<U*>(pObj->DoClone()); + assert(typeid(*pClone) == typeid(*pObj)); + return pClone; + } #ifdef LOKI_FUNCTORS_ARE_COMPARABLE - virtual bool operator==(const FunctorImplBase&) const = 0; - -#endif - - }; - } - + virtual bool operator==(const FunctorImplBase&) const = 0; + +#endif + +}; +} + //////////////////////////////////////////////////////////////////////////////// // macro LOKI_DEFINE_CLONE_FUNCTORIMPL // Implements the DoClone function for a functor implementation @@ -121,409 +122,409 @@ namespace Loki // Specializations of FunctorImpl for up to 15 parameters follow //////////////////////////////////////////////////////////////////////////////// - template <typename R, class TList, - template <class, class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL> - class FunctorImpl; +template <typename R, class TList, + template <class, class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL> +class FunctorImpl; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 0 (zero) parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, template <class, class> class ThreadingModel> - class FunctorImpl<R, NullType, ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - virtual R operator()() = 0; - }; +template <typename R, template <class, class> class ThreadingModel> +class FunctorImpl<R, NullType, ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + virtual R operator()() = 0; +}; - //////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 1 parameter //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, template <class, class> class ThreadingModel> - class FunctorImpl<R, Seq<P1>, ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - virtual R operator()(Parm1) = 0; - }; +template <typename R, typename P1, template <class, class> class ThreadingModel> +class FunctorImpl<R, Seq<P1>, ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + virtual R operator()(Parm1) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 2 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, - template <class, class> class ThreadingModel> - class FunctorImpl<R, Seq<P1, P2>, ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - virtual R operator()(Parm1, Parm2) = 0; - }; +template <typename R, typename P1, typename P2, + template <class, class> class ThreadingModel> +class FunctorImpl<R, Seq<P1, P2>, ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + virtual R operator()(Parm1, Parm2) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 3 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, - template <class, class> class ThreadingModel> - class FunctorImpl<R, Seq<P1, P2, P3>, ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - virtual R operator()(Parm1, Parm2, Parm3) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, + template <class, class> class ThreadingModel> +class FunctorImpl<R, Seq<P1, P2, P3>, ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + virtual R operator()(Parm1, Parm2, Parm3) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 4 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, typename P4, - template <class, class> class ThreadingModel> - class FunctorImpl<R, Seq<P1, P2, P3, P4>, ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - virtual R operator()(Parm1, Parm2, Parm3, Parm4) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, typename P4, + template <class, class> class ThreadingModel> +class FunctorImpl<R, Seq<P1, P2, P3, P4>, ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + virtual R operator()(Parm1, Parm2, Parm3, Parm4) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 5 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, - template <class, class> class ThreadingModel> - class FunctorImpl<R, Seq<P1, P2, P3, P4, P5>, ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, typename P4, + typename P5, + template <class, class> class ThreadingModel> +class FunctorImpl<R, Seq<P1, P2, P3, P4, P5>, ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 6 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, - template <class, class> class ThreadingModel> - class FunctorImpl<R, Seq<P1, P2, P3, P4, P5, P6>, ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, typename P4, + typename P5, typename P6, + template <class, class> class ThreadingModel> +class FunctorImpl<R, Seq<P1, P2, P3, P4, P5, P6>, ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 7 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename P7, - template <class, class> class ThreadingModel> - class FunctorImpl<R, Seq<P1, P2, P3, P4, P5, P6, P7>, ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, - Parm7) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, typename P4, + typename P5, typename P6, typename P7, + template <class, class> class ThreadingModel> +class FunctorImpl<R, Seq<P1, P2, P3, P4, P5, P6, P7>, ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + Parm7) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 8 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename P7, typename P8, - template <class, class> class ThreadingModel> - class FunctorImpl<R, Seq<P1, P2, P3, P4, P5, P6, P7, P8>, - ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, - Parm7, Parm8) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, typename P4, + typename P5, typename P6, typename P7, typename P8, + template <class, class> class ThreadingModel> +class FunctorImpl<R, Seq<P1, P2, P3, P4, P5, P6, P7, P8>, + ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + Parm7, Parm8) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 9 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename P7, typename P8, typename P9, - template <class, class> class ThreadingModel> - class FunctorImpl<R, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9>, - ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, - Parm7, Parm8, Parm9) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, typename P4, + typename P5, typename P6, typename P7, typename P8, typename P9, + template <class, class> class ThreadingModel> +class FunctorImpl<R, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9>, + ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + Parm7, Parm8, Parm9) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 10 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename P7, typename P8, typename P9, - typename P10, - template <class, class> class ThreadingModel> - class FunctorImpl<R, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10>, - ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - typedef typename TypeTraits<P10>::ParameterType Parm10; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, - Parm7, Parm8, Parm9, Parm10) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, typename P4, + typename P5, typename P6, typename P7, typename P8, typename P9, + typename P10, + template <class, class> class ThreadingModel> +class FunctorImpl<R, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10>, + ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + typedef typename TypeTraits<P10>::ParameterType Parm10; + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + Parm7, Parm8, Parm9, Parm10) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 11 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename P7, typename P8, typename P9, - typename P10, typename P11, - template <class, class> class ThreadingModel> - class FunctorImpl<R, - Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11>, - ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - typedef typename TypeTraits<P10>::ParameterType Parm10; - typedef typename TypeTraits<P11>::ParameterType Parm11; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, - Parm7, Parm8, Parm9, Parm10, Parm11) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, typename P4, + typename P5, typename P6, typename P7, typename P8, typename P9, + typename P10, typename P11, + template <class, class> class ThreadingModel> +class FunctorImpl<R, + Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11>, + ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + typedef typename TypeTraits<P10>::ParameterType Parm10; + typedef typename TypeTraits<P11>::ParameterType Parm11; + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + Parm7, Parm8, Parm9, Parm10, Parm11) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 12 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename P7, typename P8, typename P9, - typename P10, typename P11, typename P12, - template <class, class> class ThreadingModel> - class FunctorImpl<R, - Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12>, - ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - typedef typename TypeTraits<P10>::ParameterType Parm10; - typedef typename TypeTraits<P11>::ParameterType Parm11; - typedef typename TypeTraits<P12>::ParameterType Parm12; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, - Parm7, Parm8, Parm9, Parm10, Parm11, Parm12) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, typename P4, + typename P5, typename P6, typename P7, typename P8, typename P9, + typename P10, typename P11, typename P12, + template <class, class> class ThreadingModel> +class FunctorImpl<R, + Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12>, + ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + typedef typename TypeTraits<P10>::ParameterType Parm10; + typedef typename TypeTraits<P11>::ParameterType Parm11; + typedef typename TypeTraits<P12>::ParameterType Parm12; + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + Parm7, Parm8, Parm9, Parm10, Parm11, Parm12) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 13 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename P7, typename P8, typename P9, - typename P10, typename P11, typename P12, typename P13, - template <class, class> class ThreadingModel> - class FunctorImpl<R, - Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13>, - ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - typedef typename TypeTraits<P10>::ParameterType Parm10; - typedef typename TypeTraits<P11>::ParameterType Parm11; - typedef typename TypeTraits<P12>::ParameterType Parm12; - typedef typename TypeTraits<P13>::ParameterType Parm13; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, - Parm7, Parm8, Parm9, Parm10, Parm11, Parm12, Parm13) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, typename P4, + typename P5, typename P6, typename P7, typename P8, typename P9, + typename P10, typename P11, typename P12, typename P13, + template <class, class> class ThreadingModel> +class FunctorImpl<R, + Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13>, + ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + typedef typename TypeTraits<P10>::ParameterType Parm10; + typedef typename TypeTraits<P11>::ParameterType Parm11; + typedef typename TypeTraits<P12>::ParameterType Parm12; + typedef typename TypeTraits<P13>::ParameterType Parm13; + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + Parm7, Parm8, Parm9, Parm10, Parm11, Parm12, Parm13) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 14 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename P7, typename P8, typename P9, - typename P10, typename P11, typename P12, typename P13, typename P14, - template <class, class> class ThreadingModel> - class FunctorImpl<R, - Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, - P14>, - ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - typedef typename TypeTraits<P10>::ParameterType Parm10; - typedef typename TypeTraits<P11>::ParameterType Parm11; - typedef typename TypeTraits<P12>::ParameterType Parm12; - typedef typename TypeTraits<P13>::ParameterType Parm13; - typedef typename TypeTraits<P14>::ParameterType Parm14; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, - Parm7, Parm8, Parm9, Parm10, Parm11, Parm12, Parm13, Parm14) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, typename P4, + typename P5, typename P6, typename P7, typename P8, typename P9, + typename P10, typename P11, typename P12, typename P13, typename P14, + template <class, class> class ThreadingModel> +class FunctorImpl<R, + Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, + P14>, + ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + typedef typename TypeTraits<P10>::ParameterType Parm10; + typedef typename TypeTraits<P11>::ParameterType Parm11; + typedef typename TypeTraits<P12>::ParameterType Parm12; + typedef typename TypeTraits<P13>::ParameterType Parm13; + typedef typename TypeTraits<P14>::ParameterType Parm14; + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + Parm7, Parm8, Parm9, Parm10, Parm11, Parm12, Parm13, Parm14) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 15 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename P7, typename P8, typename P9, - typename P10, typename P11, typename P12, typename P13, typename P14, - typename P15, template <class, class> class ThreadingModel> - class FunctorImpl<R, - Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, - P14, P15>, - ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - typedef typename TypeTraits<P10>::ParameterType Parm10; - typedef typename TypeTraits<P11>::ParameterType Parm11; - typedef typename TypeTraits<P12>::ParameterType Parm12; - typedef typename TypeTraits<P13>::ParameterType Parm13; - typedef typename TypeTraits<P14>::ParameterType Parm14; - typedef typename TypeTraits<P15>::ParameterType Parm15; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, - Parm7, Parm8, Parm9, Parm10, Parm11, Parm12, Parm13, Parm14, - Parm15) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, typename P4, + typename P5, typename P6, typename P7, typename P8, typename P9, + typename P10, typename P11, typename P12, typename P13, typename P14, + typename P15, template <class, class> class ThreadingModel> +class FunctorImpl<R, + Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, + P14, P15>, + ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + typedef typename TypeTraits<P10>::ParameterType Parm10; + typedef typename TypeTraits<P11>::ParameterType Parm11; + typedef typename TypeTraits<P12>::ParameterType Parm12; + typedef typename TypeTraits<P13>::ParameterType Parm13; + typedef typename TypeTraits<P14>::ParameterType Parm14; + typedef typename TypeTraits<P15>::ParameterType Parm15; + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + Parm7, Parm8, Parm9, Parm10, Parm11, Parm12, Parm13, Parm14, + Parm15) = 0; +}; #ifndef LOKI_DISABLE_TYPELIST_MACROS @@ -532,386 +533,386 @@ namespace Loki // Specialization for 1 parameter //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, template <class, class> class ThreadingModel> - class FunctorImpl<R, LOKI_TYPELIST_1(P1), ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - virtual R operator()(Parm1) = 0; - }; +template <typename R, typename P1, template <class, class> class ThreadingModel> +class FunctorImpl<R, LOKI_TYPELIST_1(P1), ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + virtual R operator()(Parm1) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 2 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, - template <class, class> class ThreadingModel> - class FunctorImpl<R, LOKI_TYPELIST_2(P1, P2), ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - virtual R operator()(Parm1, Parm2) = 0; - }; +template <typename R, typename P1, typename P2, + template <class, class> class ThreadingModel> +class FunctorImpl<R, LOKI_TYPELIST_2(P1, P2), ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + virtual R operator()(Parm1, Parm2) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 3 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, - template <class, class> class ThreadingModel> - class FunctorImpl<R, LOKI_TYPELIST_3(P1, P2, P3), ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - virtual R operator()(Parm1, Parm2, Parm3) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, + template <class, class> class ThreadingModel> +class FunctorImpl<R, LOKI_TYPELIST_3(P1, P2, P3), ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + virtual R operator()(Parm1, Parm2, Parm3) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 4 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, typename P4, - template <class, class> class ThreadingModel> - class FunctorImpl<R, LOKI_TYPELIST_4(P1, P2, P3, P4), ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - virtual R operator()(Parm1, Parm2, Parm3, Parm4) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, typename P4, + template <class, class> class ThreadingModel> +class FunctorImpl<R, LOKI_TYPELIST_4(P1, P2, P3, P4), ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + virtual R operator()(Parm1, Parm2, Parm3, Parm4) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 5 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, - template <class, class> class ThreadingModel> - class FunctorImpl<R, LOKI_TYPELIST_5(P1, P2, P3, P4, P5), ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, typename P4, + typename P5, + template <class, class> class ThreadingModel> +class FunctorImpl<R, LOKI_TYPELIST_5(P1, P2, P3, P4, P5), ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 6 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, - template <class, class> class ThreadingModel> - class FunctorImpl<R, LOKI_TYPELIST_6(P1, P2, P3, P4, P5, P6), ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, typename P4, + typename P5, typename P6, + template <class, class> class ThreadingModel> +class FunctorImpl<R, LOKI_TYPELIST_6(P1, P2, P3, P4, P5, P6), ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 7 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename P7, - template <class, class> class ThreadingModel> - class FunctorImpl<R, LOKI_TYPELIST_7(P1, P2, P3, P4, P5, P6, P7), ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, - Parm7) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, typename P4, + typename P5, typename P6, typename P7, + template <class, class> class ThreadingModel> +class FunctorImpl<R, LOKI_TYPELIST_7(P1, P2, P3, P4, P5, P6, P7), ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + Parm7) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 8 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename P7, typename P8, - template <class, class> class ThreadingModel> - class FunctorImpl<R, LOKI_TYPELIST_8(P1, P2, P3, P4, P5, P6, P7, P8), - ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, - Parm7, Parm8) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, typename P4, + typename P5, typename P6, typename P7, typename P8, + template <class, class> class ThreadingModel> +class FunctorImpl<R, LOKI_TYPELIST_8(P1, P2, P3, P4, P5, P6, P7, P8), + ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + Parm7, Parm8) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 9 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename P7, typename P8, typename P9, - template <class, class> class ThreadingModel> - class FunctorImpl<R, LOKI_TYPELIST_9(P1, P2, P3, P4, P5, P6, P7, P8, P9), - ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, - Parm7, Parm8, Parm9) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, typename P4, + typename P5, typename P6, typename P7, typename P8, typename P9, + template <class, class> class ThreadingModel> +class FunctorImpl<R, LOKI_TYPELIST_9(P1, P2, P3, P4, P5, P6, P7, P8, P9), + ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + Parm7, Parm8, Parm9) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 10 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename P7, typename P8, typename P9, - typename P10, - template <class, class> class ThreadingModel> - class FunctorImpl<R, LOKI_TYPELIST_10(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10), - ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - typedef typename TypeTraits<P10>::ParameterType Parm10; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, - Parm7, Parm8, Parm9, Parm10) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, typename P4, + typename P5, typename P6, typename P7, typename P8, typename P9, + typename P10, + template <class, class> class ThreadingModel> +class FunctorImpl<R, LOKI_TYPELIST_10(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10), + ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + typedef typename TypeTraits<P10>::ParameterType Parm10; + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + Parm7, Parm8, Parm9, Parm10) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 11 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename P7, typename P8, typename P9, - typename P10, typename P11, - template <class, class> class ThreadingModel> - class FunctorImpl<R, - LOKI_TYPELIST_11(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11), - ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - typedef typename TypeTraits<P10>::ParameterType Parm10; - typedef typename TypeTraits<P11>::ParameterType Parm11; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, - Parm7, Parm8, Parm9, Parm10, Parm11) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, typename P4, + typename P5, typename P6, typename P7, typename P8, typename P9, + typename P10, typename P11, + template <class, class> class ThreadingModel> +class FunctorImpl<R, + LOKI_TYPELIST_11(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11), + ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + typedef typename TypeTraits<P10>::ParameterType Parm10; + typedef typename TypeTraits<P11>::ParameterType Parm11; + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + Parm7, Parm8, Parm9, Parm10, Parm11) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 12 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename P7, typename P8, typename P9, - typename P10, typename P11, typename P12, - template <class, class> class ThreadingModel> - class FunctorImpl<R, - LOKI_TYPELIST_12(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12), - ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - typedef typename TypeTraits<P10>::ParameterType Parm10; - typedef typename TypeTraits<P11>::ParameterType Parm11; - typedef typename TypeTraits<P12>::ParameterType Parm12; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, - Parm7, Parm8, Parm9, Parm10, Parm11, Parm12) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, typename P4, + typename P5, typename P6, typename P7, typename P8, typename P9, + typename P10, typename P11, typename P12, + template <class, class> class ThreadingModel> +class FunctorImpl<R, + LOKI_TYPELIST_12(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12), + ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + typedef typename TypeTraits<P10>::ParameterType Parm10; + typedef typename TypeTraits<P11>::ParameterType Parm11; + typedef typename TypeTraits<P12>::ParameterType Parm12; + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + Parm7, Parm8, Parm9, Parm10, Parm11, Parm12) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 13 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename P7, typename P8, typename P9, - typename P10, typename P11, typename P12, typename P13, - template <class, class> class ThreadingModel> - class FunctorImpl<R, - LOKI_TYPELIST_13(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13), - ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - typedef typename TypeTraits<P10>::ParameterType Parm10; - typedef typename TypeTraits<P11>::ParameterType Parm11; - typedef typename TypeTraits<P12>::ParameterType Parm12; - typedef typename TypeTraits<P13>::ParameterType Parm13; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, - Parm7, Parm8, Parm9, Parm10, Parm11, Parm12, Parm13) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, typename P4, + typename P5, typename P6, typename P7, typename P8, typename P9, + typename P10, typename P11, typename P12, typename P13, + template <class, class> class ThreadingModel> +class FunctorImpl<R, + LOKI_TYPELIST_13(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13), + ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + typedef typename TypeTraits<P10>::ParameterType Parm10; + typedef typename TypeTraits<P11>::ParameterType Parm11; + typedef typename TypeTraits<P12>::ParameterType Parm12; + typedef typename TypeTraits<P13>::ParameterType Parm13; + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + Parm7, Parm8, Parm9, Parm10, Parm11, Parm12, Parm13) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 14 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename P7, typename P8, typename P9, - typename P10, typename P11, typename P12, typename P13, typename P14, - template <class, class> class ThreadingModel> - class FunctorImpl<R, - LOKI_TYPELIST_14(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, - P14), - ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - typedef typename TypeTraits<P10>::ParameterType Parm10; - typedef typename TypeTraits<P11>::ParameterType Parm11; - typedef typename TypeTraits<P12>::ParameterType Parm12; - typedef typename TypeTraits<P13>::ParameterType Parm13; - typedef typename TypeTraits<P14>::ParameterType Parm14; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, - Parm7, Parm8, Parm9, Parm10, Parm11, Parm12, Parm13, Parm14) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, typename P4, + typename P5, typename P6, typename P7, typename P8, typename P9, + typename P10, typename P11, typename P12, typename P13, typename P14, + template <class, class> class ThreadingModel> +class FunctorImpl<R, + LOKI_TYPELIST_14(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, + P14), + ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + typedef typename TypeTraits<P10>::ParameterType Parm10; + typedef typename TypeTraits<P11>::ParameterType Parm11; + typedef typename TypeTraits<P12>::ParameterType Parm12; + typedef typename TypeTraits<P13>::ParameterType Parm13; + typedef typename TypeTraits<P14>::ParameterType Parm14; + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + Parm7, Parm8, Parm9, Parm10, Parm11, Parm12, Parm13, Parm14) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorImpl // Specialization for 15 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename P7, typename P8, typename P9, - typename P10, typename P11, typename P12, typename P13, typename P14, - typename P15, template <class, class> class ThreadingModel> - class FunctorImpl<R, - LOKI_TYPELIST_15(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, - P14, P15), - ThreadingModel> - : public Private::FunctorImplBase<R, ThreadingModel> - { - public: - typedef R ResultType; - typedef typename TypeTraits<P1>::ParameterType Parm1; - typedef typename TypeTraits<P2>::ParameterType Parm2; - typedef typename TypeTraits<P3>::ParameterType Parm3; - typedef typename TypeTraits<P4>::ParameterType Parm4; - typedef typename TypeTraits<P5>::ParameterType Parm5; - typedef typename TypeTraits<P6>::ParameterType Parm6; - typedef typename TypeTraits<P7>::ParameterType Parm7; - typedef typename TypeTraits<P8>::ParameterType Parm8; - typedef typename TypeTraits<P9>::ParameterType Parm9; - typedef typename TypeTraits<P10>::ParameterType Parm10; - typedef typename TypeTraits<P11>::ParameterType Parm11; - typedef typename TypeTraits<P12>::ParameterType Parm12; - typedef typename TypeTraits<P13>::ParameterType Parm13; - typedef typename TypeTraits<P14>::ParameterType Parm14; - typedef typename TypeTraits<P15>::ParameterType Parm15; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, - Parm7, Parm8, Parm9, Parm10, Parm11, Parm12, Parm13, Parm14, - Parm15) = 0; - }; +template <typename R, typename P1, typename P2, typename P3, typename P4, + typename P5, typename P6, typename P7, typename P8, typename P9, + typename P10, typename P11, typename P12, typename P13, typename P14, + typename P15, template <class, class> class ThreadingModel> +class FunctorImpl<R, + LOKI_TYPELIST_15(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, + P14, P15), + ThreadingModel> + : public Private::FunctorImplBase<R, ThreadingModel> +{ +public: + typedef R ResultType; + typedef typename TypeTraits<P1>::ParameterType Parm1; + typedef typename TypeTraits<P2>::ParameterType Parm2; + typedef typename TypeTraits<P3>::ParameterType Parm3; + typedef typename TypeTraits<P4>::ParameterType Parm4; + typedef typename TypeTraits<P5>::ParameterType Parm5; + typedef typename TypeTraits<P6>::ParameterType Parm6; + typedef typename TypeTraits<P7>::ParameterType Parm7; + typedef typename TypeTraits<P8>::ParameterType Parm8; + typedef typename TypeTraits<P9>::ParameterType Parm9; + typedef typename TypeTraits<P10>::ParameterType Parm10; + typedef typename TypeTraits<P11>::ParameterType Parm11; + typedef typename TypeTraits<P12>::ParameterType Parm12; + typedef typename TypeTraits<P13>::ParameterType Parm13; + typedef typename TypeTraits<P14>::ParameterType Parm14; + typedef typename TypeTraits<P15>::ParameterType Parm15; + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + Parm7, Parm8, Parm9, Parm10, Parm11, Parm12, Parm13, Parm14, + Parm15) = 0; +}; #endif //LOKI_DISABLE_TYPELIST_MACROS @@ -920,275 +921,275 @@ namespace Loki // Wraps functors and pointers to functions //////////////////////////////////////////////////////////////////////////////// - template <class ParentFunctor, typename Fun> - class FunctorHandler - : public ParentFunctor::Impl - { - typedef typename ParentFunctor::Impl Base; - - public: - typedef typename Base::ResultType ResultType; - typedef typename Base::Parm1 Parm1; - typedef typename Base::Parm2 Parm2; - typedef typename Base::Parm3 Parm3; - typedef typename Base::Parm4 Parm4; - typedef typename Base::Parm5 Parm5; - typedef typename Base::Parm6 Parm6; - typedef typename Base::Parm7 Parm7; - typedef typename Base::Parm8 Parm8; - typedef typename Base::Parm9 Parm9; - typedef typename Base::Parm10 Parm10; - typedef typename Base::Parm11 Parm11; - typedef typename Base::Parm12 Parm12; - typedef typename Base::Parm13 Parm13; - typedef typename Base::Parm14 Parm14; - typedef typename Base::Parm15 Parm15; - - FunctorHandler(const Fun& fun) : f_(fun) {} - - LOKI_DEFINE_CLONE_FUNCTORIMPL(FunctorHandler) +template <class ParentFunctor, typename Fun> +class FunctorHandler + : public ParentFunctor::Impl +{ + typedef typename ParentFunctor::Impl Base; + +public: + typedef typename Base::ResultType ResultType; + typedef typename Base::Parm1 Parm1; + typedef typename Base::Parm2 Parm2; + typedef typename Base::Parm3 Parm3; + typedef typename Base::Parm4 Parm4; + typedef typename Base::Parm5 Parm5; + typedef typename Base::Parm6 Parm6; + typedef typename Base::Parm7 Parm7; + typedef typename Base::Parm8 Parm8; + typedef typename Base::Parm9 Parm9; + typedef typename Base::Parm10 Parm10; + typedef typename Base::Parm11 Parm11; + typedef typename Base::Parm12 Parm12; + typedef typename Base::Parm13 Parm13; + typedef typename Base::Parm14 Parm14; + typedef typename Base::Parm15 Parm15; + + FunctorHandler(const Fun& fun) : f_(fun) {} + + LOKI_DEFINE_CLONE_FUNCTORIMPL(FunctorHandler) #ifdef LOKI_FUNCTORS_ARE_COMPARABLE - bool operator==(const typename Base::FunctorImplBaseType& rhs) const - { - // there is no static information if Functor holds a member function - // or a free function; this is the main difference to tr1::function - if(typeid(*this) != typeid(rhs)) - return false; // cannot be equal - - const FunctorHandler& fh = static_cast<const FunctorHandler&>(rhs); - // if this line gives a compiler error, you are using a function object. - // you need to implement bool MyFnObj::operator == (const MyFnObj&) const; - return f_==fh.f_; - } + bool operator==(const typename Base::FunctorImplBaseType& rhs) const + { + // there is no static information if Functor holds a member function + // or a free function; this is the main difference to tr1::function + if(typeid(*this) != typeid(rhs)) + return false; // cannot be equal + + const FunctorHandler& fh = static_cast<const FunctorHandler&>(rhs); + // if this line gives a compiler error, you are using a function object. + // you need to implement bool MyFnObj::operator == (const MyFnObj&) const; + return f_==fh.f_; + } #endif - // operator() implementations for up to 15 arguments - - ResultType operator()() - { return f_(); } - - ResultType operator()(Parm1 p1) - { return f_(p1); } - - ResultType operator()(Parm1 p1, Parm2 p2) - { return f_(p1, p2); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3) - { return f_(p1, p2, p3); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4) - { return f_(p1, p2, p3, p4); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5) - { return f_(p1, p2, p3, p4, p5); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6) - { return f_(p1, p2, p3, p4, p5, p6); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7) - { return f_(p1, p2, p3, p4, p5, p6, p7); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8) - { return f_(p1, p2, p3, p4, p5, p6, p7, p8); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9) - { return f_(p1, p2, p3, p4, p5, p6, p7, p8, p9); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10) - { return f_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11) - { return f_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, - Parm12 p12) - { return f_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, - Parm12 p12, Parm13 p13) - { return f_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, - Parm12 p12, Parm13 p13, Parm14 p14) - { - return f_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, - p14); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, - Parm12 p12, Parm13 p13, Parm14 p14, Parm15 p15) - { - return f_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, - p14, p15); - } - - private: - Fun f_; - }; - + // operator() implementations for up to 15 arguments + + ResultType operator()() + { return f_(); } + + ResultType operator()(Parm1 p1) + { return f_(p1); } + + ResultType operator()(Parm1 p1, Parm2 p2) + { return f_(p1, p2); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3) + { return f_(p1, p2, p3); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4) + { return f_(p1, p2, p3, p4); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5) + { return f_(p1, p2, p3, p4, p5); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6) + { return f_(p1, p2, p3, p4, p5, p6); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7) + { return f_(p1, p2, p3, p4, p5, p6, p7); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8) + { return f_(p1, p2, p3, p4, p5, p6, p7, p8); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9) + { return f_(p1, p2, p3, p4, p5, p6, p7, p8, p9); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10) + { return f_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11) + { return f_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, + Parm12 p12) + { return f_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, + Parm12 p12, Parm13 p13) + { return f_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, + Parm12 p12, Parm13 p13, Parm14 p14) + { + return f_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, + p14); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, + Parm12 p12, Parm13 p13, Parm14 p14, Parm15 p15) + { + return f_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, + p14, p15); + } + +private: + Fun f_; +}; + //////////////////////////////////////////////////////////////////////////////// // class template FunctorHandler // Wraps pointers to member functions //////////////////////////////////////////////////////////////////////////////// - template <class ParentFunctor, typename PointerToObj, - typename PointerToMemFn> - class MemFunHandler : public ParentFunctor::Impl - { - typedef typename ParentFunctor::Impl Base; - - public: - typedef typename Base::ResultType ResultType; - typedef typename Base::Parm1 Parm1; - typedef typename Base::Parm2 Parm2; - typedef typename Base::Parm3 Parm3; - typedef typename Base::Parm4 Parm4; - typedef typename Base::Parm5 Parm5; - typedef typename Base::Parm6 Parm6; - typedef typename Base::Parm7 Parm7; - typedef typename Base::Parm8 Parm8; - typedef typename Base::Parm9 Parm9; - typedef typename Base::Parm10 Parm10; - typedef typename Base::Parm11 Parm11; - typedef typename Base::Parm12 Parm12; - typedef typename Base::Parm13 Parm13; - typedef typename Base::Parm14 Parm14; - typedef typename Base::Parm15 Parm15; - - MemFunHandler(const PointerToObj& pObj, PointerToMemFn pMemFn) +template <class ParentFunctor, typename PointerToObj, + typename PointerToMemFn> +class MemFunHandler : public ParentFunctor::Impl +{ + typedef typename ParentFunctor::Impl Base; + +public: + typedef typename Base::ResultType ResultType; + typedef typename Base::Parm1 Parm1; + typedef typename Base::Parm2 Parm2; + typedef typename Base::Parm3 Parm3; + typedef typename Base::Parm4 Parm4; + typedef typename Base::Parm5 Parm5; + typedef typename Base::Parm6 Parm6; + typedef typename Base::Parm7 Parm7; + typedef typename Base::Parm8 Parm8; + typedef typename Base::Parm9 Parm9; + typedef typename Base::Parm10 Parm10; + typedef typename Base::Parm11 Parm11; + typedef typename Base::Parm12 Parm12; + typedef typename Base::Parm13 Parm13; + typedef typename Base::Parm14 Parm14; + typedef typename Base::Parm15 Parm15; + + MemFunHandler(const PointerToObj& pObj, PointerToMemFn pMemFn) : pObj_(pObj), pMemFn_(pMemFn) - {} - - LOKI_DEFINE_CLONE_FUNCTORIMPL(MemFunHandler) + {} + + LOKI_DEFINE_CLONE_FUNCTORIMPL(MemFunHandler) #ifdef LOKI_FUNCTORS_ARE_COMPARABLE - bool operator==(const typename Base::FunctorImplBaseType& rhs) const - { - if(typeid(*this) != typeid(rhs)) - return false; // cannot be equal - - const MemFunHandler& mfh = static_cast<const MemFunHandler&>(rhs); - // if this line gives a compiler error, you are using a function object. - // you need to implement bool MyFnObj::operator == (const MyFnObj&) const; - return pObj_==mfh.pObj_ && pMemFn_==mfh.pMemFn_; - } -#endif - - ResultType operator()() - { return ((*pObj_).*pMemFn_)(); } - - ResultType operator()(Parm1 p1) - { return ((*pObj_).*pMemFn_)(p1); } - - ResultType operator()(Parm1 p1, Parm2 p2) - { return ((*pObj_).*pMemFn_)(p1, p2); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3) - { return ((*pObj_).*pMemFn_)(p1, p2, p3); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4) - { return ((*pObj_).*pMemFn_)(p1, p2, p3, p4); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5) - { return ((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6) - { return ((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5, p6); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7) - { return ((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5, p6, p7); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8) - { return ((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5, p6, p7, p8); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9) - { return ((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5, p6, p7, p8, p9); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10) - { return ((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11) - { - return ((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, - p11); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, - Parm12 p12) - { - return ((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, - p11, p12); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, - Parm12 p12, Parm13 p13) - { - return ((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, - p11, p12, p13); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, - Parm12 p12, Parm13 p13, Parm14 p14) - { - return ((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, - p11, p12, p13, p14); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, - Parm12 p12, Parm13 p13, Parm14 p14, Parm15 p15) - { - return ((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, - p11, p12, p13, p14, p15); - } - - private: - PointerToObj pObj_; - PointerToMemFn pMemFn_; - }; - + bool operator==(const typename Base::FunctorImplBaseType& rhs) const + { + if(typeid(*this) != typeid(rhs)) + return false; // cannot be equal + + const MemFunHandler& mfh = static_cast<const MemFunHandler&>(rhs); + // if this line gives a compiler error, you are using a function object. + // you need to implement bool MyFnObj::operator == (const MyFnObj&) const; + return pObj_==mfh.pObj_ && pMemFn_==mfh.pMemFn_; + } +#endif + + ResultType operator()() + { return ((*pObj_).*pMemFn_)(); } + + ResultType operator()(Parm1 p1) + { return ((*pObj_).*pMemFn_)(p1); } + + ResultType operator()(Parm1 p1, Parm2 p2) + { return ((*pObj_).*pMemFn_)(p1, p2); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3) + { return ((*pObj_).*pMemFn_)(p1, p2, p3); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4) + { return ((*pObj_).*pMemFn_)(p1, p2, p3, p4); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5) + { return ((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6) + { return ((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5, p6); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7) + { return ((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5, p6, p7); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8) + { return ((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5, p6, p7, p8); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9) + { return ((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5, p6, p7, p8, p9); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10) + { return ((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11) + { + return ((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, + p11); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, + Parm12 p12) + { + return ((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, + p11, p12); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, + Parm12 p12, Parm13 p13) + { + return ((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, + p11, p12, p13); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, + Parm12 p12, Parm13 p13, Parm14 p14) + { + return ((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, + p11, p12, p13, p14); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, + Parm12 p12, Parm13 p13, Parm14 p14, Parm15 p15) + { + return ((*pObj_).*pMemFn_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, + p11, p12, p13, p14, p15); + } + +private: + PointerToObj pObj_; + PointerToMemFn pMemFn_; +}; + //////////////////////////////////////////////////////////////////////////////// // TR1 exception ////////////////////////////////////////////////////////////////////////////////// #ifdef LOKI_ENABLE_FUNCTION - class bad_function_call : public std::runtime_error - { - public: - bad_function_call() : std::runtime_error("bad_function_call in Loki::Functor") - {} - }; +class bad_function_call : public std::runtime_error +{ +public: + bad_function_call() : std::runtime_error("bad_function_call in Loki::Functor") + {} +}; #define LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL if(empty()) throw bad_function_call(); #else -#define LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL +#define LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL #endif @@ -1199,9 +1200,9 @@ namespace Loki /// A generalized functor implementation with value semantics /// /// \par Macro: LOKI_FUNCTOR_IS_NOT_A_SMALLOBJECT -/// Define +/// Define /// \code LOKI_FUNCTOR_IS_NOT_A_SMALLOBJECT \endcode -/// to avoid static instantiation/delete +/// to avoid static instantiation/delete /// order problems. /// It often helps against crashes when using static Functors and multi threading. /// Defining also removes problems when unloading Dlls which hosts @@ -1210,415 +1211,415 @@ namespace Loki /// \par Macro: LOKI_FUNCTORS_ARE_COMPARABLE /// To enable the operator== define the macro /// \code LOKI_FUNCTORS_ARE_COMPARABLE \endcode -/// The macro is disabled by default, because it breaks compiling functor +/// The macro is disabled by default, because it breaks compiling functor /// objects which have no operator== implemented, keep in mind when you enable /// operator==. //////////////////////////////////////////////////////////////////////////////// - template <typename R = void, class TList = NullType, - template<class, class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL> - class Functor - { - public: - // Handy type definitions for the body type - typedef FunctorImpl<R, TList, ThreadingModel> Impl; - typedef R ResultType; - typedef TList ParmList; - typedef typename Impl::Parm1 Parm1; - typedef typename Impl::Parm2 Parm2; - typedef typename Impl::Parm3 Parm3; - typedef typename Impl::Parm4 Parm4; - typedef typename Impl::Parm5 Parm5; - typedef typename Impl::Parm6 Parm6; - typedef typename Impl::Parm7 Parm7; - typedef typename Impl::Parm8 Parm8; - typedef typename Impl::Parm9 Parm9; - typedef typename Impl::Parm10 Parm10; - typedef typename Impl::Parm11 Parm11; - typedef typename Impl::Parm12 Parm12; - typedef typename Impl::Parm13 Parm13; - typedef typename Impl::Parm14 Parm14; - typedef typename Impl::Parm15 Parm15; - - // Member functions - - Functor() : spImpl_(0) - {} - - Functor(const Functor& rhs) : spImpl_(Impl::Clone(rhs.spImpl_.get())) - {} - - Functor(std::auto_ptr<Impl> spImpl) : spImpl_(spImpl) - {} - - template <typename Fun> - Functor(Fun fun) +template <typename R = void, class TList = NullType, + template<class, class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL> +class Functor +{ +public: + // Handy type definitions for the body type + typedef FunctorImpl<R, TList, ThreadingModel> Impl; + typedef R ResultType; + typedef TList ParmList; + typedef typename Impl::Parm1 Parm1; + typedef typename Impl::Parm2 Parm2; + typedef typename Impl::Parm3 Parm3; + typedef typename Impl::Parm4 Parm4; + typedef typename Impl::Parm5 Parm5; + typedef typename Impl::Parm6 Parm6; + typedef typename Impl::Parm7 Parm7; + typedef typename Impl::Parm8 Parm8; + typedef typename Impl::Parm9 Parm9; + typedef typename Impl::Parm10 Parm10; + typedef typename Impl::Parm11 Parm11; + typedef typename Impl::Parm12 Parm12; + typedef typename Impl::Parm13 Parm13; + typedef typename Impl::Parm14 Parm14; + typedef typename Impl::Parm15 Parm15; + + // Member functions + + Functor() : spImpl_(0) + {} + + Functor(const Functor& rhs) : spImpl_(Impl::Clone(rhs.spImpl_.get())) + {} + + Functor(std::auto_ptr<Impl> spImpl) : spImpl_(spImpl) + {} + + template <typename Fun> + Functor(Fun fun) : spImpl_(new FunctorHandler<Functor, Fun>(fun)) - {} + {} - template <class PtrObj, typename MemFn> - Functor(const PtrObj& p, MemFn memFn) + template <class PtrObj, typename MemFn> + Functor(const PtrObj& p, MemFn memFn) : spImpl_(new MemFunHandler<Functor, PtrObj, MemFn>(p, memFn)) - {} + {} - typedef Impl * (std::auto_ptr<Impl>::*unspecified_bool_type)() const; + typedef Impl* (std::auto_ptr<Impl>::*unspecified_bool_type)() const; - operator unspecified_bool_type() const - { - return spImpl_.get() ? &std::auto_ptr<Impl>::get : 0; - } + operator unspecified_bool_type() const + { + return spImpl_.get() ? &std::auto_ptr<Impl>::get : 0; + } - Functor& operator=(const Functor& rhs) - { - Functor copy(rhs); - // swap auto_ptrs by hand - Impl* p = spImpl_.release(); - spImpl_.reset(copy.spImpl_.release()); - copy.spImpl_.reset(p); - return *this; - } + Functor& operator=(const Functor& rhs) + { + Functor copy(rhs); + // swap auto_ptrs by hand + Impl* p = spImpl_.release(); + spImpl_.reset(copy.spImpl_.release()); + copy.spImpl_.reset(p); + return *this; + } #ifdef LOKI_ENABLE_FUNCTION - bool empty() const - { - return spImpl_.get() == 0; - } + bool empty() const + { + return spImpl_.get() == 0; + } - void clear() - { - spImpl_.reset(0); - } + void clear() + { + spImpl_.reset(0); + } #endif #ifdef LOKI_FUNCTORS_ARE_COMPARABLE - bool operator==(const Functor& rhs) const - { - if(spImpl_.get()==0 && rhs.spImpl_.get()==0) - return true; - if(spImpl_.get()!=0 && rhs.spImpl_.get()!=0) - return *spImpl_.get() == *rhs.spImpl_.get(); - else - return false; - } - - bool operator!=(const Functor& rhs) const - { - return !(*this==rhs); - } + bool operator==(const Functor& rhs) const + { + if(spImpl_.get()==0 && rhs.spImpl_.get()==0) + return true; + if(spImpl_.get()!=0 && rhs.spImpl_.get()!=0) + return *spImpl_.get() == *rhs.spImpl_.get(); + else + return false; + } + + bool operator!=(const Functor& rhs) const + { + return !(*this==rhs); + } #endif - // operator() implementations for up to 15 arguments - - ResultType operator()() const - { - LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL - return (*spImpl_)(); - } - - ResultType operator()(Parm1 p1) const - { - LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL - return (*spImpl_)(p1); - } - - ResultType operator()(Parm1 p1, Parm2 p2) const - { - LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL - return (*spImpl_)(p1, p2); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3) const - { - LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL - return (*spImpl_)(p1, p2, p3); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4) const - { - LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL - return (*spImpl_)(p1, p2, p3, p4); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5) const - { - LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL - return (*spImpl_)(p1, p2, p3, p4, p5); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6) const - { - LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL - return (*spImpl_)(p1, p2, p3, p4, p5, p6); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7) const - { - LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL - return (*spImpl_)(p1, p2, p3, p4, p5, p6, p7); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8) const - { - LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL - return (*spImpl_)(p1, p2, p3, p4, p5, p6, p7, p8); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9) const - { - LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL - return (*spImpl_)(p1, p2, p3, p4, p5, p6, p7, p8, p9); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10) const - { - LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL - return (*spImpl_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11) const - { - LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL - return (*spImpl_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, - Parm12 p12) const - { - LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL - return (*spImpl_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, - p12); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, - Parm12 p12, Parm13 p13) const - { - LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL - return (*spImpl_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, - p12, p13); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, - Parm12 p12, Parm13 p13, Parm14 p14) const - { - LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL - return (*spImpl_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, - p12, p13, p14); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, - Parm12 p12, Parm13 p13, Parm14 p14, Parm15 p15) const - { - LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL - return (*spImpl_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, - p12, p13, p14, p15); - } - - private: - std::auto_ptr<Impl> spImpl_; - }; - - -//////////////////////////////////////////////////////////////////////////////// -// -// BindersFirst and Chainer + // operator() implementations for up to 15 arguments + + ResultType operator()() const + { + LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL + return (*spImpl_)(); + } + + ResultType operator()(Parm1 p1) const + { + LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL + return (*spImpl_)(p1); + } + + ResultType operator()(Parm1 p1, Parm2 p2) const + { + LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL + return (*spImpl_)(p1, p2); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3) const + { + LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL + return (*spImpl_)(p1, p2, p3); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4) const + { + LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL + return (*spImpl_)(p1, p2, p3, p4); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5) const + { + LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL + return (*spImpl_)(p1, p2, p3, p4, p5); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6) const + { + LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL + return (*spImpl_)(p1, p2, p3, p4, p5, p6); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7) const + { + LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL + return (*spImpl_)(p1, p2, p3, p4, p5, p6, p7); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8) const + { + LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL + return (*spImpl_)(p1, p2, p3, p4, p5, p6, p7, p8); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9) const + { + LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL + return (*spImpl_)(p1, p2, p3, p4, p5, p6, p7, p8, p9); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10) const + { + LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL + return (*spImpl_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11) const + { + LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL + return (*spImpl_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, + Parm12 p12) const + { + LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL + return (*spImpl_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, + p12); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, + Parm12 p12, Parm13 p13) const + { + LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL + return (*spImpl_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, + p12, p13); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, + Parm12 p12, Parm13 p13, Parm14 p14) const + { + LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL + return (*spImpl_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, + p12, p13, p14); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, + Parm12 p12, Parm13 p13, Parm14 p14, Parm15 p15) const + { + LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL + return (*spImpl_)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, + p12, p13, p14, p15); + } + +private: + std::auto_ptr<Impl> spImpl_; +}; + + +//////////////////////////////////////////////////////////////////////////////// +// +// BindersFirst and Chainer // //////////////////////////////////////////////////////////////////////////////// - namespace Private - { - template <class Fctor> struct BinderFirstTraits; +namespace Private +{ +template <class Fctor> struct BinderFirstTraits; + +template <typename R, class TList, template <class, class> class ThreadingModel> +struct BinderFirstTraits< Functor<R, TList, ThreadingModel> > +{ + typedef Functor<R, TList, ThreadingModel> OriginalFunctor; - template <typename R, class TList, template <class, class> class ThreadingModel> - struct BinderFirstTraits< Functor<R, TList, ThreadingModel> > - { - typedef Functor<R, TList, ThreadingModel> OriginalFunctor; + typedef typename TL::Erase<TList,typename TL::TypeAt<TList, 0>::Result> + ::Result + ParmList; - typedef typename TL::Erase<TList,typename TL::TypeAt<TList, 0>::Result> - ::Result - ParmList; + typedef typename TL::TypeAt<TList, 0>::Result OriginalParm1; - typedef typename TL::TypeAt<TList, 0>::Result OriginalParm1; + typedef Functor<R, ParmList, ThreadingModel> BoundFunctorType; - typedef Functor<R, ParmList, ThreadingModel> BoundFunctorType; + typedef typename BoundFunctorType::Impl Impl; - typedef typename BoundFunctorType::Impl Impl; +}; - }; +template<class T> +struct BinderFirstBoundTypeStorage; - template<class T> - struct BinderFirstBoundTypeStorage; +template<class T> +struct BinderFirstBoundTypeStorage +{ + typedef typename TypeTraits<T>::ParameterType RefOrValue; +}; - template<class T> - struct BinderFirstBoundTypeStorage - { - typedef typename TypeTraits<T>::ParameterType RefOrValue; - }; - - template <typename R, class TList, template <class, class> class ThreadingModel> - struct BinderFirstBoundTypeStorage< Functor<R, TList, ThreadingModel> > - { - typedef Functor<R, TList, ThreadingModel> OriginalFunctor; - typedef const typename TypeTraits<OriginalFunctor>::ReferredType RefOrValue; - }; +template <typename R, class TList, template <class, class> class ThreadingModel> +struct BinderFirstBoundTypeStorage< Functor<R, TList, ThreadingModel> > +{ + typedef Functor<R, TList, ThreadingModel> OriginalFunctor; + typedef const typename TypeTraits<OriginalFunctor>::ReferredType RefOrValue; +}; - } // namespace Private +} // namespace Private //////////////////////////////////////////////////////////////////////////////// /// \class BinderFirst -/// +/// /// \ingroup FunctorGroup /// Binds the first parameter of a Functor object to a specific value //////////////////////////////////////////////////////////////////////////////// - template <class OriginalFunctor> - class BinderFirst - : public Private::BinderFirstTraits<OriginalFunctor>::Impl - { - typedef typename Private::BinderFirstTraits<OriginalFunctor>::Impl Base; - typedef typename OriginalFunctor::ResultType ResultType; - - typedef typename OriginalFunctor::Parm1 BoundType; - - typedef typename Private::BinderFirstBoundTypeStorage< - typename Private::BinderFirstTraits<OriginalFunctor> - ::OriginalParm1> - ::RefOrValue - BoundTypeStorage; - - typedef typename OriginalFunctor::Parm2 Parm1; - typedef typename OriginalFunctor::Parm3 Parm2; - typedef typename OriginalFunctor::Parm4 Parm3; - typedef typename OriginalFunctor::Parm5 Parm4; - typedef typename OriginalFunctor::Parm6 Parm5; - typedef typename OriginalFunctor::Parm7 Parm6; - typedef typename OriginalFunctor::Parm8 Parm7; - typedef typename OriginalFunctor::Parm9 Parm8; - typedef typename OriginalFunctor::Parm10 Parm9; - typedef typename OriginalFunctor::Parm11 Parm10; - typedef typename OriginalFunctor::Parm12 Parm11; - typedef typename OriginalFunctor::Parm13 Parm12; - typedef typename OriginalFunctor::Parm14 Parm13; - typedef typename OriginalFunctor::Parm15 Parm14; - typedef EmptyType Parm15; - - public: - - BinderFirst(const OriginalFunctor& fun, BoundType bound) +template <class OriginalFunctor> +class BinderFirst + : public Private::BinderFirstTraits<OriginalFunctor>::Impl +{ + typedef typename Private::BinderFirstTraits<OriginalFunctor>::Impl Base; + typedef typename OriginalFunctor::ResultType ResultType; + + typedef typename OriginalFunctor::Parm1 BoundType; + + typedef typename Private::BinderFirstBoundTypeStorage< + typename Private::BinderFirstTraits<OriginalFunctor> + ::OriginalParm1> + ::RefOrValue + BoundTypeStorage; + + typedef typename OriginalFunctor::Parm2 Parm1; + typedef typename OriginalFunctor::Parm3 Parm2; + typedef typename OriginalFunctor::Parm4 Parm3; + typedef typename OriginalFunctor::Parm5 Parm4; + typedef typename OriginalFunctor::Parm6 Parm5; + typedef typename OriginalFunctor::Parm7 Parm6; + typedef typename OriginalFunctor::Parm8 Parm7; + typedef typename OriginalFunctor::Parm9 Parm8; + typedef typename OriginalFunctor::Parm10 Parm9; + typedef typename OriginalFunctor::Parm11 Parm10; + typedef typename OriginalFunctor::Parm12 Parm11; + typedef typename OriginalFunctor::Parm13 Parm12; + typedef typename OriginalFunctor::Parm14 Parm13; + typedef typename OriginalFunctor::Parm15 Parm14; + typedef EmptyType Parm15; + +public: + + BinderFirst(const OriginalFunctor& fun, BoundType bound) : f_(fun), b_(bound) - {} + {} - LOKI_DEFINE_CLONE_FUNCTORIMPL(BinderFirst) + LOKI_DEFINE_CLONE_FUNCTORIMPL(BinderFirst) #ifdef LOKI_FUNCTORS_ARE_COMPARABLE - - bool operator==(const typename Base::FunctorImplBaseType& rhs) const - { - if(typeid(*this) != typeid(rhs)) - return false; // cannot be equal - // if this line gives a compiler error, you are using a function object. - // you need to implement bool MyFnObj::operator == (const MyFnObj&) const; - return f_ == ((static_cast<const BinderFirst&> (rhs)).f_) && - b_ == ((static_cast<const BinderFirst&> (rhs)).b_); - } + + bool operator==(const typename Base::FunctorImplBaseType& rhs) const + { + if(typeid(*this) != typeid(rhs)) + return false; // cannot be equal + // if this line gives a compiler error, you are using a function object. + // you need to implement bool MyFnObj::operator == (const MyFnObj&) const; + return f_ == ((static_cast<const BinderFirst&> (rhs)).f_) && + b_ == ((static_cast<const BinderFirst&> (rhs)).b_); + } #endif - // operator() implementations for up to 15 arguments - - ResultType operator()() - { return f_(b_); } - - ResultType operator()(Parm1 p1) - { return f_(b_, p1); } - - ResultType operator()(Parm1 p1, Parm2 p2) - { return f_(b_, p1, p2); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3) - { return f_(b_, p1, p2, p3); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4) - { return f_(b_, p1, p2, p3, p4); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5) - { return f_(b_, p1, p2, p3, p4, p5); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6) - { return f_(b_, p1, p2, p3, p4, p5, p6); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7) - { return f_(b_, p1, p2, p3, p4, p5, p6, p7); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8) - { return f_(b_, p1, p2, p3, p4, p5, p6, p7, p8); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9) - { return f_(b_, p1, p2, p3, p4, p5, p6, p7, p8, p9); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10) - { return f_(b_, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11) - { return f_(b_, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, - Parm12 p12) - { return f_(b_, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, - Parm12 p12, Parm13 p13) - { return f_(b_, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, - Parm12 p12, Parm13 p13, Parm14 p14) - { - return f_(b_, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, - p14); - } - - private: - OriginalFunctor f_; - BoundTypeStorage b_; - }; - + // operator() implementations for up to 15 arguments + + ResultType operator()() + { return f_(b_); } + + ResultType operator()(Parm1 p1) + { return f_(b_, p1); } + + ResultType operator()(Parm1 p1, Parm2 p2) + { return f_(b_, p1, p2); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3) + { return f_(b_, p1, p2, p3); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4) + { return f_(b_, p1, p2, p3, p4); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5) + { return f_(b_, p1, p2, p3, p4, p5); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6) + { return f_(b_, p1, p2, p3, p4, p5, p6); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7) + { return f_(b_, p1, p2, p3, p4, p5, p6, p7); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8) + { return f_(b_, p1, p2, p3, p4, p5, p6, p7, p8); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9) + { return f_(b_, p1, p2, p3, p4, p5, p6, p7, p8, p9); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10) + { return f_(b_, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11) + { return f_(b_, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, + Parm12 p12) + { return f_(b_, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, + Parm12 p12, Parm13 p13) + { return f_(b_, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, + Parm12 p12, Parm13 p13, Parm14 p14) + { + return f_(b_, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, + p14); + } + +private: + OriginalFunctor f_; + BoundTypeStorage b_; +}; + //////////////////////////////////////////////////////////////////////////////// /// Binds the first parameter of a Functor object to a specific value /// \ingroup FunctorGroup //////////////////////////////////////////////////////////////////////////////// - template <class Fctor> - typename Private::BinderFirstTraits<Fctor>::BoundFunctorType - BindFirst( - const Fctor& fun, - typename Fctor::Parm1 bound) - { - typedef typename Private::BinderFirstTraits<Fctor>::BoundFunctorType - Outgoing; - - return Outgoing(std::auto_ptr<typename Outgoing::Impl>( - new BinderFirst<Fctor>(fun, bound))); - } +template <class Fctor> +typename Private::BinderFirstTraits<Fctor>::BoundFunctorType +BindFirst( + const Fctor& fun, + typename Fctor::Parm1 bound) +{ + typedef typename Private::BinderFirstTraits<Fctor>::BoundFunctorType + Outgoing; + + return Outgoing(std::auto_ptr<typename Outgoing::Impl>( + new BinderFirst<Fctor>(fun, bound))); +} //////////////////////////////////////////////////////////////////////////////// /// \class Chainer @@ -1627,160 +1628,160 @@ namespace Loki /// Chains two functor calls one after another //////////////////////////////////////////////////////////////////////////////// - template <typename Fun1, typename Fun2> - class Chainer : public Fun2::Impl - { - typedef Fun2 Base; - - public: - typedef typename Base::ResultType ResultType; - typedef typename Base::Parm1 Parm1; - typedef typename Base::Parm2 Parm2; - typedef typename Base::Parm3 Parm3; - typedef typename Base::Parm4 Parm4; - typedef typename Base::Parm5 Parm5; - typedef typename Base::Parm6 Parm6; - typedef typename Base::Parm7 Parm7; - typedef typename Base::Parm8 Parm8; - typedef typename Base::Parm9 Parm9; - typedef typename Base::Parm10 Parm10; - typedef typename Base::Parm11 Parm11; - typedef typename Base::Parm12 Parm12; - typedef typename Base::Parm13 Parm13; - typedef typename Base::Parm14 Parm14; - typedef typename Base::Parm15 Parm15; - - Chainer(const Fun1& fun1, const Fun2& fun2) : f1_(fun1), f2_(fun2) {} - - LOKI_DEFINE_CLONE_FUNCTORIMPL(Chainer) +template <typename Fun1, typename Fun2> +class Chainer : public Fun2::Impl +{ + typedef Fun2 Base; + +public: + typedef typename Base::ResultType ResultType; + typedef typename Base::Parm1 Parm1; + typedef typename Base::Parm2 Parm2; + typedef typename Base::Parm3 Parm3; + typedef typename Base::Parm4 Parm4; + typedef typename Base::Parm5 Parm5; + typedef typename Base::Parm6 Parm6; + typedef typename Base::Parm7 Parm7; + typedef typename Base::Parm8 Parm8; + typedef typename Base::Parm9 Parm9; + typedef typename Base::Parm10 Parm10; + typedef typename Base::Parm11 Parm11; + typedef typename Base::Parm12 Parm12; + typedef typename Base::Parm13 Parm13; + typedef typename Base::Parm14 Parm14; + typedef typename Base::Parm15 Parm15; + + Chainer(const Fun1& fun1, const Fun2& fun2) : f1_(fun1), f2_(fun2) {} + + LOKI_DEFINE_CLONE_FUNCTORIMPL(Chainer) #ifdef LOKI_FUNCTORS_ARE_COMPARABLE - - bool operator==(const typename Base::Impl::FunctorImplBaseType& rhs) const - { - if(typeid(*this) != typeid(rhs)) - return false; // cannot be equal - // if this line gives a compiler error, you are using a function object. - // you need to implement bool MyFnObj::operator == (const MyFnObj&) const; - return f1_ == ((static_cast<const Chainer&> (rhs)).f2_) && - f2_ == ((static_cast<const Chainer&> (rhs)).f1_); - } + + bool operator==(const typename Base::Impl::FunctorImplBaseType& rhs) const + { + if(typeid(*this) != typeid(rhs)) + return false; // cannot be equal + // if this line gives a compiler error, you are using a function object. + // you need to implement bool MyFnObj::operator == (const MyFnObj&) const; + return f1_ == ((static_cast<const Chainer&> (rhs)).f2_) && + f2_ == ((static_cast<const Chainer&> (rhs)).f1_); + } #endif - // operator() implementations for up to 15 arguments - - ResultType operator()() - { return f1_(), f2_(); } - - ResultType operator()(Parm1 p1) - { return f1_(p1), f2_(p1); } - - ResultType operator()(Parm1 p1, Parm2 p2) - { return f1_(p1, p2), f2_(p1, p2); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3) - { return f1_(p1, p2, p3), f2_(p1, p2, p3); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4) - { return f1_(p1, p2, p3, p4), f2_(p1, p2, p3, p4); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5) - { return f1_(p1, p2, p3, p4, p5), f2_(p1, p2, p3, p4, p5); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6) - { return f1_(p1, p2, p3, p4, p5, p6), f2_(p1, p2, p3, p4, p5, p6); } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7) - { - return f1_(p1, p2, p3, p4, p5, p6, p7), - f2_(p1, p2, p3, p4, p5, p6, p7); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8) - { - return f1_(p1, p2, p3, p4, p5, p6, p7, p8), - f2_(p1, p2, p3, p4, p5, p6, p7, p8); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9) - { - return f1_(p1, p2, p3, p4, p5, p6, p7, p8, p9), - f2_(p1, p2, p3, p4, p5, p6, p7, p8, p9); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10) - { - return f1_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10), - f2_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11) - { - return f1_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11), - f2_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, - Parm12 p12) - { - return f1_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12), - f2_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, - Parm12 p12, Parm13 p13) - { - return f1_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), - f2_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, - Parm12 p12, Parm13 p13, Parm14 p14) - { - return f1_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, - p14), - f2_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, + // operator() implementations for up to 15 arguments + + ResultType operator()() + { return f1_(), f2_(); } + + ResultType operator()(Parm1 p1) + { return f1_(p1), f2_(p1); } + + ResultType operator()(Parm1 p1, Parm2 p2) + { return f1_(p1, p2), f2_(p1, p2); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3) + { return f1_(p1, p2, p3), f2_(p1, p2, p3); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4) + { return f1_(p1, p2, p3, p4), f2_(p1, p2, p3, p4); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5) + { return f1_(p1, p2, p3, p4, p5), f2_(p1, p2, p3, p4, p5); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6) + { return f1_(p1, p2, p3, p4, p5, p6), f2_(p1, p2, p3, p4, p5, p6); } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7) + { + return f1_(p1, p2, p3, p4, p5, p6, p7), + f2_(p1, p2, p3, p4, p5, p6, p7); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8) + { + return f1_(p1, p2, p3, p4, p5, p6, p7, p8), + f2_(p1, p2, p3, p4, p5, p6, p7, p8); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9) + { + return f1_(p1, p2, p3, p4, p5, p6, p7, p8, p9), + f2_(p1, p2, p3, p4, p5, p6, p7, p8, p9); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10) + { + return f1_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10), + f2_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11) + { + return f1_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11), + f2_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, + Parm12 p12) + { + return f1_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12), + f2_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, + Parm12 p12, Parm13 p13) + { + return f1_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), + f2_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, + Parm12 p12, Parm13 p13, Parm14 p14) + { + return f1_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, + p14), + f2_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14); - } - - ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, - Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, - Parm12 p12, Parm13 p13, Parm14 p14, Parm15 p15) - { - return f1_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, - p14, p15), - f2_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, - p14, p15); - } - - private: - Fun1 f1_; - Fun2 f2_; - }; - + } + + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, + Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, + Parm12 p12, Parm13 p13, Parm14 p14, Parm15 p15) + { + return f1_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, + p14, p15), + f2_(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, + p14, p15); + } + +private: + Fun1 f1_; + Fun2 f2_; +}; + //////////////////////////////////////////////////////////////////////////////// /// Chains two functor calls one after another /// \ingroup FunctorGroup //////////////////////////////////////////////////////////////////////////////// - template <class Fun1, class Fun2> - Fun2 Chain( - const Fun1& fun1, - const Fun2& fun2) - { - return Fun2(std::auto_ptr<typename Fun2::Impl>( - new Chainer<Fun1, Fun2>(fun1, fun2))); - } +template <class Fun1, class Fun2> +Fun2 Chain( + const Fun1& fun1, + const Fun2& fun2) +{ + return Fun2(std::auto_ptr<typename Fun2::Impl>( + new Chainer<Fun1, Fun2>(fun1, fun2))); +} } // namespace Loki diff --git a/shared/loki/HierarchyGenerators.h b/shared/loki/HierarchyGenerators.h index 3fa11ffc..83ec194c 100644 --- a/shared/loki/HierarchyGenerators.h +++ b/shared/loki/HierarchyGenerators.h @@ -2,14 +2,14 @@ // The Loki Library // Copyright (c) 2001 by Andrei Alexandrescu // This code accompanies the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author or Addison-Wesley Longman make no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author or Addison-Wesley Longman make no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_HIERARCHYGENERATORS_INC_ @@ -25,8 +25,8 @@ namespace Loki { #if defined(_MSC_VER) && _MSC_VER >= 1300 -#pragma warning( push ) - // 'class1' : base-class 'class2' is already a base-class of 'class3' +#pragma warning( push ) +// 'class1' : base-class 'class2' is already a base-class of 'class3' #pragma warning( disable : 4584 ) #endif // _MSC_VER @@ -35,180 +35,180 @@ namespace Loki // Generates a scattered hierarchy starting from a typelist and a template // Invocation (TList is a typelist, Unit is a template of one arg): // GenScatterHierarchy<TList, Unit> -// The generated class inherits all classes generated by instantiating the -// template 'Unit' with the types contained in TList +// The generated class inherits all classes generated by instantiating the +// template 'Unit' with the types contained in TList //////////////////////////////////////////////////////////////////////////////// - namespace Private - { - // The following type helps to overcome subtle flaw in the original - // implementation of GenScatterHierarchy. - // The flaw is revealed when the input type list of GenScatterHierarchy - // contains more then one element of the same type (e.g. LOKI_TYPELIST_2(int, int)). - // In this case GenScatterHierarchy will contain multiple bases of the same - // type and some of them will not be reachable (per 10.3). - // For example before the fix the first element of Tuple<LOKI_TYPELIST_2(int, int)> - // is not reachable in any way! - template<class, class> - struct ScatterHierarchyTag; - } +namespace Private +{ +// The following type helps to overcome subtle flaw in the original +// implementation of GenScatterHierarchy. +// The flaw is revealed when the input type list of GenScatterHierarchy +// contains more then one element of the same type (e.g. LOKI_TYPELIST_2(int, int)). +// In this case GenScatterHierarchy will contain multiple bases of the same +// type and some of them will not be reachable (per 10.3). +// For example before the fix the first element of Tuple<LOKI_TYPELIST_2(int, int)> +// is not reachable in any way! +template<class, class> +struct ScatterHierarchyTag; +} - template <class TList, template <class> class Unit> - class GenScatterHierarchy; - - template <class T1, class T2, template <class> class Unit> - class GenScatterHierarchy<Typelist<T1, T2>, Unit> - : public GenScatterHierarchy<Private::ScatterHierarchyTag<T1, T2>, Unit> - , public GenScatterHierarchy<T2, Unit> - { - public: - typedef Typelist<T1, T2> TList; - // Insure that LeftBase is unique and therefore reachable - typedef GenScatterHierarchy<Private::ScatterHierarchyTag<T1, T2>, Unit> LeftBase; - typedef GenScatterHierarchy<T2, Unit> RightBase; - template <typename T> struct Rebind - { - typedef Unit<T> Result; - }; - }; - - // In the middle *unique* class that resolve possible ambiguity - template <class T1, class T2, template <class> class Unit> - class GenScatterHierarchy<Private::ScatterHierarchyTag<T1, T2>, Unit> - : public GenScatterHierarchy<T1, Unit> +template <class TList, template <class> class Unit> +class GenScatterHierarchy; + +template <class T1, class T2, template <class> class Unit> +class GenScatterHierarchy<Typelist<T1, T2>, Unit> + : public GenScatterHierarchy<Private::ScatterHierarchyTag<T1, T2>, Unit> + , public GenScatterHierarchy<T2, Unit> +{ +public: + typedef Typelist<T1, T2> TList; + // Insure that LeftBase is unique and therefore reachable + typedef GenScatterHierarchy<Private::ScatterHierarchyTag<T1, T2>, Unit> LeftBase; + typedef GenScatterHierarchy<T2, Unit> RightBase; + template <typename T> struct Rebind { + typedef Unit<T> Result; }; +}; + +// In the middle *unique* class that resolve possible ambiguity +template <class T1, class T2, template <class> class Unit> +class GenScatterHierarchy<Private::ScatterHierarchyTag<T1, T2>, Unit> + : public GenScatterHierarchy<T1, Unit> +{ +}; - template <class AtomicType, template <class> class Unit> - class GenScatterHierarchy : public Unit<AtomicType> +template <class AtomicType, template <class> class Unit> +class GenScatterHierarchy : public Unit<AtomicType> +{ + typedef Unit<AtomicType> LeftBase; + template <typename T> struct Rebind { - typedef Unit<AtomicType> LeftBase; - template <typename T> struct Rebind - { - typedef Unit<T> Result; - }; + typedef Unit<T> Result; }; - - template <template <class> class Unit> - class GenScatterHierarchy<NullType, Unit> +}; + +template <template <class> class Unit> +class GenScatterHierarchy<NullType, Unit> +{ + template <typename T> struct Rebind { - template <typename T> struct Rebind - { - typedef Unit<T> Result; - }; + typedef Unit<T> Result; }; - +}; + //////////////////////////////////////////////////////////////////////////////// // function template Field // Accesses a field in an object of a type generated with GenScatterHierarchy // Invocation (obj is an object of a type H generated with GenScatterHierarchy, // T is a type in the typelist used to generate H): // Field<T>(obj) -// returns a reference to Unit<T>, where Unit is the template used to generate H +// returns a reference to Unit<T>, where Unit is the template used to generate H //////////////////////////////////////////////////////////////////////////////// - template <class T, class H> - typename H::template Rebind<T>::Result& Field(H& obj) - { - return obj; - } - - template <class T, class H> - const typename H::template Rebind<T>::Result& Field(const H& obj) - { - return obj; - } - +template <class T, class H> +typename H::template Rebind<T>::Result& Field(H& obj) +{ + return obj; +} + +template <class T, class H> +const typename H::template Rebind<T>::Result& Field(const H& obj) +{ + return obj; +} + //////////////////////////////////////////////////////////////////////////////// // function template TupleUnit -// The building block of tuples +// The building block of tuples //////////////////////////////////////////////////////////////////////////////// - template <class T> - struct TupleUnit - { - T value_; - operator T&() { return value_; } - operator const T&() const { return value_; } - }; +template <class T> +struct TupleUnit +{ + T value_; + operator T& () { return value_; } + operator const T& () const { return value_; } +}; //////////////////////////////////////////////////////////////////////////////// // class template Tuple -// Implements a tuple class that holds a number of values and provides field -// access to them via the Field function (below) +// Implements a tuple class that holds a number of values and provides field +// access to them via the Field function (below) //////////////////////////////////////////////////////////////////////////////// - template <class TList> - struct Tuple : public GenScatterHierarchy<TList, TupleUnit> - { - }; +template <class TList> +struct Tuple : public GenScatterHierarchy<TList, TupleUnit> +{ +}; //////////////////////////////////////////////////////////////////////////////// // helper class template FieldHelper // See Field below //////////////////////////////////////////////////////////////////////////////// - template <class H, unsigned int i> struct FieldHelper; - - template <class H> - struct FieldHelper<H, 0> +template <class H, unsigned int i> struct FieldHelper; + +template <class H> +struct FieldHelper<H, 0> +{ + typedef typename H::TList::Head ElementType; + typedef typename H::template Rebind<ElementType>::Result UnitType; + + enum { - typedef typename H::TList::Head ElementType; - typedef typename H::template Rebind<ElementType>::Result UnitType; - - enum - { - isTuple = Conversion<UnitType, TupleUnit<ElementType> >::sameType, - isConst = TypeTraits<H>::isConst - }; - - typedef const typename H::LeftBase ConstLeftBase; - - typedef typename Select<isConst, ConstLeftBase, + isTuple = Conversion<UnitType, TupleUnit<ElementType> >::sameType, + isConst = TypeTraits<H>::isConst + }; + + typedef const typename H::LeftBase ConstLeftBase; + + typedef typename Select<isConst, ConstLeftBase, typename H::LeftBase>::Result LeftBase; - - typedef typename Select<isTuple, ElementType, + + typedef typename Select<isTuple, ElementType, UnitType>::Result UnqualifiedResultType; - typedef typename Select<isConst, const UnqualifiedResultType, - UnqualifiedResultType>::Result ResultType; - - static ResultType& Do(H& obj) - { - LeftBase& leftBase = obj; - return leftBase; - } - }; + typedef typename Select<isConst, const UnqualifiedResultType, + UnqualifiedResultType>::Result ResultType; + + static ResultType& Do(H& obj) + { + LeftBase& leftBase = obj; + return leftBase; + } +}; + +template <class H, unsigned int i> +struct FieldHelper +{ + typedef typename TL::TypeAt<typename H::TList, i>::Result ElementType; + typedef typename H::template Rebind<ElementType>::Result UnitType; - template <class H, unsigned int i> - struct FieldHelper + enum { - typedef typename TL::TypeAt<typename H::TList, i>::Result ElementType; - typedef typename H::template Rebind<ElementType>::Result UnitType; - - enum - { - isTuple = Conversion<UnitType, TupleUnit<ElementType> >::sameType, - isConst = TypeTraits<H>::isConst - }; - - typedef const typename H::RightBase ConstRightBase; - - typedef typename Select<isConst, ConstRightBase, + isTuple = Conversion<UnitType, TupleUnit<ElementType> >::sameType, + isConst = TypeTraits<H>::isConst + }; + + typedef const typename H::RightBase ConstRightBase; + + typedef typename Select<isConst, ConstRightBase, typename H::RightBase>::Result RightBase; - typedef typename Select<isTuple, ElementType, + typedef typename Select<isTuple, ElementType, UnitType>::Result UnqualifiedResultType; - typedef typename Select<isConst, const UnqualifiedResultType, - UnqualifiedResultType>::Result ResultType; - - static ResultType& Do(H& obj) - { - RightBase& rightBase = obj; - return FieldHelper<RightBase, i - 1>::Do(rightBase); - } - }; + typedef typename Select<isConst, const UnqualifiedResultType, + UnqualifiedResultType>::Result ResultType; + + static ResultType& Do(H& obj) + { + RightBase& rightBase = obj; + return FieldHelper<RightBase, i - 1>::Do(rightBase); + } +}; //////////////////////////////////////////////////////////////////////////////// // function template Field @@ -217,23 +217,23 @@ namespace Loki // i is the index of a type in the typelist used to generate H): // Field<i>(obj) // returns a reference to Unit<T>, where Unit is the template used to generate H -// and T is the i-th type in the typelist +// and T is the i-th type in the typelist //////////////////////////////////////////////////////////////////////////////// - template <int i, class H> - typename FieldHelper<H, i>::ResultType& - Field(H& obj) - { - return FieldHelper<H, i>::Do(obj); - } - +template <int i, class H> +typename FieldHelper<H, i>::ResultType& +Field(H& obj) +{ + return FieldHelper<H, i>::Do(obj); +} + // template <int i, class H> // const typename FieldHelper<H, i>::ResultType& // Field(const H& obj) // { // return FieldHelper<H, i>::Do(obj); // } - + //////////////////////////////////////////////////////////////////////////////// // class template GenLinearHierarchy // Generates a linear hierarchy starting from a typelist and a template @@ -241,49 +241,49 @@ namespace Loki // GenScatterHierarchy<TList, Unit> //////////////////////////////////////////////////////////////////////////////// - template - < - class TList, - template <class AtomicType, class Base> class Unit, - class Root = EmptyType - > - class GenLinearHierarchy; - - template - < - class T1, - class T2, - template <class, class> class Unit, - class Root - > - class GenLinearHierarchy<Typelist<T1, T2>, Unit, Root> - : public Unit< T1, GenLinearHierarchy<T2, Unit, Root> > - { - }; +template +< +class TList, + template <class AtomicType, class Base> class Unit, + class Root = EmptyType + > +class GenLinearHierarchy; - template - < - class T, - template <class, class> class Unit, - class Root - > - class GenLinearHierarchy<Typelist<T, NullType>, Unit, Root> - : public Unit<T, Root> - { - }; +template +< +class T1, + class T2, + template <class, class> class Unit, + class Root + > +class GenLinearHierarchy<Typelist<T1, T2>, Unit, Root> + : public Unit< T1, GenLinearHierarchy<T2, Unit, Root> > +{ +}; - template - < - template <class, class> class Unit, - class Root - > - class GenLinearHierarchy<NullType , Unit, Root> - : public Root // is this better: Unit<NullType, Root> ? - { - }; +template +< +class T, + template <class, class> class Unit, + class Root + > +class GenLinearHierarchy<Typelist<T, NullType>, Unit, Root> + : public Unit<T, Root> +{ +}; + +template +< +template <class, class> class Unit, + class Root + > +class GenLinearHierarchy<NullType , Unit, Root> + : public Root // is this better: Unit<NullType, Root> ? +{ +}; #if defined(_MSC_VER) && _MSC_VER >= 1300 -#pragma warning( pop ) +#pragma warning( pop ) #endif } // namespace Loki diff --git a/shared/loki/Key.h b/shared/loki/Key.h index 4daaa603..c80d6f4e 100644 --- a/shared/loki/Key.h +++ b/shared/loki/Key.h @@ -4,16 +4,16 @@ // // Code covered by the MIT License // -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. // // The authors make no representations about the suitability of this software // for any purpose. It is provided "as is" without express or implied warranty. // // This code DOES NOT accompany the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. // //////////////////////////////////////////////////////////////////////////////// @@ -28,735 +28,737 @@ namespace Loki { - template< - class Factory, - typename IdentifierType - > - class Key; +template< +class Factory, + typename IdentifierType + > +class Key; - template<class F, typename I> - bool operator==(const Key<F, I> &k1, const Key<F, I> &k2); +template<class F, typename I> +bool operator==(const Key<F, I> &k1, const Key<F, I> &k2); + +template<class F, typename I> +bool operator<(const Key<F, I> &k1, const Key<F, I> &k2); + + +/** + * A Key class + */ +template< +class Factory, + typename IdentifierType + > +class Key +{ + typedef typename Factory::Parm1 Parm1; + typedef typename Factory::Parm2 Parm2; + typedef typename Factory::Parm3 Parm3; + typedef typename Factory::Parm4 Parm4; + typedef typename Factory::Parm5 Parm5; + typedef typename Factory::Parm6 Parm6; + typedef typename Factory::Parm7 Parm7; + typedef typename Factory::Parm8 Parm8; + typedef typename Factory::Parm9 Parm9; + typedef typename Factory::Parm10 Parm10; + typedef typename Factory::Parm11 Parm11; + typedef typename Factory::Parm12 Parm12; + typedef typename Factory::Parm13 Parm13; + typedef typename Factory::Parm14 Parm14; + typedef typename Factory::Parm15 Parm15; +public: + // member variables + int count; // should be const, but constness prevent default copy ctor + IdentifierType id; + Parm1 p1; + Parm2 p2; + Parm3 p3; + Parm4 p4; + Parm5 p5; + Parm6 p6; + Parm7 p7; + Parm8 p8; + Parm9 p9; + Parm10 p10; + Parm11 p11; + Parm12 p12; + Parm13 p13; + Parm14 p14; + Parm15 p15; + + // member functions + Key() : count(-1) + { + } + + Key(const IdentifierType& id) : count(0) + { + this->id = id; + } + + Key(const IdentifierType& id, + Parm1& p1) : count(1) + { + this->id = id; + this->p1 = p1; + } + + Key(const IdentifierType& id, + Parm1& p1, Parm2& p2) : count(2) + { + this->id = id; + this->p1 = p1; + this->p2 = p2; + } + + Key(const IdentifierType& id, + Parm1& p1, Parm2& p2, Parm3& p3) : count(3) + { + this->id = id; + this->p1 = p1; + this->p2 = p2; + this->p3 = p3; + } + + Key(const IdentifierType& id, + Parm1& p1, Parm2& p2, Parm3& p3, Parm4& p4) : count(4) + { + this->id = id; + this->p1 = p1; + this->p2 = p2; + this->p3 = p3; + this->p4 = p4; + } + + Key(const IdentifierType& id, + Parm1& p1, Parm2& p2, Parm3& p3, Parm4& p4, Parm5& p5) : count(5) + { + this->id = id; + this->p1 = p1; + this->p2 = p2; + this->p3 = p3; + this->p4 = p4; + this->p5 = p5; + } + + Key(const IdentifierType& id, + Parm1& p1, Parm2& p2, Parm3& p3, Parm4& p4, Parm5& p5, + Parm6& p6) : count(6) + { + this->id = id; + this->p1 = p1; + this->p2 = p2; + this->p3 = p3; + this->p4 = p4; + this->p5 = p5; + this->p6 = p6; + } + + Key(const IdentifierType& id, + Parm1& p1, Parm2& p2, Parm3& p3, Parm4& p4, Parm5& p5, + Parm6& p6, Parm7& p7 ) : count(7) + { + this->id = id; + this->p1 = p1; + this->p2 = p2; + this->p3 = p3; + this->p4 = p4; + this->p5 = p5; + this->p6 = p6; + this->p7 = p7; + } + + Key(const IdentifierType& id, + Parm1& p1, Parm2& p2, Parm3& p3, Parm4& p4, Parm5& p5, + Parm6& p6, Parm7& p7, Parm8& p8) : count(8) + { + this->id = id; + this->p1 = p1; + this->p2 = p2; + this->p3 = p3; + this->p4 = p4; + this->p5 = p5; + this->p6 = p6; + this->p7 = p7; + this->p8 = p8; + } + + Key(const IdentifierType& id, + Parm1& p1, Parm2& p2, Parm3& p3, Parm4& p4, Parm5& p5, + Parm6& p6, Parm7& p7, Parm8& p8, Parm9& p9) : count(9) + { + this->id = id; + this->p1 = p1; + this->p2 = p2; + this->p3 = p3; + this->p4 = p4; + this->p5 = p5; + this->p6 = p6; + this->p7 = p7; + this->p8 = p8; + this->p9 = p9; + } + + Key(const IdentifierType& id, + Parm1& p1, Parm2& p2, Parm3& p3, Parm4& p4, Parm5& p5, + Parm6& p6, Parm7& p7, Parm8& p8, Parm9& p9,Parm10& p10) : count(10) + { + this->id = id; + this->p1 = p1; + this->p2 = p2; + this->p3 = p3; + this->p4 = p4; + this->p5 = p5; + this->p6 = p6; + this->p7 = p7; + this->p8 = p8; + this->p9 = p9; + this->p10 = p10; + } + + Key(const IdentifierType& id, + Parm1& p1, Parm2& p2, Parm3& p3, Parm4& p4, Parm5& p5, + Parm6& p6, Parm7& p7, Parm8& p8, Parm9& p9, Parm10& p10, + Parm11& p11) : count(11) + { + this->id = id; + this->p1 = p1; + this->p2 = p2; + this->p3 = p3; + this->p4 = p4; + this->p5 = p5; + this->p6 = p6; + this->p7 = p7; + this->p8 = p8; + this->p9 = p9; + this->p10 = p10; + this->p11 = p11; + } + + Key(const IdentifierType& id, + Parm1& p1, Parm2& p2, Parm3& p3, Parm4& p4, Parm5& p5, + Parm6& p6, Parm7& p7, Parm8& p8, Parm9& p9, Parm10& p10, + Parm11& p11, Parm12& p12) : count(12) + { + this->id = id; + this->p1 = p1; + this->p2 = p2; + this->p3 = p3; + this->p4 = p4; + this->p5 = p5; + this->p6 = p6; + this->p7 = p7; + this->p8 = p8; + this->p9 = p9; + this->p10 = p10; + this->p11 = p11; + this->p12 = p12; + } + + Key(const IdentifierType& id, + Parm1& p1, Parm2& p2, Parm3& p3, Parm4& p4, Parm5& p5, + Parm6& p6, Parm7& p7, Parm8& p8, Parm9& p9, Parm10& p10, + Parm11& p11, Parm12& p12, Parm13& p13) : count(13) + { + this->id = id; + this->p1 = p1; + this->p2 = p2; + this->p3 = p3; + this->p4 = p4; + this->p5 = p5; + this->p6 = p6; + this->p7 = p7; + this->p8 = p8; + this->p9 = p9; + this->p10 = p10; + this->p11 = p11; + this->p12 = p12; + this->p13 = p13; + } + + Key(const IdentifierType& id, + Parm1& p1, Parm2& p2, Parm3& p3, Parm4& p4, Parm5& p5, + Parm6& p6, Parm7& p7, Parm8& p8, Parm9& p9, Parm10& p10, + Parm11& p11, Parm12& p12, Parm13& p13, Parm14& p14) : count(14) + { + this->id = id; + this->p1 = p1; + this->p2 = p2; + this->p3 = p3; + this->p4 = p4; + this->p5 = p5; + this->p6 = p6; + this->p7 = p7; + this->p8 = p8; + this->p9 = p9; + this->p10 = p10; + this->p11 = p11; + this->p12 = p12; + this->p13 = p13; + this->p14 = p14; + } + + Key(const IdentifierType& id, + Parm1& p1, Parm2& p2, Parm3& p3, Parm4& p4, Parm5& p5, + Parm6& p6, Parm7& p7, Parm8& p8, Parm9& p9, Parm10& p10, + Parm11& p11, Parm12& p12, Parm13& p13, Parm14& p14, Parm15& p15) : count(15) + { + this->id = id; + this->p1 = p1; + this->p2 = p2; + this->p3 = p3; + this->p4 = p4; + this->p5 = p5; + this->p6 = p6; + this->p7 = p7; + this->p8 = p8; + this->p9 = p9; + this->p10 = p10; + this->p11 = p11; + this->p12 = p12; + this->p13 = p13; + this->p14 = p14; + this->p15 = p15; + } template<class F, typename I> - bool operator<(const Key<F, I> &k1, const Key<F, I> &k2); - - - /** - * A Key class - */ - template< - class Factory, - typename IdentifierType - > - class Key - { - typedef typename Factory::Parm1 Parm1; - typedef typename Factory::Parm2 Parm2; - typedef typename Factory::Parm3 Parm3; - typedef typename Factory::Parm4 Parm4; - typedef typename Factory::Parm5 Parm5; - typedef typename Factory::Parm6 Parm6; - typedef typename Factory::Parm7 Parm7; - typedef typename Factory::Parm8 Parm8; - typedef typename Factory::Parm9 Parm9; - typedef typename Factory::Parm10 Parm10; - typedef typename Factory::Parm11 Parm11; - typedef typename Factory::Parm12 Parm12; - typedef typename Factory::Parm13 Parm13; - typedef typename Factory::Parm14 Parm14; - typedef typename Factory::Parm15 Parm15; - public: - // member variables - int count; // should be const, but constness prevent default copy ctor - IdentifierType id; - Parm1 p1; - Parm2 p2; - Parm3 p3; - Parm4 p4; - Parm5 p5; - Parm6 p6; - Parm7 p7; - Parm8 p8; - Parm9 p9; - Parm10 p10; - Parm11 p11; - Parm12 p12; - Parm13 p13; - Parm14 p14; - Parm15 p15; - - // member functions - Key() : count(-1) - { - } - - Key(const IdentifierType& id) : count(0) - { - this->id = id; - } - - Key(const IdentifierType& id, - Parm1 &p1) : count(1) - { - this->id = id; - this->p1 = p1; - } - - Key(const IdentifierType& id, - Parm1 &p1, Parm2 &p2) : count(2) - { - this->id = id; - this->p1 = p1; - this->p2 = p2; - } - - Key(const IdentifierType& id, - Parm1 &p1, Parm2 &p2, Parm3 &p3) : count(3) - { - this->id = id; - this->p1 = p1; - this->p2 = p2; - this->p3 = p3; - } - - Key(const IdentifierType& id, - Parm1 &p1, Parm2 &p2, Parm3 &p3, Parm4 &p4) : count(4) - { - this->id = id; - this->p1 = p1; - this->p2 = p2; - this->p3 = p3; - this->p4 = p4; - } - - Key(const IdentifierType& id, - Parm1 &p1, Parm2 &p2, Parm3 &p3, Parm4 &p4, Parm5 &p5) : count(5) - { - this->id = id; - this->p1 = p1; - this->p2 = p2; - this->p3 = p3; - this->p4 = p4; - this->p5 = p5; - } - - Key(const IdentifierType& id, - Parm1 &p1, Parm2 &p2, Parm3 &p3, Parm4 &p4, Parm5 &p5, - Parm6 &p6) : count(6) - { - this->id = id; - this->p1 = p1; - this->p2 = p2; - this->p3 = p3; - this->p4 = p4; - this->p5 = p5; - this->p6 = p6; - } - - Key(const IdentifierType& id, - Parm1 &p1, Parm2 &p2, Parm3 &p3, Parm4 &p4, Parm5 &p5, - Parm6 &p6, Parm7 &p7 ) : count(7) - { - this->id = id; - this->p1 = p1; - this->p2 = p2; - this->p3 = p3; - this->p4 = p4; - this->p5 = p5; - this->p6 = p6; - this->p7 = p7; - } - - Key(const IdentifierType& id, - Parm1 &p1, Parm2 &p2, Parm3 &p3, Parm4 &p4, Parm5 &p5, - Parm6 &p6, Parm7 &p7, Parm8 &p8) : count(8) - { - this->id = id; - this->p1 = p1; - this->p2 = p2; - this->p3 = p3; - this->p4 = p4; - this->p5 = p5; - this->p6 = p6; - this->p7 = p7; - this->p8 = p8; - } - - Key(const IdentifierType& id, - Parm1 &p1, Parm2 &p2, Parm3 &p3, Parm4 &p4, Parm5 &p5, - Parm6 &p6, Parm7 &p7, Parm8 &p8, Parm9 &p9) : count(9) - { - this->id = id; - this->p1 = p1; - this->p2 = p2; - this->p3 = p3; - this->p4 = p4; - this->p5 = p5; - this->p6 = p6; - this->p7 = p7; - this->p8 = p8; - this->p9 = p9; - } - - Key(const IdentifierType& id, - Parm1 &p1, Parm2 &p2, Parm3 &p3, Parm4 &p4, Parm5 &p5, - Parm6 &p6, Parm7 &p7, Parm8 &p8, Parm9 &p9,Parm10 &p10) : count(10) - { - this->id = id; - this->p1 = p1; - this->p2 = p2; - this->p3 = p3; - this->p4 = p4; - this->p5 = p5; - this->p6 = p6; - this->p7 = p7; - this->p8 = p8; - this->p9 = p9; - this->p10 = p10; - } - - Key(const IdentifierType& id, - Parm1 &p1, Parm2 &p2, Parm3 &p3, Parm4 &p4, Parm5 &p5, - Parm6 &p6, Parm7 &p7, Parm8 &p8, Parm9 &p9, Parm10 &p10, - Parm11 &p11) : count(11) - { - this->id = id; - this->p1 = p1; - this->p2 = p2; - this->p3 = p3; - this->p4 = p4; - this->p5 = p5; - this->p6 = p6; - this->p7 = p7; - this->p8 = p8; - this->p9 = p9; - this->p10 = p10; - this->p11 = p11; - } - - Key(const IdentifierType& id, - Parm1 &p1, Parm2 &p2, Parm3 &p3, Parm4 &p4, Parm5 &p5, - Parm6 &p6, Parm7 &p7, Parm8 &p8, Parm9 &p9, Parm10 &p10, - Parm11 &p11, Parm12 &p12) : count(12) - { - this->id = id; - this->p1 = p1; - this->p2 = p2; - this->p3 = p3; - this->p4 = p4; - this->p5 = p5; - this->p6 = p6; - this->p7 = p7; - this->p8 = p8; - this->p9 = p9; - this->p10 = p10; - this->p11 = p11; - this->p12 = p12; - } - - Key(const IdentifierType& id, - Parm1 &p1, Parm2 &p2, Parm3 &p3, Parm4 &p4, Parm5 &p5, - Parm6 &p6, Parm7 &p7, Parm8 &p8, Parm9 &p9, Parm10 &p10, - Parm11 &p11, Parm12 &p12, Parm13 &p13) : count(13) - { - this->id = id; - this->p1 = p1; - this->p2 = p2; - this->p3 = p3; - this->p4 = p4; - this->p5 = p5; - this->p6 = p6; - this->p7 = p7; - this->p8 = p8; - this->p9 = p9; - this->p10 = p10; - this->p11 = p11; - this->p12 = p12; - this->p13 = p13; - } - - Key(const IdentifierType& id, - Parm1 &p1, Parm2 &p2, Parm3 &p3, Parm4 &p4, Parm5 &p5, - Parm6 &p6, Parm7 &p7, Parm8 &p8, Parm9 &p9, Parm10 &p10, - Parm11 &p11, Parm12 &p12, Parm13 &p13, Parm14 &p14) : count(14) - { - this->id = id; - this->p1 = p1; - this->p2 = p2; - this->p3 = p3; - this->p4 = p4; - this->p5 = p5; - this->p6 = p6; - this->p7 = p7; - this->p8 = p8; - this->p9 = p9; - this->p10 = p10; - this->p11 = p11; - this->p12 = p12; - this->p13 = p13; - this->p14 = p14; - } - - Key(const IdentifierType& id, - Parm1 &p1, Parm2 &p2, Parm3 &p3, Parm4 &p4, Parm5 &p5, - Parm6 &p6, Parm7 &p7, Parm8 &p8, Parm9 &p9, Parm10 &p10, - Parm11 &p11, Parm12 &p12, Parm13 &p13, Parm14 &p14, Parm15 &p15) : count(15) - { - this->id = id; - this->p1 = p1; - this->p2 = p2; - this->p3 = p3; - this->p4 = p4; - this->p5 = p5; - this->p6 = p6; - this->p7 = p7; - this->p8 = p8; - this->p9 = p9; - this->p10 = p10; - this->p11 = p11; - this->p12 = p12; - this->p13 = p13; - this->p14 = p14; - this->p15 = p15; - } - - template<class F, typename I> - friend bool operator==(const Key<F, I> &k1, const Key<F, I> &k2); - - template<class F, typename I> - friend bool operator<(const Key<F, I> &k1, const Key<F, I> &k2); - }; - - + friend bool operator==(const Key<F, I> &k1, const Key<F, I> &k2); + template<class F, typename I> - bool operator==(const Key<F, I> &k1, const Key<F, I> &k2) + friend bool operator<(const Key<F, I> &k1, const Key<F, I> &k2); +}; + + +template<class F, typename I> +bool operator==(const Key<F, I> &k1, const Key<F, I> &k2) +{ + if( k1.count != k2.count ) + return false; + switch(k1.count) { - if( k1.count != k2.count ) + case -1: + return true; + case 0: + if( k1.id == k2.id ) + return true; + else + return false; + case 1: + if( (k1.id == k2.id) && + (k1.p1 == k2.p1) ) + return true; + else + return false; + case 2: + if( (k1.id == k2.id) && + (k1.p1 == k2.p1) && + (k1.p2 == k2.p2) ) + return true; + else + return false; + case 3: + if( (k1.id == k2.id) && + (k1.p1 == k2.p1) && + (k1.p2 == k2.p2) && + (k1.p3 == k2.p3) ) + return true; + else + return false; + case 4: + if( (k1.id == k2.id) && + (k1.p1 == k2.p1) && + (k1.p2 == k2.p2) && + (k1.p3 == k2.p3) && + (k1.p4 == k2.p4) ) + return true; + else + return false; + case 5: + if( (k1.id == k2.id) && + (k1.p1 == k2.p1) && + (k1.p2 == k2.p2) && + (k1.p3 == k2.p3) && + (k1.p4 == k2.p4) && + (k1.p5 == k2.p5) ) + return true; + else + return false; + case 6: + if( (k1.id == k2.id) && + (k1.p1 == k2.p1) && + (k1.p2 == k2.p2) && + (k1.p3 == k2.p3) && + (k1.p4 == k2.p4) && + (k1.p5 == k2.p5) && + (k1.p6 == k2.p6) ) + return true; + else + return false; + case 7: + if( (k1.id == k2.id) && + (k1.p1 == k2.p1) && + (k1.p2 == k2.p2) && + (k1.p3 == k2.p3) && + (k1.p4 == k2.p4) && + (k1.p5 == k2.p5) && + (k1.p6 == k2.p6) && + (k1.p7 == k2.p7) ) + return true; + else + return false; + case 8: + if( (k1.id == k2.id) && + (k1.p1 == k2.p1) && + (k1.p2 == k2.p2) && + (k1.p3 == k2.p3) && + (k1.p4 == k2.p4) && + (k1.p5 == k2.p5) && + (k1.p6 == k2.p6) && + (k1.p7 == k2.p7) && + (k1.p8 == k2.p8) ) + return true; + else + return false; + case 9: + if( (k1.id == k2.id) && + (k1.p1 == k2.p1) && + (k1.p2 == k2.p2) && + (k1.p3 == k2.p3) && + (k1.p4 == k2.p4) && + (k1.p5 == k2.p5) && + (k1.p6 == k2.p6) && + (k1.p7 == k2.p7) && + (k1.p8 == k2.p8) && + (k1.p9 == k2.p9) ) + return true; + else + return false; + case 10: + if( (k1.id == k2.id) && + (k1.p1 == k2.p1) && + (k1.p2 == k2.p2) && + (k1.p3 == k2.p3) && + (k1.p4 == k2.p4) && + (k1.p5 == k2.p5) && + (k1.p6 == k2.p6) && + (k1.p7 == k2.p7) && + (k1.p8 == k2.p8) && + (k1.p9 == k2.p9) && + (k1.p10 == k2.p10) ) + return true; + else + return false; + case 11: + if( (k1.id == k2.id) && + (k1.p1 == k2.p1) && + (k1.p2 == k2.p2) && + (k1.p3 == k2.p3) && + (k1.p4 == k2.p4) && + (k1.p5 == k2.p5) && + (k1.p6 == k2.p6) && + (k1.p7 == k2.p7) && + (k1.p8 == k2.p8) && + (k1.p9 == k2.p9) && + (k1.p10 == k2.p10) && + (k1.p11 == k2.p11) ) + return true; + else + return false; + case 12: + if( (k1.id == k2.id) && + (k1.p1 == k2.p1) && + (k1.p2 == k2.p2) && + (k1.p3 == k2.p3) && + (k1.p4 == k2.p4) && + (k1.p5 == k2.p5) && + (k1.p6 == k2.p6) && + (k1.p7 == k2.p7) && + (k1.p8 == k2.p8) && + (k1.p9 == k2.p9) && + (k1.p10 == k2.p10) && + (k1.p11 == k2.p11) && + (k1.p12 == k2.p12) ) + return true; + else + return false; + case 13: + if( (k1.id == k2.id) && + (k1.p1 == k2.p1) && + (k1.p2 == k2.p2) && + (k1.p3 == k2.p3) && + (k1.p4 == k2.p4) && + (k1.p5 == k2.p5) && + (k1.p6 == k2.p6) && + (k1.p7 == k2.p7) && + (k1.p8 == k2.p8) && + (k1.p9 == k2.p9) && + (k1.p10 == k2.p10) && + (k1.p11 == k2.p11) && + (k1.p12 == k2.p12) && + (k1.p13 == k2.p13) ) + return true; + else + return false; + case 14: + if( (k1.id == k2.id) && + (k1.p1 == k2.p1) && + (k1.p2 == k2.p2) && + (k1.p3 == k2.p3) && + (k1.p4 == k2.p4) && + (k1.p5 == k2.p5) && + (k1.p6 == k2.p6) && + (k1.p7 == k2.p7) && + (k1.p8 == k2.p8) && + (k1.p9 == k2.p9) && + (k1.p10 == k2.p10) && + (k1.p11 == k2.p11) && + (k1.p12 == k2.p12) && + (k1.p13 == k2.p13) && + (k1.p14 == k2.p14) ) + return true; + else + return false; + case 15: + if( (k1.id == k2.id) && + (k1.p1 == k2.p1) && + (k1.p2 == k2.p2) && + (k1.p3 == k2.p3) && + (k1.p4 == k2.p4) && + (k1.p5 == k2.p5) && + (k1.p6 == k2.p6) && + (k1.p7 == k2.p7) && + (k1.p8 == k2.p8) && + (k1.p9 == k2.p9) && + (k1.p10 == k2.p10) && + (k1.p11 == k2.p11) && + (k1.p12 == k2.p12) && + (k1.p13 == k2.p13) && + (k1.p14 == k2.p14) && + (k1.p15 == k2.p15) ) + return true; + else + return false; + default: return false; - switch(k1.count){ - case -1: - return true; - case 0: - if( k1.id == k2.id ) - return true; - else - return false; - case 1: - if( (k1.id == k2.id) && - (k1.p1 == k2.p1) ) - return true; - else - return false; - case 2: - if( (k1.id == k2.id) && - (k1.p1 == k2.p1) && - (k1.p2 == k2.p2) ) - return true; - else - return false; - case 3: - if( (k1.id == k2.id) && - (k1.p1 == k2.p1) && - (k1.p2 == k2.p2) && - (k1.p3 == k2.p3) ) - return true; - else - return false; - case 4: - if( (k1.id == k2.id) && - (k1.p1 == k2.p1) && - (k1.p2 == k2.p2) && - (k1.p3 == k2.p3) && - (k1.p4 == k2.p4) ) - return true; - else - return false; - case 5: - if( (k1.id == k2.id) && - (k1.p1 == k2.p1) && - (k1.p2 == k2.p2) && - (k1.p3 == k2.p3) && - (k1.p4 == k2.p4) && - (k1.p5 == k2.p5) ) - return true; - else - return false; - case 6: - if( (k1.id == k2.id) && - (k1.p1 == k2.p1) && - (k1.p2 == k2.p2) && - (k1.p3 == k2.p3) && - (k1.p4 == k2.p4) && - (k1.p5 == k2.p5) && - (k1.p6 == k2.p6) ) - return true; - else - return false; - case 7: - if( (k1.id == k2.id) && - (k1.p1 == k2.p1) && - (k1.p2 == k2.p2) && - (k1.p3 == k2.p3) && - (k1.p4 == k2.p4) && - (k1.p5 == k2.p5) && - (k1.p6 == k2.p6) && - (k1.p7 == k2.p7) ) - return true; - else - return false; - case 8: - if( (k1.id == k2.id) && - (k1.p1 == k2.p1) && - (k1.p2 == k2.p2) && - (k1.p3 == k2.p3) && - (k1.p4 == k2.p4) && - (k1.p5 == k2.p5) && - (k1.p6 == k2.p6) && - (k1.p7 == k2.p7) && - (k1.p8 == k2.p8) ) - return true; - else - return false; - case 9: - if( (k1.id == k2.id) && - (k1.p1 == k2.p1) && - (k1.p2 == k2.p2) && - (k1.p3 == k2.p3) && - (k1.p4 == k2.p4) && - (k1.p5 == k2.p5) && - (k1.p6 == k2.p6) && - (k1.p7 == k2.p7) && - (k1.p8 == k2.p8) && - (k1.p9 == k2.p9) ) - return true; - else - return false; - case 10: - if( (k1.id == k2.id) && - (k1.p1 == k2.p1) && - (k1.p2 == k2.p2) && - (k1.p3 == k2.p3) && - (k1.p4 == k2.p4) && - (k1.p5 == k2.p5) && - (k1.p6 == k2.p6) && - (k1.p7 == k2.p7) && - (k1.p8 == k2.p8) && - (k1.p9 == k2.p9) && - (k1.p10 == k2.p10) ) - return true; - else - return false; - case 11: - if( (k1.id == k2.id) && - (k1.p1 == k2.p1) && - (k1.p2 == k2.p2) && - (k1.p3 == k2.p3) && - (k1.p4 == k2.p4) && - (k1.p5 == k2.p5) && - (k1.p6 == k2.p6) && - (k1.p7 == k2.p7) && - (k1.p8 == k2.p8) && - (k1.p9 == k2.p9) && - (k1.p10 == k2.p10) && - (k1.p11 == k2.p11) ) - return true; - else - return false; - case 12: - if( (k1.id == k2.id) && - (k1.p1 == k2.p1) && - (k1.p2 == k2.p2) && - (k1.p3 == k2.p3) && - (k1.p4 == k2.p4) && - (k1.p5 == k2.p5) && - (k1.p6 == k2.p6) && - (k1.p7 == k2.p7) && - (k1.p8 == k2.p8) && - (k1.p9 == k2.p9) && - (k1.p10 == k2.p10) && - (k1.p11 == k2.p11) && - (k1.p12 == k2.p12) ) - return true; - else - return false; - case 13: - if( (k1.id == k2.id) && - (k1.p1 == k2.p1) && - (k1.p2 == k2.p2) && - (k1.p3 == k2.p3) && - (k1.p4 == k2.p4) && - (k1.p5 == k2.p5) && - (k1.p6 == k2.p6) && - (k1.p7 == k2.p7) && - (k1.p8 == k2.p8) && - (k1.p9 == k2.p9) && - (k1.p10 == k2.p10) && - (k1.p11 == k2.p11) && - (k1.p12 == k2.p12) && - (k1.p13 == k2.p13) ) - return true; - else - return false; - case 14: - if( (k1.id == k2.id) && - (k1.p1 == k2.p1) && - (k1.p2 == k2.p2) && - (k1.p3 == k2.p3) && - (k1.p4 == k2.p4) && - (k1.p5 == k2.p5) && - (k1.p6 == k2.p6) && - (k1.p7 == k2.p7) && - (k1.p8 == k2.p8) && - (k1.p9 == k2.p9) && - (k1.p10 == k2.p10) && - (k1.p11 == k2.p11) && - (k1.p12 == k2.p12) && - (k1.p13 == k2.p13) && - (k1.p14 == k2.p14) ) - return true; - else - return false; - case 15: - if( (k1.id == k2.id) && - (k1.p1 == k2.p1) && - (k1.p2 == k2.p2) && - (k1.p3 == k2.p3) && - (k1.p4 == k2.p4) && - (k1.p5 == k2.p5) && - (k1.p6 == k2.p6) && - (k1.p7 == k2.p7) && - (k1.p8 == k2.p8) && - (k1.p9 == k2.p9) && - (k1.p10 == k2.p10) && - (k1.p11 == k2.p11) && - (k1.p12 == k2.p12) && - (k1.p13 == k2.p13) && - (k1.p14 == k2.p14) && - (k1.p15 == k2.p15) ) - return true; - else - return false; - default: - return false; - } } +} - template<class F, typename I> - bool operator<(const Key<F, I> &k1, const Key<F, I> &k2) +template<class F, typename I> +bool operator<(const Key<F, I> &k1, const Key<F, I> &k2) +{ + if( k1.count < k2.count ) + return true; + switch(k1.count) { - if( k1.count < k2.count ) - return true; - switch(k1.count){ - case -1: - return false; - case 0: - if( k1.id < k2.id ) - return true; - else - return false; - case 1: - if( (k1.id < k2.id) || - (k1.p1 < k2.p1) ) - return true; - else - return false; - case 2: - if( (k1.id < k2.id) || - (k1.p1 < k2.p1) || - (k1.p2 < k2.p2) ) - return true; - else - return false; - case 3: - if( (k1.id < k2.id) || - (k1.p1 < k2.p1) || - (k1.p2 < k2.p2) || - (k1.p3 < k2.p3) ) - return true; - else - return false; - case 4: - if( (k1.id < k2.id) || - (k1.p1 < k2.p1) || - (k1.p2 < k2.p2) || - (k1.p3 < k2.p3) || - (k1.p4 < k2.p4) ) - return true; - else - return false; - case 5: - if( (k1.id < k2.id) || - (k1.p1 < k2.p1) || - (k1.p2 < k2.p2) || - (k1.p3 < k2.p3) || - (k1.p4 < k2.p4) || - (k1.p5 < k2.p5) ) - return true; - else - return false; - case 6: - if( (k1.id < k2.id) || - (k1.p1 < k2.p1) || - (k1.p2 < k2.p2) || - (k1.p3 < k2.p3) || - (k1.p4 < k2.p4) || - (k1.p5 < k2.p5) || - (k1.p6 < k2.p6) ) - return true; - else - return false; - case 7: - if( (k1.id < k2.id) || - (k1.p1 < k2.p1) || - (k1.p2 < k2.p2) || - (k1.p3 < k2.p3) || - (k1.p4 < k2.p4) || - (k1.p5 < k2.p5) || - (k1.p6 < k2.p6) || - (k1.p7 < k2.p7) ) - return true; - else - return false; - case 8: - if( (k1.id < k2.id) || - (k1.p1 < k2.p1) || - (k1.p2 < k2.p2) || - (k1.p3 < k2.p3) || - (k1.p4 < k2.p4) || - (k1.p5 < k2.p5) || - (k1.p6 < k2.p6) || - (k1.p7 < k2.p7) || - (k1.p8 < k2.p8) ) - return true; - else - return false; - case 9: - if( (k1.id < k2.id) || - (k1.p1 < k2.p1) || - (k1.p2 < k2.p2) || - (k1.p3 < k2.p3) || - (k1.p4 < k2.p4) || - (k1.p5 < k2.p5) || - (k1.p6 < k2.p6) || - (k1.p7 < k2.p7) || - (k1.p8 < k2.p8) || - (k1.p9 < k2.p9) ) - return true; - else - return false; - case 10: - if( (k1.id < k2.id) || - (k1.p1 < k2.p1) || - (k1.p2 < k2.p2) || - (k1.p3 < k2.p3) || - (k1.p4 < k2.p4) || - (k1.p5 < k2.p5) || - (k1.p6 < k2.p6) || - (k1.p7 < k2.p7) || - (k1.p8 < k2.p8) || - (k1.p9 < k2.p9) || - (k1.p10 < k2.p10) ) - return true; - else - return false; - case 11: - if( (k1.id < k2.id) || - (k1.p1 < k2.p1) || - (k1.p2 < k2.p2) || - (k1.p3 < k2.p3) || - (k1.p4 < k2.p4) || - (k1.p5 < k2.p5) || - (k1.p6 < k2.p6) || - (k1.p7 < k2.p7) || - (k1.p8 < k2.p8) || - (k1.p9 < k2.p9) || - (k1.p10 < k2.p10) || - (k1.p11 < k2.p11) ) - return true; - else - return false; - case 12: - if( (k1.id < k2.id) || - (k1.p1 < k2.p1) || - (k1.p2 < k2.p2) || - (k1.p3 < k2.p3) || - (k1.p4 < k2.p4) || - (k1.p5 < k2.p5) || - (k1.p6 < k2.p6) || - (k1.p7 < k2.p7) || - (k1.p8 < k2.p8) || - (k1.p9 < k2.p9) || - (k1.p10 < k2.p10) || - (k1.p11 < k2.p11) || - (k1.p12 < k2.p12) ) - return true; - else - return false; - case 13: - if( (k1.id < k2.id) || - (k1.p1 < k2.p1) || - (k1.p2 < k2.p2) || - (k1.p3 < k2.p3) || - (k1.p4 < k2.p4) || - (k1.p5 < k2.p5) || - (k1.p6 < k2.p6) || - (k1.p7 < k2.p7) || - (k1.p8 < k2.p8) || - (k1.p9 < k2.p9) || - (k1.p10 < k2.p10) || - (k1.p11 < k2.p11) || - (k1.p12 < k2.p12) || - (k1.p13 < k2.p13) ) - return true; - else - return false; - case 14: - if( (k1.id < k2.id) || - (k1.p1 < k2.p1) || - (k1.p2 < k2.p2) || - (k1.p3 < k2.p3) || - (k1.p4 < k2.p4) || - (k1.p5 < k2.p5) || - (k1.p6 < k2.p6) || - (k1.p7 < k2.p7) || - (k1.p8 < k2.p8) || - (k1.p9 < k2.p9) || - (k1.p10 < k2.p10) || - (k1.p11 < k2.p11) || - (k1.p12 < k2.p12) || - (k1.p13 < k2.p13) || - (k1.p14 < k2.p14) ) - return true; - else - return false; - case 15: - if( (k1.id < k2.id) || - (k1.p1 < k2.p1) || - (k1.p2 < k2.p2) || - (k1.p3 < k2.p3) || - (k1.p4 < k2.p4) || - (k1.p5 < k2.p5) || - (k1.p6 < k2.p6) || - (k1.p7 < k2.p7) || - (k1.p8 < k2.p8) || - (k1.p9 < k2.p9) || - (k1.p10 < k2.p10) || - (k1.p11 < k2.p11) || - (k1.p12 < k2.p12) || - (k1.p13 < k2.p13) || - (k1.p14 < k2.p14) || - (k1.p15 < k2.p15) ) - return true; - else - return false; - default: - return false; - } + case -1: + return false; + case 0: + if( k1.id < k2.id ) + return true; + else + return false; + case 1: + if( (k1.id < k2.id) || + (k1.p1 < k2.p1) ) + return true; + else + return false; + case 2: + if( (k1.id < k2.id) || + (k1.p1 < k2.p1) || + (k1.p2 < k2.p2) ) + return true; + else + return false; + case 3: + if( (k1.id < k2.id) || + (k1.p1 < k2.p1) || + (k1.p2 < k2.p2) || + (k1.p3 < k2.p3) ) + return true; + else + return false; + case 4: + if( (k1.id < k2.id) || + (k1.p1 < k2.p1) || + (k1.p2 < k2.p2) || + (k1.p3 < k2.p3) || + (k1.p4 < k2.p4) ) + return true; + else + return false; + case 5: + if( (k1.id < k2.id) || + (k1.p1 < k2.p1) || + (k1.p2 < k2.p2) || + (k1.p3 < k2.p3) || + (k1.p4 < k2.p4) || + (k1.p5 < k2.p5) ) + return true; + else + return false; + case 6: + if( (k1.id < k2.id) || + (k1.p1 < k2.p1) || + (k1.p2 < k2.p2) || + (k1.p3 < k2.p3) || + (k1.p4 < k2.p4) || + (k1.p5 < k2.p5) || + (k1.p6 < k2.p6) ) + return true; + else + return false; + case 7: + if( (k1.id < k2.id) || + (k1.p1 < k2.p1) || + (k1.p2 < k2.p2) || + (k1.p3 < k2.p3) || + (k1.p4 < k2.p4) || + (k1.p5 < k2.p5) || + (k1.p6 < k2.p6) || + (k1.p7 < k2.p7) ) + return true; + else + return false; + case 8: + if( (k1.id < k2.id) || + (k1.p1 < k2.p1) || + (k1.p2 < k2.p2) || + (k1.p3 < k2.p3) || + (k1.p4 < k2.p4) || + (k1.p5 < k2.p5) || + (k1.p6 < k2.p6) || + (k1.p7 < k2.p7) || + (k1.p8 < k2.p8) ) + return true; + else + return false; + case 9: + if( (k1.id < k2.id) || + (k1.p1 < k2.p1) || + (k1.p2 < k2.p2) || + (k1.p3 < k2.p3) || + (k1.p4 < k2.p4) || + (k1.p5 < k2.p5) || + (k1.p6 < k2.p6) || + (k1.p7 < k2.p7) || + (k1.p8 < k2.p8) || + (k1.p9 < k2.p9) ) + return true; + else + return false; + case 10: + if( (k1.id < k2.id) || + (k1.p1 < k2.p1) || + (k1.p2 < k2.p2) || + (k1.p3 < k2.p3) || + (k1.p4 < k2.p4) || + (k1.p5 < k2.p5) || + (k1.p6 < k2.p6) || + (k1.p7 < k2.p7) || + (k1.p8 < k2.p8) || + (k1.p9 < k2.p9) || + (k1.p10 < k2.p10) ) + return true; + else + return false; + case 11: + if( (k1.id < k2.id) || + (k1.p1 < k2.p1) || + (k1.p2 < k2.p2) || + (k1.p3 < k2.p3) || + (k1.p4 < k2.p4) || + (k1.p5 < k2.p5) || + (k1.p6 < k2.p6) || + (k1.p7 < k2.p7) || + (k1.p8 < k2.p8) || + (k1.p9 < k2.p9) || + (k1.p10 < k2.p10) || + (k1.p11 < k2.p11) ) + return true; + else + return false; + case 12: + if( (k1.id < k2.id) || + (k1.p1 < k2.p1) || + (k1.p2 < k2.p2) || + (k1.p3 < k2.p3) || + (k1.p4 < k2.p4) || + (k1.p5 < k2.p5) || + (k1.p6 < k2.p6) || + (k1.p7 < k2.p7) || + (k1.p8 < k2.p8) || + (k1.p9 < k2.p9) || + (k1.p10 < k2.p10) || + (k1.p11 < k2.p11) || + (k1.p12 < k2.p12) ) + return true; + else + return false; + case 13: + if( (k1.id < k2.id) || + (k1.p1 < k2.p1) || + (k1.p2 < k2.p2) || + (k1.p3 < k2.p3) || + (k1.p4 < k2.p4) || + (k1.p5 < k2.p5) || + (k1.p6 < k2.p6) || + (k1.p7 < k2.p7) || + (k1.p8 < k2.p8) || + (k1.p9 < k2.p9) || + (k1.p10 < k2.p10) || + (k1.p11 < k2.p11) || + (k1.p12 < k2.p12) || + (k1.p13 < k2.p13) ) + return true; + else + return false; + case 14: + if( (k1.id < k2.id) || + (k1.p1 < k2.p1) || + (k1.p2 < k2.p2) || + (k1.p3 < k2.p3) || + (k1.p4 < k2.p4) || + (k1.p5 < k2.p5) || + (k1.p6 < k2.p6) || + (k1.p7 < k2.p7) || + (k1.p8 < k2.p8) || + (k1.p9 < k2.p9) || + (k1.p10 < k2.p10) || + (k1.p11 < k2.p11) || + (k1.p12 < k2.p12) || + (k1.p13 < k2.p13) || + (k1.p14 < k2.p14) ) + return true; + else + return false; + case 15: + if( (k1.id < k2.id) || + (k1.p1 < k2.p1) || + (k1.p2 < k2.p2) || + (k1.p3 < k2.p3) || + (k1.p4 < k2.p4) || + (k1.p5 < k2.p5) || + (k1.p6 < k2.p6) || + (k1.p7 < k2.p7) || + (k1.p8 < k2.p8) || + (k1.p9 < k2.p9) || + (k1.p10 < k2.p10) || + (k1.p11 < k2.p11) || + (k1.p12 < k2.p12) || + (k1.p13 < k2.p13) || + (k1.p14 < k2.p14) || + (k1.p15 < k2.p15) ) + return true; + else + return false; + default: + return false; } +} + - } // namespace Loki diff --git a/shared/loki/LevelMutex.h b/shared/loki/LevelMutex.h index c048000f..eb01f44a 100644 --- a/shared/loki/LevelMutex.h +++ b/shared/loki/LevelMutex.h @@ -4,9 +4,9 @@ // Copyright (c) 2008 Richard Sposato // The copyright on this file is protected under the terms of the MIT license. // -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. // // The author makes no representations about the suitability of this software @@ -29,13 +29,13 @@ #include <time.h> #if defined( _MSC_VER ) - #include <Windows.h> +#include <Windows.h> #else - #include <pthread.h> +#include <pthread.h> #endif #if !defined(_WIN32) && !defined(_WIN64) - #include <unistd.h> // declares sleep under Linux +#include <unistd.h> // declares sleep under Linux #endif /** @par thread_local Keyword @@ -49,26 +49,26 @@ you can't use LevelMutex. */ #ifndef LOKI_THREAD_LOCAL - #if defined( _MSC_VER ) - #if ( _MSC_VER >= 1300 ) - #define LOKI_THREAD_LOCAL __declspec( thread ) - #else - #error "Only Visual Studio versions 7.0 and after supported." - #endif - - #elif ( __GNUC__ ) - #define LOKI_THREAD_LOCAL __thread - - #else - #warning "Check if your compiler provides thread local storage." - #define LOKI_THREAD_LOCAL thread_local - #endif +#if defined( _MSC_VER ) +#if ( _MSC_VER >= 1300 ) +#define LOKI_THREAD_LOCAL __declspec( thread ) +#else +#error "Only Visual Studio versions 7.0 and after supported." +#endif + +#elif ( __GNUC__ ) +#define LOKI_THREAD_LOCAL __thread + +#else +#warning "Check if your compiler provides thread local storage." +#define LOKI_THREAD_LOCAL thread_local +#endif #endif #if defined( DEBUG ) || defined( _DEBUG ) - #define LOKI_MUTEX_DEBUG_CODE( x ) x +#define LOKI_MUTEX_DEBUG_CODE( x ) x #else - #define LOKI_MUTEX_DEBUG_CODE( x ) +#define LOKI_MUTEX_DEBUG_CODE( x ) #endif @@ -154,7 +154,7 @@ public: static const unsigned int UnlockedLevel = 0xFFFFFFFF; /// Container for locking multiple mutexes at once. - typedef ::std::vector< volatile LevelMutexInfo * > MutexContainer; + typedef ::std::vector< volatile LevelMutexInfo* > MutexContainer; typedef MutexContainer::iterator LevelMutexContainerIter; typedef MutexContainer::const_iterator LevelMutexContainerCIter; typedef MutexContainer::reverse_iterator LevelMutexContainerRIter; @@ -170,7 +170,7 @@ public: by address order. @return Enum value indicating success or error. */ - static MutexErrors::Type MultiLock( MutexContainer & mutexes ); + static MutexErrors::Type MultiLock( MutexContainer& mutexes ); /** Locks several mutexes at once. Requires O(m + n*n + n*t) actions where m is the number of mutexes currently locked by the thread, n is the number of mutexes @@ -184,8 +184,8 @@ public: @param milliSeconds Amount of time to wait for each mutex. @return Enum value indicating success or error. */ - static MutexErrors::Type MultiLock( MutexContainer & mutexes, - unsigned int milliSeconds ); + static MutexErrors::Type MultiLock( MutexContainer& mutexes, + unsigned int milliSeconds ); /** Unlocks several mutexes at once. Requires O(m) actions where m is the number of mutexes in the container. This provides strong exception safety. If an exception @@ -195,14 +195,14 @@ public: be locked by the current thread. This sorts the container dby address order. @return Enum value indicating success or error. */ - static MutexErrors::Type MultiUnlock( MutexContainer & mutexes ); + static MutexErrors::Type MultiUnlock( MutexContainer& mutexes ); /** Gives pointer to most recently locked mutex, or NULL if nothing locked. The pointer is for a const mutex so the mutex can't be modified inappropriately. The pointer is for a volatile mutex so callers can call volatile member functions to get info about the mutex. */ - static const volatile LevelMutexInfo * GetCurrentMutex( void ); + static const volatile LevelMutexInfo* GetCurrentMutex( void ); /// Returns the level of this mutex. inline unsigned int GetLevel( void ) const volatile { return m_level; } @@ -214,7 +214,7 @@ public: inline unsigned int GetLockCount( void ) const volatile { return m_count; } /// Returns pointer to mutex previously locked by the thread which locked this. - inline const volatile LevelMutexInfo * GetPrevious( void ) const volatile + inline const volatile LevelMutexInfo* GetPrevious( void ) const volatile { return m_previous; } @@ -279,14 +279,14 @@ protected: class Checker { public: - inline explicit Checker( const volatile LevelMutexInfo * mutex ) : + inline explicit Checker( const volatile LevelMutexInfo* mutex ) : m_mutex( mutex ) {} inline ~Checker( void ) { m_mutex->IsValid(); } private: Checker( void ); - Checker( const Checker & ); - Checker & operator = ( const Checker & ); - const volatile LevelMutexInfo * m_mutex; + Checker( const Checker& ); + Checker& operator = ( const Checker& ); + const volatile LevelMutexInfo* m_mutex; }; /** @class MutexUndoer @@ -299,18 +299,18 @@ protected: { public: - explicit MutexUndoer( MutexContainer & mutexes ); + explicit MutexUndoer( MutexContainer& mutexes ); ~MutexUndoer( void ); - void SetPlace( LevelMutexContainerIter & here ); + void SetPlace( LevelMutexContainerIter& here ); void Cancel( void ); private: MutexUndoer( void ); - MutexUndoer( const MutexUndoer & ); - MutexUndoer & operator = ( const MutexUndoer & ); + MutexUndoer( const MutexUndoer& ); + MutexUndoer& operator = ( const MutexUndoer& ); - MutexContainer & m_mutexes; + MutexContainer& m_mutexes; LevelMutexContainerIter m_here; }; @@ -354,9 +354,9 @@ protected: private: /// Copy constructor is not implemented. - LevelMutexInfo( const LevelMutexInfo & ); + LevelMutexInfo( const LevelMutexInfo& ); /// Copy-assignment operator is not implemented. - LevelMutexInfo & operator = ( const LevelMutexInfo & ); + LevelMutexInfo& operator = ( const LevelMutexInfo& ); /** Called only by MultiLock & MultiUnlock to pass a result through an error checking policy. @@ -373,11 +373,11 @@ private: */ virtual MutexErrors::Type LockThis( unsigned int milliSeconds ) volatile = 0; - /// Called only by MultiUnlock to unlock each particular mutex within a container. + /// Called only by MultiUnlock to unlock each particular mutex within a container. virtual MutexErrors::Type UnlockThis( void ) volatile = 0; /// Pointer to singly-linked list of mutexes locked by the current thread. - static LOKI_THREAD_LOCAL volatile LevelMutexInfo * s_currentMutex; + static LOKI_THREAD_LOCAL volatile LevelMutexInfo* s_currentMutex; /// Level of this mutex. const unsigned int m_level; @@ -386,7 +386,7 @@ private: unsigned int m_count; /// Pointer to mutex locked before this one. - volatile LevelMutexInfo * m_previous; + volatile LevelMutexInfo* m_previous; }; @@ -401,7 +401,7 @@ class ThrowOnAnyMutexError { public: static MutexErrors::Type CheckError( MutexErrors::Type error, - unsigned int level ); + unsigned int level ); }; // ---------------------------------------------------------------------------- @@ -415,7 +415,7 @@ class ThrowOnBadDesignMutexError { public: static MutexErrors::Type CheckError( MutexErrors::Type error, - unsigned int level ); + unsigned int level ); }; // ---------------------------------------------------------------------------- @@ -429,11 +429,11 @@ class AssertAnyMutexError { public: static inline MutexErrors::Type CheckError( MutexErrors::Type error, - unsigned int level ) + unsigned int level ) { (void)level; assert( ( error == MutexErrors::Success ) - || ( error == MutexErrors::NoProblem ) ); + || ( error == MutexErrors::NoProblem ) ); return error; } }; @@ -449,11 +449,11 @@ class AssertBadDesignMutexError { public: static inline MutexErrors::Type CheckError( MutexErrors::Type error, - unsigned int level ) + unsigned int level ) { (void)level; assert( ( error != MutexErrors::LevelTooHigh ) - && ( error != MutexErrors::LevelTooLow ) ); + && ( error != MutexErrors::LevelTooLow ) ); return error; } }; @@ -469,7 +469,7 @@ class JustReturnMutexError { public: static inline MutexErrors::Type CheckError( MutexErrors::Type error, - unsigned int level ) + unsigned int level ) { (void)level; return error; @@ -533,24 +533,24 @@ public: private: /// Copy constructor is not implemented. - SpinLevelMutex( const SpinLevelMutex & ); + SpinLevelMutex( const SpinLevelMutex& ); /// Copy-assignment operator is not implemented. - SpinLevelMutex & operator = ( const SpinLevelMutex & ); + SpinLevelMutex& operator = ( const SpinLevelMutex& ); #if defined( _MSC_VER ) - #if ( _MSC_VER >= 1300 ) - /// The actual mutex. - CRITICAL_SECTION m_mutex; - #else - #error "Only Visual Studio versions 7.0 and after supported." - #endif +#if ( _MSC_VER >= 1300 ) + /// The actual mutex. + CRITICAL_SECTION m_mutex; +#else +#error "Only Visual Studio versions 7.0 and after supported." +#endif #elif ( __GNUC__ ) /// The actual mutex. pthread_mutex_t m_mutex; #else - #error "Check if any mutex libraries are compatible with your compiler." +#error "Check if any mutex libraries are compatible with your compiler." #endif /// Keep a copy of the mutex level around for error reporting. @@ -564,7 +564,7 @@ private: Implements a sleeping loop to wait for the mutex to unlock. @par Purpose - Since this class puts the thread to sleep for short intervals, you can use this + Since this class puts the thread to sleep for short intervals, you can use this class for most of your mutexes. Especially for locking any high level resources where any one operation on the resouce consumes many CPU cycles. The purpose of this mutex is to reduce the number of CPU cycles spent in idle loops. All @@ -613,17 +613,17 @@ private: /// Default constructor is not implemented. SleepLevelMutex( void ); /// Copy constructor is not implemented. - SleepLevelMutex( const SleepLevelMutex & ); + SleepLevelMutex( const SleepLevelMutex& ); /// Copy-assignment operator is not implemented. - SleepLevelMutex & operator = ( const SleepLevelMutex & ); + SleepLevelMutex& operator = ( const SleepLevelMutex& ); #if defined( _MSC_VER ) - #if ( _MSC_VER >= 1300 ) - /// True if operating system may wake thread to respond to events. - bool m_wakable; - #else - #error "Only Visual Studio versions 7.0 and after supported." - #endif +#if ( _MSC_VER >= 1300 ) + /// True if operating system may wake thread to respond to events. + bool m_wakable; +#else +#error "Only Visual Studio versions 7.0 and after supported." +#endif #endif /// How many milli-seconds to sleep before trying to lock mutex again. @@ -738,11 +738,11 @@ private: template < - class MutexPolicy, - unsigned int DefaultLevel, - class ErrorPolicy = ::Loki::ThrowOnBadDesignMutexError, - class WaitPolicy = ::Loki::NoMutexWait -> +class MutexPolicy, + unsigned int DefaultLevel, + class ErrorPolicy = ::Loki::ThrowOnBadDesignMutexError, + class WaitPolicy = ::Loki::NoMutexWait + > class LevelMutex : public LevelMutexInfo { public: @@ -775,10 +775,10 @@ public: const and volatile qualifiers so callers get a reference to a MutexPolicy with the proper qualifiers. */ - inline const volatile MutexPolicy & GetMutexPolicy( void ) const volatile { return m_mutex; } - inline volatile MutexPolicy & GetMutexPolicy( void ) volatile { return m_mutex; } - inline const MutexPolicy & GetMutexPolicy( void ) const { return m_mutex; } - inline MutexPolicy & GetMutexPolicy( void ) { return m_mutex; } + inline const volatile MutexPolicy& GetMutexPolicy( void ) const volatile { return m_mutex; } + inline volatile MutexPolicy& GetMutexPolicy( void ) volatile { return m_mutex; } + inline const MutexPolicy& GetMutexPolicy( void ) const { return m_mutex; } + inline MutexPolicy& GetMutexPolicy( void ) { return m_mutex; } virtual MutexErrors::Type TryLock( void ) volatile { @@ -889,9 +889,9 @@ public: private: /// Copy constructor is not implemented since mutexes don't get copied. - LevelMutex( const LevelMutex & ); + LevelMutex( const LevelMutex& ); /// Copy-assignment operator is not implemented since mutexes don't get copied. - LevelMutex & operator = ( const LevelMutex & ); + LevelMutex& operator = ( const LevelMutex& ); virtual MutexErrors::Type DoErrorCheck( MutexErrors::Type result ) const volatile { @@ -1002,7 +1002,7 @@ unsigned int CountMutexesAtCurrentLevel( void ); /** Determines if container of mutexes matches the recently locked mutexes. If they do match, it returns success, otherwise an error condition. */ -MutexErrors::Type DoMutexesMatchContainer( const LevelMutexInfo::MutexContainer & mutexes ); +MutexErrors::Type DoMutexesMatchContainer( const LevelMutexInfo::MutexContainer& mutexes ); // ---------------------------------------------------------------------------- @@ -1018,19 +1018,19 @@ public: /** Constructs an exception which stores information about a mutex and the reason an attempt to use a mutex failed. */ - MutexException( const char * message, unsigned int level, MutexErrors::Type reason ); + MutexException( const char* message, unsigned int level, MutexErrors::Type reason ); /// Copy constructor performs a member-by-member copy of an exception. - MutexException( const MutexException & that ) throw (); + MutexException( const MutexException& that ) throw (); /// Copy-assignment operator performs a member-by-member copy of an exception. - MutexException & operator = ( const MutexException & that ) throw (); + MutexException& operator = ( const MutexException& that ) throw (); /// Destroys the exception. virtual ~MutexException( void ) throw(); /// Returns a simple message about which operation failed. - virtual const char * what( void ) const throw(); + virtual const char* what( void ) const throw(); /// Returns level of mutex(es) used when problem occurred. unsigned int GetLevel( void ) const { return m_level; } @@ -1044,7 +1044,7 @@ private: MutexException( void ) throw (); /// Simple message about operation that failed. - const char * m_message; + const char* m_message; /// Level of mutex(es) used when problem occurred. unsigned int m_level; /// Error status for why operation failed. @@ -1071,7 +1071,7 @@ public: @param lock True if function wants to lock the mutex as this gets constructed. */ - explicit MutexLocker( volatile LevelMutexInfo & mutex, bool lock = true ); + explicit MutexLocker( volatile LevelMutexInfo& mutex, bool lock = true ); /** Creates an object to lock an unlock a mutex for a function. This waits a specified amount of time for another thread to unlock the mutex if it is @@ -1082,8 +1082,8 @@ public: @param lock True if function wants to lock the mutex as this gets constructed. */ - MutexLocker( volatile LevelMutexInfo & mutex, unsigned int milliSeconds, - bool lock = true ); + MutexLocker( volatile LevelMutexInfo& mutex, unsigned int milliSeconds, + bool lock = true ); /// Destructs the locker, and determines if it needs to unlock the mutex. ~MutexLocker( void ); @@ -1107,23 +1107,23 @@ public: /// Returns true if the mutex is locked by this object. inline bool IsLocked( void ) const { return m_locked; } - /// Provides access to mutex controlled by this. - const volatile LevelMutexInfo & GetMutex( void ) const { return m_mutex; } + /// Provides access to mutex controlled by this. + const volatile LevelMutexInfo& GetMutex( void ) const { return m_mutex; } private: /// Default constructor is not implemented. MutexLocker( void ); /// Copy constructor is not implemented. - MutexLocker( const MutexLocker & ); + MutexLocker( const MutexLocker& ); /// Copy-assignment operator is not implemented. - MutexLocker & operator = ( const MutexLocker & ); + MutexLocker& operator = ( const MutexLocker& ); /// True if mutex got locked. bool m_locked; /// Reference to mutex. - volatile LevelMutexInfo & m_mutex; + volatile LevelMutexInfo& m_mutex; }; // ---------------------------------------------------------------------------- @@ -1147,8 +1147,8 @@ public: @param lock True if function wants to lock the mutex as this gets constructed. */ - explicit MultiMutexLocker( LevelMutexInfo::MutexContainer & mutexes, - bool lock = true ); + explicit MultiMutexLocker( LevelMutexInfo::MutexContainer& mutexes, + bool lock = true ); /** Creates an object to lock and unlock a collection of mutexes for a function. This waits a specified amount of time for other threads to unlock each mutex @@ -1160,8 +1160,8 @@ public: @param lock True if function wants to lock the mutexes as this gets constructed. */ - MultiMutexLocker( LevelMutexInfo::MutexContainer & mutexes, - unsigned int milliSeconds, bool lock = true ); + MultiMutexLocker( LevelMutexInfo::MutexContainer& mutexes, + unsigned int milliSeconds, bool lock = true ); /// Destructs the locker, and determines if it needs to unlock the mutexes. ~MultiMutexLocker( void ); @@ -1185,23 +1185,23 @@ public: /// Returns true if the mutexes are locked by this object. inline bool IsLocked( void ) const { return m_locked; } - /// Provides access to the collection of mutexes controlled by this. - const LevelMutexInfo::MutexContainer & GetMutexes( void ) const { return m_mutexes; } + /// Provides access to the collection of mutexes controlled by this. + const LevelMutexInfo::MutexContainer& GetMutexes( void ) const { return m_mutexes; } private: /// Default constructor is not implemented. MultiMutexLocker( void ); /// Copy constructor is not implemented. - MultiMutexLocker( const MultiMutexLocker & ); + MultiMutexLocker( const MultiMutexLocker& ); /// Copy-assignment operator is not implemented. - MultiMutexLocker & operator = ( const MultiMutexLocker & ); + MultiMutexLocker& operator = ( const MultiMutexLocker& ); /// True if mutexes got locked. bool m_locked; /// Reference to external container of mutexes; - LevelMutexInfo::MutexContainer & m_mutexes; + LevelMutexInfo::MutexContainer& m_mutexes; }; // ---------------------------------------------------------------------------- diff --git a/shared/loki/LockingPtr.h b/shared/loki/LockingPtr.h index a50f5d6d..5482f075 100644 --- a/shared/loki/LockingPtr.h +++ b/shared/loki/LockingPtr.h @@ -7,12 +7,12 @@ // for You" by Alexandrescu, Andrei. // Published in the February 2001 issue of the C/C++ Users Journal. // http://www.cuj.com/documents/s=7998/cujcexp1902alexandr/ -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author makes no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author makes no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. // Prepared for Loki library by Richard Sposato //////////////////////////////////////////////////////////////////////////////// @@ -28,81 +28,81 @@ namespace Loki { - /** @class LockingPtr - Locks a volatile object and casts away volatility so that the object - can be safely used in a single-threaded region of code. - Original version of LockingPtr had only one template - for the shared - object, but not the mutex type. This version allows users to specify a - the mutex type as a LockingPolicy class. The only requirements for a - LockingPolicy class are to provide Lock and Unlock methods. +/** @class LockingPtr + Locks a volatile object and casts away volatility so that the object + can be safely used in a single-threaded region of code. + Original version of LockingPtr had only one template - for the shared + object, but not the mutex type. This version allows users to specify a + the mutex type as a LockingPolicy class. The only requirements for a + LockingPolicy class are to provide Lock and Unlock methods. + */ +template < typename SharedObject, typename LockingPolicy = LOKI_DEFAULT_MUTEX, + template<class> class ConstPolicy = LOKI_DEFAULT_CONSTNESS > +class LockingPtr +{ +public: + + typedef typename ConstPolicy<SharedObject>::Type ConstOrNotType; + + /** Constructor locks mutex associated with an object. + @param object Reference to object. + @param mutex Mutex used to control thread access to object. + */ + LockingPtr( volatile ConstOrNotType& object, LockingPolicy& mutex ) + : pObject_( const_cast< SharedObject* >( &object ) ), + pMutex_( &mutex ) + { + mutex.Lock(); + } + + typedef typename std::pair<volatile ConstOrNotType*, LockingPolicy*> Pair; + + /** Constructor locks mutex associated with an object. + @param lockpair a std::pair of pointers to the object and the mutex */ - template < typename SharedObject, typename LockingPolicy = LOKI_DEFAULT_MUTEX, - template<class> class ConstPolicy = LOKI_DEFAULT_CONSTNESS > - class LockingPtr + LockingPtr( Pair lockpair ) + : pObject_( const_cast< SharedObject* >( lockpair.first ) ), + pMutex_( lockpair.second ) + { + lockpair.second->Lock(); + } + + /// Destructor unlocks the mutex. + ~LockingPtr() + { + pMutex_->Unlock(); + } + + /// Star-operator dereferences pointer. + ConstOrNotType& operator * () + { + return *pObject_; + } + + /// Point-operator returns pointer to object. + ConstOrNotType* operator -> () { - public: - - typedef typename ConstPolicy<SharedObject>::Type ConstOrNotType; - - /** Constructor locks mutex associated with an object. - @param object Reference to object. - @param mutex Mutex used to control thread access to object. - */ - LockingPtr( volatile ConstOrNotType & object, LockingPolicy & mutex ) - : pObject_( const_cast< SharedObject * >( &object ) ), - pMutex_( &mutex ) - { - mutex.Lock(); - } - - typedef typename std::pair<volatile ConstOrNotType *, LockingPolicy *> Pair; - - /** Constructor locks mutex associated with an object. - @param lockpair a std::pair of pointers to the object and the mutex - */ - LockingPtr( Pair lockpair ) - : pObject_( const_cast< SharedObject * >( lockpair.first ) ), - pMutex_( lockpair.second ) - { - lockpair.second->Lock(); - } - - /// Destructor unlocks the mutex. - ~LockingPtr() - { - pMutex_->Unlock(); - } - - /// Star-operator dereferences pointer. - ConstOrNotType & operator * () - { - return *pObject_; - } - - /// Point-operator returns pointer to object. - ConstOrNotType * operator -> () - { - return pObject_; - } - - private: - - /// Default constructor is not implemented. - LockingPtr(); - - /// Copy-constructor is not implemented. - LockingPtr( const LockingPtr & ); - - /// Copy-assignment-operator is not implemented. - LockingPtr & operator = ( const LockingPtr & ); - - /// Pointer to the shared object. - ConstOrNotType * pObject_; - - /// Pointer to the mutex. - LockingPolicy * pMutex_; - - }; // end class LockingPtr + return pObject_; + } + +private: + + /// Default constructor is not implemented. + LockingPtr(); + + /// Copy-constructor is not implemented. + LockingPtr( const LockingPtr& ); + + /// Copy-assignment-operator is not implemented. + LockingPtr& operator = ( const LockingPtr& ); + + /// Pointer to the shared object. + ConstOrNotType* pObject_; + + /// Pointer to the mutex. + LockingPolicy* pMutex_; + +}; // end class LockingPtr } // namespace Loki diff --git a/shared/loki/LokiExport.h b/shared/loki/LokiExport.h index 625449f2..eb02516b 100644 --- a/shared/loki/LokiExport.h +++ b/shared/loki/LokiExport.h @@ -1,12 +1,12 @@ //////////////////////////////////////////////////////////////////////////////// // The Loki Library // Copyright (c) 2006 by Peter Kümmel -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author makes no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author makes no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_LOKIEXPORT_INC_ @@ -19,10 +19,10 @@ #ifdef _HAVE_GCC_VISIBILITY #define LOKI_EXPORT_SPEC __attribute__ ((visibility("default"))) -#define LOKI_IMPORT_SPEC +#define LOKI_IMPORT_SPEC #else #define LOKI_EXPORT_SPEC -#define LOKI_IMPORT_SPEC +#define LOKI_IMPORT_SPEC #endif #else @@ -31,8 +31,8 @@ #define LOKI_EXPORT_SPEC __declspec(dllexport) #define LOKI_IMPORT_SPEC __declspec(dllimport) #else -#define LOKI_EXPORT_SPEC -#define LOKI_IMPORT_SPEC +#define LOKI_EXPORT_SPEC +#define LOKI_IMPORT_SPEC #endif #endif diff --git a/shared/loki/LokiTypeInfo.h b/shared/loki/LokiTypeInfo.h index 715dab1a..ecb657d4 100644 --- a/shared/loki/LokiTypeInfo.h +++ b/shared/loki/LokiTypeInfo.h @@ -2,14 +2,14 @@ // The Loki Library // Copyright (c) 2001 by Andrei Alexandrescu // This code accompanies the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author or Addison-Wesley Longman make no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author or Addison-Wesley Longman make no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_LOKITYPEINFO_INC_ @@ -29,75 +29,75 @@ namespace Loki // Purpose: offer a first-class, comparable wrapper over std::type_info //////////////////////////////////////////////////////////////////////////////// - class TypeInfo - { - public: - // Constructors - TypeInfo(); // needed for containers - TypeInfo(const std::type_info&); // non-explicit - - // Access for the wrapped std::type_info - const std::type_info& Get() const; - // Compatibility functions - bool before(const TypeInfo& rhs) const; - const char* name() const; - - private: - const std::type_info* pInfo_; - }; - +class TypeInfo +{ +public: + // Constructors + TypeInfo(); // needed for containers + TypeInfo(const std::type_info&); // non-explicit + + // Access for the wrapped std::type_info + const std::type_info& Get() const; + // Compatibility functions + bool before(const TypeInfo& rhs) const; + const char* name() const; + +private: + const std::type_info* pInfo_; +}; + // Implementation - - inline TypeInfo::TypeInfo() - { - class Nil {}; - pInfo_ = &typeid(Nil); - assert(pInfo_); - } - - inline TypeInfo::TypeInfo(const std::type_info& ti) + +inline TypeInfo::TypeInfo() +{ + class Nil {}; + pInfo_ = &typeid(Nil); + assert(pInfo_); +} + +inline TypeInfo::TypeInfo(const std::type_info& ti) : pInfo_(&ti) - { assert(pInfo_); } - - inline bool TypeInfo::before(const TypeInfo& rhs) const - { - assert(pInfo_); - // type_info::before return type is int in some VC libraries - return pInfo_->before(*rhs.pInfo_) != 0; - } - - inline const std::type_info& TypeInfo::Get() const - { - assert(pInfo_); - return *pInfo_; - } - - inline const char* TypeInfo::name() const - { - assert(pInfo_); - return pInfo_->name(); - } +{ assert(pInfo_); } + +inline bool TypeInfo::before(const TypeInfo& rhs) const +{ + assert(pInfo_); + // type_info::before return type is int in some VC libraries + return pInfo_->before(*rhs.pInfo_) != 0; +} + +inline const std::type_info& TypeInfo::Get() const +{ + assert(pInfo_); + return *pInfo_; +} + +inline const char* TypeInfo::name() const +{ + assert(pInfo_); + return pInfo_->name(); +} // Comparison operators - - inline bool operator==(const TypeInfo& lhs, const TypeInfo& rhs) - // type_info::operator== return type is int in some VC libraries - { return (lhs.Get() == rhs.Get()) != 0; } - - inline bool operator<(const TypeInfo& lhs, const TypeInfo& rhs) - { return lhs.before(rhs); } - - inline bool operator!=(const TypeInfo& lhs, const TypeInfo& rhs) - { return !(lhs == rhs); } - - inline bool operator>(const TypeInfo& lhs, const TypeInfo& rhs) - { return rhs < lhs; } - - inline bool operator<=(const TypeInfo& lhs, const TypeInfo& rhs) - { return !(lhs > rhs); } - - inline bool operator>=(const TypeInfo& lhs, const TypeInfo& rhs) - { return !(lhs < rhs); } + +inline bool operator==(const TypeInfo& lhs, const TypeInfo& rhs) +// type_info::operator== return type is int in some VC libraries +{ return (lhs.Get() == rhs.Get()) != 0; } + +inline bool operator<(const TypeInfo& lhs, const TypeInfo& rhs) +{ return lhs.before(rhs); } + +inline bool operator!=(const TypeInfo& lhs, const TypeInfo& rhs) +{ return !(lhs == rhs); } + +inline bool operator>(const TypeInfo& lhs, const TypeInfo& rhs) +{ return rhs < lhs; } + +inline bool operator<=(const TypeInfo& lhs, const TypeInfo& rhs) +{ return !(lhs > rhs); } + +inline bool operator>=(const TypeInfo& lhs, const TypeInfo& rhs) +{ return !(lhs < rhs); } } #endif // end file guardian diff --git a/shared/loki/MultiMethods.h b/shared/loki/MultiMethods.h index d095cfae..ece4fb17 100644 --- a/shared/loki/MultiMethods.h +++ b/shared/loki/MultiMethods.h @@ -2,14 +2,14 @@ // The Loki Library // Copyright (c) 2001 by Andrei Alexandrescu // This code accompanies the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author or Addison-Wesley Longman make no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author or Addison-Wesley Longman make no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_MULTIMETHODS_INC_ @@ -36,210 +36,210 @@ namespace Loki // Helps implementing optional symmetry //////////////////////////////////////////////////////////////////////////////// - namespace Private +namespace Private +{ +template <class SomeLhs, class SomeRhs, + class Executor, typename ResultType> +struct InvocationTraits +{ + static ResultType + DoDispatch(SomeLhs& lhs, SomeRhs& rhs, + Executor& exec, Int2Type<false>) { - template <class SomeLhs, class SomeRhs, - class Executor, typename ResultType> - struct InvocationTraits - { - static ResultType - DoDispatch(SomeLhs& lhs, SomeRhs& rhs, - Executor& exec, Int2Type<false>) - { - return exec.Fire(lhs, rhs); - } - static ResultType - DoDispatch(SomeLhs& lhs, SomeRhs& rhs, - Executor& exec, Int2Type<true>) - { - return exec.Fire(rhs, lhs); - } - }; + return exec.Fire(lhs, rhs); } + static ResultType + DoDispatch(SomeLhs& lhs, SomeRhs& rhs, + Executor& exec, Int2Type<true>) + { + return exec.Fire(rhs, lhs); + } +}; +} //////////////////////////////////////////////////////////////////////////////// // class template StaticDispatcher // Implements an automatic static double dispatcher based on two typelists //////////////////////////////////////////////////////////////////////////////// - template - < - class Executor, - class BaseLhs, - class TypesLhs, - bool symmetric = true, - class BaseRhs = BaseLhs, - class TypesRhs = TypesLhs, - typename ResultType = void - > - class StaticDispatcher +template +< +class Executor, + class BaseLhs, + class TypesLhs, + bool symmetric = true, + class BaseRhs = BaseLhs, + class TypesRhs = TypesLhs, + typename ResultType = void + > +class StaticDispatcher +{ + template <class SomeLhs> + static ResultType DispatchRhs(SomeLhs& lhs, BaseRhs& rhs, + Executor exec, NullType) + { return exec.OnError(lhs, rhs); } + + template <class Head, class Tail, class SomeLhs> + static ResultType DispatchRhs(SomeLhs& lhs, BaseRhs& rhs, + Executor exec, Typelist<Head, Tail>) { - template <class SomeLhs> - static ResultType DispatchRhs(SomeLhs& lhs, BaseRhs& rhs, - Executor exec, NullType) - { return exec.OnError(lhs, rhs); } - - template <class Head, class Tail, class SomeLhs> - static ResultType DispatchRhs(SomeLhs& lhs, BaseRhs& rhs, - Executor exec, Typelist<Head, Tail>) - { - if (Head* p2 = dynamic_cast<Head*>(&rhs)) - { - Int2Type<(symmetric && - int(TL::IndexOf<TypesRhs, Head>::value) < - int(TL::IndexOf<TypesLhs, SomeLhs>::value))> i2t; - - typedef Private::InvocationTraits< - SomeLhs, Head, Executor, ResultType> CallTraits; - - return CallTraits::DoDispatch(lhs, *p2, exec, i2t); - } - return DispatchRhs(lhs, rhs, exec, Tail()); + if (Head* p2 = dynamic_cast<Head*>(&rhs)) + { + Int2Type<(symmetric && + int(TL::IndexOf<TypesRhs, Head>::value) < + int(TL::IndexOf<TypesLhs, SomeLhs>::value))> i2t; + + typedef Private::InvocationTraits< + SomeLhs, Head, Executor, ResultType> CallTraits; + + return CallTraits::DoDispatch(lhs, *p2, exec, i2t); } - - static ResultType DispatchLhs(BaseLhs& lhs, BaseRhs& rhs, - Executor exec, NullType) - { return exec.OnError(lhs, rhs); } - - template <class Head, class Tail> - static ResultType DispatchLhs(BaseLhs& lhs, BaseRhs& rhs, - Executor exec, Typelist<Head, Tail>) - { - if (Head* p1 = dynamic_cast<Head*>(&lhs)) - { - return DispatchRhs(*p1, rhs, exec, TypesRhs()); - } - return DispatchLhs(lhs, rhs, exec, Tail()); + return DispatchRhs(lhs, rhs, exec, Tail()); + } + + static ResultType DispatchLhs(BaseLhs& lhs, BaseRhs& rhs, + Executor exec, NullType) + { return exec.OnError(lhs, rhs); } + + template <class Head, class Tail> + static ResultType DispatchLhs(BaseLhs& lhs, BaseRhs& rhs, + Executor exec, Typelist<Head, Tail>) + { + if (Head* p1 = dynamic_cast<Head*>(&lhs)) + { + return DispatchRhs(*p1, rhs, exec, TypesRhs()); } + return DispatchLhs(lhs, rhs, exec, Tail()); + } + +public: + static ResultType Go(BaseLhs& lhs, BaseRhs& rhs, + Executor exec) + { return DispatchLhs(lhs, rhs, exec, TypesLhs()); } +}; - public: - static ResultType Go(BaseLhs& lhs, BaseRhs& rhs, - Executor exec) - { return DispatchLhs(lhs, rhs, exec, TypesLhs()); } - }; - //////////////////////////////////////////////////////////////////////////////// // class template BasicDispatcher // Implements a logarithmic double dispatcher for functors (or functions) // Doesn't offer automated casts or symmetry //////////////////////////////////////////////////////////////////////////////// - template - < - class BaseLhs, - class BaseRhs = BaseLhs, - typename ResultType = void, - typename CallbackType = ResultType (*)(BaseLhs&, BaseRhs&) - > - class BasicDispatcher - { - typedef std::pair<TypeInfo,TypeInfo> KeyType; - typedef CallbackType MappedType; - typedef AssocVector<KeyType, MappedType> MapType; - MapType callbackMap_; - - void DoAdd(TypeInfo lhs, TypeInfo rhs, CallbackType fun); - bool DoRemove(TypeInfo lhs, TypeInfo rhs); - - public: - template <class SomeLhs, class SomeRhs> - void Add(CallbackType fun) - { - DoAdd(typeid(SomeLhs), typeid(SomeRhs), fun); - } - - template <class SomeLhs, class SomeRhs> - bool Remove() - { - return DoRemove(typeid(SomeLhs), typeid(SomeRhs)); - } - - ResultType Go(BaseLhs& lhs, BaseRhs& rhs); - }; - - // Non-inline to reduce compile time overhead... - template <class BaseLhs, class BaseRhs, - typename ResultType, typename CallbackType> - void BasicDispatcher<BaseLhs,BaseRhs,ResultType,CallbackType> - ::DoAdd(TypeInfo lhs, TypeInfo rhs, CallbackType fun) +template +< +class BaseLhs, + class BaseRhs = BaseLhs, + typename ResultType = void, + typename CallbackType = ResultType (*)(BaseLhs&, BaseRhs&) + > +class BasicDispatcher +{ + typedef std::pair<TypeInfo,TypeInfo> KeyType; + typedef CallbackType MappedType; + typedef AssocVector<KeyType, MappedType> MapType; + MapType callbackMap_; + + void DoAdd(TypeInfo lhs, TypeInfo rhs, CallbackType fun); + bool DoRemove(TypeInfo lhs, TypeInfo rhs); + +public: + template <class SomeLhs, class SomeRhs> + void Add(CallbackType fun) { - callbackMap_[KeyType(lhs, rhs)] = fun; + DoAdd(typeid(SomeLhs), typeid(SomeRhs), fun); } - - template <class BaseLhs, class BaseRhs, - typename ResultType, typename CallbackType> - bool BasicDispatcher<BaseLhs,BaseRhs,ResultType,CallbackType> - ::DoRemove(TypeInfo lhs, TypeInfo rhs) + + template <class SomeLhs, class SomeRhs> + bool Remove() { - return callbackMap_.erase(KeyType(lhs, rhs)) == 1; + return DoRemove(typeid(SomeLhs), typeid(SomeRhs)); } - template <class BaseLhs, class BaseRhs, - typename ResultType, typename CallbackType> - ResultType BasicDispatcher<BaseLhs,BaseRhs,ResultType,CallbackType> - ::Go(BaseLhs& lhs, BaseRhs& rhs) + ResultType Go(BaseLhs& lhs, BaseRhs& rhs); +}; + +// Non-inline to reduce compile time overhead... +template <class BaseLhs, class BaseRhs, + typename ResultType, typename CallbackType> +void BasicDispatcher<BaseLhs,BaseRhs,ResultType,CallbackType> +::DoAdd(TypeInfo lhs, TypeInfo rhs, CallbackType fun) +{ + callbackMap_[KeyType(lhs, rhs)] = fun; +} + +template <class BaseLhs, class BaseRhs, + typename ResultType, typename CallbackType> +bool BasicDispatcher<BaseLhs,BaseRhs,ResultType,CallbackType> +::DoRemove(TypeInfo lhs, TypeInfo rhs) +{ + return callbackMap_.erase(KeyType(lhs, rhs)) == 1; +} + +template <class BaseLhs, class BaseRhs, + typename ResultType, typename CallbackType> +ResultType BasicDispatcher<BaseLhs,BaseRhs,ResultType,CallbackType> +::Go(BaseLhs& lhs, BaseRhs& rhs) +{ + typename MapType::key_type k(typeid(lhs),typeid(rhs)); + typename MapType::iterator i = callbackMap_.find(k); + if (i == callbackMap_.end()) { - typename MapType::key_type k(typeid(lhs),typeid(rhs)); - typename MapType::iterator i = callbackMap_.find(k); - if (i == callbackMap_.end()) - { - throw std::runtime_error("Function not found"); - } - return (i->second)(lhs, rhs); + throw std::runtime_error("Function not found"); } + return (i->second)(lhs, rhs); +} //////////////////////////////////////////////////////////////////////////////// // class template StaticCaster // Implementation of the CastingPolicy used by FunctorDispatcher //////////////////////////////////////////////////////////////////////////////// - template <class To, class From> - struct StaticCaster +template <class To, class From> +struct StaticCaster +{ + static To& Cast(From& obj) { - static To& Cast(From& obj) - { - return static_cast<To&>(obj); - } - }; + return static_cast<To&>(obj); + } +}; //////////////////////////////////////////////////////////////////////////////// // class template DynamicCaster // Implementation of the CastingPolicy used by FunctorDispatcher //////////////////////////////////////////////////////////////////////////////// - template <class To, class From> - struct DynamicCaster +template <class To, class From> +struct DynamicCaster +{ + static To& Cast(From& obj) { - static To& Cast(From& obj) - { - return dynamic_cast<To&>(obj); - } - }; + return dynamic_cast<To&>(obj); + } +}; //////////////////////////////////////////////////////////////////////////////// // class template Private::FnDispatcherHelper // Implements trampolines and argument swapping used by FnDispatcher //////////////////////////////////////////////////////////////////////////////// - namespace Private +namespace Private +{ +template <class BaseLhs, class BaseRhs, + class SomeLhs, class SomeRhs, + typename ResultType, + class CastLhs, class CastRhs, + ResultType (*Callback)(SomeLhs&, SomeRhs&)> +struct FnDispatcherHelper +{ + static ResultType Trampoline(BaseLhs& lhs, BaseRhs& rhs) { - template <class BaseLhs, class BaseRhs, - class SomeLhs, class SomeRhs, - typename ResultType, - class CastLhs, class CastRhs, - ResultType (*Callback)(SomeLhs&, SomeRhs&)> - struct FnDispatcherHelper - { - static ResultType Trampoline(BaseLhs& lhs, BaseRhs& rhs) - { - return Callback(CastLhs::Cast(lhs), CastRhs::Cast(rhs)); - } - static ResultType TrampolineR(BaseRhs& rhs, BaseLhs& lhs) - { - return Trampoline(lhs, rhs); - } - }; + return Callback(CastLhs::Cast(lhs), CastRhs::Cast(rhs)); + } + static ResultType TrampolineR(BaseRhs& rhs, BaseLhs& lhs) + { + return Trampoline(lhs, rhs); } +}; +} //////////////////////////////////////////////////////////////////////////////// // class template FnDispatcher @@ -247,102 +247,102 @@ namespace Loki // Features automated conversions //////////////////////////////////////////////////////////////////////////////// - template <class BaseLhs, class BaseRhs = BaseLhs, - typename ResultType = void, - template <class, class> class CastingPolicy = DynamicCaster, - template <class, class, class, class> - class DispatcherBackend = BasicDispatcher> - class FnDispatcher +template <class BaseLhs, class BaseRhs = BaseLhs, + typename ResultType = void, + template <class, class> class CastingPolicy = DynamicCaster, + template <class, class, class, class> + class DispatcherBackend = BasicDispatcher> +class FnDispatcher +{ + DispatcherBackend<BaseLhs, BaseRhs, ResultType, + ResultType (*)(BaseLhs&, BaseRhs&)> backEnd_; + +public: + template <class SomeLhs, class SomeRhs> + void Add(ResultType (*pFun)(BaseLhs&, BaseRhs&)) + { + return backEnd_.template Add<SomeLhs, SomeRhs>(pFun); + } + + template <class SomeLhs, class SomeRhs, + ResultType (*callback)(SomeLhs&, SomeRhs&)> + void Add() { - DispatcherBackend<BaseLhs, BaseRhs, ResultType, - ResultType (*)(BaseLhs&, BaseRhs&)> backEnd_; - - public: - template <class SomeLhs, class SomeRhs> - void Add(ResultType (*pFun)(BaseLhs&, BaseRhs&)) - { - return backEnd_.template Add<SomeLhs, SomeRhs>(pFun); - } - - template <class SomeLhs, class SomeRhs, - ResultType (*callback)(SomeLhs&, SomeRhs&)> - void Add() - { typedef Private::FnDispatcherHelper< - BaseLhs, BaseRhs, - SomeLhs, SomeRhs, - ResultType, - CastingPolicy<SomeLhs,BaseLhs>, - CastingPolicy<SomeRhs,BaseRhs>, - callback> Local; - - Add<SomeLhs, SomeRhs>(&Local::Trampoline); - } - - template <class SomeLhs, class SomeRhs, - ResultType (*callback)(SomeLhs&, SomeRhs&), - bool symmetric> - void Add(bool = true) // [gcc] dummy bool - { + BaseLhs, BaseRhs, + SomeLhs, SomeRhs, + ResultType, + CastingPolicy<SomeLhs,BaseLhs>, + CastingPolicy<SomeRhs,BaseRhs>, + callback> Local; + + Add<SomeLhs, SomeRhs>(&Local::Trampoline); + } + + template <class SomeLhs, class SomeRhs, + ResultType (*callback)(SomeLhs&, SomeRhs&), + bool symmetric> + void Add(bool = true) // [gcc] dummy bool + { typedef Private::FnDispatcherHelper< - BaseLhs, BaseRhs, - SomeLhs, SomeRhs, - ResultType, - CastingPolicy<SomeLhs,BaseLhs>, - CastingPolicy<SomeRhs,BaseRhs>, - callback> Local; - - Add<SomeLhs, SomeRhs>(&Local::Trampoline); - if (symmetric) - { - Add<SomeRhs, SomeLhs>(&Local::TrampolineR); - } - } - - template <class SomeLhs, class SomeRhs> - void Remove() + BaseLhs, BaseRhs, + SomeLhs, SomeRhs, + ResultType, + CastingPolicy<SomeLhs,BaseLhs>, + CastingPolicy<SomeRhs,BaseRhs>, + callback> Local; + + Add<SomeLhs, SomeRhs>(&Local::Trampoline); + if (symmetric) { - backEnd_.template Remove<SomeLhs, SomeRhs>(); + Add<SomeRhs, SomeLhs>(&Local::TrampolineR); } + } - ResultType Go(BaseLhs& lhs, BaseRhs& rhs) - { - return backEnd_.Go(lhs, rhs); - } - }; + template <class SomeLhs, class SomeRhs> + void Remove() + { + backEnd_.template Remove<SomeLhs, SomeRhs>(); + } + + ResultType Go(BaseLhs& lhs, BaseRhs& rhs) + { + return backEnd_.Go(lhs, rhs); + } +}; //////////////////////////////////////////////////////////////////////////////// // class template FunctorDispatcherAdaptor // permits use of FunctorDispatcher under gcc.2.95.2/3 /////////////////////////////////////////////////////////////////////////////// - namespace Private +namespace Private +{ +template <class BaseLhs, class BaseRhs, + class SomeLhs, class SomeRhs, + typename ResultType, + class CastLhs, class CastRhs, + class Fun, bool SwapArgs> +class FunctorDispatcherHelper +{ + Fun fun_; + ResultType Fire(BaseLhs& lhs, BaseRhs& rhs,Int2Type<false>) { - template <class BaseLhs, class BaseRhs, - class SomeLhs, class SomeRhs, - typename ResultType, - class CastLhs, class CastRhs, - class Fun, bool SwapArgs> - class FunctorDispatcherHelper - { - Fun fun_; - ResultType Fire(BaseLhs& lhs, BaseRhs& rhs,Int2Type<false>) - { - return fun_(CastLhs::Cast(lhs), CastRhs::Cast(rhs)); - } - ResultType Fire(BaseLhs& rhs, BaseRhs& lhs,Int2Type<true>) - { - return fun_(CastLhs::Cast(lhs), CastRhs::Cast(rhs)); - } - public: - FunctorDispatcherHelper(const Fun& fun) : fun_(fun) {} - - ResultType operator()(BaseLhs& lhs, BaseRhs& rhs) - { - return Fire(lhs,rhs,Int2Type<SwapArgs>()); - } - }; + return fun_(CastLhs::Cast(lhs), CastRhs::Cast(rhs)); } + ResultType Fire(BaseLhs& rhs, BaseRhs& lhs,Int2Type<true>) + { + return fun_(CastLhs::Cast(lhs), CastRhs::Cast(rhs)); + } +public: + FunctorDispatcherHelper(const Fun& fun) : fun_(fun) {} + + ResultType operator()(BaseLhs& lhs, BaseRhs& rhs) + { + return Fire(lhs,rhs,Int2Type<SwapArgs>()); + } +}; +} //////////////////////////////////////////////////////////////////////////////// // class template FunctorDispatcher @@ -350,63 +350,63 @@ namespace Loki // Features automated casting //////////////////////////////////////////////////////////////////////////////// - template <class BaseLhs, class BaseRhs = BaseLhs, - typename ResultType = void, - template <class, class> class CastingPolicy = DynamicCaster, - template <class, class, class, class> - class DispatcherBackend = BasicDispatcher> - class FunctorDispatcher - { - typedef LOKI_TYPELIST_2(BaseLhs&, BaseRhs&) ArgsList; - typedef Functor<ResultType, ArgsList, LOKI_DEFAULT_THREADING> FunctorType; +template <class BaseLhs, class BaseRhs = BaseLhs, + typename ResultType = void, + template <class, class> class CastingPolicy = DynamicCaster, + template <class, class, class, class> + class DispatcherBackend = BasicDispatcher> +class FunctorDispatcher +{ + typedef LOKI_TYPELIST_2(BaseLhs&, BaseRhs&) ArgsList; + typedef Functor<ResultType, ArgsList, LOKI_DEFAULT_THREADING> FunctorType; - DispatcherBackend<BaseLhs, BaseRhs, ResultType, FunctorType> backEnd_; + DispatcherBackend<BaseLhs, BaseRhs, ResultType, FunctorType> backEnd_; - public: - template <class SomeLhs, class SomeRhs, class Fun> - void Add(const Fun& fun) - { - typedef Private::FunctorDispatcherHelper< - BaseLhs, BaseRhs, - SomeLhs, SomeRhs, - ResultType, - CastingPolicy<SomeLhs, BaseLhs>, - CastingPolicy<SomeRhs, BaseRhs>, - Fun, false> Adapter; - - backEnd_.template Add<SomeLhs, SomeRhs>(FunctorType(Adapter(fun))); +public: + template <class SomeLhs, class SomeRhs, class Fun> + void Add(const Fun& fun) + { + typedef Private::FunctorDispatcherHelper< + BaseLhs, BaseRhs, + SomeLhs, SomeRhs, + ResultType, + CastingPolicy<SomeLhs, BaseLhs>, + CastingPolicy<SomeRhs, BaseRhs>, + Fun, false> Adapter; + + backEnd_.template Add<SomeLhs, SomeRhs>(FunctorType(Adapter(fun))); } - template <class SomeLhs, class SomeRhs, bool symmetric, class Fun> - void Add(const Fun& fun) - { + template <class SomeLhs, class SomeRhs, bool symmetric, class Fun> + void Add(const Fun& fun) + { Add<SomeLhs,SomeRhs>(fun); if (symmetric) { - // Note: symmetry only makes sense where BaseLhs==BaseRhs - typedef Private::FunctorDispatcherHelper< - BaseLhs, BaseLhs, - SomeLhs, SomeRhs, - ResultType, - CastingPolicy<SomeLhs, BaseLhs>, - CastingPolicy<SomeRhs, BaseLhs>, - Fun, true> AdapterR; - - backEnd_.template Add<SomeRhs, SomeLhs>(FunctorType(AdapterR(fun))); - } - } - - template <class SomeLhs, class SomeRhs> - void Remove() - { - backEnd_.template Remove<SomeLhs, SomeRhs>(); + // Note: symmetry only makes sense where BaseLhs==BaseRhs + typedef Private::FunctorDispatcherHelper< + BaseLhs, BaseLhs, + SomeLhs, SomeRhs, + ResultType, + CastingPolicy<SomeLhs, BaseLhs>, + CastingPolicy<SomeRhs, BaseLhs>, + Fun, true> AdapterR; + + backEnd_.template Add<SomeRhs, SomeLhs>(FunctorType(AdapterR(fun))); } + } - ResultType Go(BaseLhs& lhs, BaseRhs& rhs) - { - return backEnd_.Go(lhs, rhs); - } - }; + template <class SomeLhs, class SomeRhs> + void Remove() + { + backEnd_.template Remove<SomeLhs, SomeRhs>(); + } + + ResultType Go(BaseLhs& lhs, BaseRhs& rhs) + { + return backEnd_.Go(lhs, rhs); + } +}; } // namespace Loki diff --git a/shared/loki/NullType.h b/shared/loki/NullType.h index 9403901a..8a4bb008 100644 --- a/shared/loki/NullType.h +++ b/shared/loki/NullType.h @@ -2,14 +2,14 @@ // The Loki Library // Copyright (c) 2001 by Andrei Alexandrescu // This code accompanies the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author or Addison-Wesley Longman make no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author or Addison-Wesley Longman make no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_NULLTYPE_INC_ @@ -23,11 +23,11 @@ namespace Loki //////////////////////////////////////////////////////////////////////////////// // class NullType // Used as a placeholder for "no type here" -// Useful as an end marker in typelists +// Useful as an end marker in typelists //////////////////////////////////////////////////////////////////////////////// - class NullType {}; - +class NullType {}; + } // namespace Loki diff --git a/shared/loki/OrderedStatic.h b/shared/loki/OrderedStatic.h index 6eaa20b9..0f26b6e0 100644 --- a/shared/loki/OrderedStatic.h +++ b/shared/loki/OrderedStatic.h @@ -1,12 +1,12 @@ //////////////////////////////////////////////////////////////////////////////// // The Loki Library // Copyright (c) 2005 Peter Kümmel -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author makes no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author makes no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_ORDEREDSTATIC_INC_ @@ -27,197 +27,197 @@ namespace Loki { - namespace Private +namespace Private +{ +//////////////////////////////////////////////////////////////////////////////// +// polymorph base class for OrderedStatic template, +// necessary because of the creator +//////////////////////////////////////////////////////////////////////////////// +class LOKI_EXPORT OrderedStaticCreatorFunc +{ +public: + virtual void createObject() = 0; + +protected: + OrderedStaticCreatorFunc(); + virtual ~OrderedStaticCreatorFunc(); + +private: + OrderedStaticCreatorFunc(const OrderedStaticCreatorFunc&); +}; + +//////////////////////////////////////////////////////////////////////////////// +// template base clase for OrderedStatic template, +// common for all specializations +//////////////////////////////////////////////////////////////////////////////// +template<class T> +class OrderedStaticBase : public OrderedStaticCreatorFunc +{ +public: + T& operator*() { - //////////////////////////////////////////////////////////////////////////////// - // polymorph base class for OrderedStatic template, - // necessary because of the creator - //////////////////////////////////////////////////////////////////////////////// - class LOKI_EXPORT OrderedStaticCreatorFunc - { - public: - virtual void createObject() = 0; - - protected: - OrderedStaticCreatorFunc(); - virtual ~OrderedStaticCreatorFunc(); - - private: - OrderedStaticCreatorFunc(const OrderedStaticCreatorFunc&); - }; - - //////////////////////////////////////////////////////////////////////////////// - // template base clase for OrderedStatic template, - // common for all specializations - //////////////////////////////////////////////////////////////////////////////// - template<class T> - class OrderedStaticBase : public OrderedStaticCreatorFunc - { - public: - T& operator*() - { - return *val_; - } - - T* operator->() - { - return val_; - } - - protected: - - OrderedStaticBase(unsigned int longevity) : val_(0), longevity_(longevity) - { - } - - virtual ~OrderedStaticBase() - { - } - - void SetLongevity(T* ptr) - { - val_=ptr; - Loki::SetLongevity(val_,longevity_); - } - - private: - OrderedStaticBase(); - OrderedStaticBase(const OrderedStaticBase&); - OrderedStaticBase& operator=(const OrderedStaticBase&); - T* val_; - unsigned int longevity_; - - }; - - //////////////////////////////////////////////////////////////////////////////// - // OrderedStaticManagerClass implements details - // OrderedStaticManager is then defined as a Singleton - //////////////////////////////////////////////////////////////////////////////// - class LOKI_EXPORT OrderedStaticManagerClass - { - public: - OrderedStaticManagerClass(); - virtual ~OrderedStaticManagerClass(); - - typedef void (OrderedStaticCreatorFunc::*Creator)(); - - void createObjects(); - void registerObject(unsigned int longevity,OrderedStaticCreatorFunc*,Creator); - - private: - OrderedStaticManagerClass(const OrderedStaticManagerClass&); - OrderedStaticManagerClass& operator=(const OrderedStaticManagerClass&); - - struct Data - { - Data(unsigned int,OrderedStaticCreatorFunc*, Creator); - unsigned int longevity; - OrderedStaticCreatorFunc* object; - Creator creator; - }; - - std::vector<Data> staticObjects_; - unsigned int max_longevity_; - unsigned int min_longevity_; - }; - - }// namespace Private - - //////////////////////////////////////////////////////////////////////////////// - // OrderedStaticManager is only a Singleton typedef - //////////////////////////////////////////////////////////////////////////////// - - typedef Loki::SingletonHolder - < - Loki::Private::OrderedStaticManagerClass, - Loki::CreateUsingNew, - Loki::NoDestroy, - Loki::SingleThreaded - > - OrderedStaticManager; - - //////////////////////////////////////////////////////////////////////////////// - // template OrderedStatic template: - // L : longevity - // T : object type - // TList : creator parameters - //////////////////////////////////////////////////////////////////////////////// - - template<unsigned int L, class T, class TList = Loki::NullType> - class OrderedStatic; - - - //////////////////////////////////////////////////////////////////////////////// - // OrderedStatic specializations - //////////////////////////////////////////////////////////////////////////////// - - template<unsigned int L, class T> - class OrderedStatic<L, T, Loki::NullType> : public Private::OrderedStaticBase<T> + return *val_; + } + + T* operator->() { - public: - OrderedStatic() : Private::OrderedStaticBase<T>(L) - { - OrderedStaticManager::Instance().registerObject - (L,this,&Private::OrderedStaticCreatorFunc::createObject); - } - - void createObject() - { - Private::OrderedStaticBase<T>::SetLongevity(new T); - } - - private: - OrderedStatic(const OrderedStatic&); - OrderedStatic& operator=(const OrderedStatic&); - }; + return val_; + } - template<unsigned int L, class T, typename P1> - class OrderedStatic<L, T, Loki::Seq<P1> > : public Private::OrderedStaticBase<T> +protected: + + OrderedStaticBase(unsigned int longevity) : val_(0), longevity_(longevity) { - public: - OrderedStatic(P1 p) : Private::OrderedStaticBase<T>(L), para_(p) - { - OrderedStaticManager::Instance().registerObject - (L,this,&Private::OrderedStaticCreatorFunc::createObject); - } - - void createObject() - { - Private::OrderedStaticBase<T>::SetLongevity(new T(para_)); - } - - private: - OrderedStatic(); - OrderedStatic(const OrderedStatic&); - OrderedStatic& operator=(const OrderedStatic&); - P1 para_; - }; + } - template<unsigned int L, class T, typename P1> - class OrderedStatic<L, T, P1(*)() > : public Private::OrderedStaticBase<T> + virtual ~OrderedStaticBase() { - public: - - typedef P1(*Func)(); - - OrderedStatic(Func p) : Private::OrderedStaticBase<T>(L), para_(p) - { - OrderedStaticManager::Instance().registerObject - (L,this,&Private::OrderedStaticCreatorFunc::createObject); - } - - void createObject() - { - Private::OrderedStaticBase<T>::SetLongevity(new T(para_())); - } - - private: - OrderedStatic(); - OrderedStatic(const OrderedStatic&); - OrderedStatic& operator=(const OrderedStatic&); - Func para_; + } + + void SetLongevity(T* ptr) + { + val_=ptr; + Loki::SetLongevity(val_,longevity_); + } + +private: + OrderedStaticBase(); + OrderedStaticBase(const OrderedStaticBase&); + OrderedStaticBase& operator=(const OrderedStaticBase&); + T* val_; + unsigned int longevity_; + +}; + +//////////////////////////////////////////////////////////////////////////////// +// OrderedStaticManagerClass implements details +// OrderedStaticManager is then defined as a Singleton +//////////////////////////////////////////////////////////////////////////////// +class LOKI_EXPORT OrderedStaticManagerClass +{ +public: + OrderedStaticManagerClass(); + virtual ~OrderedStaticManagerClass(); + + typedef void (OrderedStaticCreatorFunc::*Creator)(); + + void createObjects(); + void registerObject(unsigned int longevity,OrderedStaticCreatorFunc*,Creator); + +private: + OrderedStaticManagerClass(const OrderedStaticManagerClass&); + OrderedStaticManagerClass& operator=(const OrderedStaticManagerClass&); + + struct Data + { + Data(unsigned int,OrderedStaticCreatorFunc*, Creator); + unsigned int longevity; + OrderedStaticCreatorFunc* object; + Creator creator; }; + std::vector<Data> staticObjects_; + unsigned int max_longevity_; + unsigned int min_longevity_; +}; + +}// namespace Private + +//////////////////////////////////////////////////////////////////////////////// +// OrderedStaticManager is only a Singleton typedef +//////////////////////////////////////////////////////////////////////////////// + +typedef Loki::SingletonHolder +< +Loki::Private::OrderedStaticManagerClass, + Loki::CreateUsingNew, + Loki::NoDestroy, + Loki::SingleThreaded + > + OrderedStaticManager; + +//////////////////////////////////////////////////////////////////////////////// +// template OrderedStatic template: +// L : longevity +// T : object type +// TList : creator parameters +//////////////////////////////////////////////////////////////////////////////// + +template<unsigned int L, class T, class TList = Loki::NullType> +class OrderedStatic; + + +//////////////////////////////////////////////////////////////////////////////// +// OrderedStatic specializations +//////////////////////////////////////////////////////////////////////////////// + +template<unsigned int L, class T> +class OrderedStatic<L, T, Loki::NullType> : public Private::OrderedStaticBase<T> +{ +public: + OrderedStatic() : Private::OrderedStaticBase<T>(L) + { + OrderedStaticManager::Instance().registerObject + (L,this,&Private::OrderedStaticCreatorFunc::createObject); + } + + void createObject() + { + Private::OrderedStaticBase<T>::SetLongevity(new T); + } + +private: + OrderedStatic(const OrderedStatic&); + OrderedStatic& operator=(const OrderedStatic&); +}; + +template<unsigned int L, class T, typename P1> +class OrderedStatic<L, T, Loki::Seq<P1> > : public Private::OrderedStaticBase<T> +{ +public: + OrderedStatic(P1 p) : Private::OrderedStaticBase<T>(L), para_(p) + { + OrderedStaticManager::Instance().registerObject + (L,this,&Private::OrderedStaticCreatorFunc::createObject); + } + + void createObject() + { + Private::OrderedStaticBase<T>::SetLongevity(new T(para_)); + } + +private: + OrderedStatic(); + OrderedStatic(const OrderedStatic&); + OrderedStatic& operator=(const OrderedStatic&); + P1 para_; +}; + +template<unsigned int L, class T, typename P1> +class OrderedStatic<L, T, P1(*)() > : public Private::OrderedStaticBase<T> +{ +public: + + typedef P1(*Func)(); + + OrderedStatic(Func p) : Private::OrderedStaticBase<T>(L), para_(p) + { + OrderedStaticManager::Instance().registerObject + (L,this,&Private::OrderedStaticCreatorFunc::createObject); + } + + void createObject() + { + Private::OrderedStaticBase<T>::SetLongevity(new T(para_())); + } + +private: + OrderedStatic(); + OrderedStatic(const OrderedStatic&); + OrderedStatic& operator=(const OrderedStatic&); + Func para_; +}; + }// namespace Loki diff --git a/shared/loki/Pimpl.h b/shared/loki/Pimpl.h index ed0d1c7b..788f76d8 100644 --- a/shared/loki/Pimpl.h +++ b/shared/loki/Pimpl.h @@ -1,12 +1,12 @@ //////////////////////////////////////////////////////////////////////////////// // The Loki Library // Copyright (c) 2006 Peter Kümmel -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author makes no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author makes no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_PIMPL_INC_ @@ -15,7 +15,7 @@ // $Id: Pimpl.h 751 2006-10-17 19:50:37Z syntheticpp $ -/// \defgroup PimplGroup Pimpl +/// \defgroup PimplGroup Pimpl #ifndef LOKI_INHERITED_PIMPL_NAME #define LOKI_INHERITED_PIMPL_NAME d @@ -28,170 +28,170 @@ namespace Loki { - ////////////////////////////////////////// - /// \class ConstPropPtr - /// - /// \ingroup PimplGroup - /// Simple const propagating smart pointer - /// Is the default smart pointer of Pimpl. - ////////////////////////////////////////// +////////////////////////////////////////// +/// \class ConstPropPtr +/// +/// \ingroup PimplGroup +/// Simple const propagating smart pointer +/// Is the default smart pointer of Pimpl. +////////////////////////////////////////// - template<class T> - struct ConstPropPtr +template<class T> +struct ConstPropPtr +{ + explicit ConstPropPtr(T* p) : ptr_(p) {} + ~ConstPropPtr() { delete ptr_; ptr_ = 0; } + T* operator->() { return ptr_; } + T& operator*() { return *ptr_; } + const T* operator->() const { return ptr_; } + const T& operator*() const { return *ptr_; } + +private: + ConstPropPtr(); + ConstPropPtr(const ConstPropPtr&); + ConstPropPtr& operator=(const ConstPropPtr&); + T* ptr_; +}; + + +//////////////////////////////////////////////////////////////////////////////// +/// \class Pimpl +/// +/// \ingroup PimplGroup +/// +/// Implements the Pimpl idiom. It's a wrapper for a smart pointer which +/// automatically creates and deletes the implementation object and adds +/// const propagation to the smart pointer. +/// +/// \par Usage +/// see test/Pimpl +//////////////////////////////////////////////////////////////////////////////// + +template +< +class T, + typename Pointer = ConstPropPtr<T> + > +class Pimpl +{ +public: + + typedef T Impl; + + Pimpl() : ptr_(new T) + {} + + ~Pimpl() { - explicit ConstPropPtr(T* p) : ptr_(p) {} - ~ConstPropPtr() { delete ptr_; ptr_ = 0; } - T* operator->() { return ptr_; } - T& operator*() { return *ptr_; } - const T* operator->() const { return ptr_; } - const T& operator*() const { return *ptr_; } - - private: - ConstPropPtr(); - ConstPropPtr(const ConstPropPtr&); - ConstPropPtr& operator=(const ConstPropPtr&); - T* ptr_; - }; + // Don't compile with incomplete type + // + // If compilation breaks here make sure + // the compiler does not auto-generate the + // destructor of the class hosting the pimpl: + // - implement the destructor of the class + // - don't inline the destructor + typedef char T_must_be_defined[sizeof(T) ? 1 : -1 ]; + } + + + T* operator->() + { + return ptr_.operator->(); + } + T& operator*() + { + return ptr_.operator*(); + } - //////////////////////////////////////////////////////////////////////////////// - /// \class Pimpl - /// - /// \ingroup PimplGroup - /// - /// Implements the Pimpl idiom. It's a wrapper for a smart pointer which - /// automatically creates and deletes the implementation object and adds - /// const propagation to the smart pointer. - /// - /// \par Usage - /// see test/Pimpl - //////////////////////////////////////////////////////////////////////////////// - - template - < - class T, - typename Pointer = ConstPropPtr<T> - > - class Pimpl + const T* operator->() const { - public: + return ptr_.operator->(); + } - typedef T Impl; + const T& operator*() const + { + return ptr_.operator*(); + } - Pimpl() : ptr_(new T) - {} + Pointer& wrapped() + { + return ptr_; + } - ~Pimpl() - { - // Don't compile with incomplete type - // - // If compilation breaks here make sure - // the compiler does not auto-generate the - // destructor of the class hosting the pimpl: - // - implement the destructor of the class - // - don't inline the destructor - typedef char T_must_be_defined[sizeof(T) ? 1 : -1 ]; - } - - - T* operator->() - { - return ptr_.operator->(); - } - - T& operator*() - { - return ptr_.operator*(); - } - - const T* operator->() const - { - return ptr_.operator->(); - } - - const T& operator*() const - { - return ptr_.operator*(); - } - - Pointer& wrapped() - { - return ptr_; - } - - const Pointer& wrapped() const - { - return ptr_; - } - - - private: - Pimpl(const Pimpl&); - Pimpl& operator=(const Pimpl&); - - Pointer ptr_; - }; + const Pointer& wrapped() const + { + return ptr_; + } - template<class T, typename Pointer = ConstPropPtr<T> > - struct PimplOwner - { - Pimpl<T,Pointer> LOKI_INHERITED_PIMPL_NAME; - }; +private: + Pimpl(const Pimpl&); + Pimpl& operator=(const Pimpl&); + Pointer ptr_; +}; - ////////////////////////////////////////// - /// \class ImplOf - /// - /// \ingroup PimplGroup - /// Convenience template for the - /// implementations which Pimpl points to. - ////////////////////////////////////////// - template<class T> - struct ImplOf; +template<class T, typename Pointer = ConstPropPtr<T> > +struct PimplOwner +{ + Pimpl<T,Pointer> LOKI_INHERITED_PIMPL_NAME; +}; - ////////////////////////////////////////// - /// \class PImplOf - /// - /// \ingroup PimplGroup - /// Convenience template which uses ImplOf - /// as implementation structure - ////////////////////////////////////////// +////////////////////////////////////////// +/// \class ImplOf +/// +/// \ingroup PimplGroup +/// Convenience template for the +/// implementations which Pimpl points to. +////////////////////////////////////////// +template<class T> +struct ImplOf; - template<class T, template<class> class Ptr = ConstPropPtr> - struct PimplOf - { - typedef T Impl; - // declare pimpl - typedef Pimpl<ImplOf<T>, Ptr<ImplOf<T> > > Type; +////////////////////////////////////////// +/// \class PImplOf +/// +/// \ingroup PimplGroup +/// Convenience template which uses ImplOf +/// as implementation structure +////////////////////////////////////////// - // inherit pimpl - typedef PimplOwner<ImplOf<T>, Ptr<ImplOf<T> > > Owner; - }; +template<class T, template<class> class Ptr = ConstPropPtr> +struct PimplOf +{ + typedef T Impl; - template<class T, class UsedPimpl = typename PimplOf<T>::Type > - struct RimplOf - { - typedef typename UsedPimpl::Impl & Type; + // declare pimpl + typedef Pimpl<ImplOf<T>, Ptr<ImplOf<T> > > Type; - class Owner - { - UsedPimpl pimpl; + // inherit pimpl + typedef PimplOwner<ImplOf<T>, Ptr<ImplOf<T> > > Owner; +}; - public: - Owner() : LOKI_INHERITED_RIMPL_NAME(*pimpl) - {} - Type LOKI_INHERITED_RIMPL_NAME; - }; +template<class T, class UsedPimpl = typename PimplOf<T>::Type > +struct RimplOf +{ + typedef typename UsedPimpl::Impl& Type; + + class Owner + { + UsedPimpl pimpl; + + public: + Owner() : LOKI_INHERITED_RIMPL_NAME(*pimpl) + {} + Type LOKI_INHERITED_RIMPL_NAME; }; - + +}; + } #endif // end file guardian diff --git a/shared/loki/RefToValue.h b/shared/loki/RefToValue.h index 248de792..3f7ecfef 100644 --- a/shared/loki/RefToValue.h +++ b/shared/loki/RefToValue.h @@ -2,12 +2,12 @@ // The Loki Library // Copyright (c) 2006 Richard Sposato // Copyright (c) 2006 Peter Kümmel -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The authors make no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The authors make no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_REFTOVALUE_INC_ @@ -19,50 +19,50 @@ namespace Loki { - //////////////////////////////////////////////////////////////////////////////// - /// \class RefToValue - /// - /// \ingroup SmartPointerGroup - /// Transports a reference as a value - /// Serves to implement the Colvin/Gibbons trick for SmartPtr/ScopeGuard - //////////////////////////////////////////////////////////////////////////////// - - template <class T> - class RefToValue - { - public: - - RefToValue(T& ref) : ref_(ref) - {} - - RefToValue(const RefToValue& rhs) : ref_(rhs.ref_) - {} - - operator T& () const - { - return ref_; - } - - private: - // Disable - not implemented - RefToValue(); - RefToValue& operator=(const RefToValue&); - - T& ref_; - }; - - - //////////////////////////////////////////////////////////////////////////////// - /// \ingroup ExceptionGroup - /// RefToValue creator. - //////////////////////////////////////////////////////////////////////////////// - - template <class T> - inline RefToValue<T> ByRef(T& t) +//////////////////////////////////////////////////////////////////////////////// +/// \class RefToValue +/// +/// \ingroup SmartPointerGroup +/// Transports a reference as a value +/// Serves to implement the Colvin/Gibbons trick for SmartPtr/ScopeGuard +//////////////////////////////////////////////////////////////////////////////// + +template <class T> +class RefToValue +{ +public: + + RefToValue(T& ref) : ref_(ref) + {} + + RefToValue(const RefToValue& rhs) : ref_(rhs.ref_) + {} + + operator T& () const { - return RefToValue<T>(t); - } - + return ref_; + } + +private: + // Disable - not implemented + RefToValue(); + RefToValue& operator=(const RefToValue&); + + T& ref_; +}; + + +//////////////////////////////////////////////////////////////////////////////// +/// \ingroup ExceptionGroup +/// RefToValue creator. +//////////////////////////////////////////////////////////////////////////////// + +template <class T> +inline RefToValue<T> ByRef(T& t) +{ + return RefToValue<T>(t); +} + } diff --git a/shared/loki/Register.h b/shared/loki/Register.h index 0ad014ab..0edf4a37 100644 --- a/shared/loki/Register.h +++ b/shared/loki/Register.h @@ -1,12 +1,12 @@ //////////////////////////////////////////////////////////////////////////////// // The Loki Library // Copyright (c) 2006 Peter Kümmel -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author makes no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author makes no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_REGISTER_INC_ @@ -18,98 +18,98 @@ #include "TypeManip.h" #include "HierarchyGenerators.h" -/// \defgroup RegisterGroup Register +/// \defgroup RegisterGroup Register namespace Loki { - //////////////////////////////////////////////////////////////////////////////// - // - // Helper classes/functions for RegisterByCreateSet - // - //////////////////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////////////////// - /// \ingroup RegisterGroup - /// Must be specialized be the user - //////////////////////////////////////////////////////////////////////////////// - template<class t> bool RegisterFunction(); - - //////////////////////////////////////////////////////////////////////////////// - /// \ingroup RegisterGroup - /// Must be specialized be the user - //////////////////////////////////////////////////////////////////////////////// - template<class t> bool UnRegisterFunction(); - - namespace Private - { - template<class T> - struct RegisterOnCreate - { - RegisterOnCreate() { RegisterFunction<T>(); } - }; - - template<class T> - struct UnRegisterOnDelete - { - ~UnRegisterOnDelete() { UnRegisterFunction<T>(); } - }; - - template<class T> - struct RegisterOnCreateElement - { - RegisterOnCreate<T> registerObj; - }; - - template<class T> - struct UnRegisterOnDeleteElement - { - UnRegisterOnDelete<T> unregisterObj; - }; - } - - //////////////////////////////////////////////////////////////////////////////// - /// \class RegisterOnCreateSet - /// - /// \ingroup RegisterGroup - /// Implements a generic register class which registers classes of a typelist - /// - /// \par Usage - /// see test/Register - //////////////////////////////////////////////////////////////////////////////// - - template<typename ElementList> - struct RegisterOnCreateSet +//////////////////////////////////////////////////////////////////////////////// +// +// Helper classes/functions for RegisterByCreateSet +// +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// \ingroup RegisterGroup +/// Must be specialized be the user +//////////////////////////////////////////////////////////////////////////////// +template<class t> bool RegisterFunction(); + +//////////////////////////////////////////////////////////////////////////////// +/// \ingroup RegisterGroup +/// Must be specialized be the user +//////////////////////////////////////////////////////////////////////////////// +template<class t> bool UnRegisterFunction(); + +namespace Private +{ +template<class T> +struct RegisterOnCreate +{ + RegisterOnCreate() { RegisterFunction<T>(); } +}; + +template<class T> +struct UnRegisterOnDelete +{ + ~UnRegisterOnDelete() { UnRegisterFunction<T>(); } +}; + +template<class T> +struct RegisterOnCreateElement +{ + RegisterOnCreate<T> registerObj; +}; + +template<class T> +struct UnRegisterOnDeleteElement +{ + UnRegisterOnDelete<T> unregisterObj; +}; +} + +//////////////////////////////////////////////////////////////////////////////// +/// \class RegisterOnCreateSet +/// +/// \ingroup RegisterGroup +/// Implements a generic register class which registers classes of a typelist +/// +/// \par Usage +/// see test/Register +//////////////////////////////////////////////////////////////////////////////// + +template<typename ElementList> +struct RegisterOnCreateSet : GenScatterHierarchy<ElementList, Private::RegisterOnCreateElement> {}; - //////////////////////////////////////////////////////////////////////////////// - /// \class UnRegisterOnDeleteSet - /// - /// \ingroup RegisterGroup - /// Implements a generic register class which unregisters classes of a typelist - /// - /// \par Usage - /// see test/Register - //////////////////////////////////////////////////////////////////////////////// - template<typename ElementList> - struct UnRegisterOnDeleteSet +//////////////////////////////////////////////////////////////////////////////// +/// \class UnRegisterOnDeleteSet +/// +/// \ingroup RegisterGroup +/// Implements a generic register class which unregisters classes of a typelist +/// +/// \par Usage +/// see test/Register +//////////////////////////////////////////////////////////////////////////////// +template<typename ElementList> +struct UnRegisterOnDeleteSet : GenScatterHierarchy<ElementList, Private::UnRegisterOnDeleteElement> {}; - //////////////////////////////////////////////////////////////////////////////// - /// \def LOKI_CHECK_CLASS_IN_LIST( CLASS , LIST ) - /// - /// \ingroup RegisterGroup - /// Check if CLASS is in the typelist LIST. - /// - /// \par Usage - /// see test/Register - //////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +/// \def LOKI_CHECK_CLASS_IN_LIST( CLASS , LIST ) +/// +/// \ingroup RegisterGroup +/// Check if CLASS is in the typelist LIST. +/// +/// \par Usage +/// see test/Register +//////////////////////////////////////////////////////////////////////////////// + - -#define LOKI_CONCATE(a,b,c,d) a ## b ## c ## d +#define LOKI_CONCATE(a,b,c,d) a ## b ## c ## d #define LOKI_CONCAT(a,b,c,d) LOKI_CONCATE(a,b,c,d) #define LOKI_CHECK_CLASS_IN_LIST( CLASS , LIST ) \ diff --git a/shared/loki/SPCachedFactory.h b/shared/loki/SPCachedFactory.h index 71c72644..aab37127 100644 --- a/shared/loki/SPCachedFactory.h +++ b/shared/loki/SPCachedFactory.h @@ -4,16 +4,16 @@ // // Code covered by the MIT License // -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. // // The authors make no representations about the suitability of this software // for any purpose. It is provided "as is" without express or implied warranty. // // This code DOES NOT accompany the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. // //////////////////////////////////////////////////////////////////////////////// @@ -29,8 +29,8 @@ * It as been defined in a separate file because of the many introduced * dependencies (SmartPtr.h would depend on Functor.h and CachedFactory.h * would depend on SmartPtr.h). By defining another header you pay for those - * extra dependencies only if you need it. - * + * extra dependencies only if you need it. + * * This file defines FunctionStorage a new SmartPointer storage policy and * SmartPointer a new CachedFactory encapsulation policy. */ @@ -45,7 +45,7 @@ namespace Loki //////////////////////////////////////////////////////////////////////////////// /// \class FunctionStorage /// -/// \ingroup SmartPointerStorageGroup +/// \ingroup SmartPointerStorageGroup /// \brief Implementation of the StoragePolicy used by SmartPtr. /// /// This storage policy is used by SmartPointer CachedFactory's encapsulation @@ -58,146 +58,146 @@ namespace Loki /// the FunctionStorage template to know the full definition of the SmartPtr. //////////////////////////////////////////////////////////////////////////////// - template <class T> - class FunctionStorage +template <class T> +class FunctionStorage +{ +public: + /// the type of the pointee_ object + typedef T* StoredType; + /// type used to declare OwnershipPolicy type. + typedef T* InitPointerType; + /// type returned by operator-> + typedef T* PointerType; + /// type returned by operator* + typedef T& ReferenceType; + /// type of the Functor to set + typedef Functor< void , Seq< void* > > FunctorType; + + FunctionStorage() : pointee_(Default()), functor_() + {} + + // The storage policy doesn't initialize the stored pointer + // which will be initialized by the OwnershipPolicy's Clone fn + FunctionStorage(const FunctionStorage& rsh) : pointee_(0), functor_(rsh.functor_) + {} + + template <class U> + FunctionStorage(const FunctionStorage<U>& rsh) : pointee_(0), functor_(rsh.functor_) + {} + + FunctionStorage(const StoredType& p) : pointee_(p), functor_() {} + + PointerType operator->() const { return pointee_; } + + ReferenceType operator*() const { return *pointee_; } + + void Swap(FunctionStorage& rhs) + { + std::swap(pointee_, rhs.pointee_); + std::swap(functor_, rhs.functor_); + } + + /// Sets the callback function to call. You have to specify it or + /// the smartPtr will throw a bad_function_call exception. + void SetCallBackFunction(const FunctorType& functor) + { + functor_ = functor; + } + + // Accessors + template <class F> + friend typename FunctionStorage<F>::PointerType GetImpl(const FunctionStorage<F>& sp); + + template <class F> + friend const typename FunctionStorage<F>::StoredType& GetImplRef(const FunctionStorage<F>& sp); + + template <class F> + friend typename FunctionStorage<F>::StoredType& GetImplRef(FunctionStorage<F>& sp); + +protected: + // Destroys the data stored + // (Destruction might be taken over by the OwnershipPolicy) + void Destroy() + { + functor_(this); + } + + // Default value to initialize the pointer + static StoredType Default() + { return 0; } + +private: + // Data + StoredType pointee_; + FunctorType functor_; +}; + +template <class T> +inline typename FunctionStorage<T>::PointerType GetImpl(const FunctionStorage<T>& sp) +{ return sp.pointee_; } + +template <class T> +inline const typename FunctionStorage<T>::StoredType& GetImplRef(const FunctionStorage<T>& sp) +{ return sp.pointee_; } + +template <class T> +inline typename FunctionStorage<T>::StoredType& GetImplRef(FunctionStorage<T>& sp) +{ return sp.pointee_; } + +/** + * \class SmartPointer + * \ingroup EncapsulationPolicyCachedFactoryGroup + * \brief Encapsulate the object in a SmartPtr with FunctionStorage policy. + * + * The object will come back to the Cache as soon as no more SmartPtr are + * referencing this object. You can customize the SmartPointer with the standard + * SmartPtr policies (OwnershipPolicy, ConversionPolicy, CheckingPolicy, + * ConstnessPolicy) but StoragePolicy is forced to FunctionStorage. + */ +template +< +class AbstractProduct, + template <class> class OwnershipPolicy = RefCounted, + class ConversionPolicy = DisallowConversion, + template <class> class CheckingPolicy = AssertCheck, + template<class> class ConstnessPolicy = LOKI_DEFAULT_CONSTNESS + > +class SmartPointer +{ +private: + typedef SmartPtr< AbstractProduct,OwnershipPolicy, + ConversionPolicy, CheckingPolicy, + FunctionStorage, ConstnessPolicy > CallBackSP; +protected: + typedef CallBackSP ProductReturn; + SmartPointer() : fun(this, &SmartPointer::smartPointerCallbackFunction) {} + virtual ~SmartPointer() {} + + ProductReturn encapsulate(AbstractProduct* pProduct) + { + CallBackSP SP(pProduct); + SP.SetCallBackFunction(fun); + return SP; + } + + AbstractProduct* release(ProductReturn& pProduct) + { + return GetImpl(pProduct); + } + + const char* name() {return "smart pointer";} + +private: + SmartPointer& operator=(const SmartPointer&); + SmartPointer(const SmartPointer&); + void smartPointerCallbackFunction(void* pSP) { - public: - /// the type of the pointee_ object - typedef T* StoredType; - /// type used to declare OwnershipPolicy type. - typedef T* InitPointerType; - /// type returned by operator-> - typedef T* PointerType; - /// type returned by operator* - typedef T& ReferenceType; - /// type of the Functor to set - typedef Functor< void , Seq< void* > > FunctorType; - - FunctionStorage() : pointee_(Default()), functor_() - {} - - // The storage policy doesn't initialize the stored pointer - // which will be initialized by the OwnershipPolicy's Clone fn - FunctionStorage(const FunctionStorage& rsh) : pointee_(0), functor_(rsh.functor_) - {} - - template <class U> - FunctionStorage(const FunctionStorage<U>& rsh) : pointee_(0), functor_(rsh.functor_) - {} - - FunctionStorage(const StoredType& p) : pointee_(p), functor_() {} - - PointerType operator->() const { return pointee_; } - - ReferenceType operator*() const { return *pointee_; } - - void Swap(FunctionStorage& rhs) - { - std::swap(pointee_, rhs.pointee_); - std::swap(functor_, rhs.functor_); - } - - /// Sets the callback function to call. You have to specify it or - /// the smartPtr will throw a bad_function_call exception. - void SetCallBackFunction(const FunctorType &functor) - { - functor_ = functor; - } - - // Accessors - template <class F> - friend typename FunctionStorage<F>::PointerType GetImpl(const FunctionStorage<F>& sp); - - template <class F> - friend const typename FunctionStorage<F>::StoredType& GetImplRef(const FunctionStorage<F>& sp); - - template <class F> - friend typename FunctionStorage<F>::StoredType& GetImplRef(FunctionStorage<F>& sp); - - protected: - // Destroys the data stored - // (Destruction might be taken over by the OwnershipPolicy) - void Destroy() - { - functor_(this); - } - - // Default value to initialize the pointer - static StoredType Default() - { return 0; } - - private: - // Data - StoredType pointee_; - FunctorType functor_; - }; - - template <class T> - inline typename FunctionStorage<T>::PointerType GetImpl(const FunctionStorage<T>& sp) - { return sp.pointee_; } - - template <class T> - inline const typename FunctionStorage<T>::StoredType& GetImplRef(const FunctionStorage<T>& sp) - { return sp.pointee_; } - - template <class T> - inline typename FunctionStorage<T>::StoredType& GetImplRef(FunctionStorage<T>& sp) - { return sp.pointee_; } - - /** - * \class SmartPointer - * \ingroup EncapsulationPolicyCachedFactoryGroup - * \brief Encapsulate the object in a SmartPtr with FunctionStorage policy. - * - * The object will come back to the Cache as soon as no more SmartPtr are - * referencing this object. You can customize the SmartPointer with the standard - * SmartPtr policies (OwnershipPolicy, ConversionPolicy, CheckingPolicy, - * ConstnessPolicy) but StoragePolicy is forced to FunctionStorage. - */ - template - < - class AbstractProduct, - template <class> class OwnershipPolicy = RefCounted, - class ConversionPolicy = DisallowConversion, - template <class> class CheckingPolicy = AssertCheck, - template<class> class ConstnessPolicy = LOKI_DEFAULT_CONSTNESS - > - class SmartPointer - { - private: - typedef SmartPtr< AbstractProduct,OwnershipPolicy, - ConversionPolicy, CheckingPolicy, - FunctionStorage, ConstnessPolicy > CallBackSP; - protected: - typedef CallBackSP ProductReturn; - SmartPointer() : fun(this, &SmartPointer::smartPointerCallbackFunction) {} - virtual ~SmartPointer(){} - - ProductReturn encapsulate(AbstractProduct* pProduct) - { - CallBackSP SP(pProduct); - SP.SetCallBackFunction(fun); - return SP; - } - - AbstractProduct* release(ProductReturn &pProduct) - { - return GetImpl(pProduct); - } - - const char* name(){return "smart pointer";} - - private: - SmartPointer& operator=(const SmartPointer&); - SmartPointer(const SmartPointer&); - void smartPointerCallbackFunction(void* pSP) - { - CallBackSP &SP(*reinterpret_cast<CallBackSP*>(pSP)); - ReleaseObject(SP); - } - virtual void ReleaseObject(ProductReturn &object)=0; - const typename CallBackSP::FunctorType fun; - }; + CallBackSP& SP(*reinterpret_cast<CallBackSP*>(pSP)); + ReleaseObject(SP); + } + virtual void ReleaseObject(ProductReturn& object)=0; + const typename CallBackSP::FunctorType fun; +}; } // namespace Loki diff --git a/shared/loki/SafeBits.h b/shared/loki/SafeBits.h index f45065ed..4105f375 100644 --- a/shared/loki/SafeBits.h +++ b/shared/loki/SafeBits.h @@ -102,7 +102,7 @@ namespace Loki /// the template one. The only downside is that instead of compile-time checking /// of the index argument, it does runtime checking. #if defined(__SUNPRO_CC) || ( defined(__GNUC__) && (__GNUC__ < 3) ) - #define LOKI_BIT_FIELD_NONTEMPLATE_INIT +#define LOKI_BIT_FIELD_NONTEMPLATE_INIT #endif /// @par Forbidding Conversions. @@ -118,9 +118,9 @@ template < typename > struct Forbidden_conversion; // This struct must not be d /// Forward declaration of the field type. template < - unsigned int unique_index, - typename word_t = unsigned long -> class SafeBitField; +unsigned int unique_index, + typename word_t = unsigned long + > class SafeBitField; //////////////////////////////////////////////////////////////////////////////// /// \class SafeBitConst Bit constants. @@ -141,9 +141,9 @@ template < template < - unsigned int unique_index, - typename word_t = unsigned long -> +unsigned int unique_index, + typename word_t = unsigned long + > class SafeBitConst { public: @@ -193,32 +193,32 @@ public: SafeBitConst( const SafeBitConst& rhs ) : word( rhs.word ) {} /// Comparison operators which take a constant bit value. - bool operator == ( const SafeBitConst & rhs ) const { return word == rhs.word; } - bool operator != ( const SafeBitConst & rhs ) const { return word != rhs.word; } - bool operator < ( const SafeBitConst & rhs ) const { return word < rhs.word; } - bool operator > ( const SafeBitConst & rhs ) const { return word > rhs.word; } - bool operator <= ( const SafeBitConst & rhs ) const { return word <= rhs.word; } - bool operator >= ( const SafeBitConst & rhs ) const { return word >= rhs.word; } + bool operator == ( const SafeBitConst& rhs ) const { return word == rhs.word; } + bool operator != ( const SafeBitConst& rhs ) const { return word != rhs.word; } + bool operator < ( const SafeBitConst& rhs ) const { return word < rhs.word; } + bool operator > ( const SafeBitConst& rhs ) const { return word > rhs.word; } + bool operator <= ( const SafeBitConst& rhs ) const { return word <= rhs.word; } + bool operator >= ( const SafeBitConst& rhs ) const { return word >= rhs.word; } /// Comparision operators for mutable bit fields. - bool operator == ( const field_t & rhs ) const { return word == rhs.word; } - bool operator != ( const field_t & rhs ) const { return word != rhs.word; } - bool operator < ( const field_t & rhs ) const { return word < rhs.word; } - bool operator > ( const field_t & rhs ) const { return word > rhs.word; } - bool operator <= ( const field_t & rhs ) const { return word <= rhs.word; } - bool operator >= ( const field_t & rhs ) const { return word >= rhs.word; } + bool operator == ( const field_t& rhs ) const { return word == rhs.word; } + bool operator != ( const field_t& rhs ) const { return word != rhs.word; } + bool operator < ( const field_t& rhs ) const { return word < rhs.word; } + bool operator > ( const field_t& rhs ) const { return word > rhs.word; } + bool operator <= ( const field_t& rhs ) const { return word <= rhs.word; } + bool operator >= ( const field_t& rhs ) const { return word >= rhs.word; } /// Bitwise operations. Operation-assignment operators are not needed, /// since bit constants cannot be changed after they are initialized. - const SafeBitConst operator | ( const SafeBitConst & rhs ) const { return SafeBitConst( word | rhs.word ); } - const SafeBitConst operator & ( const SafeBitConst & rhs ) const { return SafeBitConst( word & rhs.word ); } - const SafeBitConst operator ^ ( const SafeBitConst & rhs ) const { return SafeBitConst( word ^ rhs.word ); } + const SafeBitConst operator | ( const SafeBitConst& rhs ) const { return SafeBitConst( word | rhs.word ); } + const SafeBitConst operator & ( const SafeBitConst& rhs ) const { return SafeBitConst( word & rhs.word ); } + const SafeBitConst operator ^ ( const SafeBitConst& rhs ) const { return SafeBitConst( word ^ rhs.word ); } const SafeBitConst operator ~ ( void ) const { return SafeBitConst( ~word ); } /// These bitwise operators return a bit-field instead of a bit-const. - field_t operator | ( const field_t & rhs ) const { return field_t( word | rhs.word ); } - field_t operator & ( const field_t & rhs ) const { return field_t( word & rhs.word ); } - field_t operator ^ ( const field_t & rhs ) const { return field_t( word ^ rhs.word ); } + field_t operator | ( const field_t& rhs ) const { return field_t( word | rhs.word ); } + field_t operator & ( const field_t& rhs ) const { return field_t( word & rhs.word ); } + field_t operator ^ ( const field_t& rhs ) const { return field_t( word ^ rhs.word ); } /// The shift operators move bits inside the bit field. These are useful in /// loops which act over bit fields and increment them. @@ -232,7 +232,7 @@ private: /// Copy-assignment operator is not implemented since it does not make sense /// for a constant object. - SafeBitConst operator = ( const SafeBitConst & rhs ); + SafeBitConst operator = ( const SafeBitConst& rhs ); // Private constructor from an integer type. explicit SafeBitConst( word_t init ) : word( init ) {} @@ -287,9 +287,9 @@ private: template < - unsigned int unique_index, - typename word_t -> +unsigned int unique_index, + typename word_t + > class SafeBitField { public: @@ -305,37 +305,37 @@ public: SafeBitField() : word( 0 ) {} /// Copy constructor and assignment operators. - SafeBitField( const SafeBitField & rhs ) : word( rhs.word ) {} - SafeBitField & operator = ( const SafeBitField & rhs ) { word = rhs.word; return *this; } + SafeBitField( const SafeBitField& rhs ) : word( rhs.word ) {} + SafeBitField& operator = ( const SafeBitField& rhs ) { word = rhs.word; return *this; } /// Copy constructor and assignment operators from constant bit fields. - SafeBitField( const const_t & rhs ) : word( rhs.word ) {} - SafeBitField & operator = ( const const_t & rhs ) { word = rhs.word; return *this; } + SafeBitField( const const_t& rhs ) : word( rhs.word ) {} + SafeBitField& operator = ( const const_t& rhs ) { word = rhs.word; return *this; } /// These comparison operators act on bit-fields of the same type. - bool operator == ( const SafeBitField & rhs ) const { return word == rhs.word; } - bool operator != ( const SafeBitField & rhs ) const { return word != rhs.word; } - bool operator < ( const SafeBitField & rhs ) const { return word < rhs.word; } - bool operator > ( const SafeBitField & rhs ) const { return word > rhs.word; } - bool operator <= ( const SafeBitField & rhs ) const { return word <= rhs.word; } - bool operator >= ( const SafeBitField & rhs ) const { return word >= rhs.word; } + bool operator == ( const SafeBitField& rhs ) const { return word == rhs.word; } + bool operator != ( const SafeBitField& rhs ) const { return word != rhs.word; } + bool operator < ( const SafeBitField& rhs ) const { return word < rhs.word; } + bool operator > ( const SafeBitField& rhs ) const { return word > rhs.word; } + bool operator <= ( const SafeBitField& rhs ) const { return word <= rhs.word; } + bool operator >= ( const SafeBitField& rhs ) const { return word >= rhs.word; } /// These comparison operators act on bit-constants of a similar type. - bool operator == ( const const_t & rhs ) const { return word == rhs.word; } - bool operator != ( const const_t & rhs ) const { return word != rhs.word; } - bool operator < ( const const_t & rhs ) const { return word < rhs.word; } - bool operator > ( const const_t & rhs ) const { return word > rhs.word; } - bool operator <= ( const const_t & rhs ) const { return word <= rhs.word; } - bool operator >= ( const const_t & rhs ) const { return word >= rhs.word; } + bool operator == ( const const_t& rhs ) const { return word == rhs.word; } + bool operator != ( const const_t& rhs ) const { return word != rhs.word; } + bool operator < ( const const_t& rhs ) const { return word < rhs.word; } + bool operator > ( const const_t& rhs ) const { return word > rhs.word; } + bool operator <= ( const const_t& rhs ) const { return word <= rhs.word; } + bool operator >= ( const const_t& rhs ) const { return word >= rhs.word; } /// Bitwise operations that use bit-fields. - SafeBitField operator | ( const SafeBitField & rhs ) const { return SafeBitField( word | rhs.word ); } - SafeBitField operator & ( const SafeBitField & rhs ) const { return SafeBitField( word & rhs.word ); } - SafeBitField operator ^ ( const SafeBitField & rhs ) const { return SafeBitField( word ^ rhs.word ); } + SafeBitField operator | ( const SafeBitField& rhs ) const { return SafeBitField( word | rhs.word ); } + SafeBitField operator & ( const SafeBitField& rhs ) const { return SafeBitField( word & rhs.word ); } + SafeBitField operator ^ ( const SafeBitField& rhs ) const { return SafeBitField( word ^ rhs.word ); } SafeBitField operator ~ ( void ) const { return SafeBitField( ~word ); } - SafeBitField operator |= ( const SafeBitField & rhs ) { word |= rhs.word; return SafeBitField( *this ); } - SafeBitField operator &= ( const SafeBitField & rhs ) { word &= rhs.word; return SafeBitField( *this ); } - SafeBitField operator ^= ( const SafeBitField & rhs ) { word ^= rhs.word; return SafeBitField( *this ); } + SafeBitField operator |= ( const SafeBitField& rhs ) { word |= rhs.word; return SafeBitField( *this ); } + SafeBitField operator &= ( const SafeBitField& rhs ) { word &= rhs.word; return SafeBitField( *this ); } + SafeBitField operator ^= ( const SafeBitField& rhs ) { word ^= rhs.word; return SafeBitField( *this ); } /// Bitwise operators that use bit-constants. SafeBitField operator | ( const_t rhs ) const { return SafeBitField( word | rhs.word ); } @@ -471,42 +471,42 @@ inline SafeBitField< unique_index, word_t > operator != ( bool, SafeBitField< un // This creates a typedef field_t for SafeBitField<unique_index, ulong> where index is the current line number. Since line numbers __LINE__ are counted // separately for all header files, this ends up being the same type in all files using the header which defines field_t. #ifdef LOKI_SAFE_BIT_FIELD - #define LOKI_BIT_FIELD( word_t ) typedef SafeBitField<__LINE__, word_t> +#define LOKI_BIT_FIELD( word_t ) typedef SafeBitField<__LINE__, word_t> #else - #define LOKI_BIT_FIELD( word_t ) typedef word_t +#define LOKI_BIT_FIELD( word_t ) typedef word_t #endif // LOKI_SAFE_BIT_FIELD // The second macro helps to declare static bit constants: // LOKI_BIT_CONST( field_t, Label_1, 1 ); // creates new bit field object named Label_1 of type field_t which represents the field with the 1st (junior) bit set. #ifdef LOKI_SAFE_BIT_FIELD - #ifndef LOKI_BIT_FIELD_NONTEMPLATE_INIT - #define LOKI_BIT_CONST( field_t, label, bit_index ) \ +#ifndef LOKI_BIT_FIELD_NONTEMPLATE_INIT +#define LOKI_BIT_CONST( field_t, label, bit_index ) \ static const field_t::const_t label = field_t::const_t::make_bit_const<bit_index>() - #else - #define LOKI_BIT_CONST( field_t, label, bit_index ) \ +#else +#define LOKI_BIT_CONST( field_t, label, bit_index ) \ static const field_t::const_t label = field_t::const_t::make_bit_const( bit_index ) - #endif // LOKI_BIT_FIELD_NONTEMPLATE_INIT +#endif // LOKI_BIT_FIELD_NONTEMPLATE_INIT #else - inline size_t make_bit_const( size_t i ) { return ( i > 0 ) ? ( size_t(1) << ( ( i > 0 ) ? ( i - 1 ) : 0 ) ) : 0; } - #define LOKI_BIT_CONST( field_t, label, bit_index ) static const field_t label = make_bit_const( bit_index ) +inline size_t make_bit_const( size_t i ) { return ( i > 0 ) ? ( size_t(1) << ( ( i > 0 ) ? ( i - 1 ) : 0 ) ) : 0; } +#define LOKI_BIT_CONST( field_t, label, bit_index ) static const field_t label = make_bit_const( bit_index ) #endif // LOKI_SAFE_BIT_FIELD // The third macro helps to declare complex bit constants which are combination of several bits: // LOKI_BIT_CONSTS( field_t, Label12 ) = Label_1 | Label_2; #ifdef LOKI_SAFE_BIT_FIELD - #define LOKI_BIT_CONSTS( field_t, label ) static const field_t::const_t label +#define LOKI_BIT_CONSTS( field_t, label ) static const field_t::const_t label #else - #define LOKI_BIT_CONSTS( field_t, label ) static const field_t label +#define LOKI_BIT_CONSTS( field_t, label ) static const field_t label #endif // LOKI_SAFE_BIT_FIELD // The fourth macro helps to declare the maximum number of bit constants for a given type: // static const size_t count = LOKI_BIT_FIELD_COUNT( field_t ); // declared a variable "count" initialized to field_t::size() #ifdef LOKI_SAFE_BIT_FIELD - #define LOKI_BIT_FIELD_COUNT( field_t ) field_t::size() +#define LOKI_BIT_FIELD_COUNT( field_t ) field_t::size() #else - #define LOKI_BIT_FIELD_COUNT( field_t ) ( 8 * sizeof(field_t) ) +#define LOKI_BIT_FIELD_COUNT( field_t ) ( 8 * sizeof(field_t) ) #endif // LOKI_SAFE_BIT_FIELD } // namespace Loki diff --git a/shared/loki/SafeFormat.h b/shared/loki/SafeFormat.h index 9d948581..2734e972 100644 --- a/shared/loki/SafeFormat.h +++ b/shared/loki/SafeFormat.h @@ -5,8 +5,8 @@ // purpose is hereby granted without fee, provided that the above copyright // notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author makes no representations about the suitability of this software -// for any purpose. It is provided "as is" without express or implied +// The author makes no representations about the suitability of this software +// for any purpose. It is provided "as is" without express or implied // warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_SAFEFORMAT_INC_ @@ -16,8 +16,8 @@ //////////////////////////////////////////////////////////////////////////////// -// This file contains definitions for SafePrintf. SafeScanf coming soon (the -// design is similar). +// This file contains definitions for SafePrintf. SafeScanf coming soon (the +// design is similar). // See Alexandrescu, Andrei: Type-safe Formatting, C/C++ Users Journal, Aug 2005 //////////////////////////////////////////////////////////////////////////////// @@ -45,328 +45,375 @@ #endif // Windows headers could have min/max defined -#ifdef max -# undef max -#endif -#ifdef min -# undef min -#endif +#ifdef max +# undef max +#endif +#ifdef min +# undef min +#endif namespace Loki { - // Crude writing method: writes straight to the file, unbuffered - // Must be combined with a buffer to work properly (and efficiently) - LOKI_EXPORT - void write(std::FILE* f, const char* from, const char* to); - - // Write to an ostream - LOKI_EXPORT - void write(std::ostream& f, const char* from, const char* to); - - // Write to a string - LOKI_EXPORT - void write(std::string& s, const char* from, const char* to); - - // Write to a fixed-size buffer - template <class Char> - void write(std::pair<Char*, std::size_t>& s, const Char* from, const Char* to) { - assert(from <= to); - if(from + s.second < to) - throw std::overflow_error(""); - // s.first: position one past the final copied element - s.first = std::copy(from, to, s.first); - // remaining buffer size - s.second -= to - from; +// Crude writing method: writes straight to the file, unbuffered +// Must be combined with a buffer to work properly (and efficiently) +LOKI_EXPORT +void write(std::FILE* f, const char* from, const char* to); + +// Write to an ostream +LOKI_EXPORT +void write(std::ostream& f, const char* from, const char* to); + +// Write to a string +LOKI_EXPORT +void write(std::string& s, const char* from, const char* to); + +// Write to a fixed-size buffer +template <class Char> +void write(std::pair<Char*, std::size_t>& s, const Char* from, const Char* to) +{ + assert(from <= to); + if(from + s.second < to) + throw std::overflow_error(""); + // s.first: position one past the final copied element + s.first = std::copy(from, to, s.first); + // remaining buffer size + s.second -= to - from; +} + +//////////////////////////////////////////////////////////////////////////////// +// PrintfState class template +// Holds the formatting state, and implements operator() to format stuff +// Todo: make sure errors are handled properly +//////////////////////////////////////////////////////////////////////////////// + +template <class Device, class Char> +struct PrintfState +{ + PrintfState(Device dev, const Char* format) + : device_(dev) + , format_(format) + , width_(0) + , prec_(0) + , flags_(0) + , result_(0) + { + Advance(); } - //////////////////////////////////////////////////////////////////////////////// - // PrintfState class template - // Holds the formatting state, and implements operator() to format stuff - // Todo: make sure errors are handled properly - //////////////////////////////////////////////////////////////////////////////// - - template <class Device, class Char> - struct PrintfState { - PrintfState(Device dev, const Char * format) - : device_(dev) - , format_(format) - , width_(0) - , prec_(0) - , flags_(0) - , result_(0) { - Advance(); - } - - ~PrintfState() { - } + ~PrintfState() + { + } - #define LOKI_PRINTF_STATE_FORWARD(type) \ +#define LOKI_PRINTF_STATE_FORWARD(type) \ PrintfState& operator()(type par) {\ return (*this)(static_cast< LOKI_SAFEFORMAT_UNSIGNED_LONG >(par)); \ } - LOKI_PRINTF_STATE_FORWARD(bool) - LOKI_PRINTF_STATE_FORWARD(char) - LOKI_PRINTF_STATE_FORWARD(signed char) - LOKI_PRINTF_STATE_FORWARD(unsigned char) - LOKI_PRINTF_STATE_FORWARD(signed short) - LOKI_PRINTF_STATE_FORWARD(unsigned short) - LOKI_PRINTF_STATE_FORWARD(signed int) - LOKI_PRINTF_STATE_FORWARD(signed long) + LOKI_PRINTF_STATE_FORWARD(bool) + LOKI_PRINTF_STATE_FORWARD(char) + LOKI_PRINTF_STATE_FORWARD(signed char) + LOKI_PRINTF_STATE_FORWARD(unsigned char) + LOKI_PRINTF_STATE_FORWARD(signed short) + LOKI_PRINTF_STATE_FORWARD(unsigned short) + LOKI_PRINTF_STATE_FORWARD(signed int) + LOKI_PRINTF_STATE_FORWARD(signed long) #if (defined(_WIN32) || defined(_WIN64)) - LOKI_PRINTF_STATE_FORWARD(unsigned long) + LOKI_PRINTF_STATE_FORWARD(unsigned long) #else - // on Windows already defined by uintptr_t - LOKI_PRINTF_STATE_FORWARD(unsigned int) + // on Windows already defined by uintptr_t + LOKI_PRINTF_STATE_FORWARD(unsigned int) #endif - // Print (or gobble in case of the "*" specifier) an int - PrintfState& operator()(LOKI_SAFEFORMAT_UNSIGNED_LONG i) { - if (result_ == -1) return *this; // don't even bother - // % [flags] [width] [.prec] [modifier] type_char - // Fetch the flags - ReadFlags(); - if (*format_ == '*') { - // read the width and get out - SetWidth(static_cast<size_t>(i)); - ++format_; + // Print (or gobble in case of the "*" specifier) an int + PrintfState& operator()(LOKI_SAFEFORMAT_UNSIGNED_LONG i) + { + if (result_ == -1) return *this; // don't even bother + // % [flags] [width] [.prec] [modifier] type_char + // Fetch the flags + ReadFlags(); + if (*format_ == '*') + { + // read the width and get out + SetWidth(static_cast<size_t>(i)); + ++format_; + return *this; + } + ReadWidth(); + // precision + if (*format_ == '.') + { + // deal with precision + if (format_[1] == '*') + { + // read the precision and get out + SetPrec(static_cast<size_t>(i)); + format_ += 2; return *this; } - ReadWidth(); - // precision - if (*format_ == '.') { - // deal with precision - if (format_[1] == '*') { - // read the precision and get out - SetPrec(static_cast<size_t>(i)); - format_ += 2; - return *this; - } - ReadPrecision(); - } - ReadModifiers(); - // input size modifier - if (ForceShort()) { - // short int - const Char c = *format_; - if (c == 'x' || c == 'X' || c == 'u' || c == 'o') { - i = static_cast<LOKI_SAFEFORMAT_UNSIGNED_LONG>(static_cast<unsigned short>(i)); - } + ReadPrecision(); + } + ReadModifiers(); + // input size modifier + if (ForceShort()) + { + // short int + const Char c = *format_; + if (c == 'x' || c == 'X' || c == 'u' || c == 'o') + { + i = static_cast<LOKI_SAFEFORMAT_UNSIGNED_LONG>(static_cast<unsigned short>(i)); } - FormatWithCurrentFlags(i); - return *this; } + FormatWithCurrentFlags(i); + return *this; + } - PrintfState& operator()(void* n) { - if (result_ == -1) return *this; // don't even bother - PrintUsing_snprintf(n,"p"); - return *this; - } - - PrintfState& operator()(double n) { - if (result_ == -1) return *this; // don't even bother - PrintUsing_snprintf(n,"eEfgG"); - return *this; - } + PrintfState& operator()(void* n) + { + if (result_ == -1) return *this; // don't even bother + PrintUsing_snprintf(n,"p"); + return *this; + } - PrintfState& operator()(long double n) { - if (result_ == -1) return *this; // don't even bother - PrintUsing_snprintf(n,"eEfgG"); - return *this; - } + PrintfState& operator()(double n) + { + if (result_ == -1) return *this; // don't even bother + PrintUsing_snprintf(n,"eEfgG"); + return *this; + } - // Store the number of characters printed so far - PrintfState& operator()(int * pi) { - return StoreCountHelper(pi); - } - - // Store the number of characters printed so far - PrintfState& operator()(short * pi) { - return StoreCountHelper(pi); - } - - // Store the number of characters printed so far - PrintfState& operator()(long * pi) { - return StoreCountHelper(pi); + PrintfState& operator()(long double n) + { + if (result_ == -1) return *this; // don't even bother + PrintUsing_snprintf(n,"eEfgG"); + return *this; + } + + // Store the number of characters printed so far + PrintfState& operator()(int* pi) + { + return StoreCountHelper(pi); + } + + // Store the number of characters printed so far + PrintfState& operator()(short* pi) + { + return StoreCountHelper(pi); + } + + // Store the number of characters printed so far + PrintfState& operator()(long* pi) + { + return StoreCountHelper(pi); + } + + PrintfState& operator()(const std::string& stdstr) + { + return operator()(stdstr.c_str()); + } + + PrintfState& operator()(const char* const s) + { + if (result_ == -1) return *this; + ReadLeaders(); + const char fmt = *format_; + if (fmt == 'p') + { + FormatWithCurrentFlags(reinterpret_cast<LOKI_SAFEFORMAT_UNSIGNED_LONG>(s)); + return *this; } - - PrintfState& operator()(const std::string& stdstr) { - return operator()(stdstr.c_str()); + if (fmt != 's') + { + result_ = -1; + return *this; } - - PrintfState& operator()(const char *const s) { - if (result_ == -1) return *this; - ReadLeaders(); - const char fmt = *format_; - if (fmt == 'p') { - FormatWithCurrentFlags(reinterpret_cast<LOKI_SAFEFORMAT_UNSIGNED_LONG>(s)); - return *this; - } - if (fmt != 's') { - result_ = -1; - return *this; + const size_t len = std::min(std::strlen(s), prec_); + if (width_ > len) + { + if (LeftJustify()) + { + Write(s, s + len); + Fill(' ', width_ - len); } - const size_t len = std::min(std::strlen(s), prec_); - if (width_ > len) { - if (LeftJustify()) { - Write(s, s + len); - Fill(' ', width_ - len); - } else { - Fill(' ', width_ - len); - Write(s, s + len); - } - } else { + else + { + Fill(' ', width_ - len); Write(s, s + len); } - Next(); - return *this; } - - PrintfState& operator()(const void *const p) { - return (*this)(reinterpret_cast<LOKI_SAFEFORMAT_UNSIGNED_LONG>(p)); + else + { + Write(s, s + len); } - - // read the result - operator int() const { - return static_cast<int>(result_); + Next(); + return *this; + } + + PrintfState& operator()(const void* const p) + { + return (*this)(reinterpret_cast<LOKI_SAFEFORMAT_UNSIGNED_LONG>(p)); + } + + // read the result + operator int() const + { + return static_cast<int>(result_); + } + +private: + PrintfState& operator=(const PrintfState&); + template <typename T> + PrintfState& StoreCountHelper(T* const pi) + { + if (result_ == -1) return *this; // don't even bother + ReadLeaders(); + const char fmt = *format_; + if (fmt == 'p') // pointer + { + FormatWithCurrentFlags(reinterpret_cast<LOKI_SAFEFORMAT_UNSIGNED_LONG>(pi)); + return *this; } - - private: - PrintfState& operator=(const PrintfState&); - template <typename T> - PrintfState& StoreCountHelper(T *const pi) { - if (result_ == -1) return *this; // don't even bother - ReadLeaders(); - const char fmt = *format_; - if (fmt == 'p') { // pointer - FormatWithCurrentFlags(reinterpret_cast<LOKI_SAFEFORMAT_UNSIGNED_LONG>(pi)); - return *this; - } - if (fmt != 'n') { - result_ = -1; - return *this; - } - assert(pi != 0); - *pi = result_; - Next(); + if (fmt != 'n') + { + result_ = -1; return *this; } + assert(pi != 0); + *pi = result_; + Next(); + return *this; + } - void FormatWithCurrentFlags(const LOKI_SAFEFORMAT_UNSIGNED_LONG i) { - // look at the format character - Char formatChar = *format_; - bool isSigned = formatChar == 'd' || formatChar == 'i'; - if (formatChar == 'p') { - formatChar = 'x'; // pointers go to hex - SetAlternateForm(); // printed with '0x' in front - isSigned = true; // that's what gcc does - } - if (!strchr("cdiuoxX", formatChar)) { - result_ = -1; - return; - } - Char buf[ - sizeof(LOKI_SAFEFORMAT_UNSIGNED_LONG) * 3 // digits - + 1 // sign or ' ' - + 2 // 0x or 0X - + 1]; // terminating zero - const Char *const bufEnd = buf + (sizeof(buf) / sizeof(Char)); - Char * bufLast = buf + (sizeof(buf) / sizeof(Char) - 1); - Char signChar = 0; - unsigned int base = 10; - - if (formatChar == 'c') { - // Format only one character - // The 'fill with zeros' flag is ignored - ResetFillZeros(); - *bufLast = static_cast<char>(i); - } else { - // TODO: inefficient code, refactor - const bool negative = isSigned && static_cast<LOKI_SAFEFORMAT_SIGNED_LONG>(i) < 0; - if (formatChar == 'o') base = 8; - else if (formatChar == 'x' || formatChar == 'X') base = 16; - bufLast = isSigned - ? RenderWithoutSign(static_cast<LOKI_SAFEFORMAT_SIGNED_LONG>(i), bufLast, base, - formatChar == 'X') - : RenderWithoutSign(i, bufLast, base, - formatChar == 'X'); - // Add the sign - if (isSigned) { - negative ? signChar = '-' - : ShowSignAlways() ? signChar = '+' - : Blank() ? signChar = ' ' - : 0; - } - } - // precision - size_t - countDigits = bufEnd - bufLast, - countZeros = prec_ != size_t(-1) && countDigits < prec_ && - formatChar != 'c' - ? prec_ - countDigits - : 0, - countBase = base != 10 && AlternateForm() && i != 0 - ? (base == 16 ? 2 : countZeros > 0 ? 0 : 1) - : 0, - countSign = (signChar != 0), - totalPrintable = countDigits + countZeros + countBase + countSign; - size_t countPadLeft = 0, countPadRight = 0; - if (width_ > totalPrintable) { - if (LeftJustify()) { - countPadRight = width_ - totalPrintable; - countPadLeft = 0; - } else { - countPadLeft = width_ - totalPrintable; - countPadRight = 0; - } + void FormatWithCurrentFlags(const LOKI_SAFEFORMAT_UNSIGNED_LONG i) + { + // look at the format character + Char formatChar = *format_; + bool isSigned = formatChar == 'd' || formatChar == 'i'; + if (formatChar == 'p') + { + formatChar = 'x'; // pointers go to hex + SetAlternateForm(); // printed with '0x' in front + isSigned = true; // that's what gcc does + } + if (!strchr("cdiuoxX", formatChar)) + { + result_ = -1; + return; + } + Char buf[ + sizeof(LOKI_SAFEFORMAT_UNSIGNED_LONG) * 3 // digits + + 1 // sign or ' ' + + 2 // 0x or 0X + + 1]; // terminating zero + const Char* const bufEnd = buf + (sizeof(buf) / sizeof(Char)); + Char* bufLast = buf + (sizeof(buf) / sizeof(Char) - 1); + Char signChar = 0; + unsigned int base = 10; + + if (formatChar == 'c') + { + // Format only one character + // The 'fill with zeros' flag is ignored + ResetFillZeros(); + *bufLast = static_cast<char>(i); + } + else + { + // TODO: inefficient code, refactor + const bool negative = isSigned && static_cast<LOKI_SAFEFORMAT_SIGNED_LONG>(i) < 0; + if (formatChar == 'o') base = 8; + else if (formatChar == 'x' || formatChar == 'X') base = 16; + bufLast = isSigned + ? RenderWithoutSign(static_cast<LOKI_SAFEFORMAT_SIGNED_LONG>(i), bufLast, base, + formatChar == 'X') + : RenderWithoutSign(i, bufLast, base, + formatChar == 'X'); + // Add the sign + if (isSigned) + { + negative ? signChar = '-' + : ShowSignAlways() ? signChar = '+' + : Blank() ? signChar = ' ' + : 0; } - if (FillZeros() && prec_ == size_t(-1)) { - // pad with zeros and no precision - transfer padding to precision - countZeros = countPadLeft; + } + // precision + size_t + countDigits = bufEnd - bufLast, + countZeros = prec_ != size_t(-1) && countDigits < prec_ && + formatChar != 'c' + ? prec_ - countDigits + : 0, + countBase = base != 10 && AlternateForm() && i != 0 + ? (base == 16 ? 2 : countZeros > 0 ? 0 : 1) + : 0, + countSign = (signChar != 0), + totalPrintable = countDigits + countZeros + countBase + countSign; + size_t countPadLeft = 0, countPadRight = 0; + if (width_ > totalPrintable) + { + if (LeftJustify()) + { + countPadRight = width_ - totalPrintable; countPadLeft = 0; } - // ok, all computed, ready to print to device - Fill(' ', countPadLeft); - if (signChar != 0) Write(&signChar, &signChar + 1); - if (countBase > 0) Fill('0', 1); - if (countBase == 2) Fill(formatChar, 1); - Fill('0', countZeros); - Write(bufLast, bufEnd); - Fill(' ', countPadRight); - // done, advance - Next(); + else + { + countPadLeft = width_ - totalPrintable; + countPadRight = 0; + } } - - void Write(const Char* b, const Char* e) { - if (result_ < 0) return; - const LOKI_SAFEFORMAT_SIGNED_LONG x = e - b; - write(device_, b, e); - result_ += x; + if (FillZeros() && prec_ == size_t(-1)) + { + // pad with zeros and no precision - transfer padding to precision + countZeros = countPadLeft; + countPadLeft = 0; } + // ok, all computed, ready to print to device + Fill(' ', countPadLeft); + if (signChar != 0) Write(&signChar, &signChar + 1); + if (countBase > 0) Fill('0', 1); + if (countBase == 2) Fill(formatChar, 1); + Fill('0', countZeros); + Write(bufLast, bufEnd); + Fill(' ', countPadRight); + // done, advance + Next(); + } - template <class Value> - void PrintUsing_snprintf(Value n, const char* check_fmt_char) { - const Char *const fmt = format_ - 1; - assert(*fmt == '%'); - // enforce format string validity - ReadLeaders(); - // enforce format spec - if (!strchr(check_fmt_char, *format_)) { - result_ = -1; - return; - } - // format char validated, copy it to a temp and use legacy sprintf - ++format_; - Char fmtBuf[128], resultBuf[1024]; - if (format_ >= fmt + sizeof(fmtBuf) / sizeof(Char)) { - result_ = -1; - return; - } - memcpy(fmtBuf, fmt, (format_ - fmt) * sizeof(Char)); - fmtBuf[format_ - fmt] = 0; + void Write(const Char* b, const Char* e) + { + if (result_ < 0) return; + const LOKI_SAFEFORMAT_SIGNED_LONG x = e - b; + write(device_, b, e); + result_ += x; + } - const int stored = + template <class Value> + void PrintUsing_snprintf(Value n, const char* check_fmt_char) + { + const Char* const fmt = format_ - 1; + assert(*fmt == '%'); + // enforce format string validity + ReadLeaders(); + // enforce format spec + if (!strchr(check_fmt_char, *format_)) + { + result_ = -1; + return; + } + // format char validated, copy it to a temp and use legacy sprintf + ++format_; + Char fmtBuf[128], resultBuf[1024]; + if (format_ >= fmt + sizeof(fmtBuf) / sizeof(Char)) + { + result_ = -1; + return; + } + memcpy(fmtBuf, fmt, (format_ - fmt) * sizeof(Char)); + fmtBuf[format_ - fmt] = 0; + + const int stored = #ifdef _MSC_VER #if _MSC_VER < 1400 _snprintf @@ -374,214 +421,259 @@ namespace Loki _snprintf_s #endif #else - snprintf -#endif - (resultBuf, sizeof(resultBuf) / sizeof(Char), fmtBuf, n); - - if (stored < 0) { - result_ = -1; - return; - } - Write(resultBuf, resultBuf + strlen(resultBuf)); - Advance(); // output stuff to the next format directive - } + snprintf +#endif + (resultBuf, sizeof(resultBuf) / sizeof(Char), fmtBuf, n); - void Fill(const Char c, size_t n) { - for (; n > 0; --n) { - Write(&c, &c + 1); - } + if (stored < 0) + { + result_ = -1; + return; } - - Char* RenderWithoutSign(LOKI_SAFEFORMAT_UNSIGNED_LONG n, char* bufLast, - unsigned int base, bool uppercase) { - const Char hex1st = uppercase ? 'A' : 'a'; - for (;;) { - const LOKI_SAFEFORMAT_UNSIGNED_LONG next = n / base; - Char c = static_cast<Char>(n - next * base); - c = static_cast<Char>(c + (c <= 9 ? '0' : static_cast<Char>(hex1st - 10))); - *bufLast = c; - n = next; - if (n == 0) break; - --bufLast; - } - return bufLast; + Write(resultBuf, resultBuf + strlen(resultBuf)); + Advance(); // output stuff to the next format directive + } + + void Fill(const Char c, size_t n) + { + for (; n > 0; --n) + { + Write(&c, &c + 1); } + } - char* RenderWithoutSign(LOKI_SAFEFORMAT_SIGNED_LONG n, char* bufLast, unsigned int base, - bool uppercase) { - if (n != LONG_MIN) { - return RenderWithoutSign(static_cast<LOKI_SAFEFORMAT_UNSIGNED_LONG>(n < 0 ? -n : n), - bufLast, base, uppercase); - } - // annoying corner case - char* save = bufLast; - ++n; - bufLast = RenderWithoutSign(static_cast<LOKI_SAFEFORMAT_UNSIGNED_LONG>(n), - bufLast, base, uppercase); - --(*save); - return bufLast; + Char* RenderWithoutSign(LOKI_SAFEFORMAT_UNSIGNED_LONG n, char* bufLast, + unsigned int base, bool uppercase) + { + const Char hex1st = uppercase ? 'A' : 'a'; + for (;;) + { + const LOKI_SAFEFORMAT_UNSIGNED_LONG next = n / base; + Char c = static_cast<Char>(n - next * base); + c = static_cast<Char>(c + (c <= 9 ? '0' : static_cast<Char>(hex1st - 10))); + *bufLast = c; + n = next; + if (n == 0) break; + --bufLast; } - - void Next() { - ++format_; - Advance(); + return bufLast; + } + + char* RenderWithoutSign(LOKI_SAFEFORMAT_SIGNED_LONG n, char* bufLast, unsigned int base, + bool uppercase) + { + if (n != LONG_MIN) + { + return RenderWithoutSign(static_cast<LOKI_SAFEFORMAT_UNSIGNED_LONG>(n < 0 ? -n : n), + bufLast, base, uppercase); } - - void Advance() { - ResetAll(); - const Char* begin = format_; - for (;;) { - if (*format_ == '%') { - if (format_[1] != '%') { // It's a format specifier - Write(begin, format_); - ++format_; - break; - } - // It's a "%%" - Write(begin, ++format_); - begin = ++format_; - continue; - } - if (*format_ == 0) { + // annoying corner case + char* save = bufLast; + ++n; + bufLast = RenderWithoutSign(static_cast<LOKI_SAFEFORMAT_UNSIGNED_LONG>(n), + bufLast, base, uppercase); + --(*save); + return bufLast; + } + + void Next() + { + ++format_; + Advance(); + } + + void Advance() + { + ResetAll(); + const Char* begin = format_; + for (;;) + { + if (*format_ == '%') + { + if (format_[1] != '%') // It's a format specifier + { Write(begin, format_); + ++format_; break; } - ++format_; + // It's a "%%" + Write(begin, ++format_); + begin = ++format_; + continue; } - } - - void ReadFlags() { - for (;; ++format_) { - switch (*format_) { - case '-': SetLeftJustify(); break; - case '+': SetShowSignAlways(); break; - case ' ': SetBlank(); break; - case '#': SetAlternateForm(); break; - case '0': SetFillZeros(); break; - default: return; - } + if (*format_ == 0) + { + Write(begin, format_); + break; } - } - - void ParseDecimalSizeT(size_t& dest) { - if (!std::isdigit(*format_, std::locale())) return; - size_t r = 0; - do { - // TODO: inefficient - rewrite - r *= 10; - r += *format_ - '0'; - ++format_; - } while (std::isdigit(*format_, std::locale())); - dest = r; - } - - void ReadWidth() { - ParseDecimalSizeT(width_); - } - - void ReadPrecision() { - assert(*format_ == '.'); ++format_; - ParseDecimalSizeT(prec_); - } - - void ReadModifiers() { - switch (*format_) { - case 'h': SetForceShort(); ++format_; break; - case 'l': ++format_; break; - // more (C99 and platform-specific modifiers) to come + } + } + + void ReadFlags() + { + for (;; ++format_) + { + switch (*format_) + { + case '-': + SetLeftJustify(); + break; + case '+': + SetShowSignAlways(); + break; + case ' ': + SetBlank(); + break; + case '#': + SetAlternateForm(); + break; + case '0': + SetFillZeros(); + break; + default: + return; } } - - void ReadLeaders() { - ReadFlags(); - ReadWidth(); - if (*format_ == '.') ReadPrecision(); - ReadModifiers(); + } + + void ParseDecimalSizeT(size_t& dest) + { + if (!std::isdigit(*format_, std::locale())) return; + size_t r = 0; + do + { + // TODO: inefficient - rewrite + r *= 10; + r += *format_ - '0'; + ++format_; } - - enum { - leftJustify = 1, - showSignAlways = 2, - blank = 4, - alternateForm = 8, - fillZeros = 16, - forceShort = 32 - }; - - bool LeftJustify() const { return (flags_ & leftJustify) != 0; } - bool ShowSignAlways() const { return (flags_ & showSignAlways) != 0; } - void SetWidth(size_t w) { width_ = w; } - void SetLeftJustify() { flags_ |= leftJustify; } - void SetShowSignAlways() { flags_ |= showSignAlways; } - bool Blank() const { return (flags_ & blank) != 0; } - bool AlternateForm() const { return (flags_ & alternateForm) != 0; } - bool FillZeros() const { return (flags_ & fillZeros) != 0; } - bool ForceShort() const { return (flags_ & forceShort) != 0; } - - void SetPrec(size_t p) { prec_ = p; } - void SetBlank() { flags_ |= blank; } - void SetAlternateForm() { flags_ |= alternateForm; } - void SetFillZeros() { flags_ |= fillZeros; } - void ResetFillZeros() { flags_ &= ~fillZeros; } - void SetForceShort() { flags_ |= forceShort; } - - void ResetAll() { - assert(result_ != EOF); - width_ = 0; - prec_ = size_t(-1); - flags_ = 0; + while (std::isdigit(*format_, std::locale())); + dest = r; + } + + void ReadWidth() + { + ParseDecimalSizeT(width_); + } + + void ReadPrecision() + { + assert(*format_ == '.'); + ++format_; + ParseDecimalSizeT(prec_); + } + + void ReadModifiers() + { + switch (*format_) + { + case 'h': + SetForceShort(); + ++format_; + break; + case 'l': + ++format_; + break; + // more (C99 and platform-specific modifiers) to come } + } + + void ReadLeaders() + { + ReadFlags(); + ReadWidth(); + if (*format_ == '.') ReadPrecision(); + ReadModifiers(); + } - // state - Device device_; - const Char* format_; - size_t width_; - size_t prec_; - unsigned int flags_; - LOKI_SAFEFORMAT_SIGNED_LONG result_; + enum + { + leftJustify = 1, + showSignAlways = 2, + blank = 4, + alternateForm = 8, + fillZeros = 16, + forceShort = 32 }; - LOKI_EXPORT - PrintfState<std::FILE*, char> Printf(const char* format); + bool LeftJustify() const { return (flags_ & leftJustify) != 0; } + bool ShowSignAlways() const { return (flags_ & showSignAlways) != 0; } + void SetWidth(size_t w) { width_ = w; } + void SetLeftJustify() { flags_ |= leftJustify; } + void SetShowSignAlways() { flags_ |= showSignAlways; } + bool Blank() const { return (flags_ & blank) != 0; } + bool AlternateForm() const { return (flags_ & alternateForm) != 0; } + bool FillZeros() const { return (flags_ & fillZeros) != 0; } + bool ForceShort() const { return (flags_ & forceShort) != 0; } + + void SetPrec(size_t p) { prec_ = p; } + void SetBlank() { flags_ |= blank; } + void SetAlternateForm() { flags_ |= alternateForm; } + void SetFillZeros() { flags_ |= fillZeros; } + void ResetFillZeros() { flags_ &= ~fillZeros; } + void SetForceShort() { flags_ |= forceShort; } + + void ResetAll() + { + assert(result_ != EOF); + width_ = 0; + prec_ = size_t(-1); + flags_ = 0; + } - LOKI_EXPORT - PrintfState<std::FILE*, char> Printf(const std::string& format); + // state + Device device_; + const Char* format_; + size_t width_; + size_t prec_; + unsigned int flags_; + LOKI_SAFEFORMAT_SIGNED_LONG result_; +}; - LOKI_EXPORT - PrintfState<std::FILE*, char> FPrintf(std::FILE* f, const char* format); +LOKI_EXPORT +PrintfState<std::FILE*, char> Printf(const char* format); - LOKI_EXPORT - PrintfState<std::FILE*, char> FPrintf(std::FILE* f, const std::string& format); +LOKI_EXPORT +PrintfState<std::FILE*, char> Printf(const std::string& format); - LOKI_EXPORT - PrintfState<std::ostream&, char> FPrintf(std::ostream& f, const char* format); +LOKI_EXPORT +PrintfState<std::FILE*, char> FPrintf(std::FILE* f, const char* format); - LOKI_EXPORT - PrintfState<std::ostream&, char> FPrintf(std::ostream& f, const std::string& format); +LOKI_EXPORT +PrintfState<std::FILE*, char> FPrintf(std::FILE* f, const std::string& format); - LOKI_EXPORT - PrintfState<std::string&, char> SPrintf(std::string& s, const char* format); +LOKI_EXPORT +PrintfState<std::ostream&, char> FPrintf(std::ostream& f, const char* format); - LOKI_EXPORT - PrintfState<std::string&, char> SPrintf(std::string& s, const std::string& format); +LOKI_EXPORT +PrintfState<std::ostream&, char> FPrintf(std::ostream& f, const std::string& format); - template <class T, class Char> - PrintfState<T&, Char> XPrintf(T& device, const Char* format) { - return PrintfState<T&, Char>(device, format); - } +LOKI_EXPORT +PrintfState<std::string&, char> SPrintf(std::string& s, const char* format); - template <class T> - PrintfState<T&, char> XPrintf(T& device, const std::string& format) { - return PrintfState<T&, char>(device, format.c_str()); - } +LOKI_EXPORT +PrintfState<std::string&, char> SPrintf(std::string& s, const std::string& format); - template <class Char, std::size_t N> - PrintfState<std::pair<Char*, std::size_t>, Char> - BufPrintf(Char (&buf)[N], const Char* format) { - std::pair<Char*, std::size_t> temp(buf, N); - return PrintfState<std::pair<Char*, std::size_t>, Char>(temp, format); - } +template <class T, class Char> +PrintfState<T&, Char> XPrintf(T& device, const Char* format) +{ + return PrintfState<T&, Char>(device, format); +} + +template <class T> +PrintfState<T&, char> XPrintf(T& device, const std::string& format) +{ + return PrintfState<T&, char>(device, format.c_str()); +} + +template <class Char, std::size_t N> +PrintfState<std::pair<Char*, std::size_t>, Char> +BufPrintf(Char (&buf)[N], const Char* format) +{ + std::pair<Char*, std::size_t> temp(buf, N); + return PrintfState<std::pair<Char*, std::size_t>, Char>(temp, format); +} }// namespace Loki diff --git a/shared/loki/ScopeGuard.h b/shared/loki/ScopeGuard.h index b530068d..0b5445f5 100644 --- a/shared/loki/ScopeGuard.h +++ b/shared/loki/ScopeGuard.h @@ -4,12 +4,12 @@ // Copyright (c) 2000 Petru Marginean // Copyright (c) 2005 Joshua Lehrer // -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author makes no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author makes no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_SCOPEGUARD_INC_ @@ -25,634 +25,634 @@ namespace Loki { - //////////////////////////////////////////////////////////////// - /// - /// \class ScopeGuardImplBase - /// \ingroup ExceptionGroup - /// - /// Base class used by all ScopeGuard implementations. All commonly used - /// functions are in this class (e.g. - Dismiss and SafeExecute). - /// - /// See Andrei's and Petru Marginean's CUJ article - /// http://www.cuj.com/documents/s=8000/cujcexp1812alexandr/alexandr.htm - /// - /// Changes to the original code by Joshua Lehrer: - /// http://www.lehrerfamily.com/scopeguard.html - //////////////////////////////////////////////////////////////// - - class ScopeGuardImplBase - { - /// Copy-assignment operator is not implemented and private. - ScopeGuardImplBase& operator =(const ScopeGuardImplBase&); - - protected: - - ~ScopeGuardImplBase() - {} - - /// Copy-constructor takes over responsibility from other ScopeGuard. - ScopeGuardImplBase(const ScopeGuardImplBase& other) throw() - : dismissed_(other.dismissed_) - { - other.Dismiss(); - } - - template <typename J> - static void SafeExecute(J& j) throw() - { - if (!j.dismissed_) - try - { - j.Execute(); - } - catch(...) +//////////////////////////////////////////////////////////////// +/// +/// \class ScopeGuardImplBase +/// \ingroup ExceptionGroup +/// +/// Base class used by all ScopeGuard implementations. All commonly used +/// functions are in this class (e.g. - Dismiss and SafeExecute). +/// +/// See Andrei's and Petru Marginean's CUJ article +/// http://www.cuj.com/documents/s=8000/cujcexp1812alexandr/alexandr.htm +/// +/// Changes to the original code by Joshua Lehrer: +/// http://www.lehrerfamily.com/scopeguard.html +//////////////////////////////////////////////////////////////// + +class ScopeGuardImplBase +{ + /// Copy-assignment operator is not implemented and private. + ScopeGuardImplBase& operator =(const ScopeGuardImplBase&); + +protected: + + ~ScopeGuardImplBase() + {} + + /// Copy-constructor takes over responsibility from other ScopeGuard. + ScopeGuardImplBase(const ScopeGuardImplBase& other) throw() + : dismissed_(other.dismissed_) + { + other.Dismiss(); + } + + template <typename J> + static void SafeExecute(J& j) throw() + { + if (!j.dismissed_) + try + { + j.Execute(); + } + catch(...) {} - } - - mutable bool dismissed_; - - public: - ScopeGuardImplBase() throw() : dismissed_(false) - {} - - void Dismiss() const throw() - { - dismissed_ = true; - } - }; - - //////////////////////////////////////////////////////////////// - /// - /// \typedef typedef const ScopeGuardImplBase& ScopeGuard - /// \ingroup ExceptionGroup - /// - //////////////////////////////////////////////////////////////// - - typedef const ScopeGuardImplBase& ScopeGuard; - - //////////////////////////////////////////////////////////////// - /// - /// \class ScopeGuardImpl0 - /// \ingroup ExceptionGroup - /// - /// Implementation class for a standalone function or class static function - /// with no parameters. ScopeGuard ignores any value returned from the - /// call within the Execute function. - /// - /// This class has a single standalone helper function, MakeGuard which - /// creates and returns a ScopeGuard. - /// - //////////////////////////////////////////////////////////////// - - template <typename F> - class ScopeGuardImpl0 : public ScopeGuardImplBase - { - public: - static ScopeGuardImpl0<F> MakeGuard(F fun) - { - return ScopeGuardImpl0<F>(fun); - } - - ~ScopeGuardImpl0() throw() - { - SafeExecute(*this); - } - - void Execute() - { - fun_(); - } - - protected: - ScopeGuardImpl0(F fun) : fun_(fun) - {} - - F fun_; - }; - - template <typename F> - inline ScopeGuardImpl0<F> MakeGuard(F fun) - { - return ScopeGuardImpl0<F>::MakeGuard(fun); - } - - //////////////////////////////////////////////////////////////// - /// - /// \class ScopeGuardImpl1 - /// \ingroup ExceptionGroup - /// - /// Implementation class for a standalone function or class static function - /// with one parameter. Each parameter is copied by value - use - /// ::Loki::ByRef if you must use a reference instead. ScopeGuard ignores - /// any value returned from the call within the Execute function. - /// - /// This class has a single standalone helper function, MakeGuard which - /// creates and returns a ScopeGuard. - /// - //////////////////////////////////////////////////////////////// - - template <typename F, typename P1> - class ScopeGuardImpl1 : public ScopeGuardImplBase - { - public: - static ScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1) - { - return ScopeGuardImpl1<F, P1>(fun, p1); - } - - ~ScopeGuardImpl1() throw() - { - SafeExecute(*this); - } - - void Execute() - { - fun_(p1_); - } - - protected: - ScopeGuardImpl1(F fun, P1 p1) : fun_(fun), p1_(p1) - {} - - F fun_; - const P1 p1_; - }; - - template <typename F, typename P1> - inline ScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1) - { - return ScopeGuardImpl1<F, P1>::MakeGuard(fun, p1); - } - - //////////////////////////////////////////////////////////////// - /// - /// \class ScopeGuardImpl2 - /// \ingroup ExceptionGroup - /// - /// Implementation class for a standalone function or class static function - /// with two parameters. Each parameter is copied by value - use - /// ::Loki::ByRef if you must use a reference instead. ScopeGuard ignores - /// any value returned from the call within the Execute function. - /// - /// This class has a single standalone helper function, MakeGuard which - /// creates and returns a ScopeGuard. - /// - //////////////////////////////////////////////////////////////// - - template <typename F, typename P1, typename P2> - class ScopeGuardImpl2: public ScopeGuardImplBase - { - public: - static ScopeGuardImpl2<F, P1, P2> MakeGuard(F fun, P1 p1, P2 p2) - { - return ScopeGuardImpl2<F, P1, P2>(fun, p1, p2); - } - - ~ScopeGuardImpl2() throw() - { - SafeExecute(*this); - } - - void Execute() - { - fun_(p1_, p2_); - } - - protected: - ScopeGuardImpl2(F fun, P1 p1, P2 p2) : fun_(fun), p1_(p1), p2_(p2) - {} - - F fun_; - const P1 p1_; - const P2 p2_; - }; - - template <typename F, typename P1, typename P2> - inline ScopeGuardImpl2<F, P1, P2> MakeGuard(F fun, P1 p1, P2 p2) - { - return ScopeGuardImpl2<F, P1, P2>::MakeGuard(fun, p1, p2); - } - - //////////////////////////////////////////////////////////////// - /// - /// \class ScopeGuardImpl3 - /// \ingroup ExceptionGroup - /// - /// Implementation class for a standalone function or class static function - /// with three parameters. Each parameter is copied by value - use - /// ::Loki::ByRef if you must use a reference instead. ScopeGuard ignores - /// any value returned from the call within the Execute function. - /// - /// This class has a single standalone helper function, MakeGuard which - /// creates and returns a ScopeGuard. - /// - //////////////////////////////////////////////////////////////// - - template <typename F, typename P1, typename P2, typename P3> - class ScopeGuardImpl3 : public ScopeGuardImplBase - { - public: - static ScopeGuardImpl3<F, P1, P2, P3> MakeGuard(F fun, P1 p1, P2 p2, P3 p3) - { - return ScopeGuardImpl3<F, P1, P2, P3>(fun, p1, p2, p3); - } - - ~ScopeGuardImpl3() throw() - { - SafeExecute(*this); - } - - void Execute() - { - fun_(p1_, p2_, p3_); - } - - protected: - ScopeGuardImpl3(F fun, P1 p1, P2 p2, P3 p3) : fun_(fun), p1_(p1), p2_(p2), p3_(p3) - {} - - F fun_; - const P1 p1_; - const P2 p2_; - const P3 p3_; - }; - - template <typename F, typename P1, typename P2, typename P3> - inline ScopeGuardImpl3<F, P1, P2, P3> MakeGuard(F fun, P1 p1, P2 p2, P3 p3) - { - return ScopeGuardImpl3<F, P1, P2, P3>::MakeGuard(fun, p1, p2, p3); - } - - //////////////////////////////////////////////////////////////// - /// - /// \class ScopeGuardImpl4 - /// \ingroup ExceptionGroup - /// - /// Implementation class for a standalone function or class static function - /// with four parameters. Each parameter is copied by value - use - /// ::Loki::ByRef if you must use a reference instead. ScopeGuard ignores - /// any value returned from the call within the Execute function. - /// - /// This class has a single standalone helper function, MakeGuard which - /// creates and returns a ScopeGuard. - /// - //////////////////////////////////////////////////////////////// - - template < typename F, typename P1, typename P2, typename P3, typename P4 > - class ScopeGuardImpl4 : public ScopeGuardImplBase - { - public: - static ScopeGuardImpl4< F, P1, P2, P3, P4 > MakeGuard( - F fun, P1 p1, P2 p2, P3 p3, P4 p4 ) - { - return ScopeGuardImpl4< F, P1, P2, P3, P4 >( fun, p1, p2, p3, p4 ); - } - - ~ScopeGuardImpl4() throw() - { - SafeExecute( *this ); - } - - void Execute() - { - fun_( p1_, p2_, p3_, p4_ ); - } - - protected: - ScopeGuardImpl4( F fun, P1 p1, P2 p2, P3 p3, P4 p4 ) : - fun_( fun ), p1_( p1 ), p2_( p2 ), p3_( p3 ), p4_( p4 ) - {} - - F fun_; - const P1 p1_; - const P2 p2_; - const P3 p3_; - const P4 p4_; - }; - - template < typename F, typename P1, typename P2, typename P3, typename P4 > - inline ScopeGuardImpl4< F, P1, P2, P3, P4 > MakeGuard( F fun, P1 p1, P2 p2, P3 p3, P4 p4 ) - { - return ScopeGuardImpl4< F, P1, P2, P3, P4 >::MakeGuard( fun, p1, p2, p3, p4 ); - } - - //////////////////////////////////////////////////////////////// - /// - /// \class ScopeGuardImpl5 - /// \ingroup ExceptionGroup - /// - /// Implementation class for a standalone function or class static function - /// with five parameters. Each parameter is copied by value - use - /// ::Loki::ByRef if you must use a reference instead. ScopeGuard ignores - /// any value returned from the call within the Execute function. - /// - /// This class has a single standalone helper function, MakeGuard which - /// creates and returns a ScopeGuard. - /// - //////////////////////////////////////////////////////////////// - - template < typename F, typename P1, typename P2, typename P3, typename P4, typename P5 > - class ScopeGuardImpl5 : public ScopeGuardImplBase - { - public: - static ScopeGuardImpl5< F, P1, P2, P3, P4, P5 > MakeGuard( - F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 ) - { - return ScopeGuardImpl5< F, P1, P2, P3, P4, P5 >( fun, p1, p2, p3, p4, p5 ); - } - - ~ScopeGuardImpl5() throw() - { - SafeExecute( *this ); - } - - void Execute() - { - fun_( p1_, p2_, p3_, p4_, p5_ ); - } - - protected: - ScopeGuardImpl5( F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 ) : - fun_( fun ), p1_( p1 ), p2_( p2 ), p3_( p3 ), p4_( p4 ), p5_( p5 ) - {} - - F fun_; - const P1 p1_; - const P2 p2_; - const P3 p3_; - const P4 p4_; - const P5 p5_; - }; - - template < typename F, typename P1, typename P2, typename P3, typename P4, typename P5 > - inline ScopeGuardImpl5< F, P1, P2, P3, P4, P5 > MakeGuard( F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 ) - { - return ScopeGuardImpl5< F, P1, P2, P3, P4, P5 >::MakeGuard( fun, p1, p2, p3, p4, p5 ); - } - - //////////////////////////////////////////////////////////////// - /// - /// \class ObjScopeGuardImpl0 - /// \ingroup ExceptionGroup - /// - /// Implementation class for a class per-instance member function with no - /// parameters. ScopeGuard ignores any value returned from the call within - /// the Execute function. - /// - /// This class has 3 standalone helper functions which create a ScopeGuard. - /// One is MakeObjGuard, which is deprecated but provided for older code. - /// The other two are MakeGuard overloads, one which takes a pointer to an - /// object, and the other which takes a reference. - /// - //////////////////////////////////////////////////////////////// - - template <class Obj, typename MemFun> - class ObjScopeGuardImpl0 : public ScopeGuardImplBase - { - public: - static ObjScopeGuardImpl0<Obj, MemFun> MakeObjGuard(Obj& obj, MemFun memFun) - { - return ObjScopeGuardImpl0<Obj, MemFun>(obj, memFun); - } - - ~ObjScopeGuardImpl0() throw() - { - SafeExecute(*this); - } - - void Execute() - { - (obj_.*memFun_)(); - } - - protected: - ObjScopeGuardImpl0(Obj& obj, MemFun memFun) : obj_(obj), memFun_(memFun) - {} - - Obj& obj_; - MemFun memFun_; - }; - - template <class Obj, typename MemFun> - inline ObjScopeGuardImpl0<Obj, MemFun> MakeObjGuard(Obj& obj, MemFun memFun) - { - return ObjScopeGuardImpl0<Obj, MemFun>::MakeObjGuard(obj, memFun); - } - - template <typename Ret, class Obj1, class Obj2> - inline ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()> MakeGuard(Ret(Obj2::*memFun)(), Obj1 &obj) - { - return ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()>::MakeObjGuard(obj,memFun); - } - - template <typename Ret, class Obj1, class Obj2> - inline ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()> MakeGuard(Ret(Obj2::*memFun)(), Obj1 *obj) - { - return ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()>::MakeObjGuard(*obj,memFun); - } - - //////////////////////////////////////////////////////////////// - /// - /// \class ObjScopeGuardImpl1 - /// \ingroup ExceptionGroup - /// - /// Implementation class for a class per-instance member function with one - /// parameter. The parameter is copied by value - use ::Loki::ByRef if you - /// must use a reference instead. ScopeGuard ignores any value returned - /// from the call within the Execute function. - /// - /// This class has 3 standalone helper functions which create a ScopeGuard. - /// One is MakeObjGuard, which is deprecated but provided for older code. - /// The other two are MakeGuard overloads, one which takes a pointer to an - /// object, and the other which takes a reference. - /// - //////////////////////////////////////////////////////////////// - - template <class Obj, typename MemFun, typename P1> - class ObjScopeGuardImpl1 : public ScopeGuardImplBase - { - public: - static ObjScopeGuardImpl1<Obj, MemFun, P1> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1) - { - return ObjScopeGuardImpl1<Obj, MemFun, P1>(obj, memFun, p1); - } + } + + mutable bool dismissed_; + +public: + ScopeGuardImplBase() throw() : dismissed_(false) + {} + + void Dismiss() const throw() + { + dismissed_ = true; + } +}; + +//////////////////////////////////////////////////////////////// +/// +/// \typedef typedef const ScopeGuardImplBase& ScopeGuard +/// \ingroup ExceptionGroup +/// +//////////////////////////////////////////////////////////////// + +typedef const ScopeGuardImplBase& ScopeGuard; + +//////////////////////////////////////////////////////////////// +/// +/// \class ScopeGuardImpl0 +/// \ingroup ExceptionGroup +/// +/// Implementation class for a standalone function or class static function +/// with no parameters. ScopeGuard ignores any value returned from the +/// call within the Execute function. +/// +/// This class has a single standalone helper function, MakeGuard which +/// creates and returns a ScopeGuard. +/// +//////////////////////////////////////////////////////////////// + +template <typename F> +class ScopeGuardImpl0 : public ScopeGuardImplBase +{ +public: + static ScopeGuardImpl0<F> MakeGuard(F fun) + { + return ScopeGuardImpl0<F>(fun); + } - ~ObjScopeGuardImpl1() throw() - { - SafeExecute(*this); - } + ~ScopeGuardImpl0() throw() + { + SafeExecute(*this); + } + + void Execute() + { + fun_(); + } - void Execute() - { - (obj_.*memFun_)(p1_); - } +protected: + ScopeGuardImpl0(F fun) : fun_(fun) + {} - protected: - ObjScopeGuardImpl1(Obj& obj, MemFun memFun, P1 p1) : obj_(obj), memFun_(memFun), p1_(p1) - {} - - Obj& obj_; - MemFun memFun_; - const P1 p1_; - }; - - template <class Obj, typename MemFun, typename P1> - inline ObjScopeGuardImpl1<Obj, MemFun, P1> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1) - { - return ObjScopeGuardImpl1<Obj, MemFun, P1>::MakeObjGuard(obj, memFun, p1); - } - - template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b> - inline ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b> MakeGuard(Ret(Obj2::*memFun)(P1a), Obj1 &obj, P1b p1) + F fun_; +}; + +template <typename F> +inline ScopeGuardImpl0<F> MakeGuard(F fun) +{ + return ScopeGuardImpl0<F>::MakeGuard(fun); +} + +//////////////////////////////////////////////////////////////// +/// +/// \class ScopeGuardImpl1 +/// \ingroup ExceptionGroup +/// +/// Implementation class for a standalone function or class static function +/// with one parameter. Each parameter is copied by value - use +/// ::Loki::ByRef if you must use a reference instead. ScopeGuard ignores +/// any value returned from the call within the Execute function. +/// +/// This class has a single standalone helper function, MakeGuard which +/// creates and returns a ScopeGuard. +/// +//////////////////////////////////////////////////////////////// + +template <typename F, typename P1> +class ScopeGuardImpl1 : public ScopeGuardImplBase +{ +public: + static ScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1) { - return ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b>::MakeObjGuard(obj,memFun,p1); - } - - template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b> - inline ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b> MakeGuard(Ret(Obj2::*memFun)(P1a), Obj1 *obj, P1b p1) - { - return ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b>::MakeObjGuard(*obj,memFun,p1); - } - - //////////////////////////////////////////////////////////////// - /// - /// \class ObjScopeGuardImpl2 - /// \ingroup ExceptionGroup - /// - /// Implementation class for a class per-instance member function with two - /// parameters. Each parameter is copied by value - use ::Loki::ByRef if you - /// must use a reference instead. ScopeGuard ignores any value returned - /// from the call within the Execute function. - /// - /// This class has 3 standalone helper functions which create a ScopeGuard. - /// One is MakeObjGuard, which is deprecated but provided for older code. - /// The other two are MakeGuard overloads, one which takes a pointer to an - /// object, and the other which takes a reference. - /// - //////////////////////////////////////////////////////////////// - - template <class Obj, typename MemFun, typename P1, typename P2> - class ObjScopeGuardImpl2 : public ScopeGuardImplBase - { - public: - static ObjScopeGuardImpl2<Obj, MemFun, P1, P2> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2) - { - return ObjScopeGuardImpl2<Obj, MemFun, P1, P2>(obj, memFun, p1, p2); - } - - ~ObjScopeGuardImpl2() throw() - { - SafeExecute(*this); - } - - void Execute() - { - (obj_.*memFun_)(p1_, p2_); - } - - protected: - ObjScopeGuardImpl2(Obj& obj, MemFun memFun, P1 p1, P2 p2) : obj_(obj), memFun_(memFun), p1_(p1), p2_(p2) - {} - - Obj& obj_; - MemFun memFun_; - const P1 p1_; - const P2 p2_; - }; - - template <class Obj, typename MemFun, typename P1, typename P2> - inline ObjScopeGuardImpl2<Obj, MemFun, P1, P2> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2) - { - return ObjScopeGuardImpl2<Obj, MemFun, P1, P2>::MakeObjGuard(obj, memFun, p1, p2); - } + return ScopeGuardImpl1<F, P1>(fun, p1); + } - template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b, typename P2a, typename P2b> - inline ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b> MakeGuard(Ret(Obj2::*memFun)(P1a,P2a), Obj1 &obj, P1b p1, P2b p2) - { - return ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b>::MakeObjGuard(obj,memFun,p1,p2); + ~ScopeGuardImpl1() throw() + { + SafeExecute(*this); } - - template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b, typename P2a, typename P2b> - inline ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b> MakeGuard(Ret(Obj2::*memFun)(P1a,P2a), Obj1 *obj, P1b p1, P2b p2) + + void Execute() { - return ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b>::MakeObjGuard(*obj,memFun,p1,p2); + fun_(p1_); } - //////////////////////////////////////////////////////////////// - /// - /// \class ObjScopeGuardImpl3 - /// \ingroup ExceptionGroup - /// - /// Implementation class for a class per-instance member function with three - /// parameters. Each parameter is copied by value - use ::Loki::ByRef if you - /// must use a reference instead. ScopeGuard ignores any value returned - /// from the call within the Execute function. - /// - /// This class has 3 standalone helper functions which create a ScopeGuard. - /// One is MakeObjGuard, which is deprecated but provided for older code. - /// The other two are MakeGuard overloads, one which takes a pointer to an - /// object, and the other which takes a reference. - /// - //////////////////////////////////////////////////////////////// +protected: + ScopeGuardImpl1(F fun, P1 p1) : fun_(fun), p1_(p1) + {} - template < class Obj, typename MemFun, typename P1, typename P2, typename P3 > - class ObjScopeGuardImpl3 : public ScopeGuardImplBase + F fun_; + const P1 p1_; +}; + +template <typename F, typename P1> +inline ScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1) +{ + return ScopeGuardImpl1<F, P1>::MakeGuard(fun, p1); +} + +//////////////////////////////////////////////////////////////// +/// +/// \class ScopeGuardImpl2 +/// \ingroup ExceptionGroup +/// +/// Implementation class for a standalone function or class static function +/// with two parameters. Each parameter is copied by value - use +/// ::Loki::ByRef if you must use a reference instead. ScopeGuard ignores +/// any value returned from the call within the Execute function. +/// +/// This class has a single standalone helper function, MakeGuard which +/// creates and returns a ScopeGuard. +/// +//////////////////////////////////////////////////////////////// + +template <typename F, typename P1, typename P2> +class ScopeGuardImpl2: public ScopeGuardImplBase +{ +public: + static ScopeGuardImpl2<F, P1, P2> MakeGuard(F fun, P1 p1, P2 p2) { - public: - static ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 > MakeObjGuard( - Obj & obj, MemFun memFun, P1 p1, P2 p2, P3 p3 ) - { - return ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 >( obj, memFun, p1, p2, p3 ); - } + return ScopeGuardImpl2<F, P1, P2>(fun, p1, p2); + } - ~ObjScopeGuardImpl3() throw() - { - SafeExecute( *this ); - } - - void Execute() - { - ( obj_.*memFun_ )( p1_, p2_, p3_ ); - } - - protected: - ObjScopeGuardImpl3( Obj & obj, MemFun memFun, P1 p1, P2 p2, P3 p3 ) : - obj_( obj ), memFun_( memFun ), p1_( p1 ), p2_( p2 ), p3_( p3 ) - {} - - Obj& obj_; - MemFun memFun_; - const P1 p1_; - const P2 p2_; - const P3 p3_; - }; + ~ScopeGuardImpl2() throw() + { + SafeExecute(*this); + } - template < class Obj, typename MemFun, typename P1, typename P2, typename P3 > - inline ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 > MakeObjGuard( - Obj & obj, MemFun memFun, P1 p1, P2 p2, P3 p3 ) + void Execute() + { + fun_(p1_, p2_); + } + +protected: + ScopeGuardImpl2(F fun, P1 p1, P2 p2) : fun_(fun), p1_(p1), p2_(p2) + {} + + F fun_; + const P1 p1_; + const P2 p2_; +}; + +template <typename F, typename P1, typename P2> +inline ScopeGuardImpl2<F, P1, P2> MakeGuard(F fun, P1 p1, P2 p2) +{ + return ScopeGuardImpl2<F, P1, P2>::MakeGuard(fun, p1, p2); +} + +//////////////////////////////////////////////////////////////// +/// +/// \class ScopeGuardImpl3 +/// \ingroup ExceptionGroup +/// +/// Implementation class for a standalone function or class static function +/// with three parameters. Each parameter is copied by value - use +/// ::Loki::ByRef if you must use a reference instead. ScopeGuard ignores +/// any value returned from the call within the Execute function. +/// +/// This class has a single standalone helper function, MakeGuard which +/// creates and returns a ScopeGuard. +/// +//////////////////////////////////////////////////////////////// + +template <typename F, typename P1, typename P2, typename P3> +class ScopeGuardImpl3 : public ScopeGuardImplBase +{ +public: + static ScopeGuardImpl3<F, P1, P2, P3> MakeGuard(F fun, P1 p1, P2 p2, P3 p3) + { + return ScopeGuardImpl3<F, P1, P2, P3>(fun, p1, p2, p3); + } + + ~ScopeGuardImpl3() throw() + { + SafeExecute(*this); + } + + void Execute() + { + fun_(p1_, p2_, p3_); + } + +protected: + ScopeGuardImpl3(F fun, P1 p1, P2 p2, P3 p3) : fun_(fun), p1_(p1), p2_(p2), p3_(p3) + {} + + F fun_; + const P1 p1_; + const P2 p2_; + const P3 p3_; +}; + +template <typename F, typename P1, typename P2, typename P3> +inline ScopeGuardImpl3<F, P1, P2, P3> MakeGuard(F fun, P1 p1, P2 p2, P3 p3) +{ + return ScopeGuardImpl3<F, P1, P2, P3>::MakeGuard(fun, p1, p2, p3); +} + +//////////////////////////////////////////////////////////////// +/// +/// \class ScopeGuardImpl4 +/// \ingroup ExceptionGroup +/// +/// Implementation class for a standalone function or class static function +/// with four parameters. Each parameter is copied by value - use +/// ::Loki::ByRef if you must use a reference instead. ScopeGuard ignores +/// any value returned from the call within the Execute function. +/// +/// This class has a single standalone helper function, MakeGuard which +/// creates and returns a ScopeGuard. +/// +//////////////////////////////////////////////////////////////// + +template < typename F, typename P1, typename P2, typename P3, typename P4 > +class ScopeGuardImpl4 : public ScopeGuardImplBase +{ +public: + static ScopeGuardImpl4< F, P1, P2, P3, P4 > MakeGuard( + F fun, P1 p1, P2 p2, P3 p3, P4 p4 ) + { + return ScopeGuardImpl4< F, P1, P2, P3, P4 >( fun, p1, p2, p3, p4 ); + } + + ~ScopeGuardImpl4() throw() + { + SafeExecute( *this ); + } + + void Execute() + { + fun_( p1_, p2_, p3_, p4_ ); + } + +protected: + ScopeGuardImpl4( F fun, P1 p1, P2 p2, P3 p3, P4 p4 ) : + fun_( fun ), p1_( p1 ), p2_( p2 ), p3_( p3 ), p4_( p4 ) + {} + + F fun_; + const P1 p1_; + const P2 p2_; + const P3 p3_; + const P4 p4_; +}; + +template < typename F, typename P1, typename P2, typename P3, typename P4 > +inline ScopeGuardImpl4< F, P1, P2, P3, P4 > MakeGuard( F fun, P1 p1, P2 p2, P3 p3, P4 p4 ) +{ + return ScopeGuardImpl4< F, P1, P2, P3, P4 >::MakeGuard( fun, p1, p2, p3, p4 ); +} + +//////////////////////////////////////////////////////////////// +/// +/// \class ScopeGuardImpl5 +/// \ingroup ExceptionGroup +/// +/// Implementation class for a standalone function or class static function +/// with five parameters. Each parameter is copied by value - use +/// ::Loki::ByRef if you must use a reference instead. ScopeGuard ignores +/// any value returned from the call within the Execute function. +/// +/// This class has a single standalone helper function, MakeGuard which +/// creates and returns a ScopeGuard. +/// +//////////////////////////////////////////////////////////////// + +template < typename F, typename P1, typename P2, typename P3, typename P4, typename P5 > +class ScopeGuardImpl5 : public ScopeGuardImplBase +{ +public: + static ScopeGuardImpl5< F, P1, P2, P3, P4, P5 > MakeGuard( + F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 ) { - return ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 >::MakeObjGuard( - obj, memFun, p1, p2, p3 ); + return ScopeGuardImpl5< F, P1, P2, P3, P4, P5 >( fun, p1, p2, p3, p4, p5 ); } - template < typename Ret, class Obj1, class Obj2, typename P1a, typename P1b, - typename P2a, typename P2b, typename P3a, typename P3b > - inline ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b > - MakeGuard( Ret( Obj2::*memFun )( P1a, P2a, P3a ), Obj1 & obj, P1b p1, P2b p2, P3b p3 ) + ~ScopeGuardImpl5() throw() { - return ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b > - ::MakeObjGuard( obj, memFun, p1, p2, p3 ); + SafeExecute( *this ); } - template < typename Ret, class Obj1, class Obj2, typename P1a, typename P1b, - typename P2a, typename P2b, typename P3a, typename P3b > - inline ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b > - MakeGuard( Ret( Obj2::*memFun )( P1a, P2a, P3a ), Obj1 * obj, P1b p1, P2b p2, P3b p3 ) + void Execute() { - return ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b > - ::MakeObjGuard( *obj, memFun, p1, p2, p3 ); + fun_( p1_, p2_, p3_, p4_, p5_ ); } +protected: + ScopeGuardImpl5( F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 ) : + fun_( fun ), p1_( p1 ), p2_( p2 ), p3_( p3 ), p4_( p4 ), p5_( p5 ) + {} + + F fun_; + const P1 p1_; + const P2 p2_; + const P3 p3_; + const P4 p4_; + const P5 p5_; +}; + +template < typename F, typename P1, typename P2, typename P3, typename P4, typename P5 > +inline ScopeGuardImpl5< F, P1, P2, P3, P4, P5 > MakeGuard( F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 ) +{ + return ScopeGuardImpl5< F, P1, P2, P3, P4, P5 >::MakeGuard( fun, p1, p2, p3, p4, p5 ); +} + +//////////////////////////////////////////////////////////////// +/// +/// \class ObjScopeGuardImpl0 +/// \ingroup ExceptionGroup +/// +/// Implementation class for a class per-instance member function with no +/// parameters. ScopeGuard ignores any value returned from the call within +/// the Execute function. +/// +/// This class has 3 standalone helper functions which create a ScopeGuard. +/// One is MakeObjGuard, which is deprecated but provided for older code. +/// The other two are MakeGuard overloads, one which takes a pointer to an +/// object, and the other which takes a reference. +/// +//////////////////////////////////////////////////////////////// + +template <class Obj, typename MemFun> +class ObjScopeGuardImpl0 : public ScopeGuardImplBase +{ +public: + static ObjScopeGuardImpl0<Obj, MemFun> MakeObjGuard(Obj& obj, MemFun memFun) + { + return ObjScopeGuardImpl0<Obj, MemFun>(obj, memFun); + } + + ~ObjScopeGuardImpl0() throw() + { + SafeExecute(*this); + } + + void Execute() + { + (obj_.*memFun_)(); + } + +protected: + ObjScopeGuardImpl0(Obj& obj, MemFun memFun) : obj_(obj), memFun_(memFun) + {} + + Obj& obj_; + MemFun memFun_; +}; + +template <class Obj, typename MemFun> +inline ObjScopeGuardImpl0<Obj, MemFun> MakeObjGuard(Obj& obj, MemFun memFun) +{ + return ObjScopeGuardImpl0<Obj, MemFun>::MakeObjGuard(obj, memFun); +} + +template <typename Ret, class Obj1, class Obj2> +inline ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()> MakeGuard(Ret(Obj2::*memFun)(), Obj1& obj) +{ + return ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()>::MakeObjGuard(obj,memFun); +} + +template <typename Ret, class Obj1, class Obj2> +inline ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()> MakeGuard(Ret(Obj2::*memFun)(), Obj1* obj) +{ + return ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()>::MakeObjGuard(*obj,memFun); +} + +//////////////////////////////////////////////////////////////// +/// +/// \class ObjScopeGuardImpl1 +/// \ingroup ExceptionGroup +/// +/// Implementation class for a class per-instance member function with one +/// parameter. The parameter is copied by value - use ::Loki::ByRef if you +/// must use a reference instead. ScopeGuard ignores any value returned +/// from the call within the Execute function. +/// +/// This class has 3 standalone helper functions which create a ScopeGuard. +/// One is MakeObjGuard, which is deprecated but provided for older code. +/// The other two are MakeGuard overloads, one which takes a pointer to an +/// object, and the other which takes a reference. +/// +//////////////////////////////////////////////////////////////// + +template <class Obj, typename MemFun, typename P1> +class ObjScopeGuardImpl1 : public ScopeGuardImplBase +{ +public: + static ObjScopeGuardImpl1<Obj, MemFun, P1> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1) + { + return ObjScopeGuardImpl1<Obj, MemFun, P1>(obj, memFun, p1); + } + + ~ObjScopeGuardImpl1() throw() + { + SafeExecute(*this); + } + + void Execute() + { + (obj_.*memFun_)(p1_); + } + +protected: + ObjScopeGuardImpl1(Obj& obj, MemFun memFun, P1 p1) : obj_(obj), memFun_(memFun), p1_(p1) + {} + + Obj& obj_; + MemFun memFun_; + const P1 p1_; +}; + +template <class Obj, typename MemFun, typename P1> +inline ObjScopeGuardImpl1<Obj, MemFun, P1> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1) +{ + return ObjScopeGuardImpl1<Obj, MemFun, P1>::MakeObjGuard(obj, memFun, p1); +} + +template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b> +inline ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b> MakeGuard(Ret(Obj2::*memFun)(P1a), Obj1& obj, P1b p1) +{ + return ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b>::MakeObjGuard(obj,memFun,p1); +} + +template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b> +inline ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b> MakeGuard(Ret(Obj2::*memFun)(P1a), Obj1* obj, P1b p1) +{ + return ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b>::MakeObjGuard(*obj,memFun,p1); +} + +//////////////////////////////////////////////////////////////// +/// +/// \class ObjScopeGuardImpl2 +/// \ingroup ExceptionGroup +/// +/// Implementation class for a class per-instance member function with two +/// parameters. Each parameter is copied by value - use ::Loki::ByRef if you +/// must use a reference instead. ScopeGuard ignores any value returned +/// from the call within the Execute function. +/// +/// This class has 3 standalone helper functions which create a ScopeGuard. +/// One is MakeObjGuard, which is deprecated but provided for older code. +/// The other two are MakeGuard overloads, one which takes a pointer to an +/// object, and the other which takes a reference. +/// +//////////////////////////////////////////////////////////////// + +template <class Obj, typename MemFun, typename P1, typename P2> +class ObjScopeGuardImpl2 : public ScopeGuardImplBase +{ +public: + static ObjScopeGuardImpl2<Obj, MemFun, P1, P2> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2) + { + return ObjScopeGuardImpl2<Obj, MemFun, P1, P2>(obj, memFun, p1, p2); + } + + ~ObjScopeGuardImpl2() throw() + { + SafeExecute(*this); + } + + void Execute() + { + (obj_.*memFun_)(p1_, p2_); + } + +protected: + ObjScopeGuardImpl2(Obj& obj, MemFun memFun, P1 p1, P2 p2) : obj_(obj), memFun_(memFun), p1_(p1), p2_(p2) + {} + + Obj& obj_; + MemFun memFun_; + const P1 p1_; + const P2 p2_; +}; + +template <class Obj, typename MemFun, typename P1, typename P2> +inline ObjScopeGuardImpl2<Obj, MemFun, P1, P2> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2) +{ + return ObjScopeGuardImpl2<Obj, MemFun, P1, P2>::MakeObjGuard(obj, memFun, p1, p2); +} + +template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b, typename P2a, typename P2b> +inline ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b> MakeGuard(Ret(Obj2::*memFun)(P1a,P2a), Obj1& obj, P1b p1, P2b p2) +{ + return ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b>::MakeObjGuard(obj,memFun,p1,p2); +} + +template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b, typename P2a, typename P2b> +inline ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b> MakeGuard(Ret(Obj2::*memFun)(P1a,P2a), Obj1* obj, P1b p1, P2b p2) +{ + return ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b>::MakeObjGuard(*obj,memFun,p1,p2); +} + +//////////////////////////////////////////////////////////////// +/// +/// \class ObjScopeGuardImpl3 +/// \ingroup ExceptionGroup +/// +/// Implementation class for a class per-instance member function with three +/// parameters. Each parameter is copied by value - use ::Loki::ByRef if you +/// must use a reference instead. ScopeGuard ignores any value returned +/// from the call within the Execute function. +/// +/// This class has 3 standalone helper functions which create a ScopeGuard. +/// One is MakeObjGuard, which is deprecated but provided for older code. +/// The other two are MakeGuard overloads, one which takes a pointer to an +/// object, and the other which takes a reference. +/// +//////////////////////////////////////////////////////////////// + +template < class Obj, typename MemFun, typename P1, typename P2, typename P3 > +class ObjScopeGuardImpl3 : public ScopeGuardImplBase +{ +public: + static ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 > MakeObjGuard( + Obj& obj, MemFun memFun, P1 p1, P2 p2, P3 p3 ) + { + return ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 >( obj, memFun, p1, p2, p3 ); + } + + ~ObjScopeGuardImpl3() throw() + { + SafeExecute( *this ); + } + + void Execute() + { + ( obj_.*memFun_ )( p1_, p2_, p3_ ); + } + +protected: + ObjScopeGuardImpl3( Obj& obj, MemFun memFun, P1 p1, P2 p2, P3 p3 ) : + obj_( obj ), memFun_( memFun ), p1_( p1 ), p2_( p2 ), p3_( p3 ) + {} + + Obj& obj_; + MemFun memFun_; + const P1 p1_; + const P2 p2_; + const P3 p3_; +}; + +template < class Obj, typename MemFun, typename P1, typename P2, typename P3 > +inline ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 > MakeObjGuard( + Obj& obj, MemFun memFun, P1 p1, P2 p2, P3 p3 ) +{ + return ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 >::MakeObjGuard( + obj, memFun, p1, p2, p3 ); +} + +template < typename Ret, class Obj1, class Obj2, typename P1a, typename P1b, + typename P2a, typename P2b, typename P3a, typename P3b > +inline ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b > +MakeGuard( Ret( Obj2::*memFun )( P1a, P2a, P3a ), Obj1& obj, P1b p1, P2b p2, P3b p3 ) +{ + return ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b > + ::MakeObjGuard( obj, memFun, p1, p2, p3 ); +} + +template < typename Ret, class Obj1, class Obj2, typename P1a, typename P1b, + typename P2a, typename P2b, typename P3a, typename P3b > +inline ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b > +MakeGuard( Ret( Obj2::*memFun )( P1a, P2a, P3a ), Obj1* obj, P1b p1, P2b p2, P3b p3 ) +{ + return ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b > + ::MakeObjGuard( *obj, memFun, p1, p2, p3 ); +} + } // namespace Loki #define LOKI_CONCATENATE_DIRECT(s1, s2) s1##s2 diff --git a/shared/loki/Sequence.h b/shared/loki/Sequence.h index 4e5bd235..e8c8bd35 100644 --- a/shared/loki/Sequence.h +++ b/shared/loki/Sequence.h @@ -1,12 +1,12 @@ //////////////////////////////////////////////////////////////////////////////// // The Loki Library // Copyright (c) 2005 by Peter Kümmel -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author makes no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author makes no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_SEQUENCE_INC_ @@ -20,28 +20,28 @@ namespace Loki { - template - < - class T01=NullType,class T02=NullType,class T03=NullType,class T04=NullType,class T05=NullType, - class T06=NullType,class T07=NullType,class T08=NullType,class T09=NullType,class T10=NullType, - class T11=NullType,class T12=NullType,class T13=NullType,class T14=NullType,class T15=NullType, - class T16=NullType,class T17=NullType,class T18=NullType,class T19=NullType,class T20=NullType - > - struct Seq - { - private: - typedef typename Seq< T02, T03, T04, T05, T06, T07, T08, T09, T10, - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>::Type - TailResult; - public: - typedef Typelist<T01, TailResult> Type; - }; - - template<> - struct Seq<> - { - typedef NullType Type; - }; +template +< +class T01=NullType,class T02=NullType,class T03=NullType,class T04=NullType,class T05=NullType, + class T06=NullType,class T07=NullType,class T08=NullType,class T09=NullType,class T10=NullType, + class T11=NullType,class T12=NullType,class T13=NullType,class T14=NullType,class T15=NullType, + class T16=NullType,class T17=NullType,class T18=NullType,class T19=NullType,class T20=NullType + > +struct Seq +{ +private: + typedef typename Seq< T02, T03, T04, T05, T06, T07, T08, T09, T10, + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>::Type + TailResult; +public: + typedef Typelist<T01, TailResult> Type; +}; + +template<> +struct Seq<> +{ + typedef NullType Type; +}; } // namespace Loki diff --git a/shared/loki/Singleton.h b/shared/loki/Singleton.h index 42d6eb0d..40cc7550 100644 --- a/shared/loki/Singleton.h +++ b/shared/loki/Singleton.h @@ -2,14 +2,14 @@ // The Loki Library // Copyright (c) 2001 by Andrei Alexandrescu // This code accompanies the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author or Addison-Wesley Longman make no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author or Addison-Wesley Longman make no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_SINGLETON_INC_ @@ -30,9 +30,9 @@ #include <memory> #ifdef _MSC_VER -#define LOKI_C_CALLING_CONVENTION_QUALIFIER __cdecl +#define LOKI_C_CALLING_CONVENTION_QUALIFIER __cdecl #else -#define LOKI_C_CALLING_CONVENTION_QUALIFIER +#define LOKI_C_CALLING_CONVENTION_QUALIFIER #endif /// \defgroup SingletonGroup Singleton @@ -42,7 +42,7 @@ /// \ingroup SingletonGroup /// The lifetimes of the singleton. /// \par Special lifetime for SmallObjects -/// When the holded object is a Small(Value)Object or the holded object +/// When the holded object is a Small(Value)Object or the holded object /// uses objects which are or inherit from Small(Value)Object /// then you can't use the default lifetime: you must use the lifetime /// \code Loki::LongevityLifetime::DieAsSmallObjectChild \endcode @@ -52,820 +52,820 @@ namespace Loki { - typedef void (LOKI_C_CALLING_CONVENTION_QUALIFIER *atexit_pfn_t)(); +typedef void (LOKI_C_CALLING_CONVENTION_QUALIFIER* atexit_pfn_t)(); - namespace Private - { +namespace Private +{ #ifndef LOKI_MAKE_DLL - void LOKI_C_CALLING_CONVENTION_QUALIFIER AtExitFn(); // declaration needed below +void LOKI_C_CALLING_CONVENTION_QUALIFIER AtExitFn(); // declaration needed below #else - void LOKI_EXPORT AtExitFn(); +void LOKI_EXPORT AtExitFn(); #endif - class LifetimeTracker; +class LifetimeTracker; -#define LOKI_ENABLE_NEW_SETLONGLIVITY_HELPER_DATA_IMPL +#define LOKI_ENABLE_NEW_SETLONGLIVITY_HELPER_DATA_IMPL #ifdef LOKI_ENABLE_NEW_SETLONGLIVITY_HELPER_DATA_IMPL - // Helper data - // std::list because of the inserts - typedef std::list<LifetimeTracker*> TrackerArray; - extern LOKI_EXPORT TrackerArray* pTrackerArray; +// Helper data +// std::list because of the inserts +typedef std::list<LifetimeTracker*> TrackerArray; +extern LOKI_EXPORT TrackerArray* pTrackerArray; #else - // Helper data - typedef LifetimeTracker** TrackerArray; - extern TrackerArray pTrackerArray; - extern unsigned int elements; +// Helper data +typedef LifetimeTracker** TrackerArray; +extern TrackerArray pTrackerArray; +extern unsigned int elements; #endif - //////////////////////////////////////////////////////////////////////////////// - // class LifetimeTracker - // Helper class for SetLongevity - //////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// class LifetimeTracker +// Helper class for SetLongevity +//////////////////////////////////////////////////////////////////////////////// - class LifetimeTracker - { - public: - LifetimeTracker(unsigned int x) : longevity_(x) - {} - - virtual ~LifetimeTracker() = 0; - - static bool Compare(const LifetimeTracker* lhs, - const LifetimeTracker* rhs) - { - return lhs->longevity_ > rhs->longevity_; - } - - private: - unsigned int longevity_; - }; - - // Definition required - inline LifetimeTracker::~LifetimeTracker() {} +class LifetimeTracker +{ +public: + LifetimeTracker(unsigned int x) : longevity_(x) + {} - // Helper destroyer function - template <typename T> - struct Deleter - { - typedef void (*Type)(T*); - static void Delete(T* pObj) - { delete pObj; } - }; + virtual ~LifetimeTracker() = 0; - // Concrete lifetime tracker for objects of type T - template <typename T, typename Destroyer> - class ConcreteLifetimeTracker : public LifetimeTracker - { - public: - ConcreteLifetimeTracker(T* p,unsigned int longevity, Destroyer d) - : LifetimeTracker(longevity) - , pTracked_(p) - , destroyer_(d) - {} - - ~ConcreteLifetimeTracker() - { destroyer_(pTracked_); } - - private: - T* pTracked_; - Destroyer destroyer_; - }; + static bool Compare(const LifetimeTracker* lhs, + const LifetimeTracker* rhs) + { + return lhs->longevity_ > rhs->longevity_; + } - } // namespace Private +private: + unsigned int longevity_; +}; - //////////////////////////////////////////////////////////////////////////////// - /// \ingroup LifetimeGroup - /// - /// Assigns an object a longevity; ensures ordered destructions of objects - /// registered thusly during the exit sequence of the application - //////////////////////////////////////////////////////////////////////////////// +// Definition required +inline LifetimeTracker::~LifetimeTracker() {} + +// Helper destroyer function +template <typename T> +struct Deleter +{ + typedef void (*Type)(T*); + static void Delete(T* pObj) + { delete pObj; } +}; + +// Concrete lifetime tracker for objects of type T +template <typename T, typename Destroyer> +class ConcreteLifetimeTracker : public LifetimeTracker +{ +public: + ConcreteLifetimeTracker(T* p,unsigned int longevity, Destroyer d) + : LifetimeTracker(longevity) + , pTracked_(p) + , destroyer_(d) + {} + + ~ConcreteLifetimeTracker() + { destroyer_(pTracked_); } + +private: + T* pTracked_; + Destroyer destroyer_; +}; + +} // namespace Private + +//////////////////////////////////////////////////////////////////////////////// +/// \ingroup LifetimeGroup +/// +/// Assigns an object a longevity; ensures ordered destructions of objects +/// registered thusly during the exit sequence of the application +//////////////////////////////////////////////////////////////////////////////// #ifdef LOKI_ENABLE_NEW_SETLONGLIVITY_HELPER_DATA_IMPL - template <typename T, typename Destroyer> - void SetLongevity(T* pDynObject, unsigned int longevity, - Destroyer d) - { - using namespace Private; - - // manage lifetime of stack manually - if(pTrackerArray==0) - pTrackerArray = new TrackerArray; - - // automatically delete the ConcreteLifetimeTracker object when a exception is thrown - std::auto_ptr<LifetimeTracker> - p( new ConcreteLifetimeTracker<T, Destroyer>(pDynObject, longevity, d) ); - - // Find correct position - TrackerArray::iterator pos = std::upper_bound( - pTrackerArray->begin(), - pTrackerArray->end(), - p.get(), - LifetimeTracker::Compare); - - // Insert the pointer to the ConcreteLifetimeTracker object into the queue - pTrackerArray->insert(pos, p.get()); - - // nothing has thrown: don't delete the ConcreteLifetimeTracker object - p.release(); - - // Register a call to AtExitFn - std::atexit(Private::AtExitFn); - } +template <typename T, typename Destroyer> +void SetLongevity(T* pDynObject, unsigned int longevity, + Destroyer d) +{ + using namespace Private; + + // manage lifetime of stack manually + if(pTrackerArray==0) + pTrackerArray = new TrackerArray; + + // automatically delete the ConcreteLifetimeTracker object when a exception is thrown + std::auto_ptr<LifetimeTracker> + p( new ConcreteLifetimeTracker<T, Destroyer>(pDynObject, longevity, d) ); + + // Find correct position + TrackerArray::iterator pos = std::upper_bound( + pTrackerArray->begin(), + pTrackerArray->end(), + p.get(), + LifetimeTracker::Compare); + + // Insert the pointer to the ConcreteLifetimeTracker object into the queue + pTrackerArray->insert(pos, p.get()); + + // nothing has thrown: don't delete the ConcreteLifetimeTracker object + p.release(); + + // Register a call to AtExitFn + std::atexit(Private::AtExitFn); +} #else - - template <typename T, typename Destroyer> - void SetLongevity(T* pDynObject, unsigned int longevity, - Destroyer d) - { - using namespace Private; - - TrackerArray pNewArray = static_cast<TrackerArray>( - std::realloc(pTrackerArray, - sizeof(*pTrackerArray) * (elements + 1))); - if (!pNewArray) throw std::bad_alloc(); - - // Delayed assignment for exception safety - pTrackerArray = pNewArray; - - LifetimeTracker* p = new ConcreteLifetimeTracker<T, Destroyer>( - pDynObject, longevity, d); - - // Insert a pointer to the object into the queue - TrackerArray pos = std::upper_bound( - pTrackerArray, - pTrackerArray + elements, - p, - LifetimeTracker::Compare); - std::copy_backward( - pos, - pTrackerArray + elements, - pTrackerArray + elements + 1); - *pos = p; - ++elements; - - // Register a call to AtExitFn - std::atexit(Private::AtExitFn); - } + +template <typename T, typename Destroyer> +void SetLongevity(T* pDynObject, unsigned int longevity, + Destroyer d) +{ + using namespace Private; + + TrackerArray pNewArray = static_cast<TrackerArray>( + std::realloc(pTrackerArray, + sizeof(*pTrackerArray) * (elements + 1))); + if (!pNewArray) throw std::bad_alloc(); + + // Delayed assignment for exception safety + pTrackerArray = pNewArray; + + LifetimeTracker* p = new ConcreteLifetimeTracker<T, Destroyer>( + pDynObject, longevity, d); + + // Insert a pointer to the object into the queue + TrackerArray pos = std::upper_bound( + pTrackerArray, + pTrackerArray + elements, + p, + LifetimeTracker::Compare); + std::copy_backward( + pos, + pTrackerArray + elements, + pTrackerArray + elements + 1); + *pos = p; + ++elements; + + // Register a call to AtExitFn + std::atexit(Private::AtExitFn); +} #endif - template <typename T> - void SetLongevity(T* pDynObject, unsigned int longevity, - typename Private::Deleter<T>::Type d = Private::Deleter<T>::Delete) - { - SetLongevity<T, typename Private::Deleter<T>::Type>(pDynObject, longevity, d); - } +template <typename T> +void SetLongevity(T* pDynObject, unsigned int longevity, + typename Private::Deleter<T>::Type d = Private::Deleter<T>::Delete) +{ + SetLongevity<T, typename Private::Deleter<T>::Type>(pDynObject, longevity, d); +} - //////////////////////////////////////////////////////////////////////////////// - /// \struct CreateUsingNew - /// - /// \ingroup CreationGroup - /// Implementation of the CreationPolicy used by SingletonHolder - /// Creates objects using a straight call to the new operator - //////////////////////////////////////////////////////////////////////////////// - template <class T> struct CreateUsingNew - { - static T* Create() - { return new T; } - - static void Destroy(T* p) - { delete p; } - }; - - //////////////////////////////////////////////////////////////////////////////// - /// \struct CreateUsing - /// - /// \ingroup CreationGroup - /// Implementation of the CreationPolicy used by SingletonHolder - /// Creates objects using a custom allocater. - /// Usage: e.g. CreateUsing<std::allocator>::Allocator - //////////////////////////////////////////////////////////////////////////////// - template<template<class> class Alloc> - struct CreateUsing - { - template <class T> - struct Allocator - { - static Alloc<T> allocator; +//////////////////////////////////////////////////////////////////////////////// +/// \struct CreateUsingNew +/// +/// \ingroup CreationGroup +/// Implementation of the CreationPolicy used by SingletonHolder +/// Creates objects using a straight call to the new operator +//////////////////////////////////////////////////////////////////////////////// +template <class T> struct CreateUsingNew +{ + static T* Create() + { return new T; } - static T* Create() - { - return new (allocator.allocate(1)) T; - } + static void Destroy(T* p) + { delete p; } +}; - static void Destroy(T* p) - { - //allocator.destroy(p); - p->~T(); - allocator.deallocate(p,1); - } - }; - }; - - //////////////////////////////////////////////////////////////////////////////// - /// \struct CreateUsingMalloc - /// - /// \ingroup CreationGroup - /// Implementation of the CreationPolicy used by SingletonHolder - /// Creates objects using a call to std::malloc, followed by a call to the - /// placement new operator - //////////////////////////////////////////////////////////////////////////////// - template <class T> struct CreateUsingMalloc +//////////////////////////////////////////////////////////////////////////////// +/// \struct CreateUsing +/// +/// \ingroup CreationGroup +/// Implementation of the CreationPolicy used by SingletonHolder +/// Creates objects using a custom allocater. +/// Usage: e.g. CreateUsing<std::allocator>::Allocator +//////////////////////////////////////////////////////////////////////////////// +template<template<class> class Alloc> +struct CreateUsing +{ + template <class T> + struct Allocator { + static Alloc<T> allocator; + static T* Create() { - void* p = std::malloc(sizeof(T)); - if (!p) return 0; - return new(p) T; + return new (allocator.allocate(1)) T; } - + static void Destroy(T* p) { + //allocator.destroy(p); p->~T(); - std::free(p); + allocator.deallocate(p,1); } }; - - - //////////////////////////////////////////////////////////////////////////////// - /// \struct CreateStatic - /// - /// \ingroup CreationGroup - /// Implementation of the CreationPolicy used by SingletonHolder - /// Creates an object in static memory - /// Implementation is slightly nonportable because it uses the MaxAlign trick - /// (an union of all types to ensure proper memory alignment). This trick is - /// nonportable in theory but highly portable in practice. - //////////////////////////////////////////////////////////////////////////////// - template <class T> struct CreateStatic +}; + +//////////////////////////////////////////////////////////////////////////////// +/// \struct CreateUsingMalloc +/// +/// \ingroup CreationGroup +/// Implementation of the CreationPolicy used by SingletonHolder +/// Creates objects using a call to std::malloc, followed by a call to the +/// placement new operator +//////////////////////////////////////////////////////////////////////////////// +template <class T> struct CreateUsingMalloc +{ + static T* Create() { - + void* p = std::malloc(sizeof(T)); + if (!p) return 0; + return new(p) T; + } + + static void Destroy(T* p) + { + p->~T(); + std::free(p); + } +}; + + +//////////////////////////////////////////////////////////////////////////////// +/// \struct CreateStatic +/// +/// \ingroup CreationGroup +/// Implementation of the CreationPolicy used by SingletonHolder +/// Creates an object in static memory +/// Implementation is slightly nonportable because it uses the MaxAlign trick +/// (an union of all types to ensure proper memory alignment). This trick is +/// nonportable in theory but highly portable in practice. +//////////////////////////////////////////////////////////////////////////////// +template <class T> struct CreateStatic +{ + #ifdef _MSC_VER -#pragma warning( push ) +#pragma warning( push ) #pragma warning( disable : 4121 ) -// alignment of a member was sensitive to packing + // alignment of a member was sensitive to packing #endif // _MSC_VER - union MaxAlign - { - char t_[sizeof(T)]; - short int shortInt_; - int int_; - long int longInt_; - float float_; - double double_; - long double longDouble_; - struct Test; - int Test::* pMember_; - int (Test::*pMemberFn_)(int); - }; - + union MaxAlign + { + char t_[sizeof(T)]; + short int shortInt_; + int int_; + long int longInt_; + float float_; + double double_; + long double longDouble_; + struct Test; + int Test::* pMember_; + int (Test::*pMemberFn_)(int); + }; + #ifdef _MSC_VER #pragma warning( pop ) #endif // _MSC_VER - - static T* Create() - { - static MaxAlign staticMemory_; - return new(&staticMemory_) T; - } - - static void Destroy(T* p) - { - p->~T(); - } - }; - //////////////////////////////////////////////////////////////////////////////// - /// \struct DefaultLifetime - /// - /// \ingroup LifetimeGroup - /// Implementation of the LifetimePolicy used by SingletonHolder - /// Schedules an object's destruction as per C++ rules - /// Forwards to std::atexit - //////////////////////////////////////////////////////////////////////////////// - template <class T> - struct DefaultLifetime + static T* Create() { - static void ScheduleDestruction(T*, atexit_pfn_t pFun) - { std::atexit(pFun); } - - static void OnDeadReference() - { throw std::logic_error("Dead Reference Detected"); } - }; + static MaxAlign staticMemory_; + return new(&staticMemory_) T; + } - //////////////////////////////////////////////////////////////////////////////// - /// \struct PhoenixSingleton - /// - /// \ingroup LifetimeGroup - /// Implementation of the LifetimePolicy used by SingletonHolder - /// Schedules an object's destruction as per C++ rules, and it allows object - /// recreation by not throwing an exception from OnDeadReference - //////////////////////////////////////////////////////////////////////////////// - template <class T> - class PhoenixSingleton + static void Destroy(T* p) + { + p->~T(); + } +}; + +//////////////////////////////////////////////////////////////////////////////// +/// \struct DefaultLifetime +/// +/// \ingroup LifetimeGroup +/// Implementation of the LifetimePolicy used by SingletonHolder +/// Schedules an object's destruction as per C++ rules +/// Forwards to std::atexit +//////////////////////////////////////////////////////////////////////////////// +template <class T> +struct DefaultLifetime +{ + static void ScheduleDestruction(T*, atexit_pfn_t pFun) + { std::atexit(pFun); } + + static void OnDeadReference() + { throw std::logic_error("Dead Reference Detected"); } +}; + +//////////////////////////////////////////////////////////////////////////////// +/// \struct PhoenixSingleton +/// +/// \ingroup LifetimeGroup +/// Implementation of the LifetimePolicy used by SingletonHolder +/// Schedules an object's destruction as per C++ rules, and it allows object +/// recreation by not throwing an exception from OnDeadReference +//////////////////////////////////////////////////////////////////////////////// +template <class T> +class PhoenixSingleton +{ +public: + static void ScheduleDestruction(T*, atexit_pfn_t pFun) { - public: - static void ScheduleDestruction(T*, atexit_pfn_t pFun) - { #ifndef ATEXIT_FIXED - if (!destroyedOnce_) + if (!destroyedOnce_) #endif - std::atexit(pFun); - } - - static void OnDeadReference() - { + std::atexit(pFun); + } + + static void OnDeadReference() + { #ifndef ATEXIT_FIXED - destroyedOnce_ = true; + destroyedOnce_ = true; #endif - } - - private: + } + +private: #ifndef ATEXIT_FIXED - static bool destroyedOnce_; + static bool destroyedOnce_; #endif - }; - +}; + #ifndef ATEXIT_FIXED - template <class T> bool PhoenixSingleton<T>::destroyedOnce_ = false; +template <class T> bool PhoenixSingleton<T>::destroyedOnce_ = false; #endif - //////////////////////////////////////////////////////////////////////////////// - // Copyright (c) 2004 by Curtis Krauskopf - curtis@decompile.com - /// - /// \struct DeletableSingleton - /// - /// \ingroup LifetimeGroup - /// - /// A DeletableSingleton allows the instantiated singleton to be - /// destroyed at any time. The singleton can be reinstantiated at - /// any time, even during program termination. - /// If the singleton exists when the program terminates, it will - /// be automatically deleted. - /// - /// \par Usage: - /// The singleton can be deleted manually: - /// - /// DeletableSingleton<MyClass>::GracefulDelete(); - //////////////////////////////////////////////////////////////////////////////// - template <class T> - class DeletableSingleton - { - public: +//////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2004 by Curtis Krauskopf - curtis@decompile.com +/// +/// \struct DeletableSingleton +/// +/// \ingroup LifetimeGroup +/// +/// A DeletableSingleton allows the instantiated singleton to be +/// destroyed at any time. The singleton can be reinstantiated at +/// any time, even during program termination. +/// If the singleton exists when the program terminates, it will +/// be automatically deleted. +/// +/// \par Usage: +/// The singleton can be deleted manually: +/// +/// DeletableSingleton<MyClass>::GracefulDelete(); +//////////////////////////////////////////////////////////////////////////////// +template <class T> +class DeletableSingleton +{ +public: - static void ScheduleDestruction(T*, atexit_pfn_t pFun) - { - static bool firstPass = true; - isDead = false; - deleter = pFun; - if (firstPass || needCallback) - { - std::atexit(atexitCallback); - firstPass = false; - needCallback = false; - } - } - - static void OnDeadReference() - { - } - /// delete singleton object manually - static void GracefulDelete() + static void ScheduleDestruction(T*, atexit_pfn_t pFun) + { + static bool firstPass = true; + isDead = false; + deleter = pFun; + if (firstPass || needCallback) { - if (isDead) - return; - isDead = true; - deleter(); + std::atexit(atexitCallback); + firstPass = false; + needCallback = false; } - - protected: - static atexit_pfn_t deleter; - static bool isDead; - static bool needCallback; - - static void atexitCallback() - { + } + + static void OnDeadReference() + { + } + /// delete singleton object manually + static void GracefulDelete() + { + if (isDead) + return; + isDead = true; + deleter(); + } + +protected: + static atexit_pfn_t deleter; + static bool isDead; + static bool needCallback; + + static void atexitCallback() + { #ifdef ATEXIT_FIXED - needCallback = true; + needCallback = true; #else - needCallback = false; + needCallback = false; #endif - GracefulDelete(); - } - }; - - template <class T> - atexit_pfn_t DeletableSingleton<T>::deleter = 0; - - template <class T> - bool DeletableSingleton<T>::isDead = true; - - template <class T> - bool DeletableSingleton<T>::needCallback = true; + GracefulDelete(); + } +}; + +template <class T> +atexit_pfn_t DeletableSingleton<T>::deleter = 0; + +template <class T> +bool DeletableSingleton<T>::isDead = true; + +template <class T> +bool DeletableSingleton<T>::needCallback = true; - //////////////////////////////////////////////////////////////////////////////// - // class template Adapter - // Helper for SingletonWithLongevity below - //////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// class template Adapter +// Helper for SingletonWithLongevity below +//////////////////////////////////////////////////////////////////////////////// + +namespace Private +{ +template <class T> +struct Adapter +{ + void operator()(T*) { return pFun_(); } + atexit_pfn_t pFun_; +}; +} - namespace Private +//////////////////////////////////////////////////////////////////////////////// +/// \struct SingletonWithLongevity +/// +/// \ingroup LifetimeGroup +/// Implementation of the LifetimePolicy used by SingletonHolder +/// Schedules an object's destruction in order of their longevities +/// Assumes a visible function GetLongevity(T*) that returns the longevity of the +/// object. +//////////////////////////////////////////////////////////////////////////////// +template <class T> +class SingletonWithLongevity +{ +public: + static void ScheduleDestruction(T* pObj, atexit_pfn_t pFun) { - template <class T> - struct Adapter - { - void operator()(T*) { return pFun_(); } - atexit_pfn_t pFun_; - }; + Private::Adapter<T> adapter = { pFun }; + SetLongevity(pObj, GetLongevity(pObj), adapter); } - //////////////////////////////////////////////////////////////////////////////// - /// \struct SingletonWithLongevity - /// - /// \ingroup LifetimeGroup - /// Implementation of the LifetimePolicy used by SingletonHolder - /// Schedules an object's destruction in order of their longevities - /// Assumes a visible function GetLongevity(T*) that returns the longevity of the - /// object. - //////////////////////////////////////////////////////////////////////////////// - template <class T> - class SingletonWithLongevity + static void OnDeadReference() + { throw std::logic_error("Dead Reference Detected"); } +}; + +//////////////////////////////////////////////////////////////////////////////// +/// \struct NoDestroy +/// +/// \ingroup LifetimeGroup +/// Implementation of the LifetimePolicy used by SingletonHolder +/// Never destroys the object +//////////////////////////////////////////////////////////////////////////////// +template <class T> +struct NoDestroy +{ + static void ScheduleDestruction(T*, atexit_pfn_t) + {} + + static void OnDeadReference() + {} +}; + + +//////////////////////////////////////////////////////////////////////////////// +/// \defgroup LongevityLifetimeGroup LongevityLifetime +/// \ingroup LifetimeGroup +/// +/// \namespace LongevityLifetime +/// +/// \ingroup LongevityLifetimeGroup +/// \brief In this namespace are special lifetime policies to manage lifetime +/// dependencies. +//////////////////////////////////////////////////////////////////////////////// +namespace LongevityLifetime +{ +//////////////////////////////////////////////////////////////////////////////// +/// \struct SingletonFixedLongevity +/// +/// \ingroup LongevityLifetimeGroup +/// Add your own lifetimes into the namespace 'LongevityLifetime' +/// with your prefered lifetime by adding a struct like this: +/// +/// template<class T> +/// struct MyLifetime : SingletonFixedLongevity< MyLifetimeNumber ,T> {} +//////////////////////////////////////////////////////////////////////////////// +template <unsigned int Longevity, class T> +class SingletonFixedLongevity +{ +public: + virtual ~SingletonFixedLongevity() {} + + static void ScheduleDestruction(T* pObj, atexit_pfn_t pFun) + { + Private::Adapter<T> adapter = { pFun }; + SetLongevity(pObj, Longevity , adapter); + } + + static void OnDeadReference() + { throw std::logic_error("Dead Reference Detected"); } +}; + +/// \struct DieLast +/// \ingroup LongevityLifetimeGroup +/// \brief Longest possible SingletonWithLongevity lifetime: 0xFFFFFFFF +template <class T> +struct DieLast : SingletonFixedLongevity<0xFFFFFFFF ,T> + {}; + +/// \struct DieDirectlyBeforeLast +/// \ingroup LongevityLifetimeGroup +/// \brief Lifetime is a one less than DieLast: 0xFFFFFFFF-1 +template <class T> +struct DieDirectlyBeforeLast : SingletonFixedLongevity<0xFFFFFFFF-1 ,T> + {}; + +/// \struct DieFirst +/// \ingroup LongevityLifetimeGroup +/// \brief Shortest possible SingletonWithLongevity lifetime: 0 +template <class T> +struct DieFirst : SingletonFixedLongevity<0,T> + {}; + +}//namespace LongevityLifetime + +//////////////////////////////////////////////////////////////////////////////// +/// \class FollowIntoDeath +/// +/// \ingroup LifetimeGroup +/// +/// Lifetime policyfor the SingletonHolder tempalte. +/// Followers will die after the master dies Followers will not die, if +/// - master never dies (NoDestroy policy) +/// - master never created +/// - master dies not in the function registered with atexit +/// - master dies not by a call of a the atexit registerd function (DeletableSingleton::GracefulDelete) +/// +/// \par Usage: +/// +/// Lifetimes of the master and the follower singletons, e.g. with a M and a F class: +/// \code SingletonHolder< M , FollowIntoDeath::With<DefaultLifetime>::AsMasterLifetime > MasterSingleton; \endcode +/// \code SingletonHolder< F , CreateUsingNew, FollowIntoDeath::AfterMaster< MasterSingleton >::IsDestroyed > FollowerSingleton \endcode +//////////////////////////////////////////////////////////////////////////////// +class FollowIntoDeath +{ + template<class T> + class Followers { + typedef std::vector<atexit_pfn_t> Container; + typedef typename Container::iterator iterator; + static Container* followers_; + public: - static void ScheduleDestruction(T* pObj, atexit_pfn_t pFun) + static void Init() + { + static bool done = false; + if(!done) + { + followers_ = new Container; + done = true; + } + } + + static void AddFollower(atexit_pfn_t ae) { - Private::Adapter<T> adapter = { pFun }; - SetLongevity(pObj, GetLongevity(pObj), adapter); + Init(); + followers_->push_back(ae); } - - static void OnDeadReference() - { throw std::logic_error("Dead Reference Detected"); } - }; - //////////////////////////////////////////////////////////////////////////////// - /// \struct NoDestroy - /// - /// \ingroup LifetimeGroup - /// Implementation of the LifetimePolicy used by SingletonHolder - /// Never destroys the object - //////////////////////////////////////////////////////////////////////////////// - template <class T> - struct NoDestroy - { - static void ScheduleDestruction(T*, atexit_pfn_t) - {} - - static void OnDeadReference() - {} + static void DestroyFollowers() + { + Init(); + for(iterator it = followers_->begin(); it != followers_->end(); ++it) + (*it)(); + delete followers_; + } }; - - - //////////////////////////////////////////////////////////////////////////////// - /// \defgroup LongevityLifetimeGroup LongevityLifetime - /// \ingroup LifetimeGroup - /// - /// \namespace LongevityLifetime - /// - /// \ingroup LongevityLifetimeGroup - /// \brief In this namespace are special lifetime policies to manage lifetime - /// dependencies. - //////////////////////////////////////////////////////////////////////////////// - namespace LongevityLifetime + +public: + + /// \struct With + /// Template for the master + /// \param Lifetime Lifetime policy for the master + template<template <class> class Lifetime> + struct With { - //////////////////////////////////////////////////////////////////////////////// - /// \struct SingletonFixedLongevity - /// - /// \ingroup LongevityLifetimeGroup - /// Add your own lifetimes into the namespace 'LongevityLifetime' - /// with your prefered lifetime by adding a struct like this: - /// - /// template<class T> - /// struct MyLifetime : SingletonFixedLongevity< MyLifetimeNumber ,T> {} - //////////////////////////////////////////////////////////////////////////////// - template <unsigned int Longevity, class T> - class SingletonFixedLongevity + /// \struct AsMasterLifetime + /// Policy for master + template<class Master> + struct AsMasterLifetime { - public: - virtual ~SingletonFixedLongevity() {} - - static void ScheduleDestruction(T* pObj, atexit_pfn_t pFun) + static void ScheduleDestruction(Master* pObj, atexit_pfn_t pFun) { - Private::Adapter<T> adapter = { pFun }; - SetLongevity(pObj, Longevity , adapter); + Followers<Master>::Init(); + Lifetime<Master>::ScheduleDestruction(pObj, pFun); + + // use same policy for the followers and force a new + // template instantiation, this adds a additional atexit entry + // does not work with SetLonlevity, but there you can control + // the lifetime with the GetLongevity function. + Lifetime<Followers<Master> >::ScheduleDestruction(0,Followers<Master>::DestroyFollowers); } - + static void OnDeadReference() - { throw std::logic_error("Dead Reference Detected"); } + { + throw std::logic_error("Dead Reference Detected"); + } }; + }; - /// \struct DieLast - /// \ingroup LongevityLifetimeGroup - /// \brief Longest possible SingletonWithLongevity lifetime: 0xFFFFFFFF - template <class T> - struct DieLast : SingletonFixedLongevity<0xFFFFFFFF ,T> - {}; - - /// \struct DieDirectlyBeforeLast - /// \ingroup LongevityLifetimeGroup - /// \brief Lifetime is a one less than DieLast: 0xFFFFFFFF-1 - template <class T> - struct DieDirectlyBeforeLast : SingletonFixedLongevity<0xFFFFFFFF-1 ,T> - {}; - - /// \struct DieFirst - /// \ingroup LongevityLifetimeGroup - /// \brief Shortest possible SingletonWithLongevity lifetime: 0 - template <class T> - struct DieFirst : SingletonFixedLongevity<0,T> - {}; - - }//namespace LongevityLifetime - - //////////////////////////////////////////////////////////////////////////////// - /// \class FollowIntoDeath - /// - /// \ingroup LifetimeGroup - /// - /// Lifetime policyfor the SingletonHolder tempalte. - /// Followers will die after the master dies Followers will not die, if - /// - master never dies (NoDestroy policy) - /// - master never created - /// - master dies not in the function registered with atexit - /// - master dies not by a call of a the atexit registerd function (DeletableSingleton::GracefulDelete) - /// - /// \par Usage: - /// - /// Lifetimes of the master and the follower singletons, e.g. with a M and a F class: - /// \code SingletonHolder< M , FollowIntoDeath::With<DefaultLifetime>::AsMasterLifetime > MasterSingleton; \endcode - /// \code SingletonHolder< F , CreateUsingNew, FollowIntoDeath::AfterMaster< MasterSingleton >::IsDestroyed > FollowerSingleton \endcode - //////////////////////////////////////////////////////////////////////////////// - class FollowIntoDeath + /// \struct AfterMaster + /// Template for the follower + /// \param Master Master to follow into death + template<class Master> + struct AfterMaster { - template<class T> - class Followers + /// \struct IsDestroyed + /// Policy for followers + template<class F> + struct IsDestroyed { - typedef std::vector<atexit_pfn_t> Container; - typedef typename Container::iterator iterator; - static Container* followers_; - - public: - static void Init() + static void ScheduleDestruction(F*, atexit_pfn_t pFun) { - static bool done = false; - if(!done) - { - followers_ = new Container; - done = true; - } + Followers<Master>::AddFollower(pFun); } - static void AddFollower(atexit_pfn_t ae) - { - Init(); - followers_->push_back(ae); - } - - static void DestroyFollowers() + static void OnDeadReference() { - Init(); - for(iterator it = followers_->begin();it != followers_->end();++it) - (*it)(); - delete followers_; + throw std::logic_error("Dead Reference Detected"); } }; + }; +}; - public: +template<class T> +typename FollowIntoDeath::Followers<T>::Container* +FollowIntoDeath::Followers<T>::followers_ = 0; - /// \struct With - /// Template for the master - /// \param Lifetime Lifetime policy for the master - template<template <class> class Lifetime> - struct With - { - /// \struct AsMasterLifetime - /// Policy for master - template<class Master> - struct AsMasterLifetime - { - static void ScheduleDestruction(Master* pObj, atexit_pfn_t pFun) - { - Followers<Master>::Init(); - Lifetime<Master>::ScheduleDestruction(pObj, pFun); - - // use same policy for the followers and force a new - // template instantiation, this adds a additional atexit entry - // does not work with SetLonlevity, but there you can control - // the lifetime with the GetLongevity function. - Lifetime<Followers<Master> >::ScheduleDestruction(0,Followers<Master>::DestroyFollowers); - } - - static void OnDeadReference() - { - throw std::logic_error("Dead Reference Detected"); - } - }; - }; - /// \struct AfterMaster - /// Template for the follower - /// \param Master Master to follow into death - template<class Master> - struct AfterMaster - { - /// \struct IsDestroyed - /// Policy for followers - template<class F> - struct IsDestroyed - { - static void ScheduleDestruction(F*, atexit_pfn_t pFun) - { - Followers<Master>::AddFollower(pFun); - } - - static void OnDeadReference() - { - throw std::logic_error("Dead Reference Detected"); - } - }; - }; - }; - template<class T> - typename FollowIntoDeath::Followers<T>::Container* - FollowIntoDeath::Followers<T>::followers_ = 0; - - - - //////////////////////////////////////////////////////////////////////////////// - /// \class SingletonHolder - /// - /// \ingroup SingletonGroup - /// - /// Provides Singleton amenities for a type T - /// To protect that type from spurious instantiations, - /// you have to protect it yourself. - /// - /// \param CreationPolicy Creation policy, default: CreateUsingNew - /// \param LifetimePolicy Lifetime policy, default: DefaultLifetime, - /// \param ThreadingModel Threading policy, - /// default: LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL - //////////////////////////////////////////////////////////////////////////////// - template - < - typename T, - template <class> class CreationPolicy = CreateUsingNew, - template <class> class LifetimePolicy = DefaultLifetime, - template <class, class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL, - class MutexPolicy = LOKI_DEFAULT_MUTEX - > - class SingletonHolder - { - public: +//////////////////////////////////////////////////////////////////////////////// +/// \class SingletonHolder +/// +/// \ingroup SingletonGroup +/// +/// Provides Singleton amenities for a type T +/// To protect that type from spurious instantiations, +/// you have to protect it yourself. +/// +/// \param CreationPolicy Creation policy, default: CreateUsingNew +/// \param LifetimePolicy Lifetime policy, default: DefaultLifetime, +/// \param ThreadingModel Threading policy, +/// default: LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL +//////////////////////////////////////////////////////////////////////////////// +template +< +typename T, + template <class> class CreationPolicy = CreateUsingNew, + template <class> class LifetimePolicy = DefaultLifetime, + template <class, class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL, + class MutexPolicy = LOKI_DEFAULT_MUTEX + > +class SingletonHolder +{ +public: - /// Type of the singleton object - typedef T ObjectType; - - /// Returns a reference to singleton object - static T& Instance(); - - private: - // Helpers - static void MakeInstance(); - static void LOKI_C_CALLING_CONVENTION_QUALIFIER DestroySingleton(); - - // Protection - SingletonHolder(); - - // Data - typedef typename ThreadingModel<T*,MutexPolicy>::VolatileType PtrInstanceType; - static PtrInstanceType pInstance_; - static bool destroyed_; - }; - - //////////////////////////////////////////////////////////////////////////////// - // SingletonHolder's data - //////////////////////////////////////////////////////////////////////////////// - - template - < - class T, - template <class> class C, - template <class> class L, - template <class, class> class M, - class X - > - typename SingletonHolder<T, C, L, M, X>::PtrInstanceType - SingletonHolder<T, C, L, M, X>::pInstance_ = 0; - - template - < - class T, - template <class> class C, - template <class> class L, - template <class, class> class M, - class X - > - bool SingletonHolder<T, C, L, M, X>::destroyed_ = false; - - //////////////////////////////////////////////////////////////////////////////// - // SingletonHolder::Instance - //////////////////////////////////////////////////////////////////////////////// - - template - < - class T, - template <class> class CreationPolicy, - template <class> class LifetimePolicy, - template <class, class> class ThreadingModel, - class MutexPolicy - > - inline T& SingletonHolder<T, CreationPolicy, - LifetimePolicy, ThreadingModel, MutexPolicy>::Instance() + /// Type of the singleton object + typedef T ObjectType; + + /// Returns a reference to singleton object + static T& Instance(); + +private: + // Helpers + static void MakeInstance(); + static void LOKI_C_CALLING_CONVENTION_QUALIFIER DestroySingleton(); + + // Protection + SingletonHolder(); + + // Data + typedef typename ThreadingModel<T*,MutexPolicy>::VolatileType PtrInstanceType; + static PtrInstanceType pInstance_; + static bool destroyed_; +}; + +//////////////////////////////////////////////////////////////////////////////// +// SingletonHolder's data +//////////////////////////////////////////////////////////////////////////////// + +template +< +class T, + template <class> class C, + template <class> class L, + template <class, class> class M, + class X + > +typename SingletonHolder<T, C, L, M, X>::PtrInstanceType +SingletonHolder<T, C, L, M, X>::pInstance_ = 0; + +template +< +class T, + template <class> class C, + template <class> class L, + template <class, class> class M, + class X + > +bool SingletonHolder<T, C, L, M, X>::destroyed_ = false; + +//////////////////////////////////////////////////////////////////////////////// +// SingletonHolder::Instance +//////////////////////////////////////////////////////////////////////////////// + +template +< +class T, + template <class> class CreationPolicy, + template <class> class LifetimePolicy, + template <class, class> class ThreadingModel, + class MutexPolicy + > +inline T& SingletonHolder<T, CreationPolicy, + LifetimePolicy, ThreadingModel, MutexPolicy>::Instance() +{ + if (!pInstance_) { - if (!pInstance_) - { - MakeInstance(); - } - return *pInstance_; + MakeInstance(); } + return *pInstance_; +} + +//////////////////////////////////////////////////////////////////////////////// +// SingletonHolder::MakeInstance (helper for Instance) +//////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - // SingletonHolder::MakeInstance (helper for Instance) - //////////////////////////////////////////////////////////////////////////////// - - template - < - class T, - template <class> class CreationPolicy, - template <class> class LifetimePolicy, - template <class, class> class ThreadingModel, - class MutexPolicy - > - void SingletonHolder<T, CreationPolicy, - LifetimePolicy, ThreadingModel, MutexPolicy>::MakeInstance() +template +< +class T, +template <class> class CreationPolicy, +template <class> class LifetimePolicy, +template <class, class> class ThreadingModel, +class MutexPolicy +> +void SingletonHolder<T, CreationPolicy, + LifetimePolicy, ThreadingModel, MutexPolicy>::MakeInstance() +{ + typename ThreadingModel<SingletonHolder,MutexPolicy>::Lock guard; + (void)guard; + + if (!pInstance_) { - typename ThreadingModel<SingletonHolder,MutexPolicy>::Lock guard; - (void)guard; - - if (!pInstance_) + if (destroyed_) { - if (destroyed_) - { - destroyed_ = false; - LifetimePolicy<T>::OnDeadReference(); - } - pInstance_ = CreationPolicy<T>::Create(); - LifetimePolicy<T>::ScheduleDestruction(pInstance_, - &DestroySingleton); + destroyed_ = false; + LifetimePolicy<T>::OnDeadReference(); } + pInstance_ = CreationPolicy<T>::Create(); + LifetimePolicy<T>::ScheduleDestruction(pInstance_, + &DestroySingleton); } +} - template - < - class T, - template <class> class CreationPolicy, - template <class> class L, - template <class, class> class M, - class X - > - void LOKI_C_CALLING_CONVENTION_QUALIFIER - SingletonHolder<T, CreationPolicy, L, M, X>::DestroySingleton() - { - assert(!destroyed_); - CreationPolicy<T>::Destroy(pInstance_); - pInstance_ = 0; - destroyed_ = true; - } +template +< +class T, +template <class> class CreationPolicy, +template <class> class L, +template <class, class> class M, +class X +> +void LOKI_C_CALLING_CONVENTION_QUALIFIER +SingletonHolder<T, CreationPolicy, L, M, X>::DestroySingleton() +{ + assert(!destroyed_); + CreationPolicy<T>::Destroy(pInstance_); + pInstance_ = 0; + destroyed_ = true; +} - //////////////////////////////////////////////////////////////////////////////// - /// \class Singleton - /// - /// \ingroup SingletonGroup - /// - /// Convenience template to implement a getter function for a singleton object. - /// Often needed in a shared library which hosts singletons. - /// - /// \par Usage - /// - /// see test/SingletonDll - /// - //////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +/// \class Singleton +/// +/// \ingroup SingletonGroup +/// +/// Convenience template to implement a getter function for a singleton object. +/// Often needed in a shared library which hosts singletons. +/// +/// \par Usage +/// +/// see test/SingletonDll +/// +//////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_SINGLETON_EXPORT #define LOKI_SINGLETON_EXPORT #endif - template<class T> - class LOKI_SINGLETON_EXPORT Singleton - { - public: - static T& Instance(); - }; +template<class T> +class LOKI_SINGLETON_EXPORT Singleton +{ +public: + static T& Instance(); +}; } // namespace Loki diff --git a/shared/loki/SmallObj.cpp b/shared/loki/SmallObj.cpp index adb54c55..0d82c1bb 100644 --- a/shared/loki/SmallObj.cpp +++ b/shared/loki/SmallObj.cpp @@ -28,274 +28,274 @@ //#define LOKI_CHECK_FOR_CORRUPTION #ifdef DO_EXTRA_LOKI_TESTS - #include <iostream> +#include <iostream> #endif namespace Loki { - /** @struct Chunk - @ingroup SmallObjectGroupInternal - Contains info about each allocated Chunk - which is a collection of - contiguous blocks. Each block is the same size, as specified by the - FixedAllocator. The number of blocks in a Chunk depends upon page size. - This is a POD-style struct with value-semantics. All functions and data - are private so that they can not be changed by anything other than the - FixedAllocator which owns the Chunk. - - @par Minimal Interface - For the sake of runtime efficiency, no constructor, destructor, or - copy-assignment operator is defined. The inline functions made by the - compiler should be sufficient, and perhaps faster than hand-crafted - functions. The lack of these functions allows vector to create and copy - Chunks as needed without overhead. The Init and Release functions do - what the default constructor and destructor would do. A Chunk is not in - a usable state after it is constructed and before calling Init. Nor is - a Chunk usable after Release is called, but before the destructor. - - @par Efficiency - Down near the lowest level of the allocator, runtime efficiencies trump - almost all other considerations. Each function does the minimum required - of it. All functions should execute in constant time to prevent higher- - level code from unwittingly using a version of Shlemiel the Painter's - Algorithm. - - @par Stealth Indexes - The first char of each empty block contains the index of the next empty - block. These stealth indexes form a singly-linked list within the blocks. - A Chunk is corrupt if this singly-linked list has a loop or is shorter - than blocksAvailable_. Much of the allocator's time and space efficiency - comes from how these stealth indexes are implemented. +/** @struct Chunk + @ingroup SmallObjectGroupInternal + Contains info about each allocated Chunk - which is a collection of + contiguous blocks. Each block is the same size, as specified by the + FixedAllocator. The number of blocks in a Chunk depends upon page size. + This is a POD-style struct with value-semantics. All functions and data + are private so that they can not be changed by anything other than the + FixedAllocator which owns the Chunk. + + @par Minimal Interface + For the sake of runtime efficiency, no constructor, destructor, or + copy-assignment operator is defined. The inline functions made by the + compiler should be sufficient, and perhaps faster than hand-crafted + functions. The lack of these functions allows vector to create and copy + Chunks as needed without overhead. The Init and Release functions do + what the default constructor and destructor would do. A Chunk is not in + a usable state after it is constructed and before calling Init. Nor is + a Chunk usable after Release is called, but before the destructor. + + @par Efficiency + Down near the lowest level of the allocator, runtime efficiencies trump + almost all other considerations. Each function does the minimum required + of it. All functions should execute in constant time to prevent higher- + level code from unwittingly using a version of Shlemiel the Painter's + Algorithm. + + @par Stealth Indexes + The first char of each empty block contains the index of the next empty + block. These stealth indexes form a singly-linked list within the blocks. + A Chunk is corrupt if this singly-linked list has a loop or is shorter + than blocksAvailable_. Much of the allocator's time and space efficiency + comes from how these stealth indexes are implemented. + */ +class Chunk +{ +private: + friend class FixedAllocator; + + /** Initializes a just-constructed Chunk. + @param blockSize Number of bytes per block. + @param blocks Number of blocks per Chunk. + @return True for success, false for failure. */ - class Chunk - { - private: - friend class FixedAllocator; + bool Init( std::size_t blockSize, unsigned char blocks ); - /** Initializes a just-constructed Chunk. - @param blockSize Number of bytes per block. - @param blocks Number of blocks per Chunk. - @return True for success, false for failure. - */ - bool Init( std::size_t blockSize, unsigned char blocks ); + /** Allocate a block within the Chunk. Complexity is always O(1), and + this will never throw. Does not actually "allocate" by calling + malloc, new, or any other function, but merely adjusts some internal + indexes to indicate an already allocated block is no longer available. + @return Pointer to block within Chunk. + */ + void* Allocate( std::size_t blockSize ); + + /** Deallocate a block within the Chunk. Complexity is always O(1), and + this will never throw. For efficiency, this assumes the address is + within the block and aligned along the correct byte boundary. An + assertion checks the alignment, and a call to HasBlock is done from + within VicinityFind. Does not actually "deallocate" by calling free, + delete, or other function, but merely adjusts some internal indexes to + indicate a block is now available. + */ + void Deallocate( void* p, std::size_t blockSize ); - /** Allocate a block within the Chunk. Complexity is always O(1), and - this will never throw. Does not actually "allocate" by calling - malloc, new, or any other function, but merely adjusts some internal - indexes to indicate an already allocated block is no longer available. - @return Pointer to block within Chunk. - */ - void * Allocate( std::size_t blockSize ); - - /** Deallocate a block within the Chunk. Complexity is always O(1), and - this will never throw. For efficiency, this assumes the address is - within the block and aligned along the correct byte boundary. An - assertion checks the alignment, and a call to HasBlock is done from - within VicinityFind. Does not actually "deallocate" by calling free, - delete, or other function, but merely adjusts some internal indexes to - indicate a block is now available. - */ - void Deallocate( void * p, std::size_t blockSize ); + /** Resets the Chunk back to pristine values. The available count is + set back to zero, and the first available index is set to the zeroth + block. The stealth indexes inside each block are set to point to the + next block. This assumes the Chunk's data was already using Init. + */ + void Reset( std::size_t blockSize, unsigned char blocks ); + + /// Releases the allocated block of memory. + void Release(); + + /** Determines if the Chunk has been corrupted. + @param numBlocks Total # of blocks in the Chunk. + @param blockSize # of bytes in each block. + @param checkIndexes True if caller wants to check indexes of available + blocks for corruption. If false, then caller wants to skip some + tests tests just to run faster. (Debug version does more checks, but + release version runs faster.) + @return True if Chunk is corrupt. + */ + bool IsCorrupt( unsigned char numBlocks, std::size_t blockSize, + bool checkIndexes ) const; + + /** Determines if block is available. + @param p Address of block managed by Chunk. + @param numBlocks Total # of blocks in the Chunk. + @param blockSize # of bytes in each block. + @return True if block is available, else false if allocated. + */ + bool IsBlockAvailable( void* p, unsigned char numBlocks, + std::size_t blockSize ) const; - /** Resets the Chunk back to pristine values. The available count is - set back to zero, and the first available index is set to the zeroth - block. The stealth indexes inside each block are set to point to the - next block. This assumes the Chunk's data was already using Init. - */ - void Reset( std::size_t blockSize, unsigned char blocks ); - - /// Releases the allocated block of memory. - void Release(); - - /** Determines if the Chunk has been corrupted. - @param numBlocks Total # of blocks in the Chunk. - @param blockSize # of bytes in each block. - @param checkIndexes True if caller wants to check indexes of available - blocks for corruption. If false, then caller wants to skip some - tests tests just to run faster. (Debug version does more checks, but - release version runs faster.) - @return True if Chunk is corrupt. - */ - bool IsCorrupt( unsigned char numBlocks, std::size_t blockSize, - bool checkIndexes ) const; - - /** Determines if block is available. - @param p Address of block managed by Chunk. - @param numBlocks Total # of blocks in the Chunk. - @param blockSize # of bytes in each block. - @return True if block is available, else false if allocated. - */ - bool IsBlockAvailable( void * p, unsigned char numBlocks, - std::size_t blockSize ) const; + /// Returns true if block at address P is inside this Chunk. + inline bool HasBlock( void* p, std::size_t chunkLength ) const + { + unsigned char* pc = static_cast< unsigned char* >( p ); + return ( pData_ <= pc ) && ( pc < pData_ + chunkLength ); + } - /// Returns true if block at address P is inside this Chunk. - inline bool HasBlock( void * p, std::size_t chunkLength ) const - { - unsigned char * pc = static_cast< unsigned char * >( p ); - return ( pData_ <= pc ) && ( pc < pData_ + chunkLength ); - } + inline bool HasAvailable( unsigned char numBlocks ) const + { return ( blocksAvailable_ == numBlocks ); } + + inline bool IsFilled( void ) const + { return ( 0 == blocksAvailable_ ); } + + /// Pointer to array of allocated blocks. + unsigned char* pData_; + /// Index of first empty block. + unsigned char firstAvailableBlock_; + /// Count of empty blocks. + unsigned char blocksAvailable_; +}; + +/** @class FixedAllocator + @ingroup SmallObjectGroupInternal + Offers services for allocating fixed-sized objects. It has a container + of "containers" of fixed-size blocks. The outer container has all the + Chunks. The inner container is a Chunk which owns some blocks. + + @par Class Level Invariants + - There is always either zero or one Chunk which is empty. + - If this has no empty Chunk, then emptyChunk_ is NULL. + - If this has an empty Chunk, then emptyChunk_ points to it. + - If the Chunk container is empty, then deallocChunk_ and allocChunk_ + are NULL. + - If the Chunk container is not-empty, then deallocChunk_ and allocChunk_ + are either NULL or point to Chunks within the container. + - allocChunk_ will often point to the last Chunk in the container since + it was likely allocated most recently, and therefore likely to have an + available block. + */ +class FixedAllocator +{ +private: - inline bool HasAvailable( unsigned char numBlocks ) const - { return ( blocksAvailable_ == numBlocks ); } - - inline bool IsFilled( void ) const - { return ( 0 == blocksAvailable_ ); } - - /// Pointer to array of allocated blocks. - unsigned char * pData_; - /// Index of first empty block. - unsigned char firstAvailableBlock_; - /// Count of empty blocks. - unsigned char blocksAvailable_; - }; - - /** @class FixedAllocator - @ingroup SmallObjectGroupInternal - Offers services for allocating fixed-sized objects. It has a container - of "containers" of fixed-size blocks. The outer container has all the - Chunks. The inner container is a Chunk which owns some blocks. - - @par Class Level Invariants - - There is always either zero or one Chunk which is empty. - - If this has no empty Chunk, then emptyChunk_ is NULL. - - If this has an empty Chunk, then emptyChunk_ points to it. - - If the Chunk container is empty, then deallocChunk_ and allocChunk_ - are NULL. - - If the Chunk container is not-empty, then deallocChunk_ and allocChunk_ - are either NULL or point to Chunks within the container. - - allocChunk_ will often point to the last Chunk in the container since - it was likely allocated most recently, and therefore likely to have an - available block. + /** Deallocates the block at address p, and then handles the internal + bookkeeping needed to maintain class invariants. This assumes that + deallocChunk_ points to the correct chunk. */ - class FixedAllocator - { - private: - - /** Deallocates the block at address p, and then handles the internal - bookkeeping needed to maintain class invariants. This assumes that - deallocChunk_ points to the correct chunk. - */ - void DoDeallocate( void * p ); + void DoDeallocate( void* p ); - /** Creates an empty Chunk and adds it to the end of the ChunkList. - All calls to the lower-level memory allocation functions occur inside - this function, and so the only try-catch block is inside here. - @return true for success, false for failure. - */ - bool MakeNewChunk( void ); - - /** Finds the Chunk which owns the block at address p. It starts at - deallocChunk_ and searches in both forwards and backwards directions - from there until it finds the Chunk which owns p. This algorithm - should find the Chunk quickly if it is deallocChunk_ or is close to it - in the Chunks container. This goes both forwards and backwards since - that works well for both same-order and opposite-order deallocations. - (Same-order = objects are deallocated in the same order in which they - were allocated. Opposite order = objects are deallocated in a last to - first order. Complexity is O(C) where C is count of all Chunks. This - never throws. - @return Pointer to Chunk that owns p, or NULL if no owner found. - */ - Chunk * VicinityFind( void * p ) const; - - /// Not implemented. - FixedAllocator(const FixedAllocator&); - /// Not implemented. - FixedAllocator& operator=(const FixedAllocator&); - - /// Type of container used to hold Chunks. - typedef std::vector< Chunk > Chunks; - /// Iterator through container of Chunks. - typedef Chunks::iterator ChunkIter; - /// Iterator through const container of Chunks. - typedef Chunks::const_iterator ChunkCIter; - - /// Fewest # of objects managed by a Chunk. - static unsigned char MinObjectsPerChunk_; - - /// Most # of objects managed by a Chunk - never exceeds UCHAR_MAX. - static unsigned char MaxObjectsPerChunk_; - - /// Number of bytes in a single block within a Chunk. - std::size_t blockSize_; - /// Number of blocks managed by each Chunk. - unsigned char numBlocks_; - - /// Container of Chunks. - Chunks chunks_; - /// Pointer to Chunk used for last or next allocation. - Chunk * allocChunk_; - /// Pointer to Chunk used for last or next deallocation. - Chunk * deallocChunk_; - /// Pointer to the only empty Chunk if there is one, else NULL. - Chunk * emptyChunk_; - - public: - /// Create a FixedAllocator which manages blocks of 'blockSize' size. - FixedAllocator(); - - /// Destroy the FixedAllocator and release all its Chunks. - ~FixedAllocator(); - - /// Initializes a FixedAllocator by calculating # of blocks per Chunk. - void Initialize( std::size_t blockSize, std::size_t pageSize ); - - /** Returns pointer to allocated memory block of fixed size - or NULL - if it failed to allocate. - */ - void * Allocate( void ); + /** Creates an empty Chunk and adds it to the end of the ChunkList. + All calls to the lower-level memory allocation functions occur inside + this function, and so the only try-catch block is inside here. + @return true for success, false for failure. + */ + bool MakeNewChunk( void ); + + /** Finds the Chunk which owns the block at address p. It starts at + deallocChunk_ and searches in both forwards and backwards directions + from there until it finds the Chunk which owns p. This algorithm + should find the Chunk quickly if it is deallocChunk_ or is close to it + in the Chunks container. This goes both forwards and backwards since + that works well for both same-order and opposite-order deallocations. + (Same-order = objects are deallocated in the same order in which they + were allocated. Opposite order = objects are deallocated in a last to + first order. Complexity is O(C) where C is count of all Chunks. This + never throws. + @return Pointer to Chunk that owns p, or NULL if no owner found. + */ + Chunk* VicinityFind( void* p ) const; + + /// Not implemented. + FixedAllocator(const FixedAllocator&); + /// Not implemented. + FixedAllocator& operator=(const FixedAllocator&); + + /// Type of container used to hold Chunks. + typedef std::vector< Chunk > Chunks; + /// Iterator through container of Chunks. + typedef Chunks::iterator ChunkIter; + /// Iterator through const container of Chunks. + typedef Chunks::const_iterator ChunkCIter; + + /// Fewest # of objects managed by a Chunk. + static unsigned char MinObjectsPerChunk_; + + /// Most # of objects managed by a Chunk - never exceeds UCHAR_MAX. + static unsigned char MaxObjectsPerChunk_; + + /// Number of bytes in a single block within a Chunk. + std::size_t blockSize_; + /// Number of blocks managed by each Chunk. + unsigned char numBlocks_; + + /// Container of Chunks. + Chunks chunks_; + /// Pointer to Chunk used for last or next allocation. + Chunk* allocChunk_; + /// Pointer to Chunk used for last or next deallocation. + Chunk* deallocChunk_; + /// Pointer to the only empty Chunk if there is one, else NULL. + Chunk* emptyChunk_; + +public: + /// Create a FixedAllocator which manages blocks of 'blockSize' size. + FixedAllocator(); + + /// Destroy the FixedAllocator and release all its Chunks. + ~FixedAllocator(); + + /// Initializes a FixedAllocator by calculating # of blocks per Chunk. + void Initialize( std::size_t blockSize, std::size_t pageSize ); + + /** Returns pointer to allocated memory block of fixed size - or NULL + if it failed to allocate. + */ + void* Allocate( void ); - /** Deallocate a memory block previously allocated with Allocate. If - the block is not owned by this FixedAllocator, it returns false so - that SmallObjAllocator can call the default deallocator. If the - block was found, this returns true. - */ - bool Deallocate( void * p, Chunk * hint ); + /** Deallocate a memory block previously allocated with Allocate. If + the block is not owned by this FixedAllocator, it returns false so + that SmallObjAllocator can call the default deallocator. If the + block was found, this returns true. + */ + bool Deallocate( void* p, Chunk* hint ); - /// Returns block size with which the FixedAllocator was initialized. - inline std::size_t BlockSize() const { return blockSize_; } + /// Returns block size with which the FixedAllocator was initialized. + inline std::size_t BlockSize() const { return blockSize_; } - /** Releases the memory used by the empty Chunk. This will take - constant time under any situation. - @return True if empty chunk found and released, false if none empty. - */ - bool TrimEmptyChunk( void ); + /** Releases the memory used by the empty Chunk. This will take + constant time under any situation. + @return True if empty chunk found and released, false if none empty. + */ + bool TrimEmptyChunk( void ); - /** Releases unused spots from ChunkList. This takes constant time - with respect to # of Chunks, but actual time depends on underlying - memory allocator. - @return False if no unused spots, true if some found and released. - */ - bool TrimChunkList( void ); + /** Releases unused spots from ChunkList. This takes constant time + with respect to # of Chunks, but actual time depends on underlying + memory allocator. + @return False if no unused spots, true if some found and released. + */ + bool TrimChunkList( void ); - /** Returns count of empty Chunks held by this allocator. Complexity - is O(C) where C is the total number of Chunks - empty or used. - */ - std::size_t CountEmptyChunks( void ) const; + /** Returns count of empty Chunks held by this allocator. Complexity + is O(C) where C is the total number of Chunks - empty or used. + */ + std::size_t CountEmptyChunks( void ) const; - /** Determines if FixedAllocator is corrupt. Checks data members to - see if any have erroneous values, or violate class invariants. It - also checks if any Chunk is corrupt. Complexity is O(C) where C is - the number of Chunks. If any data is corrupt, this will return true - in release mode, or assert in debug mode. - */ - bool IsCorrupt( void ) const; + /** Determines if FixedAllocator is corrupt. Checks data members to + see if any have erroneous values, or violate class invariants. It + also checks if any Chunk is corrupt. Complexity is O(C) where C is + the number of Chunks. If any data is corrupt, this will return true + in release mode, or assert in debug mode. + */ + bool IsCorrupt( void ) const; - /** Returns true if the block at address p is within a Chunk owned by - this FixedAllocator. Complexity is O(C) where C is the total number - of Chunks - empty or used. - */ - const Chunk * HasBlock( void * p ) const; - inline Chunk * HasBlock( void * p ) - { - return const_cast< Chunk * >( - const_cast< const FixedAllocator * >( this )->HasBlock( p ) ); - } + /** Returns true if the block at address p is within a Chunk owned by + this FixedAllocator. Complexity is O(C) where C is the total number + of Chunks - empty or used. + */ + const Chunk* HasBlock( void* p ) const; + inline Chunk* HasBlock( void* p ) + { + return const_cast< Chunk* >( + const_cast< const FixedAllocator* >( this )->HasBlock( p ) ); + } - }; +}; - unsigned char FixedAllocator::MinObjectsPerChunk_ = 8; - unsigned char FixedAllocator::MaxObjectsPerChunk_ = UCHAR_MAX; +unsigned char FixedAllocator::MinObjectsPerChunk_ = 8; +unsigned char FixedAllocator::MaxObjectsPerChunk_ = UCHAR_MAX; // Chunk::Init ---------------------------------------------------------------- @@ -310,11 +310,11 @@ bool Chunk::Init( std::size_t blockSize, unsigned char blocks ) #ifdef USE_NEW_TO_ALLOCATE // If this new operator fails, it will throw, and the exception will get // caught one layer up. - pData_ = static_cast< unsigned char * >( ::operator new ( allocSize ) ); + pData_ = static_cast< unsigned char* >( ::operator new ( allocSize ) ); #else // malloc can't throw, so its only way to indicate an error is to return // a NULL pointer, so we have to check for that. - pData_ = static_cast< unsigned char * >( ::std::malloc( allocSize ) ); + pData_ = static_cast< unsigned char* >( ::std::malloc( allocSize ) ); if ( NULL == pData_ ) return false; #endif @@ -335,7 +335,7 @@ void Chunk::Reset(std::size_t blockSize, unsigned char blocks) blocksAvailable_ = blocks; unsigned char i = 0; - for ( unsigned char * p = pData_; i != blocks; p += blockSize ) + for ( unsigned char* p = pData_; i != blocks; p += blockSize ) { *p = ++i; } @@ -349,7 +349,7 @@ void Chunk::Release() #ifdef USE_NEW_TO_ALLOCATE ::operator delete ( pData_ ); #else - ::std::free( static_cast< void * >( pData_ ) ); + ::std::free( static_cast< void* >( pData_ ) ); #endif } @@ -360,8 +360,8 @@ void* Chunk::Allocate(std::size_t blockSize) if ( IsFilled() ) return NULL; assert((firstAvailableBlock_ * blockSize) / blockSize == - firstAvailableBlock_); - unsigned char * pResult = pData_ + (firstAvailableBlock_ * blockSize); + firstAvailableBlock_); + unsigned char* pResult = pData_ + (firstAvailableBlock_ * blockSize); firstAvailableBlock_ = *pResult; --blocksAvailable_; @@ -378,7 +378,7 @@ void Chunk::Deallocate(void* p, std::size_t blockSize) // Alignment check assert((toRelease - pData_) % blockSize == 0); unsigned char index = static_cast< unsigned char >( - ( toRelease - pData_ ) / blockSize); + ( toRelease - pData_ ) / blockSize); #if defined(DEBUG) || defined(_DEBUG) // Check if block was already deleted. Attempting to delete the same @@ -399,7 +399,7 @@ void Chunk::Deallocate(void* p, std::size_t blockSize) // Chunk::IsCorrupt ----------------------------------------------------------- bool Chunk::IsCorrupt( unsigned char numBlocks, std::size_t blockSize, - bool checkIndexes ) const + bool checkIndexes ) const { if ( numBlocks < blocksAvailable_ ) @@ -428,7 +428,7 @@ bool Chunk::IsCorrupt( unsigned char numBlocks, std::size_t blockSize, found on the linked-list. */ std::bitset< UCHAR_MAX > foundBlocks; - unsigned char * nextBlock = NULL; + unsigned char* nextBlock = NULL; /* The loop goes along singly linked-list of stealth indexes and makes sure that each index is within bounds (0 <= index < numBlocks) and that the @@ -499,19 +499,19 @@ bool Chunk::IsCorrupt( unsigned char numBlocks, std::size_t blockSize, // Chunk::IsBlockAvailable ---------------------------------------------------- -bool Chunk::IsBlockAvailable( void * p, unsigned char numBlocks, - std::size_t blockSize ) const +bool Chunk::IsBlockAvailable( void* p, unsigned char numBlocks, + std::size_t blockSize ) const { (void) numBlocks; if ( IsFilled() ) return false; - unsigned char * place = static_cast< unsigned char * >( p ); + unsigned char* place = static_cast< unsigned char* >( p ); // Alignment check assert( ( place - pData_ ) % blockSize == 0 ); unsigned char blockIndex = static_cast< unsigned char >( - ( place - pData_ ) / blockSize ); + ( place - pData_ ) / blockSize ); unsigned char index = firstAvailableBlock_; assert( numBlocks > index ); @@ -522,7 +522,7 @@ bool Chunk::IsBlockAvailable( void * p, unsigned char numBlocks, found on the linked-list. */ std::bitset< UCHAR_MAX > foundBlocks; - unsigned char * nextBlock = NULL; + unsigned char* nextBlock = NULL; for ( unsigned char cc = 0; ; ) { nextBlock = pData_ + ( index * blockSize ); @@ -562,7 +562,7 @@ FixedAllocator::~FixedAllocator() assert( chunks_.empty() && "Memory leak detected!" ); #endif for ( ChunkIter i( chunks_.begin() ); i != chunks_.end(); ++i ) - i->Release(); + i->Release(); } // FixedAllocator::Initialize ------------------------------------------------- @@ -592,7 +592,7 @@ std::size_t FixedAllocator::CountEmptyChunks( void ) const std::size_t count = 0; for ( ChunkCIter it( chunks_.begin() ); it != chunks_.end(); ++it ) { - const Chunk & chunk = *it; + const Chunk& chunk = *it; if ( chunk.HasAvailable( numBlocks_ ) ) ++count; } @@ -642,8 +642,8 @@ bool FixedAllocator::IsCorrupt( void ) const else { - const Chunk * front = &chunks_.front(); - const Chunk * back = &chunks_.back(); + const Chunk* front = &chunks_.front(); + const Chunk* back = &chunks_.back(); if ( start >= last ) { assert( false ); @@ -708,7 +708,7 @@ bool FixedAllocator::IsCorrupt( void ) const } for ( ChunkCIter it( start ); it != last; ++it ) { - const Chunk & chunk = *it; + const Chunk& chunk = *it; if ( chunk.IsCorrupt( numBlocks_, blockSize_, true ) ) return true; } @@ -719,12 +719,12 @@ bool FixedAllocator::IsCorrupt( void ) const // FixedAllocator::HasBlock --------------------------------------------------- -const Chunk * FixedAllocator::HasBlock( void * p ) const +const Chunk* FixedAllocator::HasBlock( void* p ) const { const std::size_t chunkLength = numBlocks_ * blockSize_; for ( ChunkCIter it( chunks_.begin() ); it != chunks_.end(); ++it ) { - const Chunk & chunk = *it; + const Chunk& chunk = *it; if ( chunk.HasBlock( p, chunkLength ) ) return &chunk; } @@ -744,7 +744,7 @@ bool FixedAllocator::TrimEmptyChunk( void ) // And there should be exactly 1 empty Chunk. assert( 1 == CountEmptyChunks() ); - Chunk * lastChunk = &chunks_.back(); + Chunk* lastChunk = &chunks_.back(); if ( lastChunk != emptyChunk_ ) std::swap( *emptyChunk_, *lastChunk ); assert( lastChunk->HasAvailable( numBlocks_ ) ); @@ -828,7 +828,7 @@ bool FixedAllocator::MakeNewChunk( void ) // FixedAllocator::Allocate --------------------------------------------------- -void * FixedAllocator::Allocate( void ) +void* FixedAllocator::Allocate( void ) { // prove either emptyChunk_ points nowhere, or points to a truly empty Chunk. assert( ( NULL == emptyChunk_ ) || ( emptyChunk_->HasAvailable( numBlocks_ ) ) ); @@ -867,7 +867,7 @@ void * FixedAllocator::Allocate( void ) assert( allocChunk_ != NULL ); assert( !allocChunk_->IsFilled() ); - void * place = allocChunk_->Allocate( blockSize_ ); + void* place = allocChunk_->Allocate( blockSize_ ); // prove either emptyChunk_ points nowhere, or points to a truly empty Chunk. assert( ( NULL == emptyChunk_ ) || ( emptyChunk_->HasAvailable( numBlocks_ ) ) ); @@ -885,7 +885,7 @@ void * FixedAllocator::Allocate( void ) // FixedAllocator::Deallocate ------------------------------------------------- -bool FixedAllocator::Deallocate( void * p, Chunk * hint ) +bool FixedAllocator::Deallocate( void* p, Chunk* hint ) { assert(!chunks_.empty()); assert(&chunks_.front() <= deallocChunk_); @@ -894,7 +894,7 @@ bool FixedAllocator::Deallocate( void * p, Chunk * hint ) assert( &chunks_.back() >= allocChunk_ ); assert( CountEmptyChunks() < 2 ); - Chunk * foundChunk = ( NULL == hint ) ? VicinityFind( p ) : hint; + Chunk* foundChunk = ( NULL == hint ) ? VicinityFind( p ) : hint; if ( NULL == foundChunk ) return false; @@ -920,16 +920,16 @@ bool FixedAllocator::Deallocate( void * p, Chunk * hint ) // FixedAllocator::VicinityFind ----------------------------------------------- -Chunk * FixedAllocator::VicinityFind( void * p ) const +Chunk* FixedAllocator::VicinityFind( void* p ) const { if ( chunks_.empty() ) return NULL; assert(deallocChunk_); const std::size_t chunkLength = numBlocks_ * blockSize_; - Chunk * lo = deallocChunk_; - Chunk * hi = deallocChunk_ + 1; - const Chunk * loBound = &chunks_.front(); - const Chunk * hiBound = &chunks_.back() + 1; + Chunk* lo = deallocChunk_; + Chunk* hi = deallocChunk_ + 1; + const Chunk* loBound = &chunks_.front(); + const Chunk* hiBound = &chunks_.back() + 1; // Special case: deallocChunk_ is the last in the array if (hi == hiBound) hi = NULL; @@ -989,7 +989,7 @@ void FixedAllocator::DoDeallocate(void* p) // If last Chunk is empty, just change what deallocChunk_ // points to, and release the last. Otherwise, swap an empty // Chunk with the last, and then release it. - Chunk * lastChunk = &chunks_.back(); + Chunk* lastChunk = &chunks_.back(); if ( lastChunk == deallocChunk_ ) deallocChunk_ = emptyChunk_; else if ( lastChunk != emptyChunk_ ) @@ -1025,13 +1025,13 @@ inline std::size_t GetOffset( std::size_t numBytes, std::size_t alignment ) @param doThrow True if this function should throw an exception, or false if it should indicate failure by returning a NULL pointer. */ -void * DefaultAllocator( std::size_t numBytes, bool doThrow ) +void* DefaultAllocator( std::size_t numBytes, bool doThrow ) { #ifdef USE_NEW_TO_ALLOCATE return doThrow ? ::operator new( numBytes ) : - ::operator new( numBytes, std::nothrow_t() ); + ::operator new( numBytes, std::nothrow_t() ); #else - void * p = ::std::malloc( numBytes ); + void* p = ::std::malloc( numBytes ); if ( doThrow && ( NULL == p ) ) throw std::bad_alloc(); return p; @@ -1046,7 +1046,7 @@ void * DefaultAllocator( std::size_t numBytes, bool doThrow ) it matches malloc which is the preferred default allocator. SmallObjAllocator will call this if an address was not found among any of its own blocks. */ -void DefaultDeallocator( void * p ) +void DefaultDeallocator( void* p ) { #ifdef USE_NEW_TO_ALLOCATE ::operator delete( p ); @@ -1058,7 +1058,7 @@ void DefaultDeallocator( void * p ) // SmallObjAllocator::SmallObjAllocator --------------------------------------- SmallObjAllocator::SmallObjAllocator( std::size_t pageSize, - std::size_t maxObjectSize, std::size_t objectAlignSize ) : + std::size_t maxObjectSize, std::size_t objectAlignSize ) : pool_( NULL ), maxSmallObjectSize_( maxObjectSize ), objectAlignSize_( objectAlignSize ) @@ -1106,7 +1106,7 @@ bool SmallObjAllocator::TrimExcessMemory( void ) // SmallObjAllocator::Allocate ------------------------------------------------ -void * SmallObjAllocator::Allocate( std::size_t numBytes, bool doThrow ) +void* SmallObjAllocator::Allocate( std::size_t numBytes, bool doThrow ) { if ( numBytes > GetMaxObjectSize() ) return DefaultAllocator( numBytes, doThrow ); @@ -1118,10 +1118,10 @@ void * SmallObjAllocator::Allocate( std::size_t numBytes, bool doThrow ) (void) allocCount; assert( index < allocCount ); - FixedAllocator & allocator = pool_[ index ]; + FixedAllocator& allocator = pool_[ index ]; assert( allocator.BlockSize() >= numBytes ); assert( allocator.BlockSize() < numBytes + GetAlignment() ); - void * place = allocator.Allocate(); + void* place = allocator.Allocate(); if ( ( NULL == place ) && TrimExcessMemory() ) place = allocator.Allocate(); @@ -1141,7 +1141,7 @@ void * SmallObjAllocator::Allocate( std::size_t numBytes, bool doThrow ) // SmallObjAllocator::Deallocate ---------------------------------------------- -void SmallObjAllocator::Deallocate( void * p, std::size_t numBytes ) +void SmallObjAllocator::Deallocate( void* p, std::size_t numBytes ) { if ( NULL == p ) return; if ( numBytes > GetMaxObjectSize() ) @@ -1155,7 +1155,7 @@ void SmallObjAllocator::Deallocate( void * p, std::size_t numBytes ) const std::size_t allocCount = GetOffset( GetMaxObjectSize(), GetAlignment() ); (void) allocCount; assert( index < allocCount ); - FixedAllocator & allocator = pool_[ index ]; + FixedAllocator& allocator = pool_[ index ]; assert( allocator.BlockSize() >= numBytes ); assert( allocator.BlockSize() < numBytes + GetAlignment() ); const bool found = allocator.Deallocate( p, NULL ); @@ -1165,13 +1165,13 @@ void SmallObjAllocator::Deallocate( void * p, std::size_t numBytes ) // SmallObjAllocator::Deallocate ---------------------------------------------- -void SmallObjAllocator::Deallocate( void * p ) +void SmallObjAllocator::Deallocate( void* p ) { if ( NULL == p ) return; assert( NULL != pool_ ); - FixedAllocator * pAllocator = NULL; + FixedAllocator* pAllocator = NULL; const std::size_t allocCount = GetOffset( GetMaxObjectSize(), GetAlignment() ); - Chunk * chunk = NULL; + Chunk* chunk = NULL; for ( std::size_t ii = 0; ii < allocCount; ++ii ) { diff --git a/shared/loki/SmallObj.h b/shared/loki/SmallObj.h index 65828bf2..8725b911 100644 --- a/shared/loki/SmallObj.h +++ b/shared/loki/SmallObj.h @@ -2,14 +2,14 @@ // The Loki Library // Copyright (c) 2001 by Andrei Alexandrescu // This code accompanies the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author or Addison-Wesley Longman make no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author or Addison-Wesley Longman make no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_SMALLOBJ_INC_ @@ -53,590 +53,590 @@ namespace Loki { - namespace LongevityLifetime - { - /** @struct DieAsSmallObjectParent - @ingroup SmallObjectGroup - Lifetime policy to manage lifetime dependencies of - SmallObject base and child classes. - The Base class should have this lifetime - */ - template <class T> - struct DieAsSmallObjectParent : DieLast<T> {}; - - /** @struct DieAsSmallObjectChild - @ingroup SmallObjectGroup - Lifetime policy to manage lifetime dependencies of - SmallObject base and child classes. - The Child class should have this lifetime - */ - template <class T> - struct DieAsSmallObjectChild : DieDirectlyBeforeLast<T> {}; - - } - - class FixedAllocator; - - /** @class SmallObjAllocator - @ingroup SmallObjectGroupInternal - Manages pool of fixed-size allocators. - Designed to be a non-templated base class of AllocatorSingleton so that - implementation details can be safely hidden in the source code file. +namespace LongevityLifetime +{ +/** @struct DieAsSmallObjectParent + @ingroup SmallObjectGroup + Lifetime policy to manage lifetime dependencies of + SmallObject base and child classes. + The Base class should have this lifetime +*/ +template <class T> +struct DieAsSmallObjectParent : DieLast<T> {}; + +/** @struct DieAsSmallObjectChild + @ingroup SmallObjectGroup + Lifetime policy to manage lifetime dependencies of + SmallObject base and child classes. + The Child class should have this lifetime +*/ +template <class T> +struct DieAsSmallObjectChild : DieDirectlyBeforeLast<T> {}; + +} + +class FixedAllocator; + +/** @class SmallObjAllocator + @ingroup SmallObjectGroupInternal + Manages pool of fixed-size allocators. + Designed to be a non-templated base class of AllocatorSingleton so that + implementation details can be safely hidden in the source code file. + */ +class LOKI_EXPORT SmallObjAllocator +{ +protected: + /** The only available constructor needs certain parameters in order to + initialize all the FixedAllocator's. This throws only if + @param pageSize # of bytes in a page of memory. + @param maxObjectSize Max # of bytes which this may allocate. + @param objectAlignSize # of bytes between alignment boundaries. */ - class LOKI_EXPORT SmallObjAllocator - { - protected: - /** The only available constructor needs certain parameters in order to - initialize all the FixedAllocator's. This throws only if - @param pageSize # of bytes in a page of memory. - @param maxObjectSize Max # of bytes which this may allocate. - @param objectAlignSize # of bytes between alignment boundaries. - */ - SmallObjAllocator( std::size_t pageSize, std::size_t maxObjectSize, - std::size_t objectAlignSize ); - - /** Destructor releases all blocks, all Chunks, and FixedAllocator's. - Any outstanding blocks are unavailable, and should not be used after - this destructor is called. The destructor is deliberately non-virtual - because it is protected, not public. - */ - ~SmallObjAllocator( void ); - - public: - /** Allocates a block of memory of requested size. Complexity is often - constant-time, but might be O(C) where C is the number of Chunks in a - FixedAllocator. - - @par Exception Safety Level - Provides either strong-exception safety, or no-throw exception-safety - level depending upon doThrow parameter. The reason it provides two - levels of exception safety is because it is used by both the nothrow - and throwing new operators. The underlying implementation will never - throw of its own accord, but this can decide to throw if it does not - allocate. The only exception it should emit is std::bad_alloc. - - @par Allocation Failure - If it does not allocate, it will call TrimExcessMemory and attempt to - allocate again, before it decides to throw or return NULL. Many - allocators loop through several new_handler functions, and terminate - if they can not allocate, but not this one. It only makes one attempt - using its own implementation of the new_handler, and then returns NULL - or throws so that the program can decide what to do at a higher level. - (Side note: Even though the C++ Standard allows allocators and - new_handlers to terminate if they fail, the Loki allocator does not do - that since that policy is not polite to a host program.) - - @param size # of bytes needed for allocation. - @param doThrow True if this should throw if unable to allocate, false - if it should provide no-throw exception safety level. - @return NULL if nothing allocated and doThrow is false. Else the - pointer to an available block of memory. - */ - void * Allocate( std::size_t size, bool doThrow ); - - /** Deallocates a block of memory at a given place and of a specific - size. Complexity is almost always constant-time, and is O(C) only if - it has to search for which Chunk deallocates. This never throws. - */ - void Deallocate( void * p, std::size_t size ); - - /** Deallocates a block of memory at a given place but of unknown size - size. Complexity is O(F + C) where F is the count of FixedAllocator's - in the pool, and C is the number of Chunks in all FixedAllocator's. This - does not throw exceptions. This overloaded version of Deallocate is - called by the nothow delete operator - which is called when the nothrow - new operator is used, but a constructor throws an exception. - */ - void Deallocate( void * p ); - - /// Returns max # of bytes which this can allocate. - inline std::size_t GetMaxObjectSize() const - { return maxSmallObjectSize_; } - - /// Returns # of bytes between allocation boundaries. - inline std::size_t GetAlignment() const { return objectAlignSize_; } - - /** Releases empty Chunks from memory. Complexity is O(F + C) where F - is the count of FixedAllocator's in the pool, and C is the number of - Chunks in all FixedAllocator's. This will never throw. This is called - by AllocatorSingleto::ClearExtraMemory, the new_handler function for - Loki's allocator, and is called internally when an allocation fails. - @return True if any memory released, or false if none released. - */ - bool TrimExcessMemory( void ); - - /** Returns true if anything in implementation is corrupt. Complexity - is O(F + C + B) where F is the count of FixedAllocator's in the pool, - C is the number of Chunks in all FixedAllocator's, and B is the number - of blocks in all Chunks. If it determines any data is corrupted, this - will return true in release version, but assert in debug version at - the line where it detects the corrupted data. If it does not detect - any corrupted data, it returns false. - */ - bool IsCorrupt( void ) const; - - private: - /// Default-constructor is not implemented. - SmallObjAllocator( void ); - /// Copy-constructor is not implemented. - SmallObjAllocator( const SmallObjAllocator & ); - /// Copy-assignment operator is not implemented. - SmallObjAllocator & operator = ( const SmallObjAllocator & ); - - /// Pointer to array of fixed-size allocators. - Loki::FixedAllocator * pool_; - - /// Largest object size supported by allocators. - const std::size_t maxSmallObjectSize_; - - /// Size of alignment boundaries. - const std::size_t objectAlignSize_; - }; - - - /** @class AllocatorSingleton - @ingroup SmallObjectGroupInternal - This template class is derived from - SmallObjAllocator in order to pass template arguments into it, and still - have a default constructor for the singleton. Each instance is a unique - combination of all the template parameters, and hence is singleton only - with respect to those parameters. The template parameters have default - values and the class has typedefs identical to both SmallObject and - SmallValueObject so that this class can be used directly instead of going - through SmallObject or SmallValueObject. That design feature allows - clients to use the new_handler without having the name of the new_handler - function show up in classes derived from SmallObject or SmallValueObject. - Thus, the only functions in the allocator which show up in SmallObject or - SmallValueObject inheritance hierarchies are the new and delete - operators. - */ - template - < - template <class, class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL, - std::size_t chunkSize = LOKI_DEFAULT_CHUNK_SIZE, - std::size_t maxSmallObjectSize = LOKI_MAX_SMALL_OBJECT_SIZE, - std::size_t objectAlignSize = LOKI_DEFAULT_OBJECT_ALIGNMENT, - template <class> class LifetimePolicy = LOKI_DEFAULT_SMALLOBJ_LIFETIME, - class MutexPolicy = LOKI_DEFAULT_MUTEX - > - class AllocatorSingleton : public SmallObjAllocator - { - public: + SmallObjAllocator( std::size_t pageSize, std::size_t maxObjectSize, + std::size_t objectAlignSize ); + + /** Destructor releases all blocks, all Chunks, and FixedAllocator's. + Any outstanding blocks are unavailable, and should not be used after + this destructor is called. The destructor is deliberately non-virtual + because it is protected, not public. + */ + ~SmallObjAllocator( void ); + +public: + /** Allocates a block of memory of requested size. Complexity is often + constant-time, but might be O(C) where C is the number of Chunks in a + FixedAllocator. + + @par Exception Safety Level + Provides either strong-exception safety, or no-throw exception-safety + level depending upon doThrow parameter. The reason it provides two + levels of exception safety is because it is used by both the nothrow + and throwing new operators. The underlying implementation will never + throw of its own accord, but this can decide to throw if it does not + allocate. The only exception it should emit is std::bad_alloc. + + @par Allocation Failure + If it does not allocate, it will call TrimExcessMemory and attempt to + allocate again, before it decides to throw or return NULL. Many + allocators loop through several new_handler functions, and terminate + if they can not allocate, but not this one. It only makes one attempt + using its own implementation of the new_handler, and then returns NULL + or throws so that the program can decide what to do at a higher level. + (Side note: Even though the C++ Standard allows allocators and + new_handlers to terminate if they fail, the Loki allocator does not do + that since that policy is not polite to a host program.) + + @param size # of bytes needed for allocation. + @param doThrow True if this should throw if unable to allocate, false + if it should provide no-throw exception safety level. + @return NULL if nothing allocated and doThrow is false. Else the + pointer to an available block of memory. + */ + void* Allocate( std::size_t size, bool doThrow ); + + /** Deallocates a block of memory at a given place and of a specific + size. Complexity is almost always constant-time, and is O(C) only if + it has to search for which Chunk deallocates. This never throws. + */ + void Deallocate( void* p, std::size_t size ); + + /** Deallocates a block of memory at a given place but of unknown size + size. Complexity is O(F + C) where F is the count of FixedAllocator's + in the pool, and C is the number of Chunks in all FixedAllocator's. This + does not throw exceptions. This overloaded version of Deallocate is + called by the nothow delete operator - which is called when the nothrow + new operator is used, but a constructor throws an exception. + */ + void Deallocate( void* p ); - /// Defines type of allocator. - typedef AllocatorSingleton< ThreadingModel, chunkSize, + /// Returns max # of bytes which this can allocate. + inline std::size_t GetMaxObjectSize() const + { return maxSmallObjectSize_; } + + /// Returns # of bytes between allocation boundaries. + inline std::size_t GetAlignment() const { return objectAlignSize_; } + + /** Releases empty Chunks from memory. Complexity is O(F + C) where F + is the count of FixedAllocator's in the pool, and C is the number of + Chunks in all FixedAllocator's. This will never throw. This is called + by AllocatorSingleto::ClearExtraMemory, the new_handler function for + Loki's allocator, and is called internally when an allocation fails. + @return True if any memory released, or false if none released. + */ + bool TrimExcessMemory( void ); + + /** Returns true if anything in implementation is corrupt. Complexity + is O(F + C + B) where F is the count of FixedAllocator's in the pool, + C is the number of Chunks in all FixedAllocator's, and B is the number + of blocks in all Chunks. If it determines any data is corrupted, this + will return true in release version, but assert in debug version at + the line where it detects the corrupted data. If it does not detect + any corrupted data, it returns false. + */ + bool IsCorrupt( void ) const; + +private: + /// Default-constructor is not implemented. + SmallObjAllocator( void ); + /// Copy-constructor is not implemented. + SmallObjAllocator( const SmallObjAllocator& ); + /// Copy-assignment operator is not implemented. + SmallObjAllocator& operator = ( const SmallObjAllocator& ); + + /// Pointer to array of fixed-size allocators. + Loki::FixedAllocator* pool_; + + /// Largest object size supported by allocators. + const std::size_t maxSmallObjectSize_; + + /// Size of alignment boundaries. + const std::size_t objectAlignSize_; +}; + + +/** @class AllocatorSingleton + @ingroup SmallObjectGroupInternal + This template class is derived from + SmallObjAllocator in order to pass template arguments into it, and still + have a default constructor for the singleton. Each instance is a unique + combination of all the template parameters, and hence is singleton only + with respect to those parameters. The template parameters have default + values and the class has typedefs identical to both SmallObject and + SmallValueObject so that this class can be used directly instead of going + through SmallObject or SmallValueObject. That design feature allows + clients to use the new_handler without having the name of the new_handler + function show up in classes derived from SmallObject or SmallValueObject. + Thus, the only functions in the allocator which show up in SmallObject or + SmallValueObject inheritance hierarchies are the new and delete + operators. +*/ +template +< +template <class, class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL, + std::size_t chunkSize = LOKI_DEFAULT_CHUNK_SIZE, + std::size_t maxSmallObjectSize = LOKI_MAX_SMALL_OBJECT_SIZE, + std::size_t objectAlignSize = LOKI_DEFAULT_OBJECT_ALIGNMENT, + template <class> class LifetimePolicy = LOKI_DEFAULT_SMALLOBJ_LIFETIME, + class MutexPolicy = LOKI_DEFAULT_MUTEX + > +class AllocatorSingleton : public SmallObjAllocator +{ +public: + + /// Defines type of allocator. + typedef AllocatorSingleton< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy > MyAllocator; - /// Defines type for thread-safety locking mechanism. - typedef ThreadingModel< MyAllocator, MutexPolicy > MyThreadingModel; + /// Defines type for thread-safety locking mechanism. + typedef ThreadingModel< MyAllocator, MutexPolicy > MyThreadingModel; - /// Defines singleton made from allocator. - typedef Loki::SingletonHolder< MyAllocator, Loki::CreateStatic, + /// Defines singleton made from allocator. + typedef Loki::SingletonHolder< MyAllocator, Loki::CreateStatic, LifetimePolicy, ThreadingModel > MyAllocatorSingleton; - /// Returns reference to the singleton. - inline static AllocatorSingleton & Instance( void ) - { - return MyAllocatorSingleton::Instance(); - } - - /// The default constructor is not meant to be called directly. - inline AllocatorSingleton() : - SmallObjAllocator( chunkSize, maxSmallObjectSize, objectAlignSize ) - {} - - /// The destructor is not meant to be called directly. - inline ~AllocatorSingleton( void ) {} - - /** Clears any excess memory used by the allocator. Complexity is - O(F + C) where F is the count of FixedAllocator's in the pool, and C - is the number of Chunks in all FixedAllocator's. This never throws. - @note This function can be used as a new_handler when Loki and other - memory allocators can no longer allocate. Although the C++ Standard - allows new_handler functions to terminate the program when they can - not release any memory, this will not do so. - */ - static void ClearExtraMemory( void ); - - /** Returns true if anything in implementation is corrupt. Complexity - is O(F + C + B) where F is the count of FixedAllocator's in the pool, - C is the number of Chunks in all FixedAllocator's, and B is the number - of blocks in all Chunks. If it determines any data is corrupted, this - will return true in release version, but assert in debug version at - the line where it detects the corrupted data. If it does not detect - any corrupted data, it returns false. - */ - static bool IsCorrupted( void ); - - private: - /// Copy-constructor is not implemented. - AllocatorSingleton( const AllocatorSingleton & ); - /// Copy-assignment operator is not implemented. - AllocatorSingleton & operator = ( const AllocatorSingleton & ); - }; - - template - < - template <class, class> class T, - std::size_t C, - std::size_t M, - std::size_t O, - template <class> class L, - class X - > - void AllocatorSingleton< T, C, M, O, L, X >::ClearExtraMemory( void ) + /// Returns reference to the singleton. + inline static AllocatorSingleton& Instance( void ) + { + return MyAllocatorSingleton::Instance(); + } + + /// The default constructor is not meant to be called directly. + inline AllocatorSingleton() : + SmallObjAllocator( chunkSize, maxSmallObjectSize, objectAlignSize ) + {} + + /// The destructor is not meant to be called directly. + inline ~AllocatorSingleton( void ) {} + + /** Clears any excess memory used by the allocator. Complexity is + O(F + C) where F is the count of FixedAllocator's in the pool, and C + is the number of Chunks in all FixedAllocator's. This never throws. + @note This function can be used as a new_handler when Loki and other + memory allocators can no longer allocate. Although the C++ Standard + allows new_handler functions to terminate the program when they can + not release any memory, this will not do so. + */ + static void ClearExtraMemory( void ); + + /** Returns true if anything in implementation is corrupt. Complexity + is O(F + C + B) where F is the count of FixedAllocator's in the pool, + C is the number of Chunks in all FixedAllocator's, and B is the number + of blocks in all Chunks. If it determines any data is corrupted, this + will return true in release version, but assert in debug version at + the line where it detects the corrupted data. If it does not detect + any corrupted data, it returns false. + */ + static bool IsCorrupted( void ); + +private: + /// Copy-constructor is not implemented. + AllocatorSingleton( const AllocatorSingleton& ); + /// Copy-assignment operator is not implemented. + AllocatorSingleton& operator = ( const AllocatorSingleton& ); +}; + +template +< +template <class, class> class T, + std::size_t C, + std::size_t M, + std::size_t O, + template <class> class L, + class X + > +void AllocatorSingleton< T, C, M, O, L, X >::ClearExtraMemory( void ) +{ + typename MyThreadingModel::Lock lock; + (void)lock; // get rid of warning + Instance().TrimExcessMemory(); +} + +template +< +template <class, class> class T, + std::size_t C, + std::size_t M, + std::size_t O, + template <class> class L, + class X + > +bool AllocatorSingleton< T, C, M, O, L, X >::IsCorrupted( void ) +{ + typename MyThreadingModel::Lock lock; + (void)lock; // get rid of warning + return Instance().IsCorrupt(); +} + +/** This standalone function provides the longevity level for Small-Object + Allocators which use the Loki::SingletonWithLongevity policy. The + SingletonWithLongevity class can find this function through argument- + dependent lookup. + + @par Longevity Levels + No Small-Object Allocator depends on any other Small-Object allocator, so + this does not need to calculate dependency levels among allocators, and + it returns just a constant. All allocators must live longer than the + objects which use the allocators, it must return a longevity level higher + than any such object. + */ +template +< +template <class, class> class T, + std::size_t C, + std::size_t M, + std::size_t O, + template <class> class L, + class X + > +inline unsigned int GetLongevity( + AllocatorSingleton< T, C, M, O, L, X > * ) +{ + // Returns highest possible value. + return 0xFFFFFFFF; +} + + +/** @class SmallObjectBase + @ingroup SmallObjectGroup + Base class for small object allocation classes. + The shared implementation of the new and delete operators are here instead + of being duplicated in both SmallObject or SmallValueObject, later just + called Small-Objects. This class is not meant to be used directly by clients, + or derived from by clients. Class has no data members so compilers can + use Empty-Base-Optimization. + + @par ThreadingModel + This class doesn't support ObjectLevelLockable policy for ThreadingModel. + The allocator is a singleton, so a per-instance mutex is not necessary. + Nor is using ObjectLevelLockable recommended with SingletonHolder since + the SingletonHolder::MakeInstance function requires a mutex that exists + prior to when the object is created - which is not possible if the mutex + is inside the object, such as required for ObjectLevelLockable. If you + attempt to use ObjectLevelLockable, the compiler will emit errors because + it can't use the default constructor in ObjectLevelLockable. If you need + a thread-safe allocator, use the ClassLevelLockable policy. + + @par Lifetime Policy + + The SmallObjectBase template needs a lifetime policy because it owns + a singleton of SmallObjAllocator which does all the low level functions. + When using a Small-Object in combination with the SingletonHolder template + you have to choose two lifetimes, that of the Small-Object and that of + the singleton. The rule is: The Small-Object lifetime must be greater than + the lifetime of the singleton hosting the Small-Object. Violating this rule + results in a crash on exit, because the hosting singleton tries to delete + the Small-Object which is then already destroyed. + + The lifetime policies recommended for use with Small-Objects hosted + by a SingletonHolder template are + - LongevityLifetime::DieAsSmallObjectParent / LongevityLifetime::DieAsSmallObjectChild + - SingletonWithLongevity + - FollowIntoDeath (not supported by MSVC 7.1) + - NoDestroy + + The default lifetime of Small-Objects is + LongevityLifetime::DieAsSmallObjectParent to + insure that memory is not released before a object with the lifetime + LongevityLifetime::DieAsSmallObjectChild using that + memory is destroyed. The LongevityLifetime::DieAsSmallObjectParent + lifetime has the highest possible value of a SetLongevity lifetime, so + you can use it in combination with your own lifetime not having also + the highest possible value. + + The DefaultLifetime and PhoenixSingleton policies are *not* recommended + since they can cause the allocator to be destroyed and release memory + for singletons hosting a object which inherit from either SmallObject + or SmallValueObject. + + @par Lifetime usage + + - LongevityLifetime: The Small-Object has + LongevityLifetime::DieAsSmallObjectParent policy and the Singleton + hosting the Small-Object has LongevityLifetime::DieAsSmallObjectChild. + The child lifetime has a hard coded SetLongevity lifetime which is + shorter than the lifetime of the parent, thus the child dies + before the parent. + + - Both Small-Object and Singleton use SingletonWithLongevity policy. + The longevity level for the singleton must be lower than that for the + Small-Object. This is why the AllocatorSingleton's GetLongevity function + returns the highest value. + + - FollowIntoDeath lifetime: The Small-Object has + FollowIntoDeath::With<LIFETIME>::AsMasterLiftime + policy and the Singleton has + FollowIntoDeath::AfterMaster<MASTERSINGLETON>::IsDestroyed policy, + where you could choose the LIFETIME. + + - Both Small-Object and Singleton use NoDestroy policy. + Since neither is ever destroyed, the destruction order does not matter. + Note: you will get memory leaks! + + - The Small-Object has NoDestroy policy but the Singleton has + SingletonWithLongevity policy. Note: you will get memory leaks! + + + You should *not* use NoDestroy for the singleton, and then use + SingletonWithLongevity for the Small-Object. + + @par Examples: + + - test/SmallObj/SmallSingleton.cpp + - test/Singleton/Dependencies.cpp + */ +template +< +template <class, class> class ThreadingModel, + std::size_t chunkSize, + std::size_t maxSmallObjectSize, + std::size_t objectAlignSize, + template <class> class LifetimePolicy, + class MutexPolicy + > +class SmallObjectBase +{ + +#if (LOKI_MAX_SMALL_OBJECT_SIZE != 0) && (LOKI_DEFAULT_CHUNK_SIZE != 0) && (LOKI_DEFAULT_OBJECT_ALIGNMENT != 0) + +public: + /// Defines type of allocator singleton, must be public + /// to handle singleton lifetime dependencies. + typedef AllocatorSingleton< ThreadingModel, chunkSize, + maxSmallObjectSize, objectAlignSize, LifetimePolicy > ObjAllocatorSingleton; + +private: + + /// Defines type for thread-safety locking mechanism. + typedef ThreadingModel< ObjAllocatorSingleton, MutexPolicy > MyThreadingModel; + + /// Use singleton defined in AllocatorSingleton. + typedef typename ObjAllocatorSingleton::MyAllocatorSingleton MyAllocatorSingleton; + +public: + + /// Throwing single-object new throws bad_alloc when allocation fails. +#ifdef _MSC_VER + /// @note MSVC complains about non-empty exception specification lists. + static void* operator new ( std::size_t size ) +#else + static void* operator new ( std::size_t size ) throw ( std::bad_alloc ) +#endif { typename MyThreadingModel::Lock lock; (void)lock; // get rid of warning - Instance().TrimExcessMemory(); + return MyAllocatorSingleton::Instance().Allocate( size, true ); } - template - < - template <class, class> class T, - std::size_t C, - std::size_t M, - std::size_t O, - template <class> class L, - class X - > - bool AllocatorSingleton< T, C, M, O, L, X >::IsCorrupted( void ) + /// Non-throwing single-object new returns NULL if allocation fails. + static void* operator new ( std::size_t size, const std::nothrow_t& ) throw () { typename MyThreadingModel::Lock lock; (void)lock; // get rid of warning - return Instance().IsCorrupt(); + return MyAllocatorSingleton::Instance().Allocate( size, false ); } - /** This standalone function provides the longevity level for Small-Object - Allocators which use the Loki::SingletonWithLongevity policy. The - SingletonWithLongevity class can find this function through argument- - dependent lookup. - - @par Longevity Levels - No Small-Object Allocator depends on any other Small-Object allocator, so - this does not need to calculate dependency levels among allocators, and - it returns just a constant. All allocators must live longer than the - objects which use the allocators, it must return a longevity level higher - than any such object. - */ - template - < - template <class, class> class T, - std::size_t C, - std::size_t M, - std::size_t O, - template <class> class L, - class X - > - inline unsigned int GetLongevity( - AllocatorSingleton< T, C, M, O, L, X > * ) + /// Placement single-object new merely calls global placement new. + inline static void* operator new ( std::size_t size, void* place ) { - // Returns highest possible value. - return 0xFFFFFFFF; + return ::operator new( size, place ); } + /// Single-object delete. + static void operator delete ( void* p, std::size_t size ) throw () + { + typename MyThreadingModel::Lock lock; + (void)lock; // get rid of warning + MyAllocatorSingleton::Instance().Deallocate( p, size ); + } - /** @class SmallObjectBase - @ingroup SmallObjectGroup - Base class for small object allocation classes. - The shared implementation of the new and delete operators are here instead - of being duplicated in both SmallObject or SmallValueObject, later just - called Small-Objects. This class is not meant to be used directly by clients, - or derived from by clients. Class has no data members so compilers can - use Empty-Base-Optimization. - - @par ThreadingModel - This class doesn't support ObjectLevelLockable policy for ThreadingModel. - The allocator is a singleton, so a per-instance mutex is not necessary. - Nor is using ObjectLevelLockable recommended with SingletonHolder since - the SingletonHolder::MakeInstance function requires a mutex that exists - prior to when the object is created - which is not possible if the mutex - is inside the object, such as required for ObjectLevelLockable. If you - attempt to use ObjectLevelLockable, the compiler will emit errors because - it can't use the default constructor in ObjectLevelLockable. If you need - a thread-safe allocator, use the ClassLevelLockable policy. - - @par Lifetime Policy - - The SmallObjectBase template needs a lifetime policy because it owns - a singleton of SmallObjAllocator which does all the low level functions. - When using a Small-Object in combination with the SingletonHolder template - you have to choose two lifetimes, that of the Small-Object and that of - the singleton. The rule is: The Small-Object lifetime must be greater than - the lifetime of the singleton hosting the Small-Object. Violating this rule - results in a crash on exit, because the hosting singleton tries to delete - the Small-Object which is then already destroyed. - - The lifetime policies recommended for use with Small-Objects hosted - by a SingletonHolder template are - - LongevityLifetime::DieAsSmallObjectParent / LongevityLifetime::DieAsSmallObjectChild - - SingletonWithLongevity - - FollowIntoDeath (not supported by MSVC 7.1) - - NoDestroy - - The default lifetime of Small-Objects is - LongevityLifetime::DieAsSmallObjectParent to - insure that memory is not released before a object with the lifetime - LongevityLifetime::DieAsSmallObjectChild using that - memory is destroyed. The LongevityLifetime::DieAsSmallObjectParent - lifetime has the highest possible value of a SetLongevity lifetime, so - you can use it in combination with your own lifetime not having also - the highest possible value. - - The DefaultLifetime and PhoenixSingleton policies are *not* recommended - since they can cause the allocator to be destroyed and release memory - for singletons hosting a object which inherit from either SmallObject - or SmallValueObject. - - @par Lifetime usage - - - LongevityLifetime: The Small-Object has - LongevityLifetime::DieAsSmallObjectParent policy and the Singleton - hosting the Small-Object has LongevityLifetime::DieAsSmallObjectChild. - The child lifetime has a hard coded SetLongevity lifetime which is - shorter than the lifetime of the parent, thus the child dies - before the parent. - - - Both Small-Object and Singleton use SingletonWithLongevity policy. - The longevity level for the singleton must be lower than that for the - Small-Object. This is why the AllocatorSingleton's GetLongevity function - returns the highest value. - - - FollowIntoDeath lifetime: The Small-Object has - FollowIntoDeath::With<LIFETIME>::AsMasterLiftime - policy and the Singleton has - FollowIntoDeath::AfterMaster<MASTERSINGLETON>::IsDestroyed policy, - where you could choose the LIFETIME. - - - Both Small-Object and Singleton use NoDestroy policy. - Since neither is ever destroyed, the destruction order does not matter. - Note: you will get memory leaks! - - - The Small-Object has NoDestroy policy but the Singleton has - SingletonWithLongevity policy. Note: you will get memory leaks! - - - You should *not* use NoDestroy for the singleton, and then use - SingletonWithLongevity for the Small-Object. - - @par Examples: - - - test/SmallObj/SmallSingleton.cpp - - test/Singleton/Dependencies.cpp + /** Non-throwing single-object delete is only called when nothrow + new operator is used, and the constructor throws an exception. */ - template - < - template <class, class> class ThreadingModel, - std::size_t chunkSize, - std::size_t maxSmallObjectSize, - std::size_t objectAlignSize, - template <class> class LifetimePolicy, - class MutexPolicy - > - class SmallObjectBase + static void operator delete ( void* p, const std::nothrow_t& ) throw() { + typename MyThreadingModel::Lock lock; + (void)lock; // get rid of warning + MyAllocatorSingleton::Instance().Deallocate( p ); + } -#if (LOKI_MAX_SMALL_OBJECT_SIZE != 0) && (LOKI_DEFAULT_CHUNK_SIZE != 0) && (LOKI_DEFAULT_OBJECT_ALIGNMENT != 0) - - public: - /// Defines type of allocator singleton, must be public - /// to handle singleton lifetime dependencies. - typedef AllocatorSingleton< ThreadingModel, chunkSize, - maxSmallObjectSize, objectAlignSize, LifetimePolicy > ObjAllocatorSingleton; - - private: - - /// Defines type for thread-safety locking mechanism. - typedef ThreadingModel< ObjAllocatorSingleton, MutexPolicy > MyThreadingModel; + /// Placement single-object delete merely calls global placement delete. + inline static void operator delete ( void* p, void* place ) + { + ::operator delete ( p, place ); + } - /// Use singleton defined in AllocatorSingleton. - typedef typename ObjAllocatorSingleton::MyAllocatorSingleton MyAllocatorSingleton; - - public: +#ifdef LOKI_SMALL_OBJECT_USE_NEW_ARRAY - /// Throwing single-object new throws bad_alloc when allocation fails. + /// Throwing array-object new throws bad_alloc when allocation fails. #ifdef _MSC_VER - /// @note MSVC complains about non-empty exception specification lists. - static void * operator new ( std::size_t size ) + /// @note MSVC complains about non-empty exception specification lists. + static void* operator new [] ( std::size_t size ) #else - static void * operator new ( std::size_t size ) throw ( std::bad_alloc ) + static void* operator new [] ( std::size_t size ) + throw ( std::bad_alloc ) #endif - { - typename MyThreadingModel::Lock lock; - (void)lock; // get rid of warning - return MyAllocatorSingleton::Instance().Allocate( size, true ); - } - - /// Non-throwing single-object new returns NULL if allocation fails. - static void * operator new ( std::size_t size, const std::nothrow_t & ) throw () - { - typename MyThreadingModel::Lock lock; - (void)lock; // get rid of warning - return MyAllocatorSingleton::Instance().Allocate( size, false ); - } - - /// Placement single-object new merely calls global placement new. - inline static void * operator new ( std::size_t size, void * place ) - { - return ::operator new( size, place ); - } - - /// Single-object delete. - static void operator delete ( void * p, std::size_t size ) throw () - { - typename MyThreadingModel::Lock lock; - (void)lock; // get rid of warning - MyAllocatorSingleton::Instance().Deallocate( p, size ); - } - - /** Non-throwing single-object delete is only called when nothrow - new operator is used, and the constructor throws an exception. - */ - static void operator delete ( void * p, const std::nothrow_t & ) throw() - { - typename MyThreadingModel::Lock lock; - (void)lock; // get rid of warning - MyAllocatorSingleton::Instance().Deallocate( p ); - } - - /// Placement single-object delete merely calls global placement delete. - inline static void operator delete ( void * p, void * place ) - { - ::operator delete ( p, place ); - } + { + typename MyThreadingModel::Lock lock; + (void)lock; // get rid of warning + return MyAllocatorSingleton::Instance().Allocate( size, true ); + } -#ifdef LOKI_SMALL_OBJECT_USE_NEW_ARRAY + /// Non-throwing array-object new returns NULL if allocation fails. + static void* operator new [] ( std::size_t size, + const std::nothrow_t& ) throw () + { + typename MyThreadingModel::Lock lock; + (void)lock; // get rid of warning + return MyAllocatorSingleton::Instance().Allocate( size, false ); + } - /// Throwing array-object new throws bad_alloc when allocation fails. -#ifdef _MSC_VER - /// @note MSVC complains about non-empty exception specification lists. - static void * operator new [] ( std::size_t size ) -#else - static void * operator new [] ( std::size_t size ) - throw ( std::bad_alloc ) -#endif - { - typename MyThreadingModel::Lock lock; - (void)lock; // get rid of warning - return MyAllocatorSingleton::Instance().Allocate( size, true ); - } - - /// Non-throwing array-object new returns NULL if allocation fails. - static void * operator new [] ( std::size_t size, - const std::nothrow_t & ) throw () - { - typename MyThreadingModel::Lock lock; - (void)lock; // get rid of warning - return MyAllocatorSingleton::Instance().Allocate( size, false ); - } - - /// Placement array-object new merely calls global placement new. - inline static void * operator new [] ( std::size_t size, void * place ) - { - return ::operator new( size, place ); - } - - /// Array-object delete. - static void operator delete [] ( void * p, std::size_t size ) throw () - { - typename MyThreadingModel::Lock lock; - (void)lock; // get rid of warning - MyAllocatorSingleton::Instance().Deallocate( p, size ); - } - - /** Non-throwing array-object delete is only called when nothrow - new operator is used, and the constructor throws an exception. - */ - static void operator delete [] ( void * p, - const std::nothrow_t & ) throw() - { - typename MyThreadingModel::Lock lock; - (void)lock; // get rid of warning - MyAllocatorSingleton::Instance().Deallocate( p ); - } - - /// Placement array-object delete merely calls global placement delete. - inline static void operator delete [] ( void * p, void * place ) - { - ::operator delete ( p, place ); - } -#endif // #if use new array functions. + /// Placement array-object new merely calls global placement new. + inline static void* operator new [] ( std::size_t size, void* place ) + { + return ::operator new( size, place ); + } -#endif // #if default template parameters are not zero + /// Array-object delete. + static void operator delete [] ( void* p, std::size_t size ) throw () + { + typename MyThreadingModel::Lock lock; + (void)lock; // get rid of warning + MyAllocatorSingleton::Instance().Deallocate( p, size ); + } - protected: - inline SmallObjectBase( void ) {} - inline SmallObjectBase( const SmallObjectBase & ) {} - inline SmallObjectBase & operator = ( const SmallObjectBase & ) - { return *this; } - inline ~SmallObjectBase() {} - }; // end class SmallObjectBase - - - /** @class SmallObject - @ingroup SmallObjectGroup - SmallObject Base class for polymorphic small objects, offers fast - allocations & deallocations. Destructor is virtual and public. Default - constructor is trivial. Copy-constructor and copy-assignment operator are - not implemented since polymorphic classes almost always disable those - operations. Class has no data members so compilers can use - Empty-Base-Optimization. + /** Non-throwing array-object delete is only called when nothrow + new operator is used, and the constructor throws an exception. */ - template - < - template <class, class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL, - std::size_t chunkSize = LOKI_DEFAULT_CHUNK_SIZE, - std::size_t maxSmallObjectSize = LOKI_MAX_SMALL_OBJECT_SIZE, - std::size_t objectAlignSize = LOKI_DEFAULT_OBJECT_ALIGNMENT, - template <class> class LifetimePolicy = LOKI_DEFAULT_SMALLOBJ_LIFETIME, - class MutexPolicy = LOKI_DEFAULT_MUTEX - > - class SmallObject : public SmallObjectBase< ThreadingModel, chunkSize, - maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy > + static void operator delete [] ( void* p, + const std::nothrow_t& ) throw() { + typename MyThreadingModel::Lock lock; + (void)lock; // get rid of warning + MyAllocatorSingleton::Instance().Deallocate( p ); + } - public: - virtual ~SmallObject() {} - protected: - inline SmallObject( void ) {} - - private: - /// Copy-constructor is not implemented. - SmallObject( const SmallObject & ); - /// Copy-assignment operator is not implemented. - SmallObject & operator = ( const SmallObject & ); - }; // end class SmallObject - - - /** @class SmallValueObject - @ingroup SmallObjectGroup - SmallValueObject Base class for small objects with value-type - semantics - offers fast allocations & deallocations. Destructor is - non-virtual, inline, and protected to prevent unintentional destruction - through base class. Default constructor is trivial. Copy-constructor - and copy-assignment operator are trivial since value-types almost always - need those operations. Class has no data members so compilers can use - Empty-Base-Optimization. - */ - template - < - template <class, class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL, - std::size_t chunkSize = LOKI_DEFAULT_CHUNK_SIZE, - std::size_t maxSmallObjectSize = LOKI_MAX_SMALL_OBJECT_SIZE, - std::size_t objectAlignSize = LOKI_DEFAULT_OBJECT_ALIGNMENT, - template <class> class LifetimePolicy = LOKI_DEFAULT_SMALLOBJ_LIFETIME, - class MutexPolicy = LOKI_DEFAULT_MUTEX - > - class SmallValueObject : public SmallObjectBase< ThreadingModel, chunkSize, - maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy > + /// Placement array-object delete merely calls global placement delete. + inline static void operator delete [] ( void* p, void* place ) { - protected: - inline SmallValueObject( void ) {} - inline SmallValueObject( const SmallValueObject & ) {} - inline SmallValueObject & operator = ( const SmallValueObject & ) - { return *this; } - inline ~SmallValueObject() {} - }; // end class SmallValueObject + ::operator delete ( p, place ); + } +#endif // #if use new array functions. + +#endif // #if default template parameters are not zero + +protected: + inline SmallObjectBase( void ) {} + inline SmallObjectBase( const SmallObjectBase& ) {} + inline SmallObjectBase& operator = ( const SmallObjectBase& ) + { return *this; } + inline ~SmallObjectBase() {} +}; // end class SmallObjectBase + + +/** @class SmallObject + @ingroup SmallObjectGroup + SmallObject Base class for polymorphic small objects, offers fast + allocations & deallocations. Destructor is virtual and public. Default + constructor is trivial. Copy-constructor and copy-assignment operator are + not implemented since polymorphic classes almost always disable those + operations. Class has no data members so compilers can use + Empty-Base-Optimization. + */ +template +< +template <class, class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL, + std::size_t chunkSize = LOKI_DEFAULT_CHUNK_SIZE, + std::size_t maxSmallObjectSize = LOKI_MAX_SMALL_OBJECT_SIZE, + std::size_t objectAlignSize = LOKI_DEFAULT_OBJECT_ALIGNMENT, + template <class> class LifetimePolicy = LOKI_DEFAULT_SMALLOBJ_LIFETIME, + class MutexPolicy = LOKI_DEFAULT_MUTEX + > +class SmallObject : public SmallObjectBase< ThreadingModel, chunkSize, + maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy > +{ + +public: + virtual ~SmallObject() {} +protected: + inline SmallObject( void ) {} + +private: + /// Copy-constructor is not implemented. + SmallObject( const SmallObject& ); + /// Copy-assignment operator is not implemented. + SmallObject& operator = ( const SmallObject& ); +}; // end class SmallObject + + +/** @class SmallValueObject + @ingroup SmallObjectGroup + SmallValueObject Base class for small objects with value-type + semantics - offers fast allocations & deallocations. Destructor is + non-virtual, inline, and protected to prevent unintentional destruction + through base class. Default constructor is trivial. Copy-constructor + and copy-assignment operator are trivial since value-types almost always + need those operations. Class has no data members so compilers can use + Empty-Base-Optimization. + */ +template +< +template <class, class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL, + std::size_t chunkSize = LOKI_DEFAULT_CHUNK_SIZE, + std::size_t maxSmallObjectSize = LOKI_MAX_SMALL_OBJECT_SIZE, + std::size_t objectAlignSize = LOKI_DEFAULT_OBJECT_ALIGNMENT, + template <class> class LifetimePolicy = LOKI_DEFAULT_SMALLOBJ_LIFETIME, + class MutexPolicy = LOKI_DEFAULT_MUTEX + > +class SmallValueObject : public SmallObjectBase< ThreadingModel, chunkSize, + maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy > +{ +protected: + inline SmallValueObject( void ) {} + inline SmallValueObject( const SmallValueObject& ) {} + inline SmallValueObject& operator = ( const SmallValueObject& ) + { return *this; } + inline ~SmallValueObject() {} +}; // end class SmallValueObject } // namespace Loki diff --git a/shared/loki/SmartPtr.h b/shared/loki/SmartPtr.h index df548553..fb14258e 100644 --- a/shared/loki/SmartPtr.h +++ b/shared/loki/SmartPtr.h @@ -67,78 +67,78 @@ namespace Loki //////////////////////////////////////////////////////////////////////////////// - template <class T> - class HeapStorage - { - public: - typedef T* StoredType; /// the type of the pointee_ object - typedef T* InitPointerType; /// type used to declare OwnershipPolicy type. - typedef T* PointerType; /// type returned by operator-> - typedef T& ReferenceType; /// type returned by operator* +template <class T> +class HeapStorage +{ +public: + typedef T* StoredType; /// the type of the pointee_ object + typedef T* InitPointerType; /// type used to declare OwnershipPolicy type. + typedef T* PointerType; /// type returned by operator-> + typedef T& ReferenceType; /// type returned by operator* - HeapStorage() : pointee_(Default()) - {} + HeapStorage() : pointee_(Default()) + {} - // The storage policy doesn't initialize the stored pointer - // which will be initialized by the OwnershipPolicy's Clone fn - HeapStorage(const HeapStorage&) : pointee_(0) - {} + // The storage policy doesn't initialize the stored pointer + // which will be initialized by the OwnershipPolicy's Clone fn + HeapStorage(const HeapStorage&) : pointee_(0) + {} - template <class U> - HeapStorage(const HeapStorage<U>&) : pointee_(0) - {} + template <class U> + HeapStorage(const HeapStorage<U>&) : pointee_(0) + {} - HeapStorage(const StoredType& p) : pointee_(p) {} + HeapStorage(const StoredType& p) : pointee_(p) {} - PointerType operator->() const { return pointee_; } + PointerType operator->() const { return pointee_; } - ReferenceType operator*() const { return *pointee_; } + ReferenceType operator*() const { return *pointee_; } - void Swap(HeapStorage& rhs) - { std::swap(pointee_, rhs.pointee_); } + void Swap(HeapStorage& rhs) + { std::swap(pointee_, rhs.pointee_); } - // Accessors - template <class F> - friend typename HeapStorage<F>::PointerType GetImpl(const HeapStorage<F>& sp); + // Accessors + template <class F> + friend typename HeapStorage<F>::PointerType GetImpl(const HeapStorage<F>& sp); - template <class F> - friend const typename HeapStorage<F>::StoredType& GetImplRef(const HeapStorage<F>& sp); + template <class F> + friend const typename HeapStorage<F>::StoredType& GetImplRef(const HeapStorage<F>& sp); - template <class F> - friend typename HeapStorage<F>::StoredType& GetImplRef(HeapStorage<F>& sp); + template <class F> + friend typename HeapStorage<F>::StoredType& GetImplRef(HeapStorage<F>& sp); - protected: - // Destroys the data stored - // (Destruction might be taken over by the OwnershipPolicy) - void Destroy() +protected: + // Destroys the data stored + // (Destruction might be taken over by the OwnershipPolicy) + void Destroy() + { + if ( 0 != pointee_ ) { - if ( 0 != pointee_ ) - { - pointee_->~T(); - ::free( pointee_ ); - } + pointee_->~T(); + ::free( pointee_ ); } + } - // Default value to initialize the pointer - static StoredType Default() - { return 0; } + // Default value to initialize the pointer + static StoredType Default() + { return 0; } - private: - // Data - StoredType pointee_; - }; +private: + // Data + StoredType pointee_; +}; - template <class T> - inline typename HeapStorage<T>::PointerType GetImpl(const HeapStorage<T>& sp) - { return sp.pointee_; } +template <class T> +inline typename HeapStorage<T>::PointerType GetImpl(const HeapStorage<T>& sp) +{ return sp.pointee_; } - template <class T> - inline const typename HeapStorage<T>::StoredType& GetImplRef(const HeapStorage<T>& sp) - { return sp.pointee_; } +template <class T> +inline const typename HeapStorage<T>::StoredType& GetImplRef(const HeapStorage<T>& sp) +{ return sp.pointee_; } - template <class T> - inline typename HeapStorage<T>::StoredType& GetImplRef(HeapStorage<T>& sp) - { return sp.pointee_; } +template <class T> +inline typename HeapStorage<T>::StoredType& GetImplRef(HeapStorage<T>& sp) +{ return sp.pointee_; } //////////////////////////////////////////////////////////////////////////////// @@ -149,77 +149,77 @@ namespace Loki //////////////////////////////////////////////////////////////////////////////// - template <class T> - class DefaultSPStorage - { - public: - typedef T* StoredType; // the type of the pointee_ object - typedef T* InitPointerType; /// type used to declare OwnershipPolicy type. - typedef T* PointerType; // type returned by operator-> - typedef T& ReferenceType; // type returned by operator* +template <class T> +class DefaultSPStorage +{ +public: + typedef T* StoredType; // the type of the pointee_ object + typedef T* InitPointerType; /// type used to declare OwnershipPolicy type. + typedef T* PointerType; // type returned by operator-> + typedef T& ReferenceType; // type returned by operator* - DefaultSPStorage() : pointee_(Default()) - {} + DefaultSPStorage() : pointee_(Default()) + {} - // The storage policy doesn't initialize the stored pointer - // which will be initialized by the OwnershipPolicy's Clone fn - DefaultSPStorage(const DefaultSPStorage&) : pointee_(0) - {} + // The storage policy doesn't initialize the stored pointer + // which will be initialized by the OwnershipPolicy's Clone fn + DefaultSPStorage(const DefaultSPStorage&) : pointee_(0) + {} - template <class U> - DefaultSPStorage(const DefaultSPStorage<U>&) : pointee_(0) - {} + template <class U> + DefaultSPStorage(const DefaultSPStorage<U>&) : pointee_(0) + {} - DefaultSPStorage(const StoredType& p) : pointee_(p) {} + DefaultSPStorage(const StoredType& p) : pointee_(p) {} - PointerType operator->() const { return pointee_; } + PointerType operator->() const { return pointee_; } - ReferenceType operator*() const { return *pointee_; } + ReferenceType operator*() const { return *pointee_; } - void Swap(DefaultSPStorage& rhs) - { std::swap(pointee_, rhs.pointee_); } + void Swap(DefaultSPStorage& rhs) + { std::swap(pointee_, rhs.pointee_); } - // Accessors - template <class F> - friend typename DefaultSPStorage<F>::PointerType GetImpl(const DefaultSPStorage<F>& sp); + // Accessors + template <class F> + friend typename DefaultSPStorage<F>::PointerType GetImpl(const DefaultSPStorage<F>& sp); - template <class F> - friend const typename DefaultSPStorage<F>::StoredType& GetImplRef(const DefaultSPStorage<F>& sp); + template <class F> + friend const typename DefaultSPStorage<F>::StoredType& GetImplRef(const DefaultSPStorage<F>& sp); - template <class F> - friend typename DefaultSPStorage<F>::StoredType& GetImplRef(DefaultSPStorage<F>& sp); + template <class F> + friend typename DefaultSPStorage<F>::StoredType& GetImplRef(DefaultSPStorage<F>& sp); - protected: - // Destroys the data stored - // (Destruction might be taken over by the OwnershipPolicy) - // - // If your compiler gives you a warning in this area while - // compiling the tests, it is on purpose, please ignore it. - void Destroy() - { - delete pointee_; - } +protected: + // Destroys the data stored + // (Destruction might be taken over by the OwnershipPolicy) + // + // If your compiler gives you a warning in this area while + // compiling the tests, it is on purpose, please ignore it. + void Destroy() + { + delete pointee_; + } - // Default value to initialize the pointer - static StoredType Default() - { return 0; } + // Default value to initialize the pointer + static StoredType Default() + { return 0; } - private: - // Data - StoredType pointee_; - }; +private: + // Data + StoredType pointee_; +}; - template <class T> - inline typename DefaultSPStorage<T>::PointerType GetImpl(const DefaultSPStorage<T>& sp) - { return sp.pointee_; } +template <class T> +inline typename DefaultSPStorage<T>::PointerType GetImpl(const DefaultSPStorage<T>& sp) +{ return sp.pointee_; } - template <class T> - inline const typename DefaultSPStorage<T>::StoredType& GetImplRef(const DefaultSPStorage<T>& sp) - { return sp.pointee_; } +template <class T> +inline const typename DefaultSPStorage<T>::StoredType& GetImplRef(const DefaultSPStorage<T>& sp) +{ return sp.pointee_; } - template <class T> - inline typename DefaultSPStorage<T>::StoredType& GetImplRef(DefaultSPStorage<T>& sp) - { return sp.pointee_; } +template <class T> +inline typename DefaultSPStorage<T>::StoredType& GetImplRef(DefaultSPStorage<T>& sp) +{ return sp.pointee_; } //////////////////////////////////////////////////////////////////////////////// @@ -245,107 +245,107 @@ namespace Loki /// LockedStorage which calls other functions to lock the object. //////////////////////////////////////////////////////////////////////////////// - template <class T> - class Locker +template <class T> +class Locker +{ +public: + Locker( const T* p ) : pointee_( const_cast< T* >( p ) ) { - public: - Locker( const T * p ) : pointee_( const_cast< T * >( p ) ) - { - if ( pointee_ != 0 ) - pointee_->Lock(); - } + if ( pointee_ != 0 ) + pointee_->Lock(); + } - ~Locker( void ) - { - if ( pointee_ != 0 ) - pointee_->Unlock(); - } + ~Locker( void ) + { + if ( pointee_ != 0 ) + pointee_->Unlock(); + } - operator T * () - { - return pointee_; - } + operator T* () + { + return pointee_; + } - T * operator->() - { - return pointee_; - } + T* operator->() + { + return pointee_; + } - private: - Locker( void ); - Locker & operator = ( const Locker & ); - T * pointee_; - }; +private: + Locker( void ); + Locker& operator = ( const Locker& ); + T* pointee_; +}; - template <class T> - class LockedStorage - { - public: +template <class T> +class LockedStorage +{ +public: - typedef T* StoredType; /// the type of the pointee_ object - typedef T* InitPointerType; /// type used to declare OwnershipPolicy type. - typedef Locker< T > PointerType; /// type returned by operator-> - typedef T& ReferenceType; /// type returned by operator* + typedef T* StoredType; /// the type of the pointee_ object + typedef T* InitPointerType; /// type used to declare OwnershipPolicy type. + typedef Locker< T > PointerType; /// type returned by operator-> + typedef T& ReferenceType; /// type returned by operator* - LockedStorage() : pointee_( Default() ) {} + LockedStorage() : pointee_( Default() ) {} - ~LockedStorage( void ) {} + ~LockedStorage( void ) {} - LockedStorage( const LockedStorage&) : pointee_( 0 ) {} + LockedStorage( const LockedStorage&) : pointee_( 0 ) {} - LockedStorage( const StoredType & p ) : pointee_( p ) {} + LockedStorage( const StoredType& p ) : pointee_( p ) {} - PointerType operator->() - { - return Locker< T >( pointee_ ); - } + PointerType operator->() + { + return Locker< T >( pointee_ ); + } - void Swap(LockedStorage& rhs) - { - std::swap( pointee_, rhs.pointee_ ); - } + void Swap(LockedStorage& rhs) + { + std::swap( pointee_, rhs.pointee_ ); + } - // Accessors - template <class F> - friend typename LockedStorage<F>::InitPointerType GetImpl(const LockedStorage<F>& sp); + // Accessors + template <class F> + friend typename LockedStorage<F>::InitPointerType GetImpl(const LockedStorage<F>& sp); - template <class F> - friend const typename LockedStorage<F>::StoredType& GetImplRef(const LockedStorage<F>& sp); + template <class F> + friend const typename LockedStorage<F>::StoredType& GetImplRef(const LockedStorage<F>& sp); - template <class F> - friend typename LockedStorage<F>::StoredType& GetImplRef(LockedStorage<F>& sp); + template <class F> + friend typename LockedStorage<F>::StoredType& GetImplRef(LockedStorage<F>& sp); - protected: - // Destroys the data stored - // (Destruction might be taken over by the OwnershipPolicy) - void Destroy() - { - delete pointee_; - } +protected: + // Destroys the data stored + // (Destruction might be taken over by the OwnershipPolicy) + void Destroy() + { + delete pointee_; + } - // Default value to initialize the pointer - static StoredType Default() - { return 0; } + // Default value to initialize the pointer + static StoredType Default() + { return 0; } - private: - /// Dereference operator is not implemented. - ReferenceType operator*(); +private: + /// Dereference operator is not implemented. + ReferenceType operator*(); - // Data - StoredType pointee_; - }; + // Data + StoredType pointee_; +}; - template <class T> - inline typename LockedStorage<T>::InitPointerType GetImpl(const LockedStorage<T>& sp) - { return sp.pointee_; } +template <class T> +inline typename LockedStorage<T>::InitPointerType GetImpl(const LockedStorage<T>& sp) +{ return sp.pointee_; } - template <class T> - inline const typename LockedStorage<T>::StoredType& GetImplRef(const LockedStorage<T>& sp) - { return sp.pointee_; } +template <class T> +inline const typename LockedStorage<T>::StoredType& GetImplRef(const LockedStorage<T>& sp) +{ return sp.pointee_; } - template <class T> - inline typename LockedStorage<T>::StoredType& GetImplRef(LockedStorage<T>& sp) - { return sp.pointee_; } +template <class T> +inline typename LockedStorage<T>::StoredType& GetImplRef(LockedStorage<T>& sp) +{ return sp.pointee_; } //////////////////////////////////////////////////////////////////////////////// @@ -356,72 +356,72 @@ namespace Loki //////////////////////////////////////////////////////////////////////////////// - template <class T> - class ArrayStorage - { - public: - typedef T* StoredType; // the type of the pointee_ object - typedef T* InitPointerType; /// type used to declare OwnershipPolicy type. - typedef T* PointerType; // type returned by operator-> - typedef T& ReferenceType; // type returned by operator* +template <class T> +class ArrayStorage +{ +public: + typedef T* StoredType; // the type of the pointee_ object + typedef T* InitPointerType; /// type used to declare OwnershipPolicy type. + typedef T* PointerType; // type returned by operator-> + typedef T& ReferenceType; // type returned by operator* - ArrayStorage() : pointee_(Default()) - {} + ArrayStorage() : pointee_(Default()) + {} - // The storage policy doesn't initialize the stored pointer - // which will be initialized by the OwnershipPolicy's Clone fn - ArrayStorage(const ArrayStorage&) : pointee_(0) - {} + // The storage policy doesn't initialize the stored pointer + // which will be initialized by the OwnershipPolicy's Clone fn + ArrayStorage(const ArrayStorage&) : pointee_(0) + {} - template <class U> - ArrayStorage(const ArrayStorage<U>&) : pointee_(0) - {} + template <class U> + ArrayStorage(const ArrayStorage<U>&) : pointee_(0) + {} - ArrayStorage(const StoredType& p) : pointee_(p) {} + ArrayStorage(const StoredType& p) : pointee_(p) {} - PointerType operator->() const { return pointee_; } + PointerType operator->() const { return pointee_; } - ReferenceType operator*() const { return *pointee_; } + ReferenceType operator*() const { return *pointee_; } - void Swap(ArrayStorage& rhs) - { std::swap(pointee_, rhs.pointee_); } + void Swap(ArrayStorage& rhs) + { std::swap(pointee_, rhs.pointee_); } - // Accessors - template <class F> - friend typename ArrayStorage<F>::PointerType GetImpl(const ArrayStorage<F>& sp); + // Accessors + template <class F> + friend typename ArrayStorage<F>::PointerType GetImpl(const ArrayStorage<F>& sp); - template <class F> - friend const typename ArrayStorage<F>::StoredType& GetImplRef(const ArrayStorage<F>& sp); + template <class F> + friend const typename ArrayStorage<F>::StoredType& GetImplRef(const ArrayStorage<F>& sp); - template <class F> - friend typename ArrayStorage<F>::StoredType& GetImplRef(ArrayStorage<F>& sp); + template <class F> + friend typename ArrayStorage<F>::StoredType& GetImplRef(ArrayStorage<F>& sp); - protected: - // Destroys the data stored - // (Destruction might be taken over by the OwnershipPolicy) - void Destroy() - { delete [] pointee_; } +protected: + // Destroys the data stored + // (Destruction might be taken over by the OwnershipPolicy) + void Destroy() + { delete [] pointee_; } - // Default value to initialize the pointer - static StoredType Default() - { return 0; } + // Default value to initialize the pointer + static StoredType Default() + { return 0; } - private: - // Data - StoredType pointee_; - }; +private: + // Data + StoredType pointee_; +}; - template <class T> - inline typename ArrayStorage<T>::PointerType GetImpl(const ArrayStorage<T>& sp) - { return sp.pointee_; } +template <class T> +inline typename ArrayStorage<T>::PointerType GetImpl(const ArrayStorage<T>& sp) +{ return sp.pointee_; } - template <class T> - inline const typename ArrayStorage<T>::StoredType& GetImplRef(const ArrayStorage<T>& sp) - { return sp.pointee_; } +template <class T> +inline const typename ArrayStorage<T>::StoredType& GetImplRef(const ArrayStorage<T>& sp) +{ return sp.pointee_; } - template <class T> - inline typename ArrayStorage<T>::StoredType& GetImplRef(ArrayStorage<T>& sp) - { return sp.pointee_; } +template <class T> +inline typename ArrayStorage<T>::StoredType& GetImplRef(ArrayStorage<T>& sp) +{ return sp.pointee_; } //////////////////////////////////////////////////////////////////////////////// @@ -432,54 +432,54 @@ namespace Loki /// Provides a classic external reference counting implementation //////////////////////////////////////////////////////////////////////////////// - template <class P> - class RefCounted +template <class P> +class RefCounted +{ +public: + RefCounted() + : pCount_(static_cast<uintptr_t*>( + SmallObject<>::operator new(sizeof(uintptr_t)))) { - public: - RefCounted() - : pCount_(static_cast<uintptr_t*>( - SmallObject<>::operator new(sizeof(uintptr_t)))) - { - assert(pCount_!=0); - *pCount_ = 1; - } + assert(pCount_!=0); + *pCount_ = 1; + } - RefCounted(const RefCounted& rhs) + RefCounted(const RefCounted& rhs) : pCount_(rhs.pCount_) - {} + {} - // MWCW lacks template friends, hence the following kludge - template <typename P1> - RefCounted(const RefCounted<P1>& rhs) + // MWCW lacks template friends, hence the following kludge + template <typename P1> + RefCounted(const RefCounted<P1>& rhs) : pCount_(reinterpret_cast<const RefCounted&>(rhs).pCount_) - {} + {} - P Clone(const P& val) - { - ++*pCount_; - return val; - } + P Clone(const P& val) + { + ++*pCount_; + return val; + } - bool Release(const P&) + bool Release(const P&) + { + if (!--*pCount_) { - if (!--*pCount_) - { - SmallObject<>::operator delete(pCount_, sizeof(uintptr_t)); - pCount_ = NULL; - return true; - } - return false; + SmallObject<>::operator delete(pCount_, sizeof(uintptr_t)); + pCount_ = NULL; + return true; } + return false; + } - void Swap(RefCounted& rhs) - { std::swap(pCount_, rhs.pCount_); } + void Swap(RefCounted& rhs) + { std::swap(pCount_, rhs.pCount_); } - enum { destructiveCopy = false }; + enum { destructiveCopy = false }; - private: - // Data - uintptr_t* pCount_; - }; +private: + // Data + uintptr_t* pCount_; +}; //////////////////////////////////////////////////////////////////////////////// /// \struct RefCountedMT @@ -500,68 +500,68 @@ namespace Loki /// fixed at a higher design level, and no change to this class could fix it. //////////////////////////////////////////////////////////////////////////////// - template <template <class, class> class ThreadingModel, - class MX = LOKI_DEFAULT_MUTEX > - struct RefCountedMTAdj +template <template <class, class> class ThreadingModel, + class MX = LOKI_DEFAULT_MUTEX > +struct RefCountedMTAdj +{ + template <class P> + class RefCountedMT : public ThreadingModel< RefCountedMT<P>, MX > { - template <class P> - class RefCountedMT : public ThreadingModel< RefCountedMT<P>, MX > - { - typedef ThreadingModel< RefCountedMT<P>, MX > base_type; - typedef typename base_type::IntType CountType; - typedef volatile CountType *CountPtrType; + typedef ThreadingModel< RefCountedMT<P>, MX > base_type; + typedef typename base_type::IntType CountType; + typedef volatile CountType* CountPtrType; - public: - RefCountedMT() - { - pCount_ = static_cast<CountPtrType>( - SmallObject<LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL>::operator new( - sizeof(*pCount_))); - assert(pCount_); - //*pCount_ = 1; - ThreadingModel<RefCountedMT, MX>::AtomicAssign(*pCount_, 1); - } + public: + RefCountedMT() + { + pCount_ = static_cast<CountPtrType>( + SmallObject<LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL>::operator new( + sizeof(*pCount_))); + assert(pCount_); + //*pCount_ = 1; + ThreadingModel<RefCountedMT, MX>::AtomicAssign(*pCount_, 1); + } - RefCountedMT(const RefCountedMT& rhs) + RefCountedMT(const RefCountedMT& rhs) : pCount_(rhs.pCount_) - {} + {} - //MWCW lacks template friends, hence the following kludge - template <typename P1> - RefCountedMT(const RefCountedMT<P1>& rhs) + //MWCW lacks template friends, hence the following kludge + template <typename P1> + RefCountedMT(const RefCountedMT<P1>& rhs) : pCount_(reinterpret_cast<const RefCountedMT<P>&>(rhs).pCount_) - {} + {} - P Clone(const P& val) - { - ThreadingModel<RefCountedMT, MX>::AtomicIncrement(*pCount_); - return val; - } + P Clone(const P& val) + { + ThreadingModel<RefCountedMT, MX>::AtomicIncrement(*pCount_); + return val; + } - bool Release(const P&) + bool Release(const P&) + { + bool isZero = false; + ThreadingModel< RefCountedMT, MX >::AtomicDecrement( *pCount_, 0, isZero ); + if ( isZero ) { - bool isZero = false; - ThreadingModel< RefCountedMT, MX >::AtomicDecrement( *pCount_, 0, isZero ); - if ( isZero ) - { - SmallObject<LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL>::operator delete( - const_cast<CountType *>(pCount_), - sizeof(*pCount_)); - return true; - } - return false; + SmallObject<LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL>::operator delete( + const_cast<CountType*>(pCount_), + sizeof(*pCount_)); + return true; } + return false; + } - void Swap(RefCountedMT& rhs) - { std::swap(pCount_, rhs.pCount_); } + void Swap(RefCountedMT& rhs) + { std::swap(pCount_, rhs.pCount_); } - enum { destructiveCopy = false }; + enum { destructiveCopy = false }; - private: - // Data - CountPtrType pCount_; - }; + private: + // Data + CountPtrType pCount_; }; +}; //////////////////////////////////////////////////////////////////////////////// /// \class COMRefCounted @@ -571,36 +571,36 @@ namespace Loki /// Adapts COM intrusive reference counting to OwnershipPolicy-specific syntax //////////////////////////////////////////////////////////////////////////////// - template <class P> - class COMRefCounted - { - public: - COMRefCounted() - {} +template <class P> +class COMRefCounted +{ +public: + COMRefCounted() + {} - template <class U> - COMRefCounted(const COMRefCounted<U>&) - {} + template <class U> + COMRefCounted(const COMRefCounted<U>&) + {} - static P Clone(const P& val) - { - if(val!=0) - val->AddRef(); - return val; - } + static P Clone(const P& val) + { + if(val!=0) + val->AddRef(); + return val; + } - static bool Release(const P& val) - { - if(val!=0) - val->Release(); - return false; - } + static bool Release(const P& val) + { + if(val!=0) + val->Release(); + return false; + } - enum { destructiveCopy = false }; + enum { destructiveCopy = false }; - static void Swap(COMRefCounted&) - {} - }; + static void Swap(COMRefCounted&) + {} +}; //////////////////////////////////////////////////////////////////////////////// /// \struct DeepCopy @@ -611,27 +611,27 @@ namespace Loki /// function of the pointee type //////////////////////////////////////////////////////////////////////////////// - template <class P> - struct DeepCopy - { - DeepCopy() - {} +template <class P> +struct DeepCopy +{ + DeepCopy() + {} - template <class P1> - DeepCopy(const DeepCopy<P1>&) - {} + template <class P1> + DeepCopy(const DeepCopy<P1>&) + {} - static P Clone(const P& val) - { return val->Clone(); } + static P Clone(const P& val) + { return val->Clone(); } - static bool Release(const P&) - { return true; } + static bool Release(const P&) + { return true; } - static void Swap(DeepCopy&) - {} + static void Swap(DeepCopy&) + {} - enum { destructiveCopy = false }; - }; + enum { destructiveCopy = false }; +}; //////////////////////////////////////////////////////////////////////////////// /// \class RefLinked @@ -641,59 +641,59 @@ namespace Loki /// Implements reference linking //////////////////////////////////////////////////////////////////////////////// - namespace Private - { - class LOKI_EXPORT RefLinkedBase - { - public: - RefLinkedBase() - { prev_ = next_ = this; } +namespace Private +{ +class LOKI_EXPORT RefLinkedBase +{ +public: + RefLinkedBase() + { prev_ = next_ = this; } - RefLinkedBase(const RefLinkedBase& rhs); + RefLinkedBase(const RefLinkedBase& rhs); - bool Release(); + bool Release(); - void Swap(RefLinkedBase& rhs); + void Swap(RefLinkedBase& rhs); - bool Merge( RefLinkedBase & rhs ); + bool Merge( RefLinkedBase& rhs ); - enum { destructiveCopy = false }; + enum { destructiveCopy = false }; - private: - static unsigned int CountPrevCycle( const RefLinkedBase * pThis ); - static unsigned int CountNextCycle( const RefLinkedBase * pThis ); - bool HasPrevNode( const RefLinkedBase * p ) const; - bool HasNextNode( const RefLinkedBase * p ) const; +private: + static unsigned int CountPrevCycle( const RefLinkedBase* pThis ); + static unsigned int CountNextCycle( const RefLinkedBase* pThis ); + bool HasPrevNode( const RefLinkedBase* p ) const; + bool HasNextNode( const RefLinkedBase* p ) const; - mutable const RefLinkedBase* prev_; - mutable const RefLinkedBase* next_; - }; - } + mutable const RefLinkedBase* prev_; + mutable const RefLinkedBase* next_; +}; +} - template <class P> - class RefLinked : public Private::RefLinkedBase - { - public: - RefLinked() - {} +template <class P> +class RefLinked : public Private::RefLinkedBase +{ +public: + RefLinked() + {} - template <class P1> - RefLinked(const RefLinked<P1>& rhs) + template <class P1> + RefLinked(const RefLinked<P1>& rhs) : Private::RefLinkedBase(rhs) - {} + {} - static P Clone(const P& val) - { return val; } + static P Clone(const P& val) + { return val; } - bool Release(const P&) - { return Private::RefLinkedBase::Release(); } + bool Release(const P&) + { return Private::RefLinkedBase::Release(); } - template < class P1 > - bool Merge( RefLinked< P1 > & rhs ) - { - return Private::RefLinkedBase::Merge( rhs ); - } - }; + template < class P1 > + bool Merge( RefLinked< P1 > & rhs ) + { + return Private::RefLinkedBase::Merge( rhs ); + } +}; //////////////////////////////////////////////////////////////////////////////// /// \class DestructiveCopy @@ -703,33 +703,33 @@ namespace Loki /// Implements destructive copy semantics (a la std::auto_ptr) //////////////////////////////////////////////////////////////////////////////// - template <class P> - class DestructiveCopy - { - public: - DestructiveCopy() - {} +template <class P> +class DestructiveCopy +{ +public: + DestructiveCopy() + {} - template <class P1> - DestructiveCopy(const DestructiveCopy<P1>&) - {} + template <class P1> + DestructiveCopy(const DestructiveCopy<P1>&) + {} - template <class P1> - static P Clone(P1& val) - { - P result(val); - val = P1(); - return result; - } + template <class P1> + static P Clone(P1& val) + { + P result(val); + val = P1(); + return result; + } - static bool Release(const P&) - { return true; } + static bool Release(const P&) + { return true; } - static void Swap(DestructiveCopy&) - {} + static void Swap(DestructiveCopy&) + {} - enum { destructiveCopy = true }; - }; + enum { destructiveCopy = true }; +}; //////////////////////////////////////////////////////////////////////////////// /// \class NoCopy @@ -739,33 +739,33 @@ namespace Loki /// Implements a policy that doesn't allow copying objects //////////////////////////////////////////////////////////////////////////////// - template <class P> - class NoCopy - { - public: - NoCopy() - {} +template <class P> +class NoCopy +{ +public: + NoCopy() + {} - template <class P1> - NoCopy(const NoCopy<P1>&) - {} + template <class P1> + NoCopy(const NoCopy<P1>&) + {} - static P Clone(const P&) - { - // Make it depended on template parameter - static const bool DependedFalse = sizeof(P*) == 0; + static P Clone(const P&) + { + // Make it depended on template parameter + static const bool DependedFalse = sizeof(P*) == 0; - LOKI_STATIC_CHECK(DependedFalse, This_Policy_Disallows_Value_Copying); - } + LOKI_STATIC_CHECK(DependedFalse, This_Policy_Disallows_Value_Copying); + } - static bool Release(const P&) - { return true; } + static bool Release(const P&) + { return true; } - static void Swap(NoCopy&) - {} + static void Swap(NoCopy&) + {} - enum { destructiveCopy = false }; - }; + enum { destructiveCopy = false }; +}; //////////////////////////////////////////////////////////////////////////////// /// \struct AllowConversion @@ -775,13 +775,13 @@ namespace Loki /// Allows implicit conversion from SmartPtr to the pointee type //////////////////////////////////////////////////////////////////////////////// - struct AllowConversion - { - enum { allow = true }; +struct AllowConversion +{ + enum { allow = true }; - void Swap(AllowConversion&) - {} - }; + void Swap(AllowConversion&) + {} +}; //////////////////////////////////////////////////////////////////////////////// /// \struct DisallowConversion @@ -792,19 +792,19 @@ namespace Loki /// You can initialize a DisallowConversion with an AllowConversion //////////////////////////////////////////////////////////////////////////////// - struct DisallowConversion - { - DisallowConversion() - {} +struct DisallowConversion +{ + DisallowConversion() + {} - DisallowConversion(const AllowConversion&) - {} + DisallowConversion(const AllowConversion&) + {} - enum { allow = false }; + enum { allow = false }; - void Swap(DisallowConversion&) - {} - }; + void Swap(DisallowConversion&) + {} +}; //////////////////////////////////////////////////////////////////////////////// /// \struct NoCheck @@ -814,28 +814,28 @@ namespace Loki /// Well, it's clear what it does :o) //////////////////////////////////////////////////////////////////////////////// - template <class P> - struct NoCheck - { - NoCheck() - {} +template <class P> +struct NoCheck +{ + NoCheck() + {} - template <class P1> - NoCheck(const NoCheck<P1>&) - {} + template <class P1> + NoCheck(const NoCheck<P1>&) + {} - static void OnDefault(const P&) - {} + static void OnDefault(const P&) + {} - static void OnInit(const P&) - {} + static void OnInit(const P&) + {} - static void OnDereference(const P&) - {} + static void OnDereference(const P&) + {} - static void Swap(NoCheck&) - {} - }; + static void Swap(NoCheck&) + {} +}; //////////////////////////////////////////////////////////////////////////////// @@ -846,32 +846,32 @@ namespace Loki /// Checks the pointer before dereference //////////////////////////////////////////////////////////////////////////////// - template <class P> - struct AssertCheck - { - AssertCheck() - {} +template <class P> +struct AssertCheck +{ + AssertCheck() + {} - template <class P1> - AssertCheck(const AssertCheck<P1>&) - {} + template <class P1> + AssertCheck(const AssertCheck<P1>&) + {} - template <class P1> - AssertCheck(const NoCheck<P1>&) - {} + template <class P1> + AssertCheck(const NoCheck<P1>&) + {} - static void OnDefault(const P&) - {} + static void OnDefault(const P&) + {} - static void OnInit(const P&) - {} + static void OnInit(const P&) + {} - static void OnDereference(P val) - { assert(val); (void)val; } + static void OnDereference(P val) + { assert(val); (void)val; } - static void Swap(AssertCheck&) - {} - }; + static void Swap(AssertCheck&) + {} +}; //////////////////////////////////////////////////////////////////////////////// /// \struct AssertCheckStrict @@ -882,36 +882,36 @@ namespace Loki /// You can initialize an AssertCheckStrict with an AssertCheck //////////////////////////////////////////////////////////////////////////////// - template <class P> - struct AssertCheckStrict - { - AssertCheckStrict() - {} +template <class P> +struct AssertCheckStrict +{ + AssertCheckStrict() + {} - template <class U> - AssertCheckStrict(const AssertCheckStrict<U>&) - {} + template <class U> + AssertCheckStrict(const AssertCheckStrict<U>&) + {} - template <class U> - AssertCheckStrict(const AssertCheck<U>&) - {} + template <class U> + AssertCheckStrict(const AssertCheck<U>&) + {} - template <class P1> - AssertCheckStrict(const NoCheck<P1>&) - {} + template <class P1> + AssertCheckStrict(const NoCheck<P1>&) + {} - static void OnDefault(P val) - { assert(val); } + static void OnDefault(P val) + { assert(val); } - static void OnInit(P val) - { assert(val); } + static void OnInit(P val) + { assert(val); } - static void OnDereference(P val) - { assert(val); } + static void OnDereference(P val) + { assert(val); } - static void Swap(AssertCheckStrict&) - {} - }; + static void Swap(AssertCheckStrict&) + {} +}; //////////////////////////////////////////////////////////////////////////////// /// \struct NullPointerException @@ -920,13 +920,13 @@ namespace Loki /// Used by some implementations of the CheckingPolicy used by SmartPtr //////////////////////////////////////////////////////////////////////////////// - struct NullPointerException : public std::runtime_error - { - NullPointerException() : std::runtime_error(std::string("")) - { } - const char* what() const throw() - { return "Null Pointer Exception"; } - }; +struct NullPointerException : public std::runtime_error +{ + NullPointerException() : std::runtime_error(std::string("")) + { } + const char* what() const throw() + { return "Null Pointer Exception"; } +}; //////////////////////////////////////////////////////////////////////////////// /// \struct RejectNullStatic @@ -936,45 +936,45 @@ namespace Loki /// Checks the pointer upon initialization and before dereference //////////////////////////////////////////////////////////////////////////////// - template <class P> - struct RejectNullStatic - { - RejectNullStatic() - {} +template <class P> +struct RejectNullStatic +{ + RejectNullStatic() + {} - template <class P1> - RejectNullStatic(const RejectNullStatic<P1>&) - {} + template <class P1> + RejectNullStatic(const RejectNullStatic<P1>&) + {} - template <class P1> - RejectNullStatic(const NoCheck<P1>&) - {} + template <class P1> + RejectNullStatic(const NoCheck<P1>&) + {} - template <class P1> - RejectNullStatic(const AssertCheck<P1>&) - {} + template <class P1> + RejectNullStatic(const AssertCheck<P1>&) + {} - template <class P1> - RejectNullStatic(const AssertCheckStrict<P1>&) - {} + template <class P1> + RejectNullStatic(const AssertCheckStrict<P1>&) + {} - static void OnDefault(const P&) - { - // Make it depended on template parameter - static const bool DependedFalse = sizeof(P*) == 0; + static void OnDefault(const P&) + { + // Make it depended on template parameter + static const bool DependedFalse = sizeof(P*) == 0; - LOKI_STATIC_CHECK(DependedFalse, ERROR_This_Policy_Does_Not_Allow_Default_Initialization); - } + LOKI_STATIC_CHECK(DependedFalse, ERROR_This_Policy_Does_Not_Allow_Default_Initialization); + } - static void OnInit(const P& val) - { if (!val) throw NullPointerException(); } + static void OnInit(const P& val) + { if (!val) throw NullPointerException(); } - static void OnDereference(const P& val) - { if (!val) throw NullPointerException(); } + static void OnDereference(const P& val) + { if (!val) throw NullPointerException(); } - static void Swap(RejectNullStatic&) - {} - }; + static void Swap(RejectNullStatic&) + {} +}; //////////////////////////////////////////////////////////////////////////////// /// \struct RejectNull @@ -984,31 +984,31 @@ namespace Loki /// Checks the pointer before dereference //////////////////////////////////////////////////////////////////////////////// - template <class P> - struct RejectNull - { - RejectNull() - {} +template <class P> +struct RejectNull +{ + RejectNull() + {} - template <class P1> - RejectNull(const RejectNull<P1>&) - {} + template <class P1> + RejectNull(const RejectNull<P1>&) + {} - static void OnInit(P) - {} + static void OnInit(P) + {} - static void OnDefault(P) - {} + static void OnDefault(P) + {} - void OnDereference(P val) - { if (!val) throw NullPointerException(); } + void OnDereference(P val) + { if (!val) throw NullPointerException(); } - void OnDereference(P val) const - { if (!val) throw NullPointerException(); } + void OnDereference(P val) const + { if (!val) throw NullPointerException(); } - void Swap(RejectNull&) - {} - }; + void Swap(RejectNull&) + {} +}; //////////////////////////////////////////////////////////////////////////////// /// \struct RejectNullStrict @@ -1018,32 +1018,32 @@ namespace Loki /// Checks the pointer upon initialization and before dereference //////////////////////////////////////////////////////////////////////////////// - template <class P> - struct RejectNullStrict - { - RejectNullStrict() - {} +template <class P> +struct RejectNullStrict +{ + RejectNullStrict() + {} - template <class P1> - RejectNullStrict(const RejectNullStrict<P1>&) - {} + template <class P1> + RejectNullStrict(const RejectNullStrict<P1>&) + {} - template <class P1> - RejectNullStrict(const RejectNull<P1>&) - {} + template <class P1> + RejectNullStrict(const RejectNull<P1>&) + {} - static void OnInit(P val) - { if (!val) throw NullPointerException(); } + static void OnInit(P val) + { if (!val) throw NullPointerException(); } - void OnDereference(P val) - { OnInit(val); } + void OnDereference(P val) + { OnInit(val); } - void OnDereference(P val) const - { OnInit(val); } + void OnDereference(P val) const + { OnInit(val); } - void Swap(RejectNullStrict&) - {} - }; + void Swap(RejectNullStrict&) + {} +}; //////////////////////////////////////////////////////////////////////////////// @@ -1051,16 +1051,16 @@ namespace Loki // The reason for all the fuss above //////////////////////////////////////////////////////////////////////////////// - template - < - typename T, - template <class> class OwnershipPolicy = RefCounted, - class ConversionPolicy = DisallowConversion, - template <class> class CheckingPolicy = AssertCheck, - template <class> class StoragePolicy = DefaultSPStorage, - template<class> class ConstnessPolicy = LOKI_DEFAULT_CONSTNESS - > - class SmartPtr; +template +< +typename T, + template <class> class OwnershipPolicy = RefCounted, + class ConversionPolicy = DisallowConversion, + template <class> class CheckingPolicy = AssertCheck, + template <class> class StoragePolicy = DefaultSPStorage, + template<class> class ConstnessPolicy = LOKI_DEFAULT_CONSTNESS + > +class SmartPtr; //////////////////////////////////////////////////////////////////////////////// // class template SmartPtrDef (definition) @@ -1068,28 +1068,28 @@ namespace Loki // instead of writing SmartPtr<T,OP,CP,KP,SP> write SmartPtrDef<T,OP,CP,KP,SP>::type //////////////////////////////////////////////////////////////////////////////// - template +template +< +typename T, + template <class> class OwnershipPolicy = RefCounted, + class ConversionPolicy = DisallowConversion, + template <class> class CheckingPolicy = AssertCheck, + template <class> class StoragePolicy = DefaultSPStorage, + template<class> class ConstnessPolicy = LOKI_DEFAULT_CONSTNESS + > +struct SmartPtrDef +{ + typedef SmartPtr < - typename T, - template <class> class OwnershipPolicy = RefCounted, - class ConversionPolicy = DisallowConversion, - template <class> class CheckingPolicy = AssertCheck, - template <class> class StoragePolicy = DefaultSPStorage, - template<class> class ConstnessPolicy = LOKI_DEFAULT_CONSTNESS + T, + OwnershipPolicy, + ConversionPolicy, + CheckingPolicy, + StoragePolicy, + ConstnessPolicy > - struct SmartPtrDef - { - typedef SmartPtr - < - T, - OwnershipPolicy, - ConversionPolicy, - CheckingPolicy, - StoragePolicy, - ConstnessPolicy - > - type; - }; + type; +}; //////////////////////////////////////////////////////////////////////////////// /// \class SmartPtr @@ -1110,368 +1110,368 @@ namespace Loki /// - IsUnique() was removed //////////////////////////////////////////////////////////////////////////////// - template - < - typename T, - template <class> class OwnershipPolicy, - class ConversionPolicy, - template <class> class CheckingPolicy, - template <class> class StoragePolicy, - template <class> class ConstnessPolicy - > - class SmartPtr - : public StoragePolicy<T> - , public OwnershipPolicy<typename StoragePolicy<T>::InitPointerType> - , public CheckingPolicy<typename StoragePolicy<T>::StoredType> - , public ConversionPolicy - { - typedef StoragePolicy<T> SP; - typedef OwnershipPolicy<typename StoragePolicy<T>::InitPointerType> OP; - typedef CheckingPolicy<typename StoragePolicy<T>::StoredType> KP; - typedef ConversionPolicy CP; +template +< +typename T, + template <class> class OwnershipPolicy, + class ConversionPolicy, + template <class> class CheckingPolicy, + template <class> class StoragePolicy, + template <class> class ConstnessPolicy + > +class SmartPtr + : public StoragePolicy<T> + , public OwnershipPolicy<typename StoragePolicy<T>::InitPointerType> + , public CheckingPolicy<typename StoragePolicy<T>::StoredType> + , public ConversionPolicy +{ + typedef StoragePolicy<T> SP; + typedef OwnershipPolicy<typename StoragePolicy<T>::InitPointerType> OP; + typedef CheckingPolicy<typename StoragePolicy<T>::StoredType> KP; + typedef ConversionPolicy CP; - public: - typedef typename ConstnessPolicy<T>::Type* ConstPointerType; - typedef typename ConstnessPolicy<T>::Type& ConstReferenceType; +public: + typedef typename ConstnessPolicy<T>::Type* ConstPointerType; + typedef typename ConstnessPolicy<T>::Type& ConstReferenceType; - typedef typename SP::PointerType PointerType; - typedef typename SP::StoredType StoredType; - typedef typename SP::ReferenceType ReferenceType; + typedef typename SP::PointerType PointerType; + typedef typename SP::StoredType StoredType; + typedef typename SP::ReferenceType ReferenceType; - typedef typename Select<OP::destructiveCopy,SmartPtr, const SmartPtr>::Result - CopyArg; + typedef typename Select<OP::destructiveCopy,SmartPtr, const SmartPtr>::Result + CopyArg; - private: - struct NeverMatched {}; +private: + struct NeverMatched {}; #ifdef LOKI_SMARTPTR_CONVERSION_CONSTRUCTOR_POLICY - typedef typename Select< CP::allow, const StoredType&, NeverMatched>::Result ImplicitArg; - typedef typename Select<!CP::allow, const StoredType&, NeverMatched>::Result ExplicitArg; + typedef typename Select< CP::allow, const StoredType&, NeverMatched>::Result ImplicitArg; + typedef typename Select<!CP::allow, const StoredType&, NeverMatched>::Result ExplicitArg; #else - typedef const StoredType& ImplicitArg; - typedef typename Select<false, const StoredType&, NeverMatched>::Result ExplicitArg; + typedef const StoredType& ImplicitArg; + typedef typename Select<false, const StoredType&, NeverMatched>::Result ExplicitArg; #endif - public: +public: - SmartPtr() - { - KP::OnDefault(GetImpl(*this)); - } + SmartPtr() + { + KP::OnDefault(GetImpl(*this)); + } - explicit - SmartPtr(ExplicitArg p) : SP(p) - { - KP::OnInit(GetImpl(*this)); - } + explicit + SmartPtr(ExplicitArg p) : SP(p) + { + KP::OnInit(GetImpl(*this)); + } - SmartPtr(ImplicitArg p) : SP(p) - { - KP::OnInit(GetImpl(*this)); - } + SmartPtr(ImplicitArg p) : SP(p) + { + KP::OnInit(GetImpl(*this)); + } - SmartPtr(CopyArg& rhs) : SP(rhs), OP(rhs), KP(rhs), CP(rhs) - { - GetImplRef(*this) = OP::Clone(GetImplRef(rhs)); - } + SmartPtr(CopyArg& rhs) : SP(rhs), OP(rhs), KP(rhs), CP(rhs) + { + GetImplRef(*this) = OP::Clone(GetImplRef(rhs)); + } - template - < - typename T1, - template <class> class OP1, - class CP1, - template <class> class KP1, - template <class> class SP1, - template <class> class CNP1 - > - SmartPtr(const SmartPtr<T1, OP1, CP1, KP1, SP1, CNP1 >& rhs) + template + < + typename T1, + template <class> class OP1, + class CP1, + template <class> class KP1, + template <class> class SP1, + template <class> class CNP1 + > + SmartPtr(const SmartPtr<T1, OP1, CP1, KP1, SP1, CNP1 >& rhs) : SP(rhs), OP(rhs), KP(rhs), CP(rhs) - { GetImplRef(*this) = OP::Clone(GetImplRef(rhs)); } - - template - < - typename T1, - template <class> class OP1, - class CP1, - template <class> class KP1, - template <class> class SP1, - template <class> class CNP1 - > - SmartPtr(SmartPtr<T1, OP1, CP1, KP1, SP1, CNP1 >& rhs) + { GetImplRef(*this) = OP::Clone(GetImplRef(rhs)); } + + template + < + typename T1, + template <class> class OP1, + class CP1, + template <class> class KP1, + template <class> class SP1, + template <class> class CNP1 + > + SmartPtr(SmartPtr<T1, OP1, CP1, KP1, SP1, CNP1 >& rhs) : SP(rhs), OP(rhs), KP(rhs), CP(rhs) - { - GetImplRef(*this) = OP::Clone(GetImplRef(rhs)); - } + { + GetImplRef(*this) = OP::Clone(GetImplRef(rhs)); + } - SmartPtr(RefToValue<SmartPtr> rhs) + SmartPtr(RefToValue<SmartPtr> rhs) : SP(rhs), OP(rhs), KP(rhs), CP(rhs) - {} + {} - operator RefToValue<SmartPtr>() - { return RefToValue<SmartPtr>(*this); } + operator RefToValue<SmartPtr>() + { return RefToValue<SmartPtr>(*this); } - SmartPtr& operator=(CopyArg& rhs) - { - SmartPtr temp(rhs); - temp.Swap(*this); - return *this; - } + SmartPtr& operator=(CopyArg& rhs) + { + SmartPtr temp(rhs); + temp.Swap(*this); + return *this; + } - template - < - typename T1, - template <class> class OP1, - class CP1, - template <class> class KP1, - template <class> class SP1, - template <class> class CNP1 - > - SmartPtr& operator=(const SmartPtr<T1, OP1, CP1, KP1, SP1, CNP1 >& rhs) - { - SmartPtr temp(rhs); - temp.Swap(*this); - return *this; - } + template + < + typename T1, + template <class> class OP1, + class CP1, + template <class> class KP1, + template <class> class SP1, + template <class> class CNP1 + > + SmartPtr& operator=(const SmartPtr<T1, OP1, CP1, KP1, SP1, CNP1 >& rhs) + { + SmartPtr temp(rhs); + temp.Swap(*this); + return *this; + } - template - < - typename T1, - template <class> class OP1, - class CP1, - template <class> class KP1, - template <class> class SP1, - template <class> class CNP1 - > - SmartPtr& operator=(SmartPtr<T1, OP1, CP1, KP1, SP1, CNP1 >& rhs) - { - SmartPtr temp(rhs); - temp.Swap(*this); - return *this; - } + template + < + typename T1, + template <class> class OP1, + class CP1, + template <class> class KP1, + template <class> class SP1, + template <class> class CNP1 + > + SmartPtr& operator=(SmartPtr<T1, OP1, CP1, KP1, SP1, CNP1 >& rhs) + { + SmartPtr temp(rhs); + temp.Swap(*this); + return *this; + } - void Swap(SmartPtr& rhs) - { - OP::Swap(rhs); - CP::Swap(rhs); - KP::Swap(rhs); - SP::Swap(rhs); - } + void Swap(SmartPtr& rhs) + { + OP::Swap(rhs); + CP::Swap(rhs); + KP::Swap(rhs); + SP::Swap(rhs); + } - ~SmartPtr() + ~SmartPtr() + { + if (OP::Release(GetImpl(*static_cast<SP*>(this)))) { - if (OP::Release(GetImpl(*static_cast<SP*>(this)))) - { - SP::Destroy(); - } + SP::Destroy(); } + } #ifdef LOKI_ENABLE_FRIEND_TEMPLATE_TEMPLATE_PARAMETER_WORKAROUND - // old non standard in class definition of friends - friend inline void Release(SmartPtr& sp, typename SP::StoredType& p) - { - p = GetImplRef(sp); - GetImplRef(sp) = SP::Default(); - } + // old non standard in class definition of friends + friend inline void Release(SmartPtr& sp, typename SP::StoredType& p) + { + p = GetImplRef(sp); + GetImplRef(sp) = SP::Default(); + } - friend inline void Reset(SmartPtr& sp, typename SP::StoredType p) - { SmartPtr(p).Swap(sp); } + friend inline void Reset(SmartPtr& sp, typename SP::StoredType p) + { SmartPtr(p).Swap(sp); } #else - template - < - typename T1, - template <class> class OP1, - class CP1, - template <class> class KP1, - template <class> class SP1, - template <class> class CNP1 - > - friend void Release(SmartPtr<T1, OP1, CP1, KP1, SP1, CNP1>& sp, - typename SP1<T1>::StoredType& p); - - template - < - typename T1, - template <class> class OP1, - class CP1, - template <class> class KP1, - template <class> class SP1, - template <class> class CNP1 - > - friend void Reset(SmartPtr<T1, OP1, CP1, KP1, SP1, CNP1>& sp, - typename SP1<T1>::StoredType p); + template + < + typename T1, + template <class> class OP1, + class CP1, + template <class> class KP1, + template <class> class SP1, + template <class> class CNP1 + > + friend void Release(SmartPtr<T1, OP1, CP1, KP1, SP1, CNP1>& sp, + typename SP1<T1>::StoredType& p); + + template + < + typename T1, + template <class> class OP1, + class CP1, + template <class> class KP1, + template <class> class SP1, + template <class> class CNP1 + > + friend void Reset(SmartPtr<T1, OP1, CP1, KP1, SP1, CNP1>& sp, + typename SP1<T1>::StoredType p); #endif - template - < - typename T1, - template <class> class OP1, - class CP1, - template <class> class KP1, - template <class> class SP1, - template <class> class CNP1 - > - bool Merge( SmartPtr< T1, OP1, CP1, KP1, SP1, CNP1 > & rhs ) + template + < + typename T1, + template <class> class OP1, + class CP1, + template <class> class KP1, + template <class> class SP1, + template <class> class CNP1 + > + bool Merge( SmartPtr< T1, OP1, CP1, KP1, SP1, CNP1 > & rhs ) + { + if ( GetImpl( *this ) != GetImpl( rhs ) ) { - if ( GetImpl( *this ) != GetImpl( rhs ) ) - { - return false; - } - return OP::template Merge( rhs ); + return false; } + return OP::template Merge( rhs ); + } - PointerType operator->() - { - KP::OnDereference(GetImplRef(*this)); - return SP::operator->(); - } + PointerType operator->() + { + KP::OnDereference(GetImplRef(*this)); + return SP::operator->(); + } - ConstPointerType operator->() const - { - KP::OnDereference(GetImplRef(*this)); - return SP::operator->(); - } + ConstPointerType operator->() const + { + KP::OnDereference(GetImplRef(*this)); + return SP::operator->(); + } - ReferenceType operator*() - { - KP::OnDereference(GetImplRef(*this)); - return SP::operator*(); - } + ReferenceType operator*() + { + KP::OnDereference(GetImplRef(*this)); + return SP::operator*(); + } - ConstReferenceType operator*() const - { - KP::OnDereference(GetImplRef(*this)); - return SP::operator*(); - } + ConstReferenceType operator*() const + { + KP::OnDereference(GetImplRef(*this)); + return SP::operator*(); + } - bool operator!() const // Enables "if (!sp) ..." - { return GetImpl(*this) == 0; } - - static inline T * GetPointer( const SmartPtr & sp ) - { return GetImpl( sp ); } - - // Ambiguity buster - template - < - typename T1, - template <class> class OP1, - class CP1, - template <class> class KP1, - template <class> class SP1, - template <class> class CNP1 - > - bool operator==(const SmartPtr<T1, OP1, CP1, KP1, SP1, CNP1 >& rhs) const - { return GetImpl(*this) == GetImpl(rhs); } - - // Ambiguity buster - template - < - typename T1, - template <class> class OP1, - class CP1, - template <class> class KP1, - template <class> class SP1, - template <class> class CNP1 - > - bool operator!=(const SmartPtr<T1, OP1, CP1, KP1, SP1, CNP1 >& rhs) const - { return !(*this == rhs); } - - // Ambiguity buster - template - < - typename T1, - template <class> class OP1, - class CP1, - template <class> class KP1, - template <class> class SP1, - template <class> class CNP1 - > - bool operator<(const SmartPtr<T1, OP1, CP1, KP1, SP1, CNP1 >& rhs) const - { return GetImpl(*this) < GetImpl(rhs); } - - // Ambiguity buster - template - < - typename T1, - template <class> class OP1, - class CP1, - template <class> class KP1, - template <class> class SP1, - template <class> class CNP1 - > - inline bool operator > ( const SmartPtr< T1, OP1, CP1, KP1, SP1, CNP1 > & rhs ) - { - return ( GetImpl( rhs ) < GetImpl( *this ) ); - } + bool operator!() const // Enables "if (!sp) ..." + { return GetImpl(*this) == 0; } - // Ambiguity buster - template - < - typename T1, - template <class> class OP1, - class CP1, - template <class> class KP1, - template <class> class SP1, - template <class> class CNP1 - > - inline bool operator <= ( const SmartPtr< T1, OP1, CP1, KP1, SP1, CNP1 > & rhs ) - { - return !( GetImpl( rhs ) < GetImpl( *this ) ); - } + static inline T* GetPointer( const SmartPtr& sp ) + { return GetImpl( sp ); } - // Ambiguity buster - template - < - typename T1, - template <class> class OP1, - class CP1, - template <class> class KP1, - template <class> class SP1, - template <class> class CNP1 - > - inline bool operator >= ( const SmartPtr< T1, OP1, CP1, KP1, SP1, CNP1 > & rhs ) - { - return !( GetImpl( *this ) < GetImpl( rhs ) ); - } + // Ambiguity buster + template + < + typename T1, + template <class> class OP1, + class CP1, + template <class> class KP1, + template <class> class SP1, + template <class> class CNP1 + > + bool operator==(const SmartPtr<T1, OP1, CP1, KP1, SP1, CNP1 >& rhs) const + { return GetImpl(*this) == GetImpl(rhs); } + + // Ambiguity buster + template + < + typename T1, + template <class> class OP1, + class CP1, + template <class> class KP1, + template <class> class SP1, + template <class> class CNP1 + > + bool operator!=(const SmartPtr<T1, OP1, CP1, KP1, SP1, CNP1 >& rhs) const + { return !(*this == rhs); } + + // Ambiguity buster + template + < + typename T1, + template <class> class OP1, + class CP1, + template <class> class KP1, + template <class> class SP1, + template <class> class CNP1 + > + bool operator<(const SmartPtr<T1, OP1, CP1, KP1, SP1, CNP1 >& rhs) const + { return GetImpl(*this) < GetImpl(rhs); } + + // Ambiguity buster + template + < + typename T1, + template <class> class OP1, + class CP1, + template <class> class KP1, + template <class> class SP1, + template <class> class CNP1 + > + inline bool operator > ( const SmartPtr< T1, OP1, CP1, KP1, SP1, CNP1 > & rhs ) + { + return ( GetImpl( rhs ) < GetImpl( *this ) ); + } - private: - // Helper for enabling 'if (sp)' - struct Tester - { - Tester(int) {} - void dummy() {} - }; + // Ambiguity buster + template + < + typename T1, + template <class> class OP1, + class CP1, + template <class> class KP1, + template <class> class SP1, + template <class> class CNP1 + > + inline bool operator <= ( const SmartPtr< T1, OP1, CP1, KP1, SP1, CNP1 > & rhs ) + { + return !( GetImpl( rhs ) < GetImpl( *this ) ); + } - typedef void (Tester::*unspecified_boolean_type_)(); + // Ambiguity buster + template + < + typename T1, + template <class> class OP1, + class CP1, + template <class> class KP1, + template <class> class SP1, + template <class> class CNP1 + > + inline bool operator >= ( const SmartPtr< T1, OP1, CP1, KP1, SP1, CNP1 > & rhs ) + { + return !( GetImpl( *this ) < GetImpl( rhs ) ); + } - typedef typename Select<CP::allow, Tester, unspecified_boolean_type_>::Result - unspecified_boolean_type; +private: + // Helper for enabling 'if (sp)' + struct Tester + { + Tester(int) {} + void dummy() {} + }; - public: - // enable 'if (sp)' - operator unspecified_boolean_type() const - { - return !*this ? 0 : &Tester::dummy; - } + typedef void (Tester::*unspecified_boolean_type_)(); - private: - // Helper for disallowing automatic conversion - struct Insipid - { - Insipid(PointerType) {} - }; + typedef typename Select<CP::allow, Tester, unspecified_boolean_type_>::Result + unspecified_boolean_type; - typedef typename Select<CP::allow, PointerType, Insipid>::Result - AutomaticConversionResult; +public: + // enable 'if (sp)' + operator unspecified_boolean_type() const + { + return !*this ? 0 : &Tester::dummy; + } - public: - operator AutomaticConversionResult() const - { return GetImpl(*this); } +private: + // Helper for disallowing automatic conversion + struct Insipid + { + Insipid(PointerType) {} }; + typedef typename Select<CP::allow, PointerType, Insipid>::Result + AutomaticConversionResult; + +public: + operator AutomaticConversionResult() const + { return GetImpl(*this); } +}; + //////////////////////////////////////////////////////////////////////////////// // friends @@ -1479,34 +1479,34 @@ namespace Loki #ifndef LOKI_ENABLE_FRIEND_TEMPLATE_TEMPLATE_PARAMETER_WORKAROUND - template - < - typename T, - template <class> class OP, - class CP, - template <class> class KP, - template <class> class SP, - template <class> class CNP - > - inline void Release(SmartPtr<T, OP, CP, KP, SP, CNP>& sp, - typename SP<T>::StoredType& p) - { - p = GetImplRef(sp); - GetImplRef(sp) = SP<T>::Default(); - } +template +< +typename T, + template <class> class OP, + class CP, + template <class> class KP, + template <class> class SP, + template <class> class CNP + > +inline void Release(SmartPtr<T, OP, CP, KP, SP, CNP>& sp, + typename SP<T>::StoredType& p) +{ + p = GetImplRef(sp); + GetImplRef(sp) = SP<T>::Default(); +} - template - < - typename T, - template <class> class OP, - class CP, - template <class> class KP, - template <class> class SP, - template <class> class CNP - > - inline void Reset(SmartPtr<T, OP, CP, KP, SP, CNP>& sp, - typename SP<T>::StoredType p) - { SmartPtr<T, OP, CP, KP, SP, CNP>(p).Swap(sp); } +template +< +typename T, + template <class> class OP, + class CP, + template <class> class KP, + template <class> class SP, + template <class> class CNP + > +inline void Reset(SmartPtr<T, OP, CP, KP, SP, CNP>& sp, + typename SP<T>::StoredType p) +{ SmartPtr<T, OP, CP, KP, SP, CNP>(p).Swap(sp); } #endif @@ -1519,232 +1519,232 @@ namespace Loki /// \ingroup SmartPointerGroup //////////////////////////////////////////////////////////////////////////////// - template - < - typename T, - template <class> class OP, - class CP, - template <class> class KP, - template <class> class SP, - template <class> class CNP1, - typename U - > - inline bool operator==(const SmartPtr<T, OP, CP, KP, SP, CNP1 >& lhs, - U* rhs) - { return GetImpl(lhs) == rhs; } +template +< +typename T, + template <class> class OP, + class CP, + template <class> class KP, + template <class> class SP, + template <class> class CNP1, + typename U + > +inline bool operator==(const SmartPtr<T, OP, CP, KP, SP, CNP1 >& lhs, + U* rhs) +{ return GetImpl(lhs) == rhs; } //////////////////////////////////////////////////////////////////////////////// /// operator== for lhs = raw pointer, rhs = SmartPtr /// \ingroup SmartPointerGroup //////////////////////////////////////////////////////////////////////////////// - template - < - typename T, - template <class> class OP, - class CP, - template <class> class KP, - template <class> class SP, - template <class> class CNP1, - typename U - > - inline bool operator==(U* lhs, - const SmartPtr<T, OP, CP, KP, SP, CNP1 >& rhs) - { return rhs == lhs; } +template +< +typename T, + template <class> class OP, + class CP, + template <class> class KP, + template <class> class SP, + template <class> class CNP1, + typename U + > +inline bool operator==(U* lhs, + const SmartPtr<T, OP, CP, KP, SP, CNP1 >& rhs) +{ return rhs == lhs; } //////////////////////////////////////////////////////////////////////////////// /// operator!= for lhs = SmartPtr, rhs = raw pointer /// \ingroup SmartPointerGroup //////////////////////////////////////////////////////////////////////////////// - template - < - typename T, - template <class> class OP, - class CP, - template <class> class KP, - template <class> class SP, - template <class> class CNP, - typename U - > - inline bool operator!=(const SmartPtr<T, OP, CP, KP, SP, CNP >& lhs, - U* rhs) - { return !(lhs == rhs); } +template +< +typename T, + template <class> class OP, + class CP, + template <class> class KP, + template <class> class SP, + template <class> class CNP, + typename U + > +inline bool operator!=(const SmartPtr<T, OP, CP, KP, SP, CNP >& lhs, + U* rhs) +{ return !(lhs == rhs); } //////////////////////////////////////////////////////////////////////////////// /// operator!= for lhs = raw pointer, rhs = SmartPtr /// \ingroup SmartPointerGroup //////////////////////////////////////////////////////////////////////////////// - template - < - typename T, - template <class> class OP, - class CP, - template <class> class KP, - template <class> class SP, - template <class> class CNP, - typename U - > - inline bool operator!=(U* lhs, - const SmartPtr<T, OP, CP, KP, SP, CNP >& rhs) - { return rhs != lhs; } +template +< +typename T, + template <class> class OP, + class CP, + template <class> class KP, + template <class> class SP, + template <class> class CNP, + typename U + > +inline bool operator!=(U* lhs, + const SmartPtr<T, OP, CP, KP, SP, CNP >& rhs) +{ return rhs != lhs; } //////////////////////////////////////////////////////////////////////////////// /// operator< for lhs = SmartPtr, rhs = raw pointer /// \ingroup SmartPointerGroup //////////////////////////////////////////////////////////////////////////////// - template - < - typename T, - template <class> class OP, - class CP, - template <class> class KP, - template <class> class SP, - template <class> class CNP, - typename U - > - inline bool operator<(const SmartPtr<T, OP, CP, KP, SP, CNP >& lhs, - U* rhs) - { - return ( GetImpl( lhs ) < rhs ); - } +template +< +typename T, + template <class> class OP, + class CP, + template <class> class KP, + template <class> class SP, + template <class> class CNP, + typename U + > +inline bool operator<(const SmartPtr<T, OP, CP, KP, SP, CNP >& lhs, + U* rhs) +{ + return ( GetImpl( lhs ) < rhs ); +} //////////////////////////////////////////////////////////////////////////////// /// operator< for lhs = raw pointer, rhs = SmartPtr /// \ingroup SmartPointerGroup //////////////////////////////////////////////////////////////////////////////// - template - < - typename T, - template <class> class OP, - class CP, - template <class> class KP, - template <class> class SP, - template <class> class CNP, - typename U - > - inline bool operator<(U* lhs, - const SmartPtr<T, OP, CP, KP, SP, CNP >& rhs) - { - return ( GetImpl( rhs ) < lhs ); - } +template +< +typename T, + template <class> class OP, + class CP, + template <class> class KP, + template <class> class SP, + template <class> class CNP, + typename U + > +inline bool operator<(U* lhs, + const SmartPtr<T, OP, CP, KP, SP, CNP >& rhs) +{ + return ( GetImpl( rhs ) < lhs ); +} //////////////////////////////////////////////////////////////////////////////// // operator> for lhs = SmartPtr, rhs = raw pointer /// \ingroup SmartPointerGroup //////////////////////////////////////////////////////////////////////////////// - template - < - typename T, - template <class> class OP, - class CP, - template <class> class KP, - template <class> class SP, - template <class> class CNP, - typename U - > - inline bool operator>(const SmartPtr<T, OP, CP, KP, SP, CNP >& lhs, - U* rhs) - { return rhs < lhs; } +template +< +typename T, + template <class> class OP, + class CP, + template <class> class KP, + template <class> class SP, + template <class> class CNP, + typename U + > +inline bool operator>(const SmartPtr<T, OP, CP, KP, SP, CNP >& lhs, + U* rhs) +{ return rhs < lhs; } //////////////////////////////////////////////////////////////////////////////// /// operator> for lhs = raw pointer, rhs = SmartPtr /// \ingroup SmartPointerGroup //////////////////////////////////////////////////////////////////////////////// - template - < - typename T, - template <class> class OP, - class CP, - template <class> class KP, - template <class> class SP, - template <class> class CNP, - typename U - > - inline bool operator>(U* lhs, - const SmartPtr<T, OP, CP, KP, SP, CNP >& rhs) - { return rhs < lhs; } +template +< +typename T, + template <class> class OP, + class CP, + template <class> class KP, + template <class> class SP, + template <class> class CNP, + typename U + > +inline bool operator>(U* lhs, + const SmartPtr<T, OP, CP, KP, SP, CNP >& rhs) +{ return rhs < lhs; } //////////////////////////////////////////////////////////////////////////////// /// operator<= for lhs = SmartPtr, rhs = raw pointer /// \ingroup SmartPointerGroup //////////////////////////////////////////////////////////////////////////////// - template - < - typename T, - template <class> class OP, - class CP, - template <class> class KP, - template <class> class SP, - template <class> class CNP, - typename U - > - inline bool operator<=(const SmartPtr<T, OP, CP, KP, SP, CNP >& lhs, - U* rhs) - { return !(rhs < lhs); } +template +< +typename T, + template <class> class OP, + class CP, + template <class> class KP, + template <class> class SP, + template <class> class CNP, + typename U + > +inline bool operator<=(const SmartPtr<T, OP, CP, KP, SP, CNP >& lhs, + U* rhs) +{ return !(rhs < lhs); } //////////////////////////////////////////////////////////////////////////////// /// operator<= for lhs = raw pointer, rhs = SmartPtr /// \ingroup SmartPointerGroup //////////////////////////////////////////////////////////////////////////////// - template - < - typename T, - template <class> class OP, - class CP, - template <class> class KP, - template <class> class SP, - template <class> class CNP, - typename U - > - inline bool operator<=(U* lhs, - const SmartPtr<T, OP, CP, KP, SP, CNP >& rhs) - { return !(rhs < lhs); } +template +< +typename T, + template <class> class OP, + class CP, + template <class> class KP, + template <class> class SP, + template <class> class CNP, + typename U + > +inline bool operator<=(U* lhs, + const SmartPtr<T, OP, CP, KP, SP, CNP >& rhs) +{ return !(rhs < lhs); } //////////////////////////////////////////////////////////////////////////////// /// operator>= for lhs = SmartPtr, rhs = raw pointer /// \ingroup SmartPointerGroup //////////////////////////////////////////////////////////////////////////////// - template - < - typename T, - template <class> class OP, - class CP, - template <class> class KP, - template <class> class SP, - template <class> class CNP, - typename U - > - inline bool operator>=(const SmartPtr<T, OP, CP, KP, SP, CNP >& lhs, - U* rhs) - { return !(lhs < rhs); } +template +< +typename T, + template <class> class OP, + class CP, + template <class> class KP, + template <class> class SP, + template <class> class CNP, + typename U + > +inline bool operator>=(const SmartPtr<T, OP, CP, KP, SP, CNP >& lhs, + U* rhs) +{ return !(lhs < rhs); } //////////////////////////////////////////////////////////////////////////////// /// operator>= for lhs = raw pointer, rhs = SmartPtr /// \ingroup SmartPointerGroup //////////////////////////////////////////////////////////////////////////////// - template - < - typename T, - template <class> class OP, - class CP, - template <class> class KP, - template <class> class SP, - template <class> class CNP, - typename U - > - inline bool operator>=(U* lhs, - const SmartPtr<T, OP, CP, KP, SP, CNP >& rhs) - { return !(lhs < rhs); } +template +< +typename T, + template <class> class OP, + class CP, + template <class> class KP, + template <class> class SP, + template <class> class CNP, + typename U + > +inline bool operator>=(U* lhs, + const SmartPtr<T, OP, CP, KP, SP, CNP >& rhs) +{ return !(lhs < rhs); } } // namespace Loki @@ -1755,23 +1755,23 @@ namespace Loki namespace std { - template - < - typename T, - template <class> class OP, - class CP, - template <class> class KP, - template <class> class SP, - template <class> class CNP - > - struct less< Loki::SmartPtr<T, OP, CP, KP, SP, CNP > > +template +< +typename T, + template <class> class OP, + class CP, + template <class> class KP, + template <class> class SP, + template <class> class CNP + > +struct less< Loki::SmartPtr<T, OP, CP, KP, SP, CNP > > : public binary_function<Loki::SmartPtr<T, OP, CP, KP, SP, CNP >, - Loki::SmartPtr<T, OP, CP, KP, SP, CNP >, bool> - { - bool operator()(const Loki::SmartPtr<T, OP, CP, KP, SP, CNP >& lhs, - const Loki::SmartPtr<T, OP, CP, KP, SP, CNP >& rhs) const - { return less<T*>()(GetImpl(lhs), GetImpl(rhs)); } - }; + Loki::SmartPtr<T, OP, CP, KP, SP, CNP >, bool> +{ + bool operator()(const Loki::SmartPtr<T, OP, CP, KP, SP, CNP >& lhs, + const Loki::SmartPtr<T, OP, CP, KP, SP, CNP >& rhs) const + { return less<T*>()(GetImpl(lhs), GetImpl(rhs)); } +}; } #endif // end file guardian diff --git a/shared/loki/StrongPtr.h b/shared/loki/StrongPtr.h index 7ec9766f..23d70415 100644 --- a/shared/loki/StrongPtr.h +++ b/shared/loki/StrongPtr.h @@ -19,7 +19,7 @@ #include <loki/SmartPtr.h> #if defined (LOKI_OBJECT_LEVEL_THREADING) || defined (LOKI_CLASS_LEVEL_THREADING) - #include <loki/Threads.h> +#include <loki/Threads.h> #endif @@ -127,7 +127,7 @@ template < class P > class DeleteUsingFree { public: - inline void static Delete( const P * p ) + inline void static Delete( const P* p ) { if ( 0 != p ) { @@ -137,12 +137,12 @@ public: } /// Provides default value to initialize the pointer - inline static P * Default( void ) + inline static P* Default( void ) { return 0; } - inline void Swap( DeleteUsingFree & ) {} + inline void Swap( DeleteUsingFree& ) {} }; //////////////////////////////////////////////////////////////////////////////// @@ -158,17 +158,17 @@ template < class P > class DeleteNothing { public: - inline static void Delete( const P * ) + inline static void Delete( const P* ) { // Do nothing at all! } - inline static P * Default( void ) + inline static P* Default( void ) { return 0; } - inline void Swap( DeleteNothing & ) {} + inline void Swap( DeleteNothing& ) {} }; //////////////////////////////////////////////////////////////////////////////// @@ -183,7 +183,7 @@ template < class P > class DeleteSingle { public: - inline static void Delete( const P * p ) + inline static void Delete( const P* p ) { /** @note If you see an error message about a negative subscript, that means your are attempting to use Loki to delete an incomplete type. @@ -194,12 +194,12 @@ public: delete p; } - inline static P * Default( void ) + inline static P* Default( void ) { return 0; } - inline void Swap( DeleteSingle & ) {} + inline void Swap( DeleteSingle& ) {} }; //////////////////////////////////////////////////////////////////////////////// @@ -214,7 +214,7 @@ template < class P > class DeleteArray { public: - inline static void Delete( const P * p ) + inline static void Delete( const P* p ) { /** @note If you see an error message about a negative subscript, that means your are attempting to use Loki to delete an incomplete type. @@ -225,12 +225,12 @@ public: delete [] p; } - inline static P * Default( void ) + inline static P* Default( void ) { return 0; } - inline void Swap( DeleteArray & ) {} + inline void Swap( DeleteArray& ) {} }; //////////////////////////////////////////////////////////////////////////////// @@ -326,7 +326,7 @@ public: { } - inline TwoRefCountInfo( void * p, bool strong ) + inline TwoRefCountInfo( void* p, bool strong ) : m_pointer( p ) , m_strongCount( strong ? 1 : 0 ) , m_weakCount( strong ? 0 : 1 ) @@ -378,28 +378,28 @@ public: m_pointer = 0; } - void SetPointer( void * p ) + void SetPointer( void* p ) { m_pointer = p; } - inline void * GetPointer( void ) const + inline void* GetPointer( void ) const { return m_pointer; } - inline void * & GetPointerRef( void ) const + inline void*& GetPointerRef( void ) const { - return const_cast< void * & >( m_pointer ); + return const_cast< void *& >( m_pointer ); } private: /// Copy-constructor not implemented. - TwoRefCountInfo( const TwoRefCountInfo & ); + TwoRefCountInfo( const TwoRefCountInfo& ); /// Copy-assignment operator not implemented. - TwoRefCountInfo & operator = ( const TwoRefCountInfo & ); + TwoRefCountInfo& operator = ( const TwoRefCountInfo& ); - void * m_pointer; + void* m_pointer; unsigned int m_strongCount; unsigned int m_weakCount; }; @@ -435,7 +435,7 @@ public: { } - LockableTwoRefCountInfo( void * p, bool strong ) + LockableTwoRefCountInfo( void* p, bool strong ) : TwoRefCountInfo( p, strong ) , m_Mutex() { @@ -507,19 +507,19 @@ public: m_Mutex.Unlock(); } - void SetPointer( void * p ) + void SetPointer( void* p ) { m_Mutex.Lock(); TwoRefCountInfo::SetPointer( p ); m_Mutex.Unlock(); } - inline void * GetPointer( void ) const + inline void* GetPointer( void ) const { return TwoRefCountInfo::GetPointer(); } - inline void * & GetPointerRef( void ) const + inline void*& GetPointerRef( void ) const { return TwoRefCountInfo::GetPointerRef(); } @@ -528,9 +528,9 @@ private: /// Default constructor is not available. LockableTwoRefCountInfo( void ); /// Copy constructor is not available. - LockableTwoRefCountInfo( const LockableTwoRefCountInfo & ); + LockableTwoRefCountInfo( const LockableTwoRefCountInfo& ); /// Copy-assignment operator is not available. - LockableTwoRefCountInfo & operator = ( const LockableTwoRefCountInfo & ); + LockableTwoRefCountInfo& operator = ( const LockableTwoRefCountInfo& ); mutable LOKI_DEFAULT_MUTEX m_Mutex; }; @@ -556,9 +556,9 @@ protected: explicit TwoRefCounts( bool strong ); - TwoRefCounts( const void * p, bool strong ); + TwoRefCounts( const void* p, bool strong ); - TwoRefCounts( const TwoRefCounts & rhs, bool strong ) : + TwoRefCounts( const TwoRefCounts& rhs, bool strong ) : m_counts( rhs.m_counts ) { Increment( strong ); @@ -580,35 +580,35 @@ protected: return m_counts->HasStrongPointer(); } - void Swap( TwoRefCounts & rhs ); + void Swap( TwoRefCounts& rhs ); - void SetPointer( void * p ) + void SetPointer( void* p ) { m_counts->SetPointer( p ); } void ZapPointer( void ); - inline void * & GetPointerRef( void ) const + inline void*& GetPointerRef( void ) const { return m_counts->GetPointerRef(); } - inline void * GetPointer( void ) const + inline void* GetPointer( void ) const { return m_counts->GetPointer(); } private: TwoRefCounts( void ); - TwoRefCounts & operator = ( const TwoRefCounts & ); + TwoRefCounts& operator = ( const TwoRefCounts& ); void Increment( bool strong ); bool Decrement( bool strong ); /// Pointer to all shared data. - Loki::Private::TwoRefCountInfo * m_counts; + Loki::Private::TwoRefCountInfo* m_counts; }; //////////////////////////////////////////////////////////////////////////////// @@ -637,28 +637,28 @@ protected: explicit LockableTwoRefCounts( bool strong ) : m_counts( NULL ) { - void * temp = ThreadSafePointerAllocator::operator new( - sizeof(Loki::Private::LockableTwoRefCountInfo) ); + void* temp = ThreadSafePointerAllocator::operator new( + sizeof(Loki::Private::LockableTwoRefCountInfo) ); #ifdef DO_EXTRA_LOKI_TESTS assert( temp != 0 ); #endif m_counts = new ( temp ) Loki::Private::LockableTwoRefCountInfo( strong ); } - LockableTwoRefCounts( const void * p, bool strong ) + LockableTwoRefCounts( const void* p, bool strong ) : m_counts( NULL ) { - void * temp = ThreadSafePointerAllocator::operator new( - sizeof(Loki::Private::LockableTwoRefCountInfo) ); + void* temp = ThreadSafePointerAllocator::operator new( + sizeof(Loki::Private::LockableTwoRefCountInfo) ); #ifdef DO_EXTRA_LOKI_TESTS assert( temp != 0 ); #endif - void * p2 = const_cast< void * >( p ); + void* p2 = const_cast< void* >( p ); m_counts = new ( temp ) - Loki::Private::LockableTwoRefCountInfo( p2, strong ); + Loki::Private::LockableTwoRefCountInfo( p2, strong ); } - LockableTwoRefCounts( const LockableTwoRefCounts & rhs, bool strong ) : + LockableTwoRefCounts( const LockableTwoRefCounts& rhs, bool strong ) : m_counts( rhs.m_counts ) { Increment( strong ); @@ -717,12 +717,12 @@ protected: return m_counts->HasStrongPointer(); } - void Swap( LockableTwoRefCounts & rhs ) + void Swap( LockableTwoRefCounts& rhs ) { std::swap( m_counts, rhs.m_counts ); } - void SetPointer( void * p ) + void SetPointer( void* p ) { m_counts->SetPointer( p ); } @@ -739,27 +739,27 @@ protected: else { ThreadSafePointerAllocator::operator delete ( m_counts, - sizeof(Loki::Private::LockableTwoRefCountInfo) ); + sizeof(Loki::Private::LockableTwoRefCountInfo) ); m_counts = NULL; } } - inline void * GetPointer( void ) const + inline void* GetPointer( void ) const { return m_counts->GetPointer(); } - inline void * & GetPointerRef( void ) const + inline void*& GetPointerRef( void ) const { return m_counts->GetPointerRef(); } private: LockableTwoRefCounts( void ); - LockableTwoRefCounts & operator = ( const LockableTwoRefCounts & ); + LockableTwoRefCounts& operator = ( const LockableTwoRefCounts& ); /// Pointer to all shared data. - Loki::Private::LockableTwoRefCountInfo * m_counts; + Loki::Private::LockableTwoRefCountInfo* m_counts; }; #endif // if object-level-locking or class-level-locking @@ -785,15 +785,15 @@ protected: m_prev = m_next = this; } - TwoRefLinks( const void * p, bool strong ); + TwoRefLinks( const void* p, bool strong ); - TwoRefLinks( const TwoRefLinks & rhs, bool strong ); + TwoRefLinks( const TwoRefLinks& rhs, bool strong ); bool Release( bool strong ); - void Swap( TwoRefLinks & rhs ); + void Swap( TwoRefLinks& rhs ); - bool Merge( TwoRefLinks & rhs ); + bool Merge( TwoRefLinks& rhs ); bool HasStrongPointer( void ) const; @@ -802,35 +802,35 @@ protected: ZapAllNodes(); } - void SetPointer( void * p ); + void SetPointer( void* p ); - inline void * GetPointer( void ) const + inline void* GetPointer( void ) const { return m_pointer; } - inline void * & GetPointerRef( void ) const + inline void*& GetPointerRef( void ) const { - return const_cast< void * & >( m_pointer ); + return const_cast< void *& >( m_pointer ); } private: - static unsigned int CountPrevCycle( const TwoRefLinks * pThis ); - static unsigned int CountNextCycle( const TwoRefLinks * pThis ); + static unsigned int CountPrevCycle( const TwoRefLinks* pThis ); + static unsigned int CountNextCycle( const TwoRefLinks* pThis ); /// Not implemented. TwoRefLinks( void ); /// Not implemented. - TwoRefLinks & operator = ( const TwoRefLinks & ); + TwoRefLinks& operator = ( const TwoRefLinks& ); - bool HasPrevNode( const TwoRefLinks * p ) const; - bool HasNextNode( const TwoRefLinks * p ) const; + bool HasPrevNode( const TwoRefLinks* p ) const; + bool HasNextNode( const TwoRefLinks* p ) const; bool AllNodesHaveSamePointer( void ) const; void ZapAllNodes( void ); - void * m_pointer; - mutable TwoRefLinks * m_prev; - mutable TwoRefLinks * m_next; + void* m_pointer; + mutable TwoRefLinks* m_prev; + mutable TwoRefLinks* m_next; const bool m_strong; }; @@ -850,24 +850,24 @@ private: template < - typename T, - bool Strong = true, - class OwnershipPolicy = Loki::TwoRefCounts, - class ConversionPolicy = Loki::DisallowConversion, - template < class > class CheckingPolicy = Loki::AssertCheck, - template < class > class ResetPolicy = Loki::CantResetWithStrong, - template < class > class DeletePolicy = Loki::DeleteSingle, - template < class > class ConstnessPolicy = LOKI_DEFAULT_CONSTNESS -> +typename T, + bool Strong = true, + class OwnershipPolicy = Loki::TwoRefCounts, + class ConversionPolicy = Loki::DisallowConversion, + template < class > class CheckingPolicy = Loki::AssertCheck, + template < class > class ResetPolicy = Loki::CantResetWithStrong, + template < class > class DeletePolicy = Loki::DeleteSingle, + template < class > class ConstnessPolicy = LOKI_DEFAULT_CONSTNESS + > class StrongPtr : public OwnershipPolicy , public ConversionPolicy - , public CheckingPolicy< T * > + , public CheckingPolicy< T* > , public ResetPolicy< T > , public DeletePolicy< T > { typedef ConversionPolicy CP; - typedef CheckingPolicy< T * > KP; + typedef CheckingPolicy< T* > KP; typedef ResetPolicy< T > RP; typedef DeletePolicy< T > DP; @@ -875,12 +875,12 @@ public: typedef OwnershipPolicy OP; - typedef T * StoredType; // the type of the pointer - typedef T * PointerType; // type returned by operator-> - typedef T & ReferenceType; // type returned by operator* + typedef T* StoredType; // the type of the pointer + typedef T* PointerType; // type returned by operator-> + typedef T& ReferenceType; // type returned by operator* - typedef typename ConstnessPolicy< T >::Type * ConstPointerType; - typedef typename ConstnessPolicy< T >::Type & ConstReferenceType; + typedef typename ConstnessPolicy< T >::Type* ConstPointerType; + typedef typename ConstnessPolicy< T >::Type& ConstReferenceType; private: struct NeverMatched {}; @@ -910,22 +910,22 @@ public: KP::OnInit( GetPointer() ); } - StrongPtr( const StrongPtr & rhs ) + StrongPtr( const StrongPtr& rhs ) : OP( rhs, Strong ), CP( rhs ), KP( rhs ), DP( rhs ) { } template < - typename T1, - bool S1, - class OP1, - class CP1, - template < class > class KP1, - template < class > class RP1, - template < class > class DP1, - template < class > class CNP1 - > + typename T1, + bool S1, + class OP1, + class CP1, + template < class > class KP1, + template < class > class RP1, + template < class > class DP1, + template < class > class CNP1 + > StrongPtr( const StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & rhs ) : OP( rhs, Strong ) @@ -934,15 +934,15 @@ public: template < - typename T1, - bool S1, - class OP1, - class CP1, - template < class > class KP1, - template < class > class RP1, - template < class > class DP1, - template < class > class CNP1 - > + typename T1, + bool S1, + class OP1, + class CP1, + template < class > class KP1, + template < class > class RP1, + template < class > class DP1, + template < class > class CNP1 + > StrongPtr( StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & rhs ) : OP( rhs, Strong ) @@ -959,7 +959,7 @@ public: return RefToValue< StrongPtr >( *this ); } - StrongPtr & operator = ( const StrongPtr & rhs ) + StrongPtr& operator = ( const StrongPtr& rhs ) { if ( GetPointer() != rhs.GetPointer() ) { @@ -969,7 +969,7 @@ public: return *this; } - StrongPtr & operator = ( T * p ) + StrongPtr& operator = ( T* p ) { if ( GetPointer() != p ) { @@ -981,16 +981,16 @@ public: template < - typename T1, - bool S1, - class OP1, - class CP1, - template < class > class KP1, - template < class > class RP1, - template < class > class DP1, - template < class > class CNP1 - > - StrongPtr & operator = ( + typename T1, + bool S1, + class OP1, + class CP1, + template < class > class KP1, + template < class > class RP1, + template < class > class DP1, + template < class > class CNP1 + > + StrongPtr& operator = ( const StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & rhs ) { if ( !rhs.Equals( GetPointer() ) ) @@ -1006,7 +1006,7 @@ public: return Strong; } - void Swap( StrongPtr & rhs ) + void Swap( StrongPtr& rhs ) { OP::Swap( rhs ); CP::Swap( rhs ); @@ -1023,7 +1023,7 @@ public: // to deleting the shared object multiple times, which leads to // undefined behavior. Therefore, this must get pointer before // zapping it, and then delete the temp pointer. - T * p = GetPointer(); + T* p = GetPointer(); OP::ZapPointer(); if ( p != 0 ) { @@ -1035,8 +1035,8 @@ public: #ifdef LOKI_ENABLE_FRIEND_TEMPLATE_TEMPLATE_PARAMETER_WORKAROUND // old non standard in class definition of friends - friend bool ReleaseAll( StrongPtr & sp, - typename StrongPtr::StoredType & p ) + friend bool ReleaseAll( StrongPtr& sp, + typename StrongPtr::StoredType& p ) { if ( !sp.RP::OnReleaseAll( sp.IsStrong() || sp.OP::HasStrongPointer() ) ) { @@ -1047,8 +1047,8 @@ public: return true; } - friend bool ResetAll( StrongPtr & sp, - typename StrongPtr::StoredType p ) + friend bool ResetAll( StrongPtr& sp, + typename StrongPtr::StoredType p ) { if ( sp.OP::GetPointer() == p ) { @@ -1067,32 +1067,32 @@ public: template < - typename T1, - bool S1, - class OP1, - class CP1, - template < class > class KP1, - template < class > class RP1, - template < class > class DP1, - template < class > class CNP1 - > + typename T1, + bool S1, + class OP1, + class CP1, + template < class > class KP1, + template < class > class RP1, + template < class > class DP1, + template < class > class CNP1 + > friend bool ReleaseAll( StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & sp, - typename StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 >::StoredType & p ); + typename StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 >::StoredType& p ); template < - typename T1, - bool S1, - class OP1, - class CP1, - template < class > class KP1, - template < class > class RP1, - template < class > class DP1, - template < class > class CNP1 - > + typename T1, + bool S1, + class OP1, + class CP1, + template < class > class KP1, + template < class > class RP1, + template < class > class DP1, + template < class > class CNP1 + > friend bool ResetAll( StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & sp, - typename StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 >::StoredType p ); + typename StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 >::StoredType p ); #endif @@ -1103,15 +1103,15 @@ public: */ template < - typename T1, - bool S1, - class OP1, - class CP1, - template < class > class KP1, - template < class > class RP1, - template < class > class DP1, - template < class > class CNP1 - > + typename T1, + bool S1, + class OP1, + class CP1, + template < class > class KP1, + template < class > class RP1, + template < class > class DP1, + template < class > class CNP1 + > bool Merge( StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & rhs ) { if ( OP::GetPointer() != rhs.OP::GetPointer() ) @@ -1163,21 +1163,21 @@ public: /// Helper function which can be called to avoid exposing GetPointer function. template < class T1 > - bool Equals( const T1 * p ) const + bool Equals( const T1* p ) const { return ( GetPointer() == p ); } /// Helper function which can be called to avoid exposing GetPointer function. template < class T1 > - bool LessThan( const T1 * p ) const + bool LessThan( const T1* p ) const { return ( GetPointer() < p ); } /// Helper function which can be called to avoid exposing GetPointer function. template < class T1 > - bool GreaterThan( const T1 * p ) const + bool GreaterThan( const T1* p ) const { return ( GetPointer() > p ); } @@ -1185,15 +1185,15 @@ public: /// Equality comparison operator is templated to handle ambiguity. template < - typename T1, - bool S1, - class OP1, - class CP1, - template < class > class KP1, - template < class > class RP1, - template < class > class DP1, - template < class > class CNP1 - > + typename T1, + bool S1, + class OP1, + class CP1, + template < class > class KP1, + template < class > class RP1, + template < class > class DP1, + template < class > class CNP1 + > bool operator == ( const StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & rhs ) const { @@ -1203,15 +1203,15 @@ public: /// Inequality comparison operator is templated to handle ambiguity. template < - typename T1, - bool S1, - class OP1, - class CP1, - template < class > class KP1, - template < class > class RP1, - template < class > class DP1, - template < class > class CNP1 - > + typename T1, + bool S1, + class OP1, + class CP1, + template < class > class KP1, + template < class > class RP1, + template < class > class DP1, + template < class > class CNP1 + > bool operator != ( const StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & rhs ) const { @@ -1221,15 +1221,15 @@ public: /// Less-than comparison operator is templated to handle ambiguity. template < - typename T1, - bool S1, - class OP1, - class CP1, - template < class > class KP1, - template < class > class RP1, - template < class > class DP1, - template < class > class CNP1 - > + typename T1, + bool S1, + class OP1, + class CP1, + template < class > class KP1, + template < class > class RP1, + template < class > class DP1, + template < class > class CNP1 + > bool operator < ( const StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & rhs ) const { @@ -1239,15 +1239,15 @@ public: /// Greater-than comparison operator is templated to handle ambiguity. template < - typename T1, - bool S1, - class OP1, - class CP1, - template < class > class KP1, - template < class > class RP1, - template < class > class DP1, - template < class > class CNP1 - > + typename T1, + bool S1, + class OP1, + class CP1, + template < class > class KP1, + template < class > class RP1, + template < class > class DP1, + template < class > class CNP1 + > inline bool operator > ( const StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & rhs ) const { @@ -1257,15 +1257,15 @@ public: /// Less-than-or-equal-to operator is templated to handle ambiguity. template < - typename T1, - bool S1, - class OP1, - class CP1, - template < class > class KP1, - template < class > class RP1, - template < class > class DP1, - template < class > class CNP1 - > + typename T1, + bool S1, + class OP1, + class CP1, + template < class > class KP1, + template < class > class RP1, + template < class > class DP1, + template < class > class CNP1 + > inline bool operator <= ( const StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & rhs ) const { @@ -1275,15 +1275,15 @@ public: /// Greater-than-or-equal-to operator is templated to handle ambiguity. template < - typename T1, - bool S1, - class OP1, - class CP1, - template < class > class KP1, - template < class > class RP1, - template < class > class DP1, - template < class > class CNP1 - > + typename T1, + bool S1, + class OP1, + class CP1, + template < class > class KP1, + template < class > class RP1, + template < class > class DP1, + template < class > class CNP1 + > inline bool operator >= ( const StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & rhs ) const { @@ -1329,7 +1329,7 @@ private: typedef void (Tester::*unspecified_boolean_type_)(); typedef typename Select< CP::allow, Tester, unspecified_boolean_type_ >::Result - unspecified_boolean_type; + unspecified_boolean_type; public: // enable 'if (sp)' @@ -1346,7 +1346,7 @@ private: }; typedef typename Select< CP::allow, PointerType, Insipid >::Result - AutomaticConversionResult; + AutomaticConversionResult; public: operator AutomaticConversionResult() const @@ -1364,54 +1364,54 @@ public: template < - typename U, - typename T, - bool S, - class OP, - class CP, - template < class > class KP, - template < class > class RP, - template < class > class DP, - template < class > class CNP -> +typename U, + typename T, + bool S, + class OP, + class CP, + template < class > class KP, + template < class > class RP, + template < class > class DP, + template < class > class CNP + > bool ReleaseAll( StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & sp, - typename StrongPtr< T, S, OP, CP, KP, RP, DP, CNP >::StoredType & p ) + typename StrongPtr< T, S, OP, CP, KP, RP, DP, CNP >::StoredType& p ) { - if ( !sp.RP<T>::OnReleaseAll( sp.IsStrong() || sp.OP::HasStrongPointer() ) ) - { - return false; - } - p = sp.GetPointer(); - sp.OP::SetPointer( sp.DP<T>::Default() ); - return true; + if ( !sp.RP<T>::OnReleaseAll( sp.IsStrong() || sp.OP::HasStrongPointer() ) ) + { + return false; + } + p = sp.GetPointer(); + sp.OP::SetPointer( sp.DP<T>::Default() ); + return true; } template < - typename U, - typename T, - bool S, - class OP, - class CP, - template < class > class KP, - template < class > class RP, - template < class > class DP, - template < class > class CNP -> +typename U, + typename T, + bool S, + class OP, + class CP, + template < class > class KP, + template < class > class RP, + template < class > class DP, + template < class > class CNP + > bool ResetAll( StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & sp, typename StrongPtr< T, S, OP, CP, KP, RP, DP, CNP >::StoredType p ) { - if ( sp.OP::GetPointer() == p ) - { + if ( sp.OP::GetPointer() == p ) + { + return true; + } + if ( !sp.RP<T>::OnResetAll( sp.IsStrong() || sp.OP::HasStrongPointer() ) ) + { + return false; + } + sp.DP<T>::Delete( sp.GetPointer() ); + sp.OP::SetPointer( p ); return true; - } - if ( !sp.RP<T>::OnResetAll( sp.IsStrong() || sp.OP::HasStrongPointer() ) ) - { - return false; - } - sp.DP<T>::Delete( sp.GetPointer() ); - sp.OP::SetPointer( p ); - return true; } #endif @@ -1422,18 +1422,18 @@ bool ResetAll( StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & sp, /// \ingroup SmartPointerGroup template < - typename U, - typename T, - bool S, - class OP, - class CP, - template < class > class KP, - template < class > class RP, - template < class > class DP, - template < class > class CNP -> +typename U, + typename T, + bool S, + class OP, + class CP, + template < class > class KP, + template < class > class RP, + template < class > class DP, + template < class > class CNP + > inline bool operator == ( - const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & lhs, U * rhs ) + const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & lhs, U* rhs ) { return ( lhs.Equals( rhs ) ); } @@ -1442,18 +1442,18 @@ inline bool operator == ( /// \ingroup SmartPointerGroup template < - typename U, - typename T, - bool S, - class OP, - class CP, - template < class > class KP, - template < class > class RP, - template < class > class DP, - template < class > class CNP -> -inline bool operator == ( U * lhs, - const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & rhs ) +typename U, + typename T, + bool S, + class OP, + class CP, + template < class > class KP, + template < class > class RP, + template < class > class DP, + template < class > class CNP + > +inline bool operator == ( U* lhs, + const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & rhs ) { return ( rhs.Equals( lhs ) ); } @@ -1462,18 +1462,18 @@ inline bool operator == ( U * lhs, /// \ingroup SmartPointerGroup template < - typename U, - typename T, - bool S, - class OP, - class CP, - template < class > class KP, - template < class > class RP, - template < class > class DP, - template < class > class CNP -> +typename U, + typename T, + bool S, + class OP, + class CP, + template < class > class KP, + template < class > class RP, + template < class > class DP, + template < class > class CNP + > inline bool operator != ( - const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & lhs, U * rhs ) + const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & lhs, U* rhs ) { return !( lhs.Equals( rhs ) ); } @@ -1482,18 +1482,18 @@ inline bool operator != ( /// \ingroup SmartPointerGroup template < - typename U, - typename T, - bool S, - class OP, - class CP, - template < class > class KP, - template < class > class RP, - template < class > class DP, - template < class > class CNP -> -inline bool operator != ( U * lhs, - const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & rhs ) +typename U, + typename T, + bool S, + class OP, + class CP, + template < class > class KP, + template < class > class RP, + template < class > class DP, + template < class > class CNP + > +inline bool operator != ( U* lhs, + const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & rhs ) { return !( rhs.Equals( lhs ) ); } @@ -1502,18 +1502,18 @@ inline bool operator != ( U * lhs, /// \ingroup SmartPointerGroup template < - typename U, - typename T, - bool S, - class OP, - class CP, - template < class > class KP, - template < class > class RP, - template < class > class DP, - template < class > class CNP -> +typename U, + typename T, + bool S, + class OP, + class CP, + template < class > class KP, + template < class > class RP, + template < class > class DP, + template < class > class CNP + > inline bool operator < ( - const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & lhs, U * rhs ) + const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & lhs, U* rhs ) { return ( lhs.LessThan( rhs ) ); } @@ -1522,18 +1522,18 @@ inline bool operator < ( /// \ingroup SmartPointerGroup template < - typename U, - typename T, - bool S, - class OP, - class CP, - template < class > class KP, - template < class > class RP, - template < class > class DP, - template < class > class CNP -> -inline bool operator < ( U * lhs, - const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & rhs ) +typename U, + typename T, + bool S, + class OP, + class CP, + template < class > class KP, + template < class > class RP, + template < class > class DP, + template < class > class CNP + > +inline bool operator < ( U* lhs, + const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & rhs ) { return ( rhs.GreaterThan( lhs ) ); } @@ -1542,18 +1542,18 @@ inline bool operator < ( U * lhs, /// \ingroup SmartPointerGroup template < - typename U, - typename T, - bool S, - class OP, - class CP, - template < class > class KP, - template < class > class RP, - template < class > class DP, - template < class > class CNP -> +typename U, + typename T, + bool S, + class OP, + class CP, + template < class > class KP, + template < class > class RP, + template < class > class DP, + template < class > class CNP + > inline bool operator > ( - const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & lhs, U * rhs ) + const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & lhs, U* rhs ) { return ( lhs.GreaterThan( rhs ) ); } @@ -1562,18 +1562,18 @@ inline bool operator > ( /// \ingroup SmartPointerGroup template < - typename U, - typename T, - bool S, - class OP, - class CP, - template < class > class KP, - template < class > class RP, - template < class > class DP, - template < class > class CNP -> -inline bool operator > ( U * lhs, - const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & rhs ) +typename U, + typename T, + bool S, + class OP, + class CP, + template < class > class KP, + template < class > class RP, + template < class > class DP, + template < class > class CNP + > +inline bool operator > ( U* lhs, + const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & rhs ) { return ( rhs.LessThan( lhs ) ); } @@ -1582,18 +1582,18 @@ inline bool operator > ( U * lhs, /// \ingroup SmartPointerGroup template < - typename U, - typename T, - bool S, - class OP, - class CP, - template < class > class KP, - template < class > class RP, - template < class > class DP, - template < class > class CNP -> +typename U, + typename T, + bool S, + class OP, + class CP, + template < class > class KP, + template < class > class RP, + template < class > class DP, + template < class > class CNP + > inline bool operator <= ( - const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & lhs, U * rhs ) + const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & lhs, U* rhs ) { return !( lhs.GreaterThan( rhs ) ); } @@ -1602,18 +1602,18 @@ inline bool operator <= ( /// \ingroup SmartPointerGroup template < - typename U, - typename T, - bool S, - class OP, - class CP, - template < class > class KP, - template < class > class RP, - template < class > class DP, - template < class > class CNP -> -inline bool operator <= ( U * lhs, - const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & rhs ) +typename U, + typename T, + bool S, + class OP, + class CP, + template < class > class KP, + template < class > class RP, + template < class > class DP, + template < class > class CNP + > +inline bool operator <= ( U* lhs, + const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & rhs ) { return !( rhs.LessThan( lhs ) ); } @@ -1622,18 +1622,18 @@ inline bool operator <= ( U * lhs, /// \ingroup SmartPointerGroup template < - typename U, - typename T, - bool S, - class OP, - class CP, - template < class > class KP, - template < class > class RP, - template < class > class DP, - template < class > class CNP -> +typename U, + typename T, + bool S, + class OP, + class CP, + template < class > class KP, + template < class > class RP, + template < class > class DP, + template < class > class CNP + > inline bool operator >= ( - const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & lhs, U * rhs ) + const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & lhs, U* rhs ) { return !( lhs.LessThan( rhs ) ); } @@ -1642,18 +1642,18 @@ inline bool operator >= ( /// \ingroup SmartPointerGroup template < - typename U, - typename T, - bool S, - class OP, - class CP, - template < class > class KP, - template < class > class RP, - template < class > class DP, - template < class > class CNP -> -inline bool operator >= ( U * lhs, - const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & rhs ) +typename U, + typename T, + bool S, + class OP, + class CP, + template < class > class KP, + template < class > class RP, + template < class > class DP, + template < class > class CNP + > +inline bool operator >= ( U* lhs, + const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & rhs ) { return !( rhs.GreaterThan( lhs ) ); } @@ -1662,33 +1662,33 @@ inline bool operator >= ( U * lhs, namespace std { - //////////////////////////////////////////////////////////////////////////////// - /// specialization of std::less for StrongPtr - /// \ingroup SmartPointerGroup - //////////////////////////////////////////////////////////////////////////////// - template - < - typename T, - bool S, - class OP, - class CP, - template < class > class KP, - template < class > class RP, - template < class > class DP, - template < class > class CNP - > - struct less< Loki::StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > > +//////////////////////////////////////////////////////////////////////////////// +/// specialization of std::less for StrongPtr +/// \ingroup SmartPointerGroup +//////////////////////////////////////////////////////////////////////////////// +template +< +typename T, + bool S, + class OP, + class CP, + template < class > class KP, + template < class > class RP, + template < class > class DP, + template < class > class CNP + > +struct less< Loki::StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > > : public binary_function< - Loki::StrongPtr< T, S, OP, CP, KP, RP, DP, CNP >, - Loki::StrongPtr< T, S, OP, CP, KP, RP, DP, CNP >, bool > + Loki::StrongPtr< T, S, OP, CP, KP, RP, DP, CNP >, + Loki::StrongPtr< T, S, OP, CP, KP, RP, DP, CNP >, bool > +{ + bool operator () ( + const Loki::StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & lhs, + const Loki::StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & rhs ) const { - bool operator () ( - const Loki::StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & lhs, - const Loki::StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & rhs ) const - { - return ( lhs < rhs ); - } - }; + return ( lhs < rhs ); + } +}; } //////////////////////////////////////////////////////////////////////////////// diff --git a/shared/loki/Threads.h b/shared/loki/Threads.h index cb44f094..8fb5d362 100644 --- a/shared/loki/Threads.h +++ b/shared/loki/Threads.h @@ -54,26 +54,26 @@ #if defined(LOKI_CLASS_LEVEL_THREADING) || defined(LOKI_OBJECT_LEVEL_THREADING) - #define LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL ::Loki::ClassLevelLockable - - #if defined(LOKI_CLASS_LEVEL_THREADING) && !defined(LOKI_OBJECT_LEVEL_THREADING) - #define LOKI_DEFAULT_THREADING ::Loki::ClassLevelLockable - #else - #define LOKI_DEFAULT_THREADING ::Loki::ObjectLevelLockable - #endif - - #if defined(_WIN32) || defined(_WIN64) - #include <windows.h> - #define LOKI_WINDOWS_H - #else - #include <pthread.h> - #define LOKI_PTHREAD_H - #endif +#define LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL ::Loki::ClassLevelLockable + +#if defined(LOKI_CLASS_LEVEL_THREADING) && !defined(LOKI_OBJECT_LEVEL_THREADING) +#define LOKI_DEFAULT_THREADING ::Loki::ClassLevelLockable +#else +#define LOKI_DEFAULT_THREADING ::Loki::ObjectLevelLockable +#endif + +#if defined(_WIN32) || defined(_WIN64) +#include <windows.h> +#define LOKI_WINDOWS_H +#else +#include <pthread.h> +#define LOKI_PTHREAD_H +#endif #else - #define LOKI_DEFAULT_THREADING ::Loki::SingleThreaded - #define LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL ::Loki::SingleThreaded +#define LOKI_DEFAULT_THREADING ::Loki::SingleThreaded +#define LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL ::Loki::SingleThreaded #endif @@ -314,291 +314,291 @@ namespace Loki { - //////////////////////////////////////////////////////////////////////////////// - /// \class Mutex - // - /// \ingroup ThreadingGroup - /// A simple and portable Mutex. A default policy class for locking objects. - //////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +/// \class Mutex +// +/// \ingroup ThreadingGroup +/// A simple and portable Mutex. A default policy class for locking objects. +//////////////////////////////////////////////////////////////////////////////// - class Mutex +class Mutex +{ +public: + Mutex() LOKI_THREADS_MUTEX_CTOR(mtx_) { - public: - Mutex() LOKI_THREADS_MUTEX_CTOR(mtx_) - { - LOKI_THREADS_MUTEX_INIT(&mtx_); - } - ~Mutex() - { - LOKI_THREADS_MUTEX_DELETE(&mtx_); - } - void Lock() - { - LOKI_THREADS_MUTEX_LOCK(&mtx_); - } - void Unlock() - { - LOKI_THREADS_MUTEX_UNLOCK(&mtx_); - } - private: - /// Copy-constructor not implemented. - Mutex(const Mutex &); - /// Copy-assignement operator not implemented. - Mutex & operator = (const Mutex &); - LOKI_THREADS_MUTEX(mtx_) - }; + LOKI_THREADS_MUTEX_INIT(&mtx_); + } + ~Mutex() + { + LOKI_THREADS_MUTEX_DELETE(&mtx_); + } + void Lock() + { + LOKI_THREADS_MUTEX_LOCK(&mtx_); + } + void Unlock() + { + LOKI_THREADS_MUTEX_UNLOCK(&mtx_); + } +private: + /// Copy-constructor not implemented. + Mutex(const Mutex&); + /// Copy-assignement operator not implemented. + Mutex& operator = (const Mutex&); + LOKI_THREADS_MUTEX(mtx_) +}; - //////////////////////////////////////////////////////////////////////////////// - /// \class SingleThreaded - /// - /// \ingroup ThreadingGroup - /// Implementation of the ThreadingModel policy used by various classes - /// Implements a single-threaded model; no synchronization - //////////////////////////////////////////////////////////////////////////////// - template <class Host, class MutexPolicy = LOKI_DEFAULT_MUTEX> - class SingleThreaded +//////////////////////////////////////////////////////////////////////////////// +/// \class SingleThreaded +/// +/// \ingroup ThreadingGroup +/// Implementation of the ThreadingModel policy used by various classes +/// Implements a single-threaded model; no synchronization +//////////////////////////////////////////////////////////////////////////////// +template <class Host, class MutexPolicy = LOKI_DEFAULT_MUTEX> +class SingleThreaded +{ +public: + /// \struct Lock + /// Dummy Lock class + struct Lock { - public: - /// \struct Lock - /// Dummy Lock class - struct Lock - { - Lock() {} - explicit Lock(const SingleThreaded&) {} - explicit Lock(const SingleThreaded*) {} - }; + Lock() {} + explicit Lock(const SingleThreaded&) {} + explicit Lock(const SingleThreaded*) {} + }; - typedef Host VolatileType; + typedef Host VolatileType; - typedef int IntType; + typedef int IntType; - static IntType AtomicAdd(volatile IntType& lval, const IntType val) - { return lval += val; } + static IntType AtomicAdd(volatile IntType& lval, const IntType val) + { return lval += val; } - static IntType AtomicSubtract(volatile IntType& lval, const IntType val) - { return lval -= val; } + static IntType AtomicSubtract(volatile IntType& lval, const IntType val) + { return lval -= val; } - static IntType AtomicMultiply(volatile IntType& lval, const IntType val) - { return lval *= val; } + static IntType AtomicMultiply(volatile IntType& lval, const IntType val) + { return lval *= val; } - static IntType AtomicDivide(volatile IntType& lval, const IntType val) - { return lval /= val; } + static IntType AtomicDivide(volatile IntType& lval, const IntType val) + { return lval /= val; } - static IntType AtomicIncrement(volatile IntType& lval) - { return ++lval; } + static IntType AtomicIncrement(volatile IntType& lval) + { return ++lval; } - static IntType AtomicDecrement(volatile IntType& lval) - { return --lval; } + static IntType AtomicDecrement(volatile IntType& lval) + { return --lval; } - static void AtomicAssign(volatile IntType & lval, const IntType val) - { lval = val; } + static void AtomicAssign(volatile IntType& lval, const IntType val) + { lval = val; } - static void AtomicAssign(IntType & lval, volatile IntType & val) - { lval = val; } + static void AtomicAssign(IntType& lval, volatile IntType& val) + { lval = val; } - static IntType AtomicAdd(volatile IntType& lval, const IntType val, const IntType compare, bool & matches ) - { - lval += val; - matches = ( lval == compare ); - return lval; - } + static IntType AtomicAdd(volatile IntType& lval, const IntType val, const IntType compare, bool& matches ) + { + lval += val; + matches = ( lval == compare ); + return lval; + } - static IntType AtomicSubtract(volatile IntType& lval, const IntType val, const IntType compare, bool & matches ) - { - lval -= val; - matches = ( lval == compare ); - return lval; - } + static IntType AtomicSubtract(volatile IntType& lval, const IntType val, const IntType compare, bool& matches ) + { + lval -= val; + matches = ( lval == compare ); + return lval; + } - static IntType AtomicMultiply(volatile IntType& lval, const IntType val, const IntType compare, bool & matches ) - { - lval *= val; - matches = ( lval == compare ); - return lval; - } + static IntType AtomicMultiply(volatile IntType& lval, const IntType val, const IntType compare, bool& matches ) + { + lval *= val; + matches = ( lval == compare ); + return lval; + } - static IntType AtomicDivide(volatile IntType& lval, const IntType val, const IntType compare, bool & matches ) - { - lval /= val; - matches = ( lval == compare ); - return lval; - } + static IntType AtomicDivide(volatile IntType& lval, const IntType val, const IntType compare, bool& matches ) + { + lval /= val; + matches = ( lval == compare ); + return lval; + } - static IntType AtomicIncrement(volatile IntType& lval, const IntType compare, bool & matches ) - { - ++lval; - matches = ( lval == compare ); - return lval; - } + static IntType AtomicIncrement(volatile IntType& lval, const IntType compare, bool& matches ) + { + ++lval; + matches = ( lval == compare ); + return lval; + } - static IntType AtomicDecrement(volatile IntType& lval, const IntType compare, bool & matches ) - { - --lval; - matches = ( lval == compare ); - return lval; - } + static IntType AtomicDecrement(volatile IntType& lval, const IntType compare, bool& matches ) + { + --lval; + matches = ( lval == compare ); + return lval; + } - }; +}; #if defined(LOKI_WINDOWS_H) || defined(LOKI_PTHREAD_H) - //////////////////////////////////////////////////////////////////////////////// - /// \class ObjectLevelLockable - /// - /// \ingroup ThreadingGroup - /// Implementation of the ThreadingModel policy used by various classes - /// Implements a object-level locking scheme - //////////////////////////////////////////////////////////////////////////////// - template < class Host, class MutexPolicy = LOKI_DEFAULT_MUTEX > - class ObjectLevelLockable - { - mutable MutexPolicy mtx_; +//////////////////////////////////////////////////////////////////////////////// +/// \class ObjectLevelLockable +/// +/// \ingroup ThreadingGroup +/// Implementation of the ThreadingModel policy used by various classes +/// Implements a object-level locking scheme +//////////////////////////////////////////////////////////////////////////////// +template < class Host, class MutexPolicy = LOKI_DEFAULT_MUTEX > +class ObjectLevelLockable +{ + mutable MutexPolicy mtx_; - public: - ObjectLevelLockable() : mtx_() {} +public: + ObjectLevelLockable() : mtx_() {} - ObjectLevelLockable(const ObjectLevelLockable&) : mtx_() {} + ObjectLevelLockable(const ObjectLevelLockable&) : mtx_() {} - ~ObjectLevelLockable() {} + ~ObjectLevelLockable() {} - class Lock; - friend class Lock; + class Lock; + friend class Lock; - /// \struct Lock - /// Lock class to lock on object level - class Lock - { - public: + /// \struct Lock + /// Lock class to lock on object level + class Lock + { + public: - /// Lock object - explicit Lock(const ObjectLevelLockable& host) : host_(host) - { - host_.mtx_.Lock(); - } + /// Lock object + explicit Lock(const ObjectLevelLockable& host) : host_(host) + { + host_.mtx_.Lock(); + } - /// Lock object - explicit Lock(const ObjectLevelLockable* host) : host_(*host) - { - host_.mtx_.Lock(); - } + /// Lock object + explicit Lock(const ObjectLevelLockable* host) : host_(*host) + { + host_.mtx_.Lock(); + } - /// Unlock object - ~Lock() - { - host_.mtx_.Unlock(); - } + /// Unlock object + ~Lock() + { + host_.mtx_.Unlock(); + } - private: - /// private by design of the object level threading - Lock(); - Lock(const Lock&); - Lock& operator=(const Lock&); - const ObjectLevelLockable& host_; - }; + private: + /// private by design of the object level threading + Lock(); + Lock(const Lock&); + Lock& operator=(const Lock&); + const ObjectLevelLockable& host_; + }; - typedef volatile Host VolatileType; + typedef volatile Host VolatileType; - typedef LOKI_THREADS_LONG IntType; + typedef LOKI_THREADS_LONG IntType; - LOKI_THREADS_ATOMIC_FUNCTIONS + LOKI_THREADS_ATOMIC_FUNCTIONS - }; +}; #ifdef LOKI_PTHREAD_H - template <class Host, class MutexPolicy> - pthread_mutex_t ObjectLevelLockable<Host, MutexPolicy>::atomic_mutex_ = PTHREAD_MUTEX_INITIALIZER; +template <class Host, class MutexPolicy> +pthread_mutex_t ObjectLevelLockable<Host, MutexPolicy>::atomic_mutex_ = PTHREAD_MUTEX_INITIALIZER; #endif - //////////////////////////////////////////////////////////////////////////////// - /// \class ClassLevelLockable - /// - /// \ingroup ThreadingGroup - /// Implementation of the ThreadingModel policy used by various classes - /// Implements a class-level locking scheme - //////////////////////////////////////////////////////////////////////////////// - template <class Host, class MutexPolicy = LOKI_DEFAULT_MUTEX > - class ClassLevelLockable +//////////////////////////////////////////////////////////////////////////////// +/// \class ClassLevelLockable +/// +/// \ingroup ThreadingGroup +/// Implementation of the ThreadingModel policy used by various classes +/// Implements a class-level locking scheme +//////////////////////////////////////////////////////////////////////////////// +template <class Host, class MutexPolicy = LOKI_DEFAULT_MUTEX > +class ClassLevelLockable +{ + struct Initializer { - struct Initializer + bool init_; + MutexPolicy mtx_; + + Initializer() : init_(false), mtx_() + { + init_ = true; + } + + ~Initializer() { - bool init_; - MutexPolicy mtx_; + assert(init_); + } + }; - Initializer() : init_(false), mtx_() - { - init_ = true; - } + static Initializer initializer_; - ~Initializer() - { - assert(init_); - } - }; +public: - static Initializer initializer_; + class Lock; + friend class Lock; + /// \struct Lock + /// Lock class to lock on class level + class Lock + { public: - class Lock; - friend class Lock; + /// Lock class + Lock() + { + assert(initializer_.init_); + initializer_.mtx_.Lock(); + } - /// \struct Lock - /// Lock class to lock on class level - class Lock + /// Lock class + explicit Lock(const ClassLevelLockable&) { - public: - - /// Lock class - Lock() - { - assert(initializer_.init_); - initializer_.mtx_.Lock(); - } - - /// Lock class - explicit Lock(const ClassLevelLockable&) - { - assert(initializer_.init_); - initializer_.mtx_.Lock(); - } - - /// Lock class - explicit Lock(const ClassLevelLockable*) - { - assert(initializer_.init_); - initializer_.mtx_.Lock(); - } - - /// Unlock class - ~Lock() - { - assert(initializer_.init_); - initializer_.mtx_.Unlock(); - } - - private: - Lock(const Lock&); - Lock& operator=(const Lock&); - }; - - typedef volatile Host VolatileType; - - typedef LOKI_THREADS_LONG IntType; - - LOKI_THREADS_ATOMIC_FUNCTIONS + assert(initializer_.init_); + initializer_.mtx_.Lock(); + } + /// Lock class + explicit Lock(const ClassLevelLockable*) + { + assert(initializer_.init_); + initializer_.mtx_.Lock(); + } + + /// Unlock class + ~Lock() + { + assert(initializer_.init_); + initializer_.mtx_.Unlock(); + } + + private: + Lock(const Lock&); + Lock& operator=(const Lock&); }; + typedef volatile Host VolatileType; + + typedef LOKI_THREADS_LONG IntType; + + LOKI_THREADS_ATOMIC_FUNCTIONS + +}; + #ifdef LOKI_PTHREAD_H - template <class Host, class MutexPolicy> - pthread_mutex_t ClassLevelLockable<Host, MutexPolicy>::atomic_mutex_ = PTHREAD_MUTEX_INITIALIZER; +template <class Host, class MutexPolicy> +pthread_mutex_t ClassLevelLockable<Host, MutexPolicy>::atomic_mutex_ = PTHREAD_MUTEX_INITIALIZER; #endif - template < class Host, class MutexPolicy > - typename ClassLevelLockable< Host, MutexPolicy >::Initializer - ClassLevelLockable< Host, MutexPolicy >::initializer_; +template < class Host, class MutexPolicy > +typename ClassLevelLockable< Host, MutexPolicy >::Initializer +ClassLevelLockable< Host, MutexPolicy >::initializer_; #endif // #if defined(LOKI_WINDOWS_H) || defined(LOKI_PTHREAD_H) diff --git a/shared/loki/Tuple.h b/shared/loki/Tuple.h index 47fc19e2..ec5ae213 100644 --- a/shared/loki/Tuple.h +++ b/shared/loki/Tuple.h @@ -2,14 +2,14 @@ // The Loki Library // Copyright (c) 2001 by Andrei Alexandrescu // This code accompanies the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author or Addison-Wesley Longman make no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author or Addison-Wesley Longman make no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// @@ -18,5 +18,5 @@ //////////////////////////////////////////////////////////////////////////////// // This file is intentionally left empty // Due to compiler limitations, its contents has been moved to -// HierarchyGenerators.h +// HierarchyGenerators.h //////////////////////////////////////////////////////////////////////////////// diff --git a/shared/loki/TypeManip.h b/shared/loki/TypeManip.h index e08b4e03..6b7f4ab8 100644 --- a/shared/loki/TypeManip.h +++ b/shared/loki/TypeManip.h @@ -2,14 +2,14 @@ // The Loki Library // Copyright (c) 2001 by Andrei Alexandrescu // This code accompanies the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author or Addison-Welsey Longman make no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author or Addison-Welsey Longman make no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_TYPEMANIP_INC_ @@ -27,12 +27,12 @@ namespace Loki // Defines 'value', an enum that evaluates to v //////////////////////////////////////////////////////////////////////////////// - template <int v> - struct Int2Type - { - enum { value = v }; - }; - +template <int v> +struct Int2Type +{ + enum { value = v }; +}; + //////////////////////////////////////////////////////////////////////////////// // class template Type2Type // Converts each type into a unique, insipid type @@ -40,12 +40,12 @@ namespace Loki // Defines the type OriginalType which maps back to T //////////////////////////////////////////////////////////////////////////////// - template <typename T> - struct Type2Type - { - typedef T OriginalType; - }; - +template <typename T> +struct Type2Type +{ + typedef T OriginalType; +}; + //////////////////////////////////////////////////////////////////////////////// // class template Select // Selects one of two types based upon a boolean constant @@ -56,17 +56,17 @@ namespace Loki // Result evaluates to T if flag is true, and to U otherwise. //////////////////////////////////////////////////////////////////////////////// - template <bool flag, typename T, typename U> - struct Select - { - typedef T Result; - }; - template <typename T, typename U> - struct Select<false, T, U> - { - typedef U Result; - }; - +template <bool flag, typename T, typename U> +struct Select +{ + typedef T Result; +}; +template <typename T, typename U> +struct Select<false, T, U> +{ + typedef U Result; +}; + //////////////////////////////////////////////////////////////////////////////// // class template IsSameType // Return true iff two given types are the same @@ -76,34 +76,34 @@ namespace Loki // Result evaluates to true iff U == T (types equal) //////////////////////////////////////////////////////////////////////////////// - template <typename T, typename U> - struct IsSameType - { - enum { value = false }; - }; - - template <typename T> - struct IsSameType<T,T> - { - enum { value = true }; - }; +template <typename T, typename U> +struct IsSameType +{ + enum { value = false }; +}; + +template <typename T> +struct IsSameType<T,T> +{ + enum { value = true }; +}; //////////////////////////////////////////////////////////////////////////////// // Helper types Small and Big - guarantee that sizeof(Small) < sizeof(Big) //////////////////////////////////////////////////////////////////////////////// - namespace Private - { - template <class T, class U> - struct ConversionHelper - { - typedef char Small; - struct Big { char dummy[2]; }; - static Big Test(...); - static Small Test(U); - static T MakeT(); - }; - } +namespace Private +{ +template <class T, class U> +struct ConversionHelper +{ + typedef char Small; + struct Big { char dummy[2]; }; + static Big Test(...); + static Small Test(U); + static T MakeT(); +}; +} //////////////////////////////////////////////////////////////////////////////// // class template Conversion @@ -121,48 +121,48 @@ namespace Loki // Caveat: might not work if T and U are in a private inheritance hierarchy. //////////////////////////////////////////////////////////////////////////////// - template <class T, class U> - struct Conversion - { - typedef Private::ConversionHelper<T, U> H; +template <class T, class U> +struct Conversion +{ + typedef Private::ConversionHelper<T, U> H; #ifndef __MWERKS__ - enum { exists = sizeof(typename H::Small) == sizeof((H::Test(H::MakeT()))) }; + enum { exists = sizeof(typename H::Small) == sizeof((H::Test(H::MakeT()))) }; #else - enum { exists = false }; + enum { exists = false }; #endif - enum { exists2Way = exists && Conversion<U, T>::exists }; - enum { sameType = false }; - }; - - template <class T> - struct Conversion<T, T> - { - enum { exists = 1, exists2Way = 1, sameType = 1 }; - }; - - template <class T> - struct Conversion<void, T> - { - enum { exists = 0, exists2Way = 0, sameType = 0 }; - }; - - template <class T> - struct Conversion<T, void> - { - enum { exists = 0, exists2Way = 0, sameType = 0 }; - }; - - template <> - struct Conversion<void, void> - { - public: - enum { exists = 1, exists2Way = 1, sameType = 1 }; - }; + enum { exists2Way = exists && Conversion<U, T>::exists }; + enum { sameType = false }; +}; + +template <class T> +struct Conversion<T, T> +{ + enum { exists = 1, exists2Way = 1, sameType = 1 }; +}; + +template <class T> +struct Conversion<void, T> +{ + enum { exists = 0, exists2Way = 0, sameType = 0 }; +}; + +template <class T> +struct Conversion<T, void> +{ + enum { exists = 0, exists2Way = 0, sameType = 0 }; +}; + +template <> +struct Conversion<void, void> +{ +public: + enum { exists = 1, exists2Way = 1, sameType = 1 }; +}; //////////////////////////////////////////////////////////////////////////////// // class template SuperSubclass -// Invocation: SuperSubclass<B, D>::value where B and D are types. -// Returns true if B is a public base of D, or if B and D are aliases of the +// Invocation: SuperSubclass<B, D>::value where B and D are types. +// Returns true if B is a public base of D, or if B and D are aliases of the // same type. // // Caveat: might not work if T and U are in a private inheritance hierarchy. @@ -172,41 +172,44 @@ template <class T, class U> struct SuperSubclass { enum { value = (::Loki::Conversion<const volatile U*, const volatile T*>::exists && - !::Loki::Conversion<const volatile T*, const volatile void*>::sameType) }; - + !::Loki::Conversion<const volatile T*, const volatile void*>::sameType) + }; + // Dummy enum to make sure that both classes are fully defined. - enum{ dontUseWithIncompleteTypes = ( sizeof (T) == sizeof (U) ) }; + enum { dontUseWithIncompleteTypes = ( sizeof (T) == sizeof (U) ) }; }; template <> -struct SuperSubclass<void, void> +struct SuperSubclass<void, void> { enum { value = false }; }; template <class U> -struct SuperSubclass<void, U> +struct SuperSubclass<void, U> { enum { value = (::Loki::Conversion<const volatile U*, const volatile void*>::exists && - !::Loki::Conversion<const volatile void*, const volatile void*>::sameType) }; - + !::Loki::Conversion<const volatile void*, const volatile void*>::sameType) + }; + // Dummy enum to make sure that both classes are fully defined. - enum{ dontUseWithIncompleteTypes = ( 0 == sizeof (U) ) }; + enum { dontUseWithIncompleteTypes = ( 0 == sizeof (U) ) }; }; template <class T> -struct SuperSubclass<T, void> +struct SuperSubclass<T, void> { enum { value = (::Loki::Conversion<const volatile void*, const volatile T*>::exists && - !::Loki::Conversion<const volatile T*, const volatile void*>::sameType) }; - + !::Loki::Conversion<const volatile T*, const volatile void*>::sameType) + }; + // Dummy enum to make sure that both classes are fully defined. - enum{ dontUseWithIncompleteTypes = ( sizeof (T) == 0 ) }; + enum { dontUseWithIncompleteTypes = ( sizeof (T) == 0 ) }; }; //////////////////////////////////////////////////////////////////////////////// // class template SuperSubclassStrict -// Invocation: SuperSubclassStrict<B, D>::value where B and D are types. +// Invocation: SuperSubclassStrict<B, D>::value where B and D are types. // Returns true if B is a public base of D. // // Caveat: might not work if T and U are in a private inheritance hierarchy. @@ -216,39 +219,42 @@ template<class T,class U> struct SuperSubclassStrict { enum { value = (::Loki::Conversion<const volatile U*, const volatile T*>::exists && - !::Loki::Conversion<const volatile T*, const volatile void*>::sameType && - !::Loki::Conversion<const volatile T*, const volatile U*>::sameType) }; - + !::Loki::Conversion<const volatile T*, const volatile void*>::sameType && + !::Loki::Conversion<const volatile T*, const volatile U*>::sameType) + }; + // Dummy enum to make sure that both classes are fully defined. - enum{ dontUseWithIncompleteTypes = ( sizeof (T) == sizeof (U) ) }; + enum { dontUseWithIncompleteTypes = ( sizeof (T) == sizeof (U) ) }; }; template<> -struct SuperSubclassStrict<void, void> +struct SuperSubclassStrict<void, void> { enum { value = false }; }; template<class U> -struct SuperSubclassStrict<void, U> +struct SuperSubclassStrict<void, U> { enum { value = (::Loki::Conversion<const volatile U*, const volatile void*>::exists && - !::Loki::Conversion<const volatile void*, const volatile void*>::sameType && - !::Loki::Conversion<const volatile void*, const volatile U*>::sameType) }; - + !::Loki::Conversion<const volatile void*, const volatile void*>::sameType && + !::Loki::Conversion<const volatile void*, const volatile U*>::sameType) + }; + // Dummy enum to make sure that both classes are fully defined. - enum{ dontUseWithIncompleteTypes = ( 0 == sizeof (U) ) }; + enum { dontUseWithIncompleteTypes = ( 0 == sizeof (U) ) }; }; template<class T> -struct SuperSubclassStrict<T, void> +struct SuperSubclassStrict<T, void> { enum { value = (::Loki::Conversion<const volatile void*, const volatile T*>::exists && - !::Loki::Conversion<const volatile T*, const volatile void*>::sameType && - !::Loki::Conversion<const volatile T*, const volatile void*>::sameType) }; - + !::Loki::Conversion<const volatile T*, const volatile void*>::sameType && + !::Loki::Conversion<const volatile T*, const volatile void*>::sameType) + }; + // Dummy enum to make sure that both classes are fully defined. - enum{ dontUseWithIncompleteTypes = ( sizeof (T) == 0 ) }; + enum { dontUseWithIncompleteTypes = ( sizeof (T) == 0 ) }; }; @@ -256,8 +262,8 @@ struct SuperSubclassStrict<T, void> //////////////////////////////////////////////////////////////////////////////// // macro SUPERSUBCLASS -// Invocation: SUPERSUBCLASS(B, D) where B and D are types. -// Returns true if B is a public base of D, or if B and D are aliases of the +// Invocation: SUPERSUBCLASS(B, D) where B and D are types. +// Returns true if B is a public base of D, or if B and D are aliases of the // same type. // // Caveat: might not work if T and U are in a private inheritance hierarchy. @@ -269,7 +275,7 @@ struct SuperSubclassStrict<T, void> //////////////////////////////////////////////////////////////////////////////// // macro SUPERSUBCLASS_STRICT -// Invocation: SUPERSUBCLASS(B, D) where B and D are types. +// Invocation: SUPERSUBCLASS(B, D) where B and D are types. // Returns true if B is a public base of D. // // Caveat: might not work if T and U are in a private inheritance hierarchy. diff --git a/shared/loki/TypeTraits.h b/shared/loki/TypeTraits.h index a592cab9..00ef069e 100644 --- a/shared/loki/TypeTraits.h +++ b/shared/loki/TypeTraits.h @@ -2,14 +2,14 @@ // The Loki Library // Copyright (c) 2001 by Andrei Alexandrescu // This code accompanies the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author or Addison-Wesley Longman make no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author or Addison-Wesley Longman make no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_TYPETRAITS_INC_ @@ -27,7 +27,7 @@ #ifdef _MSC_VER -#pragma warning( push ) +#pragma warning( push ) #pragma warning( disable : 4180 ) //qualifier applied to function type has no meaning; ignored #endif @@ -36,7 +36,7 @@ namespace Loki //////////////////////////////////////////////////////////////////////////////// // class template IsCustomUnsignedInt // Offers a means to integrate nonstandard built-in unsigned integral types -// (such as unsigned __int64 or unsigned long long int) with the TypeTraits +// (such as unsigned __int64 or unsigned long long int) with the TypeTraits // class template defined below. // Invocation: IsCustomUnsignedInt<T> where T is any type // Defines 'value', an enum that is 1 iff T is a custom built-in unsigned @@ -45,16 +45,16 @@ namespace Loki // and define value = 1 in those specializations //////////////////////////////////////////////////////////////////////////////// - template <typename T> - struct IsCustomUnsignedInt - { - enum { value = 0 }; - }; +template <typename T> +struct IsCustomUnsignedInt +{ + enum { value = 0 }; +}; //////////////////////////////////////////////////////////////////////////////// // class template IsCustomSignedInt // Offers a means to integrate nonstandard built-in unsigned integral types -// (such as unsigned __int64 or unsigned long long int) with the TypeTraits +// (such as unsigned __int64 or unsigned long long int) with the TypeTraits // class template defined below. // Invocation: IsCustomSignedInt<T> where T is any type // Defines 'value', an enum that is 1 iff T is a custom built-in signed @@ -63,11 +63,11 @@ namespace Loki // and define value = 1 in those specializations //////////////////////////////////////////////////////////////////////////////// - template <typename T> - struct IsCustomSignedInt - { - enum { value = 0 }; - }; +template <typename T> +struct IsCustomSignedInt +{ + enum { value = 0 }; +}; //////////////////////////////////////////////////////////////////////////////// // class template IsCustomFloat @@ -80,1955 +80,1955 @@ namespace Loki // and define value = 1 in those specializations //////////////////////////////////////////////////////////////////////////////// - template <typename T> - struct IsCustomFloat - { - enum { value = 0 }; - }; +template <typename T> +struct IsCustomFloat +{ + enum { value = 0 }; +}; //////////////////////////////////////////////////////////////////////////////// // Helper types for class template TypeTraits defined below //////////////////////////////////////////////////////////////////////////////// - namespace Private - { -#ifndef LOKI_DISABLE_TYPELIST_MACROS - typedef LOKI_TYPELIST_4(unsigned char, unsigned short int,unsigned int, unsigned long int) - StdUnsignedInts; - typedef LOKI_TYPELIST_4(signed char, short int,int, long int) - StdSignedInts; - typedef LOKI_TYPELIST_3(bool, char, wchar_t) - StdOtherInts; - typedef LOKI_TYPELIST_3(float, double, long double) - StdFloats; +namespace Private +{ +#ifndef LOKI_DISABLE_TYPELIST_MACROS +typedef LOKI_TYPELIST_4(unsigned char, unsigned short int,unsigned int, unsigned long int) +StdUnsignedInts; +typedef LOKI_TYPELIST_4(signed char, short int,int, long int) +StdSignedInts; +typedef LOKI_TYPELIST_3(bool, char, wchar_t) +StdOtherInts; +typedef LOKI_TYPELIST_3(float, double, long double) +StdFloats; #else - typedef Loki::Seq<unsigned char, unsigned short int,unsigned int, unsigned long int>::Type - StdUnsignedInts; - typedef Loki::Seq<signed char, short int,int, long int>::Type - StdSignedInts; - typedef Loki::Seq<bool, char, wchar_t>::Type - StdOtherInts; - typedef Loki::Seq<float, double, long double>::Type - StdFloats; - -#endif - template <typename U> struct AddPointer - { - typedef U* Result; - }; - - template <typename U> struct AddPointer<U&> - { - typedef U* Result; - }; - - template <class U> struct AddReference - { - typedef U & Result; - }; - - template <class U> struct AddReference<U &> - { - typedef U & Result; - }; - - template <> struct AddReference<void> - { - typedef NullType Result; - }; - - template <class U> struct AddParameterType - { - typedef const U & Result; - }; - - template <class U> struct AddParameterType<U &> - { - typedef U & Result; - }; - - template <> struct AddParameterType<void> - { - typedef NullType Result; - }; - - template <typename T> - struct IsFunctionPointerRaw - {enum{result = 0};}; - - template <typename T> - struct IsFunctionPointerRaw<T(*)()> - {enum {result = 1};}; - - template <typename T, - typename P01> - struct IsFunctionPointerRaw<T(*)(P01)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02> - struct IsFunctionPointerRaw<T(*)( - P01, P02)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18, typename P19> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, P19)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18, typename P19, typename P20> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, P19, P20)> - {enum {result = 1};}; - - template <typename T> - struct IsFunctionPointerRaw<T(*)( - ...)> - {enum {result = 1};}; - - template <typename T, - typename P01> - struct IsFunctionPointerRaw<T(*)( - P01, ...)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02> - struct IsFunctionPointerRaw<T(*)( - P01, P02, ...)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, ...)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, ...)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - ...)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, ...)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, ...)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, ...)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, ...)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - ...)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, ...)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, ...)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, ...)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, ...)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - ...)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, ...)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, ...)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, ...)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18, typename P19> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, P19, ...)> - {enum {result = 1};}; - - template <typename T, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18, typename P19, typename P20> - struct IsFunctionPointerRaw<T(*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, P19, P20, - ...)> - {enum {result = 1};}; - - - template <typename T> - struct IsMemberFunctionPointerRaw - {enum{result = 0};}; - - template <typename T, typename S> - struct IsMemberFunctionPointerRaw<T (S::*)()> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01> - struct IsMemberFunctionPointerRaw<T (S::*)(P01)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18, typename P19> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, P19)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18, typename P19, typename P20> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, P19, P20)> - {enum {result = 1};}; - - template <typename T, typename S> - struct IsMemberFunctionPointerRaw<T (S::*)( - ...)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, ...)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, ...)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, ...)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, ...)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - ...)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, ...)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, ...)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, ...)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, ...)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - ...)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, ...)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, ...)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, ...)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, ...)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - ...)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, ...)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, ...)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, ...)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18, typename P19> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, P19, ...)> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18, typename P19, typename P20> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, P19, P20, - ...)> - {enum {result = 1};}; - - // Const versions - - template <typename T, typename S> - struct IsMemberFunctionPointerRaw<T (S::*)() const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01> - struct IsMemberFunctionPointerRaw<T (S::*)(P01) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18, typename P19> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, P19) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18, typename P19, typename P20> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, P19, P20) const> - {enum {result = 1};}; - - template <typename T, typename S> - struct IsMemberFunctionPointerRaw<T (S::*)( - ...) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, ...) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, ...) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, ...) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, ...) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - ...) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, ...) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, ...) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, ...) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, ...) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - ...) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, ...) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, ...) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, ...) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, ...) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - ...) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, ...) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, ...) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, ...) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18, typename P19> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, P19, ...) const> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18, typename P19, typename P20> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, P19, P20, - ...) const> - {enum {result = 1};}; - - // Volatile versions - - template <typename T, typename S> - struct IsMemberFunctionPointerRaw<T (S::*)() volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01> - struct IsMemberFunctionPointerRaw<T (S::*)(P01) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18, typename P19> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, P19) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18, typename P19, typename P20> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, P19, P20) volatile> - {enum {result = 1};}; - - template <typename T, typename S> - struct IsMemberFunctionPointerRaw<T (S::*)( - ...) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, ...) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, ...) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, ...) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, ...) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - ...) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, ...) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, ...) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, ...) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, ...) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - ...) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, ...) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, ...) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, ...) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, ...) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - ...) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, ...) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, ...) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, ...) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18, typename P19> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, P19, ...) volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18, typename P19, typename P20> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, P19, P20, - ...) volatile> - {enum {result = 1};}; - - // Const volatile versions - - template <typename T, typename S> - struct IsMemberFunctionPointerRaw<T (S::*)() const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01> - struct IsMemberFunctionPointerRaw<T (S::*)(P01) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18, typename P19> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, P19) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18, typename P19, typename P20> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, P19, P20) const volatile> - {enum {result = 1};}; - - template <typename T, typename S> - struct IsMemberFunctionPointerRaw<T (S::*)( - ...) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, ...) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, ...) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, ...) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, ...) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - ...) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, ...) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, ...) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, ...) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, ...) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - ...) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, ...) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, ...) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, ...) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, ...) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - ...) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, ...) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, ...) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, ...) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18, typename P19> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, P19, ...) const volatile> - {enum {result = 1};}; - - template <typename T, typename S, - typename P01, typename P02, typename P03, typename P04, typename P05, - typename P06, typename P07, typename P08, typename P09, typename P10, - typename P11, typename P12, typename P13, typename P14, typename P15, - typename P16, typename P17, typename P18, typename P19, typename P20> - struct IsMemberFunctionPointerRaw<T (S::*)( - P01, P02, P03, P04, P05, - P06, P07, P08, P09, P10, - P11, P12, P13, P14, P15, - P16, P17, P18, P19, P20, - ...) const volatile> - {enum {result = 1};}; - - }// namespace Private - +typedef Loki::Seq<unsigned char, unsigned short int,unsigned int, unsigned long int>::Type +StdUnsignedInts; +typedef Loki::Seq<signed char, short int,int, long int>::Type +StdSignedInts; +typedef Loki::Seq<bool, char, wchar_t>::Type +StdOtherInts; +typedef Loki::Seq<float, double, long double>::Type +StdFloats; + +#endif +template <typename U> struct AddPointer +{ + typedef U* Result; +}; + +template <typename U> struct AddPointer<U&> +{ + typedef U* Result; +}; + +template <class U> struct AddReference +{ + typedef U& Result; +}; + +template <class U> struct AddReference<U&> +{ + typedef U& Result; +}; + +template <> struct AddReference<void> +{ + typedef NullType Result; +}; + +template <class U> struct AddParameterType +{ + typedef const U& Result; +}; + +template <class U> struct AddParameterType<U&> +{ + typedef U& Result; +}; + +template <> struct AddParameterType<void> +{ + typedef NullType Result; +}; + +template <typename T> +struct IsFunctionPointerRaw + {enum {result = 0};}; + +template <typename T> +struct IsFunctionPointerRaw<T(*)()> +{enum {result = 1};}; + +template <typename T, + typename P01> +struct IsFunctionPointerRaw<T(*)(P01)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02> +struct IsFunctionPointerRaw<T(*)( + P01, P02)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18, typename P19> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, P19)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18, typename P19, typename P20> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, P19, P20)> +{enum {result = 1};}; + +template <typename T> +struct IsFunctionPointerRaw<T(*)( + ...)> +{enum {result = 1};}; + +template <typename T, + typename P01> +struct IsFunctionPointerRaw<T(*)( + P01, ...)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02> +struct IsFunctionPointerRaw<T(*)( + P01, P02, ...)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, ...)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, ...)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + ...)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, ...)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, ...)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, ...)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, ...)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + ...)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, ...)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, ...)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, ...)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, ...)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + ...)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, ...)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, ...)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, ...)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18, typename P19> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, P19, ...)> +{enum {result = 1};}; + +template <typename T, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18, typename P19, typename P20> +struct IsFunctionPointerRaw<T(*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, P19, P20, + ...)> +{enum {result = 1};}; + + +template <typename T> +struct IsMemberFunctionPointerRaw + {enum {result = 0};}; + +template <typename T, typename S> +struct IsMemberFunctionPointerRaw<T (S::*)()> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01> +struct IsMemberFunctionPointerRaw<T (S::*)(P01)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18, typename P19> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, P19)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18, typename P19, typename P20> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, P19, P20)> +{enum {result = 1};}; + +template <typename T, typename S> +struct IsMemberFunctionPointerRaw<T (S::*)( + ...)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, ...)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, ...)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, ...)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, ...)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + ...)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, ...)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, ...)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, ...)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, ...)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + ...)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, ...)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, ...)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, ...)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, ...)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + ...)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, ...)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, ...)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, ...)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18, typename P19> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, P19, ...)> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18, typename P19, typename P20> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, P19, P20, + ...)> +{enum {result = 1};}; + +// Const versions + +template <typename T, typename S> +struct IsMemberFunctionPointerRaw<T (S::*)() const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01> +struct IsMemberFunctionPointerRaw<T (S::*)(P01) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18, typename P19> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, P19) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18, typename P19, typename P20> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, P19, P20) const> +{enum {result = 1};}; + +template <typename T, typename S> +struct IsMemberFunctionPointerRaw<T (S::*)( + ...) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, ...) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, ...) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, ...) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, ...) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + ...) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, ...) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, ...) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, ...) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, ...) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + ...) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, ...) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, ...) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, ...) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, ...) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + ...) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, ...) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, ...) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, ...) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18, typename P19> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, P19, ...) const> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18, typename P19, typename P20> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, P19, P20, + ...) const> +{enum {result = 1};}; + +// Volatile versions + +template <typename T, typename S> +struct IsMemberFunctionPointerRaw<T (S::*)() volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01> +struct IsMemberFunctionPointerRaw<T (S::*)(P01) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18, typename P19> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, P19) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18, typename P19, typename P20> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, P19, P20) volatile> +{enum {result = 1};}; + +template <typename T, typename S> +struct IsMemberFunctionPointerRaw<T (S::*)( + ...) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, ...) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, ...) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, ...) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, ...) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + ...) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, ...) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, ...) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, ...) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, ...) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + ...) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, ...) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, ...) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, ...) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, ...) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + ...) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, ...) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, ...) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, ...) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18, typename P19> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, P19, ...) volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18, typename P19, typename P20> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, P19, P20, + ...) volatile> +{enum {result = 1};}; + +// Const volatile versions + +template <typename T, typename S> +struct IsMemberFunctionPointerRaw<T (S::*)() const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01> +struct IsMemberFunctionPointerRaw<T (S::*)(P01) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18, typename P19> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, P19) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18, typename P19, typename P20> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, P19, P20) const volatile> +{enum {result = 1};}; + +template <typename T, typename S> +struct IsMemberFunctionPointerRaw<T (S::*)( + ...) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, ...) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, ...) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, ...) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, ...) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + ...) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, ...) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, ...) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, ...) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, ...) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + ...) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, ...) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, ...) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, ...) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, ...) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + ...) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, ...) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, ...) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, ...) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18, typename P19> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, P19, ...) const volatile> +{enum {result = 1};}; + +template <typename T, typename S, + typename P01, typename P02, typename P03, typename P04, typename P05, + typename P06, typename P07, typename P08, typename P09, typename P10, + typename P11, typename P12, typename P13, typename P14, typename P15, + typename P16, typename P17, typename P18, typename P19, typename P20> +struct IsMemberFunctionPointerRaw<T (S::*)( + P01, P02, P03, P04, P05, + P06, P07, P08, P09, P10, + P11, P12, P13, P14, P15, + P16, P17, P18, P19, P20, + ...) const volatile> +{enum {result = 1};}; + +}// namespace Private + //////////////////////////////////////////////////////////////////////////////// // class template TypeTraits // @@ -2036,10 +2036,10 @@ namespace Loki // Invocations (T is a type, TypeTraits<T>::Property): // // - isPointer : returns true if T is a pointer type -// - PointeeType : returns the type to which T points if T is a pointer +// - PointeeType : returns the type to which T points if T is a pointer // type, NullType otherwise // - isReference : returns true if T is a reference type -// - ReferredType : returns the type to which T refers if T is a reference +// - ReferredType : returns the type to which T refers if T is a reference // type, NullType otherwise // - isMemberPointer : returns true if T is a pointer to member type // - isStdUnsignedInt: returns true if T is a standard unsigned integral type @@ -2054,169 +2054,177 @@ namespace Loki // - isFloat : returns true if T is a floating-point type // - isArith : returns true if T is a arithmetic type // - isFundamental : returns true if T is a fundamental type -// - ParameterType : returns the optimal type to be used as a parameter for +// - ParameterType : returns the optimal type to be used as a parameter for // functions that take Ts // - isConst : returns true if T is a const-qualified type // - NonConstType : Type with removed 'const' qualifier from T, if any // - isVolatile : returns true if T is a volatile-qualified type // - NonVolatileType : Type with removed 'volatile' qualifier from T, if any -// - UnqualifiedType : Type with removed 'const' and 'volatile' qualifiers from +// - UnqualifiedType : Type with removed 'const' and 'volatile' qualifiers from // T, if any -// - ParameterType : returns the optimal type to be used as a parameter +// - ParameterType : returns the optimal type to be used as a parameter // for functions that take 'const T's // //////////////////////////////////////////////////////////////////////////////// - template <typename T> - class TypeTraits +template <typename T> +class TypeTraits +{ +private: + + template <class U> struct ReferenceTraits { - private: - - template <class U> struct ReferenceTraits - { - enum { result = false }; - typedef U ReferredType; - }; - - template <class U> struct ReferenceTraits<U&> - { - enum { result = true }; - typedef U ReferredType; - }; - - template <class U> struct PointerTraits - { - enum { result = false }; - typedef NullType PointeeType; - }; - - template <class U> struct PointerTraits<U*> - { - enum { result = true }; - typedef U PointeeType; - }; - - template <class U> struct PointerTraits<U*&> - { - enum { result = true }; - typedef U PointeeType; - }; - - template <class U> struct PToMTraits - { - enum { result = false }; - }; - - template <class U, class V> struct PToMTraits<U V::*> - { - enum { result = true }; - }; - - template <class U, class V> struct PToMTraits<U V::*&> - { - enum { result = true }; - }; - - template <class U> struct FunctionPointerTraits - { - enum{ result = Private::IsFunctionPointerRaw<U>::result }; - }; - - template <typename U> struct PToMFunctionTraits - { - enum{ result = Private::IsMemberFunctionPointerRaw<U>::result }; - }; - - template <class U> struct UnConst - { - typedef U Result; - enum { isConst = 0 }; - }; - - template <class U> struct UnConst<const U> - { - typedef U Result; - enum { isConst = 1 }; - }; - - template <class U> struct UnConst<const U&> - { - typedef U& Result; - enum { isConst = 1 }; - }; - - template <class U> struct UnVolatile - { - typedef U Result; - enum { isVolatile = 0 }; - }; - - template <class U> struct UnVolatile<volatile U> - { - typedef U Result; - enum { isVolatile = 1 }; - }; - - template <class U> struct UnVolatile<volatile U&> - { - typedef U& Result; - enum { isVolatile = 1 }; - }; - - public: - typedef typename UnConst<T>::Result - NonConstType; - typedef typename UnVolatile<T>::Result - NonVolatileType; - typedef typename UnVolatile<typename UnConst<T>::Result>::Result - UnqualifiedType; - typedef typename PointerTraits<UnqualifiedType>::PointeeType - PointeeType; - typedef typename ReferenceTraits<T>::ReferredType - ReferredType; - - enum { isConst = UnConst<T>::isConst }; - enum { isVolatile = UnVolatile<T>::isVolatile }; - enum { isReference = ReferenceTraits<UnqualifiedType>::result }; - enum { isFunction = FunctionPointerTraits<typename Private::AddPointer<T>::Result >::result }; - enum { isFunctionPointer= FunctionPointerTraits< - typename ReferenceTraits<UnqualifiedType>::ReferredType >::result }; - enum { isMemberFunctionPointer= PToMFunctionTraits< - typename ReferenceTraits<UnqualifiedType>::ReferredType >::result }; - enum { isMemberPointer = PToMTraits< - typename ReferenceTraits<UnqualifiedType>::ReferredType >::result || - isMemberFunctionPointer }; - enum { isPointer = PointerTraits< - typename ReferenceTraits<UnqualifiedType>::ReferredType >::result || - isFunctionPointer }; - - enum { isStdUnsignedInt = TL::IndexOf<Private::StdUnsignedInts, UnqualifiedType>::value >= 0 || - TL::IndexOf<Private::StdUnsignedInts, - typename ReferenceTraits<UnqualifiedType>::ReferredType>::value >= 0}; - enum { isStdSignedInt = TL::IndexOf<Private::StdSignedInts, UnqualifiedType>::value >= 0 || - TL::IndexOf<Private::StdSignedInts, - typename ReferenceTraits<UnqualifiedType>::ReferredType>::value >= 0}; - enum { isStdIntegral = isStdUnsignedInt || isStdSignedInt || - TL::IndexOf<Private::StdOtherInts, UnqualifiedType>::value >= 0 || - TL::IndexOf<Private::StdOtherInts, - typename ReferenceTraits<UnqualifiedType>::ReferredType>::value >= 0}; - enum { isStdFloat = TL::IndexOf<Private::StdFloats, UnqualifiedType>::value >= 0 || - TL::IndexOf<Private::StdFloats, - typename ReferenceTraits<UnqualifiedType>::ReferredType>::value >= 0}; - enum { isStdArith = isStdIntegral || isStdFloat }; - enum { isStdFundamental = isStdArith || isStdFloat || Conversion<T, void>::sameType }; - - enum { isUnsignedInt = isStdUnsignedInt || IsCustomUnsignedInt<UnqualifiedType>::value }; - enum { isSignedInt = isStdSignedInt || IsCustomSignedInt<UnqualifiedType>::value }; - enum { isIntegral = isStdIntegral || isUnsignedInt || isSignedInt }; - enum { isFloat = isStdFloat || IsCustomFloat<UnqualifiedType>::value }; - enum { isArith = isIntegral || isFloat }; - enum { isFundamental = isStdFundamental || isArith }; - - typedef typename Select<isStdArith || isPointer || isMemberPointer, T, - typename Private::AddParameterType<T>::Result>::Result - ParameterType; + enum { result = false }; + typedef U ReferredType; + }; + + template <class U> struct ReferenceTraits<U&> + { + enum { result = true }; + typedef U ReferredType; + }; + + template <class U> struct PointerTraits + { + enum { result = false }; + typedef NullType PointeeType; + }; + + template <class U> struct PointerTraits<U*> + { + enum { result = true }; + typedef U PointeeType; }; + + template <class U> struct PointerTraits<U*&> + { + enum { result = true }; + typedef U PointeeType; + }; + + template <class U> struct PToMTraits + { + enum { result = false }; + }; + + template <class U, class V> struct PToMTraits<U V::*> + { + enum { result = true }; + }; + + template <class U, class V> struct PToMTraits<U V::*&> + { + enum { result = true }; + }; + + template <class U> struct FunctionPointerTraits + { + enum { result = Private::IsFunctionPointerRaw<U>::result }; + }; + + template <typename U> struct PToMFunctionTraits + { + enum { result = Private::IsMemberFunctionPointerRaw<U>::result }; + }; + + template <class U> struct UnConst + { + typedef U Result; + enum { isConst = 0 }; + }; + + template <class U> struct UnConst<const U> + { + typedef U Result; + enum { isConst = 1 }; + }; + + template <class U> struct UnConst<const U&> + { + typedef U& Result; + enum { isConst = 1 }; + }; + + template <class U> struct UnVolatile + { + typedef U Result; + enum { isVolatile = 0 }; + }; + + template <class U> struct UnVolatile<volatile U> + { + typedef U Result; + enum { isVolatile = 1 }; + }; + + template <class U> struct UnVolatile<volatile U&> + { + typedef U& Result; + enum { isVolatile = 1 }; + }; + +public: + typedef typename UnConst<T>::Result + NonConstType; + typedef typename UnVolatile<T>::Result + NonVolatileType; + typedef typename UnVolatile<typename UnConst<T>::Result>::Result + UnqualifiedType; + typedef typename PointerTraits<UnqualifiedType>::PointeeType + PointeeType; + typedef typename ReferenceTraits<T>::ReferredType + ReferredType; + + enum { isConst = UnConst<T>::isConst }; + enum { isVolatile = UnVolatile<T>::isVolatile }; + enum { isReference = ReferenceTraits<UnqualifiedType>::result }; + enum { isFunction = FunctionPointerTraits<typename Private::AddPointer<T>::Result >::result }; + enum { isFunctionPointer= FunctionPointerTraits< + typename ReferenceTraits<UnqualifiedType>::ReferredType >::result + }; + enum { isMemberFunctionPointer= PToMFunctionTraits< + typename ReferenceTraits<UnqualifiedType>::ReferredType >::result + }; + enum { isMemberPointer = PToMTraits< + typename ReferenceTraits<UnqualifiedType>::ReferredType >::result || + isMemberFunctionPointer + }; + enum { isPointer = PointerTraits< + typename ReferenceTraits<UnqualifiedType>::ReferredType >::result || + isFunctionPointer + }; + + enum { isStdUnsignedInt = TL::IndexOf<Private::StdUnsignedInts, UnqualifiedType>::value >= 0 || + TL::IndexOf<Private::StdUnsignedInts, + typename ReferenceTraits<UnqualifiedType>::ReferredType>::value >= 0 + }; + enum { isStdSignedInt = TL::IndexOf<Private::StdSignedInts, UnqualifiedType>::value >= 0 || + TL::IndexOf<Private::StdSignedInts, + typename ReferenceTraits<UnqualifiedType>::ReferredType>::value >= 0 + }; + enum { isStdIntegral = isStdUnsignedInt || isStdSignedInt || + TL::IndexOf<Private::StdOtherInts, UnqualifiedType>::value >= 0 || + TL::IndexOf<Private::StdOtherInts, + typename ReferenceTraits<UnqualifiedType>::ReferredType>::value >= 0 + }; + enum { isStdFloat = TL::IndexOf<Private::StdFloats, UnqualifiedType>::value >= 0 || + TL::IndexOf<Private::StdFloats, + typename ReferenceTraits<UnqualifiedType>::ReferredType>::value >= 0 + }; + enum { isStdArith = isStdIntegral || isStdFloat }; + enum { isStdFundamental = isStdArith || isStdFloat || Conversion<T, void>::sameType }; + + enum { isUnsignedInt = isStdUnsignedInt || IsCustomUnsignedInt<UnqualifiedType>::value }; + enum { isSignedInt = isStdSignedInt || IsCustomSignedInt<UnqualifiedType>::value }; + enum { isIntegral = isStdIntegral || isUnsignedInt || isSignedInt }; + enum { isFloat = isStdFloat || IsCustomFloat<UnqualifiedType>::value }; + enum { isArith = isIntegral || isFloat }; + enum { isFundamental = isStdFundamental || isArith }; + + typedef typename Select<isStdArith || isPointer || isMemberPointer, T, + typename Private::AddParameterType<T>::Result>::Result + ParameterType; +}; } #ifdef _MSC_VER diff --git a/shared/loki/Typelist.h b/shared/loki/Typelist.h index 6a885927..ba18032f 100644 --- a/shared/loki/Typelist.h +++ b/shared/loki/Typelist.h @@ -2,14 +2,14 @@ // The Loki Library // Copyright (c) 2001 by Andrei Alexandrescu // This code accompanies the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author or Addison-Welsey Longman make no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author or Addison-Welsey Longman make no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_TYPELIST_INC_ @@ -34,17 +34,17 @@ namespace Loki // Tail (second element, can be another typelist) //////////////////////////////////////////////////////////////////////////////// - template <class T, class U> - struct Typelist - { - typedef T Head; - typedef U Tail; - }; +template <class T, class U> +struct Typelist +{ + typedef T Head; + typedef U Tail; +}; // Typelist utility algorithms - namespace TL - { +namespace TL +{ //////////////////////////////////////////////////////////////////////////////// // class template MakeTypelist @@ -54,38 +54,38 @@ namespace Loki // returns a typelist that is of T1, T2, ... //////////////////////////////////////////////////////////////////////////////// - template - < - typename T1 = NullType, typename T2 = NullType, typename T3 = NullType, - typename T4 = NullType, typename T5 = NullType, typename T6 = NullType, - typename T7 = NullType, typename T8 = NullType, typename T9 = NullType, - typename T10 = NullType, typename T11 = NullType, typename T12 = NullType, - typename T13 = NullType, typename T14 = NullType, typename T15 = NullType, - typename T16 = NullType, typename T17 = NullType, typename T18 = NullType - > - struct MakeTypelist - { - private: - typedef typename MakeTypelist - < - T2 , T3 , T4 , - T5 , T6 , T7 , - T8 , T9 , T10, - T11, T12, T13, - T14, T15, T16, - T17, T18 - > - ::Result TailResult; - - public: - typedef Typelist<T1, TailResult> Result; - }; - - template<> - struct MakeTypelist<> - { - typedef NullType Result; - }; +template +< +typename T1 = NullType, typename T2 = NullType, typename T3 = NullType, + typename T4 = NullType, typename T5 = NullType, typename T6 = NullType, + typename T7 = NullType, typename T8 = NullType, typename T9 = NullType, + typename T10 = NullType, typename T11 = NullType, typename T12 = NullType, + typename T13 = NullType, typename T14 = NullType, typename T15 = NullType, + typename T16 = NullType, typename T17 = NullType, typename T18 = NullType + > +struct MakeTypelist +{ +private: + typedef typename MakeTypelist + < + T2 , T3 , T4 , + T5 , T6 , T7 , + T8 , T9 , T10, + T11, T12, T13, + T14, T15, T16, + T17, T18 + > + ::Result TailResult; + +public: + typedef Typelist<T1, TailResult> Result; +}; + +template<> +struct MakeTypelist<> +{ + typedef NullType Result; +}; //////////////////////////////////////////////////////////////////////////////// // class template Length @@ -96,73 +96,73 @@ namespace Loki // the end terminator (which by convention is NullType) //////////////////////////////////////////////////////////////////////////////// - template <class TList> struct Length; - template <> struct Length<NullType> - { - enum { value = 0 }; - }; - - template <class T, class U> - struct Length< Typelist<T, U> > - { - enum { value = 1 + Length<U>::value }; - }; +template <class TList> struct Length; +template <> struct Length<NullType> +{ + enum { value = 0 }; +}; + +template <class T, class U> +struct Length< Typelist<T, U> > +{ + enum { value = 1 + Length<U>::value }; +}; //////////////////////////////////////////////////////////////////////////////// // class template TypeAt // Finds the type at a given index in a typelist -// Invocation (TList is a typelist and index is a compile-time integral +// Invocation (TList is a typelist and index is a compile-time integral // constant): // TypeAt<TList, index>::Result // returns the type in position 'index' in TList // If you pass an out-of-bounds index, the result is a compile-time error //////////////////////////////////////////////////////////////////////////////// - template <class TList, unsigned int index> struct TypeAt; - - template <class Head, class Tail> - struct TypeAt<Typelist<Head, Tail>, 0> - { - typedef Head Result; - }; +template <class TList, unsigned int index> struct TypeAt; + +template <class Head, class Tail> +struct TypeAt<Typelist<Head, Tail>, 0> +{ + typedef Head Result; +}; - template <class Head, class Tail, unsigned int i> - struct TypeAt<Typelist<Head, Tail>, i> - { - typedef typename TypeAt<Tail, i - 1>::Result Result; - }; +template <class Head, class Tail, unsigned int i> +struct TypeAt<Typelist<Head, Tail>, i> +{ + typedef typename TypeAt<Tail, i - 1>::Result Result; +}; //////////////////////////////////////////////////////////////////////////////// // class template TypeAtNonStrict // Finds the type at a given index in a typelist -// Invocations (TList is a typelist and index is a compile-time integral +// Invocations (TList is a typelist and index is a compile-time integral // constant): // a) TypeAt<TList, index>::Result -// returns the type in position 'index' in TList, or NullType if index is +// returns the type in position 'index' in TList, or NullType if index is // out-of-bounds // b) TypeAt<TList, index, D>::Result // returns the type in position 'index' in TList, or D if index is out-of-bounds //////////////////////////////////////////////////////////////////////////////// - template <class TList, unsigned int index, - typename DefaultType = NullType> - struct TypeAtNonStrict - { - typedef DefaultType Result; - }; - - template <class Head, class Tail, typename DefaultType> - struct TypeAtNonStrict<Typelist<Head, Tail>, 0, DefaultType> - { - typedef Head Result; - }; - - template <class Head, class Tail, unsigned int i, typename DefaultType> - struct TypeAtNonStrict<Typelist<Head, Tail>, i, DefaultType> - { - typedef typename - TypeAtNonStrict<Tail, i - 1, DefaultType>::Result Result; - }; +template <class TList, unsigned int index, + typename DefaultType = NullType> +struct TypeAtNonStrict +{ + typedef DefaultType Result; +}; + +template <class Head, class Tail, typename DefaultType> +struct TypeAtNonStrict<Typelist<Head, Tail>, 0, DefaultType> +{ + typedef Head Result; +}; + +template <class Head, class Tail, unsigned int i, typename DefaultType> +struct TypeAtNonStrict<Typelist<Head, Tail>, i, DefaultType> +{ + typedef typename + TypeAtNonStrict<Tail, i - 1, DefaultType>::Result Result; +}; //////////////////////////////////////////////////////////////////////////////// // class template IndexOf @@ -172,28 +172,28 @@ namespace Loki // returns the position of T in TList, or NullType if T is not found in TList //////////////////////////////////////////////////////////////////////////////// - template <class TList, class T> struct IndexOf; - - template <class T> - struct IndexOf<NullType, T> - { - enum { value = -1 }; - }; - - template <class T, class Tail> - struct IndexOf<Typelist<T, Tail>, T> - { - enum { value = 0 }; - }; - - template <class Head, class Tail, class T> - struct IndexOf<Typelist<Head, Tail>, T> - { - private: - enum { temp = IndexOf<Tail, T>::value }; - public: - enum { value = (temp == -1 ? -1 : 1 + temp) }; - }; +template <class TList, class T> struct IndexOf; + +template <class T> +struct IndexOf<NullType, T> +{ + enum { value = -1 }; +}; + +template <class T, class Tail> +struct IndexOf<Typelist<T, Tail>, T> +{ + enum { value = 0 }; +}; + +template <class Head, class Tail, class T> +struct IndexOf<Typelist<Head, Tail>, T> +{ +private: + enum { temp = IndexOf<Tail, T>::value }; +public: + enum { value = (temp == -1 ? -1 : 1 + temp) }; +}; //////////////////////////////////////////////////////////////////////////////// // class template Append @@ -203,32 +203,32 @@ namespace Loki // returns a typelist that is TList followed by T and NullType-terminated //////////////////////////////////////////////////////////////////////////////// - template <class TList, class T> struct Append; - - template <> struct Append<NullType, NullType> - { - typedef NullType Result; - }; - - template <class T> struct Append<NullType, T> - { - typedef Typelist<T,NullType> Result; - }; - - template <class Head, class Tail> - struct Append<NullType, Typelist<Head, Tail> > - { - typedef Typelist<Head, Tail> Result; - }; - - template <class Head, class Tail, class T> - struct Append<Typelist<Head, Tail>, T> - { - typedef Typelist<Head, - typename Append<Tail, T>::Result> - Result; - }; - +template <class TList, class T> struct Append; + +template <> struct Append<NullType, NullType> +{ + typedef NullType Result; +}; + +template <class T> struct Append<NullType, T> +{ + typedef Typelist<T,NullType> Result; +}; + +template <class Head, class Tail> +struct Append<NullType, Typelist<Head, Tail> > +{ + typedef Typelist<Head, Tail> Result; +}; + +template <class Head, class Tail, class T> +struct Append<Typelist<Head, Tail>, T> +{ + typedef Typelist<Head, + typename Append<Tail, T>::Result> + Result; +}; + //////////////////////////////////////////////////////////////////////////////// // class template Erase // Erases the first occurence, if any, of a type in a typelist @@ -237,27 +237,27 @@ namespace Loki // returns a typelist that is TList without the first occurence of T //////////////////////////////////////////////////////////////////////////////// - template <class TList, class T> struct Erase; - - template <class T> // Specialization 1 - struct Erase<NullType, T> - { - typedef NullType Result; - }; +template <class TList, class T> struct Erase; + +template <class T> // Specialization 1 +struct Erase<NullType, T> +{ + typedef NullType Result; +}; - template <class T, class Tail> // Specialization 2 - struct Erase<Typelist<T, Tail>, T> - { - typedef Tail Result; - }; +template <class T, class Tail> // Specialization 2 +struct Erase<Typelist<T, Tail>, T> +{ + typedef Tail Result; +}; - template <class Head, class Tail, class T> // Specialization 3 - struct Erase<Typelist<Head, Tail>, T> - { - typedef Typelist<Head, - typename Erase<Tail, T>::Result> - Result; - }; +template <class Head, class Tail, class T> // Specialization 3 +struct Erase<Typelist<Head, Tail>, T> +{ + typedef Typelist<Head, + typename Erase<Tail, T>::Result> + Result; +}; //////////////////////////////////////////////////////////////////////////////// // class template EraseAll @@ -267,26 +267,26 @@ namespace Loki // returns a typelist that is TList without any occurence of T //////////////////////////////////////////////////////////////////////////////// - template <class TList, class T> struct EraseAll; - template <class T> - struct EraseAll<NullType, T> - { - typedef NullType Result; - }; - template <class T, class Tail> - struct EraseAll<Typelist<T, Tail>, T> - { - // Go all the way down the list removing the type - typedef typename EraseAll<Tail, T>::Result Result; - }; - template <class Head, class Tail, class T> - struct EraseAll<Typelist<Head, Tail>, T> - { - // Go all the way down the list removing the type - typedef Typelist<Head, - typename EraseAll<Tail, T>::Result> - Result; - }; +template <class TList, class T> struct EraseAll; +template <class T> +struct EraseAll<NullType, T> +{ + typedef NullType Result; +}; +template <class T, class Tail> +struct EraseAll<Typelist<T, Tail>, T> +{ + // Go all the way down the list removing the type + typedef typename EraseAll<Tail, T>::Result Result; +}; +template <class Head, class Tail, class T> +struct EraseAll<Typelist<Head, Tail>, T> +{ + // Go all the way down the list removing the type + typedef Typelist<Head, + typename EraseAll<Tail, T>::Result> + Result; +}; //////////////////////////////////////////////////////////////////////////////// // class template NoDuplicates @@ -295,22 +295,22 @@ namespace Loki // NoDuplicates<TList, T>::Result //////////////////////////////////////////////////////////////////////////////// - template <class TList> struct NoDuplicates; - - template <> struct NoDuplicates<NullType> - { - typedef NullType Result; - }; +template <class TList> struct NoDuplicates; + +template <> struct NoDuplicates<NullType> +{ + typedef NullType Result; +}; - template <class Head, class Tail> - struct NoDuplicates< Typelist<Head, Tail> > - { - private: - typedef typename NoDuplicates<Tail>::Result L1; - typedef typename Erase<L1, Head>::Result L2; - public: - typedef Typelist<Head, L2> Result; - }; +template <class Head, class Tail> +struct NoDuplicates< Typelist<Head, Tail> > +{ +private: + typedef typename NoDuplicates<Tail>::Result L1; + typedef typename Erase<L1, Head>::Result L2; +public: + typedef Typelist<Head, L2> Result; +}; //////////////////////////////////////////////////////////////////////////////// // class template Replace @@ -320,27 +320,27 @@ namespace Loki // returns a typelist in which the first occurence of T is replaced with U //////////////////////////////////////////////////////////////////////////////// - template <class TList, class T, class U> struct Replace; - - template <class T, class U> - struct Replace<NullType, T, U> - { - typedef NullType Result; - }; +template <class TList, class T, class U> struct Replace; - template <class T, class Tail, class U> - struct Replace<Typelist<T, Tail>, T, U> - { - typedef Typelist<U, Tail> Result; - }; +template <class T, class U> +struct Replace<NullType, T, U> +{ + typedef NullType Result; +}; + +template <class T, class Tail, class U> +struct Replace<Typelist<T, Tail>, T, U> +{ + typedef Typelist<U, Tail> Result; +}; - template <class Head, class Tail, class T, class U> - struct Replace<Typelist<Head, Tail>, T, U> - { - typedef Typelist<Head, - typename Replace<Tail, T, U>::Result> - Result; - }; +template <class Head, class Tail, class T, class U> +struct Replace<Typelist<Head, Tail>, T, U> +{ + typedef Typelist<Head, + typename Replace<Tail, T, U>::Result> + Result; +}; //////////////////////////////////////////////////////////////////////////////// // class template ReplaceAll @@ -350,27 +350,27 @@ namespace Loki // returns a typelist in which all occurences of T is replaced with U //////////////////////////////////////////////////////////////////////////////// - template <class TList, class T, class U> struct ReplaceAll; - - template <class T, class U> - struct ReplaceAll<NullType, T, U> - { - typedef NullType Result; - }; - - template <class T, class Tail, class U> - struct ReplaceAll<Typelist<T, Tail>, T, U> - { - typedef Typelist<U, typename ReplaceAll<Tail, T, U>::Result> Result; - }; - - template <class Head, class Tail, class T, class U> - struct ReplaceAll<Typelist<Head, Tail>, T, U> - { - typedef Typelist<Head, - typename ReplaceAll<Tail, T, U>::Result> - Result; - }; +template <class TList, class T, class U> struct ReplaceAll; + +template <class T, class U> +struct ReplaceAll<NullType, T, U> +{ + typedef NullType Result; +}; + +template <class T, class Tail, class U> +struct ReplaceAll<Typelist<T, Tail>, T, U> +{ + typedef Typelist<U, typename ReplaceAll<Tail, T, U>::Result> Result; +}; + +template <class Head, class Tail, class T, class U> +struct ReplaceAll<Typelist<Head, Tail>, T, U> +{ + typedef Typelist<Head, + typename ReplaceAll<Tail, T, U>::Result> + Result; +}; //////////////////////////////////////////////////////////////////////////////// // class template Reverse @@ -380,20 +380,20 @@ namespace Loki // returns a typelist that is TList reversed //////////////////////////////////////////////////////////////////////////////// - template <class TList> struct Reverse; - - template <> - struct Reverse<NullType> - { - typedef NullType Result; - }; - - template <class Head, class Tail> - struct Reverse< Typelist<Head, Tail> > - { - typedef typename Append< - typename Reverse<Tail>::Result, Head>::Result Result; - }; +template <class TList> struct Reverse; + +template <> +struct Reverse<NullType> +{ + typedef NullType Result; +}; + +template <class Head, class Tail> +struct Reverse< Typelist<Head, Tail> > +{ + typedef typename Append< + typename Reverse<Tail>::Result, Head>::Result Result; +}; //////////////////////////////////////////////////////////////////////////////// // class template MostDerived @@ -403,55 +403,55 @@ namespace Loki // returns the type in TList that's the most derived from T //////////////////////////////////////////////////////////////////////////////// - template <class TList, class T> struct MostDerived; - - template <class T> - struct MostDerived<NullType, T> - { - typedef T Result; - }; - - template <class Head, class Tail, class T> - struct MostDerived<Typelist<Head, Tail>, T> - { - private: - typedef typename MostDerived<Tail, T>::Result Candidate; - public: - typedef typename Select< - SuperSubclass<Candidate,Head>::value, - Head, Candidate>::Result Result; - }; +template <class TList, class T> struct MostDerived; + +template <class T> +struct MostDerived<NullType, T> +{ + typedef T Result; +}; + +template <class Head, class Tail, class T> +struct MostDerived<Typelist<Head, Tail>, T> +{ +private: + typedef typename MostDerived<Tail, T>::Result Candidate; +public: + typedef typename Select< + SuperSubclass<Candidate,Head>::value, + Head, Candidate>::Result Result; +}; //////////////////////////////////////////////////////////////////////////////// // class template DerivedToFront // Arranges the types in a typelist so that the most derived types appear first // Invocation (TList is a typelist): // DerivedToFront<TList>::Result -// returns the reordered TList -//////////////////////////////////////////////////////////////////////////////// - - template <class TList> struct DerivedToFront; - - template <> - struct DerivedToFront<NullType> - { - typedef NullType Result; - }; - - template <class Head, class Tail> - struct DerivedToFront< Typelist<Head, Tail> > - { - private: - typedef typename MostDerived<Tail, Head>::Result - TheMostDerived; - typedef typename Replace<Tail, - TheMostDerived, Head>::Result Temp; - typedef typename DerivedToFront<Temp>::Result L; - public: - typedef Typelist<TheMostDerived, L> Result; - }; - - } // namespace TL +// returns the reordered TList +//////////////////////////////////////////////////////////////////////////////// + +template <class TList> struct DerivedToFront; + +template <> +struct DerivedToFront<NullType> +{ + typedef NullType Result; +}; + +template <class Head, class Tail> +struct DerivedToFront< Typelist<Head, Tail> > +{ +private: + typedef typename MostDerived<Tail, Head>::Result + TheMostDerived; + typedef typename Replace<Tail, + TheMostDerived, Head>::Result Temp; + typedef typename DerivedToFront<Temp>::Result L; +public: + typedef Typelist<TheMostDerived, L> Result; +}; + +} // namespace TL } // namespace Loki diff --git a/shared/loki/TypelistMacros.h b/shared/loki/TypelistMacros.h index 6c14b348..1c3c3e63 100644 --- a/shared/loki/TypelistMacros.h +++ b/shared/loki/TypelistMacros.h @@ -2,14 +2,14 @@ // The Loki Library // Copyright (c) 2001 by Andrei Alexandrescu // This code accompanies the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author or Addison-Welsey Longman make no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author or Addison-Welsey Longman make no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_TYPELISTMACROS_INC_ @@ -24,7 +24,7 @@ //////////////////////////////////////////////////////////////////////////////// // macros LOKI_TYPELIST_1, LOKI_TYPELIST_2, ... LOKI_TYPELIST_50 // Each takes a number of arguments equal to its numeric suffix -// The arguments are type names. LOKI_TYPELIST_NN generates a typelist containing +// The arguments are type names. LOKI_TYPELIST_NN generates a typelist containing // all types passed as arguments, in that order. // Example: LOKI_TYPELIST_2(char, int) generates a type containing char and int. //////////////////////////////////////////////////////////////////////////////// diff --git a/shared/loki/Visitor.h b/shared/loki/Visitor.h index 4425a9fa..f6b0ad81 100644 --- a/shared/loki/Visitor.h +++ b/shared/loki/Visitor.h @@ -2,14 +2,14 @@ // The Loki Library // Copyright (c) 2001 by Andrei Alexandrescu // This code accompanies the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author or Addison-Wesley Longman make no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author or Addison-Wesley Longman make no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_VISITOR_INC_ @@ -28,17 +28,17 @@ namespace Loki //////////////////////////////////////////////////////////////////////////////// /// \class BaseVisitor -/// +/// /// \ingroup VisitorGroup /// The base class of any Acyclic Visitor //////////////////////////////////////////////////////////////////////////////// - class BaseVisitor - { - public: - virtual ~BaseVisitor() {} - }; - +class BaseVisitor +{ +public: + virtual ~BaseVisitor() {} +}; + //////////////////////////////////////////////////////////////////////////////// /// \class Visitor /// @@ -48,7 +48,7 @@ namespace Loki /// \par Usage /// /// Defining the visitable class: -/// +/// /// \code /// class RasterBitmap : public BaseVisitable<> /// { @@ -59,7 +59,7 @@ namespace Loki /// /// Way 1 to define a visitor: /// \code -/// class SomeVisitor : +/// class SomeVisitor : /// public BaseVisitor // required /// public Visitor<RasterBitmap>, /// public Visitor<Paragraph> @@ -72,7 +72,7 @@ namespace Loki /// /// Way 2 to define the visitor: /// \code -/// class SomeVisitor : +/// class SomeVisitor : /// public BaseVisitor // required /// public Visitor<LOKI_TYPELIST_2(RasterBitmap, Paragraph)> /// { @@ -84,7 +84,7 @@ namespace Loki /// /// Way 3 to define the visitor: /// \code -/// class SomeVisitor : +/// class SomeVisitor : /// public BaseVisitor // required /// public Visitor<Seq<RasterBitmap, Paragraph>::Type> /// { @@ -97,7 +97,7 @@ namespace Loki /// \par Using const visit functions: /// /// Defining the visitable class (true for const): -/// +/// /// \code /// class RasterBitmap : public BaseVisitable<void, DefaultCatchAll, true> /// { @@ -108,7 +108,7 @@ namespace Loki /// /// Defining the visitor which only calls const member functions: /// \code -/// class SomeVisitor : +/// class SomeVisitor : /// public BaseVisitor // required /// public Visitor<RasterBitmap, void, true>, /// { @@ -119,38 +119,38 @@ namespace Loki /// /// \par Example: /// -/// test/Visitor/main.cpp +/// test/Visitor/main.cpp //////////////////////////////////////////////////////////////////////////////// - template <class T, typename R = void, bool ConstVisit = false> - class Visitor; +template <class T, typename R = void, bool ConstVisit = false> +class Visitor; - template <class T, typename R> - class Visitor<T, R, false> - { - public: - typedef R ReturnType; - typedef T ParamType; - virtual ~Visitor() {} - virtual ReturnType Visit(ParamType&) = 0; - }; - - template <class T, typename R> - class Visitor<T, R, true> - { - public: - typedef R ReturnType; - typedef const T ParamType; - virtual ~Visitor() {} - virtual ReturnType Visit(ParamType&) = 0; - }; +template <class T, typename R> +class Visitor<T, R, false> +{ +public: + typedef R ReturnType; + typedef T ParamType; + virtual ~Visitor() {} + virtual ReturnType Visit(ParamType&) = 0; +}; + +template <class T, typename R> +class Visitor<T, R, true> +{ +public: + typedef R ReturnType; + typedef const T ParamType; + virtual ~Visitor() {} + virtual ReturnType Visit(ParamType&) = 0; +}; //////////////////////////////////////////////////////////////////////////////// // class template Visitor (specialization) // This specialization is not present in the book. It makes it easier to define // Visitors for multiple types in a shot by using a typelist. Example: // -// class SomeVisitor : +// class SomeVisitor : // public BaseVisitor // required // public Visitor<LOKI_TYPELIST_2(RasterBitmap, Paragraph)> // { @@ -160,41 +160,41 @@ namespace Loki // }; //////////////////////////////////////////////////////////////////////////////// - template <class Head, class Tail, typename R> - class Visitor<Typelist<Head, Tail>, R, false> - : public Visitor<Head, R, false>, public Visitor<Tail, R, false> - { - public: - typedef R ReturnType; - // using Visitor<Head, R>::Visit; - // using Visitor<Tail, R>::Visit; - }; - - template <class Head, typename R> - class Visitor<Typelist<Head, NullType>, R, false> : public Visitor<Head, R, false> - { - public: - typedef R ReturnType; - using Visitor<Head, R, false>::Visit; - }; - - template <class Head, class Tail, typename R> - class Visitor<Typelist<Head, Tail>, R, true> - : public Visitor<Head, R, true>, public Visitor<Tail, R, true> - { - public: - typedef R ReturnType; - // using Visitor<Head, R>::Visit; - // using Visitor<Tail, R>::Visit; - }; - - template <class Head, typename R> - class Visitor<Typelist<Head, NullType>, R, true> : public Visitor<Head, R, true> - { - public: - typedef R ReturnType; - using Visitor<Head, R, true>::Visit; - }; +template <class Head, class Tail, typename R> +class Visitor<Typelist<Head, Tail>, R, false> + : public Visitor<Head, R, false>, public Visitor<Tail, R, false> +{ +public: + typedef R ReturnType; + // using Visitor<Head, R>::Visit; + // using Visitor<Tail, R>::Visit; +}; + +template <class Head, typename R> +class Visitor<Typelist<Head, NullType>, R, false> : public Visitor<Head, R, false> +{ +public: + typedef R ReturnType; + using Visitor<Head, R, false>::Visit; +}; + +template <class Head, class Tail, typename R> +class Visitor<Typelist<Head, Tail>, R, true> + : public Visitor<Head, R, true>, public Visitor<Tail, R, true> +{ +public: + typedef R ReturnType; + // using Visitor<Head, R>::Visit; + // using Visitor<Tail, R>::Visit; +}; + +template <class Head, typename R> +class Visitor<Typelist<Head, NullType>, R, true> : public Visitor<Head, R, true> +{ +public: + typedef R ReturnType; + using Visitor<Head, R, true>::Visit; +}; //////////////////////////////////////////////////////////////////////////////// @@ -203,29 +203,29 @@ namespace Loki // functions) //////////////////////////////////////////////////////////////////////////////// - template <class TList, typename R = void> class BaseVisitorImpl; +template <class TList, typename R = void> class BaseVisitorImpl; + +template <class Head, class Tail, typename R> +class BaseVisitorImpl<Typelist<Head, Tail>, R> + : public Visitor<Head, R> + , public BaseVisitorImpl<Tail, R> +{ +public: + // using BaseVisitorImpl<Tail, R>::Visit; + + virtual R Visit(Head&) + { return R(); } +}; + +template <class Head, typename R> +class BaseVisitorImpl<Typelist<Head, NullType>, R> + : public Visitor<Head, R> +{ +public: + virtual R Visit(Head&) + { return R(); } +}; - template <class Head, class Tail, typename R> - class BaseVisitorImpl<Typelist<Head, Tail>, R> - : public Visitor<Head, R> - , public BaseVisitorImpl<Tail, R> - { - public: - // using BaseVisitorImpl<Tail, R>::Visit; - - virtual R Visit(Head&) - { return R(); } - }; - - template <class Head, typename R> - class BaseVisitorImpl<Typelist<Head, NullType>, R> - : public Visitor<Head, R> - { - public: - virtual R Visit(Head&) - { return R(); } - }; - //////////////////////////////////////////////////////////////////////////////// // class template BaseVisitable //////////////////////////////////////////////////////////////////////////////// @@ -241,61 +241,61 @@ struct DefaultCatchAll // class template BaseVisitable //////////////////////////////////////////////////////////////////////////////// - template - < - typename R = void, - template <typename, class> class CatchAll = DefaultCatchAll, - bool ConstVisitable = false - > - class BaseVisitable; +template +< +typename R = void, + template <typename, class> class CatchAll = DefaultCatchAll, + bool ConstVisitable = false + > +class BaseVisitable; - template<typename R,template <typename, class> class CatchAll> - class BaseVisitable<R, CatchAll, false> +template<typename R,template <typename, class> class CatchAll> +class BaseVisitable<R, CatchAll, false> +{ +public: + typedef R ReturnType; + virtual ~BaseVisitable() {} + virtual ReturnType Accept(BaseVisitor&) = 0; + +protected: // give access only to the hierarchy + template <class T> + static ReturnType AcceptImpl(T& visited, BaseVisitor& guest) { - public: - typedef R ReturnType; - virtual ~BaseVisitable() {} - virtual ReturnType Accept(BaseVisitor&) = 0; - - protected: // give access only to the hierarchy - template <class T> - static ReturnType AcceptImpl(T& visited, BaseVisitor& guest) + // Apply the Acyclic Visitor + if (Visitor<T,R>* p = dynamic_cast<Visitor<T,R>*>(&guest)) { - // Apply the Acyclic Visitor - if (Visitor<T,R>* p = dynamic_cast<Visitor<T,R>*>(&guest)) - { - return p->Visit(visited); - } - return CatchAll<R, T>::OnUnknownVisitor(visited, guest); + return p->Visit(visited); } - }; + return CatchAll<R, T>::OnUnknownVisitor(visited, guest); + } +}; - template<typename R,template <typename, class> class CatchAll> - class BaseVisitable<R, CatchAll, true> +template<typename R,template <typename, class> class CatchAll> +class BaseVisitable<R, CatchAll, true> +{ +public: + typedef R ReturnType; + virtual ~BaseVisitable() {} + virtual ReturnType Accept(BaseVisitor&) const = 0; + +protected: // give access only to the hierarchy + template <class T> + static ReturnType AcceptImpl(const T& visited, BaseVisitor& guest) { - public: - typedef R ReturnType; - virtual ~BaseVisitable() {} - virtual ReturnType Accept(BaseVisitor&) const = 0; - - protected: // give access only to the hierarchy - template <class T> - static ReturnType AcceptImpl(const T& visited, BaseVisitor& guest) + // Apply the Acyclic Visitor + if (Visitor<T,R,true>* p = dynamic_cast<Visitor<T,R,true>*>(&guest)) { - // Apply the Acyclic Visitor - if (Visitor<T,R,true>* p = dynamic_cast<Visitor<T,R,true>*>(&guest)) - { - return p->Visit(visited); - } - return CatchAll<R, T>::OnUnknownVisitor(const_cast<T&>(visited), guest); + return p->Visit(visited); } - }; + return CatchAll<R, T>::OnUnknownVisitor(const_cast<T&>(visited), guest); + } +}; //////////////////////////////////////////////////////////////////////////////// /// \def LOKI_DEFINE_VISITABLE() /// \ingroup VisitorGroup -/// Put it in every class that you want to make visitable +/// Put it in every class that you want to make visitable /// (in addition to deriving it from BaseVisitable<R>) //////////////////////////////////////////////////////////////////////////////// @@ -306,7 +306,7 @@ struct DefaultCatchAll //////////////////////////////////////////////////////////////////////////////// /// \def LOKI_DEFINE_CONST_VISITABLE() /// \ingroup VisitorGroup -/// Put it in every class that you want to make visitable by const member +/// Put it in every class that you want to make visitable by const member /// functions (in addition to deriving it from BaseVisitable<R>) //////////////////////////////////////////////////////////////////////////////// @@ -318,25 +318,25 @@ struct DefaultCatchAll /// \class CyclicVisitor /// /// \ingroup VisitorGroup -/// Put it in every class that you want to make visitable (in addition to +/// Put it in every class that you want to make visitable (in addition to /// deriving it from BaseVisitable<R> //////////////////////////////////////////////////////////////////////////////// - template <typename R, class TList> - class CyclicVisitor : public Visitor<TList, R> +template <typename R, class TList> +class CyclicVisitor : public Visitor<TList, R> +{ +public: + typedef R ReturnType; + // using Visitor<TList, R>::Visit; + + template <class Visited> + ReturnType GenericVisit(Visited& host) { - public: - typedef R ReturnType; - // using Visitor<TList, R>::Visit; - - template <class Visited> - ReturnType GenericVisit(Visited& host) - { - Visitor<Visited, ReturnType>& subObj = *this; - return subObj.Visit(host); - } - }; - + Visitor<Visited, ReturnType>& subObj = *this; + return subObj.Visit(host); + } +}; + //////////////////////////////////////////////////////////////////////////////// /// \def LOKI_DEFINE_CYCLIC_VISITABLE(SomeVisitor) /// \ingroup VisitorGroup diff --git a/shared/loki/static_check.h b/shared/loki/static_check.h index 51ce389e..b4c455c9 100644 --- a/shared/loki/static_check.h +++ b/shared/loki/static_check.h @@ -2,14 +2,14 @@ // The Loki Library // Copyright (c) 2001 by Andrei Alexandrescu // This code accompanies the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author or Addison-Wesley Longman make no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author or Addison-Wesley Longman make no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_STATIC_CHECK_INC_ @@ -24,8 +24,8 @@ namespace Loki // Helper structure for the STATIC_CHECK macro //////////////////////////////////////////////////////////////////////////////// - template<int> struct CompileTimeError; - template<> struct CompileTimeError<true> {}; +template<int> struct CompileTimeError; +template<> struct CompileTimeError<true> {}; } //////////////////////////////////////////////////////////////////////////////// @@ -38,7 +38,7 @@ namespace Loki //////////////////////////////////////////////////////////////////////////////// #define LOKI_STATIC_CHECK(expr, msg) \ - { Loki::CompileTimeError<((expr) != 0)> ERROR_##msg; (void)ERROR_##msg; } + { Loki::CompileTimeError<((expr) != 0)> ERROR_##msg; (void)ERROR_##msg; } #endif // end file guardian diff --git a/shared/long_path_prefix.cpp b/shared/long_path_prefix.cpp index 3fb0703d..dc249283 100644 --- a/shared/long_path_prefix.cpp +++ b/shared/long_path_prefix.cpp @@ -16,8 +16,8 @@ template <size_t max_path> inline Zstring applyLongPathPrefixImpl(const Zstring& path) { - if ( path.length() >= max_path && //maximum allowed path length without prefix is (MAX_PATH - 1) - !path.StartsWith(LONG_PATH_PREFIX)) + if (path.length() >= max_path && //maximum allowed path length without prefix is (MAX_PATH - 1) + !path.StartsWith(LONG_PATH_PREFIX)) { if (path.StartsWith(Zstr("\\\\"))) //UNC-name, e.g. \\zenju-pc\Users return LONG_PATH_PREFIX_UNC + path.AfterFirst(Zchar('\\')); //convert to \\?\UNC\zenju-pc\Users @@ -47,12 +47,10 @@ Zstring ffs3::removeLongPathPrefix(const Zstring& path) //throw() { if (path.StartsWith(LONG_PATH_PREFIX)) { - Zstring finalPath = path; if (path.StartsWith(LONG_PATH_PREFIX_UNC)) //UNC-name - finalPath.Replace(LONG_PATH_PREFIX_UNC, Zstr("\\"), false); + return Zstring(path).Replace(LONG_PATH_PREFIX_UNC, Zstr("\\"), false); else - finalPath.Replace(LONG_PATH_PREFIX, Zstr(""), false); - return finalPath; + return Zstring(path).Replace(LONG_PATH_PREFIX, Zstr(""), false); } //fallback diff --git a/ui/mouse_move_dlg.cpp b/shared/mouse_move_dlg.cpp index abaa7ead..abaa7ead 100644 --- a/ui/mouse_move_dlg.cpp +++ b/shared/mouse_move_dlg.cpp diff --git a/ui/mouse_move_dlg.h b/shared/mouse_move_dlg.h index ccdf6c01..ccdf6c01 100644 --- a/ui/mouse_move_dlg.h +++ b/shared/mouse_move_dlg.h diff --git a/shared/perf.h b/shared/perf.h index 4f955748..1ad4650d 100644 --- a/shared/perf.h +++ b/shared/perf.h @@ -7,22 +7,34 @@ #ifndef DEBUG_PERF_HEADER #define DEBUG_PERF_HEADER +#include <sstream> //#define WIN32_LEAN_AND_MEAN -> not in a header +/* +#include <windows.h> +#undef max +#undef min +*/ #include <wx/msw/wrapwin.h> //includes "windows.h" -#include <sstream> + #ifdef __MINGW32__ - #define DEPRECATED(x) x __attribute__ ((deprecated)) +#define DEPRECATED(x) x __attribute__ ((deprecated)) #elif defined _MSC_VER - #define DEPRECATED(x) __declspec(deprecated) x +#define DEPRECATED(x) __declspec(deprecated) x #endif -class Performance +class CpuTimer { public: - DEPRECATED(Performance()) : resultWasShown(false), startTime(::GetTickCount()) {} + class TimerError {}; - ~Performance() + DEPRECATED(CpuTimer()) : resultWasShown(false), startTime(), frequency() + { + if (!::QueryPerformanceFrequency(&frequency)) throw TimerError(); + if (!::QueryPerformanceCounter (&startTime)) throw TimerError(); + } + + ~CpuTimer() { if (!resultWasShown) showResult(); @@ -30,23 +42,27 @@ public: void showResult() { - const DWORD delta = ::GetTickCount() - startTime; + LARGE_INTEGER currentTime = {}; + if (!::QueryPerformanceCounter(¤tTime)) throw TimerError(); + + const long delta = 1000.0 * (currentTime.QuadPart - startTime.QuadPart) / frequency.QuadPart; std::ostringstream ss; ss << delta << " ms"; - + ::MessageBoxA(NULL, ss.str().c_str(), "Timer", 0); resultWasShown = true; - startTime = ::GetTickCount(); //don't include call to MessageBox()! + if (!::QueryPerformanceCounter(&startTime)) throw TimerError(); //don't include call to MessageBox()! } - + private: bool resultWasShown; - DWORD startTime; + LARGE_INTEGER startTime; + LARGE_INTEGER frequency; }; //two macros for quick performance measurements -#define PERF_START Performance a; -#define PERF_STOP a.showResult(); +#define PERF_START CpuTimer perfTest; +#define PERF_STOP perfTest.showResult(); -#endif //DEBUG_PERF_HEADER
\ No newline at end of file +#endif //DEBUG_PERF_HEADER diff --git a/shared/privilege.cpp b/shared/privilege.cpp index 16f9d385..00eb2855 100644 --- a/shared/privilege.cpp +++ b/shared/privilege.cpp @@ -1,7 +1,8 @@ #include "privilege.h" #include <wx/intl.h> #include "system_func.h" -#include <boost/shared_ptr.hpp> +//#include <boost/shared_ptr.hpp> +#include "loki/ScopeGuard.h" using namespace ffs3; @@ -23,19 +24,21 @@ bool Privileges::privilegeIsActive(LPCTSTR privilege) //throw FileError() const wxString errorMessage = wxString(_("Error setting privilege:")) + wxT(" \"") + privilege + wxT("\"") + wxT("\n\n"); throw FileError(errorMessage + ffs3::getLastErrorFormatted()); } - boost::shared_ptr<void> dummy(hToken, ::CloseHandle); + Loki::ScopeGuard dummy = Loki::MakeGuard(::CloseHandle, hToken); + (void)dummy; //silence warning "unused variable" - LUID luid = {0}; + + LUID luid = {}; if (!::LookupPrivilegeValue( - NULL, //__in_opt LPCTSTR lpSystemName, - privilege, //__in LPCTSTR lpName, - &luid )) //__out PLUID lpLuid + NULL, //__in_opt LPCTSTR lpSystemName, + privilege, //__in LPCTSTR lpName, + &luid )) //__out PLUID lpLuid { const wxString errorMessage = wxString(_("Error setting privilege:")) + wxT(" \"") + privilege + wxT("\"") + wxT("\n\n"); throw FileError(errorMessage + ffs3::getLastErrorFormatted()); } - PRIVILEGE_SET priv = {0}; + PRIVILEGE_SET priv = {}; priv.PrivilegeCount = 1; priv.Control = PRIVILEGE_SET_ALL_NECESSARY; priv.Privilege[0].Luid = luid; @@ -43,9 +46,9 @@ bool Privileges::privilegeIsActive(LPCTSTR privilege) //throw FileError() BOOL alreadyGranted = FALSE; if (!::PrivilegeCheck( - hToken, //__in HANDLE ClientToken, - &priv, //__inout PPRIVILEGE_SET RequiredPrivileges, - &alreadyGranted)) //__out LPBOOL pfResult + hToken, //__in HANDLE ClientToken, + &priv, //__inout PPRIVILEGE_SET RequiredPrivileges, + &alreadyGranted)) //__out LPBOOL pfResult { const wxString errorMessage = wxString(_("Error setting privilege:")) + wxT(" \"") + privilege + wxT("\"") + wxT("\n\n"); throw FileError(errorMessage + ffs3::getLastErrorFormatted()); @@ -65,30 +68,31 @@ void Privileges::setPrivilege(LPCTSTR privilege, bool enable) //throw FileError( const wxString errorMessage = wxString(_("Error setting privilege:")) + wxT(" \"") + privilege + wxT("\"") + wxT("\n\n"); throw FileError(errorMessage + ffs3::getLastErrorFormatted()); } - boost::shared_ptr<void> dummy(hToken, ::CloseHandle); + Loki::ScopeGuard dummy = Loki::MakeGuard(::CloseHandle, hToken); + (void)dummy; //silence warning "unused variable" - LUID luid = {0}; + LUID luid = {}; if (!::LookupPrivilegeValue( - NULL, //__in_opt LPCTSTR lpSystemName, - privilege, //__in LPCTSTR lpName, - &luid )) //__out PLUID lpLuid + NULL, //__in_opt LPCTSTR lpSystemName, + privilege, //__in LPCTSTR lpName, + &luid )) //__out PLUID lpLuid { const wxString errorMessage = wxString(_("Error setting privilege:")) + wxT(" \"") + privilege + wxT("\"") + wxT("\n\n"); throw FileError(errorMessage + ffs3::getLastErrorFormatted()); } - TOKEN_PRIVILEGES tp = {0}; + TOKEN_PRIVILEGES tp = {}; tp.PrivilegeCount = 1; tp.Privileges[0].Luid = luid; tp.Privileges[0].Attributes = enable ? SE_PRIVILEGE_ENABLED : 0; if (!::AdjustTokenPrivileges( - hToken, //__in HANDLE TokenHandle, - false, //__in BOOL DisableAllPrivileges, - &tp, //__in_opt PTOKEN_PRIVILEGES NewState, - 0, //__in DWORD BufferLength, - NULL, //__out_opt PTOKEN_PRIVILEGES PreviousState, - NULL)) //__out_opt PDWORD ReturnLength + hToken, //__in HANDLE TokenHandle, + false, //__in BOOL DisableAllPrivileges, + &tp, //__in_opt PTOKEN_PRIVILEGES NewState, + 0, //__in DWORD BufferLength, + NULL, //__out_opt PTOKEN_PRIVILEGES PreviousState, + NULL)) //__out_opt PDWORD ReturnLength { const wxString errorMessage = wxString(_("Error setting privilege:")) + wxT(" \"") + privilege + wxT("\"") + wxT("\n\n"); throw FileError(errorMessage + ffs3::getLastErrorFormatted()); diff --git a/shared/recycler.cpp b/shared/recycler.cpp index 4a0d7290..4e9ce9a3 100644 --- a/shared/recycler.cpp +++ b/shared/recycler.cpp @@ -101,9 +101,9 @@ void moveToWindowsRecycler(const std::vector<Zstring>& filesToDelete) //throw ( wxString(_("Could not load a required DLL:")) + wxT(" \"") + getRecyclerDllName().c_str() + wxT("\"")); //#warning moving long file paths to recycler does not work! clarify! -// std::vector<Zstring> temp; -// std::transform(filesToDelete.begin(), filesToDelete.end(), -// std::back_inserter(temp), std::ptr_fun(ffs3::removeLongPathPrefix)); //::IFileOperation() can't handle \\?\-prefix! + // std::vector<Zstring> temp; + // std::transform(filesToDelete.begin(), filesToDelete.end(), + // std::back_inserter(temp), std::ptr_fun(ffs3::removeLongPathPrefix)); //::IFileOperation() can't handle \\?\-prefix! if (!moveToRecycler(&fileNames[0], //array must not be empty fileNames.size())) @@ -126,7 +126,7 @@ void moveToWindowsRecycler(const std::vector<Zstring>& filesToDelete) //throw ( filenameDoubleNull += Zchar(0); } - SHFILEOPSTRUCT fileOp; + SHFILEOPSTRUCT fileOp = {}; fileOp.hwnd = NULL; fileOp.wFunc = FO_DELETE; fileOp.pFrom = filenameDoubleNull.c_str(); diff --git a/shared/shadow.cpp b/shared/shadow.cpp index 5a70bb6e..9dab1494 100644 --- a/shared/shadow.cpp +++ b/shared/shadow.cpp @@ -105,8 +105,8 @@ public: releaseShadowCopy = util::getDllFun<ReleaseShadowCopyFct>(getShadowDllName(), releaseShadowCopyFctName); //check if shadow copy dll was loaded correctly - if ( createShadowCopy == NULL || - releaseShadowCopy == NULL) + if (createShadowCopy == NULL || + releaseShadowCopy == NULL) throw FileError(wxString(_("Error starting Volume Shadow Copy Service!")) + wxT("\n") + _("Could not load a required DLL:") + wxT(" \"") + getShadowDllName().c_str() + wxT("\"")); @@ -117,18 +117,18 @@ public: throw FileError(wxString(_("Error starting Volume Shadow Copy Service!")) + wxT("\n") + _("Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit version.")); -//--------------------------------------------------------------------------------------------------------- + //--------------------------------------------------------------------------------------------------------- //start shadow volume copy service: wchar_t shadowVolName[1000]; wchar_t errorMessage[1000]; if (!createShadowCopy( - volumeNameFormatted.c_str(), - shadowVolName, - 1000, - &backupHandle, - errorMessage, - 1000)) + volumeNameFormatted.c_str(), + shadowVolName, + 1000, + &backupHandle, + errorMessage, + 1000)) throw FileError(wxString(_("Error starting Volume Shadow Copy Service!")) + wxT("\n") + wxT("(") + errorMessage + wxT(" Volume: \"") + volumeNameFormatted.c_str() + wxT("\")")); diff --git a/shared/symlink_target.h b/shared/symlink_target.h index 358f2913..6dec85a0 100644 --- a/shared/symlink_target.h +++ b/shared/symlink_target.h @@ -7,7 +7,7 @@ #ifndef SYMLINK_WIN_H_INCLUDED #define SYMLINK_WIN_H_INCLUDED -#include <boost/shared_ptr.hpp> +#include "loki/ScopeGuard.h" #include <boost/scoped_array.hpp> #include "system_func.h" #include <wx/intl.h> @@ -67,9 +67,9 @@ Zstring getSymlinkRawTargetString(const Zstring& linkPath) //throw (FileError) using ffs3::zToWx; using ffs3::FileError; #ifdef FFS_WIN -//FSCTL_GET_REPARSE_POINT: http://msdn.microsoft.com/en-us/library/aa364571(VS.85).aspx + //FSCTL_GET_REPARSE_POINT: http://msdn.microsoft.com/en-us/library/aa364571(VS.85).aspx - try //setting privileges requires admin rights! This shall not cause an error in user mode! + try //reading certain symlinks requires admin rights! This shall not cause an error in user mode! { //allow access to certain symbolic links/junctions ffs3::Privileges::getInstance().ensureActive(SE_BACKUP_NAME); //throw FileError() @@ -88,7 +88,8 @@ Zstring getSymlinkRawTargetString(const Zstring& linkPath) //throw (FileError) wxString errorMessage = wxString(_("Error resolving symbolic link:")) + wxT("\n\"") + ffs3::zToWx(linkPath) + wxT("\""); throw FileError(errorMessage + wxT("\n\n") + ffs3::getLastErrorFormatted()); } - boost::shared_ptr<void> dummy(hLink, ::CloseHandle); + Loki::ScopeGuard dummy = Loki::MakeGuard(::CloseHandle, hLink); + (void)dummy; //silence warning "unused variable" //respect alignment issues... const size_t bufferSize = REPARSE_DATA_BUFFER_HEADER_SIZE + MAXIMUM_REPARSE_DATA_BUFFER_SIZE; diff --git a/shared/taskbar.cpp b/shared/taskbar.cpp index 881a1570..5767f8c9 100644 --- a/shared/taskbar.cpp +++ b/shared/taskbar.cpp @@ -73,21 +73,21 @@ public: TaskBarStatus tbSevenStatus = tbseven::STATUS_NORMAL; switch (status) { - case TaskbarProgress::STATUS_NOPROGRESS: - tbSevenStatus = tbseven::STATUS_NOPROGRESS; - break; - case TaskbarProgress::STATUS_INDETERMINATE: - tbSevenStatus = tbseven::STATUS_INDETERMINATE; - break; - case TaskbarProgress::STATUS_NORMAL: - tbSevenStatus = tbseven::STATUS_NORMAL; - break; - case TaskbarProgress::STATUS_ERROR: - tbSevenStatus = tbseven::STATUS_ERROR; - break; - case TaskbarProgress::STATUS_PAUSED: - tbSevenStatus = tbseven::STATUS_PAUSED; - break; + case TaskbarProgress::STATUS_NOPROGRESS: + tbSevenStatus = tbseven::STATUS_NOPROGRESS; + break; + case TaskbarProgress::STATUS_INDETERMINATE: + tbSevenStatus = tbseven::STATUS_INDETERMINATE; + break; + case TaskbarProgress::STATUS_NORMAL: + tbSevenStatus = tbseven::STATUS_NORMAL; + break; + case TaskbarProgress::STATUS_ERROR: + tbSevenStatus = tbseven::STATUS_ERROR; + break; + case TaskbarProgress::STATUS_PAUSED: + tbSevenStatus = tbseven::STATUS_PAUSED; + break; } setStatus_(assocWindow, tbSevenStatus); diff --git a/shared/tinyxml/tinystr.cpp b/shared/tinyxml/tinystr.cpp index 2b9b5467..86377ad1 100644 --- a/shared/tinyxml/tinystr.cpp +++ b/shared/tinyxml/tinystr.cpp @@ -83,7 +83,7 @@ TiXmlString& TiXmlString::append(const char* str, size_type len) } -TiXmlString operator + (const TiXmlString & a, const TiXmlString & b) +TiXmlString operator + (const TiXmlString& a, const TiXmlString& b) { TiXmlString tmp; tmp.reserve(a.length() + b.length()); @@ -92,7 +92,7 @@ TiXmlString operator + (const TiXmlString & a, const TiXmlString & b) return tmp; } -TiXmlString operator + (const TiXmlString & a, const char* b) +TiXmlString operator + (const TiXmlString& a, const char* b) { TiXmlString tmp; TiXmlString::size_type b_len = static_cast<TiXmlString::size_type>( strlen(b) ); @@ -102,7 +102,7 @@ TiXmlString operator + (const TiXmlString & a, const char* b) return tmp; } -TiXmlString operator + (const char* a, const TiXmlString & b) +TiXmlString operator + (const char* a, const TiXmlString& b) { TiXmlString tmp; TiXmlString::size_type a_len = static_cast<TiXmlString::size_type>( strlen(a) ); diff --git a/shared/tinyxml/tinystr.h b/shared/tinyxml/tinystr.h index 3c2aa9d5..b11407a4 100644 --- a/shared/tinyxml/tinystr.h +++ b/shared/tinyxml/tinystr.h @@ -47,13 +47,13 @@ distribution. used. Be nice to old compilers and macro it here: */ #if defined(_MSC_VER) && (_MSC_VER >= 1200 ) - // Microsoft visual studio, version 6 and higher. - #define TIXML_EXPLICIT explicit +// Microsoft visual studio, version 6 and higher. +#define TIXML_EXPLICIT explicit #elif defined(__GNUC__) && (__GNUC__ >= 3 ) - // GCC version 3 and higher.s - #define TIXML_EXPLICIT explicit +// GCC version 3 and higher.s +#define TIXML_EXPLICIT explicit #else - #define TIXML_EXPLICIT +#define TIXML_EXPLICIT #endif @@ -66,229 +66,229 @@ distribution. */ class TiXmlString { - public : - // The size type used - typedef size_t size_type; - - // Error value for find primitive - static const size_type npos; // = -1; - - - // TiXmlString empty constructor - TiXmlString () : rep_(&nullrep_) - { - } - - // TiXmlString copy constructor - TiXmlString ( const TiXmlString & copy) : rep_(0) - { - init(copy.length()); - memcpy(start(), copy.data(), length()); - } - - // TiXmlString constructor, based on a string - TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0) - { - init( static_cast<size_type>( strlen(copy) )); - memcpy(start(), copy, length()); - } - - // TiXmlString constructor, based on a string - TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0) - { - init(len); - memcpy(start(), str, len); - } - - // TiXmlString destructor - ~TiXmlString () - { - quit(); - } - - // = operator - TiXmlString& operator = (const char * copy) - { - return assign( copy, (size_type)strlen(copy)); - } - - // = operator - TiXmlString& operator = (const TiXmlString & copy) - { - return assign(copy.start(), copy.length()); - } - - - // += operator. Maps to append - TiXmlString& operator += (const char * suffix) - { - return append(suffix, static_cast<size_type>( strlen(suffix) )); - } - - // += operator. Maps to append - TiXmlString& operator += (char single) - { - return append(&single, 1); - } - - // += operator. Maps to append - TiXmlString& operator += (const TiXmlString & suffix) - { - return append(suffix.data(), suffix.length()); - } - - - // Convert a TiXmlString into a null-terminated char * - const char * c_str () const { return rep_->str; } - - // Convert a TiXmlString into a char * (need not be null terminated). - const char * data () const { return rep_->str; } - - // Return the length of a TiXmlString - size_type length () const { return rep_->size; } - - // Alias for length() - size_type size () const { return rep_->size; } - - // Checks if a TiXmlString is empty - bool empty () const { return rep_->size == 0; } - - // Return capacity of string - size_type capacity () const { return rep_->capacity; } - - - // single char extraction - const char& at (size_type index) const - { - assert( index < length() ); - return rep_->str[ index ]; - } - - // [] operator - char& operator [] (size_type index) const - { - assert( index < length() ); - return rep_->str[ index ]; - } - - // find a char in a string. Return TiXmlString::npos if not found - size_type find (char lookup) const - { - return find(lookup, 0); - } - - // find a char in a string from an offset. Return TiXmlString::npos if not found - size_type find (char tofind, size_type offset) const - { - if (offset >= length()) return npos; - - for (const char* p = c_str() + offset; *p != '\0'; ++p) - { - if (*p == tofind) return static_cast< size_type >( p - c_str() ); - } - return npos; - } - - void clear () - { - //Lee: - //The original was just too strange, though correct: - // TiXmlString().swap(*this); - //Instead use the quit & re-init: - quit(); - init(0,0); - } - - /* Function to reserve a big amount of data when we know we'll need it. Be aware that this - function DOES NOT clear the content of the TiXmlString if any exists. - */ - void reserve (size_type cap); - - TiXmlString& assign (const char* str, size_type len); - - TiXmlString& append (const char* str, size_type len); - - void swap (TiXmlString& other) - { - Rep* r = rep_; - rep_ = other.rep_; - other.rep_ = r; - } - - private: - - void init(size_type sz) { init(sz, sz); } - void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; } - char* start() const { return rep_->str; } - char* finish() const { return rep_->str + rep_->size; } - - struct Rep - { - size_type size, capacity; - char str[1]; - }; - - void init(size_type sz, size_type cap) - { - if (cap) - { - // Lee: the original form: - // rep_ = static_cast<Rep*>(operator new(sizeof(Rep) + cap)); - // doesn't work in some cases of new being overloaded. Switching - // to the normal allocation, although use an 'int' for systems - // that are overly picky about structure alignment. - const size_type bytesNeeded = sizeof(Rep) + cap; - const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int ); - rep_ = reinterpret_cast<Rep*>( new int[ intsNeeded ] ); - - rep_->str[ rep_->size = sz ] = '\0'; - rep_->capacity = cap; - } - else - { - rep_ = &nullrep_; - } - } - - void quit() - { - if (rep_ != &nullrep_) - { - // The rep_ is really an array of ints. (see the allocator, above). - // Cast it back before delete, so the compiler won't incorrectly call destructors. - delete [] ( reinterpret_cast<int*>( rep_ ) ); - } - } - - Rep * rep_; - static Rep nullrep_; +public : + // The size type used + typedef size_t size_type; + + // Error value for find primitive + static const size_type npos; // = -1; + + + // TiXmlString empty constructor + TiXmlString () : rep_(&nullrep_) + { + } + + // TiXmlString copy constructor + TiXmlString ( const TiXmlString& copy) : rep_(0) + { + init(copy.length()); + memcpy(start(), copy.data(), length()); + } + + // TiXmlString constructor, based on a string + TIXML_EXPLICIT TiXmlString ( const char* copy) : rep_(0) + { + init( static_cast<size_type>( strlen(copy) )); + memcpy(start(), copy, length()); + } + + // TiXmlString constructor, based on a string + TIXML_EXPLICIT TiXmlString ( const char* str, size_type len) : rep_(0) + { + init(len); + memcpy(start(), str, len); + } + + // TiXmlString destructor + ~TiXmlString () + { + quit(); + } + + // = operator + TiXmlString& operator = (const char* copy) + { + return assign( copy, (size_type)strlen(copy)); + } + + // = operator + TiXmlString& operator = (const TiXmlString& copy) + { + return assign(copy.start(), copy.length()); + } + + + // += operator. Maps to append + TiXmlString& operator += (const char* suffix) + { + return append(suffix, static_cast<size_type>( strlen(suffix) )); + } + + // += operator. Maps to append + TiXmlString& operator += (char single) + { + return append(&single, 1); + } + + // += operator. Maps to append + TiXmlString& operator += (const TiXmlString& suffix) + { + return append(suffix.data(), suffix.length()); + } + + + // Convert a TiXmlString into a null-terminated char * + const char* c_str () const { return rep_->str; } + + // Convert a TiXmlString into a char * (need not be null terminated). + const char* data () const { return rep_->str; } + + // Return the length of a TiXmlString + size_type length () const { return rep_->size; } + + // Alias for length() + size_type size () const { return rep_->size; } + + // Checks if a TiXmlString is empty + bool empty () const { return rep_->size == 0; } + + // Return capacity of string + size_type capacity () const { return rep_->capacity; } + + + // single char extraction + const char& at (size_type index) const + { + assert( index < length() ); + return rep_->str[ index ]; + } + + // [] operator + char& operator [] (size_type index) const + { + assert( index < length() ); + return rep_->str[ index ]; + } + + // find a char in a string. Return TiXmlString::npos if not found + size_type find (char lookup) const + { + return find(lookup, 0); + } + + // find a char in a string from an offset. Return TiXmlString::npos if not found + size_type find (char tofind, size_type offset) const + { + if (offset >= length()) return npos; + + for (const char* p = c_str() + offset; *p != '\0'; ++p) + { + if (*p == tofind) return static_cast< size_type >( p - c_str() ); + } + return npos; + } + + void clear () + { + //Lee: + //The original was just too strange, though correct: + // TiXmlString().swap(*this); + //Instead use the quit & re-init: + quit(); + init(0,0); + } + + /* Function to reserve a big amount of data when we know we'll need it. Be aware that this + function DOES NOT clear the content of the TiXmlString if any exists. + */ + void reserve (size_type cap); + + TiXmlString& assign (const char* str, size_type len); + + TiXmlString& append (const char* str, size_type len); + + void swap (TiXmlString& other) + { + Rep* r = rep_; + rep_ = other.rep_; + other.rep_ = r; + } + +private: + + void init(size_type sz) { init(sz, sz); } + void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; } + char* start() const { return rep_->str; } + char* finish() const { return rep_->str + rep_->size; } + + struct Rep + { + size_type size, capacity; + char str[1]; + }; + + void init(size_type sz, size_type cap) + { + if (cap) + { + // Lee: the original form: + // rep_ = static_cast<Rep*>(operator new(sizeof(Rep) + cap)); + // doesn't work in some cases of new being overloaded. Switching + // to the normal allocation, although use an 'int' for systems + // that are overly picky about structure alignment. + const size_type bytesNeeded = sizeof(Rep) + cap; + const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int ); + rep_ = reinterpret_cast<Rep*>( new int[ intsNeeded ] ); + + rep_->str[ rep_->size = sz ] = '\0'; + rep_->capacity = cap; + } + else + { + rep_ = &nullrep_; + } + } + + void quit() + { + if (rep_ != &nullrep_) + { + // The rep_ is really an array of ints. (see the allocator, above). + // Cast it back before delete, so the compiler won't incorrectly call destructors. + delete [] ( reinterpret_cast<int*>( rep_ ) ); + } + } + + Rep* rep_; + static Rep nullrep_; } ; -inline bool operator == (const TiXmlString & a, const TiXmlString & b) +inline bool operator == (const TiXmlString& a, const TiXmlString& b) { - return ( a.length() == b.length() ) // optimization on some platforms - && ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare + return ( a.length() == b.length() ) // optimization on some platforms + && ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare } -inline bool operator < (const TiXmlString & a, const TiXmlString & b) +inline bool operator < (const TiXmlString& a, const TiXmlString& b) { - return strcmp(a.c_str(), b.c_str()) < 0; + return strcmp(a.c_str(), b.c_str()) < 0; } -inline bool operator != (const TiXmlString & a, const TiXmlString & b) { return !(a == b); } -inline bool operator > (const TiXmlString & a, const TiXmlString & b) { return b < a; } -inline bool operator <= (const TiXmlString & a, const TiXmlString & b) { return !(b < a); } -inline bool operator >= (const TiXmlString & a, const TiXmlString & b) { return !(a < b); } +inline bool operator != (const TiXmlString& a, const TiXmlString& b) { return !(a == b); } +inline bool operator > (const TiXmlString& a, const TiXmlString& b) { return b < a; } +inline bool operator <= (const TiXmlString& a, const TiXmlString& b) { return !(b < a); } +inline bool operator >= (const TiXmlString& a, const TiXmlString& b) { return !(a < b); } -inline bool operator == (const TiXmlString & a, const char* b) { return strcmp(a.c_str(), b) == 0; } -inline bool operator == (const char* a, const TiXmlString & b) { return b == a; } -inline bool operator != (const TiXmlString & a, const char* b) { return !(a == b); } -inline bool operator != (const char* a, const TiXmlString & b) { return !(b == a); } +inline bool operator == (const TiXmlString& a, const char* b) { return strcmp(a.c_str(), b) == 0; } +inline bool operator == (const char* a, const TiXmlString& b) { return b == a; } +inline bool operator != (const TiXmlString& a, const char* b) { return !(a == b); } +inline bool operator != (const char* a, const TiXmlString& b) { return !(b == a); } -TiXmlString operator + (const TiXmlString & a, const TiXmlString & b); -TiXmlString operator + (const TiXmlString & a, const char* b); -TiXmlString operator + (const char* a, const TiXmlString & b); +TiXmlString operator + (const TiXmlString& a, const TiXmlString& b); +TiXmlString operator + (const TiXmlString& a, const char* b); +TiXmlString operator + (const char* a, const TiXmlString& b); /* @@ -299,19 +299,19 @@ class TiXmlOutStream : public TiXmlString { public : - // TiXmlOutStream << operator. - TiXmlOutStream & operator << (const TiXmlString & in) - { - *this += in; - return *this; - } - - // TiXmlOutStream << operator. - TiXmlOutStream & operator << (const char * in) - { - *this += in; - return *this; - } + // TiXmlOutStream << operator. + TiXmlOutStream& operator << (const TiXmlString& in) + { + *this += in; + return *this; + } + + // TiXmlOutStream << operator. + TiXmlOutStream& operator << (const char* in) + { + *this += in; + return *this; + } } ; diff --git a/shared/tinyxml/tinyxml.cpp b/shared/tinyxml/tinyxml.cpp index 9a13c32b..2b8f17a8 100644 --- a/shared/tinyxml/tinyxml.cpp +++ b/shared/tinyxml/tinyxml.cpp @@ -57,10 +57,10 @@ void TiXmlBase::EncodeString( const TIXML_STRING& str, TIXML_STRING* outString ) { unsigned char c = (unsigned char) str[i]; - if ( c == '&' - && i < ( (int)str.length() - 2 ) - && str[i+1] == '#' - && str[i+2] == 'x' ) + if (c == '&' + && i < ( (int)str.length() - 2 ) + && str[i+1] == '#' + && str[i+2] == 'x' ) { // Hexadecimal character reference. // Pass through unchanged. @@ -358,7 +358,7 @@ bool TiXmlNode::RemoveChild( TiXmlNode* removeThis ) return true; } -const TiXmlNode* TiXmlNode::FirstChild( const char * _value ) const +const TiXmlNode* TiXmlNode::FirstChild( const char* _value ) const { const TiXmlNode* node; for ( node = firstChild; node; node = node->next ) @@ -370,7 +370,7 @@ const TiXmlNode* TiXmlNode::FirstChild( const char * _value ) const } -const TiXmlNode* TiXmlNode::LastChild( const char * _value ) const +const TiXmlNode* TiXmlNode::LastChild( const char* _value ) const { const TiXmlNode* node; for ( node = lastChild; node; node = node->prev ) @@ -396,7 +396,7 @@ const TiXmlNode* TiXmlNode::IterateChildren( const TiXmlNode* previous ) const } -const TiXmlNode* TiXmlNode::IterateChildren( const char * val, const TiXmlNode* previous ) const +const TiXmlNode* TiXmlNode::IterateChildren( const char* val, const TiXmlNode* previous ) const { if ( !previous ) { @@ -410,7 +410,7 @@ const TiXmlNode* TiXmlNode::IterateChildren( const char * val, const TiXmlNode* } -const TiXmlNode* TiXmlNode::NextSibling( const char * _value ) const +const TiXmlNode* TiXmlNode::NextSibling( const char* _value ) const { const TiXmlNode* node; for ( node = next; node; node = node->next ) @@ -422,7 +422,7 @@ const TiXmlNode* TiXmlNode::NextSibling( const char * _value ) const } -const TiXmlNode* TiXmlNode::PreviousSibling( const char * _value ) const +const TiXmlNode* TiXmlNode::PreviousSibling( const char* _value ) const { const TiXmlNode* node; for ( node = prev; node; node = node->prev ) @@ -434,7 +434,7 @@ const TiXmlNode* TiXmlNode::PreviousSibling( const char * _value ) const } -void TiXmlElement::RemoveAttribute( const char * name ) +void TiXmlElement::RemoveAttribute( const char* name ) { #ifdef TIXML_USE_STL TIXML_STRING str( name ); @@ -464,7 +464,7 @@ const TiXmlElement* TiXmlNode::FirstChildElement() const } -const TiXmlElement* TiXmlNode::FirstChildElement( const char * _value ) const +const TiXmlElement* TiXmlNode::FirstChildElement( const char* _value ) const { const TiXmlNode* node; @@ -494,7 +494,7 @@ const TiXmlElement* TiXmlNode::NextSiblingElement() const } -const TiXmlElement* TiXmlNode::NextSiblingElement( const char * _value ) const +const TiXmlElement* TiXmlNode::NextSiblingElement( const char* _value ) const { const TiXmlNode* node; @@ -522,7 +522,7 @@ const TiXmlDocument* TiXmlNode::GetDocument() const } -TiXmlElement::TiXmlElement (const char * _value) +TiXmlElement::TiXmlElement (const char* _value) : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) { firstChild = lastChild = 0; @@ -705,7 +705,7 @@ int TiXmlElement::QueryDoubleAttribute( const std::string& name, double* dval ) #endif -void TiXmlElement::SetAttribute( const char * name, int val ) +void TiXmlElement::SetAttribute( const char* name, int val ) { TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); if ( attrib ) @@ -727,7 +727,7 @@ void TiXmlElement::SetAttribute( const std::string& name, int val ) #endif -void TiXmlElement::SetDoubleAttribute( const char * name, double val ) +void TiXmlElement::SetDoubleAttribute( const char* name, double val ) { TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); if ( attrib ) @@ -749,7 +749,7 @@ void TiXmlElement::SetDoubleAttribute( const std::string& name, double val ) #endif -void TiXmlElement::SetAttribute( const char * cname, const char * cvalue ) +void TiXmlElement::SetAttribute( const char* cname, const char* cvalue ) { TiXmlAttribute* attrib = attributeSet.FindOrCreate( cname ); if ( attrib ) @@ -895,7 +895,7 @@ TiXmlDocument::TiXmlDocument() : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) ClearError(); } -TiXmlDocument::TiXmlDocument( const char * documentName ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) +TiXmlDocument::TiXmlDocument( const char* documentName ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) { tabsize = 4; useMicrosoftBOM = false; @@ -1063,7 +1063,7 @@ bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding ) } -bool TiXmlDocument::SaveFile( const char * filename ) const +bool TiXmlDocument::SaveFile( const char* filename ) const { // The old c stuff lives on... FILE* fp = TiXmlFOpen( filename, "w" ); @@ -1370,9 +1370,9 @@ TiXmlNode* TiXmlText::Clone() const } -TiXmlDeclaration::TiXmlDeclaration( const char * _version, - const char * _encoding, - const char * _standalone ) +TiXmlDeclaration::TiXmlDeclaration( const char* _version, + const char* _encoding, + const char* _standalone ) : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) { version = _version; @@ -1606,7 +1606,7 @@ TiXmlAttribute* TiXmlAttributeSet::FindOrCreate( const char* _name ) #ifdef TIXML_USE_STL -std::istream& operator>> (std::istream & in, TiXmlNode & base) +std::istream& operator>> (std::istream& in, TiXmlNode& base) { TIXML_STRING tag; tag.reserve( 8 * 1000 ); @@ -1619,7 +1619,7 @@ std::istream& operator>> (std::istream & in, TiXmlNode & base) #ifdef TIXML_USE_STL -std::ostream& operator<< (std::ostream & out, const TiXmlNode & base) +std::ostream& operator<< (std::ostream& out, const TiXmlNode& base) { TiXmlPrinter printer; printer.SetStreamPrinting(); @@ -1654,7 +1654,7 @@ TiXmlHandle TiXmlHandle::FirstChild() const } -TiXmlHandle TiXmlHandle::FirstChild( const char * value ) const +TiXmlHandle TiXmlHandle::FirstChild( const char* value ) const { if ( node ) { @@ -1678,7 +1678,7 @@ TiXmlHandle TiXmlHandle::FirstChildElement() const } -TiXmlHandle TiXmlHandle::FirstChildElement( const char * value ) const +TiXmlHandle TiXmlHandle::FirstChildElement( const char* value ) const { if ( node ) { @@ -1796,9 +1796,9 @@ bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute else { buffer += ">"; - if ( element.FirstChild()->ToText() - && element.LastChild() == element.FirstChild() - && element.FirstChild()->ToText()->CDATA() == false ) + if (element.FirstChild()->ToText() + && element.LastChild() == element.FirstChild() + && element.FirstChild()->ToText()->CDATA() == false ) { simpleTextPrint = true; // no DoLineBreak()! diff --git a/shared/tinyxml/tinyxml.h b/shared/tinyxml/tinyxml.h index 01822911..226415c9 100644 --- a/shared/tinyxml/tinyxml.h +++ b/shared/tinyxml/tinyxml.h @@ -44,13 +44,13 @@ distribution. #endif #ifdef TIXML_USE_STL - #include <string> - #include <iostream> - #include <sstream> - #define TIXML_STRING std::string +#include <string> +#include <iostream> +#include <sstream> +#define TIXML_STRING std::string #else - #include "tinystr.h" - #define TIXML_STRING TiXmlString +#include "tinystr.h" +#define TIXML_STRING TiXmlString #endif // Deprecated library function hell. Compilers want to use the @@ -60,25 +60,25 @@ distribution. #define TIXML_SAFE #ifdef TIXML_SAFE - #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) - // Microsoft visual studio, version 2005 and higher. - #define TIXML_SNPRINTF _snprintf_s - #define TIXML_SSCANF sscanf_s - #elif defined(_MSC_VER) && (_MSC_VER >= 1200 ) - // Microsoft visual studio, version 6 and higher. - //#pragma message( "Using _sn* functions." ) - #define TIXML_SNPRINTF _snprintf - #define TIXML_SSCANF sscanf - #elif defined(__GNUC__) && (__GNUC__ >= 3 ) - // GCC version 3 and higher.s - //#warning( "Using sn* functions." ) - #define TIXML_SNPRINTF snprintf - #define TIXML_SSCANF sscanf - #else - #define TIXML_SNPRINTF snprintf - #define TIXML_SSCANF sscanf - #endif -#endif +#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) +// Microsoft visual studio, version 2005 and higher. +#define TIXML_SNPRINTF _snprintf_s +#define TIXML_SSCANF sscanf_s +#elif defined(_MSC_VER) && (_MSC_VER >= 1200 ) +// Microsoft visual studio, version 6 and higher. +//#pragma message( "Using _sn* functions." ) +#define TIXML_SNPRINTF _snprintf +#define TIXML_SSCANF sscanf +#elif defined(__GNUC__) && (__GNUC__ >= 3 ) +// GCC version 3 and higher.s +//#warning( "Using sn* functions." ) +#define TIXML_SNPRINTF snprintf +#define TIXML_SSCANF sscanf +#else +#define TIXML_SNPRINTF snprintf +#define TIXML_SSCANF sscanf +#endif +#endif class TiXmlDocument; class TiXmlElement; @@ -93,16 +93,16 @@ const int TIXML_MAJOR_VERSION = 2; const int TIXML_MINOR_VERSION = 6; const int TIXML_PATCH_VERSION = 1; -/* Internal structure for tracking location of items +/* Internal structure for tracking location of items in the XML file. */ struct TiXmlCursor { - TiXmlCursor() { Clear(); } - void Clear() { row = col = -1; } + TiXmlCursor() { Clear(); } + void Clear() { row = col = -1; } - int row; // 0 based. - int col; // 0 based. + int row; // 0 based. + int col; // 0 based. }; @@ -116,7 +116,7 @@ struct TiXmlCursor If you return 'true' from a Visit method, recursive parsing will continue. If you return false, <b>no children of this node or its sibilings</b> will be Visited. - All flavors of Visit methods have a default implementation that returns 'true' (continue + All flavors of Visit methods have a default implementation that returns 'true' (continue visiting). You need to only override methods that are interesting to you. Generally Accept() is called on the TiXmlDocument, although all nodes suppert Visiting. @@ -128,43 +128,43 @@ struct TiXmlCursor class TiXmlVisitor { public: - virtual ~TiXmlVisitor() {} - - /// Visit a document. - virtual bool VisitEnter( const TiXmlDocument& /*doc*/ ) { return true; } - /// Visit a document. - virtual bool VisitExit( const TiXmlDocument& /*doc*/ ) { return true; } - - /// Visit an element. - virtual bool VisitEnter( const TiXmlElement& /*element*/, const TiXmlAttribute* /*firstAttribute*/ ) { return true; } - /// Visit an element. - virtual bool VisitExit( const TiXmlElement& /*element*/ ) { return true; } - - /// Visit a declaration - virtual bool Visit( const TiXmlDeclaration& /*declaration*/ ) { return true; } - /// Visit a text node - virtual bool Visit( const TiXmlText& /*text*/ ) { return true; } - /// Visit a comment node - virtual bool Visit( const TiXmlComment& /*comment*/ ) { return true; } - /// Visit an unknow node - virtual bool Visit( const TiXmlUnknown& /*unknown*/ ) { return true; } + virtual ~TiXmlVisitor() {} + + /// Visit a document. + virtual bool VisitEnter( const TiXmlDocument& /*doc*/ ) { return true; } + /// Visit a document. + virtual bool VisitExit( const TiXmlDocument& /*doc*/ ) { return true; } + + /// Visit an element. + virtual bool VisitEnter( const TiXmlElement& /*element*/, const TiXmlAttribute* /*firstAttribute*/ ) { return true; } + /// Visit an element. + virtual bool VisitExit( const TiXmlElement& /*element*/ ) { return true; } + + /// Visit a declaration + virtual bool Visit( const TiXmlDeclaration& /*declaration*/ ) { return true; } + /// Visit a text node + virtual bool Visit( const TiXmlText& /*text*/ ) { return true; } + /// Visit a comment node + virtual bool Visit( const TiXmlComment& /*comment*/ ) { return true; } + /// Visit an unknow node + virtual bool Visit( const TiXmlUnknown& /*unknown*/ ) { return true; } }; // Only used by Attribute::Query functions -enum -{ - TIXML_SUCCESS, - TIXML_NO_ATTRIBUTE, - TIXML_WRONG_TYPE +enum +{ + TIXML_SUCCESS, + TIXML_NO_ATTRIBUTE, + TIXML_WRONG_TYPE }; // Used by the parsing routines. enum TiXmlEncoding { - TIXML_ENCODING_UNKNOWN, - TIXML_ENCODING_UTF8, - TIXML_ENCODING_LEGACY + TIXML_ENCODING_UNKNOWN, + TIXML_ENCODING_UTF8, + TIXML_ENCODING_LEGACY }; const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN; @@ -193,224 +193,225 @@ const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN; */ class TiXmlBase { - friend class TiXmlNode; - friend class TiXmlElement; - friend class TiXmlDocument; + friend class TiXmlNode; + friend class TiXmlElement; + friend class TiXmlDocument; public: - TiXmlBase() : userData(0) {} - virtual ~TiXmlBase() {} - - /** All TinyXml classes can print themselves to a filestream - or the string class (TiXmlString in non-STL mode, std::string - in STL mode.) Either or both cfile and str can be null. - - This is a formatted print, and will insert - tabs and newlines. - - (For an unformatted stream, use the << operator.) - */ - virtual void Print( FILE* cfile, int depth ) const = 0; - - /** The world does not agree on whether white space should be kept or - not. In order to make everyone happy, these global, static functions - are provided to set whether or not TinyXml will condense all white space - into a single space or not. The default is to condense. Note changing this - value is not thread safe. - */ - static void SetCondenseWhiteSpace( bool condense ) { condenseWhiteSpace = condense; } - - /// Return the current white space setting. - static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; } - - /** Return the position, in the original source file, of this node or attribute. - The row and column are 1-based. (That is the first row and first column is - 1,1). If the returns values are 0 or less, then the parser does not have - a row and column value. - - Generally, the row and column value will be set when the TiXmlDocument::Load(), - TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is called. It will NOT be set - when the DOM was created from operator>>. - - The values reflect the initial load. Once the DOM is modified programmatically - (by adding or changing nodes and attributes) the new values will NOT update to - reflect changes in the document. - - There is a minor performance cost to computing the row and column. Computation - can be disabled if TiXmlDocument::SetTabSize() is called with 0 as the value. - - @sa TiXmlDocument::SetTabSize() - */ - int Row() const { return location.row + 1; } - int Column() const { return location.col + 1; } ///< See Row() - - void SetUserData( void* user ) { userData = user; } ///< Set a pointer to arbitrary user data. - void* GetUserData() { return userData; } ///< Get a pointer to arbitrary user data. - const void* GetUserData() const { return userData; } ///< Get a pointer to arbitrary user data. - - // Table that returs, for a given lead byte, the total number of bytes - // in the UTF-8 sequence. - static const int utf8ByteTable[256]; - - virtual const char* Parse( const char* p, - TiXmlParsingData* data, - TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0; - - /** Expands entities in a string. Note this should not contian the tag's '<', '>', etc, - or they will be transformed into entities! - */ - static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out ); - - enum - { - TIXML_NO_ERROR = 0, - TIXML_ERROR, - TIXML_ERROR_OPENING_FILE, - TIXML_ERROR_PARSING_ELEMENT, - TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, - TIXML_ERROR_READING_ELEMENT_VALUE, - TIXML_ERROR_READING_ATTRIBUTES, - TIXML_ERROR_PARSING_EMPTY, - TIXML_ERROR_READING_END_TAG, - TIXML_ERROR_PARSING_UNKNOWN, - TIXML_ERROR_PARSING_COMMENT, - TIXML_ERROR_PARSING_DECLARATION, - TIXML_ERROR_DOCUMENT_EMPTY, - TIXML_ERROR_EMBEDDED_NULL, - TIXML_ERROR_PARSING_CDATA, - TIXML_ERROR_DOCUMENT_TOP_ONLY, - - TIXML_ERROR_STRING_COUNT - }; + TiXmlBase() : userData(0) {} + virtual ~TiXmlBase() {} + + /** All TinyXml classes can print themselves to a filestream + or the string class (TiXmlString in non-STL mode, std::string + in STL mode.) Either or both cfile and str can be null. + + This is a formatted print, and will insert + tabs and newlines. + + (For an unformatted stream, use the << operator.) + */ + virtual void Print( FILE* cfile, int depth ) const = 0; + + /** The world does not agree on whether white space should be kept or + not. In order to make everyone happy, these global, static functions + are provided to set whether or not TinyXml will condense all white space + into a single space or not. The default is to condense. Note changing this + value is not thread safe. + */ + static void SetCondenseWhiteSpace( bool condense ) { condenseWhiteSpace = condense; } + + /// Return the current white space setting. + static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; } + + /** Return the position, in the original source file, of this node or attribute. + The row and column are 1-based. (That is the first row and first column is + 1,1). If the returns values are 0 or less, then the parser does not have + a row and column value. + + Generally, the row and column value will be set when the TiXmlDocument::Load(), + TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is called. It will NOT be set + when the DOM was created from operator>>. + + The values reflect the initial load. Once the DOM is modified programmatically + (by adding or changing nodes and attributes) the new values will NOT update to + reflect changes in the document. + + There is a minor performance cost to computing the row and column. Computation + can be disabled if TiXmlDocument::SetTabSize() is called with 0 as the value. + + @sa TiXmlDocument::SetTabSize() + */ + int Row() const { return location.row + 1; } + int Column() const { return location.col + 1; } ///< See Row() + + void SetUserData( void* user ) { userData = user; } ///< Set a pointer to arbitrary user data. + void* GetUserData() { return userData; } ///< Get a pointer to arbitrary user data. + const void* GetUserData() const { return userData; } ///< Get a pointer to arbitrary user data. + + // Table that returs, for a given lead byte, the total number of bytes + // in the UTF-8 sequence. + static const int utf8ByteTable[256]; + + virtual const char* Parse( const char* p, + TiXmlParsingData* data, + TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0; + + /** Expands entities in a string. Note this should not contian the tag's '<', '>', etc, + or they will be transformed into entities! + */ + static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out ); + + enum + { + TIXML_NO_ERROR = 0, + TIXML_ERROR, + TIXML_ERROR_OPENING_FILE, + TIXML_ERROR_PARSING_ELEMENT, + TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, + TIXML_ERROR_READING_ELEMENT_VALUE, + TIXML_ERROR_READING_ATTRIBUTES, + TIXML_ERROR_PARSING_EMPTY, + TIXML_ERROR_READING_END_TAG, + TIXML_ERROR_PARSING_UNKNOWN, + TIXML_ERROR_PARSING_COMMENT, + TIXML_ERROR_PARSING_DECLARATION, + TIXML_ERROR_DOCUMENT_EMPTY, + TIXML_ERROR_EMBEDDED_NULL, + TIXML_ERROR_PARSING_CDATA, + TIXML_ERROR_DOCUMENT_TOP_ONLY, + + TIXML_ERROR_STRING_COUNT + }; protected: - static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding ); + static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding ); - inline static bool IsWhiteSpace( char c ) - { - return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); - } - inline static bool IsWhiteSpace( int c ) - { - if ( c < 256 ) - return IsWhiteSpace( (char) c ); - return false; // Again, only truly correct for English/Latin...but usually works. - } + inline static bool IsWhiteSpace( char c ) + { + return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); + } + inline static bool IsWhiteSpace( int c ) + { + if ( c < 256 ) + return IsWhiteSpace( (char) c ); + return false; // Again, only truly correct for English/Latin...but usually works. + } - #ifdef TIXML_USE_STL - static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag ); - static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag ); - #endif - - /* Reads an XML name into the string provided. Returns - a pointer just past the last character of the name, - or 0 if the function has an error. - */ - static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding ); - - /* Reads text. Returns a pointer past the given end tag. - Wickedly complex options, but it keeps the (sensitive) code in one place. - */ - static const char* ReadText( const char* in, // where to start - TIXML_STRING* text, // the string read - bool ignoreWhiteSpace, // whether to keep the white space - const char* endTag, // what ends this text - bool ignoreCase, // whether to ignore case in the end tag - TiXmlEncoding encoding ); // the current encoding - - // If an entity has been found, transform it into a character. - static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding ); - - // Get a character, while interpreting entities. - // The length can be from 0 to 4 bytes. - inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding ) - { - assert( p ); - if ( encoding == TIXML_ENCODING_UTF8 ) - { - *length = utf8ByteTable[ *((const unsigned char*)p) ]; - assert( *length >= 0 && *length < 5 ); - } - else - { - *length = 1; - } - - if ( *length == 1 ) - { - if ( *p == '&' ) - return GetEntity( p, _value, length, encoding ); - *_value = *p; - return p+1; - } - else if ( *length ) - { - //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe), - // and the null terminator isn't needed - for( int i=0; p[i] && i<*length; ++i ) { - _value[i] = p[i]; - } - return p + (*length); - } - else - { - // Not valid text. - return 0; - } - } - - // Return true if the next characters in the stream are any of the endTag sequences. - // Ignore case only works for english, and should only be relied on when comparing - // to English words: StringEqual( p, "version", true ) is fine. - static bool StringEqual( const char* p, - const char* endTag, - bool ignoreCase, - TiXmlEncoding encoding ); - - static const char* errorString[ TIXML_ERROR_STRING_COUNT ]; +#ifdef TIXML_USE_STL + static bool StreamWhiteSpace( std::istream* in, TIXML_STRING* tag ); + static bool StreamTo( std::istream* in, int character, TIXML_STRING* tag ); +#endif - TiXmlCursor location; + /* Reads an XML name into the string provided. Returns + a pointer just past the last character of the name, + or 0 if the function has an error. + */ + static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding ); + + /* Reads text. Returns a pointer past the given end tag. + Wickedly complex options, but it keeps the (sensitive) code in one place. + */ + static const char* ReadText( const char* in, // where to start + TIXML_STRING* text, // the string read + bool ignoreWhiteSpace, // whether to keep the white space + const char* endTag, // what ends this text + bool ignoreCase, // whether to ignore case in the end tag + TiXmlEncoding encoding ); // the current encoding + + // If an entity has been found, transform it into a character. + static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding ); + + // Get a character, while interpreting entities. + // The length can be from 0 to 4 bytes. + inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding ) + { + assert( p ); + if ( encoding == TIXML_ENCODING_UTF8 ) + { + *length = utf8ByteTable[ *((const unsigned char*)p) ]; + assert( *length >= 0 && *length < 5 ); + } + else + { + *length = 1; + } + + if ( *length == 1 ) + { + if ( *p == '&' ) + return GetEntity( p, _value, length, encoding ); + *_value = *p; + return p+1; + } + else if ( *length ) + { + //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe), + // and the null terminator isn't needed + for( int i=0; p[i] && i<*length; ++i ) + { + _value[i] = p[i]; + } + return p + (*length); + } + else + { + // Not valid text. + return 0; + } + } + + // Return true if the next characters in the stream are any of the endTag sequences. + // Ignore case only works for english, and should only be relied on when comparing + // to English words: StringEqual( p, "version", true ) is fine. + static bool StringEqual( const char* p, + const char* endTag, + bool ignoreCase, + TiXmlEncoding encoding ); + + static const char* errorString[ TIXML_ERROR_STRING_COUNT ]; + + TiXmlCursor location; /// Field containing a generic user pointer - void* userData; - - // None of these methods are reliable for any language except English. - // Good for approximation, not great for accuracy. - static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding ); - static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding ); - inline static int ToLower( int v, TiXmlEncoding encoding ) - { - if ( encoding == TIXML_ENCODING_UTF8 ) - { - if ( v < 128 ) return tolower( v ); - return v; - } - else - { - return tolower( v ); - } - } - static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ); + void* userData; + + // None of these methods are reliable for any language except English. + // Good for approximation, not great for accuracy. + static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding ); + static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding ); + inline static int ToLower( int v, TiXmlEncoding encoding ) + { + if ( encoding == TIXML_ENCODING_UTF8 ) + { + if ( v < 128 ) return tolower( v ); + return v; + } + else + { + return tolower( v ); + } + } + static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ); private: - TiXmlBase( const TiXmlBase& ); // not implemented. - void operator=( const TiXmlBase& base ); // not allowed. - - struct Entity - { - const char* str; - unsigned int strLength; - char chr; - }; - enum - { - NUM_ENTITY = 5, - MAX_ENTITY_LENGTH = 6 - - }; - static Entity entity[ NUM_ENTITY ]; - static bool condenseWhiteSpace; + TiXmlBase( const TiXmlBase& ); // not implemented. + void operator=( const TiXmlBase& base ); // not allowed. + + struct Entity + { + const char* str; + unsigned int strLength; + char chr; + }; + enum + { + NUM_ENTITY = 5, + MAX_ENTITY_LENGTH = 6 + + }; + static Entity entity[ NUM_ENTITY ]; + static bool condenseWhiteSpace; }; @@ -422,350 +423,361 @@ private: */ class TiXmlNode : public TiXmlBase { - friend class TiXmlDocument; - friend class TiXmlElement; + friend class TiXmlDocument; + friend class TiXmlElement; public: - #ifdef TIXML_USE_STL - - /** An input stream operator, for every class. Tolerant of newlines and - formatting, but doesn't expect them. - */ - friend std::istream& operator >> (std::istream& in, TiXmlNode& base); - - /** An output stream operator, for every class. Note that this outputs - without any newlines or formatting, as opposed to Print(), which - includes tabs and new lines. - - The operator<< and operator>> are not completely symmetric. Writing - a node to a stream is very well defined. You'll get a nice stream - of output, without any extra whitespace or newlines. - - But reading is not as well defined. (As it always is.) If you create - a TiXmlElement (for example) and read that from an input stream, - the text needs to define an element or junk will result. This is - true of all input streams, but it's worth keeping in mind. - - A TiXmlDocument will read nodes until it reads a root element, and - all the children of that root element. - */ - friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base); - - /// Appends the XML node or attribute to a std::string. - friend std::string& operator<< (std::string& out, const TiXmlNode& base ); - - #endif - - /** The types of XML nodes supported by TinyXml. (All the - unsupported types are picked up by UNKNOWN.) - */ - enum NodeType - { - TINYXML_DOCUMENT, - TINYXML_ELEMENT, - TINYXML_COMMENT, - TINYXML_UNKNOWN, - TINYXML_TEXT, - TINYXML_DECLARATION, - TINYXML_TYPECOUNT - }; - - virtual ~TiXmlNode(); - - /** The meaning of 'value' changes for the specific type of - TiXmlNode. - @verbatim - Document: filename of the xml file - Element: name of the element - Comment: the comment text - Unknown: the tag contents - Text: the text string - @endverbatim - - The subclasses will wrap this function. - */ - const char *Value() const { return value.c_str (); } - - #ifdef TIXML_USE_STL - /** Return Value() as a std::string. If you only use STL, - this is more efficient than calling Value(). - Only available in STL mode. - */ - const std::string& ValueStr() const { return value; } - #endif - - const TIXML_STRING& ValueTStr() const { return value; } - - /** Changes the value of the node. Defined as: - @verbatim - Document: filename of the xml file - Element: name of the element - Comment: the comment text - Unknown: the tag contents - Text: the text string - @endverbatim - */ - void SetValue(const char * _value) { value = _value;} - - #ifdef TIXML_USE_STL - /// STL std::string form. - void SetValue( const std::string& _value ) { value = _value; } - #endif - - /// Delete all the children of this node. Does not affect 'this'. - void Clear(); - - /// One step up the DOM. - TiXmlNode* Parent() { return parent; } - const TiXmlNode* Parent() const { return parent; } - - const TiXmlNode* FirstChild() const { return firstChild; } ///< The first child of this node. Will be null if there are no children. - TiXmlNode* FirstChild() { return firstChild; } - const TiXmlNode* FirstChild( const char * value ) const; ///< The first child of this node with the matching 'value'. Will be null if none found. - /// The first child of this node with the matching 'value'. Will be null if none found. - TiXmlNode* FirstChild( const char * _value ) { - // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe) - // call the method, cast the return back to non-const. - return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value )); - } - const TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children. - TiXmlNode* LastChild() { return lastChild; } - - const TiXmlNode* LastChild( const char * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children. - TiXmlNode* LastChild( const char * _value ) { - return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value )); - } +#ifdef TIXML_USE_STL - #ifdef TIXML_USE_STL - const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); } ///< STL std::string form. - const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); } ///< STL std::string form. - #endif - - /** An alternate way to walk the children of a node. - One way to iterate over nodes is: - @verbatim - for( child = parent->FirstChild(); child; child = child->NextSibling() ) - @endverbatim - - IterateChildren does the same thing with the syntax: - @verbatim - child = 0; - while( child = parent->IterateChildren( child ) ) - @endverbatim - - IterateChildren takes the previous child as input and finds - the next one. If the previous child is null, it returns the - first. IterateChildren will return null when done. - */ - const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const; - TiXmlNode* IterateChildren( const TiXmlNode* previous ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) ); - } + /** An input stream operator, for every class. Tolerant of newlines and + formatting, but doesn't expect them. + */ + friend std::istream& operator >> (std::istream& in, TiXmlNode& base); - /// This flavor of IterateChildren searches for children with a particular 'value' - const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const; - TiXmlNode* IterateChildren( const char * _value, const TiXmlNode* previous ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) ); - } + /** An output stream operator, for every class. Note that this outputs + without any newlines or formatting, as opposed to Print(), which + includes tabs and new lines. - #ifdef TIXML_USE_STL - const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. - TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. - #endif + The operator<< and operator>> are not completely symmetric. Writing + a node to a stream is very well defined. You'll get a nice stream + of output, without any extra whitespace or newlines. - /** Add a new node related to this. Adds a child past the LastChild. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* InsertEndChild( const TiXmlNode& addThis ); + But reading is not as well defined. (As it always is.) If you create + a TiXmlElement (for example) and read that from an input stream, + the text needs to define an element or junk will result. This is + true of all input streams, but it's worth keeping in mind. + A TiXmlDocument will read nodes until it reads a root element, and + all the children of that root element. + */ + friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base); - /** Add a new node related to this. Adds a child past the LastChild. + /// Appends the XML node or attribute to a std::string. + friend std::string& operator<< (std::string& out, const TiXmlNode& base ); - NOTE: the node to be added is passed by pointer, and will be - henceforth owned (and deleted) by tinyXml. This method is efficient - and avoids an extra copy, but should be used with care as it - uses a different memory model than the other insert functions. +#endif - @sa InsertEndChild - */ - TiXmlNode* LinkEndChild( TiXmlNode* addThis ); + /** The types of XML nodes supported by TinyXml. (All the + unsupported types are picked up by UNKNOWN.) + */ + enum NodeType + { + TINYXML_DOCUMENT, + TINYXML_ELEMENT, + TINYXML_COMMENT, + TINYXML_UNKNOWN, + TINYXML_TEXT, + TINYXML_DECLARATION, + TINYXML_TYPECOUNT + }; + + virtual ~TiXmlNode(); + + /** The meaning of 'value' changes for the specific type of + TiXmlNode. + @verbatim + Document: filename of the xml file + Element: name of the element + Comment: the comment text + Unknown: the tag contents + Text: the text string + @endverbatim + + The subclasses will wrap this function. + */ + const char* Value() const { return value.c_str (); } - /** Add a new node related to this. Adds a child before the specified child. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ); +#ifdef TIXML_USE_STL + /** Return Value() as a std::string. If you only use STL, + this is more efficient than calling Value(). + Only available in STL mode. + */ + const std::string& ValueStr() const { return value; } +#endif - /** Add a new node related to this. Adds a child after the specified child. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ); + const TIXML_STRING& ValueTStr() const { return value; } - /** Replace a child of this node. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ); + /** Changes the value of the node. Defined as: + @verbatim + Document: filename of the xml file + Element: name of the element + Comment: the comment text + Unknown: the tag contents + Text: the text string + @endverbatim + */ + void SetValue(const char* _value) { value = _value;} - /// Delete a child of this node. - bool RemoveChild( TiXmlNode* removeThis ); +#ifdef TIXML_USE_STL + /// STL std::string form. + void SetValue( const std::string& _value ) { value = _value; } +#endif - /// Navigate to a sibling node. - const TiXmlNode* PreviousSibling() const { return prev; } - TiXmlNode* PreviousSibling() { return prev; } + /// Delete all the children of this node. Does not affect 'this'. + void Clear(); + + /// One step up the DOM. + TiXmlNode* Parent() { return parent; } + const TiXmlNode* Parent() const { return parent; } + + const TiXmlNode* FirstChild() const { return firstChild; } ///< The first child of this node. Will be null if there are no children. + TiXmlNode* FirstChild() { return firstChild; } + const TiXmlNode* FirstChild( const char* value ) const; ///< The first child of this node with the matching 'value'. Will be null if none found. + /// The first child of this node with the matching 'value'. Will be null if none found. + TiXmlNode* FirstChild( const char* _value ) + { + // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe) + // call the method, cast the return back to non-const. + return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value )); + } + const TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children. + TiXmlNode* LastChild() { return lastChild; } + + const TiXmlNode* LastChild( const char* value ) const; /// The last child of this node matching 'value'. Will be null if there are no children. + TiXmlNode* LastChild( const char* _value ) + { + return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value )); + } - /// Navigate to a sibling node. - const TiXmlNode* PreviousSibling( const char * ) const; - TiXmlNode* PreviousSibling( const char *_prev ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) ); - } +#ifdef TIXML_USE_STL + const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); } ///< STL std::string form. + const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); } ///< STL std::string form. +#endif - #ifdef TIXML_USE_STL - const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. - const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); } ///< STL std::string form. - #endif - - /// Navigate to a sibling node. - const TiXmlNode* NextSibling() const { return next; } - TiXmlNode* NextSibling() { return next; } - - /// Navigate to a sibling node with the given 'value'. - const TiXmlNode* NextSibling( const char * ) const; - TiXmlNode* NextSibling( const char* _next ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) ); - } + /** An alternate way to walk the children of a node. + One way to iterate over nodes is: + @verbatim + for( child = parent->FirstChild(); child; child = child->NextSibling() ) + @endverbatim + + IterateChildren does the same thing with the syntax: + @verbatim + child = 0; + while( child = parent->IterateChildren( child ) ) + @endverbatim + + IterateChildren takes the previous child as input and finds + the next one. If the previous child is null, it returns the + first. IterateChildren will return null when done. + */ + const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const; + TiXmlNode* IterateChildren( const TiXmlNode* previous ) + { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) ); + } + + /// This flavor of IterateChildren searches for children with a particular 'value' + const TiXmlNode* IterateChildren( const char* value, const TiXmlNode* previous ) const; + TiXmlNode* IterateChildren( const char* _value, const TiXmlNode* previous ) + { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) ); + } - /** Convenience function to get through elements. - Calls NextSibling and ToElement. Will skip all non-Element - nodes. Returns 0 if there is not another element. - */ - const TiXmlElement* NextSiblingElement() const; - TiXmlElement* NextSiblingElement() { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() ); - } +#ifdef TIXML_USE_STL + const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. + TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. +#endif - /** Convenience function to get through elements. - Calls NextSibling and ToElement. Will skip all non-Element - nodes. Returns 0 if there is not another element. - */ - const TiXmlElement* NextSiblingElement( const char * ) const; - TiXmlElement* NextSiblingElement( const char *_next ) { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) ); - } + /** Add a new node related to this. Adds a child past the LastChild. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* InsertEndChild( const TiXmlNode& addThis ); - #ifdef TIXML_USE_STL - const TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. - TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. - #endif - /// Convenience function to get through elements. - const TiXmlElement* FirstChildElement() const; - TiXmlElement* FirstChildElement() { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() ); - } + /** Add a new node related to this. Adds a child past the LastChild. - /// Convenience function to get through elements. - const TiXmlElement* FirstChildElement( const char * _value ) const; - TiXmlElement* FirstChildElement( const char * _value ) { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) ); - } + NOTE: the node to be added is passed by pointer, and will be + henceforth owned (and deleted) by tinyXml. This method is efficient + and avoids an extra copy, but should be used with care as it + uses a different memory model than the other insert functions. - #ifdef TIXML_USE_STL - const TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. - TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. - #endif - - /** Query the type (as an enumerated value, above) of this node. - The possible types are: DOCUMENT, ELEMENT, COMMENT, - UNKNOWN, TEXT, and DECLARATION. - */ - int Type() const { return type; } - - /** Return a pointer to the Document this node lives in. - Returns null if not in a document. - */ - const TiXmlDocument* GetDocument() const; - TiXmlDocument* GetDocument() { - return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() ); - } + @sa InsertEndChild + */ + TiXmlNode* LinkEndChild( TiXmlNode* addThis ); - /// Returns true if this node has no children. - bool NoChildren() const { return !firstChild; } + /** Add a new node related to this. Adds a child before the specified child. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ); - virtual const TiXmlDocument* ToDocument() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlElement* ToElement() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlComment* ToComment() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlUnknown* ToUnknown() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlText* ToText() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlDeclaration* ToDeclaration() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + /** Add a new node related to this. Adds a child after the specified child. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ); - virtual TiXmlDocument* ToDocument() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlElement* ToElement() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlComment* ToComment() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlUnknown* ToUnknown() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlText* ToText() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlDeclaration* ToDeclaration() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + /** Replace a child of this node. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ); - /** Create an exact duplicate of this node and return it. The memory must be deleted - by the caller. - */ - virtual TiXmlNode* Clone() const = 0; + /// Delete a child of this node. + bool RemoveChild( TiXmlNode* removeThis ); - /** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the - XML tree will be conditionally visited and the host will be called back - via the TiXmlVisitor interface. + /// Navigate to a sibling node. + const TiXmlNode* PreviousSibling() const { return prev; } + TiXmlNode* PreviousSibling() { return prev; } - This is essentially a SAX interface for TinyXML. (Note however it doesn't re-parse - the XML for the callbacks, so the performance of TinyXML is unchanged by using this - interface versus any other.) + /// Navigate to a sibling node. + const TiXmlNode* PreviousSibling( const char* ) const; + TiXmlNode* PreviousSibling( const char* _prev ) + { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) ); + } - The interface has been based on ideas from: +#ifdef TIXML_USE_STL + const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. + const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); } ///< STL std::string form. +#endif - - http://www.saxproject.org/ - - http://c2.com/cgi/wiki?HierarchicalVisitorPattern + /// Navigate to a sibling node. + const TiXmlNode* NextSibling() const { return next; } + TiXmlNode* NextSibling() { return next; } + + /// Navigate to a sibling node with the given 'value'. + const TiXmlNode* NextSibling( const char* ) const; + TiXmlNode* NextSibling( const char* _next ) + { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) ); + } + + /** Convenience function to get through elements. + Calls NextSibling and ToElement. Will skip all non-Element + nodes. Returns 0 if there is not another element. + */ + const TiXmlElement* NextSiblingElement() const; + TiXmlElement* NextSiblingElement() + { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() ); + } + + /** Convenience function to get through elements. + Calls NextSibling and ToElement. Will skip all non-Element + nodes. Returns 0 if there is not another element. + */ + const TiXmlElement* NextSiblingElement( const char* ) const; + TiXmlElement* NextSiblingElement( const char* _next ) + { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) ); + } - Which are both good references for "visiting". +#ifdef TIXML_USE_STL + const TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. + TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. +#endif + + /// Convenience function to get through elements. + const TiXmlElement* FirstChildElement() const; + TiXmlElement* FirstChildElement() + { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() ); + } - An example of using Accept(): - @verbatim - TiXmlPrinter printer; - tinyxmlDoc.Accept( &printer ); - const char* xmlcstr = printer.CStr(); - @endverbatim - */ - virtual bool Accept( TiXmlVisitor* visitor ) const = 0; + /// Convenience function to get through elements. + const TiXmlElement* FirstChildElement( const char* _value ) const; + TiXmlElement* FirstChildElement( const char* _value ) + { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) ); + } + +#ifdef TIXML_USE_STL + const TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. + TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. +#endif + + /** Query the type (as an enumerated value, above) of this node. + The possible types are: DOCUMENT, ELEMENT, COMMENT, + UNKNOWN, TEXT, and DECLARATION. + */ + int Type() const { return type; } + + /** Return a pointer to the Document this node lives in. + Returns null if not in a document. + */ + const TiXmlDocument* GetDocument() const; + TiXmlDocument* GetDocument() + { + return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() ); + } + + /// Returns true if this node has no children. + bool NoChildren() const { return !firstChild; } + + virtual const TiXmlDocument* ToDocument() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlElement* ToElement() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlComment* ToComment() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlUnknown* ToUnknown() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlText* ToText() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlDeclaration* ToDeclaration() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + + virtual TiXmlDocument* ToDocument() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlElement* ToElement() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlComment* ToComment() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlUnknown* ToUnknown() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlText* ToText() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlDeclaration* ToDeclaration() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + + /** Create an exact duplicate of this node and return it. The memory must be deleted + by the caller. + */ + virtual TiXmlNode* Clone() const = 0; + + /** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the + XML tree will be conditionally visited and the host will be called back + via the TiXmlVisitor interface. + + This is essentially a SAX interface for TinyXML. (Note however it doesn't re-parse + the XML for the callbacks, so the performance of TinyXML is unchanged by using this + interface versus any other.) + + The interface has been based on ideas from: + + - http://www.saxproject.org/ + - http://c2.com/cgi/wiki?HierarchicalVisitorPattern + + Which are both good references for "visiting". + + An example of using Accept(): + @verbatim + TiXmlPrinter printer; + tinyxmlDoc.Accept( &printer ); + const char* xmlcstr = printer.CStr(); + @endverbatim + */ + virtual bool Accept( TiXmlVisitor* visitor ) const = 0; protected: - TiXmlNode( NodeType _type ); + TiXmlNode( NodeType _type ); - // Copy to the allocated object. Shared functionality between Clone, Copy constructor, - // and the assignment operator. - void CopyTo( TiXmlNode* target ) const; + // Copy to the allocated object. Shared functionality between Clone, Copy constructor, + // and the assignment operator. + void CopyTo( TiXmlNode* target ) const; - #ifdef TIXML_USE_STL - // The real work of the input operator. - virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0; - #endif +#ifdef TIXML_USE_STL + // The real work of the input operator. + virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0; +#endif - // Figure out what is at *p, and parse it. Returns null if it is not an xml node. - TiXmlNode* Identify( const char* start, TiXmlEncoding encoding ); + // Figure out what is at *p, and parse it. Returns null if it is not an xml node. + TiXmlNode* Identify( const char* start, TiXmlEncoding encoding ); - TiXmlNode* parent; - NodeType type; + TiXmlNode* parent; + NodeType type; - TiXmlNode* firstChild; - TiXmlNode* lastChild; + TiXmlNode* firstChild; + TiXmlNode* lastChild; - TIXML_STRING value; + TIXML_STRING value; - TiXmlNode* prev; - TiXmlNode* next; + TiXmlNode* prev; + TiXmlNode* next; private: - TiXmlNode( const TiXmlNode& ); // not implemented. - void operator=( const TiXmlNode& base ); // not allowed. + TiXmlNode( const TiXmlNode& ); // not implemented. + void operator=( const TiXmlNode& base ); // not allowed. }; @@ -778,119 +790,122 @@ private: */ class TiXmlAttribute : public TiXmlBase { - friend class TiXmlAttributeSet; + friend class TiXmlAttributeSet; public: - /// Construct an empty attribute. - TiXmlAttribute() : TiXmlBase() - { - document = 0; - prev = next = 0; - } + /// Construct an empty attribute. + TiXmlAttribute() : TiXmlBase() + { + document = 0; + prev = next = 0; + } - #ifdef TIXML_USE_STL - /// std::string constructor. - TiXmlAttribute( const std::string& _name, const std::string& _value ) - { - name = _name; - value = _value; - document = 0; - prev = next = 0; - } - #endif +#ifdef TIXML_USE_STL + /// std::string constructor. + TiXmlAttribute( const std::string& _name, const std::string& _value ) + { + name = _name; + value = _value; + document = 0; + prev = next = 0; + } +#endif - /// Construct an attribute with a name and value. - TiXmlAttribute( const char * _name, const char * _value ) - { - name = _name; - value = _value; - document = 0; - prev = next = 0; - } + /// Construct an attribute with a name and value. + TiXmlAttribute( const char* _name, const char* _value ) + { + name = _name; + value = _value; + document = 0; + prev = next = 0; + } + + const char* Name() const { return name.c_str(); } ///< Return the name of this attribute. + const char* Value() const { return value.c_str(); } ///< Return the value of this attribute. +#ifdef TIXML_USE_STL + const std::string& ValueStr() const { return value; } ///< Return the value of this attribute. +#endif + int IntValue() const; ///< Return the value of this attribute, converted to an integer. + double DoubleValue() const; ///< Return the value of this attribute, converted to a double. - const char* Name() const { return name.c_str(); } ///< Return the name of this attribute. - const char* Value() const { return value.c_str(); } ///< Return the value of this attribute. - #ifdef TIXML_USE_STL - const std::string& ValueStr() const { return value; } ///< Return the value of this attribute. - #endif - int IntValue() const; ///< Return the value of this attribute, converted to an integer. - double DoubleValue() const; ///< Return the value of this attribute, converted to a double. - - // Get the tinyxml string representation - const TIXML_STRING& NameTStr() const { return name; } - - /** QueryIntValue examines the value string. It is an alternative to the - IntValue() method with richer error checking. - If the value is an integer, it is stored in 'value' and - the call returns TIXML_SUCCESS. If it is not - an integer, it returns TIXML_WRONG_TYPE. - - A specialized but useful call. Note that for success it returns 0, - which is the opposite of almost all other TinyXml calls. - */ - int QueryIntValue( int* _value ) const; - /// QueryDoubleValue examines the value string. See QueryIntValue(). - int QueryDoubleValue( double* _value ) const; - - void SetName( const char* _name ) { name = _name; } ///< Set the name of this attribute. - void SetValue( const char* _value ) { value = _value; } ///< Set the value. - - void SetIntValue( int _value ); ///< Set the value from an integer. - void SetDoubleValue( double _value ); ///< Set the value from a double. - - #ifdef TIXML_USE_STL - /// STL std::string form. - void SetName( const std::string& _name ) { name = _name; } - /// STL std::string form. - void SetValue( const std::string& _value ) { value = _value; } - #endif - - /// Get the next sibling attribute in the DOM. Returns null at end. - const TiXmlAttribute* Next() const; - TiXmlAttribute* Next() { - return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); - } + // Get the tinyxml string representation + const TIXML_STRING& NameTStr() const { return name; } - /// Get the previous sibling attribute in the DOM. Returns null at beginning. - const TiXmlAttribute* Previous() const; - TiXmlAttribute* Previous() { - return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); - } + /** QueryIntValue examines the value string. It is an alternative to the + IntValue() method with richer error checking. + If the value is an integer, it is stored in 'value' and + the call returns TIXML_SUCCESS. If it is not + an integer, it returns TIXML_WRONG_TYPE. - bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; } - bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; } - bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; } + A specialized but useful call. Note that for success it returns 0, + which is the opposite of almost all other TinyXml calls. + */ + int QueryIntValue( int* _value ) const; + /// QueryDoubleValue examines the value string. See QueryIntValue(). + int QueryDoubleValue( double* _value ) const; - /* Attribute parsing starts: first letter of the name - returns: the next char after the value end quote - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + void SetName( const char* _name ) { name = _name; } ///< Set the name of this attribute. + void SetValue( const char* _value ) { value = _value; } ///< Set the value. - // Prints this Attribute to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const { - Print( cfile, depth, 0 ); - } - void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; + void SetIntValue( int _value ); ///< Set the value from an integer. + void SetDoubleValue( double _value ); ///< Set the value from a double. - // [internal use] - // Set the document pointer so the attribute can report errors. - void SetDocument( TiXmlDocument* doc ) { document = doc; } +#ifdef TIXML_USE_STL + /// STL std::string form. + void SetName( const std::string& _name ) { name = _name; } + /// STL std::string form. + void SetValue( const std::string& _value ) { value = _value; } +#endif + + /// Get the next sibling attribute in the DOM. Returns null at end. + const TiXmlAttribute* Next() const; + TiXmlAttribute* Next() + { + return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); + } + + /// Get the previous sibling attribute in the DOM. Returns null at beginning. + const TiXmlAttribute* Previous() const; + TiXmlAttribute* Previous() + { + return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); + } + + bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; } + bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; } + bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; } + + /* Attribute parsing starts: first letter of the name + returns: the next char after the value end quote + */ + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + // Prints this Attribute to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const + { + Print( cfile, depth, 0 ); + } + void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; + + // [internal use] + // Set the document pointer so the attribute can report errors. + void SetDocument( TiXmlDocument* doc ) { document = doc; } private: - TiXmlAttribute( const TiXmlAttribute& ); // not implemented. - void operator=( const TiXmlAttribute& base ); // not allowed. - - TiXmlDocument* document; // A pointer back to a document, for error reporting. - TIXML_STRING name; - TIXML_STRING value; - TiXmlAttribute* prev; - TiXmlAttribute* next; + TiXmlAttribute( const TiXmlAttribute& ); // not implemented. + void operator=( const TiXmlAttribute& base ); // not allowed. + + TiXmlDocument* document; // A pointer back to a document, for error reporting. + TIXML_STRING name; + TIXML_STRING value; + TiXmlAttribute* prev; + TiXmlAttribute* next; }; /* A class used to manage a group of attributes. It is only used internally, both by the ELEMENT and the DECLARATION. - + The set can be changed transparent to the Element and Declaration classes that use it, but NOT transparent to the Attribute which has to implement a next() and previous() method. Which makes @@ -903,33 +918,33 @@ private: class TiXmlAttributeSet { public: - TiXmlAttributeSet(); - ~TiXmlAttributeSet(); + TiXmlAttributeSet(); + ~TiXmlAttributeSet(); - void Add( TiXmlAttribute* attribute ); - void Remove( TiXmlAttribute* attribute ); + void Add( TiXmlAttribute* attribute ); + void Remove( TiXmlAttribute* attribute ); - const TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } - TiXmlAttribute* First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } - const TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } - TiXmlAttribute* Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } + const TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } + TiXmlAttribute* First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } + const TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } + TiXmlAttribute* Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } - TiXmlAttribute* Find( const char* _name ) const; - TiXmlAttribute* FindOrCreate( const char* _name ); + TiXmlAttribute* Find( const char* _name ) const; + TiXmlAttribute* FindOrCreate( const char* _name ); # ifdef TIXML_USE_STL - TiXmlAttribute* Find( const std::string& _name ) const; - TiXmlAttribute* FindOrCreate( const std::string& _name ); + TiXmlAttribute* Find( const std::string& _name ) const; + TiXmlAttribute* FindOrCreate( const std::string& _name ); # endif private: - //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element), - //*ME: this class must be also use a hidden/disabled copy-constructor !!! - TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed - void operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute) + //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element), + //*ME: this class must be also use a hidden/disabled copy-constructor !!! + TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed + void operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute) - TiXmlAttribute sentinel; + TiXmlAttribute sentinel; }; @@ -940,213 +955,217 @@ private: class TiXmlElement : public TiXmlNode { public: - /// Construct an element. - TiXmlElement (const char * in_value); - - #ifdef TIXML_USE_STL - /// std::string constructor. - TiXmlElement( const std::string& _value ); - #endif - - TiXmlElement( const TiXmlElement& ); - - void operator=( const TiXmlElement& base ); - - virtual ~TiXmlElement(); - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none exists. - */ - const char* Attribute( const char* name ) const; - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none exists. - If the attribute exists and can be converted to an integer, - the integer value will be put in the return 'i', if 'i' - is non-null. - */ - const char* Attribute( const char* name, int* i ) const; - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none exists. - If the attribute exists and can be converted to an double, - the double value will be put in the return 'd', if 'd' - is non-null. - */ - const char* Attribute( const char* name, double* d ) const; - - /** QueryIntAttribute examines the attribute - it is an alternative to the - Attribute() method with richer error checking. - If the attribute is an integer, it is stored in 'value' and - the call returns TIXML_SUCCESS. If it is not - an integer, it returns TIXML_WRONG_TYPE. If the attribute - does not exist, then TIXML_NO_ATTRIBUTE is returned. - */ - int QueryIntAttribute( const char* name, int* _value ) const; - /// QueryDoubleAttribute examines the attribute - see QueryIntAttribute(). - int QueryDoubleAttribute( const char* name, double* _value ) const; - /// QueryFloatAttribute examines the attribute - see QueryIntAttribute(). - int QueryFloatAttribute( const char* name, float* _value ) const { - double d; - int result = QueryDoubleAttribute( name, &d ); - if ( result == TIXML_SUCCESS ) { - *_value = (float)d; - } - return result; - } + /// Construct an element. + TiXmlElement (const char* in_value); - #ifdef TIXML_USE_STL - /// QueryStringAttribute examines the attribute - see QueryIntAttribute(). - int QueryStringAttribute( const char* name, std::string* _value ) const { - const char* cstr = Attribute( name ); - if ( cstr ) { - *_value = std::string( cstr ); - return TIXML_SUCCESS; - } - return TIXML_NO_ATTRIBUTE; - } +#ifdef TIXML_USE_STL + /// std::string constructor. + TiXmlElement( const std::string& _value ); +#endif - /** Template form of the attribute query which will try to read the - attribute into the specified type. Very easy, very powerful, but - be careful to make sure to call this with the correct type. - - NOTE: This method doesn't work correctly for 'string' types that contain spaces. + TiXmlElement( const TiXmlElement& ); + + void operator=( const TiXmlElement& base ); + + virtual ~TiXmlElement(); + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none exists. + */ + const char* Attribute( const char* name ) const; + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none exists. + If the attribute exists and can be converted to an integer, + the integer value will be put in the return 'i', if 'i' + is non-null. + */ + const char* Attribute( const char* name, int* i ) const; + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none exists. + If the attribute exists and can be converted to an double, + the double value will be put in the return 'd', if 'd' + is non-null. + */ + const char* Attribute( const char* name, double* d ) const; + + /** QueryIntAttribute examines the attribute - it is an alternative to the + Attribute() method with richer error checking. + If the attribute is an integer, it is stored in 'value' and + the call returns TIXML_SUCCESS. If it is not + an integer, it returns TIXML_WRONG_TYPE. If the attribute + does not exist, then TIXML_NO_ATTRIBUTE is returned. + */ + int QueryIntAttribute( const char* name, int* _value ) const; + /// QueryDoubleAttribute examines the attribute - see QueryIntAttribute(). + int QueryDoubleAttribute( const char* name, double* _value ) const; + /// QueryFloatAttribute examines the attribute - see QueryIntAttribute(). + int QueryFloatAttribute( const char* name, float* _value ) const + { + double d; + int result = QueryDoubleAttribute( name, &d ); + if ( result == TIXML_SUCCESS ) + { + *_value = (float)d; + } + return result; + } - @return TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE - */ - template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const - { - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - - std::stringstream sstream( node->ValueStr() ); - sstream >> *outValue; - if ( !sstream.fail() ) - return TIXML_SUCCESS; - return TIXML_WRONG_TYPE; - } +#ifdef TIXML_USE_STL + /// QueryStringAttribute examines the attribute - see QueryIntAttribute(). + int QueryStringAttribute( const char* name, std::string* _value ) const + { + const char* cstr = Attribute( name ); + if ( cstr ) + { + *_value = std::string( cstr ); + return TIXML_SUCCESS; + } + return TIXML_NO_ATTRIBUTE; + } + + /** Template form of the attribute query which will try to read the + attribute into the specified type. Very easy, very powerful, but + be careful to make sure to call this with the correct type. + + NOTE: This method doesn't work correctly for 'string' types that contain spaces. + + @return TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE + */ + template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const + { + const TiXmlAttribute* node = attributeSet.Find( name ); + if ( !node ) + return TIXML_NO_ATTRIBUTE; + + std::stringstream sstream( node->ValueStr() ); + sstream >> *outValue; + if ( !sstream.fail() ) + return TIXML_SUCCESS; + return TIXML_WRONG_TYPE; + } + + int QueryValueAttribute( const std::string& name, std::string* outValue ) const + { + const TiXmlAttribute* node = attributeSet.Find( name ); + if ( !node ) + return TIXML_NO_ATTRIBUTE; + *outValue = node->ValueStr(); + return TIXML_SUCCESS; + } +#endif - int QueryValueAttribute( const std::string& name, std::string* outValue ) const - { - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - *outValue = node->ValueStr(); - return TIXML_SUCCESS; - } - #endif - - /** Sets an attribute of name to a given value. The attribute - will be created if it does not exist, or changed if it does. - */ - void SetAttribute( const char* name, const char * _value ); - - #ifdef TIXML_USE_STL - const std::string* Attribute( const std::string& name ) const; - const std::string* Attribute( const std::string& name, int* i ) const; - const std::string* Attribute( const std::string& name, double* d ) const; - int QueryIntAttribute( const std::string& name, int* _value ) const; - int QueryDoubleAttribute( const std::string& name, double* _value ) const; - - /// STL std::string form. - void SetAttribute( const std::string& name, const std::string& _value ); - ///< STL std::string form. - void SetAttribute( const std::string& name, int _value ); - ///< STL std::string form. - void SetDoubleAttribute( const std::string& name, double value ); - #endif - - /** Sets an attribute of name to a given value. The attribute - will be created if it does not exist, or changed if it does. - */ - void SetAttribute( const char * name, int value ); - - /** Sets an attribute of name to a given value. The attribute - will be created if it does not exist, or changed if it does. - */ - void SetDoubleAttribute( const char * name, double value ); - - /** Deletes an attribute with the given name. - */ - void RemoveAttribute( const char * name ); - #ifdef TIXML_USE_STL - void RemoveAttribute( const std::string& name ) { RemoveAttribute (name.c_str ()); } ///< STL std::string form. - #endif - - const TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); } ///< Access the first attribute in this element. - TiXmlAttribute* FirstAttribute() { return attributeSet.First(); } - const TiXmlAttribute* LastAttribute() const { return attributeSet.Last(); } ///< Access the last attribute in this element. - TiXmlAttribute* LastAttribute() { return attributeSet.Last(); } - - /** Convenience function for easy access to the text inside an element. Although easy - and concise, GetText() is limited compared to getting the TiXmlText child - and accessing it directly. - - If the first child of 'this' is a TiXmlText, the GetText() - returns the character string of the Text node, else null is returned. - - This is a convenient method for getting the text of simple contained text: - @verbatim - <foo>This is text</foo> - const char* str = fooElement->GetText(); - @endverbatim - - 'str' will be a pointer to "This is text". - - Note that this function can be misleading. If the element foo was created from - this XML: - @verbatim - <foo><b>This is text</b></foo> - @endverbatim - - then the value of str would be null. The first child node isn't a text node, it is - another element. From this XML: - @verbatim - <foo>This is <b>text</b></foo> - @endverbatim - GetText() will return "This is ". - - WARNING: GetText() accesses a child node - don't become confused with the - similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are - safe type casts on the referenced node. - */ - const char* GetText() const; - - /// Creates a new Element and returns it - the returned element is a copy. - virtual TiXmlNode* Clone() const; - // Print the Element to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - /* Attribtue parsing starts: next char past '<' - returns: next char past '>' - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlElement* ToElement() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlElement* ToElement() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; + /** Sets an attribute of name to a given value. The attribute + will be created if it does not exist, or changed if it does. + */ + void SetAttribute( const char* name, const char* _value ); + +#ifdef TIXML_USE_STL + const std::string* Attribute( const std::string& name ) const; + const std::string* Attribute( const std::string& name, int* i ) const; + const std::string* Attribute( const std::string& name, double* d ) const; + int QueryIntAttribute( const std::string& name, int* _value ) const; + int QueryDoubleAttribute( const std::string& name, double* _value ) const; + + /// STL std::string form. + void SetAttribute( const std::string& name, const std::string& _value ); + ///< STL std::string form. + void SetAttribute( const std::string& name, int _value ); + ///< STL std::string form. + void SetDoubleAttribute( const std::string& name, double value ); +#endif + + /** Sets an attribute of name to a given value. The attribute + will be created if it does not exist, or changed if it does. + */ + void SetAttribute( const char* name, int value ); + + /** Sets an attribute of name to a given value. The attribute + will be created if it does not exist, or changed if it does. + */ + void SetDoubleAttribute( const char* name, double value ); + + /** Deletes an attribute with the given name. + */ + void RemoveAttribute( const char* name ); +#ifdef TIXML_USE_STL + void RemoveAttribute( const std::string& name ) { RemoveAttribute (name.c_str ()); } ///< STL std::string form. +#endif + + const TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); } ///< Access the first attribute in this element. + TiXmlAttribute* FirstAttribute() { return attributeSet.First(); } + const TiXmlAttribute* LastAttribute() const { return attributeSet.Last(); } ///< Access the last attribute in this element. + TiXmlAttribute* LastAttribute() { return attributeSet.Last(); } + + /** Convenience function for easy access to the text inside an element. Although easy + and concise, GetText() is limited compared to getting the TiXmlText child + and accessing it directly. + + If the first child of 'this' is a TiXmlText, the GetText() + returns the character string of the Text node, else null is returned. + + This is a convenient method for getting the text of simple contained text: + @verbatim + <foo>This is text</foo> + const char* str = fooElement->GetText(); + @endverbatim + + 'str' will be a pointer to "This is text". + + Note that this function can be misleading. If the element foo was created from + this XML: + @verbatim + <foo><b>This is text</b></foo> + @endverbatim + + then the value of str would be null. The first child node isn't a text node, it is + another element. From this XML: + @verbatim + <foo>This is <b>text</b></foo> + @endverbatim + GetText() will return "This is ". + + WARNING: GetText() accesses a child node - don't become confused with the + similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are + safe type casts on the referenced node. + */ + const char* GetText() const; + + /// Creates a new Element and returns it - the returned element is a copy. + virtual TiXmlNode* Clone() const; + // Print the Element to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const; + + /* Attribtue parsing starts: next char past '<' + returns: next char past '>' + */ + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + virtual const TiXmlElement* ToElement() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXmlElement* ToElement() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* visitor ) const; protected: - void CopyTo( TiXmlElement* target ) const; - void ClearThis(); // like clear, but initializes 'this' object as well + void CopyTo( TiXmlElement* target ) const; + void ClearThis(); // like clear, but initializes 'this' object as well - // Used to be public [internal use] - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - /* [internal use] - Reads the "value" of the element -- another element, or text. - This should terminate with the current end tag. - */ - const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding ); + // Used to be public [internal use] +#ifdef TIXML_USE_STL + virtual void StreamIn( std::istream* in, TIXML_STRING* tag ); +#endif + /* [internal use] + Reads the "value" of the element -- another element, or text. + This should terminate with the current end tag. + */ + const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding ); private: - TiXmlAttributeSet attributeSet; + TiXmlAttributeSet attributeSet; }; @@ -1155,110 +1174,111 @@ private: class TiXmlComment : public TiXmlNode { public: - /// Constructs an empty comment. - TiXmlComment() : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) {} - /// Construct a comment from text. - TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) { - SetValue( _value ); - } - TiXmlComment( const TiXmlComment& ); - void operator=( const TiXmlComment& base ); - - virtual ~TiXmlComment() {} - - /// Returns a copy of this Comment. - virtual TiXmlNode* Clone() const; - // Write this Comment to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - /* Attribtue parsing starts: at the ! of the !-- - returns: next char past '>' - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlComment* ToComment() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlComment* ToComment() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; + /// Constructs an empty comment. + TiXmlComment() : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) {} + /// Construct a comment from text. + TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) + { + SetValue( _value ); + } + TiXmlComment( const TiXmlComment& ); + void operator=( const TiXmlComment& base ); + + virtual ~TiXmlComment() {} + + /// Returns a copy of this Comment. + virtual TiXmlNode* Clone() const; + // Write this Comment to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const; + + /* Attribtue parsing starts: at the ! of the !-- + returns: next char past '>' + */ + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + virtual const TiXmlComment* ToComment() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXmlComment* ToComment() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* visitor ) const; protected: - void CopyTo( TiXmlComment* target ) const; + void CopyTo( TiXmlComment* target ) const; - // used to be public - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif -// virtual void StreamOut( TIXML_OSTREAM * out ) const; + // used to be public +#ifdef TIXML_USE_STL + virtual void StreamIn( std::istream* in, TIXML_STRING* tag ); +#endif + // virtual void StreamOut( TIXML_OSTREAM * out ) const; private: }; -/** XML text. A text node can have 2 ways to output the next. "normal" output +/** XML text. A text node can have 2 ways to output the next. "normal" output and CDATA. It will default to the mode it was parsed from the XML file and - you generally want to leave it alone, but you can change the output mode with + you generally want to leave it alone, but you can change the output mode with SetCDATA() and query it with CDATA(). */ class TiXmlText : public TiXmlNode { - friend class TiXmlElement; + friend class TiXmlElement; public: - /** Constructor for text element. By default, it is treated as - normal, encoded text. If you want it be output as a CDATA text - element, set the parameter _cdata to 'true' - */ - TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) - { - SetValue( initValue ); - cdata = false; - } - virtual ~TiXmlText() {} + /** Constructor for text element. By default, it is treated as + normal, encoded text. If you want it be output as a CDATA text + element, set the parameter _cdata to 'true' + */ + TiXmlText (const char* initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) + { + SetValue( initValue ); + cdata = false; + } + virtual ~TiXmlText() {} - #ifdef TIXML_USE_STL - /// Constructor. - TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) - { - SetValue( initValue ); - cdata = false; - } - #endif +#ifdef TIXML_USE_STL + /// Constructor. + TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) + { + SetValue( initValue ); + cdata = false; + } +#endif - TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TINYXML_TEXT ) { copy.CopyTo( this ); } - void operator=( const TiXmlText& base ) { base.CopyTo( this ); } + TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TINYXML_TEXT ) { copy.CopyTo( this ); } + void operator=( const TiXmlText& base ) { base.CopyTo( this ); } - // Write this text object to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; + // Write this text object to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const; - /// Queries whether this represents text using a CDATA section. - bool CDATA() const { return cdata; } - /// Turns on or off a CDATA representation of text. - void SetCDATA( bool _cdata ) { cdata = _cdata; } + /// Queries whether this represents text using a CDATA section. + bool CDATA() const { return cdata; } + /// Turns on or off a CDATA representation of text. + void SetCDATA( bool _cdata ) { cdata = _cdata; } - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - virtual const TiXmlText* ToText() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlText* ToText() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual const TiXmlText* ToText() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXmlText* ToText() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* content ) const; + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* content ) const; protected : - /// [internal use] Creates a new Element and returns it. - virtual TiXmlNode* Clone() const; - void CopyTo( TiXmlText* target ) const; + /// [internal use] Creates a new Element and returns it. + virtual TiXmlNode* Clone() const; + void CopyTo( TiXmlText* target ) const; - bool Blank() const; // returns true if all white space and new lines - // [internal use] - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif + bool Blank() const; // returns true if all white space and new lines + // [internal use] +#ifdef TIXML_USE_STL + virtual void StreamIn( std::istream* in, TIXML_STRING* tag ); +#endif private: - bool cdata; // true if this should be input and output as a CDATA style text element + bool cdata; // true if this should be input and output as a CDATA style text element }; @@ -1278,62 +1298,63 @@ private: class TiXmlDeclaration : public TiXmlNode { public: - /// Construct an empty declaration. - TiXmlDeclaration() : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) {} + /// Construct an empty declaration. + TiXmlDeclaration() : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) {} #ifdef TIXML_USE_STL - /// Constructor. - TiXmlDeclaration( const std::string& _version, - const std::string& _encoding, - const std::string& _standalone ); + /// Constructor. + TiXmlDeclaration( const std::string& _version, + const std::string& _encoding, + const std::string& _standalone ); #endif - /// Construct. - TiXmlDeclaration( const char* _version, - const char* _encoding, - const char* _standalone ); - - TiXmlDeclaration( const TiXmlDeclaration& copy ); - void operator=( const TiXmlDeclaration& copy ); - - virtual ~TiXmlDeclaration() {} - - /// Version. Will return an empty string if none was found. - const char *Version() const { return version.c_str (); } - /// Encoding. Will return an empty string if none was found. - const char *Encoding() const { return encoding.c_str (); } - /// Is this a standalone document? - const char *Standalone() const { return standalone.c_str (); } - - /// Creates a copy of this Declaration and returns it. - virtual TiXmlNode* Clone() const; - // Print this declaration to a FILE stream. - virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; - virtual void Print( FILE* cfile, int depth ) const { - Print( cfile, depth, 0 ); - } + /// Construct. + TiXmlDeclaration( const char* _version, + const char* _encoding, + const char* _standalone ); + + TiXmlDeclaration( const TiXmlDeclaration& copy ); + void operator=( const TiXmlDeclaration& copy ); - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + virtual ~TiXmlDeclaration() {} - virtual const TiXmlDeclaration* ToDeclaration() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlDeclaration* ToDeclaration() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + /// Version. Will return an empty string if none was found. + const char* Version() const { return version.c_str (); } + /// Encoding. Will return an empty string if none was found. + const char* Encoding() const { return encoding.c_str (); } + /// Is this a standalone document? + const char* Standalone() const { return standalone.c_str (); } - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; + /// Creates a copy of this Declaration and returns it. + virtual TiXmlNode* Clone() const; + // Print this declaration to a FILE stream. + virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; + virtual void Print( FILE* cfile, int depth ) const + { + Print( cfile, depth, 0 ); + } + + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + virtual const TiXmlDeclaration* ToDeclaration() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXmlDeclaration* ToDeclaration() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* visitor ) const; protected: - void CopyTo( TiXmlDeclaration* target ) const; - // used to be public - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif + void CopyTo( TiXmlDeclaration* target ) const; + // used to be public +#ifdef TIXML_USE_STL + virtual void StreamIn( std::istream* in, TIXML_STRING* tag ); +#endif private: - TIXML_STRING version; - TIXML_STRING encoding; - TIXML_STRING standalone; + TIXML_STRING version; + TIXML_STRING encoding; + TIXML_STRING standalone; }; @@ -1347,32 +1368,32 @@ private: class TiXmlUnknown : public TiXmlNode { public: - TiXmlUnknown() : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) {} - virtual ~TiXmlUnknown() {} + TiXmlUnknown() : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) {} + virtual ~TiXmlUnknown() {} - TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) { copy.CopyTo( this ); } - void operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); } + TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) { copy.CopyTo( this ); } + void operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); } - /// Creates a copy of this Unknown and returns it. - virtual TiXmlNode* Clone() const; - // Print this Unknown to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; + /// Creates a copy of this Unknown and returns it. + virtual TiXmlNode* Clone() const; + // Print this Unknown to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const; - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - virtual const TiXmlUnknown* ToUnknown() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlUnknown* ToUnknown() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual const TiXmlUnknown* ToUnknown() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXmlUnknown* ToUnknown() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* content ) const; + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* content ) const; protected: - void CopyTo( TiXmlUnknown* target ) const; + void CopyTo( TiXmlUnknown* target ) const; - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif +#ifdef TIXML_USE_STL + virtual void StreamIn( std::istream* in, TIXML_STRING* tag ); +#endif private: @@ -1386,165 +1407,167 @@ private: class TiXmlDocument : public TiXmlNode { public: - /// Create an empty document, that has no name. - TiXmlDocument(); - /// Create a document with a name. The name of the document is also the filename of the xml. - TiXmlDocument( const char * documentName ); - - #ifdef TIXML_USE_STL - /// Constructor. - TiXmlDocument( const std::string& documentName ); - #endif - - TiXmlDocument( const TiXmlDocument& copy ); - void operator=( const TiXmlDocument& copy ); - - virtual ~TiXmlDocument() {} - - /** Load a file using the current document value. - Returns true if successful. Will delete any existing - document data before loading. - */ - bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /// Save a file using the current document value. Returns true if successful. - bool SaveFile() const; - /// Load a file using the given filename. Returns true if successful. - bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /// Save a file using the given filename. Returns true if successful. - bool SaveFile( const char * filename ) const; - /** Load a file using the given FILE*. Returns true if successful. Note that this method - doesn't stream - the entire object pointed at by the FILE* - will be interpreted as an XML file. TinyXML doesn't stream in XML from the current - file location. Streaming may be added in the future. - */ - bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /// Save a file using the given FILE*. Returns true if successful. - bool SaveFile( FILE* ) const; - - #ifdef TIXML_USE_STL - bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ) ///< STL std::string version. - { - return LoadFile( filename.c_str(), encoding ); - } - bool SaveFile( const std::string& filename ) const ///< STL std::string version. - { - return SaveFile( filename.c_str() ); - } - #endif - - /** Parse the given null terminated block of xml data. Passing in an encoding to this - method (either TIXML_ENCODING_LEGACY or TIXML_ENCODING_UTF8 will force TinyXml - to use that encoding, regardless of what TinyXml might otherwise try to detect. - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - - /** Get the root element -- the only top level element -- of the document. - In well formed XML, there should only be one. TinyXml is tolerant of - multiple elements at the document level. - */ - const TiXmlElement* RootElement() const { return FirstChildElement(); } - TiXmlElement* RootElement() { return FirstChildElement(); } - - /** If an error occurs, Error will be set to true. Also, - - The ErrorId() will contain the integer identifier of the error (not generally useful) - - The ErrorDesc() method will return the name of the error. (very useful) - - The ErrorRow() and ErrorCol() will return the location of the error (if known) - */ - bool Error() const { return error; } - - /// Contains a textual (english) description of the error if one occurs. - const char * ErrorDesc() const { return errorDesc.c_str (); } - - /** Generally, you probably want the error string ( ErrorDesc() ). But if you - prefer the ErrorId, this function will fetch it. - */ - int ErrorId() const { return errorId; } - - /** Returns the location (if known) of the error. The first column is column 1, - and the first row is row 1. A value of 0 means the row and column wasn't applicable - (memory errors, for example, have no row/column) or the parser lost the error. (An - error in the error reporting, in that case.) - - @sa SetTabSize, Row, Column - */ - int ErrorRow() const { return errorLocation.row+1; } - int ErrorCol() const { return errorLocation.col+1; } ///< The column where the error occured. See ErrorRow() - - /** SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol()) - to report the correct values for row and column. It does not change the output - or input in any way. - - By calling this method, with a tab size - greater than 0, the row and column of each node and attribute is stored - when the file is loaded. Very useful for tracking the DOM back in to - the source file. - - The tab size is required for calculating the location of nodes. If not - set, the default of 4 is used. The tabsize is set per document. Setting - the tabsize to 0 disables row/column tracking. - - Note that row and column tracking is not supported when using operator>>. - - The tab size needs to be enabled before the parse or load. Correct usage: - @verbatim - TiXmlDocument doc; - doc.SetTabSize( 8 ); - doc.Load( "myfile.xml" ); - @endverbatim - - @sa Row, Column - */ - void SetTabSize( int _tabsize ) { tabsize = _tabsize; } - - int TabSize() const { return tabsize; } - - /** If you have handled the error, it can be reset with this call. The error - state is automatically cleared if you Parse a new XML block. - */ - void ClearError() { error = false; - errorId = 0; - errorDesc = ""; - errorLocation.row = errorLocation.col = 0; - //errorLocation.last = 0; - } - - /** Write the document to standard out using formatted printing ("pretty print"). */ - void Print() const { Print( stdout, 0 ); } - - /* Write the document to a string using formatted printing ("pretty print"). This - will allocate a character array (new char[]) and return it as a pointer. The - calling code pust call delete[] on the return char* to avoid a memory leak. - */ - //char* PrintToMemory() const; - - /// Print this Document to a FILE stream. - virtual void Print( FILE* cfile, int depth = 0 ) const; - // [internal use] - void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding ); - - virtual const TiXmlDocument* ToDocument() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlDocument* ToDocument() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* content ) const; + /// Create an empty document, that has no name. + TiXmlDocument(); + /// Create a document with a name. The name of the document is also the filename of the xml. + TiXmlDocument( const char* documentName ); + +#ifdef TIXML_USE_STL + /// Constructor. + TiXmlDocument( const std::string& documentName ); +#endif + + TiXmlDocument( const TiXmlDocument& copy ); + void operator=( const TiXmlDocument& copy ); + + virtual ~TiXmlDocument() {} + + /** Load a file using the current document value. + Returns true if successful. Will delete any existing + document data before loading. + */ + bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); + /// Save a file using the current document value. Returns true if successful. + bool SaveFile() const; + /// Load a file using the given filename. Returns true if successful. + bool LoadFile( const char* filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); + /// Save a file using the given filename. Returns true if successful. + bool SaveFile( const char* filename ) const; + /** Load a file using the given FILE*. Returns true if successful. Note that this method + doesn't stream - the entire object pointed at by the FILE* + will be interpreted as an XML file. TinyXML doesn't stream in XML from the current + file location. Streaming may be added in the future. + */ + bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); + /// Save a file using the given FILE*. Returns true if successful. + bool SaveFile( FILE* ) const; + +#ifdef TIXML_USE_STL + bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ) ///< STL std::string version. + { + return LoadFile( filename.c_str(), encoding ); + } + bool SaveFile( const std::string& filename ) const ///< STL std::string version. + { + return SaveFile( filename.c_str() ); + } +#endif + + /** Parse the given null terminated block of xml data. Passing in an encoding to this + method (either TIXML_ENCODING_LEGACY or TIXML_ENCODING_UTF8 will force TinyXml + to use that encoding, regardless of what TinyXml might otherwise try to detect. + */ + virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); + + /** Get the root element -- the only top level element -- of the document. + In well formed XML, there should only be one. TinyXml is tolerant of + multiple elements at the document level. + */ + const TiXmlElement* RootElement() const { return FirstChildElement(); } + TiXmlElement* RootElement() { return FirstChildElement(); } + + /** If an error occurs, Error will be set to true. Also, + - The ErrorId() will contain the integer identifier of the error (not generally useful) + - The ErrorDesc() method will return the name of the error. (very useful) + - The ErrorRow() and ErrorCol() will return the location of the error (if known) + */ + bool Error() const { return error; } + + /// Contains a textual (english) description of the error if one occurs. + const char* ErrorDesc() const { return errorDesc.c_str (); } + + /** Generally, you probably want the error string ( ErrorDesc() ). But if you + prefer the ErrorId, this function will fetch it. + */ + int ErrorId() const { return errorId; } + + /** Returns the location (if known) of the error. The first column is column 1, + and the first row is row 1. A value of 0 means the row and column wasn't applicable + (memory errors, for example, have no row/column) or the parser lost the error. (An + error in the error reporting, in that case.) + + @sa SetTabSize, Row, Column + */ + int ErrorRow() const { return errorLocation.row+1; } + int ErrorCol() const { return errorLocation.col+1; } ///< The column where the error occured. See ErrorRow() + + /** SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol()) + to report the correct values for row and column. It does not change the output + or input in any way. + + By calling this method, with a tab size + greater than 0, the row and column of each node and attribute is stored + when the file is loaded. Very useful for tracking the DOM back in to + the source file. + + The tab size is required for calculating the location of nodes. If not + set, the default of 4 is used. The tabsize is set per document. Setting + the tabsize to 0 disables row/column tracking. + + Note that row and column tracking is not supported when using operator>>. + + The tab size needs to be enabled before the parse or load. Correct usage: + @verbatim + TiXmlDocument doc; + doc.SetTabSize( 8 ); + doc.Load( "myfile.xml" ); + @endverbatim + + @sa Row, Column + */ + void SetTabSize( int _tabsize ) { tabsize = _tabsize; } + + int TabSize() const { return tabsize; } + + /** If you have handled the error, it can be reset with this call. The error + state is automatically cleared if you Parse a new XML block. + */ + void ClearError() + { + error = false; + errorId = 0; + errorDesc = ""; + errorLocation.row = errorLocation.col = 0; + //errorLocation.last = 0; + } + + /** Write the document to standard out using formatted printing ("pretty print"). */ + void Print() const { Print( stdout, 0 ); } + + /* Write the document to a string using formatted printing ("pretty print"). This + will allocate a character array (new char[]) and return it as a pointer. The + calling code pust call delete[] on the return char* to avoid a memory leak. + */ + //char* PrintToMemory() const; + + /// Print this Document to a FILE stream. + virtual void Print( FILE* cfile, int depth = 0 ) const; + // [internal use] + void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding ); + + virtual const TiXmlDocument* ToDocument() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXmlDocument* ToDocument() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* content ) const; protected : - // [internal use] - virtual TiXmlNode* Clone() const; - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif + // [internal use] + virtual TiXmlNode* Clone() const; +#ifdef TIXML_USE_STL + virtual void StreamIn( std::istream* in, TIXML_STRING* tag ); +#endif private: - void CopyTo( TiXmlDocument* target ) const; - - bool error; - int errorId; - TIXML_STRING errorDesc; - int tabsize; - TiXmlCursor errorLocation; - bool useMicrosoftBOM; // the UTF-8 BOM were found when read. Note this, and try to write. + void CopyTo( TiXmlDocument* target ) const; + + bool error; + int errorId; + TIXML_STRING errorDesc; + int tabsize; + TiXmlCursor errorLocation; + bool useMicrosoftBOM; // the UTF-8 BOM were found when read. Note this, and try to write. }; @@ -1563,7 +1586,7 @@ private: <Document> @endverbatim - Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very + Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very easy to write a *lot* of code that looks like: @verbatim @@ -1583,7 +1606,7 @@ private: @endverbatim And that doesn't even cover "else" cases. TiXmlHandle addresses the verbosity - of such code. A TiXmlHandle checks for null pointers so it is perfectly safe + of such code. A TiXmlHandle checks for null pointers so it is perfectly safe and correct to use: @verbatim @@ -1604,7 +1627,7 @@ private: What they should not be used for is iteration: @verbatim - int i=0; + int i=0; while ( true ) { TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).ToElement(); @@ -1615,8 +1638,8 @@ private: } @endverbatim - It seems reasonable, but it is in fact two embedded while loops. The Child method is - a linear walk to find the element, so this code would iterate much more than it needs + It seems reasonable, but it is in fact two embedded while loops. The Child method is + a linear walk to find the element, so this code would iterate much more than it needs to. Instead, prefer: @verbatim @@ -1631,80 +1654,80 @@ private: class TiXmlHandle { public: - /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. - TiXmlHandle( TiXmlNode* _node ) { this->node = _node; } - /// Copy constructor - TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; } - TiXmlHandle operator=( const TiXmlHandle& ref ) { this->node = ref.node; return *this; } - - /// Return a handle to the first child node. - TiXmlHandle FirstChild() const; - /// Return a handle to the first child node with the given name. - TiXmlHandle FirstChild( const char * value ) const; - /// Return a handle to the first child element. - TiXmlHandle FirstChildElement() const; - /// Return a handle to the first child element with the given name. - TiXmlHandle FirstChildElement( const char * value ) const; - - /** Return a handle to the "index" child with the given name. - The first child is 0, the second 1, etc. - */ - TiXmlHandle Child( const char* value, int index ) const; - /** Return a handle to the "index" child. - The first child is 0, the second 1, etc. - */ - TiXmlHandle Child( int index ) const; - /** Return a handle to the "index" child element with the given name. - The first child element is 0, the second 1, etc. Note that only TiXmlElements - are indexed: other types are not counted. - */ - TiXmlHandle ChildElement( const char* value, int index ) const; - /** Return a handle to the "index" child element. - The first child element is 0, the second 1, etc. Note that only TiXmlElements - are indexed: other types are not counted. - */ - TiXmlHandle ChildElement( int index ) const; - - #ifdef TIXML_USE_STL - TiXmlHandle FirstChild( const std::string& _value ) const { return FirstChild( _value.c_str() ); } - TiXmlHandle FirstChildElement( const std::string& _value ) const { return FirstChildElement( _value.c_str() ); } - - TiXmlHandle Child( const std::string& _value, int index ) const { return Child( _value.c_str(), index ); } - TiXmlHandle ChildElement( const std::string& _value, int index ) const { return ChildElement( _value.c_str(), index ); } - #endif - - /** Return the handle as a TiXmlNode. This may return null. - */ - TiXmlNode* ToNode() const { return node; } - /** Return the handle as a TiXmlElement. This may return null. - */ - TiXmlElement* ToElement() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); } - /** Return the handle as a TiXmlText. This may return null. - */ - TiXmlText* ToText() const { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); } - /** Return the handle as a TiXmlUnknown. This may return null. - */ - TiXmlUnknown* ToUnknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); } - - /** @deprecated use ToNode. - Return the handle as a TiXmlNode. This may return null. - */ - TiXmlNode* Node() const { return ToNode(); } - /** @deprecated use ToElement. - Return the handle as a TiXmlElement. This may return null. - */ - TiXmlElement* Element() const { return ToElement(); } - /** @deprecated use ToText() - Return the handle as a TiXmlText. This may return null. - */ - TiXmlText* Text() const { return ToText(); } - /** @deprecated use ToUnknown() - Return the handle as a TiXmlUnknown. This may return null. - */ - TiXmlUnknown* Unknown() const { return ToUnknown(); } + /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. + TiXmlHandle( TiXmlNode* _node ) { this->node = _node; } + /// Copy constructor + TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; } + TiXmlHandle operator=( const TiXmlHandle& ref ) { this->node = ref.node; return *this; } + + /// Return a handle to the first child node. + TiXmlHandle FirstChild() const; + /// Return a handle to the first child node with the given name. + TiXmlHandle FirstChild( const char* value ) const; + /// Return a handle to the first child element. + TiXmlHandle FirstChildElement() const; + /// Return a handle to the first child element with the given name. + TiXmlHandle FirstChildElement( const char* value ) const; + + /** Return a handle to the "index" child with the given name. + The first child is 0, the second 1, etc. + */ + TiXmlHandle Child( const char* value, int index ) const; + /** Return a handle to the "index" child. + The first child is 0, the second 1, etc. + */ + TiXmlHandle Child( int index ) const; + /** Return a handle to the "index" child element with the given name. + The first child element is 0, the second 1, etc. Note that only TiXmlElements + are indexed: other types are not counted. + */ + TiXmlHandle ChildElement( const char* value, int index ) const; + /** Return a handle to the "index" child element. + The first child element is 0, the second 1, etc. Note that only TiXmlElements + are indexed: other types are not counted. + */ + TiXmlHandle ChildElement( int index ) const; + +#ifdef TIXML_USE_STL + TiXmlHandle FirstChild( const std::string& _value ) const { return FirstChild( _value.c_str() ); } + TiXmlHandle FirstChildElement( const std::string& _value ) const { return FirstChildElement( _value.c_str() ); } + + TiXmlHandle Child( const std::string& _value, int index ) const { return Child( _value.c_str(), index ); } + TiXmlHandle ChildElement( const std::string& _value, int index ) const { return ChildElement( _value.c_str(), index ); } +#endif + + /** Return the handle as a TiXmlNode. This may return null. + */ + TiXmlNode* ToNode() const { return node; } + /** Return the handle as a TiXmlElement. This may return null. + */ + TiXmlElement* ToElement() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); } + /** Return the handle as a TiXmlText. This may return null. + */ + TiXmlText* ToText() const { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); } + /** Return the handle as a TiXmlUnknown. This may return null. + */ + TiXmlUnknown* ToUnknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); } + + /** @deprecated use ToNode. + Return the handle as a TiXmlNode. This may return null. + */ + TiXmlNode* Node() const { return ToNode(); } + /** @deprecated use ToElement. + Return the handle as a TiXmlElement. This may return null. + */ + TiXmlElement* Element() const { return ToElement(); } + /** @deprecated use ToText() + Return the handle as a TiXmlText. This may return null. + */ + TiXmlText* Text() const { return ToText(); } + /** @deprecated use ToUnknown() + Return the handle as a TiXmlUnknown. This may return null. + */ + TiXmlUnknown* Unknown() const { return ToUnknown(); } private: - TiXmlNode* node; + TiXmlNode* node; }; @@ -1730,64 +1753,68 @@ private: class TiXmlPrinter : public TiXmlVisitor { public: - TiXmlPrinter() : depth( 0 ), simpleTextPrint( false ), - buffer(), indent( " " ), lineBreak( "\n" ) {} - - virtual bool VisitEnter( const TiXmlDocument& doc ); - virtual bool VisitExit( const TiXmlDocument& doc ); - - virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute ); - virtual bool VisitExit( const TiXmlElement& element ); - - virtual bool Visit( const TiXmlDeclaration& declaration ); - virtual bool Visit( const TiXmlText& text ); - virtual bool Visit( const TiXmlComment& comment ); - virtual bool Visit( const TiXmlUnknown& unknown ); - - /** Set the indent characters for printing. By default 4 spaces - but tab (\t) is also useful, or null/empty string for no indentation. - */ - void SetIndent( const char* _indent ) { indent = _indent ? _indent : "" ; } - /// Query the indention string. - const char* Indent() { return indent.c_str(); } - /** Set the line breaking string. By default set to newline (\n). - Some operating systems prefer other characters, or can be - set to the null/empty string for no indenation. - */ - void SetLineBreak( const char* _lineBreak ) { lineBreak = _lineBreak ? _lineBreak : ""; } - /// Query the current line breaking string. - const char* LineBreak() { return lineBreak.c_str(); } - - /** Switch over to "stream printing" which is the most dense formatting without - linebreaks. Common when the XML is needed for network transmission. - */ - void SetStreamPrinting() { indent = ""; - lineBreak = ""; - } - /// Return the result. - const char* CStr() { return buffer.c_str(); } - /// Return the length of the result string. - size_t Size() { return buffer.size(); } - - #ifdef TIXML_USE_STL - /// Return the result. - const std::string& Str() { return buffer; } - #endif + TiXmlPrinter() : depth( 0 ), simpleTextPrint( false ), + buffer(), indent( " " ), lineBreak( "\n" ) {} + + virtual bool VisitEnter( const TiXmlDocument& doc ); + virtual bool VisitExit( const TiXmlDocument& doc ); + + virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute ); + virtual bool VisitExit( const TiXmlElement& element ); + + virtual bool Visit( const TiXmlDeclaration& declaration ); + virtual bool Visit( const TiXmlText& text ); + virtual bool Visit( const TiXmlComment& comment ); + virtual bool Visit( const TiXmlUnknown& unknown ); + + /** Set the indent characters for printing. By default 4 spaces + but tab (\t) is also useful, or null/empty string for no indentation. + */ + void SetIndent( const char* _indent ) { indent = _indent ? _indent : "" ; } + /// Query the indention string. + const char* Indent() { return indent.c_str(); } + /** Set the line breaking string. By default set to newline (\n). + Some operating systems prefer other characters, or can be + set to the null/empty string for no indenation. + */ + void SetLineBreak( const char* _lineBreak ) { lineBreak = _lineBreak ? _lineBreak : ""; } + /// Query the current line breaking string. + const char* LineBreak() { return lineBreak.c_str(); } + + /** Switch over to "stream printing" which is the most dense formatting without + linebreaks. Common when the XML is needed for network transmission. + */ + void SetStreamPrinting() + { + indent = ""; + lineBreak = ""; + } + /// Return the result. + const char* CStr() { return buffer.c_str(); } + /// Return the length of the result string. + size_t Size() { return buffer.size(); } -private: - void DoIndent() { - for( int i=0; i<depth; ++i ) - buffer += indent; - } - void DoLineBreak() { - buffer += lineBreak; - } +#ifdef TIXML_USE_STL + /// Return the result. + const std::string& Str() { return buffer; } +#endif - int depth; - bool simpleTextPrint; - TIXML_STRING buffer; - TIXML_STRING indent; - TIXML_STRING lineBreak; +private: + void DoIndent() + { + for( int i=0; i<depth; ++i ) + buffer += indent; + } + void DoLineBreak() + { + buffer += lineBreak; + } + + int depth; + bool simpleTextPrint; + TIXML_STRING buffer; + TIXML_STRING indent; + TIXML_STRING lineBreak; }; diff --git a/shared/tinyxml/tinyxmlparser.cpp b/shared/tinyxml/tinyxmlparser.cpp index 92bee64d..ea691fd4 100644 --- a/shared/tinyxml/tinyxmlparser.cpp +++ b/shared/tinyxml/tinyxmlparser.cpp @@ -110,21 +110,21 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng // Scary scary fall throughs. switch (*length) { - case 4: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - case 3: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - case 2: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - case 1: - --output; - *output = (char)(input | FIRST_BYTE_MARK[*length]); + case 4: + --output; + *output = (char)((input | BYTE_MARK) & BYTE_MASK); + input >>= 6; + case 3: + --output; + *output = (char)((input | BYTE_MARK) & BYTE_MASK); + input >>= 6; + case 2: + --output; + *output = (char)((input | BYTE_MARK) & BYTE_MASK); + input >>= 6; + case 1: + --output; + *output = (char)(input | FIRST_BYTE_MARK[*length]); } } @@ -136,17 +136,17 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng // to figure out alhabetical vs. not across encoding. So take a very // conservative approach. -// if ( encoding == TIXML_ENCODING_UTF8 ) -// { + // if ( encoding == TIXML_ENCODING_UTF8 ) + // { if ( anyByte < 127 ) return isalpha( anyByte ); else return 1; // What else to do? The unicode set is huge...get the english ones right. -// } -// else -// { -// return isalpha( anyByte ); -// } + // } + // else + // { + // return isalpha( anyByte ); + // } } @@ -157,17 +157,17 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng // to figure out alhabetical vs. not across encoding. So take a very // conservative approach. -// if ( encoding == TIXML_ENCODING_UTF8 ) -// { + // if ( encoding == TIXML_ENCODING_UTF8 ) + // { if ( anyByte < 127 ) return isalnum( anyByte ); else return 1; // What else to do? The unicode set is huge...get the english ones right. -// } -// else -// { -// return isalnum( anyByte ); -// } + // } + // else + // { + // return isalnum( anyByte ); + // } } @@ -223,95 +223,95 @@ void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding ) // Code contributed by Fletcher Dunn: (modified by lee) switch (*pU) { - case 0: - // We *should* never get here, but in case we do, don't - // advance past the terminating null character, ever - return; - - case '\r': - // bump down to the next line - ++row; - col = 0; - // Eat the character - ++p; + case 0: + // We *should* never get here, but in case we do, don't + // advance past the terminating null character, ever + return; - // Check for \r\n sequence, and treat this as a single character - if (*p == '\n') - { + case '\r': + // bump down to the next line + ++row; + col = 0; + // Eat the character ++p; - } - break; - case '\n': - // bump down to the next line - ++row; - col = 0; + // Check for \r\n sequence, and treat this as a single character + if (*p == '\n') + { + ++p; + } + break; - // Eat the character - ++p; + case '\n': + // bump down to the next line + ++row; + col = 0; - // Check for \n\r sequence, and treat this as a single - // character. (Yes, this bizarre thing does occur still - // on some arcane platforms...) - if (*p == '\r') - { + // Eat the character ++p; - } - break; - case '\t': - // Eat the character - ++p; + // Check for \n\r sequence, and treat this as a single + // character. (Yes, this bizarre thing does occur still + // on some arcane platforms...) + if (*p == '\r') + { + ++p; + } + break; - // Skip to next tab stop - col = (col / tabsize + 1) * tabsize; - break; + case '\t': + // Eat the character + ++p; - case TIXML_UTF_LEAD_0: - if ( encoding == TIXML_ENCODING_UTF8 ) - { - if ( *(p+1) && *(p+2) ) + // Skip to next tab stop + col = (col / tabsize + 1) * tabsize; + break; + + case TIXML_UTF_LEAD_0: + if ( encoding == TIXML_ENCODING_UTF8 ) { - // In these cases, don't advance the column. These are - // 0-width spaces. - if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 ) - p += 3; - else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU ) - p += 3; - else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU ) - p += 3; - else + if ( *(p+1) && *(p+2) ) { - p +=3; // A normal character. - ++col; + // In these cases, don't advance the column. These are + // 0-width spaces. + if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 ) + p += 3; + else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU ) + p += 3; + else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU ) + p += 3; + else + { + p +=3; // A normal character. + ++col; + } } } - } - else - { - ++p; - ++col; - } - break; + else + { + ++p; + ++col; + } + break; - default: - if ( encoding == TIXML_ENCODING_UTF8 ) - { - // Eat the 1 to 4 byte utf8 character. - int step = TiXmlBase::utf8ByteTable[*((const unsigned char*)p)]; - if ( step == 0 ) - step = 1; // Error case from bad encoding, but handle gracefully. - p += step; - - // Just advance one column, of course. - ++col; - } - else - { - ++p; - ++col; - } - break; + default: + if ( encoding == TIXML_ENCODING_UTF8 ) + { + // Eat the 1 to 4 byte utf8 character. + int step = TiXmlBase::utf8ByteTable[*((const unsigned char*)p)]; + if ( step == 0 ) + step = 1; // Error case from bad encoding, but handle gracefully. + p += step; + + // Just advance one column, of course. + ++col; + } + else + { + ++p; + ++col; + } + break; } } cursor.row = row; @@ -374,7 +374,7 @@ const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding ) } #ifdef TIXML_USE_STL -/*static*/ bool TiXmlBase::StreamWhiteSpace( std::istream * in, TIXML_STRING * tag ) +/*static*/ bool TiXmlBase::StreamWhiteSpace( std::istream* in, TIXML_STRING* tag ) { for( ;; ) { @@ -389,7 +389,7 @@ const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding ) } } -/*static*/ bool TiXmlBase::StreamTo( std::istream * in, int character, TIXML_STRING * tag ) +/*static*/ bool TiXmlBase::StreamTo( std::istream* in, int character, TIXML_STRING* tag ) { //assert( character > 0 && character < 128 ); // else it won't work in utf-8 while ( in->good() ) @@ -410,7 +410,7 @@ const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding ) // One of TinyXML's more performance demanding functions. Try to keep the memory overhead down. The // "assign" optimization removes over 10% of the execution time. // -const char* TiXmlBase::ReadName( const char* p, TIXML_STRING * name, TiXmlEncoding encoding ) +const char* TiXmlBase::ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding ) { // Oddly, not supported on some comilers, //name->clear(); @@ -425,8 +425,8 @@ const char* TiXmlBase::ReadName( const char* p, TIXML_STRING * name, TiXmlEncodi // After that, they can be letters, underscores, numbers, // hyphens, or colons. (Colons are valid ony for namespaces, // but tinyxml can't tell namespaces from names.) - if ( p && *p - && ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) ) + if (p && *p + && ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) ) { const char* start = p; while( p && *p @@ -585,15 +585,15 @@ bool TiXmlBase::StringEqual( const char* p, } const char* TiXmlBase::ReadText( const char* p, - TIXML_STRING * text, + TIXML_STRING* text, bool trimWhiteSpace, const char* endTag, bool caseInsensitive, TiXmlEncoding encoding ) { *text = ""; - if ( !trimWhiteSpace // certain tags always keep whitespace - || !condenseWhiteSpace ) // if true, whitespace is always kept + if (!trimWhiteSpace // certain tags always keep whitespace + || !condenseWhiteSpace ) // if true, whitespace is always kept { // Keep all the white space. while ( p && *p @@ -651,7 +651,7 @@ const char* TiXmlBase::ReadText( const char* p, #ifdef TIXML_USE_STL -void TiXmlDocument::StreamIn( std::istream * in, TIXML_STRING * tag ) +void TiXmlDocument::StreamIn( std::istream* in, TIXML_STRING* tag ) { // The basic issue with a document is that we don't know what we're // streaming. Read something presumed to be a tag (and hope), then @@ -778,8 +778,8 @@ const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiX } // Did we get encoding info? - if ( encoding == TIXML_ENCODING_UNKNOWN - && node->ToDeclaration() ) + if (encoding == TIXML_ENCODING_UNKNOWN + && node->ToDeclaration() ) { TiXmlDeclaration* dec = node->ToDeclaration(); const char* enc = dec->Encoding(); @@ -888,8 +888,8 @@ TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding ) #endif returnNode = new TiXmlUnknown(); } - else if ( IsAlpha( *(p+1), encoding ) - || *(p+1) == '_' ) + else if (IsAlpha( *(p+1), encoding ) + || *(p+1) == '_' ) { #ifdef DEBUG_PARSER TIXML_LOG( "XML parsing Element\n" ); @@ -914,7 +914,7 @@ TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding ) #ifdef TIXML_USE_STL -void TiXmlElement::StreamIn (std::istream * in, TIXML_STRING * tag) +void TiXmlElement::StreamIn (std::istream* in, TIXML_STRING* tag) { // We're called with some amount of pre-parsing. That is, some of "this" // element is in "tag". Go ahead and stream to the closing ">" @@ -939,8 +939,8 @@ void TiXmlElement::StreamIn (std::istream * in, TIXML_STRING * tag) // Okay...if we are a "/>" tag, then we're done. We've read a complete tag. // If not, identify and stream. - if ( tag->at( tag->length() - 1 ) == '>' - && tag->at( tag->length() - 2 ) == '/' ) + if (tag->at( tag->length() - 1 ) == '>' + && tag->at( tag->length() - 2 ) == '/' ) { // All good! return; @@ -1265,7 +1265,7 @@ const char* TiXmlElement::ReadValue( const char* p, TiXmlParsingData* data, TiXm #ifdef TIXML_USE_STL -void TiXmlUnknown::StreamIn( std::istream * in, TIXML_STRING * tag ) +void TiXmlUnknown::StreamIn( std::istream* in, TIXML_STRING* tag ) { while ( in->good() ) { @@ -1323,7 +1323,7 @@ const char* TiXmlUnknown::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc } #ifdef TIXML_USE_STL -void TiXmlComment::StreamIn( std::istream * in, TIXML_STRING * tag ) +void TiXmlComment::StreamIn( std::istream* in, TIXML_STRING* tag ) { while ( in->good() ) { @@ -1339,8 +1339,8 @@ void TiXmlComment::StreamIn( std::istream * in, TIXML_STRING * tag ) (*tag) += (char) c; if ( c == '>' - && tag->at( tag->length() - 2 ) == '-' - && tag->at( tag->length() - 3 ) == '-' ) + && tag->at( tag->length() - 2 ) == '-' + && tag->at( tag->length() - 3 ) == '-' ) { // All is well. return; @@ -1479,7 +1479,7 @@ const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlE } #ifdef TIXML_USE_STL -void TiXmlText::StreamIn( std::istream * in, TIXML_STRING * tag ) +void TiXmlText::StreamIn( std::istream* in, TIXML_STRING* tag ) { while ( in->good() ) { @@ -1563,7 +1563,7 @@ const char* TiXmlText::Parse( const char* p, TiXmlParsingData* data, TiXmlEncodi } #ifdef TIXML_USE_STL -void TiXmlDeclaration::StreamIn( std::istream * in, TIXML_STRING * tag ) +void TiXmlDeclaration::StreamIn( std::istream* in, TIXML_STRING* tag ) { while ( in->good() ) { diff --git a/shared/tinyxml/xmltest.cpp b/shared/tinyxml/xmltest.cpp index 7cd6faca..b4d3551c 100644 --- a/shared/tinyxml/xmltest.cpp +++ b/shared/tinyxml/xmltest.cpp @@ -4,17 +4,17 @@ #ifdef TIXML_USE_STL - #include <iostream> - #include <sstream> - using namespace std; +#include <iostream> +#include <sstream> +using namespace std; #else - #include <stdio.h> +#include <stdio.h> #endif #if defined( WIN32 ) && defined( TUNE ) - #include <crtdbg.h> - _CrtMemState startMemState; - _CrtMemState endMemState; +#include <crtdbg.h> +_CrtMemState startMemState; +_CrtMemState endMemState; #endif #include "tinyxml.h" @@ -29,43 +29,43 @@ static int gFail = 0; bool XmlTest (const char* testString, const char* expected, const char* found, bool noEcho ) { - bool pass = !strcmp( expected, found ); - if ( pass ) - printf ("[pass]"); - else - printf ("[fail]"); - - if ( noEcho ) - printf (" %s\n", testString); - else - printf (" %s [%s][%s]\n", testString, expected, found); - - if ( pass ) - ++gPass; - else - ++gFail; - return pass; + bool pass = !strcmp( expected, found ); + if ( pass ) + printf ("[pass]"); + else + printf ("[fail]"); + + if ( noEcho ) + printf (" %s\n", testString); + else + printf (" %s [%s][%s]\n", testString, expected, found); + + if ( pass ) + ++gPass; + else + ++gFail; + return pass; } bool XmlTest( const char* testString, int expected, int found, bool noEcho ) { - bool pass = ( expected == found ); - if ( pass ) - printf ("[pass]"); - else - printf ("[fail]"); - - if ( noEcho ) - printf (" %s\n", testString); - else - printf (" %s [%d][%d]\n", testString, expected, found); - - if ( pass ) - ++gPass; - else - ++gFail; - return pass; + bool pass = ( expected == found ); + if ( pass ) + printf ("[pass]"); + else + printf ("[fail]"); + + if ( noEcho ) + printf (" %s\n", testString); + else + printf (" %s [%d][%d]\n", testString, expected, found); + + if ( pass ) + ++gPass; + else + ++gFail; + return pass; } @@ -79,910 +79,914 @@ bool XmlTest( const char* testString, int expected, int found, bool noEcho ) int main() { - // - // We start with the 'demoStart' todo list. Process it. And - // should hopefully end up with the todo list as illustrated. - // - const char* demoStart = - "<?xml version=\"1.0\" standalone='no' >\n" - "<!-- Our to do list data -->" - "<ToDo>\n" - "<!-- Do I need a secure PDA? -->\n" - "<Item priority=\"1\" distance='close'> Go to the <bold>Toy store!</bold></Item>" - "<Item priority=\"2\" distance='none'> Do bills </Item>" - "<Item priority=\"2\" distance='far & back'> Look for Evil Dinosaurs! </Item>" - "</ToDo>"; - - { - - #ifdef TIXML_USE_STL - // What the todo list should look like after processing. - // In stream (no formatting) representation. - const char* demoEnd = - "<?xml version=\"1.0\" standalone=\"no\" ?>" - "<!-- Our to do list data -->" - "<ToDo>" - "<!-- Do I need a secure PDA? -->" - "<Item priority=\"2\" distance=\"close\">Go to the" - "<bold>Toy store!" - "</bold>" - "</Item>" - "<Item priority=\"1\" distance=\"far\">Talk to:" - "<Meeting where=\"School\">" - "<Attendee name=\"Marple\" position=\"teacher\" />" - "<Attendee name=\"Voel\" position=\"counselor\" />" - "</Meeting>" - "<Meeting where=\"Lunch\" />" - "</Item>" - "<Item priority=\"2\" distance=\"here\">Do bills" - "</Item>" - "</ToDo>"; - #endif - - // The example parses from the character string (above): - #if defined( WIN32 ) && defined( TUNE ) - _CrtMemCheckpoint( &startMemState ); - #endif - - { - // Write to a file and read it back, to check file I/O. - - TiXmlDocument doc( "demotest.xml" ); - doc.Parse( demoStart ); - - if ( doc.Error() ) - { - printf( "Error in %s: %s\n", doc.Value(), doc.ErrorDesc() ); - exit( 1 ); - } - doc.SaveFile(); - } - - TiXmlDocument doc( "demotest.xml" ); - bool loadOkay = doc.LoadFile(); - - if ( !loadOkay ) - { - printf( "Could not load test file 'demotest.xml'. Error='%s'. Exiting.\n", doc.ErrorDesc() ); - exit( 1 ); - } - - printf( "** Demo doc read from disk: ** \n\n" ); - printf( "** Printing via doc.Print **\n" ); - doc.Print( stdout ); - - { - printf( "** Printing via TiXmlPrinter **\n" ); - TiXmlPrinter printer; - doc.Accept( &printer ); - fprintf( stdout, "%s", printer.CStr() ); - } - #ifdef TIXML_USE_STL - { - printf( "** Printing via operator<< **\n" ); - std::cout << doc; - } - #endif - TiXmlNode* node = 0; - TiXmlElement* todoElement = 0; - TiXmlElement* itemElement = 0; - - - // -------------------------------------------------------- - // An example of changing existing attributes, and removing - // an element from the document. - // -------------------------------------------------------- - - // Get the "ToDo" element. - // It is a child of the document, and can be selected by name. - node = doc.FirstChild( "ToDo" ); - assert( node ); - todoElement = node->ToElement(); - assert( todoElement ); - - // Going to the toy store is now our second priority... - // So set the "priority" attribute of the first item in the list. - node = todoElement->FirstChildElement(); // This skips the "PDA" comment. - assert( node ); - itemElement = node->ToElement(); - assert( itemElement ); - itemElement->SetAttribute( "priority", 2 ); - - // Change the distance to "doing bills" from - // "none" to "here". It's the next sibling element. - itemElement = itemElement->NextSiblingElement(); - assert( itemElement ); - itemElement->SetAttribute( "distance", "here" ); - - // Remove the "Look for Evil Dinosaurs!" item. - // It is 1 more sibling away. We ask the parent to remove - // a particular child. - itemElement = itemElement->NextSiblingElement(); - todoElement->RemoveChild( itemElement ); - - itemElement = 0; - - // -------------------------------------------------------- - // What follows is an example of created elements and text - // nodes and adding them to the document. - // -------------------------------------------------------- - - // Add some meetings. - TiXmlElement item( "Item" ); - item.SetAttribute( "priority", "1" ); - item.SetAttribute( "distance", "far" ); - - TiXmlText text( "Talk to:" ); - - TiXmlElement meeting1( "Meeting" ); - meeting1.SetAttribute( "where", "School" ); - - TiXmlElement meeting2( "Meeting" ); - meeting2.SetAttribute( "where", "Lunch" ); - - TiXmlElement attendee1( "Attendee" ); - attendee1.SetAttribute( "name", "Marple" ); - attendee1.SetAttribute( "position", "teacher" ); - - TiXmlElement attendee2( "Attendee" ); - attendee2.SetAttribute( "name", "Voel" ); - attendee2.SetAttribute( "position", "counselor" ); - - // Assemble the nodes we've created: - meeting1.InsertEndChild( attendee1 ); - meeting1.InsertEndChild( attendee2 ); - - item.InsertEndChild( text ); - item.InsertEndChild( meeting1 ); - item.InsertEndChild( meeting2 ); - - // And add the node to the existing list after the first child. - node = todoElement->FirstChild( "Item" ); - assert( node ); - itemElement = node->ToElement(); - assert( itemElement ); - - todoElement->InsertAfterChild( itemElement, item ); - - printf( "\n** Demo doc processed: ** \n\n" ); - doc.Print( stdout ); - - - #ifdef TIXML_USE_STL - printf( "** Demo doc processed to stream: ** \n\n" ); - cout << doc << endl << endl; - #endif - - // -------------------------------------------------------- - // Different tests...do we have what we expect? - // -------------------------------------------------------- - - int count = 0; - TiXmlElement* element; - - ////////////////////////////////////////////////////// - - #ifdef TIXML_USE_STL - cout << "** Basic structure. **\n"; - ostringstream outputStream( ostringstream::out ); - outputStream << doc; - XmlTest( "Output stream correct.", string( demoEnd ).c_str(), - outputStream.str().c_str(), true ); - #endif - - node = doc.RootElement(); - assert( node ); - XmlTest( "Root element exists.", true, ( node != 0 && node->ToElement() ) ); - XmlTest ( "Root element value is 'ToDo'.", "ToDo", node->Value()); - - node = node->FirstChild(); - XmlTest( "First child exists & is a comment.", true, ( node != 0 && node->ToComment() ) ); - node = node->NextSibling(); - XmlTest( "Sibling element exists & is an element.", true, ( node != 0 && node->ToElement() ) ); - XmlTest ( "Value is 'Item'.", "Item", node->Value() ); - - node = node->FirstChild(); - XmlTest ( "First child exists.", true, ( node != 0 && node->ToText() ) ); - XmlTest ( "Value is 'Go to the'.", "Go to the", node->Value() ); - - - ////////////////////////////////////////////////////// - printf ("\n** Iterators. **\n"); - - // Walk all the top level nodes of the document. - count = 0; - for( node = doc.FirstChild(); - node; - node = node->NextSibling() ) - { - count++; - } - XmlTest( "Top level nodes, using First / Next.", 3, count ); - - count = 0; - for( node = doc.LastChild(); - node; - node = node->PreviousSibling() ) - { - count++; - } - XmlTest( "Top level nodes, using Last / Previous.", 3, count ); - - // Walk all the top level nodes of the document, - // using a different syntax. - count = 0; - for( node = doc.IterateChildren( 0 ); - node; - node = doc.IterateChildren( node ) ) - { - count++; - } - XmlTest( "Top level nodes, using IterateChildren.", 3, count ); - - // Walk all the elements in a node. - count = 0; - for( element = todoElement->FirstChildElement(); - element; - element = element->NextSiblingElement() ) - { - count++; - } - XmlTest( "Children of the 'ToDo' element, using First / Next.", - 3, count ); - - // Walk all the elements in a node by value. - count = 0; - for( node = todoElement->FirstChild( "Item" ); - node; - node = node->NextSibling( "Item" ) ) - { - count++; - } - XmlTest( "'Item' children of the 'ToDo' element, using First/Next.", 3, count ); - - count = 0; - for( node = todoElement->LastChild( "Item" ); - node; - node = node->PreviousSibling( "Item" ) ) - { - count++; - } - XmlTest( "'Item' children of the 'ToDo' element, using Last/Previous.", 3, count ); - - #ifdef TIXML_USE_STL - { - cout << "\n** Parsing. **\n"; - istringstream parse0( "<Element0 attribute0='foo0' attribute1= noquotes attribute2 = '>' />" ); - TiXmlElement element0( "default" ); - parse0 >> element0; - - XmlTest ( "Element parsed, value is 'Element0'.", "Element0", element0.Value() ); - XmlTest ( "Reads attribute 'attribute0=\"foo0\"'.", "foo0", element0.Attribute( "attribute0" )); - XmlTest ( "Reads incorrectly formatted 'attribute1=noquotes'.", "noquotes", element0.Attribute( "attribute1" ) ); - XmlTest ( "Read attribute with entity value '>'.", ">", element0.Attribute( "attribute2" ) ); - } - #endif - - { - const char* error = "<?xml version=\"1.0\" standalone=\"no\" ?>\n" - "<passages count=\"006\" formatversion=\"20020620\">\n" - " <wrong error>\n" - "</passages>"; - - TiXmlDocument docTest; - docTest.Parse( error ); - XmlTest( "Error row", docTest.ErrorRow(), 3 ); - XmlTest( "Error column", docTest.ErrorCol(), 17 ); - //printf( "error=%d id='%s' row %d col%d\n", (int) doc.Error(), doc.ErrorDesc(), doc.ErrorRow()+1, doc.ErrorCol() + 1 ); - - } - - #ifdef TIXML_USE_STL - { - ////////////////////////////////////////////////////// - cout << "\n** Streaming. **\n"; - - // Round trip check: stream in, then stream back out to verify. The stream - // out has already been checked, above. We use the output - - istringstream inputStringStream( outputStream.str() ); - TiXmlDocument document0; - - inputStringStream >> document0; - - ostringstream outputStream0( ostringstream::out ); - outputStream0 << document0; - - XmlTest( "Stream round trip correct.", string( demoEnd ).c_str(), - outputStream0.str().c_str(), true ); - - std::string str; - str << document0; - - XmlTest( "String printing correct.", string( demoEnd ).c_str(), - str.c_str(), true ); - } - #endif - } - - { - const char* str = "<doc attr0='1' attr1='2.0' attr2='foo' />"; - - TiXmlDocument doc; - doc.Parse( str ); - - TiXmlElement* ele = doc.FirstChildElement(); - - int iVal, result; - double dVal; - - result = ele->QueryDoubleAttribute( "attr0", &dVal ); - XmlTest( "Query attribute: int as double", result, TIXML_SUCCESS ); - XmlTest( "Query attribute: int as double", (int)dVal, 1 ); - result = ele->QueryDoubleAttribute( "attr1", &dVal ); - XmlTest( "Query attribute: double as double", (int)dVal, 2 ); - result = ele->QueryIntAttribute( "attr1", &iVal ); - XmlTest( "Query attribute: double as int", result, TIXML_SUCCESS ); - XmlTest( "Query attribute: double as int", iVal, 2 ); - result = ele->QueryIntAttribute( "attr2", &iVal ); - XmlTest( "Query attribute: not a number", result, TIXML_WRONG_TYPE ); - result = ele->QueryIntAttribute( "bar", &iVal ); - XmlTest( "Query attribute: does not exist", result, TIXML_NO_ATTRIBUTE ); - } - - { - const char* str = "<doc/>"; - - TiXmlDocument doc; - doc.Parse( str ); - - TiXmlElement* ele = doc.FirstChildElement(); - - int iVal; - double dVal; - - ele->SetAttribute( "str", "strValue" ); - ele->SetAttribute( "int", 1 ); - ele->SetDoubleAttribute( "double", -1.0 ); - - const char* cStr = ele->Attribute( "str" ); - ele->QueryIntAttribute( "int", &iVal ); - ele->QueryDoubleAttribute( "double", &dVal ); - - XmlTest( "Attribute round trip. c-string.", "strValue", cStr ); - XmlTest( "Attribute round trip. int.", 1, iVal ); - XmlTest( "Attribute round trip. double.", -1, (int)dVal ); - } - - { - const char* str = "\t<?xml version=\"1.0\" standalone=\"no\" ?>\t<room doors='2'>\n" - "</room>"; - - TiXmlDocument doc; - doc.SetTabSize( 8 ); - doc.Parse( str ); - - TiXmlHandle docHandle( &doc ); - TiXmlHandle roomHandle = docHandle.FirstChildElement( "room" ); - - assert( docHandle.Node() ); - assert( roomHandle.Element() ); - - TiXmlElement* room = roomHandle.Element(); - assert( room ); - TiXmlAttribute* doors = room->FirstAttribute(); - assert( doors ); - - XmlTest( "Location tracking: Tab 8: room row", room->Row(), 1 ); - XmlTest( "Location tracking: Tab 8: room col", room->Column(), 49 ); - XmlTest( "Location tracking: Tab 8: doors row", doors->Row(), 1 ); - XmlTest( "Location tracking: Tab 8: doors col", doors->Column(), 55 ); - } - - { - const char* str = "\t<?xml version=\"1.0\" standalone=\"no\" ?>\t<room doors='2'>\n" - " <!-- Silly example -->\n" - " <door wall='north'>A great door!</door>\n" - "\t<door wall='east'/>" - "</room>"; - - TiXmlDocument doc; - doc.Parse( str ); - - TiXmlHandle docHandle( &doc ); - TiXmlHandle roomHandle = docHandle.FirstChildElement( "room" ); - TiXmlHandle commentHandle = docHandle.FirstChildElement( "room" ).FirstChild(); - TiXmlHandle textHandle = docHandle.FirstChildElement( "room" ).ChildElement( "door", 0 ).FirstChild(); - TiXmlHandle door0Handle = docHandle.FirstChildElement( "room" ).ChildElement( 0 ); - TiXmlHandle door1Handle = docHandle.FirstChildElement( "room" ).ChildElement( 1 ); - - assert( docHandle.Node() ); - assert( roomHandle.Element() ); - assert( commentHandle.Node() ); - assert( textHandle.Text() ); - assert( door0Handle.Element() ); - assert( door1Handle.Element() ); - - TiXmlDeclaration* declaration = doc.FirstChild()->ToDeclaration(); - assert( declaration ); - TiXmlElement* room = roomHandle.Element(); - assert( room ); - TiXmlAttribute* doors = room->FirstAttribute(); - assert( doors ); - TiXmlText* text = textHandle.Text(); - TiXmlComment* comment = commentHandle.Node()->ToComment(); - assert( comment ); - TiXmlElement* door0 = door0Handle.Element(); - TiXmlElement* door1 = door1Handle.Element(); - - XmlTest( "Location tracking: Declaration row", declaration->Row(), 1 ); - XmlTest( "Location tracking: Declaration col", declaration->Column(), 5 ); - XmlTest( "Location tracking: room row", room->Row(), 1 ); - XmlTest( "Location tracking: room col", room->Column(), 45 ); - XmlTest( "Location tracking: doors row", doors->Row(), 1 ); - XmlTest( "Location tracking: doors col", doors->Column(), 51 ); - XmlTest( "Location tracking: Comment row", comment->Row(), 2 ); - XmlTest( "Location tracking: Comment col", comment->Column(), 3 ); - XmlTest( "Location tracking: text row", text->Row(), 3 ); - XmlTest( "Location tracking: text col", text->Column(), 24 ); - XmlTest( "Location tracking: door0 row", door0->Row(), 3 ); - XmlTest( "Location tracking: door0 col", door0->Column(), 5 ); - XmlTest( "Location tracking: door1 row", door1->Row(), 4 ); - XmlTest( "Location tracking: door1 col", door1->Column(), 5 ); - } - - - // -------------------------------------------------------- - // UTF-8 testing. It is important to test: - // 1. Making sure name, value, and text read correctly - // 2. Row, Col functionality - // 3. Correct output - // -------------------------------------------------------- - printf ("\n** UTF-8 **\n"); - { - TiXmlDocument doc( "utf8test.xml" ); - doc.LoadFile(); - if ( doc.Error() && doc.ErrorId() == TiXmlBase::TIXML_ERROR_OPENING_FILE ) { - printf( "WARNING: File 'utf8test.xml' not found.\n" - "(Are you running the test from the wrong directory?)\n" - "Could not test UTF-8 functionality.\n" ); - } - else - { - TiXmlHandle docH( &doc ); - // Get the attribute "value" from the "Russian" element and check it. - TiXmlElement* element = docH.FirstChildElement( "document" ).FirstChildElement( "Russian" ).Element(); - const unsigned char correctValue[] = { 0xd1U, 0x86U, 0xd0U, 0xb5U, 0xd0U, 0xbdU, 0xd0U, 0xbdU, - 0xd0U, 0xbeU, 0xd1U, 0x81U, 0xd1U, 0x82U, 0xd1U, 0x8cU, 0 }; - - XmlTest( "UTF-8: Russian value.", (const char*)correctValue, element->Attribute( "value" ), true ); - XmlTest( "UTF-8: Russian value row.", 4, element->Row() ); - XmlTest( "UTF-8: Russian value column.", 5, element->Column() ); - - const unsigned char russianElementName[] = { 0xd0U, 0xa0U, 0xd1U, 0x83U, - 0xd1U, 0x81U, 0xd1U, 0x81U, - 0xd0U, 0xbaU, 0xd0U, 0xb8U, - 0xd0U, 0xb9U, 0 }; - const char russianText[] = "<\xD0\xB8\xD0\xBC\xD0\xB5\xD0\xB5\xD1\x82>"; - - TiXmlText* text = docH.FirstChildElement( "document" ).FirstChildElement( (const char*) russianElementName ).Child( 0 ).Text(); - XmlTest( "UTF-8: Browsing russian element name.", - russianText, - text->Value(), - true ); - XmlTest( "UTF-8: Russian element name row.", 7, text->Row() ); - XmlTest( "UTF-8: Russian element name column.", 47, text->Column() ); - - TiXmlDeclaration* dec = docH.Child( 0 ).Node()->ToDeclaration(); - XmlTest( "UTF-8: Declaration column.", 1, dec->Column() ); - XmlTest( "UTF-8: Document column.", 1, doc.Column() ); - - // Now try for a round trip. - doc.SaveFile( "utf8testout.xml" ); - - // Check the round trip. - char savedBuf[256]; - char verifyBuf[256]; - int okay = 1; - - FILE* saved = fopen( "utf8testout.xml", "r" ); - FILE* verify = fopen( "utf8testverify.xml", "r" ); - if ( saved && verify ) - { - while ( fgets( verifyBuf, 256, verify ) ) - { - fgets( savedBuf, 256, saved ); - if ( strcmp( verifyBuf, savedBuf ) ) - { - okay = 0; - break; - } - } - fclose( saved ); - fclose( verify ); - } - XmlTest( "UTF-8: Verified multi-language round trip.", 1, okay ); - - // On most Western machines, this is an element that contains - // the word "resume" with the correct accents, in a latin encoding. - // It will be something else completely on non-wester machines, - // which is why TinyXml is switching to UTF-8. - const char latin[] = "<element>r\x82sum\x82</element>"; - - TiXmlDocument latinDoc; - latinDoc.Parse( latin, 0, TIXML_ENCODING_LEGACY ); - - text = latinDoc.FirstChildElement()->FirstChild()->ToText(); - XmlTest( "Legacy encoding: Verify text element.", "r\x82sum\x82", text->Value() ); - } - } - - ////////////////////// - // Copy and assignment - ////////////////////// - printf ("\n** Copy and Assignment **\n"); - { - TiXmlElement element( "foo" ); - element.Parse( "<element name='value' />", 0, TIXML_ENCODING_UNKNOWN ); - - TiXmlElement elementCopy( element ); - TiXmlElement elementAssign( "foo" ); - elementAssign.Parse( "<incorrect foo='bar'/>", 0, TIXML_ENCODING_UNKNOWN ); - elementAssign = element; - - XmlTest( "Copy/Assign: element copy #1.", "element", elementCopy.Value() ); - XmlTest( "Copy/Assign: element copy #2.", "value", elementCopy.Attribute( "name" ) ); - XmlTest( "Copy/Assign: element assign #1.", "element", elementAssign.Value() ); - XmlTest( "Copy/Assign: element assign #2.", "value", elementAssign.Attribute( "name" ) ); - XmlTest( "Copy/Assign: element assign #3.", true, ( 0 == elementAssign.Attribute( "foo" )) ); - - TiXmlComment comment; - comment.Parse( "<!--comment-->", 0, TIXML_ENCODING_UNKNOWN ); - TiXmlComment commentCopy( comment ); - TiXmlComment commentAssign; - commentAssign = commentCopy; - XmlTest( "Copy/Assign: comment copy.", "comment", commentCopy.Value() ); - XmlTest( "Copy/Assign: comment assign.", "comment", commentAssign.Value() ); - - TiXmlUnknown unknown; - unknown.Parse( "<[unknown]>", 0, TIXML_ENCODING_UNKNOWN ); - TiXmlUnknown unknownCopy( unknown ); - TiXmlUnknown unknownAssign; - unknownAssign.Parse( "incorrect", 0, TIXML_ENCODING_UNKNOWN ); - unknownAssign = unknownCopy; - XmlTest( "Copy/Assign: unknown copy.", "[unknown]", unknownCopy.Value() ); - XmlTest( "Copy/Assign: unknown assign.", "[unknown]", unknownAssign.Value() ); - - TiXmlText text( "TextNode" ); - TiXmlText textCopy( text ); - TiXmlText textAssign( "incorrect" ); - textAssign = text; - XmlTest( "Copy/Assign: text copy.", "TextNode", textCopy.Value() ); - XmlTest( "Copy/Assign: text assign.", "TextNode", textAssign.Value() ); - - TiXmlDeclaration dec; - dec.Parse( "<?xml version='1.0' encoding='UTF-8'?>", 0, TIXML_ENCODING_UNKNOWN ); - TiXmlDeclaration decCopy( dec ); - TiXmlDeclaration decAssign; - decAssign = dec; - - XmlTest( "Copy/Assign: declaration copy.", "UTF-8", decCopy.Encoding() ); - XmlTest( "Copy/Assign: text assign.", "UTF-8", decAssign.Encoding() ); - - TiXmlDocument doc; - elementCopy.InsertEndChild( textCopy ); - doc.InsertEndChild( decAssign ); - doc.InsertEndChild( elementCopy ); - doc.InsertEndChild( unknownAssign ); - - TiXmlDocument docCopy( doc ); - TiXmlDocument docAssign; - docAssign = docCopy; - - #ifdef TIXML_USE_STL - std::string original, copy, assign; - original << doc; - copy << docCopy; - assign << docAssign; - XmlTest( "Copy/Assign: document copy.", original.c_str(), copy.c_str(), true ); - XmlTest( "Copy/Assign: document assign.", original.c_str(), assign.c_str(), true ); - - #endif - } - - ////////////////////////////////////////////////////// + // + // We start with the 'demoStart' todo list. Process it. And + // should hopefully end up with the todo list as illustrated. + // + const char* demoStart = + "<?xml version=\"1.0\" standalone='no' >\n" + "<!-- Our to do list data -->" + "<ToDo>\n" + "<!-- Do I need a secure PDA? -->\n" + "<Item priority=\"1\" distance='close'> Go to the <bold>Toy store!</bold></Item>" + "<Item priority=\"2\" distance='none'> Do bills </Item>" + "<Item priority=\"2\" distance='far & back'> Look for Evil Dinosaurs! </Item>" + "</ToDo>"; + + { + +#ifdef TIXML_USE_STL + // What the todo list should look like after processing. + // In stream (no formatting) representation. + const char* demoEnd = + "<?xml version=\"1.0\" standalone=\"no\" ?>" + "<!-- Our to do list data -->" + "<ToDo>" + "<!-- Do I need a secure PDA? -->" + "<Item priority=\"2\" distance=\"close\">Go to the" + "<bold>Toy store!" + "</bold>" + "</Item>" + "<Item priority=\"1\" distance=\"far\">Talk to:" + "<Meeting where=\"School\">" + "<Attendee name=\"Marple\" position=\"teacher\" />" + "<Attendee name=\"Voel\" position=\"counselor\" />" + "</Meeting>" + "<Meeting where=\"Lunch\" />" + "</Item>" + "<Item priority=\"2\" distance=\"here\">Do bills" + "</Item>" + "</ToDo>"; +#endif + + // The example parses from the character string (above): +#if defined( WIN32 ) && defined( TUNE ) + _CrtMemCheckpoint( &startMemState ); +#endif + + { + // Write to a file and read it back, to check file I/O. + + TiXmlDocument doc( "demotest.xml" ); + doc.Parse( demoStart ); + + if ( doc.Error() ) + { + printf( "Error in %s: %s\n", doc.Value(), doc.ErrorDesc() ); + exit( 1 ); + } + doc.SaveFile(); + } + + TiXmlDocument doc( "demotest.xml" ); + bool loadOkay = doc.LoadFile(); + + if ( !loadOkay ) + { + printf( "Could not load test file 'demotest.xml'. Error='%s'. Exiting.\n", doc.ErrorDesc() ); + exit( 1 ); + } + + printf( "** Demo doc read from disk: ** \n\n" ); + printf( "** Printing via doc.Print **\n" ); + doc.Print( stdout ); + + { + printf( "** Printing via TiXmlPrinter **\n" ); + TiXmlPrinter printer; + doc.Accept( &printer ); + fprintf( stdout, "%s", printer.CStr() ); + } #ifdef TIXML_USE_STL - printf ("\n** Parsing, no Condense Whitespace **\n"); - TiXmlBase::SetCondenseWhiteSpace( false ); - { - istringstream parse1( "<start>This is \ntext</start>" ); - TiXmlElement text1( "text" ); - parse1 >> text1; - - XmlTest ( "Condense white space OFF.", "This is \ntext", - text1.FirstChild()->Value(), - true ); - } - TiXmlBase::SetCondenseWhiteSpace( true ); + { + printf( "** Printing via operator<< **\n" ); + std::cout << doc; + } #endif + TiXmlNode* node = 0; + TiXmlElement* todoElement = 0; + TiXmlElement* itemElement = 0; + + + // -------------------------------------------------------- + // An example of changing existing attributes, and removing + // an element from the document. + // -------------------------------------------------------- + + // Get the "ToDo" element. + // It is a child of the document, and can be selected by name. + node = doc.FirstChild( "ToDo" ); + assert( node ); + todoElement = node->ToElement(); + assert( todoElement ); + + // Going to the toy store is now our second priority... + // So set the "priority" attribute of the first item in the list. + node = todoElement->FirstChildElement(); // This skips the "PDA" comment. + assert( node ); + itemElement = node->ToElement(); + assert( itemElement ); + itemElement->SetAttribute( "priority", 2 ); + + // Change the distance to "doing bills" from + // "none" to "here". It's the next sibling element. + itemElement = itemElement->NextSiblingElement(); + assert( itemElement ); + itemElement->SetAttribute( "distance", "here" ); + + // Remove the "Look for Evil Dinosaurs!" item. + // It is 1 more sibling away. We ask the parent to remove + // a particular child. + itemElement = itemElement->NextSiblingElement(); + todoElement->RemoveChild( itemElement ); + + itemElement = 0; + + // -------------------------------------------------------- + // What follows is an example of created elements and text + // nodes and adding them to the document. + // -------------------------------------------------------- + + // Add some meetings. + TiXmlElement item( "Item" ); + item.SetAttribute( "priority", "1" ); + item.SetAttribute( "distance", "far" ); + + TiXmlText text( "Talk to:" ); + + TiXmlElement meeting1( "Meeting" ); + meeting1.SetAttribute( "where", "School" ); + + TiXmlElement meeting2( "Meeting" ); + meeting2.SetAttribute( "where", "Lunch" ); + + TiXmlElement attendee1( "Attendee" ); + attendee1.SetAttribute( "name", "Marple" ); + attendee1.SetAttribute( "position", "teacher" ); + + TiXmlElement attendee2( "Attendee" ); + attendee2.SetAttribute( "name", "Voel" ); + attendee2.SetAttribute( "position", "counselor" ); + + // Assemble the nodes we've created: + meeting1.InsertEndChild( attendee1 ); + meeting1.InsertEndChild( attendee2 ); + + item.InsertEndChild( text ); + item.InsertEndChild( meeting1 ); + item.InsertEndChild( meeting2 ); + + // And add the node to the existing list after the first child. + node = todoElement->FirstChild( "Item" ); + assert( node ); + itemElement = node->ToElement(); + assert( itemElement ); + + todoElement->InsertAfterChild( itemElement, item ); + + printf( "\n** Demo doc processed: ** \n\n" ); + doc.Print( stdout ); + + +#ifdef TIXML_USE_STL + printf( "** Demo doc processed to stream: ** \n\n" ); + cout << doc << endl << endl; +#endif + + // -------------------------------------------------------- + // Different tests...do we have what we expect? + // -------------------------------------------------------- - ////////////////////////////////////////////////////// - // GetText(); - { - const char* str = "<foo>This is text</foo>"; - TiXmlDocument doc; - doc.Parse( str ); - const TiXmlElement* element = doc.RootElement(); - - XmlTest( "GetText() normal use.", "This is text", element->GetText() ); - - str = "<foo><b>This is text</b></foo>"; - doc.Clear(); - doc.Parse( str ); - element = doc.RootElement(); - - XmlTest( "GetText() contained element.", element->GetText() == 0, true ); - - str = "<foo>This is <b>text</b></foo>"; - doc.Clear(); - TiXmlBase::SetCondenseWhiteSpace( false ); - doc.Parse( str ); - TiXmlBase::SetCondenseWhiteSpace( true ); - element = doc.RootElement(); - - XmlTest( "GetText() partial.", "This is ", element->GetText() ); - } - - - ////////////////////////////////////////////////////// - // CDATA - { - const char* str = "<xmlElement>" - "<![CDATA[" - "I am > the rules!\n" - "...since I make symbolic puns" - "]]>" - "</xmlElement>"; - TiXmlDocument doc; - doc.Parse( str ); - doc.Print(); - - XmlTest( "CDATA parse.", doc.FirstChildElement()->FirstChild()->Value(), - "I am > the rules!\n...since I make symbolic puns", - true ); - - #ifdef TIXML_USE_STL - //cout << doc << '\n'; - - doc.Clear(); - - istringstream parse0( str ); - parse0 >> doc; - //cout << doc << '\n'; - - XmlTest( "CDATA stream.", doc.FirstChildElement()->FirstChild()->Value(), - "I am > the rules!\n...since I make symbolic puns", - true ); - #endif - - TiXmlDocument doc1 = doc; - //doc.Print(); - - XmlTest( "CDATA copy.", doc1.FirstChildElement()->FirstChild()->Value(), - "I am > the rules!\n...since I make symbolic puns", - true ); - } - { - // [ 1482728 ] Wrong wide char parsing - char buf[256]; - buf[255] = 0; - for( int i=0; i<255; ++i ) { - buf[i] = (char)((i>=32) ? i : 32); - } - TIXML_STRING str( "<xmlElement><![CDATA[" ); - str += buf; - str += "]]></xmlElement>"; - - TiXmlDocument doc; - doc.Parse( str.c_str() ); - - TiXmlPrinter printer; - printer.SetStreamPrinting(); - doc.Accept( &printer ); - - XmlTest( "CDATA with all bytes #1.", str.c_str(), printer.CStr(), true ); - - #ifdef TIXML_USE_STL - doc.Clear(); - istringstream iss( printer.Str() ); - iss >> doc; - std::string out; - out << doc; - XmlTest( "CDATA with all bytes #2.", out.c_str(), printer.CStr(), true ); - #endif - } - { - // [ 1480107 ] Bug-fix for STL-streaming of CDATA that contains tags - // CDATA streaming had a couple of bugs, that this tests for. - const char* str = "<xmlElement>" - "<![CDATA[" - "<b>I am > the rules!</b>\n" - "...since I make symbolic puns" - "]]>" - "</xmlElement>"; - TiXmlDocument doc; - doc.Parse( str ); - doc.Print(); - - XmlTest( "CDATA parse. [ 1480107 ]", doc.FirstChildElement()->FirstChild()->Value(), - "<b>I am > the rules!</b>\n...since I make symbolic puns", - true ); - - #ifdef TIXML_USE_STL - - doc.Clear(); - - istringstream parse0( str ); - parse0 >> doc; - - XmlTest( "CDATA stream. [ 1480107 ]", doc.FirstChildElement()->FirstChild()->Value(), - "<b>I am > the rules!</b>\n...since I make symbolic puns", - true ); - #endif - - TiXmlDocument doc1 = doc; - //doc.Print(); - - XmlTest( "CDATA copy. [ 1480107 ]", doc1.FirstChildElement()->FirstChild()->Value(), - "<b>I am > the rules!</b>\n...since I make symbolic puns", - true ); - } - ////////////////////////////////////////////////////// - // Visit() - - - - ////////////////////////////////////////////////////// - printf( "\n** Fuzzing... **\n" ); - - const int FUZZ_ITERATION = 300; - - // The only goal is not to crash on bad input. - int len = (int) strlen( demoStart ); - for( int i=0; i<FUZZ_ITERATION; ++i ) - { - char* demoCopy = new char[ len+1 ]; - strcpy( demoCopy, demoStart ); - - demoCopy[ i%len ] = (char)((i+1)*3); - demoCopy[ (i*7)%len ] = '>'; - demoCopy[ (i*11)%len ] = '<'; - - TiXmlDocument xml; - xml.Parse( demoCopy ); - - delete [] demoCopy; - } - printf( "** Fuzzing Complete. **\n" ); - - ////////////////////////////////////////////////////// - printf ("\n** Bug regression tests **\n"); - - // InsertBeforeChild and InsertAfterChild causes crash. - { - TiXmlElement parent( "Parent" ); - TiXmlElement childText0( "childText0" ); - TiXmlElement childText1( "childText1" ); - TiXmlNode* childNode0 = parent.InsertEndChild( childText0 ); - TiXmlNode* childNode1 = parent.InsertBeforeChild( childNode0, childText1 ); - - XmlTest( "Test InsertBeforeChild on empty node.", ( childNode1 == parent.FirstChild() ), true ); - } - - { - // InsertBeforeChild and InsertAfterChild causes crash. - TiXmlElement parent( "Parent" ); - TiXmlElement childText0( "childText0" ); - TiXmlElement childText1( "childText1" ); - TiXmlNode* childNode0 = parent.InsertEndChild( childText0 ); - TiXmlNode* childNode1 = parent.InsertAfterChild( childNode0, childText1 ); - - XmlTest( "Test InsertAfterChild on empty node. ", ( childNode1 == parent.LastChild() ), true ); - } - - // Reports of missing constructors, irregular string problems. - { - // Missing constructor implementation. No test -- just compiles. - TiXmlText text( "Missing" ); - - #ifdef TIXML_USE_STL - // Missing implementation: - TiXmlDocument doc; - string name = "missing"; - doc.LoadFile( name ); - - TiXmlText textSTL( name ); - #else - // verifying some basic string functions: - TiXmlString a; - TiXmlString b( "Hello" ); - TiXmlString c( "ooga" ); - - c = " World!"; - a = b; - a += c; - a = a; - - XmlTest( "Basic TiXmlString test. ", "Hello World!", a.c_str() ); - #endif - } - - // Long filenames crashing STL version - { - TiXmlDocument doc( "midsummerNightsDreamWithAVeryLongFilenameToConfuseTheStringHandlingRoutines.xml" ); - bool loadOkay = doc.LoadFile(); - loadOkay = true; // get rid of compiler warning. - // Won't pass on non-dev systems. Just a "no crash" check. - //XmlTest( "Long filename. ", true, loadOkay ); - } - - { - // Entities not being written correctly. - // From Lynn Allen - - const char* passages = - "<?xml version=\"1.0\" standalone=\"no\" ?>" - "<passages count=\"006\" formatversion=\"20020620\">" - "<psg context=\"Line 5 has "quotation marks" and 'apostrophe marks'." - " It also has <, >, and &, as well as a fake copyright ©.\"> </psg>" - "</passages>"; - - TiXmlDocument doc( "passages.xml" ); - doc.Parse( passages ); - TiXmlElement* psg = doc.RootElement()->FirstChildElement(); - const char* context = psg->Attribute( "context" ); - const char* expected = "Line 5 has \"quotation marks\" and 'apostrophe marks'. It also has <, >, and &, as well as a fake copyright \xC2\xA9."; - - XmlTest( "Entity transformation: read. ", expected, context, true ); - - FILE* textfile = fopen( "textfile.txt", "w" ); - if ( textfile ) - { - psg->Print( textfile, 0 ); - fclose( textfile ); - } - textfile = fopen( "textfile.txt", "r" ); - assert( textfile ); - if ( textfile ) - { - char buf[ 1024 ]; - fgets( buf, 1024, textfile ); - XmlTest( "Entity transformation: write. ", - "<psg context=\'Line 5 has "quotation marks" and 'apostrophe marks'." - " It also has <, >, and &, as well as a fake copyright \xC2\xA9.' />", - buf, - true ); - } - fclose( textfile ); - } + int count = 0; + TiXmlElement* element; + + ////////////////////////////////////////////////////// + +#ifdef TIXML_USE_STL + cout << "** Basic structure. **\n"; + ostringstream outputStream( ostringstream::out ); + outputStream << doc; + XmlTest( "Output stream correct.", string( demoEnd ).c_str(), + outputStream.str().c_str(), true ); +#endif + + node = doc.RootElement(); + assert( node ); + XmlTest( "Root element exists.", true, ( node != 0 && node->ToElement() ) ); + XmlTest ( "Root element value is 'ToDo'.", "ToDo", node->Value()); + + node = node->FirstChild(); + XmlTest( "First child exists & is a comment.", true, ( node != 0 && node->ToComment() ) ); + node = node->NextSibling(); + XmlTest( "Sibling element exists & is an element.", true, ( node != 0 && node->ToElement() ) ); + XmlTest ( "Value is 'Item'.", "Item", node->Value() ); + + node = node->FirstChild(); + XmlTest ( "First child exists.", true, ( node != 0 && node->ToText() ) ); + XmlTest ( "Value is 'Go to the'.", "Go to the", node->Value() ); + + + ////////////////////////////////////////////////////// + printf ("\n** Iterators. **\n"); + + // Walk all the top level nodes of the document. + count = 0; + for( node = doc.FirstChild(); + node; + node = node->NextSibling() ) + { + count++; + } + XmlTest( "Top level nodes, using First / Next.", 3, count ); + + count = 0; + for( node = doc.LastChild(); + node; + node = node->PreviousSibling() ) + { + count++; + } + XmlTest( "Top level nodes, using Last / Previous.", 3, count ); + + // Walk all the top level nodes of the document, + // using a different syntax. + count = 0; + for( node = doc.IterateChildren( 0 ); + node; + node = doc.IterateChildren( node ) ) + { + count++; + } + XmlTest( "Top level nodes, using IterateChildren.", 3, count ); + + // Walk all the elements in a node. + count = 0; + for( element = todoElement->FirstChildElement(); + element; + element = element->NextSiblingElement() ) + { + count++; + } + XmlTest( "Children of the 'ToDo' element, using First / Next.", + 3, count ); + + // Walk all the elements in a node by value. + count = 0; + for( node = todoElement->FirstChild( "Item" ); + node; + node = node->NextSibling( "Item" ) ) + { + count++; + } + XmlTest( "'Item' children of the 'ToDo' element, using First/Next.", 3, count ); + + count = 0; + for( node = todoElement->LastChild( "Item" ); + node; + node = node->PreviousSibling( "Item" ) ) + { + count++; + } + XmlTest( "'Item' children of the 'ToDo' element, using Last/Previous.", 3, count ); + +#ifdef TIXML_USE_STL + { + cout << "\n** Parsing. **\n"; + istringstream parse0( "<Element0 attribute0='foo0' attribute1= noquotes attribute2 = '>' />" ); + TiXmlElement element0( "default" ); + parse0 >> element0; + + XmlTest ( "Element parsed, value is 'Element0'.", "Element0", element0.Value() ); + XmlTest ( "Reads attribute 'attribute0=\"foo0\"'.", "foo0", element0.Attribute( "attribute0" )); + XmlTest ( "Reads incorrectly formatted 'attribute1=noquotes'.", "noquotes", element0.Attribute( "attribute1" ) ); + XmlTest ( "Read attribute with entity value '>'.", ">", element0.Attribute( "attribute2" ) ); + } +#endif + + { + const char* error = "<?xml version=\"1.0\" standalone=\"no\" ?>\n" + "<passages count=\"006\" formatversion=\"20020620\">\n" + " <wrong error>\n" + "</passages>"; + + TiXmlDocument docTest; + docTest.Parse( error ); + XmlTest( "Error row", docTest.ErrorRow(), 3 ); + XmlTest( "Error column", docTest.ErrorCol(), 17 ); + //printf( "error=%d id='%s' row %d col%d\n", (int) doc.Error(), doc.ErrorDesc(), doc.ErrorRow()+1, doc.ErrorCol() + 1 ); + + } + +#ifdef TIXML_USE_STL + { + ////////////////////////////////////////////////////// + cout << "\n** Streaming. **\n"; + + // Round trip check: stream in, then stream back out to verify. The stream + // out has already been checked, above. We use the output + + istringstream inputStringStream( outputStream.str() ); + TiXmlDocument document0; + + inputStringStream >> document0; + + ostringstream outputStream0( ostringstream::out ); + outputStream0 << document0; + + XmlTest( "Stream round trip correct.", string( demoEnd ).c_str(), + outputStream0.str().c_str(), true ); + + std::string str; + str << document0; + + XmlTest( "String printing correct.", string( demoEnd ).c_str(), + str.c_str(), true ); + } +#endif + } + + { + const char* str = "<doc attr0='1' attr1='2.0' attr2='foo' />"; + + TiXmlDocument doc; + doc.Parse( str ); + + TiXmlElement* ele = doc.FirstChildElement(); + + int iVal, result; + double dVal; + + result = ele->QueryDoubleAttribute( "attr0", &dVal ); + XmlTest( "Query attribute: int as double", result, TIXML_SUCCESS ); + XmlTest( "Query attribute: int as double", (int)dVal, 1 ); + result = ele->QueryDoubleAttribute( "attr1", &dVal ); + XmlTest( "Query attribute: double as double", (int)dVal, 2 ); + result = ele->QueryIntAttribute( "attr1", &iVal ); + XmlTest( "Query attribute: double as int", result, TIXML_SUCCESS ); + XmlTest( "Query attribute: double as int", iVal, 2 ); + result = ele->QueryIntAttribute( "attr2", &iVal ); + XmlTest( "Query attribute: not a number", result, TIXML_WRONG_TYPE ); + result = ele->QueryIntAttribute( "bar", &iVal ); + XmlTest( "Query attribute: does not exist", result, TIXML_NO_ATTRIBUTE ); + } { - FILE* textfile = fopen( "test5.xml", "w" ); - if ( textfile ) - { + const char* str = "<doc/>"; + + TiXmlDocument doc; + doc.Parse( str ); + + TiXmlElement* ele = doc.FirstChildElement(); + + int iVal; + double dVal; + + ele->SetAttribute( "str", "strValue" ); + ele->SetAttribute( "int", 1 ); + ele->SetDoubleAttribute( "double", -1.0 ); + + const char* cStr = ele->Attribute( "str" ); + ele->QueryIntAttribute( "int", &iVal ); + ele->QueryDoubleAttribute( "double", &dVal ); + + XmlTest( "Attribute round trip. c-string.", "strValue", cStr ); + XmlTest( "Attribute round trip. int.", 1, iVal ); + XmlTest( "Attribute round trip. double.", -1, (int)dVal ); + } + + { + const char* str = "\t<?xml version=\"1.0\" standalone=\"no\" ?>\t<room doors='2'>\n" + "</room>"; + + TiXmlDocument doc; + doc.SetTabSize( 8 ); + doc.Parse( str ); + + TiXmlHandle docHandle( &doc ); + TiXmlHandle roomHandle = docHandle.FirstChildElement( "room" ); + + assert( docHandle.Node() ); + assert( roomHandle.Element() ); + + TiXmlElement* room = roomHandle.Element(); + assert( room ); + TiXmlAttribute* doors = room->FirstAttribute(); + assert( doors ); + + XmlTest( "Location tracking: Tab 8: room row", room->Row(), 1 ); + XmlTest( "Location tracking: Tab 8: room col", room->Column(), 49 ); + XmlTest( "Location tracking: Tab 8: doors row", doors->Row(), 1 ); + XmlTest( "Location tracking: Tab 8: doors col", doors->Column(), 55 ); + } + + { + const char* str = "\t<?xml version=\"1.0\" standalone=\"no\" ?>\t<room doors='2'>\n" + " <!-- Silly example -->\n" + " <door wall='north'>A great door!</door>\n" + "\t<door wall='east'/>" + "</room>"; + + TiXmlDocument doc; + doc.Parse( str ); + + TiXmlHandle docHandle( &doc ); + TiXmlHandle roomHandle = docHandle.FirstChildElement( "room" ); + TiXmlHandle commentHandle = docHandle.FirstChildElement( "room" ).FirstChild(); + TiXmlHandle textHandle = docHandle.FirstChildElement( "room" ).ChildElement( "door", 0 ).FirstChild(); + TiXmlHandle door0Handle = docHandle.FirstChildElement( "room" ).ChildElement( 0 ); + TiXmlHandle door1Handle = docHandle.FirstChildElement( "room" ).ChildElement( 1 ); + + assert( docHandle.Node() ); + assert( roomHandle.Element() ); + assert( commentHandle.Node() ); + assert( textHandle.Text() ); + assert( door0Handle.Element() ); + assert( door1Handle.Element() ); + + TiXmlDeclaration* declaration = doc.FirstChild()->ToDeclaration(); + assert( declaration ); + TiXmlElement* room = roomHandle.Element(); + assert( room ); + TiXmlAttribute* doors = room->FirstAttribute(); + assert( doors ); + TiXmlText* text = textHandle.Text(); + TiXmlComment* comment = commentHandle.Node()->ToComment(); + assert( comment ); + TiXmlElement* door0 = door0Handle.Element(); + TiXmlElement* door1 = door1Handle.Element(); + + XmlTest( "Location tracking: Declaration row", declaration->Row(), 1 ); + XmlTest( "Location tracking: Declaration col", declaration->Column(), 5 ); + XmlTest( "Location tracking: room row", room->Row(), 1 ); + XmlTest( "Location tracking: room col", room->Column(), 45 ); + XmlTest( "Location tracking: doors row", doors->Row(), 1 ); + XmlTest( "Location tracking: doors col", doors->Column(), 51 ); + XmlTest( "Location tracking: Comment row", comment->Row(), 2 ); + XmlTest( "Location tracking: Comment col", comment->Column(), 3 ); + XmlTest( "Location tracking: text row", text->Row(), 3 ); + XmlTest( "Location tracking: text col", text->Column(), 24 ); + XmlTest( "Location tracking: door0 row", door0->Row(), 3 ); + XmlTest( "Location tracking: door0 col", door0->Column(), 5 ); + XmlTest( "Location tracking: door1 row", door1->Row(), 4 ); + XmlTest( "Location tracking: door1 col", door1->Column(), 5 ); + } + + + // -------------------------------------------------------- + // UTF-8 testing. It is important to test: + // 1. Making sure name, value, and text read correctly + // 2. Row, Col functionality + // 3. Correct output + // -------------------------------------------------------- + printf ("\n** UTF-8 **\n"); + { + TiXmlDocument doc( "utf8test.xml" ); + doc.LoadFile(); + if ( doc.Error() && doc.ErrorId() == TiXmlBase::TIXML_ERROR_OPENING_FILE ) + { + printf( "WARNING: File 'utf8test.xml' not found.\n" + "(Are you running the test from the wrong directory?)\n" + "Could not test UTF-8 functionality.\n" ); + } + else + { + TiXmlHandle docH( &doc ); + // Get the attribute "value" from the "Russian" element and check it. + TiXmlElement* element = docH.FirstChildElement( "document" ).FirstChildElement( "Russian" ).Element(); + const unsigned char correctValue[] = { 0xd1U, 0x86U, 0xd0U, 0xb5U, 0xd0U, 0xbdU, 0xd0U, 0xbdU, + 0xd0U, 0xbeU, 0xd1U, 0x81U, 0xd1U, 0x82U, 0xd1U, 0x8cU, 0 + }; + + XmlTest( "UTF-8: Russian value.", (const char*)correctValue, element->Attribute( "value" ), true ); + XmlTest( "UTF-8: Russian value row.", 4, element->Row() ); + XmlTest( "UTF-8: Russian value column.", 5, element->Column() ); + + const unsigned char russianElementName[] = { 0xd0U, 0xa0U, 0xd1U, 0x83U, + 0xd1U, 0x81U, 0xd1U, 0x81U, + 0xd0U, 0xbaU, 0xd0U, 0xb8U, + 0xd0U, 0xb9U, 0 + }; + const char russianText[] = "<\xD0\xB8\xD0\xBC\xD0\xB5\xD0\xB5\xD1\x82>"; + + TiXmlText* text = docH.FirstChildElement( "document" ).FirstChildElement( (const char*) russianElementName ).Child( 0 ).Text(); + XmlTest( "UTF-8: Browsing russian element name.", + russianText, + text->Value(), + true ); + XmlTest( "UTF-8: Russian element name row.", 7, text->Row() ); + XmlTest( "UTF-8: Russian element name column.", 47, text->Column() ); + + TiXmlDeclaration* dec = docH.Child( 0 ).Node()->ToDeclaration(); + XmlTest( "UTF-8: Declaration column.", 1, dec->Column() ); + XmlTest( "UTF-8: Document column.", 1, doc.Column() ); + + // Now try for a round trip. + doc.SaveFile( "utf8testout.xml" ); + + // Check the round trip. + char savedBuf[256]; + char verifyBuf[256]; + int okay = 1; + + FILE* saved = fopen( "utf8testout.xml", "r" ); + FILE* verify = fopen( "utf8testverify.xml", "r" ); + if ( saved && verify ) + { + while ( fgets( verifyBuf, 256, verify ) ) + { + fgets( savedBuf, 256, saved ); + if ( strcmp( verifyBuf, savedBuf ) ) + { + okay = 0; + break; + } + } + fclose( saved ); + fclose( verify ); + } + XmlTest( "UTF-8: Verified multi-language round trip.", 1, okay ); + + // On most Western machines, this is an element that contains + // the word "resume" with the correct accents, in a latin encoding. + // It will be something else completely on non-wester machines, + // which is why TinyXml is switching to UTF-8. + const char latin[] = "<element>r\x82sum\x82</element>"; + + TiXmlDocument latinDoc; + latinDoc.Parse( latin, 0, TIXML_ENCODING_LEGACY ); + + text = latinDoc.FirstChildElement()->FirstChild()->ToText(); + XmlTest( "Legacy encoding: Verify text element.", "r\x82sum\x82", text->Value() ); + } + } + + ////////////////////// + // Copy and assignment + ////////////////////// + printf ("\n** Copy and Assignment **\n"); + { + TiXmlElement element( "foo" ); + element.Parse( "<element name='value' />", 0, TIXML_ENCODING_UNKNOWN ); + + TiXmlElement elementCopy( element ); + TiXmlElement elementAssign( "foo" ); + elementAssign.Parse( "<incorrect foo='bar'/>", 0, TIXML_ENCODING_UNKNOWN ); + elementAssign = element; + + XmlTest( "Copy/Assign: element copy #1.", "element", elementCopy.Value() ); + XmlTest( "Copy/Assign: element copy #2.", "value", elementCopy.Attribute( "name" ) ); + XmlTest( "Copy/Assign: element assign #1.", "element", elementAssign.Value() ); + XmlTest( "Copy/Assign: element assign #2.", "value", elementAssign.Attribute( "name" ) ); + XmlTest( "Copy/Assign: element assign #3.", true, ( 0 == elementAssign.Attribute( "foo" )) ); + + TiXmlComment comment; + comment.Parse( "<!--comment-->", 0, TIXML_ENCODING_UNKNOWN ); + TiXmlComment commentCopy( comment ); + TiXmlComment commentAssign; + commentAssign = commentCopy; + XmlTest( "Copy/Assign: comment copy.", "comment", commentCopy.Value() ); + XmlTest( "Copy/Assign: comment assign.", "comment", commentAssign.Value() ); + + TiXmlUnknown unknown; + unknown.Parse( "<[unknown]>", 0, TIXML_ENCODING_UNKNOWN ); + TiXmlUnknown unknownCopy( unknown ); + TiXmlUnknown unknownAssign; + unknownAssign.Parse( "incorrect", 0, TIXML_ENCODING_UNKNOWN ); + unknownAssign = unknownCopy; + XmlTest( "Copy/Assign: unknown copy.", "[unknown]", unknownCopy.Value() ); + XmlTest( "Copy/Assign: unknown assign.", "[unknown]", unknownAssign.Value() ); + + TiXmlText text( "TextNode" ); + TiXmlText textCopy( text ); + TiXmlText textAssign( "incorrect" ); + textAssign = text; + XmlTest( "Copy/Assign: text copy.", "TextNode", textCopy.Value() ); + XmlTest( "Copy/Assign: text assign.", "TextNode", textAssign.Value() ); + + TiXmlDeclaration dec; + dec.Parse( "<?xml version='1.0' encoding='UTF-8'?>", 0, TIXML_ENCODING_UNKNOWN ); + TiXmlDeclaration decCopy( dec ); + TiXmlDeclaration decAssign; + decAssign = dec; + + XmlTest( "Copy/Assign: declaration copy.", "UTF-8", decCopy.Encoding() ); + XmlTest( "Copy/Assign: text assign.", "UTF-8", decAssign.Encoding() ); + + TiXmlDocument doc; + elementCopy.InsertEndChild( textCopy ); + doc.InsertEndChild( decAssign ); + doc.InsertEndChild( elementCopy ); + doc.InsertEndChild( unknownAssign ); + + TiXmlDocument docCopy( doc ); + TiXmlDocument docAssign; + docAssign = docCopy; + +#ifdef TIXML_USE_STL + std::string original, copy, assign; + original << doc; + copy << docCopy; + assign << docAssign; + XmlTest( "Copy/Assign: document copy.", original.c_str(), copy.c_str(), true ); + XmlTest( "Copy/Assign: document assign.", original.c_str(), assign.c_str(), true ); + +#endif + } + + ////////////////////////////////////////////////////// +#ifdef TIXML_USE_STL + printf ("\n** Parsing, no Condense Whitespace **\n"); + TiXmlBase::SetCondenseWhiteSpace( false ); + { + istringstream parse1( "<start>This is \ntext</start>" ); + TiXmlElement text1( "text" ); + parse1 >> text1; + + XmlTest ( "Condense white space OFF.", "This is \ntext", + text1.FirstChild()->Value(), + true ); + } + TiXmlBase::SetCondenseWhiteSpace( true ); +#endif + + ////////////////////////////////////////////////////// + // GetText(); + { + const char* str = "<foo>This is text</foo>"; + TiXmlDocument doc; + doc.Parse( str ); + const TiXmlElement* element = doc.RootElement(); + + XmlTest( "GetText() normal use.", "This is text", element->GetText() ); + + str = "<foo><b>This is text</b></foo>"; + doc.Clear(); + doc.Parse( str ); + element = doc.RootElement(); + + XmlTest( "GetText() contained element.", element->GetText() == 0, true ); + + str = "<foo>This is <b>text</b></foo>"; + doc.Clear(); + TiXmlBase::SetCondenseWhiteSpace( false ); + doc.Parse( str ); + TiXmlBase::SetCondenseWhiteSpace( true ); + element = doc.RootElement(); + + XmlTest( "GetText() partial.", "This is ", element->GetText() ); + } + + + ////////////////////////////////////////////////////// + // CDATA + { + const char* str = "<xmlElement>" + "<![CDATA[" + "I am > the rules!\n" + "...since I make symbolic puns" + "]]>" + "</xmlElement>"; + TiXmlDocument doc; + doc.Parse( str ); + doc.Print(); + + XmlTest( "CDATA parse.", doc.FirstChildElement()->FirstChild()->Value(), + "I am > the rules!\n...since I make symbolic puns", + true ); + +#ifdef TIXML_USE_STL + //cout << doc << '\n'; + + doc.Clear(); + + istringstream parse0( str ); + parse0 >> doc; + //cout << doc << '\n'; + + XmlTest( "CDATA stream.", doc.FirstChildElement()->FirstChild()->Value(), + "I am > the rules!\n...since I make symbolic puns", + true ); +#endif + + TiXmlDocument doc1 = doc; + //doc.Print(); + + XmlTest( "CDATA copy.", doc1.FirstChildElement()->FirstChild()->Value(), + "I am > the rules!\n...since I make symbolic puns", + true ); + } + { + // [ 1482728 ] Wrong wide char parsing + char buf[256]; + buf[255] = 0; + for( int i=0; i<255; ++i ) + { + buf[i] = (char)((i>=32) ? i : 32); + } + TIXML_STRING str( "<xmlElement><![CDATA[" ); + str += buf; + str += "]]></xmlElement>"; + + TiXmlDocument doc; + doc.Parse( str.c_str() ); + + TiXmlPrinter printer; + printer.SetStreamPrinting(); + doc.Accept( &printer ); + + XmlTest( "CDATA with all bytes #1.", str.c_str(), printer.CStr(), true ); + +#ifdef TIXML_USE_STL + doc.Clear(); + istringstream iss( printer.Str() ); + iss >> doc; + std::string out; + out << doc; + XmlTest( "CDATA with all bytes #2.", out.c_str(), printer.CStr(), true ); +#endif + } + { + // [ 1480107 ] Bug-fix for STL-streaming of CDATA that contains tags + // CDATA streaming had a couple of bugs, that this tests for. + const char* str = "<xmlElement>" + "<![CDATA[" + "<b>I am > the rules!</b>\n" + "...since I make symbolic puns" + "]]>" + "</xmlElement>"; + TiXmlDocument doc; + doc.Parse( str ); + doc.Print(); + + XmlTest( "CDATA parse. [ 1480107 ]", doc.FirstChildElement()->FirstChild()->Value(), + "<b>I am > the rules!</b>\n...since I make symbolic puns", + true ); + +#ifdef TIXML_USE_STL + + doc.Clear(); + + istringstream parse0( str ); + parse0 >> doc; + + XmlTest( "CDATA stream. [ 1480107 ]", doc.FirstChildElement()->FirstChild()->Value(), + "<b>I am > the rules!</b>\n...since I make symbolic puns", + true ); +#endif + + TiXmlDocument doc1 = doc; + //doc.Print(); + + XmlTest( "CDATA copy. [ 1480107 ]", doc1.FirstChildElement()->FirstChild()->Value(), + "<b>I am > the rules!</b>\n...since I make symbolic puns", + true ); + } + ////////////////////////////////////////////////////// + // Visit() + + + + ////////////////////////////////////////////////////// + printf( "\n** Fuzzing... **\n" ); + + const int FUZZ_ITERATION = 300; + + // The only goal is not to crash on bad input. + int len = (int) strlen( demoStart ); + for( int i=0; i<FUZZ_ITERATION; ++i ) + { + char* demoCopy = new char[ len+1 ]; + strcpy( demoCopy, demoStart ); + + demoCopy[ i%len ] = (char)((i+1)*3); + demoCopy[ (i*7)%len ] = '>'; + demoCopy[ (i*11)%len ] = '<'; + + TiXmlDocument xml; + xml.Parse( demoCopy ); + + delete [] demoCopy; + } + printf( "** Fuzzing Complete. **\n" ); + + ////////////////////////////////////////////////////// + printf ("\n** Bug regression tests **\n"); + + // InsertBeforeChild and InsertAfterChild causes crash. + { + TiXmlElement parent( "Parent" ); + TiXmlElement childText0( "childText0" ); + TiXmlElement childText1( "childText1" ); + TiXmlNode* childNode0 = parent.InsertEndChild( childText0 ); + TiXmlNode* childNode1 = parent.InsertBeforeChild( childNode0, childText1 ); + + XmlTest( "Test InsertBeforeChild on empty node.", ( childNode1 == parent.FirstChild() ), true ); + } + + { + // InsertBeforeChild and InsertAfterChild causes crash. + TiXmlElement parent( "Parent" ); + TiXmlElement childText0( "childText0" ); + TiXmlElement childText1( "childText1" ); + TiXmlNode* childNode0 = parent.InsertEndChild( childText0 ); + TiXmlNode* childNode1 = parent.InsertAfterChild( childNode0, childText1 ); + + XmlTest( "Test InsertAfterChild on empty node. ", ( childNode1 == parent.LastChild() ), true ); + } + + // Reports of missing constructors, irregular string problems. + { + // Missing constructor implementation. No test -- just compiles. + TiXmlText text( "Missing" ); + +#ifdef TIXML_USE_STL + // Missing implementation: + TiXmlDocument doc; + string name = "missing"; + doc.LoadFile( name ); + + TiXmlText textSTL( name ); +#else + // verifying some basic string functions: + TiXmlString a; + TiXmlString b( "Hello" ); + TiXmlString c( "ooga" ); + + c = " World!"; + a = b; + a += c; + a = a; + + XmlTest( "Basic TiXmlString test. ", "Hello World!", a.c_str() ); +#endif + } + + // Long filenames crashing STL version + { + TiXmlDocument doc( "midsummerNightsDreamWithAVeryLongFilenameToConfuseTheStringHandlingRoutines.xml" ); + bool loadOkay = doc.LoadFile(); + loadOkay = true; // get rid of compiler warning. + // Won't pass on non-dev systems. Just a "no crash" check. + //XmlTest( "Long filename. ", true, loadOkay ); + } + + { + // Entities not being written correctly. + // From Lynn Allen + + const char* passages = + "<?xml version=\"1.0\" standalone=\"no\" ?>" + "<passages count=\"006\" formatversion=\"20020620\">" + "<psg context=\"Line 5 has "quotation marks" and 'apostrophe marks'." + " It also has <, >, and &, as well as a fake copyright ©.\"> </psg>" + "</passages>"; + + TiXmlDocument doc( "passages.xml" ); + doc.Parse( passages ); + TiXmlElement* psg = doc.RootElement()->FirstChildElement(); + const char* context = psg->Attribute( "context" ); + const char* expected = "Line 5 has \"quotation marks\" and 'apostrophe marks'. It also has <, >, and &, as well as a fake copyright \xC2\xA9."; + + XmlTest( "Entity transformation: read. ", expected, context, true ); + + FILE* textfile = fopen( "textfile.txt", "w" ); + if ( textfile ) + { + psg->Print( textfile, 0 ); + fclose( textfile ); + } + textfile = fopen( "textfile.txt", "r" ); + assert( textfile ); + if ( textfile ) + { + char buf[ 1024 ]; + fgets( buf, 1024, textfile ); + XmlTest( "Entity transformation: write. ", + "<psg context=\'Line 5 has "quotation marks" and 'apostrophe marks'." + " It also has <, >, and &, as well as a fake copyright \xC2\xA9.' />", + buf, + true ); + } + fclose( textfile ); + } + + { + FILE* textfile = fopen( "test5.xml", "w" ); + if ( textfile ) + { fputs("<?xml version='1.0'?><a.elem xmi.version='2.0'/>", textfile); fclose(textfile); - TiXmlDocument doc; + TiXmlDocument doc; doc.LoadFile( "test5.xml" ); XmlTest( "dot in element attributes and names", doc.Error(), 0); - } + } } - { - FILE* textfile = fopen( "test6.xml", "w" ); - if ( textfile ) - { + { + FILE* textfile = fopen( "test6.xml", "w" ); + if ( textfile ) + { fputs("<element><Name>1.1 Start easy ignore fin thickness
</Name></element>", textfile ); fclose(textfile); @@ -990,375 +994,376 @@ int main() bool result = doc.LoadFile( "test6.xml" ); XmlTest( "Entity with one digit.", result, true ); - TiXmlText* text = doc.FirstChildElement()->FirstChildElement()->FirstChild()->ToText(); - XmlTest( "Entity with one digit.", - text->Value(), "1.1 Start easy ignore fin thickness\n" ); - } + TiXmlText* text = doc.FirstChildElement()->FirstChildElement()->FirstChild()->ToText(); + XmlTest( "Entity with one digit.", + text->Value(), "1.1 Start easy ignore fin thickness\n" ); + } } - { - // DOCTYPE not preserved (950171) - // - const char* doctype = - "<?xml version=\"1.0\" ?>" - "<!DOCTYPE PLAY SYSTEM 'play.dtd'>" - "<!ELEMENT title (#PCDATA)>" - "<!ELEMENT books (title,authors)>" - "<element />"; - - TiXmlDocument doc; - doc.Parse( doctype ); - doc.SaveFile( "test7.xml" ); - doc.Clear(); - doc.LoadFile( "test7.xml" ); - - TiXmlHandle docH( &doc ); - TiXmlUnknown* unknown = docH.Child( 1 ).Unknown(); - XmlTest( "Correct value of unknown.", "!DOCTYPE PLAY SYSTEM 'play.dtd'", unknown->Value() ); - #ifdef TIXML_USE_STL - TiXmlNode* node = docH.Child( 2 ).Node(); - std::string str; - str << (*node); - XmlTest( "Correct streaming of unknown.", "<!ELEMENT title (#PCDATA)>", str.c_str() ); - #endif - } - - { - // [ 791411 ] Formatting bug - // Comments do not stream out correctly. - const char* doctype = - "<!-- Somewhat<evil> -->"; - TiXmlDocument doc; - doc.Parse( doctype ); - - TiXmlHandle docH( &doc ); - TiXmlComment* comment = docH.Child( 0 ).Node()->ToComment(); - - XmlTest( "Comment formatting.", " Somewhat<evil> ", comment->Value() ); - #ifdef TIXML_USE_STL - std::string str; - str << (*comment); - XmlTest( "Comment streaming.", "<!-- Somewhat<evil> -->", str.c_str() ); - #endif - } - - { - // [ 870502 ] White space issues - TiXmlDocument doc; - TiXmlText* text; - TiXmlHandle docH( &doc ); - - const char* doctype0 = "<element> This has leading and trailing space </element>"; - const char* doctype1 = "<element>This has internal space</element>"; - const char* doctype2 = "<element> This has leading, trailing, and internal space </element>"; - - TiXmlBase::SetCondenseWhiteSpace( false ); - doc.Clear(); - doc.Parse( doctype0 ); - text = docH.FirstChildElement( "element" ).Child( 0 ).Text(); - XmlTest( "White space kept.", " This has leading and trailing space ", text->Value() ); - - doc.Clear(); - doc.Parse( doctype1 ); - text = docH.FirstChildElement( "element" ).Child( 0 ).Text(); - XmlTest( "White space kept.", "This has internal space", text->Value() ); - - doc.Clear(); - doc.Parse( doctype2 ); - text = docH.FirstChildElement( "element" ).Child( 0 ).Text(); - XmlTest( "White space kept.", " This has leading, trailing, and internal space ", text->Value() ); - - TiXmlBase::SetCondenseWhiteSpace( true ); - doc.Clear(); - doc.Parse( doctype0 ); - text = docH.FirstChildElement( "element" ).Child( 0 ).Text(); - XmlTest( "White space condensed.", "This has leading and trailing space", text->Value() ); - - doc.Clear(); - doc.Parse( doctype1 ); - text = docH.FirstChildElement( "element" ).Child( 0 ).Text(); - XmlTest( "White space condensed.", "This has internal space", text->Value() ); - - doc.Clear(); - doc.Parse( doctype2 ); - text = docH.FirstChildElement( "element" ).Child( 0 ).Text(); - XmlTest( "White space condensed.", "This has leading, trailing, and internal space", text->Value() ); - } - - { - // Double attributes - const char* doctype = "<element attr='red' attr='blue' />"; - - TiXmlDocument doc; - doc.Parse( doctype ); - - XmlTest( "Parsing repeated attributes.", true, doc.Error() ); // is an error to tinyxml (didn't use to be, but caused issues) - //XmlTest( "Parsing repeated attributes.", "blue", doc.FirstChildElement( "element" )->Attribute( "attr" ) ); - } - - { - // Embedded null in stream. - const char* doctype = "<element att\0r='red' attr='blue' />"; - - TiXmlDocument doc; - doc.Parse( doctype ); - XmlTest( "Embedded null throws error.", true, doc.Error() ); - - #ifdef TIXML_USE_STL - istringstream strm( doctype ); - doc.Clear(); - doc.ClearError(); - strm >> doc; - XmlTest( "Embedded null throws error.", true, doc.Error() ); - #endif - } + { + // DOCTYPE not preserved (950171) + // + const char* doctype = + "<?xml version=\"1.0\" ?>" + "<!DOCTYPE PLAY SYSTEM 'play.dtd'>" + "<!ELEMENT title (#PCDATA)>" + "<!ELEMENT books (title,authors)>" + "<element />"; + + TiXmlDocument doc; + doc.Parse( doctype ); + doc.SaveFile( "test7.xml" ); + doc.Clear(); + doc.LoadFile( "test7.xml" ); + + TiXmlHandle docH( &doc ); + TiXmlUnknown* unknown = docH.Child( 1 ).Unknown(); + XmlTest( "Correct value of unknown.", "!DOCTYPE PLAY SYSTEM 'play.dtd'", unknown->Value() ); +#ifdef TIXML_USE_STL + TiXmlNode* node = docH.Child( 2 ).Node(); + std::string str; + str << (*node); + XmlTest( "Correct streaming of unknown.", "<!ELEMENT title (#PCDATA)>", str.c_str() ); +#endif + } { - // Legacy mode test. (This test may only pass on a western system) - const char* str = - "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" - "<ä>" - "CöntäntßäöüÄÖÜ" - "</ä>"; + // [ 791411 ] Formatting bug + // Comments do not stream out correctly. + const char* doctype = + "<!-- Somewhat<evil> -->"; + TiXmlDocument doc; + doc.Parse( doctype ); - TiXmlDocument doc; - doc.Parse( str ); - - TiXmlHandle docHandle( &doc ); - TiXmlHandle aHandle = docHandle.FirstChildElement( "ä" ); - TiXmlHandle tHandle = aHandle.Child( 0 ); - assert( aHandle.Element() ); - assert( tHandle.Text() ); - XmlTest( "ISO-8859-1 Parsing.", "CöntäntßäöüÄÖÜ", tHandle.Text()->Value() ); + TiXmlHandle docH( &doc ); + TiXmlComment* comment = docH.Child( 0 ).Node()->ToComment(); + + XmlTest( "Comment formatting.", " Somewhat<evil> ", comment->Value() ); +#ifdef TIXML_USE_STL + std::string str; + str << (*comment); + XmlTest( "Comment streaming.", "<!-- Somewhat<evil> -->", str.c_str() ); +#endif + } + + { + // [ 870502 ] White space issues + TiXmlDocument doc; + TiXmlText* text; + TiXmlHandle docH( &doc ); + + const char* doctype0 = "<element> This has leading and trailing space </element>"; + const char* doctype1 = "<element>This has internal space</element>"; + const char* doctype2 = "<element> This has leading, trailing, and internal space </element>"; + + TiXmlBase::SetCondenseWhiteSpace( false ); + doc.Clear(); + doc.Parse( doctype0 ); + text = docH.FirstChildElement( "element" ).Child( 0 ).Text(); + XmlTest( "White space kept.", " This has leading and trailing space ", text->Value() ); + + doc.Clear(); + doc.Parse( doctype1 ); + text = docH.FirstChildElement( "element" ).Child( 0 ).Text(); + XmlTest( "White space kept.", "This has internal space", text->Value() ); + + doc.Clear(); + doc.Parse( doctype2 ); + text = docH.FirstChildElement( "element" ).Child( 0 ).Text(); + XmlTest( "White space kept.", " This has leading, trailing, and internal space ", text->Value() ); + + TiXmlBase::SetCondenseWhiteSpace( true ); + doc.Clear(); + doc.Parse( doctype0 ); + text = docH.FirstChildElement( "element" ).Child( 0 ).Text(); + XmlTest( "White space condensed.", "This has leading and trailing space", text->Value() ); + + doc.Clear(); + doc.Parse( doctype1 ); + text = docH.FirstChildElement( "element" ).Child( 0 ).Text(); + XmlTest( "White space condensed.", "This has internal space", text->Value() ); + + doc.Clear(); + doc.Parse( doctype2 ); + text = docH.FirstChildElement( "element" ).Child( 0 ).Text(); + XmlTest( "White space condensed.", "This has leading, trailing, and internal space", text->Value() ); + } + + { + // Double attributes + const char* doctype = "<element attr='red' attr='blue' />"; + + TiXmlDocument doc; + doc.Parse( doctype ); + + XmlTest( "Parsing repeated attributes.", true, doc.Error() ); // is an error to tinyxml (didn't use to be, but caused issues) + //XmlTest( "Parsing repeated attributes.", "blue", doc.FirstChildElement( "element" )->Attribute( "attr" ) ); + } + + { + // Embedded null in stream. + const char* doctype = "<element att\0r='red' attr='blue' />"; + + TiXmlDocument doc; + doc.Parse( doctype ); + XmlTest( "Embedded null throws error.", true, doc.Error() ); + +#ifdef TIXML_USE_STL + istringstream strm( doctype ); + doc.Clear(); + doc.ClearError(); + strm >> doc; + XmlTest( "Embedded null throws error.", true, doc.Error() ); +#endif + } + + { + // Legacy mode test. (This test may only pass on a western system) + const char* str = + "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" + "<ä>" + "CöntäntßäöüÄÖÜ" + "</ä>"; + + TiXmlDocument doc; + doc.Parse( str ); + + TiXmlHandle docHandle( &doc ); + TiXmlHandle aHandle = docHandle.FirstChildElement( "ä" ); + TiXmlHandle tHandle = aHandle.Child( 0 ); + assert( aHandle.Element() ); + assert( tHandle.Text() ); + XmlTest( "ISO-8859-1 Parsing.", "CöntäntßäöüÄÖÜ", tHandle.Text()->Value() ); + } + + { + // Empty documents should return TIXML_ERROR_PARSING_EMPTY, bug 1070717 + const char* str = " "; + TiXmlDocument doc; + doc.Parse( str ); + XmlTest( "Empty document error TIXML_ERROR_DOCUMENT_EMPTY", TiXmlBase::TIXML_ERROR_DOCUMENT_EMPTY, doc.ErrorId() ); + } +#ifndef TIXML_USE_STL + { + // String equality. [ 1006409 ] string operator==/!= no worky in all cases + TiXmlString temp; + XmlTest( "Empty tinyxml string compare equal", ( temp == "" ), true ); + + TiXmlString foo; + TiXmlString bar( "" ); + XmlTest( "Empty tinyxml string compare equal", ( foo == bar ), true ); + } + +#endif + { + // Bug [ 1195696 ] from marlonism + TiXmlBase::SetCondenseWhiteSpace(false); + TiXmlDocument xml; + xml.Parse("<text><break/>This hangs</text>"); + XmlTest( "Test safe error return.", xml.Error(), false ); + } + + { + // Bug [ 1243992 ] - another infinite loop + TiXmlDocument doc; + doc.SetCondenseWhiteSpace(false); + doc.Parse("<p><pb></pb>test</p>"); + } + { + // Low entities + TiXmlDocument xml; + xml.Parse( "<test></test>" ); + const char result[] = { 0x0e, 0 }; + XmlTest( "Low entities.", xml.FirstChildElement()->GetText(), result ); + xml.Print(); + } + { + // Bug [ 1451649 ] Attribute values with trailing quotes not handled correctly + TiXmlDocument xml; + xml.Parse( "<foo attribute=bar\" />" ); + XmlTest( "Throw error with bad end quotes.", xml.Error(), true ); + } +#ifdef TIXML_USE_STL + { + // Bug [ 1449463 ] Consider generic query + TiXmlDocument xml; + xml.Parse( "<foo bar='3' barStr='a string'/>" ); + + TiXmlElement* ele = xml.FirstChildElement(); + double d; + int i; + float f; + bool b; + std::string str; + + XmlTest( "QueryValueAttribute", ele->QueryValueAttribute( "bar", &d ), TIXML_SUCCESS ); + XmlTest( "QueryValueAttribute", ele->QueryValueAttribute( "bar", &i ), TIXML_SUCCESS ); + XmlTest( "QueryValueAttribute", ele->QueryValueAttribute( "bar", &f ), TIXML_SUCCESS ); + XmlTest( "QueryValueAttribute", ele->QueryValueAttribute( "bar", &b ), TIXML_WRONG_TYPE ); + XmlTest( "QueryValueAttribute", ele->QueryValueAttribute( "nobar", &b ), TIXML_NO_ATTRIBUTE ); + XmlTest( "QueryValueAttribute", ele->QueryValueAttribute( "barStr", &str ), TIXML_SUCCESS ); + + XmlTest( "QueryValueAttribute", (d==3.0), true ); + XmlTest( "QueryValueAttribute", (i==3), true ); + XmlTest( "QueryValueAttribute", (f==3.0f), true ); + XmlTest( "QueryValueAttribute", (str==std::string( "a string" )), true ); + } +#endif + +#ifdef TIXML_USE_STL + { + // [ 1505267 ] redundant malloc in TiXmlElement::Attribute + TiXmlDocument xml; + xml.Parse( "<foo bar='3' />" ); + TiXmlElement* ele = xml.FirstChildElement(); + double d; + int i; + + std::string bar = "bar"; + + const std::string* atrrib = ele->Attribute( bar ); + ele->Attribute( bar, &d ); + ele->Attribute( bar, &i ); + + XmlTest( "Attribute", atrrib->empty(), false ); + XmlTest( "Attribute", (d==3.0), true ); + XmlTest( "Attribute", (i==3), true ); + } +#endif + + { + // [ 1356059 ] Allow TiXMLDocument to only be at the top level + TiXmlDocument xml, xml2; + xml.InsertEndChild( xml2 ); + XmlTest( "Document only at top level.", xml.Error(), true ); + XmlTest( "Document only at top level.", xml.ErrorId(), TiXmlBase::TIXML_ERROR_DOCUMENT_TOP_ONLY ); + } + + { + // [ 1663758 ] Failure to report error on bad XML + TiXmlDocument xml; + xml.Parse("<x>"); + XmlTest("Missing end tag at end of input", xml.Error(), true); + xml.Parse("<x> "); + XmlTest("Missing end tag with trailing whitespace", xml.Error(), true); + } + + { + // [ 1635701 ] fail to parse files with a tag separated into two lines + // I'm not sure this is a bug. Marked 'pending' for feedback. + TiXmlDocument xml; + xml.Parse( "<title><p>text</p\n><title>" ); + //xml.Print(); + //XmlTest( "Tag split by newline", xml.Error(), false ); + } + +#ifdef TIXML_USE_STL + { + // [ 1475201 ] TinyXML parses entities in comments + TiXmlDocument xml; + istringstream parse1( "<!-- declarations for <head> & <body> -->" + "<!-- far & away -->" ); + parse1 >> xml; + + TiXmlNode* e0 = xml.FirstChild(); + TiXmlNode* e1 = e0->NextSibling(); + TiXmlComment* c0 = e0->ToComment(); + TiXmlComment* c1 = e1->ToComment(); + + XmlTest( "Comments ignore entities.", " declarations for <head> & <body> ", c0->Value(), true ); + XmlTest( "Comments ignore entities.", " far & away ", c1->Value(), true ); + } +#endif + + { + // [ 1475201 ] TinyXML parses entities in comments + TiXmlDocument xml; + xml.Parse("<!-- declarations for <head> & <body> -->" + "<!-- far & away -->" ); + + TiXmlNode* e0 = xml.FirstChild(); + TiXmlNode* e1 = e0->NextSibling(); + TiXmlComment* c0 = e0->ToComment(); + TiXmlComment* c1 = e1->ToComment(); + + XmlTest( "Comments ignore entities.", " declarations for <head> & <body> ", c0->Value(), true ); + XmlTest( "Comments ignore entities.", " far & away ", c1->Value(), true ); + } + + { + TiXmlDocument xml; + xml.Parse( "<Parent>" + "<child1 att=''/>" + "<!-- With this comment, child2 will not be parsed! -->" + "<child2 att=''/>" + "</Parent>" ); + int count = 0; + + TiXmlNode* ele = 0; + while ( (ele = xml.FirstChildElement( "Parent" )->IterateChildren( ele ) ) != 0 ) + { + ++count; + } + XmlTest( "Comments iterate correctly.", 3, count ); + } + + { + // trying to repro ]1874301]. If it doesn't go into an infinite loop, all is well. + unsigned char buf[] = "<?xml version=\"1.0\" encoding=\"utf-8\"?><feed><![CDATA[Test XMLblablablalblbl"; + buf[60] = 239; + buf[61] = 0; + + TiXmlDocument doc; + doc.Parse( (const char*)buf); + } + + + { + // bug 1827248 Error while parsing a little bit malformed file + // Actually not malformed - should work. + TiXmlDocument xml; + xml.Parse( "<attributelist> </attributelist >" ); + XmlTest( "Handle end tag whitespace", false, xml.Error() ); + } + + { + // 1709904 - can not repro the crash + { + TiXmlDocument xml; + xml.Parse( "<tag>/</tag>" ); + XmlTest( "Odd XML parsing.", xml.FirstChild()->Value(), "tag" ); + } + /* Could not repro. { + TiXmlDocument xml; + xml.LoadFile( "EQUI_Inventory.xml" ); + //XmlTest( "Odd XML parsing.", xml.FirstChildElement()->Value(), "XML" ); + TiXmlPrinter printer; + xml.Accept( &printer ); + fprintf( stdout, "%s", printer.CStr() ); + }*/ } - { - // Empty documents should return TIXML_ERROR_PARSING_EMPTY, bug 1070717 - const char* str = " "; - TiXmlDocument doc; - doc.Parse( str ); - XmlTest( "Empty document error TIXML_ERROR_DOCUMENT_EMPTY", TiXmlBase::TIXML_ERROR_DOCUMENT_EMPTY, doc.ErrorId() ); - } - #ifndef TIXML_USE_STL - { - // String equality. [ 1006409 ] string operator==/!= no worky in all cases - TiXmlString temp; - XmlTest( "Empty tinyxml string compare equal", ( temp == "" ), true ); - - TiXmlString foo; - TiXmlString bar( "" ); - XmlTest( "Empty tinyxml string compare equal", ( foo == bar ), true ); - } - - #endif - { - // Bug [ 1195696 ] from marlonism - TiXmlBase::SetCondenseWhiteSpace(false); - TiXmlDocument xml; - xml.Parse("<text><break/>This hangs</text>"); - XmlTest( "Test safe error return.", xml.Error(), false ); - } - - { - // Bug [ 1243992 ] - another infinite loop - TiXmlDocument doc; - doc.SetCondenseWhiteSpace(false); - doc.Parse("<p><pb></pb>test</p>"); - } - { - // Low entities - TiXmlDocument xml; - xml.Parse( "<test></test>" ); - const char result[] = { 0x0e, 0 }; - XmlTest( "Low entities.", xml.FirstChildElement()->GetText(), result ); - xml.Print(); - } - { - // Bug [ 1451649 ] Attribute values with trailing quotes not handled correctly - TiXmlDocument xml; - xml.Parse( "<foo attribute=bar\" />" ); - XmlTest( "Throw error with bad end quotes.", xml.Error(), true ); - } - #ifdef TIXML_USE_STL - { - // Bug [ 1449463 ] Consider generic query - TiXmlDocument xml; - xml.Parse( "<foo bar='3' barStr='a string'/>" ); - - TiXmlElement* ele = xml.FirstChildElement(); - double d; - int i; - float f; - bool b; - std::string str; - - XmlTest( "QueryValueAttribute", ele->QueryValueAttribute( "bar", &d ), TIXML_SUCCESS ); - XmlTest( "QueryValueAttribute", ele->QueryValueAttribute( "bar", &i ), TIXML_SUCCESS ); - XmlTest( "QueryValueAttribute", ele->QueryValueAttribute( "bar", &f ), TIXML_SUCCESS ); - XmlTest( "QueryValueAttribute", ele->QueryValueAttribute( "bar", &b ), TIXML_WRONG_TYPE ); - XmlTest( "QueryValueAttribute", ele->QueryValueAttribute( "nobar", &b ), TIXML_NO_ATTRIBUTE ); - XmlTest( "QueryValueAttribute", ele->QueryValueAttribute( "barStr", &str ), TIXML_SUCCESS ); - - XmlTest( "QueryValueAttribute", (d==3.0), true ); - XmlTest( "QueryValueAttribute", (i==3), true ); - XmlTest( "QueryValueAttribute", (f==3.0f), true ); - XmlTest( "QueryValueAttribute", (str==std::string( "a string" )), true ); - } - #endif - - #ifdef TIXML_USE_STL - { - // [ 1505267 ] redundant malloc in TiXmlElement::Attribute - TiXmlDocument xml; - xml.Parse( "<foo bar='3' />" ); - TiXmlElement* ele = xml.FirstChildElement(); - double d; - int i; - - std::string bar = "bar"; - - const std::string* atrrib = ele->Attribute( bar ); - ele->Attribute( bar, &d ); - ele->Attribute( bar, &i ); - - XmlTest( "Attribute", atrrib->empty(), false ); - XmlTest( "Attribute", (d==3.0), true ); - XmlTest( "Attribute", (i==3), true ); - } - #endif - - { - // [ 1356059 ] Allow TiXMLDocument to only be at the top level - TiXmlDocument xml, xml2; - xml.InsertEndChild( xml2 ); - XmlTest( "Document only at top level.", xml.Error(), true ); - XmlTest( "Document only at top level.", xml.ErrorId(), TiXmlBase::TIXML_ERROR_DOCUMENT_TOP_ONLY ); - } - - { - // [ 1663758 ] Failure to report error on bad XML - TiXmlDocument xml; - xml.Parse("<x>"); - XmlTest("Missing end tag at end of input", xml.Error(), true); - xml.Parse("<x> "); - XmlTest("Missing end tag with trailing whitespace", xml.Error(), true); - } - - { - // [ 1635701 ] fail to parse files with a tag separated into two lines - // I'm not sure this is a bug. Marked 'pending' for feedback. - TiXmlDocument xml; - xml.Parse( "<title><p>text</p\n><title>" ); - //xml.Print(); - //XmlTest( "Tag split by newline", xml.Error(), false ); - } - - #ifdef TIXML_USE_STL - { - // [ 1475201 ] TinyXML parses entities in comments - TiXmlDocument xml; - istringstream parse1( "<!-- declarations for <head> & <body> -->" - "<!-- far & away -->" ); - parse1 >> xml; - - TiXmlNode* e0 = xml.FirstChild(); - TiXmlNode* e1 = e0->NextSibling(); - TiXmlComment* c0 = e0->ToComment(); - TiXmlComment* c1 = e1->ToComment(); - - XmlTest( "Comments ignore entities.", " declarations for <head> & <body> ", c0->Value(), true ); - XmlTest( "Comments ignore entities.", " far & away ", c1->Value(), true ); - } - #endif - - { - // [ 1475201 ] TinyXML parses entities in comments - TiXmlDocument xml; - xml.Parse("<!-- declarations for <head> & <body> -->" - "<!-- far & away -->" ); - - TiXmlNode* e0 = xml.FirstChild(); - TiXmlNode* e1 = e0->NextSibling(); - TiXmlComment* c0 = e0->ToComment(); - TiXmlComment* c1 = e1->ToComment(); - - XmlTest( "Comments ignore entities.", " declarations for <head> & <body> ", c0->Value(), true ); - XmlTest( "Comments ignore entities.", " far & away ", c1->Value(), true ); - } - - { - TiXmlDocument xml; - xml.Parse( "<Parent>" - "<child1 att=''/>" - "<!-- With this comment, child2 will not be parsed! -->" - "<child2 att=''/>" - "</Parent>" ); - int count = 0; - - TiXmlNode* ele = 0; - while ( (ele = xml.FirstChildElement( "Parent" )->IterateChildren( ele ) ) != 0 ) { - ++count; - } - XmlTest( "Comments iterate correctly.", 3, count ); - } - - { - // trying to repro ]1874301]. If it doesn't go into an infinite loop, all is well. - unsigned char buf[] = "<?xml version=\"1.0\" encoding=\"utf-8\"?><feed><![CDATA[Test XMLblablablalblbl"; - buf[60] = 239; - buf[61] = 0; - - TiXmlDocument doc; - doc.Parse( (const char*)buf); - } - - - { - // bug 1827248 Error while parsing a little bit malformed file - // Actually not malformed - should work. - TiXmlDocument xml; - xml.Parse( "<attributelist> </attributelist >" ); - XmlTest( "Handle end tag whitespace", false, xml.Error() ); - } - - { - // 1709904 - can not repro the crash - { - TiXmlDocument xml; - xml.Parse( "<tag>/</tag>" ); - XmlTest( "Odd XML parsing.", xml.FirstChild()->Value(), "tag" ); - } - /* Could not repro. { - TiXmlDocument xml; - xml.LoadFile( "EQUI_Inventory.xml" ); - //XmlTest( "Odd XML parsing.", xml.FirstChildElement()->Value(), "XML" ); - TiXmlPrinter printer; - xml.Accept( &printer ); - fprintf( stdout, "%s", printer.CStr() ); - }*/ - } - - /* 1417717 experiment - { - TiXmlDocument xml; - xml.Parse("<text>Dan & Tracie</text>"); - xml.Print(stdout); - } - { - TiXmlDocument xml; - xml.Parse("<text>Dan &foo; Tracie</text>"); - xml.Print(stdout); - } - */ - #if defined( WIN32 ) && defined( TUNE ) - _CrtMemCheckpoint( &endMemState ); - //_CrtMemDumpStatistics( &endMemState ); - - _CrtMemState diffMemState; - _CrtMemDifference( &diffMemState, &startMemState, &endMemState ); - _CrtMemDumpStatistics( &diffMemState ); - #endif - - printf ("\nPass %d, Fail %d\n", gPass, gFail); - return gFail; + /* 1417717 experiment + { + TiXmlDocument xml; + xml.Parse("<text>Dan & Tracie</text>"); + xml.Print(stdout); + } + { + TiXmlDocument xml; + xml.Parse("<text>Dan &foo; Tracie</text>"); + xml.Print(stdout); + } + */ +#if defined( WIN32 ) && defined( TUNE ) + _CrtMemCheckpoint( &endMemState ); + //_CrtMemDumpStatistics( &endMemState ); + + _CrtMemState diffMemState; + _CrtMemDifference( &diffMemState, &startMemState, &endMemState ); + _CrtMemDumpStatistics( &diffMemState ); +#endif + + printf ("\nPass %d, Fail %d\n", gPass, gFail); + return gFail; } diff --git a/shared/util.cpp b/shared/util.cpp index f115f8dc..2af7dc5b 100644 --- a/shared/util.cpp +++ b/shared/util.cpp @@ -175,16 +175,16 @@ wxString ffs3::utcTimeToLocalString(const wxLongLong& utcTime) SYSTEMTIME systemTimeUtc = {}; if (!::FileTimeToSystemTime( - &lastWriteTimeUtc, //__in const FILETIME *lpFileTime, - &systemTimeUtc)) //__out LPSYSTEMTIME lpSystemTime + &lastWriteTimeUtc, //__in const FILETIME *lpFileTime, + &systemTimeUtc)) //__out LPSYSTEMTIME lpSystemTime throw std::runtime_error(std::string((wxString(_("Conversion error:")) + wxT(" FILETIME -> SYSTEMTIME: ") + wxT("(") + wxULongLong(lastWriteTimeUtc.dwHighDateTime, lastWriteTimeUtc.dwLowDateTime).ToString() + wxT(") ") + wxT("\n\n") + getLastErrorFormatted()).ToAscii())); if (!::SystemTimeToTzSpecificLocalTime( - NULL, //__in_opt LPTIME_ZONE_INFORMATION lpTimeZone, - &systemTimeUtc, //__in LPSYSTEMTIME lpUniversalTime, - &systemTimeLocal)) //__out LPSYSTEMTIME lpLocalTime + NULL, //__in_opt LPTIME_ZONE_INFORMATION lpTimeZone, + &systemTimeUtc, //__in LPSYSTEMTIME lpUniversalTime, + &systemTimeLocal)) //__out LPSYSTEMTIME lpLocalTime throw std::runtime_error(std::string((wxString(_("Conversion error:")) + wxT(" SYSTEMTIME -> local SYSTEMTIME: ") + wxT("(") + wxULongLong(lastWriteTimeUtc.dwHighDateTime, lastWriteTimeUtc.dwLowDateTime).ToString() + wxT(") ") + wxT("\n\n") + getLastErrorFormatted()).ToAscii())); @@ -193,8 +193,8 @@ wxString ffs3::utcTimeToLocalString(const wxLongLong& utcTime) { FILETIME fileTimeLocal = {}; if (!::FileTimeToLocalFileTime( //convert to local time - &lastWriteTimeUtc, //pointer to UTC file time to convert - &fileTimeLocal)) //pointer to converted file time + &lastWriteTimeUtc, //pointer to UTC file time to convert + &fileTimeLocal)) //pointer to converted file time throw std::runtime_error(std::string((wxString(_("Conversion error:")) + wxT(" FILETIME -> local FILETIME: ") + wxT("(") + wxULongLong(lastWriteTimeUtc.dwHighDateTime, lastWriteTimeUtc.dwLowDateTime).ToString() + wxT(") ") + wxT("\n\n") + getLastErrorFormatted()).ToAscii())); @@ -205,8 +205,8 @@ wxString ffs3::utcTimeToLocalString(const wxLongLong& utcTime) // dateLow = 4294967295 if (!::FileTimeToSystemTime( - &fileTimeLocal, //pointer to file time to convert - &systemTimeLocal)) //pointer to structure to receive system time + &fileTimeLocal, //pointer to file time to convert + &systemTimeLocal)) //pointer to structure to receive system time throw std::runtime_error(std::string((wxString(_("Conversion error:")) + wxT(" local FILETIME -> local SYSTEMTIME: ") + wxT("(") + wxULongLong(fileTimeLocal.dwHighDateTime, fileTimeLocal.dwLowDateTime).ToString() + wxT(") ") + wxT("\n\n") + getLastErrorFormatted()).ToAscii())); diff --git a/shared/xml_base.cpp b/shared/xml_base.cpp index 99d4d3ca..c3d04364 100644 --- a/shared/xml_base.cpp +++ b/shared/xml_base.cpp @@ -19,16 +19,16 @@ std::string getTypeName(xmlAccess::XmlType type) { switch (type) { - case xmlAccess::XML_GUI_CONFIG: - return "GUI"; - case xmlAccess::XML_BATCH_CONFIG: - return "BATCH"; - case xmlAccess::XML_GLOBAL_SETTINGS: - return "GLOBAL"; - case xmlAccess::XML_REAL_CONFIG: - return "REAL"; - case xmlAccess::XML_OTHER: - break; + case xmlAccess::XML_GUI_CONFIG: + return "GUI"; + case xmlAccess::XML_BATCH_CONFIG: + return "BATCH"; + case xmlAccess::XML_GLOBAL_SETTINGS: + return "GLOBAL"; + case xmlAccess::XML_REAL_CONFIG: + return "REAL"; + case xmlAccess::XML_OTHER: + break; } assert(false); return "OTHER"; @@ -44,13 +44,13 @@ void normalize(std::vector<char>& stream) for (std::vector<char>::const_iterator i = stream.begin(); i != stream.end(); ++i) switch (*i) { - case 0xD: - tmp.push_back(0xA); - if (i + 1 != stream.end() && *(i + 1) == 0xA) - ++i; - break; - default: - tmp.push_back(*i); + case 0xD: + tmp.push_back(0xA); + if (i + 1 != stream.end() && *(i + 1) == 0xA) + ++i; + break; + default: + tmp.push_back(*i); } stream.swap(tmp); @@ -131,6 +131,8 @@ xmlAccess::XmlType xmlAccess::getXmlType(const wxString& filename) //throw() void xmlAccess::loadXmlDocument(const wxString& filename, const xmlAccess::XmlType type, TiXmlDocument& document) //throw XmlError() { + TiXmlBase::SetCondenseWhiteSpace(false); //do not condense whitespace characters + ::loadRawXmlDocument(filename, document); //throw XmlError() TiXmlElement* root = document.RootElement(); diff --git a/shared/zbase.h b/shared/zbase.h index c3d539a1..a0322de0 100644 --- a/shared/zbase.h +++ b/shared/zbase.h @@ -225,7 +225,7 @@ public: Zbase(const Zbase& source); ~Zbase(); - operator const T*() const; //implicit conversion to C-string + operator const T* () const; //implicit conversion to C-string //STL accessors const T* begin() const; @@ -417,7 +417,7 @@ Zbase<T, SP, AP>::~Zbase() template <class T, template <class, class> class SP, class AP> inline -Zbase<T, SP, AP>::operator const T*() const +Zbase<T, SP, AP>::operator const T* () const { return rawStr; } diff --git a/shared/zstring.cpp b/shared/zstring.cpp index 40590a90..6440c9af 100644 --- a/shared/zstring.cpp +++ b/shared/zstring.cpp @@ -31,8 +31,8 @@ LeakChecker::~LeakChecker() std::string leakingStrings; for (VoidPtrSizeMap::const_iterator i = activeStrings.begin(); - i != activeStrings.end() && ++rowCount <= 20; - ++i) + i != activeStrings.end() && ++rowCount <= 20; + ++i) leakingStrings += "\"" + rawMemToString(i->first, i->second) + "\"\n"; const std::string message = std::string("Memory leak detected!") + "\n\n" @@ -130,8 +130,8 @@ int z_impl::compareFilenamesWin(const wchar_t* a, const wchar_t* b, size_t sizeA } else //fallback { -//do NOT use "CompareString"; this function is NOT accurate (even with LOCALE_INVARIANT and SORT_STRINGSORT): for example "weiß" == "weiss"!!! -//the only reliable way to compare filenames (with XP) is to call "CharUpper" or "LCMapString": + //do NOT use "CompareString"; this function is NOT accurate (even with LOCALE_INVARIANT and SORT_STRINGSORT): for example "weiß" == "weiss"!!! + //the only reliable way to compare filenames (with XP) is to call "CharUpper" or "LCMapString": const size_t minSize = std::min(sizeA, sizeB); @@ -145,13 +145,13 @@ int z_impl::compareFilenamesWin(const wchar_t* a, const wchar_t* b, size_t sizeA wchar_t bufferB[5000]; if (::LCMapString( //faster than CharUpperBuff + wmemcpy or CharUpper + wmemcpy and same speed like ::CompareString() - ZSTRING_INVARIANT_LOCALE, //__in LCID Locale, - LCMAP_UPPERCASE, //__in DWORD dwMapFlags, - a, //__in LPCTSTR lpSrcStr, - static_cast<int>(minSize), //__in int cchSrc, - bufferA, //__out LPTSTR lpDestStr, - 5000 //__in int cchDest - ) == 0) + ZSTRING_INVARIANT_LOCALE, //__in LCID Locale, + LCMAP_UPPERCASE, //__in DWORD dwMapFlags, + a, //__in LPCTSTR lpSrcStr, + static_cast<int>(minSize), //__in int cchSrc, + bufferA, //__out LPTSTR lpDestStr, + 5000 //__in int cchDest + ) == 0) throw std::runtime_error("Error comparing strings! (LCMapString)"); if (::LCMapString(ZSTRING_INVARIANT_LOCALE, LCMAP_UPPERCASE, b, static_cast<int>(minSize), bufferB, 5000) == 0) @@ -178,18 +178,18 @@ int z_impl::compareFilenamesWin(const wchar_t* a, const wchar_t* b, size_t sizeA rv; } -// const int rv = CompareString( -// invariantLocale, //locale independent -// NORM_IGNORECASE | SORT_STRINGSORT, //comparison-style options -// a, //pointer to first string -// aCount, //size, in bytes or characters, of first string -// b, //pointer to second string -// bCount); //size, in bytes or characters, of second string -// -// if (rv == 0) -// throw std::runtime_error("Error comparing strings!"); -// else -// return rv - 2; //convert to C-style string compare result + // const int rv = CompareString( + // invariantLocale, //locale independent + // NORM_IGNORECASE | SORT_STRINGSORT, //comparison-style options + // a, //pointer to first string + // aCount, //size, in bytes or characters, of first string + // b, //pointer to second string + // bCount); //size, in bytes or characters, of second string + // + // if (rv == 0) + // throw std::runtime_error("Error comparing strings!"); + // else + // return rv - 2; //convert to C-style string compare result } diff --git a/structures.cpp b/structures.cpp index 4dde40e0..7eb1eb4e 100644 --- a/structures.cpp +++ b/structures.cpp @@ -30,10 +30,10 @@ wxString ffs3::getVariantName(CompareVariant var) { switch (var) { - case CMP_BY_CONTENT: - return _("File content"); - case CMP_BY_TIME_SIZE: - return _("File size and date"); + case CMP_BY_CONTENT: + return _("File content"); + case CMP_BY_TIME_SIZE: + return _("File size and date"); } assert(false); @@ -45,14 +45,14 @@ wxString ffs3::getVariantName(const SyncConfiguration& syncCfg) { switch (getVariant(syncCfg)) { - case SyncConfiguration::AUTOMATIC: - return _("<Automatic>"); - case SyncConfiguration::MIRROR: - return _("Mirror ->>"); - case SyncConfiguration::UPDATE: - return _("Update ->"); - case SyncConfiguration::CUSTOM: - return _("Custom"); + case SyncConfiguration::AUTOMATIC: + return _("<Automatic>"); + case SyncConfiguration::MIRROR: + return _("Mirror ->>"); + case SyncConfiguration::UPDATE: + return _("Update ->"); + case SyncConfiguration::CUSTOM: + return _("Custom"); } return _("Error"); } @@ -75,12 +75,12 @@ SyncConfiguration::Variant ffs3::getVariant(const SyncConfiguration& syncCfg) if (syncCfg.automatic == true) return SyncConfiguration::AUTOMATIC; //automatic mode - if ( syncCfg.exLeftSideOnly == SYNC_DIR_RIGHT && - syncCfg.exRightSideOnly == SYNC_DIR_RIGHT && - syncCfg.leftNewer == SYNC_DIR_RIGHT && - syncCfg.rightNewer == SYNC_DIR_RIGHT && - syncCfg.different == SYNC_DIR_RIGHT && - syncCfg.conflict == SYNC_DIR_RIGHT) + if (syncCfg.exLeftSideOnly == SYNC_DIR_RIGHT && + syncCfg.exRightSideOnly == SYNC_DIR_RIGHT && + syncCfg.leftNewer == SYNC_DIR_RIGHT && + syncCfg.rightNewer == SYNC_DIR_RIGHT && + syncCfg.different == SYNC_DIR_RIGHT && + syncCfg.conflict == SYNC_DIR_RIGHT) return SyncConfiguration::MIRROR; //one way -> else if (syncCfg.exLeftSideOnly == SYNC_DIR_RIGHT && @@ -99,30 +99,30 @@ void ffs3::setVariant(SyncConfiguration& syncCfg, const SyncConfiguration::Varia { switch (var) { - case SyncConfiguration::AUTOMATIC: - syncCfg.automatic = true; - break; - case SyncConfiguration::MIRROR: - syncCfg.automatic = false; - syncCfg.exLeftSideOnly = SYNC_DIR_RIGHT; - syncCfg.exRightSideOnly = SYNC_DIR_RIGHT; - syncCfg.leftNewer = SYNC_DIR_RIGHT; - syncCfg.rightNewer = SYNC_DIR_RIGHT; - syncCfg.different = SYNC_DIR_RIGHT; - syncCfg.conflict = SYNC_DIR_RIGHT; - break; - case SyncConfiguration::UPDATE: - syncCfg.automatic = false; - syncCfg.exLeftSideOnly = SYNC_DIR_RIGHT; - syncCfg.exRightSideOnly = SYNC_DIR_NONE; - syncCfg.leftNewer = SYNC_DIR_RIGHT; - syncCfg.rightNewer = SYNC_DIR_NONE; - syncCfg.different = SYNC_DIR_RIGHT; - syncCfg.conflict = SYNC_DIR_NONE; - break; - case SyncConfiguration::CUSTOM: - assert(false); - break; + case SyncConfiguration::AUTOMATIC: + syncCfg.automatic = true; + break; + case SyncConfiguration::MIRROR: + syncCfg.automatic = false; + syncCfg.exLeftSideOnly = SYNC_DIR_RIGHT; + syncCfg.exRightSideOnly = SYNC_DIR_RIGHT; + syncCfg.leftNewer = SYNC_DIR_RIGHT; + syncCfg.rightNewer = SYNC_DIR_RIGHT; + syncCfg.different = SYNC_DIR_RIGHT; + syncCfg.conflict = SYNC_DIR_RIGHT; + break; + case SyncConfiguration::UPDATE: + syncCfg.automatic = false; + syncCfg.exLeftSideOnly = SYNC_DIR_RIGHT; + syncCfg.exRightSideOnly = SYNC_DIR_NONE; + syncCfg.leftNewer = SYNC_DIR_RIGHT; + syncCfg.rightNewer = SYNC_DIR_NONE; + syncCfg.different = SYNC_DIR_RIGHT; + syncCfg.conflict = SYNC_DIR_NONE; + break; + case SyncConfiguration::CUSTOM: + assert(false); + break; } } @@ -158,22 +158,22 @@ wxString ffs3::getDescription(CompareFilesResult cmpRes) { switch (cmpRes) { - case FILE_LEFT_SIDE_ONLY: - return _("Files/folders that exist on left side only"); - case FILE_RIGHT_SIDE_ONLY: - return _("Files/folders that exist on right side only"); - case FILE_LEFT_NEWER: - return _("Files that exist on both sides, left one is newer"); - case FILE_RIGHT_NEWER: - return _("Files that exist on both sides, right one is newer"); - case FILE_DIFFERENT: - return _("Files that have different content"); - case FILE_EQUAL: - return _("Files that are equal on both sides"); - case FILE_DIFFERENT_METADATA: - return _("Files/folders that differ in attributes only"); - case FILE_CONFLICT: - return _("Conflicts/files that cannot be categorized"); + case FILE_LEFT_SIDE_ONLY: + return _("Files/folders that exist on left side only"); + case FILE_RIGHT_SIDE_ONLY: + return _("Files/folders that exist on right side only"); + case FILE_LEFT_NEWER: + return _("Files that exist on both sides, left one is newer"); + case FILE_RIGHT_NEWER: + return _("Files that exist on both sides, right one is newer"); + case FILE_DIFFERENT: + return _("Files that have different content"); + case FILE_EQUAL: + return _("Files that are equal on both sides"); + case FILE_DIFFERENT_METADATA: + return _("Equal files/folders that differ in attributes only"); + case FILE_CONFLICT: + return _("Conflicts/files that cannot be categorized"); } assert(false); @@ -185,21 +185,21 @@ wxString ffs3::getSymbol(CompareFilesResult cmpRes) { switch (cmpRes) { - case FILE_LEFT_SIDE_ONLY: - return wxT("<|"); - case FILE_RIGHT_SIDE_ONLY: - return wxT("|>"); - case FILE_LEFT_NEWER: - return wxT("<<"); - case FILE_RIGHT_NEWER: - return wxT(">>"); - case FILE_DIFFERENT: - return wxT("!="); - case FILE_EQUAL: - return wxT("'=="); //added quotation mark to avoid error in Excel cell when exporting to *.cvs - case FILE_CONFLICT: - case FILE_DIFFERENT_METADATA: - return wxT("\\/\\->"); + case FILE_LEFT_SIDE_ONLY: + return wxT("<|"); + case FILE_RIGHT_SIDE_ONLY: + return wxT("|>"); + case FILE_LEFT_NEWER: + return wxT("<<"); + case FILE_RIGHT_NEWER: + return wxT(">>"); + case FILE_DIFFERENT: + return wxT("!="); + case FILE_EQUAL: + return wxT("'=="); //added quotation mark to avoid error in Excel cell when exporting to *.cvs + case FILE_CONFLICT: + case FILE_DIFFERENT_METADATA: + return wxT("\\/\\->"); } assert(false); @@ -211,28 +211,28 @@ wxString ffs3::getDescription(SyncOperation op) { switch (op) { - case SO_CREATE_NEW_LEFT: - return _("Copy from right to left"); - case SO_CREATE_NEW_RIGHT: - return _("Copy from left to right"); - case SO_DELETE_LEFT: - return _("Delete files/folders existing on left side only"); - case SO_DELETE_RIGHT: - return _("Delete files/folders existing on right side only"); - case SO_OVERWRITE_LEFT: - return _("Copy from right to left overwriting"); - case SO_OVERWRITE_RIGHT: - return _("Copy from left to right overwriting"); - case SO_DO_NOTHING: - return _("Do nothing"); - case SO_EQUAL: - return _("Files that are equal on both sides"); - case SO_COPY_METADATA_TO_LEFT: - return _("Copy attributes only from right to left"); - case SO_COPY_METADATA_TO_RIGHT: - return _("Copy attributes only from left to right"); - case SO_UNRESOLVED_CONFLICT: - return _("Conflicts/files that cannot be categorized"); + case SO_CREATE_NEW_LEFT: + return _("Copy from right to left"); + case SO_CREATE_NEW_RIGHT: + return _("Copy from left to right"); + case SO_DELETE_LEFT: + return _("Delete files/folders existing on left side only"); + case SO_DELETE_RIGHT: + return _("Delete files/folders existing on right side only"); + case SO_OVERWRITE_LEFT: + return _("Copy from right to left overwriting"); + case SO_OVERWRITE_RIGHT: + return _("Copy from left to right overwriting"); + case SO_DO_NOTHING: + return _("Do nothing"); + case SO_EQUAL: + return _("Files that are equal on both sides"); + case SO_COPY_METADATA_TO_LEFT: + return _("Copy attributes only from right to left"); + case SO_COPY_METADATA_TO_RIGHT: + return _("Copy attributes only from left to right"); + case SO_UNRESOLVED_CONFLICT: + return _("Conflicts/files that cannot be categorized"); }; assert(false); @@ -244,26 +244,26 @@ wxString ffs3::getSymbol(SyncOperation op) { switch (op) { - case SO_CREATE_NEW_LEFT: - return wxT("*-"); - case SO_CREATE_NEW_RIGHT: - return wxT("-*"); - case SO_DELETE_LEFT: - return wxT("D-"); - case SO_DELETE_RIGHT: - return wxT("-D"); - case SO_OVERWRITE_LEFT: - case SO_COPY_METADATA_TO_LEFT: - return wxT("<-"); - case SO_OVERWRITE_RIGHT: - case SO_COPY_METADATA_TO_RIGHT: - return wxT("->"); - case SO_DO_NOTHING: - return wxT(" -"); - case SO_EQUAL: - return wxT("'=="); //added quotation mark to avoid error in Excel cell when exporting to *.cvs - case SO_UNRESOLVED_CONFLICT: - return wxT("\\/\\->"); + case SO_CREATE_NEW_LEFT: + return wxT("*-"); + case SO_CREATE_NEW_RIGHT: + return wxT("-*"); + case SO_DELETE_LEFT: + return wxT("D-"); + case SO_DELETE_RIGHT: + return wxT("-D"); + case SO_OVERWRITE_LEFT: + case SO_COPY_METADATA_TO_LEFT: + return wxT("<-"); + case SO_OVERWRITE_RIGHT: + case SO_COPY_METADATA_TO_RIGHT: + return wxT("->"); + case SO_DO_NOTHING: + return wxT(" -"); + case SO_EQUAL: + return wxT("'=="); //added quotation mark to avoid error in Excel cell when exporting to *.cvs + case SO_UNRESOLVED_CONFLICT: + return wxT("\\/\\->"); }; assert(false); @@ -335,11 +335,11 @@ ffs3::MainConfiguration ffs3::merge(const std::vector<MainConfiguration>& mainCf for (std::vector<FolderPairEnh>::iterator fp = fpMerged.begin(); fp != fpMerged.end(); ++fp) { //if local config matches output global config we don't need local one - if ( fp->altSyncConfig && - *fp->altSyncConfig == - AlternateSyncConfig(mainCfgs[0].syncConfiguration, - mainCfgs[0].handleDeletion, - mainCfgs[0].customDeletionDirectory)) + if (fp->altSyncConfig && + *fp->altSyncConfig == + AlternateSyncConfig(mainCfgs[0].syncConfiguration, + mainCfgs[0].handleDeletion, + mainCfgs[0].customDeletionDirectory)) fp->altSyncConfig.reset(); if (sameLocalFilter) //use global filter in this case diff --git a/synchronization.cpp b/synchronization.cpp index 8e0dc7de..77b734eb 100644 --- a/synchronization.cpp +++ b/synchronization.cpp @@ -23,6 +23,8 @@ #include "library/db_file.h" #include "shared/disable_standby.h" #include "library/cmp_filetime.h" +#include "shared/file_io.h" +#include <deque> #ifdef FFS_WIN #include "shared/long_path_prefix.h" @@ -108,51 +110,51 @@ void SyncStatistics::getFileNumbers(const FileMapping& fileObj) { switch (fileObj.getSyncOperation()) //evaluate comparison result and sync direction { - case SO_CREATE_NEW_LEFT: - ++createLeft; - dataToProcess += fileObj.getFileSize<RIGHT_SIDE>(); - break; + case SO_CREATE_NEW_LEFT: + ++createLeft; + dataToProcess += fileObj.getFileSize<RIGHT_SIDE>(); + break; - case SO_CREATE_NEW_RIGHT: - ++createRight; - dataToProcess += fileObj.getFileSize<LEFT_SIDE>(); - break; + case SO_CREATE_NEW_RIGHT: + ++createRight; + dataToProcess += fileObj.getFileSize<LEFT_SIDE>(); + break; - case SO_DELETE_LEFT: - ++deleteLeft; - break; + case SO_DELETE_LEFT: + ++deleteLeft; + break; - case SO_DELETE_RIGHT: - ++deleteRight; - break; + case SO_DELETE_RIGHT: + ++deleteRight; + break; - case SO_OVERWRITE_LEFT: - ++overwriteLeft; - dataToProcess += fileObj.getFileSize<RIGHT_SIDE>(); - break; + case SO_OVERWRITE_LEFT: + ++overwriteLeft; + dataToProcess += fileObj.getFileSize<RIGHT_SIDE>(); + break; - case SO_OVERWRITE_RIGHT: - ++overwriteRight; - dataToProcess += fileObj.getFileSize<LEFT_SIDE>(); - break; + case SO_OVERWRITE_RIGHT: + ++overwriteRight; + dataToProcess += fileObj.getFileSize<LEFT_SIDE>(); + break; - case SO_UNRESOLVED_CONFLICT: - ++conflict; - if (firstConflicts.size() < 3) //save the first 3 conflict texts - firstConflicts.push_back(std::make_pair(fileObj.getObjRelativeName(), fileObj.getSyncOpConflict())); - break; + case SO_UNRESOLVED_CONFLICT: + ++conflict; + if (firstConflicts.size() < 3) //save the first 3 conflict texts + firstConflicts.push_back(std::make_pair(fileObj.getObjRelativeName(), fileObj.getSyncOpConflict())); + break; - case SO_COPY_METADATA_TO_LEFT: - ++overwriteLeft; - break; + case SO_COPY_METADATA_TO_LEFT: + ++overwriteLeft; + break; - case SO_COPY_METADATA_TO_RIGHT: - ++overwriteRight; - break; + case SO_COPY_METADATA_TO_RIGHT: + ++overwriteRight; + break; - case SO_DO_NOTHING: - case SO_EQUAL: - break; + case SO_DO_NOTHING: + case SO_EQUAL: + break; } } @@ -162,41 +164,41 @@ void SyncStatistics::getLinkNumbers(const SymLinkMapping& linkObj) { switch (linkObj.getSyncOperation()) //evaluate comparison result and sync direction { - case SO_CREATE_NEW_LEFT: - ++createLeft; - break; + case SO_CREATE_NEW_LEFT: + ++createLeft; + break; - case SO_CREATE_NEW_RIGHT: - ++createRight; - break; + case SO_CREATE_NEW_RIGHT: + ++createRight; + break; - case SO_DELETE_LEFT: - ++deleteLeft; - break; + case SO_DELETE_LEFT: + ++deleteLeft; + break; - case SO_DELETE_RIGHT: - ++deleteRight; - break; + case SO_DELETE_RIGHT: + ++deleteRight; + break; - case SO_OVERWRITE_LEFT: - case SO_COPY_METADATA_TO_LEFT: - ++overwriteLeft; - break; + case SO_OVERWRITE_LEFT: + case SO_COPY_METADATA_TO_LEFT: + ++overwriteLeft; + break; - case SO_OVERWRITE_RIGHT: - case SO_COPY_METADATA_TO_RIGHT: - ++overwriteRight; - break; + case SO_OVERWRITE_RIGHT: + case SO_COPY_METADATA_TO_RIGHT: + ++overwriteRight; + break; - case SO_UNRESOLVED_CONFLICT: - ++conflict; - if (firstConflicts.size() < 3) //save the first 3 conflict texts - firstConflicts.push_back(std::make_pair(linkObj.getObjRelativeName(), linkObj.getSyncOpConflict())); - break; + case SO_UNRESOLVED_CONFLICT: + ++conflict; + if (firstConflicts.size() < 3) //save the first 3 conflict texts + firstConflicts.push_back(std::make_pair(linkObj.getObjRelativeName(), linkObj.getSyncOpConflict())); + break; - case SO_DO_NOTHING: - case SO_EQUAL: - break; + case SO_DO_NOTHING: + case SO_EQUAL: + break; } } @@ -206,44 +208,44 @@ void SyncStatistics::getDirNumbers(const DirMapping& dirObj) { switch (dirObj.getSyncOperation()) //evaluate comparison result and sync direction { - case SO_CREATE_NEW_LEFT: - ++createLeft; - break; + case SO_CREATE_NEW_LEFT: + ++createLeft; + break; - case SO_CREATE_NEW_RIGHT: - ++createRight; - break; + case SO_CREATE_NEW_RIGHT: + ++createRight; + break; - case SO_DELETE_LEFT: - ++deleteLeft; - break; + case SO_DELETE_LEFT: + ++deleteLeft; + break; - case SO_DELETE_RIGHT: - ++deleteRight; - break; + case SO_DELETE_RIGHT: + ++deleteRight; + break; - case SO_OVERWRITE_LEFT: - case SO_OVERWRITE_RIGHT: - assert(false); - break; + case SO_OVERWRITE_LEFT: + case SO_OVERWRITE_RIGHT: + assert(false); + break; - case SO_UNRESOLVED_CONFLICT: - ++conflict; - if (firstConflicts.size() < 3) //save the first 3 conflict texts - firstConflicts.push_back(std::make_pair(dirObj.getObjRelativeName(), dirObj.getSyncOpConflict())); - break; + case SO_UNRESOLVED_CONFLICT: + ++conflict; + if (firstConflicts.size() < 3) //save the first 3 conflict texts + firstConflicts.push_back(std::make_pair(dirObj.getObjRelativeName(), dirObj.getSyncOpConflict())); + break; - case SO_COPY_METADATA_TO_LEFT: - ++overwriteLeft; - break; + case SO_COPY_METADATA_TO_LEFT: + ++overwriteLeft; + break; - case SO_COPY_METADATA_TO_RIGHT: - ++overwriteRight; - break; + case SO_COPY_METADATA_TO_RIGHT: + ++overwriteRight; + break; - case SO_DO_NOTHING: - case SO_EQUAL: - break; + case SO_DO_NOTHING: + case SO_EQUAL: + break; } //recurse into sub-dirs @@ -305,42 +307,42 @@ private: for (HierarchyObject::SubFileMapping::const_iterator i = hierObj.useSubFiles().begin(); i != hierObj.useSubFiles().end(); ++i) switch (i->getSyncOperation()) //evaluate comparison result and sync direction { - case SO_CREATE_NEW_LEFT: - spaceNeededLeft += common::convertToSigned(i->getFileSize<RIGHT_SIDE>()); - break; - - case SO_CREATE_NEW_RIGHT: - spaceNeededRight += common::convertToSigned(i->getFileSize<LEFT_SIDE>()); - break; - - case SO_DELETE_LEFT: - if (freeSpaceDelLeft_) - spaceNeededLeft -= common::convertToSigned(i->getFileSize<LEFT_SIDE>()); - break; - - case SO_DELETE_RIGHT: - if (freeSpaceDelRight_) - spaceNeededRight -= common::convertToSigned(i->getFileSize<RIGHT_SIDE>()); - break; - - case SO_OVERWRITE_LEFT: - if (freeSpaceDelLeft_) - spaceNeededLeft -= common::convertToSigned(i->getFileSize<LEFT_SIDE>()); - spaceNeededLeft += common::convertToSigned(i->getFileSize<RIGHT_SIDE>()); - break; - - case SO_OVERWRITE_RIGHT: - if (freeSpaceDelRight_) - spaceNeededRight -= common::convertToSigned(i->getFileSize<RIGHT_SIDE>()); - spaceNeededRight += common::convertToSigned(i->getFileSize<LEFT_SIDE>()); - break; - - case SO_DO_NOTHING: - case SO_EQUAL: - case SO_UNRESOLVED_CONFLICT: - case SO_COPY_METADATA_TO_LEFT: - case SO_COPY_METADATA_TO_RIGHT: - break; + case SO_CREATE_NEW_LEFT: + spaceNeededLeft += common::convertToSigned(i->getFileSize<RIGHT_SIDE>()); + break; + + case SO_CREATE_NEW_RIGHT: + spaceNeededRight += common::convertToSigned(i->getFileSize<LEFT_SIDE>()); + break; + + case SO_DELETE_LEFT: + if (freeSpaceDelLeft_) + spaceNeededLeft -= common::convertToSigned(i->getFileSize<LEFT_SIDE>()); + break; + + case SO_DELETE_RIGHT: + if (freeSpaceDelRight_) + spaceNeededRight -= common::convertToSigned(i->getFileSize<RIGHT_SIDE>()); + break; + + case SO_OVERWRITE_LEFT: + if (freeSpaceDelLeft_) + spaceNeededLeft -= common::convertToSigned(i->getFileSize<LEFT_SIDE>()); + spaceNeededLeft += common::convertToSigned(i->getFileSize<RIGHT_SIDE>()); + break; + + case SO_OVERWRITE_RIGHT: + if (freeSpaceDelRight_) + spaceNeededRight -= common::convertToSigned(i->getFileSize<RIGHT_SIDE>()); + spaceNeededRight += common::convertToSigned(i->getFileSize<LEFT_SIDE>()); + break; + + case SO_DO_NOTHING: + case SO_EQUAL: + case SO_UNRESOLVED_CONFLICT: + case SO_COPY_METADATA_TO_LEFT: + case SO_COPY_METADATA_TO_RIGHT: + break; } //symbolic links @@ -365,20 +367,20 @@ bool deletionFreesSpace(const Zstring& baseDir, { switch (handleDeletion) { - case DELETE_PERMANENTLY: - return true; - case MOVE_TO_RECYCLE_BIN: - return false; //in general... (unless Recycle Bin is full) - case MOVE_TO_CUSTOM_DIRECTORY: - switch (ffs3::onSameVolume(baseDir, custDelFolderFmt)) - { - case VOLUME_SAME: - return false; - case VOLUME_DIFFERENT: - return true; //but other volume (custDelFolderFmt) may become full... - case VOLUME_CANT_SAY: - return true; //a rough guess! - } + case DELETE_PERMANENTLY: + return true; + case MOVE_TO_RECYCLE_BIN: + return false; //in general... (unless Recycle Bin is full) + case MOVE_TO_CUSTOM_DIRECTORY: + switch (ffs3::onSameVolume(baseDir, custDelFolderFmt)) + { + case VOLUME_SAME: + return false; + case VOLUME_DIFFERENT: + return true; //but other volume (custDelFolderFmt) may become full... + case VOLUME_CANT_SAY: + return true; //a rough guess! + } } assert(false); return true; @@ -411,25 +413,18 @@ bool synchronizationNeeded(const SyncStatistics& statisticsTotal) } -bool ffs3::synchronizationNeeded(const FolderComparison& folderCmp) -{ - const SyncStatistics statisticsTotal(folderCmp); - return ::synchronizationNeeded(statisticsTotal); -} - - //test if user accidentally tries to sync the wrong folders bool significantDifferenceDetected(const SyncStatistics& folderPairStat) { //initial file copying shall not be detected as major difference - if ( folderPairStat.getCreate<LEFT_SIDE>() == 0 && - folderPairStat.getOverwrite() == 0 && - folderPairStat.getDelete() == 0 && - folderPairStat.getConflict() == 0) return false; - if ( folderPairStat.getCreate<RIGHT_SIDE>() == 0 && - folderPairStat.getOverwrite() == 0 && - folderPairStat.getDelete() == 0 && - folderPairStat.getConflict() == 0) return false; + if (folderPairStat.getCreate<LEFT_SIDE>() == 0 && + folderPairStat.getOverwrite() == 0 && + folderPairStat.getDelete() == 0 && + folderPairStat.getConflict() == 0) return false; + if (folderPairStat.getCreate<RIGHT_SIDE>() == 0 && + folderPairStat.getOverwrite() == 0 && + folderPairStat.getDelete() == 0 && + folderPairStat.getConflict() == 0) return false; const int changedRows = folderPairStat.getCreate() + folderPairStat.getOverwrite() + @@ -452,14 +447,14 @@ FolderPairSyncCfg::FolderPairSyncCfg(bool automaticMode, template <typename Function> inline -void tryReportingError(StatusHandler& handler, Function cmd) +bool tryReportingError(StatusHandler& handler, Function cmd) //return "true" on success, "false" if error was ignored { while (true) { try { cmd(); - break; + return true; } catch (FileError& error) { @@ -469,8 +464,8 @@ void tryReportingError(StatusHandler& handler, Function cmd) handler.requestUiRefresh(true); //may throw! ErrorHandler::Response rv = handler.reportError(error.msg()); //may throw! - if ( rv == ErrorHandler::IGNORE_ERROR) - break; + if (rv == ErrorHandler::IGNORE_ERROR) + return false; else if (rv == ErrorHandler::RETRY) ; //continue with loop else @@ -596,26 +591,26 @@ DeletionHandling::DeletionHandling(const DeletionPolicy handleDel, { switch (handleDel) { - case DELETE_PERMANENTLY: - txtRemovingFile = wxToZ(_("Deleting file %x")).Replace(Zstr("%x"), Zstr("\n\"%x\""), false); - txtRemovingSymlink = wxToZ(_("Deleting Symbolic Link %x")).Replace(Zstr("%x"), Zstr("\n\"%x\""), false); - txtRemovingDirectory = wxToZ(_("Deleting folder %x")).Replace( Zstr("%x"), Zstr("\n\"%x\""), false); - break; + case DELETE_PERMANENTLY: + txtRemovingFile = wxToZ(_("Deleting file %x")).Replace(Zstr("%x"), Zstr("\n\"%x\""), false); + txtRemovingSymlink = wxToZ(_("Deleting Symbolic Link %x")).Replace(Zstr("%x"), Zstr("\n\"%x\""), false); + txtRemovingDirectory = wxToZ(_("Deleting folder %x")).Replace( Zstr("%x"), Zstr("\n\"%x\""), false); + break; - case MOVE_TO_RECYCLE_BIN: - sessionDelDirLeft = getSessionDeletionDir(baseDirLeft, Zstr("FFS ")); - sessionDelDirRight = getSessionDeletionDir(baseDirRight, Zstr("FFS ")); + case MOVE_TO_RECYCLE_BIN: + sessionDelDirLeft = getSessionDeletionDir(baseDirLeft, Zstr("FFS ")); + sessionDelDirRight = getSessionDeletionDir(baseDirRight, Zstr("FFS ")); - txtRemovingFile = txtRemovingSymlink = txtRemovingDirectory = wxToZ(_("Moving %x to Recycle Bin")).Replace(Zstr("%x"), Zstr("\"%x\""), false); - break; + txtRemovingFile = txtRemovingSymlink = txtRemovingDirectory = wxToZ(_("Moving %x to Recycle Bin")).Replace(Zstr("%x"), Zstr("\"%x\""), false); + break; - case MOVE_TO_CUSTOM_DIRECTORY: - sessionDelDirLeft = sessionDelDirRight = getSessionDeletionDir(custDelFolder); + case MOVE_TO_CUSTOM_DIRECTORY: + sessionDelDirLeft = sessionDelDirRight = getSessionDeletionDir(custDelFolder); - txtRemovingFile = wxToZ(_("Moving file %x to user-defined directory %y")). Replace(Zstr("%x"), Zstr("\"%x\"\n"), false).Replace(Zstr("%y"), Zstring(Zstr("\"")) + custDelFolder + Zstr("\""), false); - txtRemovingDirectory = wxToZ(_("Moving folder %x to user-defined directory %y")). Replace(Zstr("%x"), Zstr("\"%x\"\n"), false).Replace(Zstr("%y"), Zstring(Zstr("\"")) + custDelFolder + Zstr("\""), false); - txtRemovingSymlink = wxToZ(_("Moving Symbolic Link %x to user-defined directory %y")).Replace(Zstr("%x"), Zstr("\"%x\"\n"), false).Replace(Zstr("%y"), Zstring(Zstr("\"")) + custDelFolder + Zstr("\""), false); - break; + txtRemovingFile = wxToZ(_("Moving file %x to user-defined directory %y")). Replace(Zstr("%x"), Zstr("\"%x\"\n"), false).Replace(Zstr("%y"), Zstring(Zstr("\"")) + custDelFolder + Zstr("\""), false); + txtRemovingDirectory = wxToZ(_("Moving folder %x to user-defined directory %y")). Replace(Zstr("%x"), Zstr("\"%x\"\n"), false).Replace(Zstr("%y"), Zstring(Zstr("\"")) + custDelFolder + Zstr("\""), false); + txtRemovingSymlink = wxToZ(_("Moving Symbolic Link %x to user-defined directory %y")).Replace(Zstr("%x"), Zstr("\"%x\"\n"), false).Replace(Zstr("%y"), Zstring(Zstr("\"")) + custDelFolder + Zstr("\""), false); + break; } } @@ -739,46 +734,46 @@ void DeletionHandling::removeFile(const FileSystemObject& fileObj) const switch (deletionType) { - case DELETE_PERMANENTLY: - ffs3::removeFile(fileObj.getFullName<side>()); - break; + case DELETE_PERMANENTLY: + ffs3::removeFile(fileObj.getFullName<side>()); + break; - case MOVE_TO_RECYCLE_BIN: - if (fileExists(fileObj.getFullName<side>())) - { - const Zstring targetFile = getSessionDir<side>() + fileObj.getRelativeName<side>(); //altDeletionDir ends with path separator - const Zstring targetDir = targetFile.BeforeLast(common::FILE_NAME_SEPARATOR); + case MOVE_TO_RECYCLE_BIN: + if (fileExists(fileObj.getFullName<side>())) + { + const Zstring targetFile = getSessionDir<side>() + fileObj.getRelativeName<side>(); //altDeletionDir ends with path separator + const Zstring targetDir = targetFile.BeforeLast(common::FILE_NAME_SEPARATOR); - if (!dirExists(targetDir)) - createDirectory(targetDir); //throw (FileError) + if (!dirExists(targetDir)) + createDirectory(targetDir); //throw (FileError) - try //rename file: no copying!!! - { - //performance optimization!! Instead of moving each object into recycle bin separately, we rename them ony by one into a - //temporary directory and delete this directory only ONCE! - renameFile(fileObj.getFullName<side>(), targetFile); //throw (FileError); - } - catch (...) - { - //if anything went wrong, move to recycle bin the standard way (single file processing: slow) - moveToRecycleBin(fileObj.getFullName<side>()); //throw (FileError) + try //rename file: no copying!!! + { + //performance optimization!! Instead of moving each object into recycle bin separately, we rename them ony by one into a + //temporary directory and delete this directory only ONCE! + renameFile(fileObj.getFullName<side>(), targetFile); //throw (FileError); + } + catch (...) + { + //if anything went wrong, move to recycle bin the standard way (single file processing: slow) + moveToRecycleBin(fileObj.getFullName<side>()); //throw (FileError) + } } - } - break; + break; - case MOVE_TO_CUSTOM_DIRECTORY: - if (fileExists(fileObj.getFullName<side>())) - { - const Zstring targetFile = getSessionDir<side>() + fileObj.getRelativeName<side>(); //altDeletionDir ends with path separator - const Zstring targetDir = targetFile.BeforeLast(common::FILE_NAME_SEPARATOR); + case MOVE_TO_CUSTOM_DIRECTORY: + if (fileExists(fileObj.getFullName<side>())) + { + const Zstring targetFile = getSessionDir<side>() + fileObj.getRelativeName<side>(); //altDeletionDir ends with path separator + const Zstring targetDir = targetFile.BeforeLast(common::FILE_NAME_SEPARATOR); - if (!dirExists(targetDir)) - createDirectory(targetDir); //throw (FileError) + if (!dirExists(targetDir)) + createDirectory(targetDir); //throw (FileError) - MoveFileCallbackImpl callBack(statusUpdater_); //if file needs to be copied we need callback functionality to update screen and offer abort - moveFile(fileObj.getFullName<side>(), targetFile, &callBack); - } - break; + MoveFileCallbackImpl callBack(statusUpdater_); //if file needs to be copied we need callback functionality to update screen and offer abort + moveFile(fileObj.getFullName<side>(), targetFile, &callBack); + } + break; } } @@ -790,50 +785,50 @@ void DeletionHandling::removeFolder(const FileSystemObject& dirObj) const switch (deletionType) { - case DELETE_PERMANENTLY: - { - RemoveDirCallbackImpl remDirCallback(statusUpdater_); - removeDirectory(dirObj.getFullName<side>(), &remDirCallback); - } - break; - - case MOVE_TO_RECYCLE_BIN: - if (dirExists(dirObj.getFullName<side>())) + case DELETE_PERMANENTLY: { - const Zstring targetDir = getSessionDir<side>() + dirObj.getRelativeName<side>(); - const Zstring targetSuperDir = targetDir.BeforeLast(common::FILE_NAME_SEPARATOR); - - if (!dirExists(targetSuperDir)) - createDirectory(targetSuperDir); //throw (FileError) + RemoveDirCallbackImpl remDirCallback(statusUpdater_); + removeDirectory(dirObj.getFullName<side>(), &remDirCallback); + } + break; - try //rename directory: no copying!!! - { - //performance optimization!! Instead of moving each object into recycle bin separately, we rename them ony by one into a - //temporary directory and delete this directory only ONCE! - renameFile(dirObj.getFullName<side>(), targetDir); //throw (FileError); - } - catch (...) + case MOVE_TO_RECYCLE_BIN: + if (dirExists(dirObj.getFullName<side>())) { - //if anything went wrong, move to recycle bin the standard way (single file processing: slow) - moveToRecycleBin(dirObj.getFullName<side>()); //throw (FileError) + const Zstring targetDir = getSessionDir<side>() + dirObj.getRelativeName<side>(); + const Zstring targetSuperDir = targetDir.BeforeLast(common::FILE_NAME_SEPARATOR); + + if (!dirExists(targetSuperDir)) + createDirectory(targetSuperDir); //throw (FileError) + try //rename directory: no copying!!! + { + //performance optimization!! Instead of moving each object into recycle bin separately, we rename them ony by one into a + //temporary directory and delete this directory only ONCE! + renameFile(dirObj.getFullName<side>(), targetDir); //throw (FileError); + } + catch (...) + { + //if anything went wrong, move to recycle bin the standard way (single file processing: slow) + moveToRecycleBin(dirObj.getFullName<side>()); //throw (FileError) + + } } - } - break; + break; - case MOVE_TO_CUSTOM_DIRECTORY: - if (dirExists(dirObj.getFullName<side>())) - { - const Zstring targetDir = getSessionDir<side>() + dirObj.getRelativeName<side>(); - const Zstring targetSuperDir = targetDir.BeforeLast(common::FILE_NAME_SEPARATOR); + case MOVE_TO_CUSTOM_DIRECTORY: + if (dirExists(dirObj.getFullName<side>())) + { + const Zstring targetDir = getSessionDir<side>() + dirObj.getRelativeName<side>(); + const Zstring targetSuperDir = targetDir.BeforeLast(common::FILE_NAME_SEPARATOR); - if (!dirExists(targetSuperDir)) - createDirectory(targetSuperDir); //throw (FileError) + if (!dirExists(targetSuperDir)) + createDirectory(targetSuperDir); //throw (FileError) - MoveFileCallbackImpl callBack(statusUpdater_); //if files need to be copied, we need callback functionality to update screen and offer abort - moveDirectory(dirObj.getFullName<side>(), targetDir, true, &callBack); - } - break; + MoveFileCallbackImpl callBack(statusUpdater_); //if files need to be copied, we need callback functionality to update screen and offer abort + moveDirectory(dirObj.getFullName<side>(), targetDir, true, &callBack); + } + break; } } //---------------------------------------------------------------------------------------- @@ -845,24 +840,24 @@ bool diskSpaceIsReduced(const FileMapping& fileObj) { switch (fileObj.getSyncOperation()) //evaluate comparison result and sync direction { - case SO_DELETE_LEFT: - case SO_DELETE_RIGHT: - return true; - - case SO_OVERWRITE_LEFT: - return fileObj.getFileSize<LEFT_SIDE>() > fileObj.getFileSize<RIGHT_SIDE>(); - - case SO_OVERWRITE_RIGHT: - return fileObj.getFileSize<LEFT_SIDE>() < fileObj.getFileSize<RIGHT_SIDE>(); - - case SO_CREATE_NEW_LEFT: - case SO_CREATE_NEW_RIGHT: - case SO_DO_NOTHING: - case SO_EQUAL: - case SO_UNRESOLVED_CONFLICT: - case SO_COPY_METADATA_TO_LEFT: - case SO_COPY_METADATA_TO_RIGHT: - return false; + case SO_DELETE_LEFT: + case SO_DELETE_RIGHT: + return true; + + case SO_OVERWRITE_LEFT: + return fileObj.getFileSize<LEFT_SIDE>() > fileObj.getFileSize<RIGHT_SIDE>(); + + case SO_OVERWRITE_RIGHT: + return fileObj.getFileSize<LEFT_SIDE>() < fileObj.getFileSize<RIGHT_SIDE>(); + + case SO_CREATE_NEW_LEFT: + case SO_CREATE_NEW_RIGHT: + case SO_DO_NOTHING: + case SO_EQUAL: + case SO_UNRESOLVED_CONFLICT: + case SO_COPY_METADATA_TO_LEFT: + case SO_COPY_METADATA_TO_RIGHT: + return false; } return false; //dummy } @@ -872,21 +867,21 @@ bool diskSpaceIsReduced(const DirMapping& dirObj) { switch (dirObj.getSyncOperation()) //evaluate comparison result and sync direction { - case SO_DELETE_LEFT: - case SO_DELETE_RIGHT: - return true; - - case SO_OVERWRITE_LEFT: - case SO_OVERWRITE_RIGHT: - assert(false); - case SO_UNRESOLVED_CONFLICT: - case SO_CREATE_NEW_LEFT: - case SO_CREATE_NEW_RIGHT: - case SO_DO_NOTHING: - case SO_EQUAL: - case SO_COPY_METADATA_TO_LEFT: - case SO_COPY_METADATA_TO_RIGHT: - return false; + case SO_DELETE_LEFT: + case SO_DELETE_RIGHT: + return true; + + case SO_OVERWRITE_LEFT: + case SO_OVERWRITE_RIGHT: + assert(false); + case SO_UNRESOLVED_CONFLICT: + case SO_CREATE_NEW_LEFT: + case SO_CREATE_NEW_RIGHT: + case SO_DO_NOTHING: + case SO_EQUAL: + case SO_COPY_METADATA_TO_LEFT: + case SO_COPY_METADATA_TO_RIGHT: + return false; } return false; //dummy } @@ -964,8 +959,8 @@ void SynchronizeFolderPair::execute(HierarchyObject& hierObj) //synchronize files: for (HierarchyObject::SubFileMapping::iterator i = hierObj.useSubFiles().begin(); i != hierObj.useSubFiles().end(); ++i) { - if ( ( reduceDiskSpace && diskSpaceIsReduced(*i)) || - (!reduceDiskSpace && !diskSpaceIsReduced(*i))) + if (( reduceDiskSpace && diskSpaceIsReduced(*i)) || + (!reduceDiskSpace && !diskSpaceIsReduced(*i))) tryReportingError(statusUpdater_, boost::bind(&SynchronizeFolderPair::synchronizeFile, this, boost::ref(*i))); } @@ -979,8 +974,8 @@ void SynchronizeFolderPair::execute(HierarchyObject& hierObj) { const SyncOperation syncOp = i->getSyncOperation(); - if ( ( reduceDiskSpace && diskSpaceIsReduced(*i)) || //ensure folder creation happens in second pass, to enable time adaption below - (!reduceDiskSpace && !diskSpaceIsReduced(*i))) // + if (( reduceDiskSpace && diskSpaceIsReduced(*i)) || //ensure folder creation happens in second pass, to enable time adaption below + (!reduceDiskSpace && !diskSpaceIsReduced(*i))) // tryReportingError(statusUpdater_, boost::bind(&SynchronizeFolderPair::synchronizeFolder, this, boost::ref(*i))); //recursive synchronization: @@ -991,29 +986,40 @@ void SynchronizeFolderPair::execute(HierarchyObject& hierObj) { switch (syncOp) { - case SO_CREATE_NEW_LEFT: - case SO_COPY_METADATA_TO_LEFT: - copyFileTimes(i->getFullName<RIGHT_SIDE>(), i->getFullName<LEFT_SIDE>(), true); //deref symlinks; throw (FileError) - break; - case SO_CREATE_NEW_RIGHT: - case SO_COPY_METADATA_TO_RIGHT: - copyFileTimes(i->getFullName<LEFT_SIDE>(), i->getFullName<RIGHT_SIDE>(), true); //deref symlinks; throw (FileError) - break; - case SO_OVERWRITE_RIGHT: - case SO_OVERWRITE_LEFT: - assert(false); - case SO_UNRESOLVED_CONFLICT: - case SO_DELETE_LEFT: - case SO_DELETE_RIGHT: - case SO_DO_NOTHING: - case SO_EQUAL: - break; + case SO_CREATE_NEW_LEFT: + case SO_COPY_METADATA_TO_LEFT: + copyFileTimes(i->getFullName<RIGHT_SIDE>(), i->getFullName<LEFT_SIDE>(), true); //deref symlinks; throw (FileError) + break; + case SO_CREATE_NEW_RIGHT: + case SO_COPY_METADATA_TO_RIGHT: + copyFileTimes(i->getFullName<LEFT_SIDE>(), i->getFullName<RIGHT_SIDE>(), true); //deref symlinks; throw (FileError) + break; + case SO_OVERWRITE_RIGHT: + case SO_OVERWRITE_LEFT: + assert(false); + case SO_UNRESOLVED_CONFLICT: + case SO_DELETE_LEFT: + case SO_DELETE_RIGHT: + case SO_DO_NOTHING: + case SO_EQUAL: + break; } } catch (...) {} } } +namespace +{ +//runtime impact per file: SSD: 0s, HDD: 43 µs, USB stick: 1 ms +inline +void checkFileReadable(const Zstring& filename) //throw (FileError) +{ + ffs3::FileInput file(filename); //throw (FileError) + char buffer[1]; + file.read(buffer, 1); // +} +} void SynchronizeFolderPair::synchronizeFile(FileMapping& fileObj) const { @@ -1022,110 +1028,118 @@ void SynchronizeFolderPair::synchronizeFile(FileMapping& fileObj) const switch (fileObj.getSyncOperation()) //evaluate comparison result and sync direction { - case SO_CREATE_NEW_LEFT: - target = fileObj.getBaseDirPf<LEFT_SIDE>() + fileObj.getRelativeName<RIGHT_SIDE>(); //can't use "getFullName" as target is not yet existing + case SO_CREATE_NEW_LEFT: + target = fileObj.getBaseDirPf<LEFT_SIDE>() + fileObj.getRelativeName<RIGHT_SIDE>(); //can't use "getFullName" as target is not yet existing - statusText = txtCopyingFile; - statusText.Replace(Zstr("%x"), fileObj.getShortName<RIGHT_SIDE>(), false); - statusText.Replace(Zstr("%y"), target.BeforeLast(common::FILE_NAME_SEPARATOR), false); - statusUpdater_.reportInfo(statusText); - statusUpdater_.requestUiRefresh(); //trigger display refresh + statusText = txtCopyingFile; + statusText.Replace(Zstr("%x"), fileObj.getShortName<RIGHT_SIDE>(), false); + statusText.Replace(Zstr("%y"), target.BeforeLast(common::FILE_NAME_SEPARATOR), false); + statusUpdater_.reportInfo(statusText); + statusUpdater_.requestUiRefresh(); //trigger display refresh - copyFileUpdating(fileObj.getFullName<RIGHT_SIDE>(), target, fileObj.getFileSize<RIGHT_SIDE>()); - break; + copyFileUpdating(fileObj.getFullName<RIGHT_SIDE>(), target, fileObj.getFileSize<RIGHT_SIDE>()); + break; - case SO_CREATE_NEW_RIGHT: - target = fileObj.getBaseDirPf<RIGHT_SIDE>() + fileObj.getRelativeName<LEFT_SIDE>(); + case SO_CREATE_NEW_RIGHT: + target = fileObj.getBaseDirPf<RIGHT_SIDE>() + fileObj.getRelativeName<LEFT_SIDE>(); - statusText = txtCopyingFile; - statusText.Replace(Zstr("%x"), fileObj.getShortName<LEFT_SIDE>(), false); - statusText.Replace(Zstr("%y"), target.BeforeLast(common::FILE_NAME_SEPARATOR), false); - statusUpdater_.reportInfo(statusText); - statusUpdater_.requestUiRefresh(); //trigger display refresh + statusText = txtCopyingFile; + statusText.Replace(Zstr("%x"), fileObj.getShortName<LEFT_SIDE>(), false); + statusText.Replace(Zstr("%y"), target.BeforeLast(common::FILE_NAME_SEPARATOR), false); + statusUpdater_.reportInfo(statusText); + statusUpdater_.requestUiRefresh(); //trigger display refresh - copyFileUpdating(fileObj.getFullName<LEFT_SIDE>(), target, fileObj.getFileSize<LEFT_SIDE>()); - break; + copyFileUpdating(fileObj.getFullName<LEFT_SIDE>(), target, fileObj.getFileSize<LEFT_SIDE>()); + break; - case SO_DELETE_LEFT: - statusText = delHandling_.getTxtRemovingFile(); - statusText.Replace(Zstr("%x"), fileObj.getFullName<LEFT_SIDE>(), false); - statusUpdater_.reportInfo(statusText); - statusUpdater_.requestUiRefresh(); //trigger display refresh + case SO_DELETE_LEFT: + statusText = delHandling_.getTxtRemovingFile(); + statusText.Replace(Zstr("%x"), fileObj.getFullName<LEFT_SIDE>(), false); + statusUpdater_.reportInfo(statusText); + statusUpdater_.requestUiRefresh(); //trigger display refresh - delHandling_.removeFile<LEFT_SIDE>(fileObj); //throw FileError() - break; + delHandling_.removeFile<LEFT_SIDE>(fileObj); //throw FileError() + break; - case SO_DELETE_RIGHT: - statusText = delHandling_.getTxtRemovingFile(); - statusText.Replace(Zstr("%x"), fileObj.getFullName<RIGHT_SIDE>(), false); - statusUpdater_.reportInfo(statusText); - statusUpdater_.requestUiRefresh(); //trigger display refresh + case SO_DELETE_RIGHT: + statusText = delHandling_.getTxtRemovingFile(); + statusText.Replace(Zstr("%x"), fileObj.getFullName<RIGHT_SIDE>(), false); + statusUpdater_.reportInfo(statusText); + statusUpdater_.requestUiRefresh(); //trigger display refresh - delHandling_.removeFile<RIGHT_SIDE>(fileObj); //throw FileError() - break; + delHandling_.removeFile<RIGHT_SIDE>(fileObj); //throw FileError() + break; - case SO_OVERWRITE_LEFT: - target = fileObj.getBaseDirPf<LEFT_SIDE>() + fileObj.getRelativeName<RIGHT_SIDE>(); //respect differences in case of source object + case SO_OVERWRITE_LEFT: + target = fileObj.getBaseDirPf<LEFT_SIDE>() + fileObj.getRelativeName<RIGHT_SIDE>(); //respect differences in case of source object - statusText = txtOverwritingFile; - statusText.Replace(Zstr("%x"), fileObj.getShortName<RIGHT_SIDE>(), false); - statusText.Replace(Zstr("%y"), fileObj.getFullName<LEFT_SIDE>().BeforeLast(common::FILE_NAME_SEPARATOR), false); - statusUpdater_.reportInfo(statusText); - statusUpdater_.requestUiRefresh(); //trigger display refresh + statusText = txtOverwritingFile; + statusText.Replace(Zstr("%x"), fileObj.getShortName<RIGHT_SIDE>(), false); + statusText.Replace(Zstr("%y"), fileObj.getFullName<LEFT_SIDE>().BeforeLast(common::FILE_NAME_SEPARATOR), false); + statusUpdater_.reportInfo(statusText); + statusUpdater_.requestUiRefresh(); //trigger display refresh - delHandling_.removeFile<LEFT_SIDE>(fileObj); //throw FileError() - fileObj.removeObject<LEFT_SIDE>(); //remove file from FileMapping, to keep in sync (if subsequent copying fails!!) + //1. check read access: don't delete target file if source cannot be read (e.g. is locked) + checkFileReadable(fileObj.getFullName<RIGHT_SIDE>()); //throw (FileError) - copyFileUpdating(fileObj.getFullName<RIGHT_SIDE>(), target, fileObj.getFileSize<RIGHT_SIDE>()); - break; + //2. delete target and copy source + delHandling_.removeFile<LEFT_SIDE>(fileObj); //throw FileError() + fileObj.removeObject<LEFT_SIDE>(); //remove file from FileMapping, to keep in sync (if subsequent copying fails!!) - case SO_OVERWRITE_RIGHT: - target = fileObj.getBaseDirPf<RIGHT_SIDE>() + fileObj.getRelativeName<LEFT_SIDE>(); //respect differences in case of source object + copyFileUpdating(fileObj.getFullName<RIGHT_SIDE>(), target, fileObj.getFileSize<RIGHT_SIDE>()); + break; - statusText = txtOverwritingFile; - statusText.Replace(Zstr("%x"), fileObj.getShortName<LEFT_SIDE>(), false); - statusText.Replace(Zstr("%y"), fileObj.getFullName<RIGHT_SIDE>().BeforeLast(common::FILE_NAME_SEPARATOR), false); - statusUpdater_.reportInfo(statusText); - statusUpdater_.requestUiRefresh(); //trigger display refresh + case SO_OVERWRITE_RIGHT: + target = fileObj.getBaseDirPf<RIGHT_SIDE>() + fileObj.getRelativeName<LEFT_SIDE>(); //respect differences in case of source object - delHandling_.removeFile<RIGHT_SIDE>(fileObj); //throw FileError() - fileObj.removeObject<RIGHT_SIDE>(); //remove file from FileMapping, to keep in sync (if subsequent copying fails!!) + statusText = txtOverwritingFile; + statusText.Replace(Zstr("%x"), fileObj.getShortName<LEFT_SIDE>(), false); + statusText.Replace(Zstr("%y"), fileObj.getFullName<RIGHT_SIDE>().BeforeLast(common::FILE_NAME_SEPARATOR), false); + statusUpdater_.reportInfo(statusText); + statusUpdater_.requestUiRefresh(); //trigger display refresh - copyFileUpdating(fileObj.getFullName<LEFT_SIDE>(), target, fileObj.getFileSize<LEFT_SIDE>()); - break; + //1. check read access: don't delete target file if source cannot be read (e.g. is locked) + checkFileReadable(fileObj.getFullName<LEFT_SIDE>()); //throw (FileError) - case SO_COPY_METADATA_TO_LEFT: - statusText = txtWritingAttributes; - statusText.Replace(Zstr("%x"), fileObj.getFullName<LEFT_SIDE>(), false); - statusUpdater_.reportInfo(statusText); - statusUpdater_.requestUiRefresh(); //trigger display refresh + //2. delete target and copy source + delHandling_.removeFile<RIGHT_SIDE>(fileObj); //throw FileError() + fileObj.removeObject<RIGHT_SIDE>(); //remove file from FileMapping, to keep in sync (if subsequent copying fails!!) - if (fileObj.getShortName<LEFT_SIDE>() != fileObj.getShortName<RIGHT_SIDE>()) //adapt difference in case (windows only) - moveFile(fileObj.getFullName<LEFT_SIDE>(), - fileObj.getFullName<LEFT_SIDE>().BeforeLast(common::FILE_NAME_SEPARATOR) + common::FILE_NAME_SEPARATOR + fileObj.getShortName<RIGHT_SIDE>()); //throw (FileError); + copyFileUpdating(fileObj.getFullName<LEFT_SIDE>(), target, fileObj.getFileSize<LEFT_SIDE>()); + break; - if (!sameFileTime(fileObj.getLastWriteTime<LEFT_SIDE>(), fileObj.getLastWriteTime<RIGHT_SIDE>(), 2)) ////respect 2 second FAT/FAT32 precision - copyFileTimes(fileObj.getFullName<RIGHT_SIDE>(), fileObj.getFullName<LEFT_SIDE>(), true); //deref symlinks; throw (FileError) - break; + case SO_COPY_METADATA_TO_LEFT: + statusText = txtWritingAttributes; + statusText.Replace(Zstr("%x"), fileObj.getFullName<LEFT_SIDE>(), false); + statusUpdater_.reportInfo(statusText); + statusUpdater_.requestUiRefresh(); //trigger display refresh + + if (fileObj.getShortName<LEFT_SIDE>() != fileObj.getShortName<RIGHT_SIDE>()) //adapt difference in case (windows only) + moveFile(fileObj.getFullName<LEFT_SIDE>(), + fileObj.getFullName<LEFT_SIDE>().BeforeLast(common::FILE_NAME_SEPARATOR) + common::FILE_NAME_SEPARATOR + fileObj.getShortName<RIGHT_SIDE>()); //throw (FileError); - case SO_COPY_METADATA_TO_RIGHT: - statusText = txtWritingAttributes; - statusText.Replace(Zstr("%x"), fileObj.getFullName<RIGHT_SIDE>(), false); - statusUpdater_.reportInfo(statusText); - statusUpdater_.requestUiRefresh(); //trigger display refresh + if (!sameFileTime(fileObj.getLastWriteTime<LEFT_SIDE>(), fileObj.getLastWriteTime<RIGHT_SIDE>(), 2)) ////respect 2 second FAT/FAT32 precision + copyFileTimes(fileObj.getFullName<RIGHT_SIDE>(), fileObj.getFullName<LEFT_SIDE>(), true); //deref symlinks; throw (FileError) + break; - if (fileObj.getShortName<LEFT_SIDE>() != fileObj.getShortName<RIGHT_SIDE>()) //adapt difference in case (windows only) - moveFile(fileObj.getFullName<RIGHT_SIDE>(), - fileObj.getFullName<RIGHT_SIDE>().BeforeLast(common::FILE_NAME_SEPARATOR) + common::FILE_NAME_SEPARATOR + fileObj.getShortName<LEFT_SIDE>()); //throw (FileError); + case SO_COPY_METADATA_TO_RIGHT: + statusText = txtWritingAttributes; + statusText.Replace(Zstr("%x"), fileObj.getFullName<RIGHT_SIDE>(), false); + statusUpdater_.reportInfo(statusText); + statusUpdater_.requestUiRefresh(); //trigger display refresh - if (!sameFileTime(fileObj.getLastWriteTime<LEFT_SIDE>(), fileObj.getLastWriteTime<RIGHT_SIDE>(), 2)) ////respect 2 second FAT/FAT32 precision - copyFileTimes(fileObj.getFullName<LEFT_SIDE>(), fileObj.getFullName<RIGHT_SIDE>(), true); //deref symlinks; throw (FileError) - break; + if (fileObj.getShortName<LEFT_SIDE>() != fileObj.getShortName<RIGHT_SIDE>()) //adapt difference in case (windows only) + moveFile(fileObj.getFullName<RIGHT_SIDE>(), + fileObj.getFullName<RIGHT_SIDE>().BeforeLast(common::FILE_NAME_SEPARATOR) + common::FILE_NAME_SEPARATOR + fileObj.getShortName<LEFT_SIDE>()); //throw (FileError); + + if (!sameFileTime(fileObj.getLastWriteTime<LEFT_SIDE>(), fileObj.getLastWriteTime<RIGHT_SIDE>(), 2)) ////respect 2 second FAT/FAT32 precision + copyFileTimes(fileObj.getFullName<LEFT_SIDE>(), fileObj.getFullName<RIGHT_SIDE>(), true); //deref symlinks; throw (FileError) + break; - case SO_DO_NOTHING: - case SO_EQUAL: - case SO_UNRESOLVED_CONFLICT: - return; //no update on processed data! + case SO_DO_NOTHING: + case SO_EQUAL: + case SO_UNRESOLVED_CONFLICT: + return; //no update on processed data! } //update FileMapping @@ -1144,110 +1158,110 @@ void SynchronizeFolderPair::synchronizeLink(SymLinkMapping& linkObj) const switch (linkObj.getSyncOperation()) //evaluate comparison result and sync direction { - case SO_CREATE_NEW_LEFT: - target = linkObj.getBaseDirPf<LEFT_SIDE>() + linkObj.getRelativeName<RIGHT_SIDE>(); + case SO_CREATE_NEW_LEFT: + target = linkObj.getBaseDirPf<LEFT_SIDE>() + linkObj.getRelativeName<RIGHT_SIDE>(); - statusText = txtCopyingLink; - statusText.Replace(Zstr("%x"), linkObj.getShortName<RIGHT_SIDE>(), false); - statusText.Replace(Zstr("%y"), target.BeforeLast(common::FILE_NAME_SEPARATOR), false); - statusUpdater_.reportInfo(statusText); - statusUpdater_.requestUiRefresh(); //trigger display refresh + statusText = txtCopyingLink; + statusText.Replace(Zstr("%x"), linkObj.getShortName<RIGHT_SIDE>(), false); + statusText.Replace(Zstr("%y"), target.BeforeLast(common::FILE_NAME_SEPARATOR), false); + statusUpdater_.reportInfo(statusText); + statusUpdater_.requestUiRefresh(); //trigger display refresh - copySymlink(linkObj.getFullName<RIGHT_SIDE>(), target, linkObj.getLinkType<RIGHT_SIDE>()); - break; + copySymlink(linkObj.getFullName<RIGHT_SIDE>(), target, linkObj.getLinkType<RIGHT_SIDE>()); + break; - case SO_CREATE_NEW_RIGHT: - target = linkObj.getBaseDirPf<RIGHT_SIDE>() + linkObj.getRelativeName<LEFT_SIDE>(); + case SO_CREATE_NEW_RIGHT: + target = linkObj.getBaseDirPf<RIGHT_SIDE>() + linkObj.getRelativeName<LEFT_SIDE>(); - statusText = txtCopyingLink; - statusText.Replace(Zstr("%x"), linkObj.getShortName<LEFT_SIDE>(), false); - statusText.Replace(Zstr("%y"), target.BeforeLast(common::FILE_NAME_SEPARATOR), false); - statusUpdater_.reportInfo(statusText); - statusUpdater_.requestUiRefresh(); //trigger display refresh + statusText = txtCopyingLink; + statusText.Replace(Zstr("%x"), linkObj.getShortName<LEFT_SIDE>(), false); + statusText.Replace(Zstr("%y"), target.BeforeLast(common::FILE_NAME_SEPARATOR), false); + statusUpdater_.reportInfo(statusText); + statusUpdater_.requestUiRefresh(); //trigger display refresh - copySymlink(linkObj.getFullName<LEFT_SIDE>(), target, linkObj.getLinkType<LEFT_SIDE>()); - break; + copySymlink(linkObj.getFullName<LEFT_SIDE>(), target, linkObj.getLinkType<LEFT_SIDE>()); + break; - case SO_DELETE_LEFT: - statusText = delHandling_.getTxtRemovingSymLink(); - statusText.Replace(Zstr("%x"), linkObj.getFullName<LEFT_SIDE>(), false); - statusUpdater_.reportInfo(statusText); - statusUpdater_.requestUiRefresh(); //trigger display refresh + case SO_DELETE_LEFT: + statusText = delHandling_.getTxtRemovingSymLink(); + statusText.Replace(Zstr("%x"), linkObj.getFullName<LEFT_SIDE>(), false); + statusUpdater_.reportInfo(statusText); + statusUpdater_.requestUiRefresh(); //trigger display refresh - deleteSymlink<LEFT_SIDE>(linkObj); //throw FileError() - break; + deleteSymlink<LEFT_SIDE>(linkObj); //throw FileError() + break; - case SO_DELETE_RIGHT: - statusText = delHandling_.getTxtRemovingSymLink(); - statusText.Replace(Zstr("%x"), linkObj.getFullName<RIGHT_SIDE>(), false); - statusUpdater_.reportInfo(statusText); - statusUpdater_.requestUiRefresh(); //trigger display refresh + case SO_DELETE_RIGHT: + statusText = delHandling_.getTxtRemovingSymLink(); + statusText.Replace(Zstr("%x"), linkObj.getFullName<RIGHT_SIDE>(), false); + statusUpdater_.reportInfo(statusText); + statusUpdater_.requestUiRefresh(); //trigger display refresh - deleteSymlink<RIGHT_SIDE>(linkObj); //throw FileError() - break; + deleteSymlink<RIGHT_SIDE>(linkObj); //throw FileError() + break; - case SO_OVERWRITE_LEFT: - target = linkObj.getBaseDirPf<LEFT_SIDE>() + linkObj.getRelativeName<RIGHT_SIDE>(); //respect differences in case of source object + case SO_OVERWRITE_LEFT: + target = linkObj.getBaseDirPf<LEFT_SIDE>() + linkObj.getRelativeName<RIGHT_SIDE>(); //respect differences in case of source object - statusText = txtOverwritingLink; - statusText.Replace(Zstr("%x"), linkObj.getShortName<RIGHT_SIDE>(), false); - statusText.Replace(Zstr("%y"), linkObj.getFullName<LEFT_SIDE>().BeforeLast(common::FILE_NAME_SEPARATOR), false); - statusUpdater_.reportInfo(statusText); - statusUpdater_.requestUiRefresh(); //trigger display refresh + statusText = txtOverwritingLink; + statusText.Replace(Zstr("%x"), linkObj.getShortName<RIGHT_SIDE>(), false); + statusText.Replace(Zstr("%y"), linkObj.getFullName<LEFT_SIDE>().BeforeLast(common::FILE_NAME_SEPARATOR), false); + statusUpdater_.reportInfo(statusText); + statusUpdater_.requestUiRefresh(); //trigger display refresh - deleteSymlink<LEFT_SIDE>(linkObj); //throw FileError() - linkObj.removeObject<LEFT_SIDE>(); //remove file from FileMapping, to keep in sync (if subsequent copying fails!!) + deleteSymlink<LEFT_SIDE>(linkObj); //throw FileError() + linkObj.removeObject<LEFT_SIDE>(); //remove file from FileMapping, to keep in sync (if subsequent copying fails!!) - copySymlink(linkObj.getFullName<RIGHT_SIDE>(), target, linkObj.getLinkType<RIGHT_SIDE>()); - break; + copySymlink(linkObj.getFullName<RIGHT_SIDE>(), target, linkObj.getLinkType<RIGHT_SIDE>()); + break; - case SO_OVERWRITE_RIGHT: - target = linkObj.getBaseDirPf<RIGHT_SIDE>() + linkObj.getRelativeName<LEFT_SIDE>(); //respect differences in case of source object + case SO_OVERWRITE_RIGHT: + target = linkObj.getBaseDirPf<RIGHT_SIDE>() + linkObj.getRelativeName<LEFT_SIDE>(); //respect differences in case of source object - statusText = txtOverwritingLink; - statusText.Replace(Zstr("%x"), linkObj.getShortName<LEFT_SIDE>(), false); - statusText.Replace(Zstr("%y"), linkObj.getFullName<RIGHT_SIDE>().BeforeLast(common::FILE_NAME_SEPARATOR), false); - statusUpdater_.reportInfo(statusText); - statusUpdater_.requestUiRefresh(); //trigger display refresh + statusText = txtOverwritingLink; + statusText.Replace(Zstr("%x"), linkObj.getShortName<LEFT_SIDE>(), false); + statusText.Replace(Zstr("%y"), linkObj.getFullName<RIGHT_SIDE>().BeforeLast(common::FILE_NAME_SEPARATOR), false); + statusUpdater_.reportInfo(statusText); + statusUpdater_.requestUiRefresh(); //trigger display refresh - deleteSymlink<RIGHT_SIDE>(linkObj); //throw FileError() - linkObj.removeObject<RIGHT_SIDE>(); //remove file from FileMapping, to keep in sync (if subsequent copying fails!!) + deleteSymlink<RIGHT_SIDE>(linkObj); //throw FileError() + linkObj.removeObject<RIGHT_SIDE>(); //remove file from FileMapping, to keep in sync (if subsequent copying fails!!) - copySymlink(linkObj.getFullName<LEFT_SIDE>(), target, linkObj.getLinkType<LEFT_SIDE>()); - break; + copySymlink(linkObj.getFullName<LEFT_SIDE>(), target, linkObj.getLinkType<LEFT_SIDE>()); + break; - case SO_COPY_METADATA_TO_LEFT: - statusText = txtWritingAttributes; - statusText.Replace(Zstr("%x"), linkObj.getFullName<LEFT_SIDE>(), false); - statusUpdater_.reportInfo(statusText); - statusUpdater_.requestUiRefresh(); //trigger display refresh + case SO_COPY_METADATA_TO_LEFT: + statusText = txtWritingAttributes; + statusText.Replace(Zstr("%x"), linkObj.getFullName<LEFT_SIDE>(), false); + statusUpdater_.reportInfo(statusText); + statusUpdater_.requestUiRefresh(); //trigger display refresh - if (linkObj.getShortName<LEFT_SIDE>() != linkObj.getShortName<RIGHT_SIDE>()) //adapt difference in case (windows only) - moveFile(linkObj.getFullName<LEFT_SIDE>(), - linkObj.getFullName<LEFT_SIDE>().BeforeLast(common::FILE_NAME_SEPARATOR) + common::FILE_NAME_SEPARATOR + linkObj.getShortName<RIGHT_SIDE>()); //throw (FileError); + if (linkObj.getShortName<LEFT_SIDE>() != linkObj.getShortName<RIGHT_SIDE>()) //adapt difference in case (windows only) + moveFile(linkObj.getFullName<LEFT_SIDE>(), + linkObj.getFullName<LEFT_SIDE>().BeforeLast(common::FILE_NAME_SEPARATOR) + common::FILE_NAME_SEPARATOR + linkObj.getShortName<RIGHT_SIDE>()); //throw (FileError); - if (!sameFileTime(linkObj.getLastWriteTime<LEFT_SIDE>(), linkObj.getLastWriteTime<RIGHT_SIDE>(), 2)) ////respect 2 second FAT/FAT32 precision - copyFileTimes(linkObj.getFullName<RIGHT_SIDE>(), linkObj.getFullName<LEFT_SIDE>(), false); //don't deref symlinks; throw (FileError) - break; + if (!sameFileTime(linkObj.getLastWriteTime<LEFT_SIDE>(), linkObj.getLastWriteTime<RIGHT_SIDE>(), 2)) ////respect 2 second FAT/FAT32 precision + copyFileTimes(linkObj.getFullName<RIGHT_SIDE>(), linkObj.getFullName<LEFT_SIDE>(), false); //don't deref symlinks; throw (FileError) + break; - case SO_COPY_METADATA_TO_RIGHT: - statusText = txtWritingAttributes; - statusText.Replace(Zstr("%x"), linkObj.getFullName<RIGHT_SIDE>(), false); - statusUpdater_.reportInfo(statusText); - statusUpdater_.requestUiRefresh(); //trigger display refresh + case SO_COPY_METADATA_TO_RIGHT: + statusText = txtWritingAttributes; + statusText.Replace(Zstr("%x"), linkObj.getFullName<RIGHT_SIDE>(), false); + statusUpdater_.reportInfo(statusText); + statusUpdater_.requestUiRefresh(); //trigger display refresh - if (linkObj.getShortName<LEFT_SIDE>() != linkObj.getShortName<RIGHT_SIDE>()) //adapt difference in case (windows only) - moveFile(linkObj.getFullName<RIGHT_SIDE>(), - linkObj.getFullName<RIGHT_SIDE>().BeforeLast(common::FILE_NAME_SEPARATOR) + common::FILE_NAME_SEPARATOR + linkObj.getShortName<LEFT_SIDE>()); //throw (FileError); + if (linkObj.getShortName<LEFT_SIDE>() != linkObj.getShortName<RIGHT_SIDE>()) //adapt difference in case (windows only) + moveFile(linkObj.getFullName<RIGHT_SIDE>(), + linkObj.getFullName<RIGHT_SIDE>().BeforeLast(common::FILE_NAME_SEPARATOR) + common::FILE_NAME_SEPARATOR + linkObj.getShortName<LEFT_SIDE>()); //throw (FileError); - if (!sameFileTime(linkObj.getLastWriteTime<LEFT_SIDE>(), linkObj.getLastWriteTime<RIGHT_SIDE>(), 2)) ////respect 2 second FAT/FAT32 precision - copyFileTimes(linkObj.getFullName<LEFT_SIDE>(), linkObj.getFullName<RIGHT_SIDE>(), false); //don't deref symlinks; throw (FileError) - break; + if (!sameFileTime(linkObj.getLastWriteTime<LEFT_SIDE>(), linkObj.getLastWriteTime<RIGHT_SIDE>(), 2)) ////respect 2 second FAT/FAT32 precision + copyFileTimes(linkObj.getFullName<LEFT_SIDE>(), linkObj.getFullName<RIGHT_SIDE>(), false); //don't deref symlinks; throw (FileError) + break; - case SO_DO_NOTHING: - case SO_EQUAL: - case SO_UNRESOLVED_CONFLICT: - return; //no update on processed data! + case SO_DO_NOTHING: + case SO_EQUAL: + case SO_UNRESOLVED_CONFLICT: + return; //no update on processed data! } //update FileMapping @@ -1267,103 +1281,103 @@ void SynchronizeFolderPair::synchronizeFolder(DirMapping& dirObj) const //synchronize folders: switch (dirObj.getSyncOperation()) //evaluate comparison result and sync direction { - case SO_CREATE_NEW_LEFT: - target = dirObj.getBaseDirPf<LEFT_SIDE>() + dirObj.getRelativeName<RIGHT_SIDE>(); - - statusText = txtCreatingFolder; - statusText.Replace(Zstr("%x"), target, false); - statusUpdater_.reportInfo(statusText); - statusUpdater_.requestUiRefresh(); //trigger display refresh - - //some check to catch the error that directory on source has been deleted externally after "compare"... - if (!ffs3::dirExists(dirObj.getFullName<RIGHT_SIDE>())) - throw FileError(wxString(_("Source directory does not exist anymore:")) + wxT("\n\"") + zToWx(dirObj.getFullName<RIGHT_SIDE>()) + wxT("\"")); - createDirectory(target, dirObj.getFullName<RIGHT_SIDE>(), false, copyFilePermissions_); //no symlink copying! - break; + case SO_CREATE_NEW_LEFT: + target = dirObj.getBaseDirPf<LEFT_SIDE>() + dirObj.getRelativeName<RIGHT_SIDE>(); + + statusText = txtCreatingFolder; + statusText.Replace(Zstr("%x"), target, false); + statusUpdater_.reportInfo(statusText); + statusUpdater_.requestUiRefresh(); //trigger display refresh + + //some check to catch the error that directory on source has been deleted externally after "compare"... + if (!ffs3::dirExists(dirObj.getFullName<RIGHT_SIDE>())) + throw FileError(wxString(_("Source directory does not exist anymore:")) + wxT("\n\"") + zToWx(dirObj.getFullName<RIGHT_SIDE>()) + wxT("\"")); + createDirectory(target, dirObj.getFullName<RIGHT_SIDE>(), false, copyFilePermissions_); //no symlink copying! + break; - case SO_CREATE_NEW_RIGHT: - target = dirObj.getBaseDirPf<RIGHT_SIDE>() + dirObj.getRelativeName<LEFT_SIDE>(); + case SO_CREATE_NEW_RIGHT: + target = dirObj.getBaseDirPf<RIGHT_SIDE>() + dirObj.getRelativeName<LEFT_SIDE>(); - statusText = txtCreatingFolder; - statusText.Replace(Zstr("%x"), target, false); - statusUpdater_.reportInfo(statusText); - statusUpdater_.requestUiRefresh(); //trigger display refresh + statusText = txtCreatingFolder; + statusText.Replace(Zstr("%x"), target, false); + statusUpdater_.reportInfo(statusText); + statusUpdater_.requestUiRefresh(); //trigger display refresh - //some check to catch the error that directory on source has been deleted externally after "compare"... - if (!ffs3::dirExists(dirObj.getFullName<LEFT_SIDE>())) - throw FileError(wxString(_("Source directory does not exist anymore:")) + wxT("\n\"") + zToWx(dirObj.getFullName<LEFT_SIDE>()) + wxT("\"")); - createDirectory(target, dirObj.getFullName<LEFT_SIDE>(), false, copyFilePermissions_); //no symlink copying! - break; + //some check to catch the error that directory on source has been deleted externally after "compare"... + if (!ffs3::dirExists(dirObj.getFullName<LEFT_SIDE>())) + throw FileError(wxString(_("Source directory does not exist anymore:")) + wxT("\n\"") + zToWx(dirObj.getFullName<LEFT_SIDE>()) + wxT("\"")); + createDirectory(target, dirObj.getFullName<LEFT_SIDE>(), false, copyFilePermissions_); //no symlink copying! + break; - case SO_DELETE_LEFT: - //status information - statusText = delHandling_.getTxtRemovingDir(); - statusText.Replace(Zstr("%x"), dirObj.getFullName<LEFT_SIDE>(), false); - statusUpdater_.reportInfo(statusText); - statusUpdater_.requestUiRefresh(); //trigger display refresh + case SO_DELETE_LEFT: + //status information + statusText = delHandling_.getTxtRemovingDir(); + statusText.Replace(Zstr("%x"), dirObj.getFullName<LEFT_SIDE>(), false); + statusUpdater_.reportInfo(statusText); + statusUpdater_.requestUiRefresh(); //trigger display refresh - delHandling_.removeFolder<LEFT_SIDE>(dirObj); //throw FileError() - { - //progress indicator update: DON'T forget to notify about implicitly deleted objects! - const SyncStatistics subObjects(dirObj); - //...then remove everything - dirObj.useSubFiles().clear(); - dirObj.useSubLinks().clear(); - dirObj.useSubDirs().clear(); - statusUpdater_.updateProcessedData(subObjects.getCreate() + subObjects.getOverwrite() + subObjects.getDelete(), subObjects.getDataToProcess().ToDouble()); - } - break; + delHandling_.removeFolder<LEFT_SIDE>(dirObj); //throw FileError() + { + //progress indicator update: DON'T forget to notify about implicitly deleted objects! + const SyncStatistics subObjects(dirObj); + //...then remove everything + dirObj.useSubFiles().clear(); + dirObj.useSubLinks().clear(); + dirObj.useSubDirs().clear(); + statusUpdater_.updateProcessedData(subObjects.getCreate() + subObjects.getOverwrite() + subObjects.getDelete(), subObjects.getDataToProcess().ToDouble()); + } + break; - case SO_DELETE_RIGHT: - //status information - statusText = delHandling_.getTxtRemovingDir(); - statusText.Replace(Zstr("%x"), dirObj.getFullName<RIGHT_SIDE>(), false); - statusUpdater_.reportInfo(statusText); - statusUpdater_.requestUiRefresh(); //trigger display refresh + case SO_DELETE_RIGHT: + //status information + statusText = delHandling_.getTxtRemovingDir(); + statusText.Replace(Zstr("%x"), dirObj.getFullName<RIGHT_SIDE>(), false); + statusUpdater_.reportInfo(statusText); + statusUpdater_.requestUiRefresh(); //trigger display refresh - delHandling_.removeFolder<RIGHT_SIDE>(dirObj); //throw FileError() - { - //progress indicator update: DON'T forget to notify about implicitly deleted objects! - const SyncStatistics subObjects(dirObj); - //...then remove everything - dirObj.useSubFiles().clear(); - dirObj.useSubLinks().clear(); - dirObj.useSubDirs().clear(); - statusUpdater_.updateProcessedData(subObjects.getCreate() + subObjects.getOverwrite() + subObjects.getDelete(), subObjects.getDataToProcess().ToDouble()); - } - break; + delHandling_.removeFolder<RIGHT_SIDE>(dirObj); //throw FileError() + { + //progress indicator update: DON'T forget to notify about implicitly deleted objects! + const SyncStatistics subObjects(dirObj); + //...then remove everything + dirObj.useSubFiles().clear(); + dirObj.useSubLinks().clear(); + dirObj.useSubDirs().clear(); + statusUpdater_.updateProcessedData(subObjects.getCreate() + subObjects.getOverwrite() + subObjects.getDelete(), subObjects.getDataToProcess().ToDouble()); + } + break; - case SO_COPY_METADATA_TO_LEFT: - statusText = txtWritingAttributes; - statusText.Replace(Zstr("%x"), dirObj.getFullName<LEFT_SIDE>(), false); - statusUpdater_.reportInfo(statusText); - statusUpdater_.requestUiRefresh(); //trigger display refresh + case SO_COPY_METADATA_TO_LEFT: + statusText = txtWritingAttributes; + statusText.Replace(Zstr("%x"), dirObj.getFullName<LEFT_SIDE>(), false); + statusUpdater_.reportInfo(statusText); + statusUpdater_.requestUiRefresh(); //trigger display refresh - if (dirObj.getShortName<LEFT_SIDE>() != dirObj.getShortName<RIGHT_SIDE>()) //adapt difference in case (windows only) - moveFile(dirObj.getFullName<LEFT_SIDE>(), - dirObj.getFullName<LEFT_SIDE>().BeforeLast(common::FILE_NAME_SEPARATOR) + common::FILE_NAME_SEPARATOR + dirObj.getShortName<RIGHT_SIDE>()); //throw (FileError); - //copyFileTimes(dirObj.getFullName<RIGHT_SIDE>(), dirObj.getFullName<LEFT_SIDE>(), true); //throw (FileError) -> is executed after sub-objects have finished synchronization - break; + if (dirObj.getShortName<LEFT_SIDE>() != dirObj.getShortName<RIGHT_SIDE>()) //adapt difference in case (windows only) + moveFile(dirObj.getFullName<LEFT_SIDE>(), + dirObj.getFullName<LEFT_SIDE>().BeforeLast(common::FILE_NAME_SEPARATOR) + common::FILE_NAME_SEPARATOR + dirObj.getShortName<RIGHT_SIDE>()); //throw (FileError); + //copyFileTimes(dirObj.getFullName<RIGHT_SIDE>(), dirObj.getFullName<LEFT_SIDE>(), true); //throw (FileError) -> is executed after sub-objects have finished synchronization + break; - case SO_COPY_METADATA_TO_RIGHT: - statusText = txtWritingAttributes; - statusText.Replace(Zstr("%x"), dirObj.getFullName<RIGHT_SIDE>(), false); - statusUpdater_.reportInfo(statusText); - statusUpdater_.requestUiRefresh(); //trigger display refresh + case SO_COPY_METADATA_TO_RIGHT: + statusText = txtWritingAttributes; + statusText.Replace(Zstr("%x"), dirObj.getFullName<RIGHT_SIDE>(), false); + statusUpdater_.reportInfo(statusText); + statusUpdater_.requestUiRefresh(); //trigger display refresh - if (dirObj.getShortName<LEFT_SIDE>() != dirObj.getShortName<RIGHT_SIDE>()) //adapt difference in case (windows only) - moveFile(dirObj.getFullName<RIGHT_SIDE>(), - dirObj.getFullName<RIGHT_SIDE>().BeforeLast(common::FILE_NAME_SEPARATOR) + common::FILE_NAME_SEPARATOR + dirObj.getShortName<LEFT_SIDE>()); //throw (FileError); - //copyFileTimes(dirObj.getFullName<LEFT_SIDE>(), dirObj.getFullName<RIGHT_SIDE>(), true); //throw (FileError) -> is executed after sub-objects have finished synchronization - break; + if (dirObj.getShortName<LEFT_SIDE>() != dirObj.getShortName<RIGHT_SIDE>()) //adapt difference in case (windows only) + moveFile(dirObj.getFullName<RIGHT_SIDE>(), + dirObj.getFullName<RIGHT_SIDE>().BeforeLast(common::FILE_NAME_SEPARATOR) + common::FILE_NAME_SEPARATOR + dirObj.getShortName<LEFT_SIDE>()); //throw (FileError); + //copyFileTimes(dirObj.getFullName<LEFT_SIDE>(), dirObj.getFullName<RIGHT_SIDE>(), true); //throw (FileError) -> is executed after sub-objects have finished synchronization + break; - case SO_OVERWRITE_RIGHT: - case SO_OVERWRITE_LEFT: - assert(false); - case SO_UNRESOLVED_CONFLICT: - case SO_DO_NOTHING: - case SO_EQUAL: - return; //no update on processed data! + case SO_OVERWRITE_RIGHT: + case SO_OVERWRITE_LEFT: + assert(false); + case SO_UNRESOLVED_CONFLICT: + case SO_DO_NOTHING: + case SO_EQUAL: + return; //no update on processed data! } //update DirMapping @@ -1421,6 +1435,9 @@ void SyncProcess::startSynchronizationProcess(const std::vector<FolderPairSyncCf //PERF_START; + if (syncConfig.size() != folderCmp.size()) + throw std::logic_error("Programming Error: Contract violation!"); + //inform about the total amount of data that will be processed from now on const SyncStatistics statisticsTotal(folderCmp); @@ -1430,10 +1447,14 @@ void SyncProcess::startSynchronizationProcess(const std::vector<FolderPairSyncCf common::convertToSigned(statisticsTotal.getDataToProcess()), StatusHandler::PROCESS_SYNCHRONIZING); + if (!synchronizationNeeded(statisticsTotal)) + statusUpdater.reportInfo(wxToZ(_("Nothing to synchronize according to configuration!"))); //inform about this special case + + + std::deque<bool> skipFolderPair(folderCmp.size()); //folder pairs may be skipped after fatal errors were found + //-------------------some basic checks:------------------------------------------ - if (syncConfig.size() != folderCmp.size()) - throw std::logic_error("Programming Error: Contract violation!"); //aggregate information typedef std::set<Zstring, LessDependentDirectory> DirReadSet; //count (at least one) read access @@ -1451,14 +1472,17 @@ void SyncProcess::startSynchronizationProcess(const std::vector<FolderPairSyncCf //start checking folder pairs for (FolderComparison::const_iterator j = folderCmp.begin(); j != folderCmp.end(); ++j) { + const size_t folderIndex = j - folderCmp.begin(); + //exclude some pathological case (leftdir, rightdir are empty) if (EqualFilename()(j->getBaseDir<LEFT_SIDE>(), j->getBaseDir<RIGHT_SIDE>())) continue; - const FolderPairSyncCfg& folderPairCfg = syncConfig[j - folderCmp.begin()]; + const FolderPairSyncCfg& folderPairCfg = syncConfig[folderIndex]; + const SyncStatistics statisticsFolderPair(*j); - //aggregate information of folders used by multiple pairs in read/write access + //aggregate basic information const bool writeLeft = statisticsFolderPair.getCreate <LEFT_SIDE>() + statisticsFolderPair.getOverwrite<LEFT_SIDE>() + statisticsFolderPair.getDelete <LEFT_SIDE>() > 0; @@ -1466,6 +1490,26 @@ void SyncProcess::startSynchronizationProcess(const std::vector<FolderPairSyncCf const bool writeRight = statisticsFolderPair.getCreate <RIGHT_SIDE>() + statisticsFolderPair.getOverwrite<RIGHT_SIDE>() + statisticsFolderPair.getDelete <RIGHT_SIDE>() > 0; + + //skip folder pair if there is nothing to do (except for automatic mode, where data base needs to be written even in this case) + if (!writeLeft && !writeRight && + !folderPairCfg.inAutomaticMode) + { + skipFolderPair[folderIndex] = true; //skip creating (not yet existing) base directories in particular if there's no need + continue; + } + + + //check empty input fields: basically this only makes sense if empty field is not target (and not automatic mode: because of db file creation) + if ((j->getBaseDir<LEFT_SIDE>(). empty() && (writeLeft || folderPairCfg.inAutomaticMode)) || + (j->getBaseDir<RIGHT_SIDE>().empty() && (writeRight || folderPairCfg.inAutomaticMode))) + { + statusUpdater.reportFatalError(_("Cannot write to empty directory path!")); + skipFolderPair[folderIndex] = true; + continue; + } + + //aggregate information of folders used by multiple pairs in read/write access if (!EqualDependentDirectory()(j->getBaseDir<LEFT_SIDE>(), j->getBaseDir<RIGHT_SIDE>())) //true in general { if (writeLeft) @@ -1488,13 +1532,15 @@ void SyncProcess::startSynchronizationProcess(const std::vector<FolderPairSyncCf ++dirWriteCount[j->getBaseDir<LEFT_SIDE>()]; } + if (statisticsFolderPair.getOverwrite() + statisticsFolderPair.getDelete() > 0) { //test existence of Recycle Bin if (folderPairCfg.handleDeletion == ffs3::MOVE_TO_RECYCLE_BIN && !ffs3::recycleBinExists()) { statusUpdater.reportFatalError(_("Recycle Bin not yet supported for this system!")); - return; //should be obsolete! + skipFolderPair[folderIndex] = true; + continue; } if (folderPairCfg.handleDeletion == ffs3::MOVE_TO_CUSTOM_DIRECTORY) @@ -1503,7 +1549,8 @@ void SyncProcess::startSynchronizationProcess(const std::vector<FolderPairSyncCf if (folderPairCfg.custDelFolder.empty()) { statusUpdater.reportFatalError(_("User-defined directory for deletion was not specified!")); - return; //should be obsolete! + skipFolderPair[folderIndex] = true; + continue; } } } @@ -1512,12 +1559,14 @@ void SyncProcess::startSynchronizationProcess(const std::vector<FolderPairSyncCf if (dataLossPossible(j->getBaseDir<LEFT_SIDE>(), statisticsFolderPair)) { statusUpdater.reportFatalError(wxString(_("Source directory does not exist anymore:")) + wxT("\n\"") + zToWx(j->getBaseDir<LEFT_SIDE>()) + wxT("\"")); - return; //should be obsolete! + skipFolderPair[folderIndex] = true; + continue; } if (dataLossPossible(j->getBaseDir<RIGHT_SIDE>(), statisticsFolderPair)) { statusUpdater.reportFatalError(wxString(_("Source directory does not exist anymore:")) + wxT("\n\"") + zToWx(j->getBaseDir<RIGHT_SIDE>()) + wxT("\"") ); - return; //should be obsolete! + skipFolderPair[folderIndex] = true; + continue; } //check if more than 50% of total number of files/dirs are to be created/overwritten/deleted @@ -1531,7 +1580,7 @@ void SyncProcess::startSynchronizationProcess(const std::vector<FolderPairSyncCf if (wxGetDiskSpace(zToWx(j->getBaseDir<LEFT_SIDE>()), NULL, &freeDiskSpaceLeft)) { if (0 < freeDiskSpaceLeft && //zero disk space is either an error or not: in both cases this warning message is obsolete (WebDav seems to report 0) - freeDiskSpaceLeft < spaceNeeded.first) + freeDiskSpaceLeft < spaceNeeded.first) diskSpaceMissing.push_back(std::make_pair(j->getBaseDir<LEFT_SIDE>(), std::make_pair(spaceNeeded.first, freeDiskSpaceLeft))); } @@ -1540,7 +1589,7 @@ void SyncProcess::startSynchronizationProcess(const std::vector<FolderPairSyncCf if (wxGetDiskSpace(zToWx(j->getBaseDir<RIGHT_SIDE>()), NULL, &freeDiskSpaceRight)) { if (0 < freeDiskSpaceRight && //zero disk space is either an error or not: in both cases this warning message is obsolete (WebDav seems to report 0) - freeDiskSpaceRight < spaceNeeded.second) + freeDiskSpaceRight < spaceNeeded.second) diskSpaceMissing.push_back(std::make_pair(j->getBaseDir<RIGHT_SIDE>(), std::make_pair(spaceNeeded.second, freeDiskSpaceRight))); } } @@ -1593,7 +1642,7 @@ void SyncProcess::startSynchronizationProcess(const std::vector<FolderPairSyncCf for (DirSpaceRequAvailList::const_iterator i = diskSpaceMissing.begin(); i != diskSpaceMissing.end(); ++i) warningMessage += wxString(wxT("\n\n")) + wxT("\"") + zToWx(i->first) + wxT("\"\n") + - _("Total required free disk space:") + wxT(" ") + formatFilesizeToShortString(i->second.first) + wxT("\n") + + _("Free disk space required:") + wxT(" ") + formatFilesizeToShortString(i->second.first) + wxT("\n") + _("Free disk space available:") + wxT(" ") + formatFilesizeToShortString(i->second.second); statusUpdater.reportWarning(warningMessage, m_warnings.warningNotEnoughDiskSpace); @@ -1603,8 +1652,8 @@ void SyncProcess::startSynchronizationProcess(const std::vector<FolderPairSyncCf //check if folders are used by multiple pairs in read/write access std::vector<Zstring> conflictDirs; for (DirWriteMap::const_iterator i = dirWriteCount.begin(); i != dirWriteCount.end(); ++i) - if ( i->second >= 2 || //multiple write accesses - (i->second == 1 && dirReadCount.find(i->first) != dirReadCount.end())) //read/write access + if (i->second >= 2 || //multiple write accesses + (i->second == 1 && dirReadCount.find(i->first) != dirReadCount.end())) //read/write access conflictDirs.push_back(i->first); if (!conflictDirs.empty()) @@ -1647,13 +1696,18 @@ void SyncProcess::startSynchronizationProcess(const std::vector<FolderPairSyncCf assert(syncConfig.size() == folderCmp.size()); for (FolderComparison::iterator j = folderCmp.begin(); j != folderCmp.end(); ++j) { - const FolderPairSyncCfg& folderPairCfg = syncConfig[j - folderCmp.begin()]; + const size_t folderIndex = j - folderCmp.begin(); + + const FolderPairSyncCfg& folderPairCfg = syncConfig[folderIndex]; + + if (skipFolderPair[folderIndex]) //folder pairs may be skipped after fatal errors were found + continue; //exclude some pathological case (leftdir, rightdir are empty) if (EqualFilename()(j->getBaseDir<LEFT_SIDE>(), j->getBaseDir<RIGHT_SIDE>())) continue; -//------------------------------------------------------------------------------------------ + //------------------------------------------------------------------------------------------ //info about folder pair to be processed (useful for logfile) wxString left = wxString(_("Left")) + wxT(": "); wxString right = wxString(_("Right")) + wxT(": "); @@ -1663,19 +1717,23 @@ void SyncProcess::startSynchronizationProcess(const std::vector<FolderPairSyncCf wxT("\t") + left + wxT("\"") + zToWx(j->getBaseDir<LEFT_SIDE>()) + wxT("\"")+ wxT(" \n") + wxT("\t") + right + wxT("\"") + zToWx(j->getBaseDir<RIGHT_SIDE>()) + wxT("\""); statusUpdater.reportInfo(wxToZ(statusTxt)); -//------------------------------------------------------------------------------------------ - //(try to) create base dir first (if not yet existing) -> no symlink or attribute copying! - try + + //------------------------------------------------------------------------------------------ + + //create base directories first (if not yet existing) -> no symlink or attribute copying! -> single error message instead of one per file (e.g. unplugged network drive) + const Zstring dirnameLeft = j->getBaseDir<LEFT_SIDE>().BeforeLast(common::FILE_NAME_SEPARATOR); + if (!dirnameLeft.empty() && !ffs3::dirExists(dirnameLeft)) { - ffs3::createDirectory(j->getBaseDir<LEFT_SIDE>().BeforeLast(common::FILE_NAME_SEPARATOR)); + if (!tryReportingError(statusUpdater, boost::bind(ffs3::createDirectory, boost::cref(dirnameLeft)))) //may throw in error-callback! + continue; //skip this folder pair } - catch (...) {} - try //create base dir first -> no symlink or attribute copying! + const Zstring dirnameRight = j->getBaseDir<RIGHT_SIDE>().BeforeLast(common::FILE_NAME_SEPARATOR); + if (!dirnameRight.empty() && !ffs3::dirExists(dirnameRight)) { - ffs3::createDirectory(j->getBaseDir<RIGHT_SIDE>().BeforeLast(common::FILE_NAME_SEPARATOR)); + if (!tryReportingError(statusUpdater, boost::bind(ffs3::createDirectory, boost::cref(dirnameRight)))) //may throw in error-callback! + continue; //skip this folder pair } - catch (...) {} -//------------------------------------------------------------------------------------------ + //------------------------------------------------------------------------------------------ //generate name of alternate deletion directory (unique for session AND folder pair) const DeletionHandling currentDelHandling( @@ -1684,10 +1742,10 @@ void SyncProcess::startSynchronizationProcess(const std::vector<FolderPairSyncCf j->getBaseDir<LEFT_SIDE>(), j->getBaseDir<RIGHT_SIDE>(), statusUpdater); -//------------------------------------------------------------------------------------------ + //------------------------------------------------------------------------------------------ //execute synchronization recursively - //enforce removal of invalid entries (where both sides are empty) + //enforce removal of invalid entries (where element on both sides is empty) struct RemoveInvalid { RemoveInvalid(BaseDirMapping& baseDir) : baseDir_(baseDir) {} @@ -1699,35 +1757,34 @@ void SyncProcess::startSynchronizationProcess(const std::vector<FolderPairSyncCf } dummy1(*j); - SynchronizeFolderPair syncFP( *this, + SynchronizeFolderPair syncFP(*this, #ifdef FFS_WIN - shadowCopyHandler.get(), + shadowCopyHandler.get(), #endif - currentDelHandling); + currentDelHandling); //loop through all files twice; reason: first delete files (or overwrite big ones with smaller ones), then copy rest syncFP.startSync<true>(*j); syncFP.startSync<false>(*j); - //(try to gracefully) cleanup temporary folders (Recycle bin optimization) -> will be done in DeletionHandling anyway... - currentDelHandling.tryCleanup(); + //(try to gracefully) cleanup temporary folders (Recycle bin optimization) -> will be done in ~DeletionHandling anyway... + currentDelHandling.tryCleanup(); //show error dialog if necessary -//------------------------------------------------------------------------------------------ + //------------------------------------------------------------------------------------------ //update synchronization database (automatic sync only) if (folderPairCfg.inAutomaticMode) { statusUpdater.reportInfo(wxToZ(_("Generating database..."))); statusUpdater.forceUiRefresh(); - tryReportingError(statusUpdater, boost::bind(ffs3::saveToDisk, boost::cref(*j))); //these call may throw in error-callback! + tryReportingError(statusUpdater, boost::bind(ffs3::saveToDisk, boost::cref(*j))); //may throw in error-callback! } } } catch (const std::exception& e) { statusUpdater.reportFatalError(wxString::FromUTF8(e.what())); - return; //should be obsolete! } } @@ -1819,18 +1876,18 @@ void SynchronizeFolderPair::copySymlink(const Zstring& source, const Zstring& ta switch (type) { - case LinkDescriptor::TYPE_DIR: - ffs3::createDirectory(target, source, true, copyFilePermissions_); //copy symlink - break; + case LinkDescriptor::TYPE_DIR: + ffs3::createDirectory(target, source, true, copyFilePermissions_); //copy symlink + break; - case LinkDescriptor::TYPE_FILE: //Windows: true file symlink; Linux: file-link or broken link - ffs3::copyFile(source, target, true, //copy symlink - copyFilePermissions_, + case LinkDescriptor::TYPE_FILE: //Windows: true file symlink; Linux: file-link or broken link + ffs3::copyFile(source, target, true, //copy symlink + copyFilePermissions_, #ifdef FFS_WIN - shadowCopyHandler_, + shadowCopyHandler_, #endif - NULL); - break; + NULL); + break; } } @@ -1840,13 +1897,13 @@ void SynchronizeFolderPair::deleteSymlink(const SymLinkMapping& linkObj) const { switch (linkObj.getLinkType<side>()) { - case LinkDescriptor::TYPE_DIR: - delHandling_.removeFolder<side>(linkObj); //throw (FileError) - break; + case LinkDescriptor::TYPE_DIR: + delHandling_.removeFolder<side>(linkObj); //throw (FileError) + break; - case LinkDescriptor::TYPE_FILE: //Windows: true file symlink; Linux: file-link or broken link - delHandling_.removeFile<side>(linkObj); //throw (FileError) - break; + case LinkDescriptor::TYPE_FILE: //Windows: true file symlink; Linux: file-link or broken link + delHandling_.removeFile<side>(linkObj); //throw (FileError) + break; } } diff --git a/synchronization.h b/synchronization.h index d83315f4..d44d03ba 100644 --- a/synchronization.h +++ b/synchronization.h @@ -57,7 +57,6 @@ private: size_t rowsTotal; }; -bool synchronizationNeeded(const FolderComparison& folderCmp); class SynchronizeFolderPair; diff --git a/ui/batch_config.cpp b/ui/batch_config.cpp index 9b32ee35..5630d000 100644 --- a/ui/batch_config.cpp +++ b/ui/batch_config.cpp @@ -14,7 +14,7 @@ #include "msg_popup.h" #include <wx/dnd.h> #include <wx/msgdlg.h> -#include "mouse_move_dlg.h" +#include "../shared/mouse_move_dlg.h" using namespace ffs3; @@ -37,38 +37,38 @@ public: switch (xmlAccess::getMergeType(filenames)) //throw () { - case xmlAccess::MERGE_BATCH: - case xmlAccess::MERGE_GUI: - case xmlAccess::MERGE_GUI_BATCH: - if (filenames.size() == 1) - { - batchDlg.loadBatchFile(filenames[0]); - return false; - } - else - { - xmlAccess::XmlBatchConfig batchCfg; - try + case xmlAccess::MERGE_BATCH: + case xmlAccess::MERGE_GUI: + case xmlAccess::MERGE_GUI_BATCH: + if (filenames.size() == 1) { - convertConfig(filenames, batchCfg); //throw (xmlAccess::XmlError) + batchDlg.loadBatchFile(filenames[0]); + return false; } - catch (const xmlAccess::XmlError& error) + else { - if (error.getSeverity() == xmlAccess::XmlError::WARNING) - wxMessageBox(error.msg(), _("Warning"), wxOK | wxICON_WARNING); - else + xmlAccess::XmlBatchConfig batchCfg; + try { - wxMessageBox(error.msg(), _("Error"), wxOK | wxICON_ERROR); - return false; + convertConfig(filenames, batchCfg); //throw (xmlAccess::XmlError) } + catch (const xmlAccess::XmlError& error) + { + if (error.getSeverity() == xmlAccess::XmlError::WARNING) + wxMessageBox(error.msg(), _("Warning"), wxOK | wxICON_WARNING); + else + { + wxMessageBox(error.msg(), _("Error"), wxOK | wxICON_ERROR); + return false; + } + } + batchDlg.loadBatchCfg(batchCfg); } - batchDlg.loadBatchCfg(batchCfg); - } - break; + break; - case xmlAccess::MERGE_OTHER: - wxMessageBox(_("Invalid FreeFileSync config file!"), _("Error"), wxOK | wxICON_ERROR); - break; + case xmlAccess::MERGE_OTHER: + wxMessageBox(_("Invalid FreeFileSync config file!"), _("Error"), wxOK | wxICON_ERROR); + break; } return false; @@ -114,6 +114,20 @@ private: return batchDlg.getCurrentConfiguration().mainCfg; } + virtual void OnAltSyncCfgChange() + { + batchDlg.updateGui(); + } + + virtual void OnAltSyncCfgRemoveConfirm(wxCommandEvent& event) + { + FolderPairPanelBasic<GuiPanel>::OnAltSyncCfgRemoveConfirm(event); + batchDlg.updateGui(); + } + + virtual void OnLocalFilterCfgChange() {} + + BatchDialog& batchDlg; }; @@ -221,10 +235,10 @@ void BatchDialog::init() wxWindowUpdateLocker dummy(this); //avoid display distortion - m_bpButtonCmpConfig->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("cmpConfig"))); - m_bpButtonSyncConfig->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("syncConfig"))); + m_bpButtonCmpConfig->SetBitmapLabel(GlobalResources::instance().getImage(wxT("cmpConfig"))); + m_bpButtonSyncConfig->SetBitmapLabel(GlobalResources::instance().getImage(wxT("syncConfig"))); - m_bpButtonHelp->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("help"))); + m_bpButtonHelp->SetBitmapLabel(GlobalResources::instance().getImage(wxT("help"))); //init handling of first folder pair firstFolderPair.reset(new DirectoryPairBatchFirst(*this)); @@ -236,8 +250,8 @@ void BatchDialog::init() logfileDir.reset(new DirectoryName(m_panelLogging, m_dirPickerLogfileDir, m_textCtrlLogfileDir)); //set icons for this dialog - m_bpButtonAddPair->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("addFolderPair"))); - m_bitmap27->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("batch"))); + m_bpButtonAddPair->SetBitmapLabel(GlobalResources::instance().getImage(wxT("addFolderPair"))); + m_bitmap27->SetBitmap(GlobalResources::instance().getImage(wxT("batch"))); m_buttonSave->SetFocus(); } @@ -248,15 +262,15 @@ xmlAccess::OnError BatchDialog::getSelectionHandleError() const { switch (m_choiceHandleError->GetSelection()) { - case 0: - return xmlAccess::ON_ERROR_POPUP; - case 1: - return xmlAccess::ON_ERROR_IGNORE; - case 2: - return xmlAccess::ON_ERROR_EXIT; - default: - assert(false); - return xmlAccess::ON_ERROR_POPUP; + case 0: + return xmlAccess::ON_ERROR_POPUP; + case 1: + return xmlAccess::ON_ERROR_IGNORE; + case 2: + return xmlAccess::ON_ERROR_EXIT; + default: + assert(false); + return xmlAccess::ON_ERROR_POPUP; } } @@ -265,15 +279,15 @@ void BatchDialog::updateToolTipErrorHandling(const xmlAccess::OnError value) { switch (value) { - case xmlAccess::ON_ERROR_POPUP: - m_choiceHandleError->SetToolTip(_("Show popup on errors or warnings")); - break; - case xmlAccess::ON_ERROR_IGNORE: - m_choiceHandleError->SetToolTip(_("Hide all error and warning messages")); - break; - case xmlAccess::ON_ERROR_EXIT: - m_choiceHandleError->SetToolTip(_("Abort synchronization immediately")); - break; + case xmlAccess::ON_ERROR_POPUP: + m_choiceHandleError->SetToolTip(_("Show popup on errors or warnings")); + break; + case xmlAccess::ON_ERROR_IGNORE: + m_choiceHandleError->SetToolTip(_("Hide all error and warning messages")); + break; + case xmlAccess::ON_ERROR_EXIT: + m_choiceHandleError->SetToolTip(_("Abort synchronization immediately")); + break; } } @@ -291,16 +305,16 @@ void BatchDialog::setSelectionHandleError(const xmlAccess::OnError value) switch (value) { - case xmlAccess::ON_ERROR_POPUP: - m_choiceHandleError->SetSelection(0); - break; - case xmlAccess::ON_ERROR_IGNORE: - m_choiceHandleError->SetSelection(1); - break; - case xmlAccess::ON_ERROR_EXIT: - if (m_checkBoxSilent->GetValue()) //this option shall be available for silent mode only! - m_choiceHandleError->SetSelection(2); - break; + case xmlAccess::ON_ERROR_POPUP: + m_choiceHandleError->SetSelection(0); + break; + case xmlAccess::ON_ERROR_IGNORE: + m_choiceHandleError->SetSelection(1); + break; + case xmlAccess::ON_ERROR_EXIT: + if (m_checkBoxSilent->GetValue()) //this option shall be available for silent mode only! + m_choiceHandleError->SetSelection(2); + break; } updateToolTipErrorHandling(getSelectionHandleError()); @@ -331,13 +345,13 @@ void BatchDialog::OnCmpSettings(wxCommandEvent& event) void BatchDialog::OnSyncSettings(wxCommandEvent& event) { - SyncCfgDialog* syncDlg = new SyncCfgDialog(this, - localBatchCfg.mainCfg.compareVar, - localBatchCfg.mainCfg.syncConfiguration, - localBatchCfg.mainCfg.handleDeletion, - localBatchCfg.mainCfg.customDeletionDirectory, - NULL); - if (syncDlg->ShowModal() == SyncCfgDialog::BUTTON_APPLY) + SyncCfgDialog syncDlg(this, + localBatchCfg.mainCfg.compareVar, + localBatchCfg.mainCfg.syncConfiguration, + localBatchCfg.mainCfg.handleDeletion, + localBatchCfg.mainCfg.customDeletionDirectory, + NULL); + if (syncDlg.ShowModal() == SyncCfgDialog::BUTTON_APPLY) { updateGui(); } @@ -357,21 +371,28 @@ void BatchDialog::OnConfigureFilter(wxCommandEvent& event) void BatchDialog::updateGui() //re-evaluate gui after config changes { + xmlAccess::XmlBatchConfig cfg = getCurrentConfiguration(); + + showNotebookpage(m_panelLogging, _("Logging"), cfg.silent); + + m_textCtrlLogfileDir ->Enable(cfg.logFileCountMax > 0); + m_dirPickerLogfileDir->Enable(cfg.logFileCountMax > 0); + //update compare variant name - m_staticTextCmpVariant->SetLabel(wxString(wxT("(")) + getVariantName(localBatchCfg.mainCfg.compareVar) + wxT(")")); + m_staticTextCmpVariant->SetLabel(wxString(wxT("(")) + getVariantName(cfg.mainCfg.compareVar) + wxT(")")); //update sync variant name - m_staticTextSyncVariant->SetLabel(wxString(wxT("(")) + localBatchCfg.mainCfg.getSyncVariantName() + wxT(")")); + m_staticTextSyncVariant->SetLabel(wxString(wxT("(")) + cfg.mainCfg.getSyncVariantName() + wxT(")")); //set filter icon - if (isNullFilter(localBatchCfg.mainCfg.globalFilter)) + if (isNullFilter(cfg.mainCfg.globalFilter)) { - m_bpButtonFilter->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("filterOff"))); + m_bpButtonFilter->SetBitmapLabel(GlobalResources::instance().getImage(wxT("filterOff"))); m_bpButtonFilter->SetToolTip(_("No filter selected")); } else { - m_bpButtonFilter->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("filterOn"))); + m_bpButtonFilter->SetBitmapLabel(GlobalResources::instance().getImage(wxT("filterOn"))); m_bpButtonFilter->SetToolTip(_("Filter is active")); } @@ -402,13 +423,19 @@ void BatchDialog::OnGlobalFilterRemConfirm(wxCommandEvent& event) void BatchDialog::OnCheckSilent(wxCommandEvent& event) { - updateVisibleTabs(); + updateGui(); //reset error handling depending on "m_checkBoxSilent" setSelectionHandleError(getSelectionHandleError()); } +void BatchDialog::OnChangeMaxLogCountTxt(wxCommandEvent& event) +{ + updateGui(); +} + + void BatchDialog::OnHelp(wxCommandEvent& event) { #ifdef FFS_WIN @@ -419,12 +446,6 @@ void BatchDialog::OnHelp(wxCommandEvent& event) } -void BatchDialog::updateVisibleTabs() -{ - showNotebookpage(m_panelLogging, _("Logging"), m_checkBoxSilent->GetValue()); -} - - void BatchDialog::showNotebookpage(wxWindow* page, const wxString& pageName, bool show) { int windowPosition = -1; @@ -476,17 +497,17 @@ void BatchDialog::OnSaveBatchJob(wxCommandEvent& event) defaultFileName.Replace(wxT(".ffs_gui"), wxT(".ffs_batch"), false); - wxFileDialog* filePicker = new wxFileDialog(this, wxEmptyString, wxEmptyString, defaultFileName, wxString(_("FreeFileSync batch file")) + wxT(" (*.ffs_batch)|*.ffs_batch"), wxFD_SAVE); - if (filePicker->ShowModal() == wxID_OK) + wxFileDialog filePicker(this, wxEmptyString, wxEmptyString, defaultFileName, wxString(_("FreeFileSync batch file")) + wxT(" (*.ffs_batch)|*.ffs_batch"), wxFD_SAVE); //creating this on freestore leads to memleak! + if (filePicker.ShowModal() == wxID_OK) { - const wxString newFileName = filePicker->GetPath(); + const wxString newFileName = filePicker.GetPath(); if (ffs3::fileExists(wxToZ(newFileName))) { - QuestionDlg* messageDlg = new QuestionDlg(this, - QuestionDlg::BUTTON_YES | QuestionDlg::BUTTON_CANCEL, - wxString(_("File already exists. Overwrite?")) + wxT(" \"") + newFileName + wxT("\"")); + QuestionDlg messageDlg(this, + QuestionDlg::BUTTON_YES | QuestionDlg::BUTTON_CANCEL, + wxString(_("File already exists. Overwrite?")) + wxT(" \"") + newFileName + wxT("\"")); - if (messageDlg->ShowModal() != QuestionDlg::BUTTON_YES) + if (messageDlg.ShowModal() != QuestionDlg::BUTTON_YES) { OnSaveBatchJob(event); //retry return; @@ -502,9 +523,9 @@ void BatchDialog::OnSaveBatchJob(wxCommandEvent& event) void BatchDialog::OnLoadBatchJob(wxCommandEvent& event) { - wxFileDialog* filePicker = new wxFileDialog(this, wxEmptyString, wxEmptyString, wxEmptyString, wxString(_("FreeFileSync configuration")) + wxT(" (*.ffs_batch;*.ffs_gui)|*.ffs_batch;*.ffs_gui"), wxFD_OPEN);; - if (filePicker->ShowModal() == wxID_OK) - loadBatchFile(filePicker->GetPath()); + wxFileDialog filePicker(this, wxEmptyString, wxEmptyString, wxEmptyString, wxString(_("FreeFileSync configuration")) + wxT(" (*.ffs_batch;*.ffs_gui)|*.ffs_batch;*.ffs_gui"), wxFD_OPEN); //creating this on freestore leads to memleak! + if (filePicker.ShowModal() == wxID_OK) + loadBatchFile(filePicker.GetPath()); } @@ -527,9 +548,9 @@ xmlAccess::XmlBatchConfig BatchDialog::getCurrentConfiguration() const //first folder pair batchCfg.mainCfg.firstPair = FolderPairEnh(firstFolderPair->getLeftDir(), - firstFolderPair->getRightDir(), - firstFolderPair->getAltSyncConfig(), - firstFolderPair->getAltFilterConfig()); + firstFolderPair->getRightDir(), + firstFolderPair->getAltSyncConfig(), + firstFolderPair->getAltFilterConfig()); //add additional pairs batchCfg.mainCfg.additionalPairs.clear(); @@ -540,6 +561,7 @@ xmlAccess::XmlBatchConfig BatchDialog::getCurrentConfiguration() const //load structure with batch settings "batchCfg" batchCfg.silent = m_checkBoxSilent->GetValue(); batchCfg.logFileDirectory = zToWx(logfileDir->getName()); + batchCfg.logFileCountMax = m_spinCtrlLogCountMax->GetValue(); batchCfg.handleError = getSelectionHandleError(); return batchCfg; @@ -603,11 +625,13 @@ void BatchDialog::loadBatchCfg(const xmlAccess::XmlBatchConfig& batchCfg) { wxWindowUpdateLocker dummy(this); //avoid display distortion -//make working copy + //make working copy localBatchCfg = batchCfg; - m_checkBoxSilent->SetValue(batchCfg.silent); logfileDir->setName(wxToZ(batchCfg.logFileDirectory)); + m_spinCtrlLogCountMax->SetValue(static_cast<int>(batchCfg.logFileCountMax)); + + m_checkBoxSilent->SetValue(batchCfg.silent); //error handling is dependent from m_checkBoxSilent! /|\ \|/ setSelectionHandleError(batchCfg.handleError); @@ -623,8 +647,6 @@ void BatchDialog::loadBatchCfg(const xmlAccess::XmlBatchConfig& batchCfg) //set additional pairs addFolderPair(batchCfg.mainCfg.additionalPairs); - updateVisibleTabs(); - updateGui(); //re-evaluate gui after config changes Fit(); //needed @@ -684,9 +706,6 @@ void BatchDialog::OnRemoveTopFolderPair(wxCommandEvent& event) } -const size_t MAX_FOLDER_PAIRS = 3; - - void BatchDialog::updateGuiForFolderPair() { //adapt delete top folder pair button @@ -696,10 +715,10 @@ void BatchDialog::updateGuiForFolderPair() m_bpButtonRemovePair->Show(); //adapt local filter and sync cfg for first folder pair - if ( additionalFolderPairs.size() == 0 && - firstFolderPair->getAltSyncConfig().get() == NULL && - NameFilter(firstFolderPair->getAltFilterConfig().includeFilter, - firstFolderPair->getAltFilterConfig().excludeFilter).isNull()) + if (additionalFolderPairs.size() == 0 && + firstFolderPair->getAltSyncConfig().get() == NULL && + NameFilter(firstFolderPair->getAltFilterConfig().includeFilter, + firstFolderPair->getAltFilterConfig().excludeFilter).isNull()) { m_bpButtonLocalFilter->Hide(); m_bpButtonAltSyncCfg->Hide(); @@ -710,8 +729,26 @@ void BatchDialog::updateGuiForFolderPair() m_bpButtonAltSyncCfg->Show(); } - m_scrolledWindow6->Fit(); //adjust scrolled window size + //update controls + + int pairHeight = sbSizerMainPair->GetSize().GetHeight(); //respect height of main pair + if (additionalFolderPairs.size() > 0) + pairHeight += std::min<double>(1.5, additionalFolderPairs.size()) * //have 0.5 * height indicate that more folders are there + additionalFolderPairs[0]->GetSize().GetHeight(); + + m_scrolledWindow6->SetMinSize(wxSize( -1, pairHeight)); + + + m_scrolledWindow6->Fit(); //adjust scrolled window size + m_scrolledWindow6->Layout(); //adjust scrolled window size + + //bSizerAddFolderPairs->FitInside(m_scrolledWindow6); //adjust scrolled window size + m_panelOverview->Layout(); //adjust stuff inside scrolled window + //m_panelOverview->InvalidateBestSize(); //needed for Fit() to work correctly! + + if (m_scrolledWindow6->GetSize().GetHeight() < pairHeight) + Fit(); //adapt dialog size } @@ -722,7 +759,6 @@ void BatchDialog::addFolderPair(const std::vector<ffs3::FolderPairEnh>& newPairs if (!newPairs.empty()) { //add folder pairs - int pairHeight = 0; for (std::vector<ffs3::FolderPairEnh>::const_iterator i = newPairs.begin(); i != newPairs.end(); ++i) { DirectoryPairBatch* newPair = new DirectoryPairBatch(m_scrolledWindow6, *this); @@ -738,9 +774,6 @@ void BatchDialog::addFolderPair(const std::vector<ffs3::FolderPairEnh>& newPairs additionalFolderPairs.push_back(newPair); } - //get size of scrolled window - pairHeight = newPair->GetSize().GetHeight(); - //register events newPair->m_bpButtonRemovePair->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(BatchDialog::OnRemoveFolderPair), NULL, this ); @@ -750,14 +783,6 @@ void BatchDialog::addFolderPair(const std::vector<ffs3::FolderPairEnh>& newPairs i->altSyncConfig, i->localFilter); } - //set size of scrolled window - const size_t visiblePairs = std::min(additionalFolderPairs.size() + 1, MAX_FOLDER_PAIRS); //up to MAX_FOLDER_PAIRS pairs shall be shown - m_scrolledWindow6->SetMinSize(wxSize( -1, pairHeight * static_cast<int>(visiblePairs))); - - //update controls - m_scrolledWindow6->Fit(); //adjust scrolled window size - m_panelOverview->Layout(); //adjust stuff inside scrolled window - Fit(); //adapt dialog size //after changing folder pairs window focus is lost: results in scrolled window scrolling to top each time window is shown: we don't want this m_bpButtonAddPair->SetFocus(); @@ -775,23 +800,11 @@ void BatchDialog::removeAddFolderPair(const int pos) { //remove folder pairs from window DirectoryPairBatch* pairToDelete = additionalFolderPairs[pos]; - const int pairHeight = pairToDelete->GetSize().GetHeight(); bSizerAddFolderPairs->Detach(pairToDelete); //Remove() does not work on Window*, so do it manually pairToDelete->Destroy(); // additionalFolderPairs.erase(additionalFolderPairs.begin() + pos); //remove last element in vector - //set size of scrolled window - const size_t visiblePairs = std::min(additionalFolderPairs.size() + 1, MAX_FOLDER_PAIRS); //up to MAX_FOLDER_PAIRS pairs shall be shown - m_scrolledWindow6->SetMinSize(wxSize(-1, pairHeight * static_cast<int>(visiblePairs))); - - //update controls - m_scrolledWindow6->Fit(); //adjust scrolled window size - m_panelOverview->Layout(); //adjust stuff inside scrolled window - - m_panelOverview->InvalidateBestSize(); //needed for Fit() to work correctly! - Fit(); //adapt dialog size - //after changing folder pairs window focus is lost: results in scrolled window scrolling to top each time window is shown: we don't want this m_bpButtonCmpConfig->SetFocus(); } @@ -807,7 +820,7 @@ void BatchDialog::clearAddFolderPairs() additionalFolderPairs.clear(); bSizerAddFolderPairs->Clear(true); - m_scrolledWindow6->SetMinSize(wxSize(-1, sbSizerMainPair->GetSize().GetHeight())); //respect height of main pair + updateGuiForFolderPair(); } diff --git a/ui/batch_config.h b/ui/batch_config.h index cc4e014f..88d5e4eb 100644 --- a/ui/batch_config.h +++ b/ui/batch_config.h @@ -48,6 +48,7 @@ private: void OnGlobalFilterOpenContext(wxCommandEvent& event); void OnGlobalFilterRemConfirm(wxCommandEvent& event); virtual void OnCheckSilent( wxCommandEvent& event); + virtual void OnChangeMaxLogCountTxt(wxCommandEvent& event); virtual void OnClose( wxCloseEvent& event); virtual void OnCancel( wxCommandEvent& event); virtual void OnSaveBatchJob( wxCommandEvent& event); @@ -64,7 +65,6 @@ private: void updateGui(); //re-evaluate gui after config changes - void updateVisibleTabs(); void showNotebookpage(wxWindow* page, const wxString& pageName, bool show); //error handling diff --git a/ui/batch_status_handler.cpp b/ui/batch_status_handler.cpp index ba70de39..9d57b4e3 100644 --- a/ui/batch_status_handler.cpp +++ b/ui/batch_status_handler.cpp @@ -15,16 +15,56 @@ #include "../shared/global_func.h" #include "../shared/app_main.h" #include "../shared/util.h" +#include "../shared/file_traverser.h" using namespace ffs3; +namespace +{ +class FindLogfiles : public ffs3::TraverseCallback +{ +public: + FindLogfiles(const Zstring& prefix, std::vector<Zstring>& logfiles) : prefix_(prefix), logfiles_(logfiles) {} + + virtual void onFile(const Zchar* shortName, const Zstring& fullName, const FileInfo& details) + { + const Zstring fileName(shortName); + if (fileName.StartsWith(prefix_) && fileName.EndsWith(Zstr(".log"))) + logfiles_.push_back(fullName); + } + + virtual void onSymlink(const Zchar* shortName, const Zstring& fullName, const SymlinkInfo& details) {} + + virtual ReturnValDir onDir(const Zchar* shortName, const Zstring& fullName) + { + return Loki::Int2Type<ReturnValDir::TRAVERSING_DIR_IGNORE>(); //DON'T traverse into subdirs + } + + virtual void onError(const wxString& errorText) {} //errors are not really critical in this context + +private: + const Zstring prefix_; + std::vector<Zstring>& logfiles_; +}; + +void removeFileNoThrow(const Zstring& filename) +{ + try + { + ffs3::removeFile(filename); + } + catch(...) {} +} +} + + class LogFile { public: - LogFile(const wxString& logfileDirectory, const wxString& jobName) //throw (FileError&) + LogFile(const wxString& logfileDirectory, const wxString& jobName) : jobName_(jobName) //throw (FileError&) { - const wxString logfileName = findUniqueLogname(logfileDirectory, jobName); + logfileName = findUniqueLogname(logfileDirectory, jobName); logFile.Open(logfileName, wxT("w")); if (!logFile.IsOpened()) @@ -50,8 +90,8 @@ public: void writeLog(const ErrorLogging& log) { //write actual logfile - const ErrorLogging::MessageEntry& messages = log.getFormattedMessages(); - for (ErrorLogging::MessageEntry::const_iterator i = messages.begin(); i != messages.end(); ++i) + const std::vector<wxString>& messages = log.getFormattedMessages(); + for (std::vector<wxString>::const_iterator i = messages.begin(); i != messages.end(); ++i) logFile.Write(*i + wxChar('\n')); } @@ -65,6 +105,23 @@ public: logFile.Write(wxString(_("Stop")) + wxT(" (") + _("Total time:") + wxT(" ") + (wxTimeSpan::Milliseconds(time)).Format() + wxT(")")); } + void limitLogfileCount(size_t maxCount) const + { + std::vector<Zstring> logFiles; + FindLogfiles traverseCallback(wxToZ(jobName_), logFiles); + + traverseFolder(wxToZ(logfileName).BeforeLast(common::FILE_NAME_SEPARATOR), //throw(); + false, //follow Symlinks + traverseCallback); + + if (logFiles.size() <= maxCount) + return; + + //delete oldest logfiles + std::sort(logFiles.begin(), logFiles.end()); //take advantage of logfile naming convention to sort by age + std::for_each(logFiles.begin(), logFiles.end() - maxCount, ::removeFileNoThrow); + } + private: static wxString findUniqueLogname(const wxString& logfileDirectory, const wxString& jobName) { @@ -101,6 +158,8 @@ private: return output; } + const wxString jobName_; + wxString logfileName; wxFFile logFile; wxStopWatch totalTime; }; @@ -110,6 +169,7 @@ private: BatchStatusHandler::BatchStatusHandler(bool runSilent, const wxString& jobName, const wxString* logfileDirectory, + size_t logFileMaxCount, const xmlAccess::OnError handleError, const SwitchToGui& switchBatchToGui, //functionality to change from batch mode to GUI mode int& returnVal) : @@ -121,11 +181,12 @@ BatchStatusHandler::BatchStatusHandler(bool runSilent, returnValue(returnVal), syncStatusFrame(*this, NULL, runSilent, jobName) { - if (logfileDirectory) + if (logfileDirectory && logFileMaxCount > 0) { try { logFile.reset(new LogFile(*logfileDirectory, jobName)); + logFile->limitLogfileCount(logFileMaxCount); } catch (ffs3::FileError& error) { @@ -141,21 +202,21 @@ BatchStatusHandler::BatchStatusHandler(bool runSilent, BatchStatusHandler::~BatchStatusHandler() { - const int totalErrors = errorLog.errorsTotal(); //evaluate before finalizing log + const int totalErrors = errorLog.typeCount(TYPE_ERROR | TYPE_FATAL_ERROR); //evaluate before finalizing log //finalize error log if (abortIsRequested()) { returnValue = -4; - errorLog.logError(_("Synchronization aborted!")); + errorLog.logMsg(_("Synchronization aborted!"), TYPE_ERROR); } - else if (totalErrors) + else if (totalErrors > 0) { returnValue = -5; - errorLog.logWarning(_("Synchronization completed with errors!")); + errorLog.logMsg(_("Synchronization completed with errors!"), TYPE_WARNING); } else - errorLog.logInfo(_("Synchronization completed successfully!")); + errorLog.logMsg(_("Synchronization completed successfully!"), TYPE_INFO); //print the results list: logfile @@ -170,32 +231,16 @@ BatchStatusHandler::~BatchStatusHandler() } else if (!exitWhenFinished || syncStatusFrame.getAsWindow()->IsShown()) //warning: wxWindow::Show() is called within processHasFinished()! { - //print the results list: GUI - wxString finalMessage; - if (totalErrors > 0) - { - wxString header(_("Warning: Synchronization failed for %x item(s):")); - header.Replace(wxT("%x"), ffs3::numberToStringSep(totalErrors), false); - finalMessage += header + wxT("\n\n"); - } - - const ErrorLogging::MessageEntry& messages = errorLog.getFormattedMessages(); - for (ErrorLogging::MessageEntry::const_iterator i = messages.begin(); i != messages.end(); ++i) - { - finalMessage += *i; - finalMessage += wxT("\n\n"); - } - //notify about (logical) application main window => program won't quit, but stay on this dialog ffs3::AppMainWindow::setMainWindow(syncStatusFrame.getAsWindow()); //notify to syncStatusFrame that current process has ended if (abortIsRequested()) - syncStatusFrame.processHasFinished(SyncStatus::ABORTED, finalMessage); //enable okay and close events - else if (totalErrors) - syncStatusFrame.processHasFinished(SyncStatus::FINISHED_WITH_ERROR, finalMessage); + syncStatusFrame.processHasFinished(SyncStatus::ABORTED, errorLog); //enable okay and close events + else if (totalErrors > 0) + syncStatusFrame.processHasFinished(SyncStatus::FINISHED_WITH_ERROR, errorLog); else - syncStatusFrame.processHasFinished(SyncStatus::FINISHED_WITH_SUCCESS, finalMessage); + syncStatusFrame.processHasFinished(SyncStatus::FINISHED_WITH_SUCCESS, errorLog); } else syncStatusFrame.closeWindowDirectly(); //syncStatusFrame is main window => program will quit directly @@ -205,8 +250,8 @@ BatchStatusHandler::~BatchStatusHandler() inline void BatchStatusHandler::reportInfo(const Zstring& text) { - if (currentProcess == StatusHandler::PROCESS_SYNCHRONIZING && logFile.get()) //write file transfer information to log - errorLog.logInfo(zToWx(text)); //avoid spamming with file copy info: visually identifying warning messages has priority! however when saving to a log file wee need this info + if (currentProcess == StatusHandler::PROCESS_SYNCHRONIZING) //write file transfer information to log + errorLog.logMsg(zToWx(text), TYPE_INFO); //avoid spamming with file copy info: visually identifying warning messages has priority! however when saving to a log file wee need this info syncStatusFrame.setStatusText_NoUpdate(text); } @@ -218,21 +263,21 @@ void BatchStatusHandler::initNewProcess(int objectsTotal, wxLongLong dataTotal, switch (currentProcess) { - case StatusHandler::PROCESS_SCANNING: - syncStatusFrame.resetGauge(0, 0); //initialize some gui elements (remaining time, speed) - syncStatusFrame.setCurrentStatus(SyncStatus::SCANNING); - break; - case StatusHandler::PROCESS_COMPARING_CONTENT: - syncStatusFrame.resetGauge(objectsTotal, dataTotal); - syncStatusFrame.setCurrentStatus(SyncStatus::COMPARING_CONTENT); - break; - case StatusHandler::PROCESS_SYNCHRONIZING: - syncStatusFrame.resetGauge(objectsTotal, dataTotal); - syncStatusFrame.setCurrentStatus(SyncStatus::SYNCHRONIZING); - break; - case StatusHandler::PROCESS_NONE: - assert(false); - break; + case StatusHandler::PROCESS_SCANNING: + syncStatusFrame.resetGauge(0, 0); //initialize some gui elements (remaining time, speed) + syncStatusFrame.setCurrentStatus(SyncStatus::SCANNING); + break; + case StatusHandler::PROCESS_COMPARING_CONTENT: + syncStatusFrame.resetGauge(objectsTotal, dataTotal); + syncStatusFrame.setCurrentStatus(SyncStatus::COMPARING_CONTENT); + break; + case StatusHandler::PROCESS_SYNCHRONIZING: + syncStatusFrame.resetGauge(objectsTotal, dataTotal); + syncStatusFrame.setCurrentStatus(SyncStatus::SYNCHRONIZING); + break; + case StatusHandler::PROCESS_NONE: + assert(false); + break; } } @@ -242,70 +287,64 @@ void BatchStatusHandler::updateProcessedData(int objectsProcessed, wxLongLong da { switch (currentProcess) { - case StatusHandler::PROCESS_SCANNING: - syncStatusFrame.incScannedObjects_NoUpdate(objectsProcessed); - break; - case StatusHandler::PROCESS_COMPARING_CONTENT: - case StatusHandler::PROCESS_SYNCHRONIZING: - syncStatusFrame.incProgressIndicator_NoUpdate(objectsProcessed, dataProcessed); - break; - case StatusHandler::PROCESS_NONE: - assert(false); - break; + case StatusHandler::PROCESS_SCANNING: + syncStatusFrame.incScannedObjects_NoUpdate(objectsProcessed); + break; + case StatusHandler::PROCESS_COMPARING_CONTENT: + case StatusHandler::PROCESS_SYNCHRONIZING: + syncStatusFrame.incProgressIndicator_NoUpdate(objectsProcessed, dataProcessed); + break; + case StatusHandler::PROCESS_NONE: + assert(false); + break; } } -void BatchStatusHandler::logInfo(const wxString& infoMessage) -{ - errorLog.logInfo(infoMessage); -} - - void BatchStatusHandler::reportWarning(const wxString& warningMessage, bool& warningActive) { - errorLog.logWarning(warningMessage); + errorLog.logMsg(warningMessage, TYPE_WARNING); if (!warningActive) return; switch (handleError_) { - case xmlAccess::ON_ERROR_POPUP: - { - //show popup and ask user how to handle warning - bool dontWarnAgain = false; - WarningDlg warningDlg(NULL, - WarningDlg::BUTTON_IGNORE | WarningDlg::BUTTON_SWITCH | WarningDlg::BUTTON_ABORT, - warningMessage + wxT("\n\n") + _("Press \"Switch\" to open FreeFileSync GUI mode."), - dontWarnAgain); - warningDlg.Raise(); - const WarningDlg::Response rv = static_cast<WarningDlg::Response>(warningDlg.ShowModal()); - switch (rv) + case xmlAccess::ON_ERROR_POPUP: { - case WarningDlg::BUTTON_ABORT: - abortThisProcess(); - break; + //show popup and ask user how to handle warning + bool dontWarnAgain = false; + WarningDlg warningDlg(NULL, + WarningDlg::BUTTON_IGNORE | WarningDlg::BUTTON_SWITCH | WarningDlg::BUTTON_ABORT, + warningMessage + wxT("\n\n") + _("Press \"Switch\" to open FreeFileSync GUI mode."), + dontWarnAgain); + warningDlg.Raise(); + const WarningDlg::Response rv = static_cast<WarningDlg::Response>(warningDlg.ShowModal()); + switch (rv) + { + case WarningDlg::BUTTON_ABORT: + abortThisProcess(); + break; + + case WarningDlg::BUTTON_SWITCH: + errorLog.logMsg(_("Switching to FreeFileSync GUI mode..."), TYPE_WARNING); + switchToGuiRequested = true; + abortThisProcess(); + break; + + case WarningDlg::BUTTON_IGNORE: //no unhandled error situation! + warningActive = !dontWarnAgain; + break; + } + } + break; //keep it! last switch might not find match - case WarningDlg::BUTTON_SWITCH: - errorLog.logWarning(_("Switching to FreeFileSync GUI mode...")); - switchToGuiRequested = true; + case xmlAccess::ON_ERROR_EXIT: //abort abortThisProcess(); break; - case WarningDlg::BUTTON_IGNORE: //no unhandled error situation! - warningActive = !dontWarnAgain; + case xmlAccess::ON_ERROR_IGNORE: //no unhandled error situation! break; - } - } - break; //keep it! last switch might not find match - - case xmlAccess::ON_ERROR_EXIT: //abort - abortThisProcess(); - break; - - case xmlAccess::ON_ERROR_IGNORE: //no unhandled error situation! - break; } } @@ -314,40 +353,40 @@ ErrorHandler::Response BatchStatusHandler::reportError(const wxString& errorMess { switch (handleError_) { - case xmlAccess::ON_ERROR_POPUP: - { - bool ignoreNextErrors = false; - ErrorDlg errorDlg(NULL, - ErrorDlg::BUTTON_IGNORE | ErrorDlg::BUTTON_RETRY | ErrorDlg::BUTTON_ABORT, - errorMessage, - ignoreNextErrors); - errorDlg.Raise(); - const ErrorDlg::ReturnCodes rv = static_cast<ErrorDlg::ReturnCodes>(errorDlg.ShowModal()); - switch (rv) + case xmlAccess::ON_ERROR_POPUP: { - case ErrorDlg::BUTTON_IGNORE: - if (ignoreNextErrors) //falsify only - handleError_ = xmlAccess::ON_ERROR_IGNORE; - errorLog.logError(errorMessage); - return ErrorHandler::IGNORE_ERROR; - - case ErrorDlg::BUTTON_RETRY: - return ErrorHandler::RETRY; - - case ErrorDlg::BUTTON_ABORT: - errorLog.logError(errorMessage); - abortThisProcess(); + bool ignoreNextErrors = false; + ErrorDlg errorDlg(NULL, + ErrorDlg::BUTTON_IGNORE | ErrorDlg::BUTTON_RETRY | ErrorDlg::BUTTON_ABORT, + errorMessage, + ignoreNextErrors); + errorDlg.Raise(); + const ErrorDlg::ReturnCodes rv = static_cast<ErrorDlg::ReturnCodes>(errorDlg.ShowModal()); + switch (rv) + { + case ErrorDlg::BUTTON_IGNORE: + if (ignoreNextErrors) //falsify only + handleError_ = xmlAccess::ON_ERROR_IGNORE; + errorLog.logMsg(errorMessage, TYPE_ERROR); + return ErrorHandler::IGNORE_ERROR; + + case ErrorDlg::BUTTON_RETRY: + return ErrorHandler::RETRY; + + case ErrorDlg::BUTTON_ABORT: + errorLog.logMsg(errorMessage, TYPE_ERROR); + abortThisProcess(); + } } - } - break; //used if last switch didn't find a match + break; //used if last switch didn't find a match - case xmlAccess::ON_ERROR_EXIT: //abort - errorLog.logError(errorMessage); - abortThisProcess(); + case xmlAccess::ON_ERROR_EXIT: //abort + errorLog.logMsg(errorMessage, TYPE_ERROR); + abortThisProcess(); - case xmlAccess::ON_ERROR_IGNORE: - errorLog.logError(errorMessage); - return ErrorHandler::IGNORE_ERROR; + case xmlAccess::ON_ERROR_IGNORE: + errorLog.logMsg(errorMessage, TYPE_ERROR); + return ErrorHandler::IGNORE_ERROR; } assert(false); @@ -361,8 +400,7 @@ void BatchStatusHandler::reportFatalError(const wxString& errorMessage) if (handleError_ == xmlAccess::ON_ERROR_POPUP) exitWhenFinished = false; //log fatal error and show it on status dialog - errorLog.logFatalError(errorMessage); - abortThisProcess(); + errorLog.logMsg(errorMessage, TYPE_FATAL_ERROR); } diff --git a/ui/batch_status_handler.h b/ui/batch_status_handler.h index 2d3b4cda..61d8bddc 100644 --- a/ui/batch_status_handler.h +++ b/ui/batch_status_handler.h @@ -22,7 +22,8 @@ class BatchStatusHandler : public StatusHandler public: BatchStatusHandler(bool runSilent, //defines: -start minimized and -quit immediately when finished const wxString& jobName, - const wxString* logfileDirectory, //optional: enable logging if available + const wxString* logfileDirectory, //non-empty if logging shall be active + size_t logFileMaxCount, const xmlAccess::OnError handleError, const ffs3::SwitchToGui& switchBatchToGui, //functionality to change from batch mode to GUI mode int& returnVal); @@ -33,7 +34,6 @@ public: virtual void reportInfo(const Zstring& text); virtual void forceUiRefresh(); - void logInfo(const wxString& infoMessage); virtual void reportWarning(const wxString& warningMessage, bool& warningActive); virtual ErrorHandler::Response reportError(const wxString& errorMessage); virtual void reportFatalError(const wxString& errorMessage); diff --git a/ui/check_version.cpp b/ui/check_version.cpp index 4fb74c49..fa1b84a1 100644 --- a/ui/check_version.cpp +++ b/ui/check_version.cpp @@ -131,13 +131,12 @@ void ffs3::checkForUpdatePeriodically(long& lastUpdateCheck) { if (lastUpdateCheck == 0) { - QuestionDlg* const messageDlg = new QuestionDlg(NULL, - QuestionDlg::BUTTON_YES | QuestionDlg::BUTTON_NO, - wxString(_("Do you want FreeFileSync to automatically check for updates every week?")) + wxT("\n") + - _("(Requires an Internet connection!)")); + QuestionDlg messageDlg(NULL, + QuestionDlg::BUTTON_YES | QuestionDlg::BUTTON_NO, + wxString(_("Do you want FreeFileSync to automatically check for updates every week?")) + wxT("\n") + + _("(Requires an Internet connection!)")); - const bool checkRegularly = messageDlg->ShowModal() == QuestionDlg::BUTTON_YES; - messageDlg->Destroy(); + const bool checkRegularly = messageDlg.ShowModal() == QuestionDlg::BUTTON_YES; if (checkRegularly) { lastUpdateCheck = 123; //some old date (few seconds after 1970) diff --git a/ui/folder_pair.h b/ui/folder_pair.h index 6c633fce..af614176 100644 --- a/ui/folder_pair.h +++ b/ui/folder_pair.h @@ -49,25 +49,25 @@ public: { if (altSyncConfig.get()) { - basicPanel_.m_bpButtonAltSyncCfg->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("syncConfigSmall"))); + basicPanel_.m_bpButtonAltSyncCfg->SetBitmapLabel(GlobalResources::instance().getImage(wxT("syncConfigSmall"))); basicPanel_.m_bpButtonAltSyncCfg->SetToolTip(wxString(_("Select alternate synchronization settings")) + wxT(" ") + common::LINE_BREAK + - wxT("(") + getVariantName(altSyncConfig->syncConfiguration) + wxT(")")); + wxT("(") + getVariantName(altSyncConfig->syncConfiguration) + wxT(")")); } else { - basicPanel_.m_bpButtonAltSyncCfg->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("syncConfigSmallGrey"))); + basicPanel_.m_bpButtonAltSyncCfg->SetBitmapLabel(GlobalResources::instance().getImage(wxT("syncConfigSmallGrey"))); basicPanel_.m_bpButtonAltSyncCfg->SetToolTip(_("Select alternate synchronization settings")); } //test for Null-filter if (isNullFilter(localFilter)) { - basicPanel_.m_bpButtonLocalFilter->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("filterSmallGrey"))); + basicPanel_.m_bpButtonLocalFilter->SetBitmapLabel(GlobalResources::instance().getImage(wxT("filterSmallGrey"))); basicPanel_.m_bpButtonLocalFilter->SetToolTip(_("No filter selected")); } else { - basicPanel_.m_bpButtonLocalFilter->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("filterSmall"))); + basicPanel_.m_bpButtonLocalFilter->SetBitmapLabel(GlobalResources::instance().getImage(wxT("filterSmall"))); basicPanel_.m_bpButtonLocalFilter->SetToolTip(_("Filter is active")); } } @@ -83,7 +83,7 @@ protected: basicPanel_.m_bpButtonAltSyncCfg-> Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(FolderPairPanelBasic::OnAltSyncCfg), NULL, this); basicPanel_.m_bpButtonLocalFilter->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(FolderPairPanelBasic::OnLocalFilterCfg), NULL, this); - basicPanel_.m_bpButtonRemovePair->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("removeFolderPair"))); + basicPanel_.m_bpButtonRemovePair->SetBitmapLabel(GlobalResources::instance().getImage(wxT("removeFolderPair"))); } virtual void OnLocalFilterCfgRemoveConfirm(wxCommandEvent& event) @@ -135,17 +135,17 @@ private: { const MainConfiguration mainCfg = getMainConfig(); const AlternateSyncConfig syncConfigMain(mainCfg.syncConfiguration, - mainCfg.handleDeletion, - mainCfg.customDeletionDirectory); + mainCfg.handleDeletion, + mainCfg.customDeletionDirectory); AlternateSyncConfig altSyncCfg = altSyncConfig.get() ? *altSyncConfig : syncConfigMain; - SyncCfgDialog* syncDlg = new SyncCfgDialog(getParentWindow(), - mainCfg.compareVar, - altSyncCfg.syncConfiguration, - altSyncCfg.handleDeletion, - altSyncCfg.customDeletionDirectory, - NULL); - if (syncDlg->ShowModal() == SyncCfgDialog::BUTTON_APPLY) + SyncCfgDialog syncDlg(getParentWindow(), + mainCfg.compareVar, + altSyncCfg.syncConfiguration, + altSyncCfg.handleDeletion, + altSyncCfg.customDeletionDirectory, + NULL); + if (syncDlg.ShowModal() == SyncCfgDialog::BUTTON_APPLY) { altSyncConfig.reset(new AlternateSyncConfig(altSyncCfg)); refreshButtons(); diff --git a/ui/grid_view.cpp b/ui/grid_view.cpp index 8ff8762d..93f75b95 100644 --- a/ui/grid_view.cpp +++ b/ui/grid_view.cpp @@ -72,13 +72,13 @@ void getNumbers(const FileSystemObject& fsObj, StatusResult& result) GridView::StatusCmpResult GridView::updateCmpResult(bool hideFiltered, //maps sortedRef to viewRef - bool leftOnlyFilesActive, - bool rightOnlyFilesActive, - bool leftNewerFilesActive, - bool rightNewerFilesActive, - bool differentFilesActive, - bool equalFilesActive, - bool conflictFilesActive) + bool leftOnlyFilesActive, + bool rightOnlyFilesActive, + bool leftNewerFilesActive, + bool rightNewerFilesActive, + bool differentFilesActive, + bool equalFilesActive, + bool conflictFilesActive) { StatusCmpResult output; @@ -95,35 +95,35 @@ GridView::StatusCmpResult GridView::updateCmpResult(bool hideFiltered, //maps so switch (fsObj->getCategory()) { - case FILE_LEFT_SIDE_ONLY: - output.existsLeftOnly = true; - if (!leftOnlyFilesActive) continue; - break; - case FILE_RIGHT_SIDE_ONLY: - output.existsRightOnly = true; - if (!rightOnlyFilesActive) continue; - break; - case FILE_LEFT_NEWER: - output.existsLeftNewer = true; - if (!leftNewerFilesActive) continue; - break; - case FILE_RIGHT_NEWER: - output.existsRightNewer = true; - if (!rightNewerFilesActive) continue; - break; - case FILE_DIFFERENT: - output.existsDifferent = true; - if (!differentFilesActive) continue; - break; - case FILE_EQUAL: - output.existsEqual = true; - if (!equalFilesActive) continue; - break; - case FILE_CONFLICT: - case FILE_DIFFERENT_METADATA: //no extra button on screen - output.existsConflict = true; - if (!conflictFilesActive) continue; - break; + case FILE_LEFT_SIDE_ONLY: + output.existsLeftOnly = true; + if (!leftOnlyFilesActive) continue; + break; + case FILE_RIGHT_SIDE_ONLY: + output.existsRightOnly = true; + if (!rightOnlyFilesActive) continue; + break; + case FILE_LEFT_NEWER: + output.existsLeftNewer = true; + if (!leftNewerFilesActive) continue; + break; + case FILE_RIGHT_NEWER: + output.existsRightNewer = true; + if (!rightNewerFilesActive) continue; + break; + case FILE_DIFFERENT: + output.existsDifferent = true; + if (!differentFilesActive) continue; + break; + case FILE_EQUAL: + output.existsEqual = true; + if (!equalFilesActive) continue; + break; + case FILE_CONFLICT: + case FILE_DIFFERENT_METADATA: //no extra button on screen + output.existsConflict = true; + if (!conflictFilesActive) continue; + break; } //calculate total number of bytes for each side @@ -155,15 +155,15 @@ GridView::StatusSyncPreview::StatusSyncPreview() : GridView::StatusSyncPreview GridView::updateSyncPreview(bool hideFiltered, //maps sortedRef to viewRef - bool syncCreateLeftActive, - bool syncCreateRightActive, - bool syncDeleteLeftActive, - bool syncDeleteRightActive, - bool syncDirOverwLeftActive, - bool syncDirOverwRightActive, - bool syncDirNoneActive, - bool syncEqualActive, - bool conflictFilesActive) + bool syncCreateLeftActive, + bool syncCreateRightActive, + bool syncDeleteLeftActive, + bool syncDeleteRightActive, + bool syncDirOverwLeftActive, + bool syncDirOverwRightActive, + bool syncDirNoneActive, + bool syncEqualActive, + bool conflictFilesActive) { StatusSyncPreview output; @@ -180,44 +180,44 @@ GridView::StatusSyncPreview GridView::updateSyncPreview(bool hideFiltered, //map switch (fsObj->getSyncOperation()) //evaluate comparison result and sync direction { - case SO_CREATE_NEW_LEFT: - output.existsSyncCreateLeft = true; - if (!syncCreateLeftActive) continue; - break; - case SO_CREATE_NEW_RIGHT: - output.existsSyncCreateRight = true; - if (!syncCreateRightActive) continue; - break; - case SO_DELETE_LEFT: - output.existsSyncDeleteLeft = true; - if (!syncDeleteLeftActive) continue; - break; - case SO_DELETE_RIGHT: - output.existsSyncDeleteRight = true; - if (!syncDeleteRightActive) continue; - break; - case SO_OVERWRITE_RIGHT: - case SO_COPY_METADATA_TO_RIGHT: //no extra button on screen - output.existsSyncDirRight = true; - if (!syncDirOverwRightActive) continue; - break; - case SO_OVERWRITE_LEFT: - case SO_COPY_METADATA_TO_LEFT: //no extra button on screen - output.existsSyncDirLeft = true; - if (!syncDirOverwLeftActive) continue; - break; - case SO_DO_NOTHING: - output.existsSyncDirNone = true; - if (!syncDirNoneActive) continue; - break; - case SO_EQUAL: - output.existsSyncEqual = true; - if (!syncEqualActive) continue; - break; - case SO_UNRESOLVED_CONFLICT: - output.existsConflict = true; - if (!conflictFilesActive) continue; - break; + case SO_CREATE_NEW_LEFT: + output.existsSyncCreateLeft = true; + if (!syncCreateLeftActive) continue; + break; + case SO_CREATE_NEW_RIGHT: + output.existsSyncCreateRight = true; + if (!syncCreateRightActive) continue; + break; + case SO_DELETE_LEFT: + output.existsSyncDeleteLeft = true; + if (!syncDeleteLeftActive) continue; + break; + case SO_DELETE_RIGHT: + output.existsSyncDeleteRight = true; + if (!syncDeleteRightActive) continue; + break; + case SO_OVERWRITE_RIGHT: + case SO_COPY_METADATA_TO_RIGHT: //no extra button on screen + output.existsSyncDirRight = true; + if (!syncDirOverwRightActive) continue; + break; + case SO_OVERWRITE_LEFT: + case SO_COPY_METADATA_TO_LEFT: //no extra button on screen + output.existsSyncDirLeft = true; + if (!syncDirOverwLeftActive) continue; + break; + case SO_DO_NOTHING: + output.existsSyncDirNone = true; + if (!syncDirNoneActive) continue; + break; + case SO_EQUAL: + output.existsSyncEqual = true; + if (!syncEqualActive) continue; + break; + case SO_UNRESOLVED_CONFLICT: + output.existsConflict = true; + if (!conflictFilesActive) continue; + break; } //calculate total number of bytes for each side @@ -502,17 +502,17 @@ bool GridView::getDefaultDirection(SortType type) //true: ascending; false: desc { switch (type) { - case SORT_BY_FILESIZE: - case SORT_BY_DATE: - return false; - - case SORT_BY_REL_NAME: - case SORT_BY_FILENAME: - case SORT_BY_EXTENSION: - case SORT_BY_CMP_RESULT: - case SORT_BY_DIRECTORY: - case SORT_BY_SYNC_DIRECTION: - return true; + case SORT_BY_FILESIZE: + case SORT_BY_DATE: + return false; + + case SORT_BY_REL_NAME: + case SORT_BY_FILENAME: + case SORT_BY_EXTENSION: + case SORT_BY_CMP_RESULT: + case SORT_BY_DIRECTORY: + case SORT_BY_SYNC_DIRECTION: + return true; } assert(false); return true; @@ -525,48 +525,48 @@ void GridView::sortView(SortType type, bool onLeft, bool ascending) switch (type) { - case SORT_BY_REL_NAME: - if ( ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByRelName<true, LEFT_SIDE>(*this)); - else if ( ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByRelName<true, RIGHT_SIDE>(*this)); - else if (!ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByRelName<false, LEFT_SIDE >(*this)); - else if (!ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByRelName<false, RIGHT_SIDE>(*this)); - break; - case SORT_BY_FILENAME: - if ( ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByFileName<true, LEFT_SIDE >(*this)); - else if ( ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByFileName<true, RIGHT_SIDE>(*this)); - else if (!ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByFileName<false, LEFT_SIDE >(*this)); - else if (!ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByFileName<false, RIGHT_SIDE>(*this)); - break; - case SORT_BY_FILESIZE: - if ( ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByFileSize<true, LEFT_SIDE >(*this)); - else if ( ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByFileSize<true, RIGHT_SIDE>(*this)); - else if (!ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByFileSize<false, LEFT_SIDE >(*this)); - else if (!ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByFileSize<false, RIGHT_SIDE>(*this)); - break; - case SORT_BY_DATE: - if ( ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByDate<true, LEFT_SIDE >(*this)); - else if ( ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByDate<true, RIGHT_SIDE>(*this)); - else if (!ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByDate<false, LEFT_SIDE >(*this)); - else if (!ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByDate<false, RIGHT_SIDE>(*this)); - break; - case SORT_BY_EXTENSION: - if ( ascending && onLeft) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortByExtension<true, LEFT_SIDE >(*this)); - else if ( ascending && !onLeft) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortByExtension<true, RIGHT_SIDE>(*this)); - else if (!ascending && onLeft) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortByExtension<false, LEFT_SIDE >(*this)); - else if (!ascending && !onLeft) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortByExtension<false, RIGHT_SIDE>(*this)); - break; - case SORT_BY_CMP_RESULT: - if ( ascending) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortByCmpResult<true >(*this)); - else if (!ascending) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortByCmpResult<false>(*this)); - break; - case SORT_BY_SYNC_DIRECTION: - if ( ascending) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortBySyncDirection<true >(*this)); - else if (!ascending) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortBySyncDirection<false>(*this)); - break; - case SORT_BY_DIRECTORY: - if ( ascending) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortByDirectory<true>()); - else if (!ascending) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortByDirectory<false>()); - break; + case SORT_BY_REL_NAME: + if ( ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByRelName<true, LEFT_SIDE>(*this)); + else if ( ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByRelName<true, RIGHT_SIDE>(*this)); + else if (!ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByRelName<false, LEFT_SIDE >(*this)); + else if (!ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByRelName<false, RIGHT_SIDE>(*this)); + break; + case SORT_BY_FILENAME: + if ( ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByFileName<true, LEFT_SIDE >(*this)); + else if ( ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByFileName<true, RIGHT_SIDE>(*this)); + else if (!ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByFileName<false, LEFT_SIDE >(*this)); + else if (!ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByFileName<false, RIGHT_SIDE>(*this)); + break; + case SORT_BY_FILESIZE: + if ( ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByFileSize<true, LEFT_SIDE >(*this)); + else if ( ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByFileSize<true, RIGHT_SIDE>(*this)); + else if (!ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByFileSize<false, LEFT_SIDE >(*this)); + else if (!ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByFileSize<false, RIGHT_SIDE>(*this)); + break; + case SORT_BY_DATE: + if ( ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByDate<true, LEFT_SIDE >(*this)); + else if ( ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByDate<true, RIGHT_SIDE>(*this)); + else if (!ascending && onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByDate<false, LEFT_SIDE >(*this)); + else if (!ascending && !onLeft) std::sort(sortedRef.begin(), sortedRef.end(), SortByDate<false, RIGHT_SIDE>(*this)); + break; + case SORT_BY_EXTENSION: + if ( ascending && onLeft) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortByExtension<true, LEFT_SIDE >(*this)); + else if ( ascending && !onLeft) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortByExtension<true, RIGHT_SIDE>(*this)); + else if (!ascending && onLeft) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortByExtension<false, LEFT_SIDE >(*this)); + else if (!ascending && !onLeft) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortByExtension<false, RIGHT_SIDE>(*this)); + break; + case SORT_BY_CMP_RESULT: + if ( ascending) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortByCmpResult<true >(*this)); + else if (!ascending) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortByCmpResult<false>(*this)); + break; + case SORT_BY_SYNC_DIRECTION: + if ( ascending) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortBySyncDirection<true >(*this)); + else if (!ascending) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortBySyncDirection<false>(*this)); + break; + case SORT_BY_DIRECTORY: + if ( ascending) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortByDirectory<true>()); + else if (!ascending) std::stable_sort(sortedRef.begin(), sortedRef.end(), SortByDirectory<false>()); + break; } } diff --git a/ui/gui_generated.cpp b/ui/gui_generated.cpp index 27e6ddd2..bfedac26 100644 --- a/ui/gui_generated.cpp +++ b/ui/gui_generated.cpp @@ -16,864 +16,864 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxSize( 640,400 ), wxDefaultSize ); - - m_menubar1 = new wxMenuBar( 0 ); - m_menuFile = new wxMenu(); - m_menuItem10 = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("1. &Compare") ) + wxT('\t') + wxT("ALT-C"), wxEmptyString, wxITEM_NORMAL ); - m_menuFile->Append( m_menuItem10 ); - - m_menuItem11 = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("2. &Synchronize...") ) + wxT('\t') + wxT("ALT-S"), wxEmptyString, wxITEM_NORMAL ); - m_menuFile->Append( m_menuItem11 ); - - wxMenuItem* m_separator1; - m_separator1 = m_menuFile->AppendSeparator(); - - m_menuItemSwitchView = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("S&witch view") ) + wxT('\t') + wxT("ALT-W"), wxEmptyString, wxITEM_NORMAL ); - m_menuFile->Append( m_menuItemSwitchView ); - - wxMenuItem* m_separator2; - m_separator2 = m_menuFile->AppendSeparator(); - - m_menuItemNew = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("&New") ) + wxT('\t') + wxT("CTRL-N"), wxEmptyString, wxITEM_NORMAL ); - m_menuFile->Append( m_menuItemNew ); - - m_menuItemSave = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("S&ave configuration...") ) + wxT('\t') + wxT("CTRL-S"), wxEmptyString, wxITEM_NORMAL ); - m_menuFile->Append( m_menuItemSave ); - - m_menuItemLoad = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("&Load configuration...") ) + wxT('\t') + wxT("CTRL-L"), wxEmptyString, wxITEM_NORMAL ); - m_menuFile->Append( m_menuItemLoad ); - - wxMenuItem* m_separator3; - m_separator3 = m_menuFile->AppendSeparator(); - - wxMenuItem* m_menuItem4; - m_menuItem4 = new wxMenuItem( m_menuFile, wxID_EXIT, wxString( _("&Quit") ) + wxT('\t') + wxT("CTRL-Q"), wxEmptyString, wxITEM_NORMAL ); - m_menuFile->Append( m_menuItem4 ); - - m_menubar1->Append( m_menuFile, _("&Program") ); - - m_menuAdvanced = new wxMenu(); - m_menuLanguages = new wxMenu(); - m_menuAdvanced->Append( -1, _("&Language"), m_menuLanguages ); - - wxMenuItem* m_separator4; - m_separator4 = m_menuAdvanced->AppendSeparator(); - - m_menuItemGlobSett = new wxMenuItem( m_menuAdvanced, wxID_ANY, wxString( _("&Global settings...") ) , wxEmptyString, wxITEM_NORMAL ); - m_menuAdvanced->Append( m_menuItemGlobSett ); - - m_menuItem7 = new wxMenuItem( m_menuAdvanced, wxID_ANY, wxString( _("&Create batch job...") ) , wxEmptyString, wxITEM_NORMAL ); - m_menuAdvanced->Append( m_menuItem7 ); - - wxMenuItem* m_menuItem5; - m_menuItem5 = new wxMenuItem( m_menuAdvanced, wxID_ANY, wxString( _("&Export file list...") ) , wxEmptyString, wxITEM_NORMAL ); - m_menuAdvanced->Append( m_menuItem5 ); - - m_menubar1->Append( m_menuAdvanced, _("&Advanced") ); - - m_menuHelp = new wxMenu(); - wxMenuItem* m_menuItemReadme; - m_menuItemReadme = new wxMenuItem( m_menuHelp, wxID_ANY, wxString( _("&Content") ) + wxT('\t') + wxT("F1"), wxEmptyString, wxITEM_NORMAL ); - m_menuHelp->Append( m_menuItemReadme ); - - m_menuItemCheckVer = new wxMenuItem( m_menuHelp, wxID_ANY, wxString( _("&Check for new version") ) , wxEmptyString, wxITEM_NORMAL ); - m_menuHelp->Append( m_menuItemCheckVer ); - - wxMenuItem* m_separator5; - m_separator5 = m_menuHelp->AppendSeparator(); - - m_menuItemAbout = new wxMenuItem( m_menuHelp, wxID_ABOUT, wxString( _("&About...") ) + wxT('\t') + wxT("SHIFT-F1"), wxEmptyString, wxITEM_NORMAL ); - m_menuHelp->Append( m_menuItemAbout ); - - m_menubar1->Append( m_menuHelp, _("&Help") ); - - this->SetMenuBar( m_menubar1 ); - - bSizerPanelHolder = new wxBoxSizer( wxVERTICAL ); - - m_panelTopButtons = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER|wxTAB_TRAVERSAL ); - bSizerTopButtons = new wxBoxSizer( wxHORIZONTAL ); - - - bSizerTopButtons->Add( 15, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - wxFlexGridSizer* fgSizer121; - fgSizer121 = new wxFlexGridSizer( 2, 2, 0, 0 ); - fgSizer121->SetFlexibleDirection( wxBOTH ); - fgSizer121->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - m_staticTextCmpVariant = new wxStaticText( m_panelTopButtons, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextCmpVariant->Wrap( -1 ); - m_staticTextCmpVariant->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); - m_staticTextCmpVariant->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) ); - - fgSizer121->Add( m_staticTextCmpVariant, 1, wxALIGN_CENTER_HORIZONTAL, 5 ); - - - fgSizer121->Add( 0, 0, 1, 0, 5 ); - - wxBoxSizer* bSizer30; - bSizer30 = new wxBoxSizer( wxHORIZONTAL ); - - m_buttonCompare = new wxButtonWithImage( m_panelTopButtons, wxID_OK, _("Compare"), wxDefaultPosition, wxSize( 180,42 ), 0 ); - m_buttonCompare->SetDefault(); - m_buttonCompare->SetFont( wxFont( 14, 74, 90, 92, false, wxT("Arial Black") ) ); - m_buttonCompare->SetToolTip( _("Compare both sides") ); - - bSizer30->Add( m_buttonCompare, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_buttonAbort = new wxButton( m_panelTopButtons, wxID_CANCEL, _("&Abort"), wxDefaultPosition, wxSize( 180,42 ), 0 ); - m_buttonAbort->SetFont( wxFont( 14, 74, 90, 92, false, wxT("Arial Black") ) ); - m_buttonAbort->Enable( false ); - m_buttonAbort->Hide(); - - bSizer30->Add( m_buttonAbort, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - fgSizer121->Add( bSizer30, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bpButtonCmpConfig = new wxBitmapButton( m_panelTopButtons, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,42 ), wxBU_AUTODRAW ); - m_bpButtonCmpConfig->SetToolTip( _("Comparison settings") ); - - m_bpButtonCmpConfig->SetToolTip( _("Comparison settings") ); - - fgSizer121->Add( m_bpButtonCmpConfig, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 ); - - bSizerTopButtons->Add( fgSizer121, 0, wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizerTopButtons->Add( 0, 0, 1, 0, 5 ); - - wxFlexGridSizer* fgSizer12; - fgSizer12 = new wxFlexGridSizer( 2, 2, 0, 0 ); - fgSizer12->SetFlexibleDirection( wxBOTH ); - fgSizer12->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - - fgSizer12->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_staticTextSyncVariant = new wxStaticText( m_panelTopButtons, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextSyncVariant->Wrap( -1 ); - m_staticTextSyncVariant->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); - m_staticTextSyncVariant->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) ); - - fgSizer12->Add( m_staticTextSyncVariant, 1, wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_bpButtonSyncConfig = new wxBitmapButton( m_panelTopButtons, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,42 ), wxBU_AUTODRAW ); - m_bpButtonSyncConfig->SetToolTip( _("Synchronization settings") ); - - m_bpButtonSyncConfig->SetToolTip( _("Synchronization settings") ); - - fgSizer12->Add( m_bpButtonSyncConfig, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 ); - - m_buttonStartSync = new wxButtonWithImage( m_panelTopButtons, wxID_ANY, _("Synchronize..."), wxDefaultPosition, wxSize( -1,42 ), 0 ); - m_buttonStartSync->SetFont( wxFont( 14, 74, 90, 92, false, wxT("Arial Black") ) ); - m_buttonStartSync->SetToolTip( _("Start synchronization") ); - - fgSizer12->Add( m_buttonStartSync, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizerTopButtons->Add( fgSizer12, 0, wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizerTopButtons->Add( 15, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_panelTopButtons->SetSizer( bSizerTopButtons ); - m_panelTopButtons->Layout(); - bSizerTopButtons->Fit( m_panelTopButtons ); - bSizerPanelHolder->Add( m_panelTopButtons, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - m_panelDirectoryPairs = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer1601; - bSizer1601 = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizer91; - bSizer91 = new wxBoxSizer( wxHORIZONTAL ); - - m_panelTopLeft = new wxPanel( m_panelDirectoryPairs, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_panelTopLeft->SetMinSize( wxSize( 1,1 ) ); - - sbSizerDirLeft = new wxStaticBoxSizer( new wxStaticBox( m_panelTopLeft, wxID_ANY, _("Drag && drop") ), wxHORIZONTAL ); - - m_directoryLeft = new CustomComboBox( m_panelTopLeft, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - sbSizerDirLeft->Add( m_directoryLeft, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_dirPickerLeft = new wxDirPickerCtrl( m_panelTopLeft, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); - m_dirPickerLeft->SetToolTip( _("Select a folder") ); - - sbSizerDirLeft->Add( m_dirPickerLeft, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_panelTopLeft->SetSizer( sbSizerDirLeft ); - m_panelTopLeft->Layout(); - sbSizerDirLeft->Fit( m_panelTopLeft ); - bSizer91->Add( m_panelTopLeft, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - - m_panelTopMiddle = new wxPanel( m_panelDirectoryPairs, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer93; - bSizer93 = new wxBoxSizer( wxVERTICAL ); - - - bSizer93->Add( 0, 3, 0, 0, 5 ); - - m_bpButtonSwapSides = new wxBitmapButton( m_panelTopMiddle, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW ); - m_bpButtonSwapSides->SetToolTip( _("Swap sides") ); - - m_bpButtonSwapSides->SetToolTip( _("Swap sides") ); - - bSizer93->Add( m_bpButtonSwapSides, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - wxBoxSizer* bSizer160; - bSizer160 = new wxBoxSizer( wxHORIZONTAL ); - - - bSizer160->Add( 0, 0, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - - m_bpButtonLocalFilter = new wxBitmapButton( m_panelTopMiddle, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); - bSizer160->Add( m_bpButtonLocalFilter, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer160->Add( 5, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bpButtonAltSyncCfg = new wxBitmapButton( m_panelTopMiddle, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); - bSizer160->Add( m_bpButtonAltSyncCfg, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer160->Add( 0, 0, 1, wxEXPAND, 5 ); - - bSizer93->Add( bSizer160, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_panelTopMiddle->SetSizer( bSizer93 ); - m_panelTopMiddle->Layout(); - bSizer93->Fit( m_panelTopMiddle ); - bSizer91->Add( m_panelTopMiddle, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - m_panelTopRight = new wxPanel( m_panelDirectoryPairs, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_panelTopRight->SetMinSize( wxSize( 1,1 ) ); - - sbSizerDirRight = new wxStaticBoxSizer( new wxStaticBox( m_panelTopRight, wxID_ANY, _("Drag && drop") ), wxHORIZONTAL ); - - m_bpButtonAddPair = new wxBitmapButton( m_panelTopRight, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); - m_bpButtonAddPair->SetToolTip( _("Add folder pair") ); - - m_bpButtonAddPair->SetToolTip( _("Add folder pair") ); - - sbSizerDirRight->Add( m_bpButtonAddPair, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 3 ); - - m_bpButtonRemovePair = new wxBitmapButton( m_panelTopRight, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); - m_bpButtonRemovePair->SetToolTip( _("Remove folder pair") ); - - m_bpButtonRemovePair->SetToolTip( _("Remove folder pair") ); - - sbSizerDirRight->Add( m_bpButtonRemovePair, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_directoryRight = new CustomComboBox( m_panelTopRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - sbSizerDirRight->Add( m_directoryRight, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_dirPickerRight = new wxDirPickerCtrl( m_panelTopRight, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); - m_dirPickerRight->SetToolTip( _("Select a folder") ); - - sbSizerDirRight->Add( m_dirPickerRight, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_panelTopRight->SetSizer( sbSizerDirRight ); - m_panelTopRight->Layout(); - sbSizerDirRight->Fit( m_panelTopRight ); - bSizer91->Add( m_panelTopRight, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - bSizer1601->Add( bSizer91, 0, wxEXPAND, 5 ); - - m_scrolledWindowFolderPairs = new wxScrolledWindow( m_panelDirectoryPairs, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxHSCROLL|wxVSCROLL ); - m_scrolledWindowFolderPairs->SetScrollRate( 5, 5 ); - m_scrolledWindowFolderPairs->SetMinSize( wxSize( -1,0 ) ); - - bSizerAddFolderPairs = new wxBoxSizer( wxVERTICAL ); - - m_scrolledWindowFolderPairs->SetSizer( bSizerAddFolderPairs ); - m_scrolledWindowFolderPairs->Layout(); - bSizerAddFolderPairs->Fit( m_scrolledWindowFolderPairs ); - bSizer1601->Add( m_scrolledWindowFolderPairs, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - m_panelDirectoryPairs->SetSizer( bSizer1601 ); - m_panelDirectoryPairs->Layout(); - bSizer1601->Fit( m_panelDirectoryPairs ); - bSizerPanelHolder->Add( m_panelDirectoryPairs, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - m_panelGrids = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_panelGrids->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_APPWORKSPACE ) ); - - bSizerGridHolder = new wxBoxSizer( wxHORIZONTAL ); - - m_panelLeft = new wxPanel( m_panelGrids, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer7; - bSizer7 = new wxBoxSizer( wxVERTICAL ); - - m_gridLeft = new CustomGridLeft( m_panelLeft, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); - - // Grid - m_gridLeft->CreateGrid( 15, 4 ); - m_gridLeft->EnableEditing( false ); - m_gridLeft->EnableGridLines( true ); - m_gridLeft->EnableDragGridSize( true ); - m_gridLeft->SetMargins( 0, 0 ); - - // Columns - m_gridLeft->EnableDragColMove( false ); - m_gridLeft->EnableDragColSize( true ); - m_gridLeft->SetColLabelSize( 20 ); - m_gridLeft->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE ); - - // Rows - m_gridLeft->EnableDragRowSize( false ); - m_gridLeft->SetRowLabelSize( 38 ); - m_gridLeft->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - - // Label Appearance - - // Cell Defaults - m_gridLeft->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_CENTRE ); - m_gridLeft->SetMinSize( wxSize( 1,1 ) ); - - bSizer7->Add( m_gridLeft, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 5 ); - - m_panelLeft->SetSizer( bSizer7 ); - m_panelLeft->Layout(); - bSizer7->Fit( m_panelLeft ); - bSizerGridHolder->Add( m_panelLeft, 1, wxEXPAND, 5 ); - - m_panelMiddle = new wxPanel( m_panelGrids, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer18; - bSizer18 = new wxBoxSizer( wxVERTICAL ); - - m_gridMiddle = new CustomGridMiddle( m_panelMiddle, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); - - // Grid - m_gridMiddle->CreateGrid( 15, 1 ); - m_gridMiddle->EnableEditing( false ); - m_gridMiddle->EnableGridLines( true ); - m_gridMiddle->EnableDragGridSize( false ); - m_gridMiddle->SetMargins( 0, 0 ); - - // Columns - m_gridMiddle->SetColSize( 0, 60 ); - m_gridMiddle->EnableDragColMove( false ); - m_gridMiddle->EnableDragColSize( false ); - m_gridMiddle->SetColLabelSize( 20 ); - m_gridMiddle->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - - // Rows - m_gridMiddle->EnableDragRowSize( false ); - m_gridMiddle->SetRowLabelSize( 0 ); - m_gridMiddle->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - - // Label Appearance - - // Cell Defaults - m_gridMiddle->SetDefaultCellFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxT("Arial") ) ); - m_gridMiddle->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - bSizer18->Add( m_gridMiddle, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - m_panelMiddle->SetSizer( bSizer18 ); - m_panelMiddle->Layout(); - bSizer18->Fit( m_panelMiddle ); - bSizerGridHolder->Add( m_panelMiddle, 0, wxEXPAND, 5 ); - - m_panelRight = new wxPanel( m_panelGrids, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer10; - bSizer10 = new wxBoxSizer( wxVERTICAL ); - - m_gridRight = new CustomGridRight( m_panelRight, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); - - // Grid - m_gridRight->CreateGrid( 15, 4 ); - m_gridRight->EnableEditing( false ); - m_gridRight->EnableGridLines( true ); - m_gridRight->EnableDragGridSize( true ); - m_gridRight->SetMargins( 0, 0 ); - - // Columns - m_gridRight->EnableDragColMove( false ); - m_gridRight->EnableDragColSize( true ); - m_gridRight->SetColLabelSize( 20 ); - m_gridRight->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE ); - - // Rows - m_gridRight->EnableDragRowSize( false ); - m_gridRight->SetRowLabelSize( 38 ); - m_gridRight->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - - // Label Appearance - - // Cell Defaults - m_gridRight->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_CENTRE ); - m_gridRight->SetMinSize( wxSize( 1,1 ) ); - - bSizer10->Add( m_gridRight, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT, 5 ); - - m_panelRight->SetSizer( bSizer10 ); - m_panelRight->Layout(); - bSizer10->Fit( m_panelRight ); - bSizerGridHolder->Add( m_panelRight, 1, wxEXPAND, 5 ); - - m_panelGrids->SetSizer( bSizerGridHolder ); - m_panelGrids->Layout(); - bSizerGridHolder->Fit( m_panelGrids ); - bSizerPanelHolder->Add( m_panelGrids, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - m_panelConfig = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - bSizerConfig = new wxBoxSizer( wxHORIZONTAL ); - - - bSizerConfig->Add( 10, 0, 0, 0, 5 ); - - wxBoxSizer* bSizer151; - bSizer151 = new wxBoxSizer( wxHORIZONTAL ); - - m_bpButtonSave = new wxBitmapButton( m_panelConfig, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - m_bpButtonSave->SetToolTip( _("Save current configuration to file") ); - - m_bpButtonSave->SetToolTip( _("Save current configuration to file") ); - - bSizer151->Add( m_bpButtonSave, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bpButtonLoad = new wxBitmapButton( m_panelConfig, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - m_bpButtonLoad->SetToolTip( _("Load configuration from file") ); - - m_bpButtonLoad->SetToolTip( _("Load configuration from file") ); - - bSizer151->Add( m_bpButtonLoad, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizerConfig->Add( bSizer151, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_listBoxHistory = new wxListBox( m_panelConfig, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_NEEDED_SB|wxLB_SINGLE|wxLB_SORT ); - m_listBoxHistory->SetToolTip( _("Load configuration history (press DEL to delete items)") ); - m_listBoxHistory->SetMinSize( wxSize( -1,40 ) ); - - bSizerConfig->Add( m_listBoxHistory, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - - m_panelConfig->SetSizer( bSizerConfig ); - m_panelConfig->Layout(); - bSizerConfig->Fit( m_panelConfig ); - bSizerPanelHolder->Add( m_panelConfig, 0, 0, 5 ); - - m_panelFilter = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer140; - bSizer140 = new wxBoxSizer( wxHORIZONTAL ); - - - bSizer140->Add( 10, 0, 0, 0, 5 ); - - m_bpButtonFilter = new wxBitmapButton( m_panelFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW|wxFULL_REPAINT_ON_RESIZE ); - bSizer140->Add( m_bpButtonFilter, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - wxBoxSizer* bSizer23; - bSizer23 = new wxBoxSizer( wxVERTICAL ); - - m_checkBoxHideFilt = new wxCheckBox( m_panelFilter, wxID_ANY, _("Hide excluded items"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkBoxHideFilt->SetToolTip( _("Hide filtered or temporarily excluded files") ); - - bSizer23->Add( m_checkBoxHideFilt, 0, wxEXPAND, 5 ); - - bSizer140->Add( bSizer23, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_panelFilter->SetSizer( bSizer140 ); - m_panelFilter->Layout(); - bSizer140->Fit( m_panelFilter ); - bSizerPanelHolder->Add( m_panelFilter, 0, 0, 5 ); - - m_panelStatistics = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - bSizerStatistics = new wxBoxSizer( wxHORIZONTAL ); - - - bSizerStatistics->Add( 0, 0, 1, wxEXPAND, 5 ); - - wxFlexGridSizer* fgSizer5; - fgSizer5 = new wxFlexGridSizer( 2, 2, 0, 5 ); - fgSizer5->SetFlexibleDirection( wxHORIZONTAL ); - fgSizer5->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - m_bitmapCreate = new wxStaticBitmap( m_panelStatistics, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - m_bitmapCreate->SetToolTip( _("Number of files and directories that will be created") ); - - fgSizer5->Add( m_bitmapCreate, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_textCtrlCreate = new wxTextCtrl( m_panelStatistics, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), wxTE_READONLY ); - m_textCtrlCreate->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) ); - m_textCtrlCreate->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - m_textCtrlCreate->SetToolTip( _("Number of files and directories that will be created") ); - - fgSizer5->Add( m_textCtrlCreate, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bitmapDelete = new wxStaticBitmap( m_panelStatistics, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - m_bitmapDelete->SetToolTip( _("Number of files and directories that will be deleted") ); - - fgSizer5->Add( m_bitmapDelete, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_textCtrlDelete = new wxTextCtrl( m_panelStatistics, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), wxTE_READONLY ); - m_textCtrlDelete->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) ); - m_textCtrlDelete->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - m_textCtrlDelete->SetToolTip( _("Number of files and directories that will be deleted") ); - - fgSizer5->Add( m_textCtrlDelete, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizerStatistics->Add( fgSizer5, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); - - wxFlexGridSizer* fgSizer6; - fgSizer6 = new wxFlexGridSizer( 2, 2, 0, 5 ); - fgSizer6->SetFlexibleDirection( wxHORIZONTAL ); - fgSizer6->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - m_bitmapUpdate = new wxStaticBitmap( m_panelStatistics, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - m_bitmapUpdate->SetToolTip( _("Number of files that will be overwritten") ); - - fgSizer6->Add( m_bitmapUpdate, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_textCtrlUpdate = new wxTextCtrl( m_panelStatistics, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), wxTE_READONLY ); - m_textCtrlUpdate->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) ); - m_textCtrlUpdate->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - m_textCtrlUpdate->SetToolTip( _("Number of files that will be overwritten") ); - - fgSizer6->Add( m_textCtrlUpdate, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bitmapData = new wxStaticBitmap( m_panelStatistics, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - m_bitmapData->SetToolTip( _("Total amount of data that will be transferred") ); - - fgSizer6->Add( m_bitmapData, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_textCtrlData = new wxTextCtrl( m_panelStatistics, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), wxTE_READONLY ); - m_textCtrlData->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) ); - m_textCtrlData->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - m_textCtrlData->SetToolTip( _("Total amount of data that will be transferred") ); - - fgSizer6->Add( m_textCtrlData, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizerStatistics->Add( fgSizer6, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); - - - bSizerStatistics->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_panelStatistics->SetSizer( bSizerStatistics ); - m_panelStatistics->Layout(); - bSizerStatistics->Fit( m_panelStatistics ); - bSizerPanelHolder->Add( m_panelStatistics, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_panelViewFilter = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - bSizerViewFilter = new wxBoxSizer( wxHORIZONTAL ); - - - bSizerViewFilter->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_bpButtonSyncCreateLeft = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonSyncCreateLeft, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_bpButtonSyncDirOverwLeft = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonSyncDirOverwLeft, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_bpButtonSyncDeleteLeft = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonSyncDeleteLeft, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_bpButtonLeftOnly = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonLeftOnly, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_bpButtonLeftNewer = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonLeftNewer, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_bpButtonEqual = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonEqual, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_bpButtonDifferent = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonDifferent, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_bpButtonSyncDirNone = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonSyncDirNone, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_bpButtonRightNewer = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonRightNewer, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_bpButtonRightOnly = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonRightOnly, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_bpButtonSyncDeleteRight = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonSyncDeleteRight, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_bpButtonSyncDirOverwRight = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonSyncDirOverwRight, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_bpButtonSyncCreateRight = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonSyncCreateRight, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_bpButtonConflict = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - bSizerViewFilter->Add( m_bpButtonConflict, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - - bSizerViewFilter->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_panelViewFilter->SetSizer( bSizerViewFilter ); - m_panelViewFilter->Layout(); - bSizerViewFilter->Fit( m_panelViewFilter ); - bSizerPanelHolder->Add( m_panelViewFilter, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_panelStatusBar = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSTATIC_BORDER|wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer451; - bSizer451 = new wxBoxSizer( wxHORIZONTAL ); - - bSizer451->SetMinSize( wxSize( -1,22 ) ); - wxBoxSizer* bSizer53; - bSizer53 = new wxBoxSizer( wxHORIZONTAL ); - - - bSizer53->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticTextStatusLeft = new wxStaticText( m_panelStatusBar, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextStatusLeft->Wrap( -1 ); - m_staticTextStatusLeft->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); - - bSizer53->Add( m_staticTextStatusLeft, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - - bSizer53->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer451->Add( bSizer53, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - m_staticline9 = new wxStaticLine( m_panelStatusBar, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); - bSizer451->Add( m_staticline9, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxEXPAND, 2 ); - - - bSizer451->Add( 26, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticTextStatusMiddle = new wxStaticText( m_panelStatusBar, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextStatusMiddle->Wrap( -1 ); - m_staticTextStatusMiddle->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); - - bSizer451->Add( m_staticTextStatusMiddle, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - - bSizer451->Add( 26, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticline10 = new wxStaticLine( m_panelStatusBar, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); - bSizer451->Add( m_staticline10, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP, 2 ); - - wxBoxSizer* bSizer52; - bSizer52 = new wxBoxSizer( wxHORIZONTAL ); - - - bSizer52->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticTextStatusRight = new wxStaticText( m_panelStatusBar, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextStatusRight->Wrap( -1 ); - m_staticTextStatusRight->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); - - bSizer52->Add( m_staticTextStatusRight, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - wxBoxSizer* bSizer50; - bSizer50 = new wxBoxSizer( wxHORIZONTAL ); - - - bSizer50->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bitmap15 = new wxStaticBitmap( m_panelStatusBar, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 10,10 ), 0 ); - bSizer50->Add( m_bitmap15, 0, wxALIGN_BOTTOM, 2 ); - - bSizer52->Add( bSizer50, 1, wxALIGN_BOTTOM|wxEXPAND, 5 ); - - bSizer451->Add( bSizer52, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - - m_panelStatusBar->SetSizer( bSizer451 ); - m_panelStatusBar->Layout(); - bSizer451->Fit( m_panelStatusBar ); - bSizerPanelHolder->Add( m_panelStatusBar, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - this->SetSizer( bSizerPanelHolder ); - this->Layout(); - bSizerPanelHolder->Fit( this ); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainDialogGenerated::OnClose ) ); - this->Connect( m_menuItem10->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnCompare ) ); - this->Connect( m_menuItem11->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnStartSync ) ); - this->Connect( m_menuItemSwitchView->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnSwitchView ) ); - this->Connect( m_menuItemNew->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnNewConfig ) ); - this->Connect( m_menuItemSave->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnSaveConfig ) ); - this->Connect( m_menuItemLoad->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnLoadConfig ) ); - this->Connect( m_menuItem4->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuQuit ) ); - this->Connect( m_menuItemGlobSett->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuGlobalSettings ) ); - this->Connect( m_menuItem7->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuBatchJob ) ); - this->Connect( m_menuItem5->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuExportFileList ) ); - this->Connect( m_menuItemReadme->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnShowHelp ) ); - this->Connect( m_menuItemCheckVer->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuCheckVersion ) ); - this->Connect( m_menuItemAbout->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuAbout ) ); - m_buttonCompare->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnCompare ), NULL, this ); - m_bpButtonCmpConfig->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnCmpSettings ), NULL, this ); - m_bpButtonSyncConfig->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncSettings ), NULL, this ); - m_buttonStartSync->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnStartSync ), NULL, this ); - m_dirPickerLeft->Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( MainDialogGenerated::OnDirSelected ), NULL, this ); - m_bpButtonSwapSides->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSwapSides ), NULL, this ); - m_bpButtonAddPair->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnAddFolderPair ), NULL, this ); - m_bpButtonRemovePair->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRemoveTopFolderPair ), NULL, this ); - m_dirPickerRight->Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( MainDialogGenerated::OnDirSelected ), NULL, this ); - m_gridLeft->Connect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( MainDialogGenerated::OnLeftGridDoubleClick ), NULL, this ); - m_gridLeft->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( MainDialogGenerated::OnContextRim ), NULL, this ); - m_gridLeft->Connect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( MainDialogGenerated::OnSortLeftGrid ), NULL, this ); - m_gridLeft->Connect( wxEVT_GRID_LABEL_RIGHT_CLICK, wxGridEventHandler( MainDialogGenerated::OnContextRimLabelLeft ), NULL, this ); - m_gridMiddle->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( MainDialogGenerated::OnContextMiddle ), NULL, this ); - m_gridMiddle->Connect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( MainDialogGenerated::OnSortMiddleGrid ), NULL, this ); - m_gridMiddle->Connect( wxEVT_GRID_LABEL_RIGHT_CLICK, wxGridEventHandler( MainDialogGenerated::OnContextMiddleLabel ), NULL, this ); - m_gridRight->Connect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( MainDialogGenerated::OnRightGridDoubleClick ), NULL, this ); - m_gridRight->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( MainDialogGenerated::OnContextRim ), NULL, this ); - m_gridRight->Connect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( MainDialogGenerated::OnSortRightGrid ), NULL, this ); - m_gridRight->Connect( wxEVT_GRID_LABEL_RIGHT_CLICK, wxGridEventHandler( MainDialogGenerated::OnContextRimLabelRight ), NULL, this ); - m_bpButtonSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSaveConfig ), NULL, this ); - m_bpButtonLoad->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnLoadConfig ), NULL, this ); - m_listBoxHistory->Connect( wxEVT_CHAR, wxKeyEventHandler( MainDialogGenerated::OnCfgHistoryKeyEvent ), NULL, this ); - m_listBoxHistory->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnLoadFromHistory ), NULL, this ); - m_bpButtonFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigureFilter ), NULL, this ); - m_checkBoxHideFilt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnHideFilteredButton ), NULL, this ); - m_bpButtonSyncCreateLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncCreateLeft ), NULL, this ); - m_bpButtonSyncDirOverwLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDirLeft ), NULL, this ); - m_bpButtonSyncDeleteLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDeleteLeft ), NULL, this ); - m_bpButtonLeftOnly->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnLeftOnlyFiles ), NULL, this ); - m_bpButtonLeftNewer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnLeftNewerFiles ), NULL, this ); - m_bpButtonEqual->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnEqualFiles ), NULL, this ); - m_bpButtonDifferent->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnDifferentFiles ), NULL, this ); - m_bpButtonSyncDirNone->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDirNone ), NULL, this ); - m_bpButtonRightNewer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRightNewerFiles ), NULL, this ); - m_bpButtonRightOnly->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRightOnlyFiles ), NULL, this ); - m_bpButtonSyncDeleteRight->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDeleteRight ), NULL, this ); - m_bpButtonSyncDirOverwRight->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDirRight ), NULL, this ); - m_bpButtonSyncCreateRight->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncCreateRight ), NULL, this ); - m_bpButtonConflict->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConflictFiles ), NULL, this ); + this->SetSizeHints( wxSize( 640,400 ), wxDefaultSize ); + + m_menubar1 = new wxMenuBar( 0 ); + m_menuFile = new wxMenu(); + m_menuItem10 = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("1. &Compare") ) + wxT('\t') + wxT("F5"), wxEmptyString, wxITEM_NORMAL ); + m_menuFile->Append( m_menuItem10 ); + + m_menuItem11 = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("2. &Synchronize...") ) + wxT('\t') + wxT("F6"), wxEmptyString, wxITEM_NORMAL ); + m_menuFile->Append( m_menuItem11 ); + + wxMenuItem* m_separator1; + m_separator1 = m_menuFile->AppendSeparator(); + + m_menuItemSwitchView = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("S&witch view") ) + wxT('\t') + wxT("F8"), wxEmptyString, wxITEM_NORMAL ); + m_menuFile->Append( m_menuItemSwitchView ); + + wxMenuItem* m_separator2; + m_separator2 = m_menuFile->AppendSeparator(); + + m_menuItemNew = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("&New") ) + wxT('\t') + wxT("CTRL-N"), wxEmptyString, wxITEM_NORMAL ); + m_menuFile->Append( m_menuItemNew ); + + m_menuItemSave = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("S&ave configuration...") ) + wxT('\t') + wxT("CTRL-S"), wxEmptyString, wxITEM_NORMAL ); + m_menuFile->Append( m_menuItemSave ); + + m_menuItemLoad = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("&Load configuration...") ) + wxT('\t') + wxT("CTRL-L"), wxEmptyString, wxITEM_NORMAL ); + m_menuFile->Append( m_menuItemLoad ); + + wxMenuItem* m_separator3; + m_separator3 = m_menuFile->AppendSeparator(); + + wxMenuItem* m_menuItem4; + m_menuItem4 = new wxMenuItem( m_menuFile, wxID_EXIT, wxString( _("&Quit") ) + wxT('\t') + wxT("CTRL-Q"), wxEmptyString, wxITEM_NORMAL ); + m_menuFile->Append( m_menuItem4 ); + + m_menubar1->Append( m_menuFile, _("&Program") ); + + m_menuAdvanced = new wxMenu(); + m_menuLanguages = new wxMenu(); + m_menuAdvanced->Append( -1, _("&Language"), m_menuLanguages ); + + wxMenuItem* m_separator4; + m_separator4 = m_menuAdvanced->AppendSeparator(); + + m_menuItemGlobSett = new wxMenuItem( m_menuAdvanced, wxID_ANY, wxString( _("&Global settings...") ) , wxEmptyString, wxITEM_NORMAL ); + m_menuAdvanced->Append( m_menuItemGlobSett ); + + m_menuItem7 = new wxMenuItem( m_menuAdvanced, wxID_ANY, wxString( _("&Create batch job...") ) , wxEmptyString, wxITEM_NORMAL ); + m_menuAdvanced->Append( m_menuItem7 ); + + wxMenuItem* m_menuItem5; + m_menuItem5 = new wxMenuItem( m_menuAdvanced, wxID_ANY, wxString( _("&Export file list...") ) , wxEmptyString, wxITEM_NORMAL ); + m_menuAdvanced->Append( m_menuItem5 ); + + m_menubar1->Append( m_menuAdvanced, _("&Advanced") ); + + m_menuHelp = new wxMenu(); + wxMenuItem* m_menuItemReadme; + m_menuItemReadme = new wxMenuItem( m_menuHelp, wxID_ANY, wxString( _("&Content") ) + wxT('\t') + wxT("F1"), wxEmptyString, wxITEM_NORMAL ); + m_menuHelp->Append( m_menuItemReadme ); + + m_menuItemCheckVer = new wxMenuItem( m_menuHelp, wxID_ANY, wxString( _("&Check for new version") ) , wxEmptyString, wxITEM_NORMAL ); + m_menuHelp->Append( m_menuItemCheckVer ); + + wxMenuItem* m_separator5; + m_separator5 = m_menuHelp->AppendSeparator(); + + m_menuItemAbout = new wxMenuItem( m_menuHelp, wxID_ABOUT, wxString( _("&About...") ) + wxT('\t') + wxT("SHIFT-F1"), wxEmptyString, wxITEM_NORMAL ); + m_menuHelp->Append( m_menuItemAbout ); + + m_menubar1->Append( m_menuHelp, _("&Help") ); + + this->SetMenuBar( m_menubar1 ); + + bSizerPanelHolder = new wxBoxSizer( wxVERTICAL ); + + m_panelTopButtons = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER|wxTAB_TRAVERSAL ); + bSizerTopButtons = new wxBoxSizer( wxHORIZONTAL ); + + + bSizerTopButtons->Add( 15, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + wxFlexGridSizer* fgSizer121; + fgSizer121 = new wxFlexGridSizer( 2, 2, 0, 0 ); + fgSizer121->SetFlexibleDirection( wxBOTH ); + fgSizer121->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticTextCmpVariant = new wxStaticText( m_panelTopButtons, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextCmpVariant->Wrap( -1 ); + m_staticTextCmpVariant->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); + m_staticTextCmpVariant->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) ); + + fgSizer121->Add( m_staticTextCmpVariant, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxTOP, 1 ); + + + fgSizer121->Add( 0, 0, 1, 0, 5 ); + + wxBoxSizer* bSizer30; + bSizer30 = new wxBoxSizer( wxHORIZONTAL ); + + m_buttonCompare = new wxButtonWithImage( m_panelTopButtons, wxID_OK, _("Compare"), wxDefaultPosition, wxSize( 180,42 ), 0 ); + m_buttonCompare->SetDefault(); + m_buttonCompare->SetFont( wxFont( 14, 74, 90, 92, false, wxT("Arial Black") ) ); + m_buttonCompare->SetToolTip( _("Compare both sides") ); + + bSizer30->Add( m_buttonCompare, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_buttonAbort = new wxButton( m_panelTopButtons, wxID_CANCEL, _("&Abort"), wxDefaultPosition, wxSize( 180,42 ), 0 ); + m_buttonAbort->SetFont( wxFont( 14, 74, 90, 92, false, wxT("Arial Black") ) ); + m_buttonAbort->Enable( false ); + m_buttonAbort->Hide(); + + bSizer30->Add( m_buttonAbort, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + fgSizer121->Add( bSizer30, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bpButtonCmpConfig = new wxBitmapButton( m_panelTopButtons, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,42 ), wxBU_AUTODRAW ); + m_bpButtonCmpConfig->SetToolTip( _("Comparison settings") ); + + m_bpButtonCmpConfig->SetToolTip( _("Comparison settings") ); + + fgSizer121->Add( m_bpButtonCmpConfig, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 ); + + bSizerTopButtons->Add( fgSizer121, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 ); + + + bSizerTopButtons->Add( 0, 0, 1, 0, 5 ); + + wxFlexGridSizer* fgSizer12; + fgSizer12 = new wxFlexGridSizer( 2, 2, 0, 0 ); + fgSizer12->SetFlexibleDirection( wxBOTH ); + fgSizer12->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + + fgSizer12->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_staticTextSyncVariant = new wxStaticText( m_panelTopButtons, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextSyncVariant->Wrap( -1 ); + m_staticTextSyncVariant->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); + m_staticTextSyncVariant->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) ); + + fgSizer12->Add( m_staticTextSyncVariant, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxTOP, 1 ); + + m_bpButtonSyncConfig = new wxBitmapButton( m_panelTopButtons, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,42 ), wxBU_AUTODRAW ); + m_bpButtonSyncConfig->SetToolTip( _("Synchronization settings") ); + + m_bpButtonSyncConfig->SetToolTip( _("Synchronization settings") ); + + fgSizer12->Add( m_bpButtonSyncConfig, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 ); + + m_buttonStartSync = new wxButtonWithImage( m_panelTopButtons, wxID_ANY, _("Synchronize..."), wxDefaultPosition, wxSize( -1,42 ), 0 ); + m_buttonStartSync->SetFont( wxFont( 14, 74, 90, 92, false, wxT("Arial Black") ) ); + m_buttonStartSync->SetToolTip( _("Start synchronization") ); + + fgSizer12->Add( m_buttonStartSync, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizerTopButtons->Add( fgSizer12, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 ); + + + bSizerTopButtons->Add( 15, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_panelTopButtons->SetSizer( bSizerTopButtons ); + m_panelTopButtons->Layout(); + bSizerTopButtons->Fit( m_panelTopButtons ); + bSizerPanelHolder->Add( m_panelTopButtons, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + m_panelDirectoryPairs = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer1601; + bSizer1601 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer91; + bSizer91 = new wxBoxSizer( wxHORIZONTAL ); + + m_panelTopLeft = new wxPanel( m_panelDirectoryPairs, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_panelTopLeft->SetMinSize( wxSize( 1,1 ) ); + + sbSizerDirLeft = new wxStaticBoxSizer( new wxStaticBox( m_panelTopLeft, wxID_ANY, _("Drag && drop") ), wxHORIZONTAL ); + + m_directoryLeft = new CustomComboBox( m_panelTopLeft, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + sbSizerDirLeft->Add( m_directoryLeft, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_dirPickerLeft = new wxDirPickerCtrl( m_panelTopLeft, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); + m_dirPickerLeft->SetToolTip( _("Select a folder") ); + + sbSizerDirLeft->Add( m_dirPickerLeft, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_panelTopLeft->SetSizer( sbSizerDirLeft ); + m_panelTopLeft->Layout(); + sbSizerDirLeft->Fit( m_panelTopLeft ); + bSizer91->Add( m_panelTopLeft, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + m_panelTopMiddle = new wxPanel( m_panelDirectoryPairs, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer93; + bSizer93 = new wxBoxSizer( wxVERTICAL ); + + + bSizer93->Add( 0, 3, 0, 0, 5 ); + + m_bpButtonSwapSides = new wxBitmapButton( m_panelTopMiddle, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW ); + m_bpButtonSwapSides->SetToolTip( _("Swap sides") ); + + m_bpButtonSwapSides->SetToolTip( _("Swap sides") ); + + bSizer93->Add( m_bpButtonSwapSides, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + wxBoxSizer* bSizer160; + bSizer160 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer160->Add( 0, 0, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + m_bpButtonLocalFilter = new wxBitmapButton( m_panelTopMiddle, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); + bSizer160->Add( m_bpButtonLocalFilter, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer160->Add( 5, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bpButtonAltSyncCfg = new wxBitmapButton( m_panelTopMiddle, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); + bSizer160->Add( m_bpButtonAltSyncCfg, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer160->Add( 0, 0, 1, wxEXPAND, 5 ); + + bSizer93->Add( bSizer160, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_panelTopMiddle->SetSizer( bSizer93 ); + m_panelTopMiddle->Layout(); + bSizer93->Fit( m_panelTopMiddle ); + bSizer91->Add( m_panelTopMiddle, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + m_panelTopRight = new wxPanel( m_panelDirectoryPairs, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_panelTopRight->SetMinSize( wxSize( 1,1 ) ); + + sbSizerDirRight = new wxStaticBoxSizer( new wxStaticBox( m_panelTopRight, wxID_ANY, _("Drag && drop") ), wxHORIZONTAL ); + + m_bpButtonAddPair = new wxBitmapButton( m_panelTopRight, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); + m_bpButtonAddPair->SetToolTip( _("Add folder pair") ); + + m_bpButtonAddPair->SetToolTip( _("Add folder pair") ); + + sbSizerDirRight->Add( m_bpButtonAddPair, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 3 ); + + m_bpButtonRemovePair = new wxBitmapButton( m_panelTopRight, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); + m_bpButtonRemovePair->SetToolTip( _("Remove folder pair") ); + + m_bpButtonRemovePair->SetToolTip( _("Remove folder pair") ); + + sbSizerDirRight->Add( m_bpButtonRemovePair, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_directoryRight = new CustomComboBox( m_panelTopRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + sbSizerDirRight->Add( m_directoryRight, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_dirPickerRight = new wxDirPickerCtrl( m_panelTopRight, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); + m_dirPickerRight->SetToolTip( _("Select a folder") ); + + sbSizerDirRight->Add( m_dirPickerRight, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_panelTopRight->SetSizer( sbSizerDirRight ); + m_panelTopRight->Layout(); + sbSizerDirRight->Fit( m_panelTopRight ); + bSizer91->Add( m_panelTopRight, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + bSizer1601->Add( bSizer91, 0, wxEXPAND, 5 ); + + m_scrolledWindowFolderPairs = new wxScrolledWindow( m_panelDirectoryPairs, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxHSCROLL|wxVSCROLL ); + m_scrolledWindowFolderPairs->SetScrollRate( 5, 5 ); + m_scrolledWindowFolderPairs->SetMinSize( wxSize( -1,0 ) ); + + bSizerAddFolderPairs = new wxBoxSizer( wxVERTICAL ); + + m_scrolledWindowFolderPairs->SetSizer( bSizerAddFolderPairs ); + m_scrolledWindowFolderPairs->Layout(); + bSizerAddFolderPairs->Fit( m_scrolledWindowFolderPairs ); + bSizer1601->Add( m_scrolledWindowFolderPairs, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + m_panelDirectoryPairs->SetSizer( bSizer1601 ); + m_panelDirectoryPairs->Layout(); + bSizer1601->Fit( m_panelDirectoryPairs ); + bSizerPanelHolder->Add( m_panelDirectoryPairs, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + m_panelGrids = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_panelGrids->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_APPWORKSPACE ) ); + + bSizerGridHolder = new wxBoxSizer( wxHORIZONTAL ); + + m_panelLeft = new wxPanel( m_panelGrids, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer7; + bSizer7 = new wxBoxSizer( wxVERTICAL ); + + m_gridLeft = new CustomGridLeft( m_panelLeft, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + // Grid + m_gridLeft->CreateGrid( 15, 4 ); + m_gridLeft->EnableEditing( false ); + m_gridLeft->EnableGridLines( true ); + m_gridLeft->EnableDragGridSize( true ); + m_gridLeft->SetMargins( 0, 0 ); + + // Columns + m_gridLeft->EnableDragColMove( false ); + m_gridLeft->EnableDragColSize( true ); + m_gridLeft->SetColLabelSize( 20 ); + m_gridLeft->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE ); + + // Rows + m_gridLeft->EnableDragRowSize( false ); + m_gridLeft->SetRowLabelSize( 38 ); + m_gridLeft->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Label Appearance + + // Cell Defaults + m_gridLeft->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_CENTRE ); + m_gridLeft->SetMinSize( wxSize( 1,1 ) ); + + bSizer7->Add( m_gridLeft, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 5 ); + + m_panelLeft->SetSizer( bSizer7 ); + m_panelLeft->Layout(); + bSizer7->Fit( m_panelLeft ); + bSizerGridHolder->Add( m_panelLeft, 1, wxEXPAND, 5 ); + + m_panelMiddle = new wxPanel( m_panelGrids, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer18; + bSizer18 = new wxBoxSizer( wxVERTICAL ); + + m_gridMiddle = new CustomGridMiddle( m_panelMiddle, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + // Grid + m_gridMiddle->CreateGrid( 15, 1 ); + m_gridMiddle->EnableEditing( false ); + m_gridMiddle->EnableGridLines( true ); + m_gridMiddle->EnableDragGridSize( false ); + m_gridMiddle->SetMargins( 0, 0 ); + + // Columns + m_gridMiddle->SetColSize( 0, 60 ); + m_gridMiddle->EnableDragColMove( false ); + m_gridMiddle->EnableDragColSize( false ); + m_gridMiddle->SetColLabelSize( 20 ); + m_gridMiddle->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Rows + m_gridMiddle->EnableDragRowSize( false ); + m_gridMiddle->SetRowLabelSize( 0 ); + m_gridMiddle->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Label Appearance + + // Cell Defaults + m_gridMiddle->SetDefaultCellFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxT("Arial") ) ); + m_gridMiddle->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + bSizer18->Add( m_gridMiddle, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + m_panelMiddle->SetSizer( bSizer18 ); + m_panelMiddle->Layout(); + bSizer18->Fit( m_panelMiddle ); + bSizerGridHolder->Add( m_panelMiddle, 0, wxEXPAND, 5 ); + + m_panelRight = new wxPanel( m_panelGrids, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer10; + bSizer10 = new wxBoxSizer( wxVERTICAL ); + + m_gridRight = new CustomGridRight( m_panelRight, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + // Grid + m_gridRight->CreateGrid( 15, 4 ); + m_gridRight->EnableEditing( false ); + m_gridRight->EnableGridLines( true ); + m_gridRight->EnableDragGridSize( true ); + m_gridRight->SetMargins( 0, 0 ); + + // Columns + m_gridRight->EnableDragColMove( false ); + m_gridRight->EnableDragColSize( true ); + m_gridRight->SetColLabelSize( 20 ); + m_gridRight->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE ); + + // Rows + m_gridRight->EnableDragRowSize( false ); + m_gridRight->SetRowLabelSize( 38 ); + m_gridRight->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Label Appearance + + // Cell Defaults + m_gridRight->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_CENTRE ); + m_gridRight->SetMinSize( wxSize( 1,1 ) ); + + bSizer10->Add( m_gridRight, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT, 5 ); + + m_panelRight->SetSizer( bSizer10 ); + m_panelRight->Layout(); + bSizer10->Fit( m_panelRight ); + bSizerGridHolder->Add( m_panelRight, 1, wxEXPAND, 5 ); + + m_panelGrids->SetSizer( bSizerGridHolder ); + m_panelGrids->Layout(); + bSizerGridHolder->Fit( m_panelGrids ); + bSizerPanelHolder->Add( m_panelGrids, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + m_panelConfig = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + bSizerConfig = new wxBoxSizer( wxHORIZONTAL ); + + + bSizerConfig->Add( 10, 0, 0, 0, 5 ); + + wxBoxSizer* bSizer151; + bSizer151 = new wxBoxSizer( wxHORIZONTAL ); + + m_bpButtonSave = new wxBitmapButton( m_panelConfig, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + m_bpButtonSave->SetToolTip( _("Save current configuration to file") ); + + m_bpButtonSave->SetToolTip( _("Save current configuration to file") ); + + bSizer151->Add( m_bpButtonSave, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bpButtonLoad = new wxBitmapButton( m_panelConfig, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + m_bpButtonLoad->SetToolTip( _("Load configuration from file") ); + + m_bpButtonLoad->SetToolTip( _("Load configuration from file") ); + + bSizer151->Add( m_bpButtonLoad, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizerConfig->Add( bSizer151, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_listBoxHistory = new wxListBox( m_panelConfig, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_NEEDED_SB|wxLB_SINGLE|wxLB_SORT ); + m_listBoxHistory->SetToolTip( _("Last used configurations (press DEL to remove from list)") ); + m_listBoxHistory->SetMinSize( wxSize( -1,40 ) ); + + bSizerConfig->Add( m_listBoxHistory, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + m_panelConfig->SetSizer( bSizerConfig ); + m_panelConfig->Layout(); + bSizerConfig->Fit( m_panelConfig ); + bSizerPanelHolder->Add( m_panelConfig, 0, 0, 5 ); + + m_panelFilter = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer140; + bSizer140 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer140->Add( 10, 0, 0, 0, 5 ); + + m_bpButtonFilter = new wxBitmapButton( m_panelFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW|wxFULL_REPAINT_ON_RESIZE ); + bSizer140->Add( m_bpButtonFilter, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + wxBoxSizer* bSizer23; + bSizer23 = new wxBoxSizer( wxVERTICAL ); + + m_checkBoxHideFilt = new wxCheckBox( m_panelFilter, wxID_ANY, _("Hide excluded items"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxHideFilt->SetToolTip( _("Hide filtered or temporarily excluded files") ); + + bSizer23->Add( m_checkBoxHideFilt, 0, wxEXPAND, 5 ); + + bSizer140->Add( bSizer23, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_panelFilter->SetSizer( bSizer140 ); + m_panelFilter->Layout(); + bSizer140->Fit( m_panelFilter ); + bSizerPanelHolder->Add( m_panelFilter, 0, 0, 5 ); + + m_panelStatistics = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + bSizerStatistics = new wxBoxSizer( wxHORIZONTAL ); + + + bSizerStatistics->Add( 0, 0, 1, wxEXPAND, 5 ); + + wxFlexGridSizer* fgSizer5; + fgSizer5 = new wxFlexGridSizer( 2, 2, 0, 5 ); + fgSizer5->SetFlexibleDirection( wxHORIZONTAL ); + fgSizer5->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_bitmapCreate = new wxStaticBitmap( m_panelStatistics, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + m_bitmapCreate->SetToolTip( _("Number of files and directories that will be created") ); + + fgSizer5->Add( m_bitmapCreate, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_textCtrlCreate = new wxTextCtrl( m_panelStatistics, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), wxTE_READONLY ); + m_textCtrlCreate->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) ); + m_textCtrlCreate->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + m_textCtrlCreate->SetToolTip( _("Number of files and directories that will be created") ); + + fgSizer5->Add( m_textCtrlCreate, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bitmapUpdate = new wxStaticBitmap( m_panelStatistics, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + m_bitmapUpdate->SetToolTip( _("Number of files that will be overwritten") ); + + fgSizer5->Add( m_bitmapUpdate, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_textCtrlUpdate = new wxTextCtrl( m_panelStatistics, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), wxTE_READONLY ); + m_textCtrlUpdate->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) ); + m_textCtrlUpdate->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + m_textCtrlUpdate->SetToolTip( _("Number of files that will be overwritten") ); + + fgSizer5->Add( m_textCtrlUpdate, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizerStatistics->Add( fgSizer5, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); + + wxFlexGridSizer* fgSizer6; + fgSizer6 = new wxFlexGridSizer( 2, 2, 0, 5 ); + fgSizer6->SetFlexibleDirection( wxHORIZONTAL ); + fgSizer6->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_bitmapDelete = new wxStaticBitmap( m_panelStatistics, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + m_bitmapDelete->SetToolTip( _("Number of files and directories that will be deleted") ); + + fgSizer6->Add( m_bitmapDelete, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_textCtrlDelete = new wxTextCtrl( m_panelStatistics, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), wxTE_READONLY ); + m_textCtrlDelete->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) ); + m_textCtrlDelete->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + m_textCtrlDelete->SetToolTip( _("Number of files and directories that will be deleted") ); + + fgSizer6->Add( m_textCtrlDelete, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bitmapData = new wxStaticBitmap( m_panelStatistics, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + m_bitmapData->SetToolTip( _("Total amount of data that will be transferred") ); + + fgSizer6->Add( m_bitmapData, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_textCtrlData = new wxTextCtrl( m_panelStatistics, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), wxTE_READONLY ); + m_textCtrlData->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) ); + m_textCtrlData->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + m_textCtrlData->SetToolTip( _("Total amount of data that will be transferred") ); + + fgSizer6->Add( m_textCtrlData, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizerStatistics->Add( fgSizer6, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); + + + bSizerStatistics->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_panelStatistics->SetSizer( bSizerStatistics ); + m_panelStatistics->Layout(); + bSizerStatistics->Fit( m_panelStatistics ); + bSizerPanelHolder->Add( m_panelStatistics, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_panelViewFilter = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + bSizerViewFilter = new wxBoxSizer( wxHORIZONTAL ); + + + bSizerViewFilter->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_bpButtonSyncCreateLeft = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonSyncCreateLeft, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_bpButtonSyncDirOverwLeft = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonSyncDirOverwLeft, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_bpButtonSyncDeleteLeft = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonSyncDeleteLeft, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_bpButtonLeftOnly = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonLeftOnly, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_bpButtonLeftNewer = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonLeftNewer, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_bpButtonEqual = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonEqual, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_bpButtonDifferent = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonDifferent, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_bpButtonSyncDirNone = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonSyncDirNone, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_bpButtonRightNewer = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonRightNewer, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_bpButtonRightOnly = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonRightOnly, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_bpButtonSyncDeleteRight = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonSyncDeleteRight, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_bpButtonSyncDirOverwRight = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonSyncDirOverwRight, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_bpButtonSyncCreateRight = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonSyncCreateRight, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_bpButtonConflict = new ToggleButton( m_panelViewFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + bSizerViewFilter->Add( m_bpButtonConflict, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + + bSizerViewFilter->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_panelViewFilter->SetSizer( bSizerViewFilter ); + m_panelViewFilter->Layout(); + bSizerViewFilter->Fit( m_panelViewFilter ); + bSizerPanelHolder->Add( m_panelViewFilter, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_panelStatusBar = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSTATIC_BORDER|wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer451; + bSizer451 = new wxBoxSizer( wxHORIZONTAL ); + + bSizer451->SetMinSize( wxSize( -1,22 ) ); + wxBoxSizer* bSizer53; + bSizer53 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer53->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticTextStatusLeft = new wxStaticText( m_panelStatusBar, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextStatusLeft->Wrap( -1 ); + m_staticTextStatusLeft->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); + + bSizer53->Add( m_staticTextStatusLeft, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + + bSizer53->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer451->Add( bSizer53, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + m_staticline9 = new wxStaticLine( m_panelStatusBar, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); + bSizer451->Add( m_staticline9, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxEXPAND, 2 ); + + + bSizer451->Add( 26, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticTextStatusMiddle = new wxStaticText( m_panelStatusBar, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextStatusMiddle->Wrap( -1 ); + m_staticTextStatusMiddle->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); + + bSizer451->Add( m_staticTextStatusMiddle, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + + bSizer451->Add( 26, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticline10 = new wxStaticLine( m_panelStatusBar, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); + bSizer451->Add( m_staticline10, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP, 2 ); + + wxBoxSizer* bSizer52; + bSizer52 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer52->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticTextStatusRight = new wxStaticText( m_panelStatusBar, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextStatusRight->Wrap( -1 ); + m_staticTextStatusRight->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); + + bSizer52->Add( m_staticTextStatusRight, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + wxBoxSizer* bSizer50; + bSizer50 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer50->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bitmap15 = new wxStaticBitmap( m_panelStatusBar, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 10,10 ), 0 ); + bSizer50->Add( m_bitmap15, 0, wxALIGN_BOTTOM, 2 ); + + bSizer52->Add( bSizer50, 1, wxALIGN_BOTTOM|wxEXPAND, 5 ); + + bSizer451->Add( bSizer52, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + m_panelStatusBar->SetSizer( bSizer451 ); + m_panelStatusBar->Layout(); + bSizer451->Fit( m_panelStatusBar ); + bSizerPanelHolder->Add( m_panelStatusBar, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + this->SetSizer( bSizerPanelHolder ); + this->Layout(); + bSizerPanelHolder->Fit( this ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainDialogGenerated::OnClose ) ); + this->Connect( m_menuItem10->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnCompare ) ); + this->Connect( m_menuItem11->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnStartSync ) ); + this->Connect( m_menuItemSwitchView->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnSwitchView ) ); + this->Connect( m_menuItemNew->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnNewConfig ) ); + this->Connect( m_menuItemSave->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnSaveConfig ) ); + this->Connect( m_menuItemLoad->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnLoadConfig ) ); + this->Connect( m_menuItem4->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuQuit ) ); + this->Connect( m_menuItemGlobSett->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuGlobalSettings ) ); + this->Connect( m_menuItem7->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuBatchJob ) ); + this->Connect( m_menuItem5->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuExportFileList ) ); + this->Connect( m_menuItemReadme->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnShowHelp ) ); + this->Connect( m_menuItemCheckVer->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuCheckVersion ) ); + this->Connect( m_menuItemAbout->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuAbout ) ); + m_buttonCompare->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnCompare ), NULL, this ); + m_bpButtonCmpConfig->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnCmpSettings ), NULL, this ); + m_bpButtonSyncConfig->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncSettings ), NULL, this ); + m_buttonStartSync->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnStartSync ), NULL, this ); + m_dirPickerLeft->Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( MainDialogGenerated::OnDirSelected ), NULL, this ); + m_bpButtonSwapSides->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSwapSides ), NULL, this ); + m_bpButtonAddPair->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnAddFolderPair ), NULL, this ); + m_bpButtonRemovePair->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRemoveTopFolderPair ), NULL, this ); + m_dirPickerRight->Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( MainDialogGenerated::OnDirSelected ), NULL, this ); + m_gridLeft->Connect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( MainDialogGenerated::OnLeftGridDoubleClick ), NULL, this ); + m_gridLeft->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( MainDialogGenerated::OnContextRim ), NULL, this ); + m_gridLeft->Connect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( MainDialogGenerated::OnSortLeftGrid ), NULL, this ); + m_gridLeft->Connect( wxEVT_GRID_LABEL_RIGHT_CLICK, wxGridEventHandler( MainDialogGenerated::OnContextRimLabelLeft ), NULL, this ); + m_gridMiddle->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( MainDialogGenerated::OnContextMiddle ), NULL, this ); + m_gridMiddle->Connect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( MainDialogGenerated::OnSortMiddleGrid ), NULL, this ); + m_gridMiddle->Connect( wxEVT_GRID_LABEL_RIGHT_CLICK, wxGridEventHandler( MainDialogGenerated::OnContextMiddleLabel ), NULL, this ); + m_gridRight->Connect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( MainDialogGenerated::OnRightGridDoubleClick ), NULL, this ); + m_gridRight->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( MainDialogGenerated::OnContextRim ), NULL, this ); + m_gridRight->Connect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( MainDialogGenerated::OnSortRightGrid ), NULL, this ); + m_gridRight->Connect( wxEVT_GRID_LABEL_RIGHT_CLICK, wxGridEventHandler( MainDialogGenerated::OnContextRimLabelRight ), NULL, this ); + m_bpButtonSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSaveConfig ), NULL, this ); + m_bpButtonLoad->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnLoadConfig ), NULL, this ); + m_listBoxHistory->Connect( wxEVT_CHAR, wxKeyEventHandler( MainDialogGenerated::OnCfgHistoryKeyEvent ), NULL, this ); + m_listBoxHistory->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnLoadFromHistory ), NULL, this ); + m_bpButtonFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigureFilter ), NULL, this ); + m_checkBoxHideFilt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnHideFilteredButton ), NULL, this ); + m_bpButtonSyncCreateLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncCreateLeft ), NULL, this ); + m_bpButtonSyncDirOverwLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDirLeft ), NULL, this ); + m_bpButtonSyncDeleteLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDeleteLeft ), NULL, this ); + m_bpButtonLeftOnly->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnLeftOnlyFiles ), NULL, this ); + m_bpButtonLeftNewer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnLeftNewerFiles ), NULL, this ); + m_bpButtonEqual->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnEqualFiles ), NULL, this ); + m_bpButtonDifferent->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnDifferentFiles ), NULL, this ); + m_bpButtonSyncDirNone->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDirNone ), NULL, this ); + m_bpButtonRightNewer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRightNewerFiles ), NULL, this ); + m_bpButtonRightOnly->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRightOnlyFiles ), NULL, this ); + m_bpButtonSyncDeleteRight->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDeleteRight ), NULL, this ); + m_bpButtonSyncDirOverwRight->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDirRight ), NULL, this ); + m_bpButtonSyncCreateRight->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncCreateRight ), NULL, this ); + m_bpButtonConflict->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConflictFiles ), NULL, this ); } MainDialogGenerated::~MainDialogGenerated() { - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainDialogGenerated::OnClose ) ); - this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnCompare ) ); - this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnStartSync ) ); - this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnSwitchView ) ); - this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnNewConfig ) ); - this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnSaveConfig ) ); - this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnLoadConfig ) ); - this->Disconnect( wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuQuit ) ); - this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuGlobalSettings ) ); - this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuBatchJob ) ); - this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuExportFileList ) ); - this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnShowHelp ) ); - this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuCheckVersion ) ); - this->Disconnect( wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuAbout ) ); - m_buttonCompare->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnCompare ), NULL, this ); - m_bpButtonCmpConfig->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnCmpSettings ), NULL, this ); - m_bpButtonSyncConfig->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncSettings ), NULL, this ); - m_buttonStartSync->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnStartSync ), NULL, this ); - m_dirPickerLeft->Disconnect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( MainDialogGenerated::OnDirSelected ), NULL, this ); - m_bpButtonSwapSides->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSwapSides ), NULL, this ); - m_bpButtonAddPair->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnAddFolderPair ), NULL, this ); - m_bpButtonRemovePair->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRemoveTopFolderPair ), NULL, this ); - m_dirPickerRight->Disconnect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( MainDialogGenerated::OnDirSelected ), NULL, this ); - m_gridLeft->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( MainDialogGenerated::OnLeftGridDoubleClick ), NULL, this ); - m_gridLeft->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( MainDialogGenerated::OnContextRim ), NULL, this ); - m_gridLeft->Disconnect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( MainDialogGenerated::OnSortLeftGrid ), NULL, this ); - m_gridLeft->Disconnect( wxEVT_GRID_LABEL_RIGHT_CLICK, wxGridEventHandler( MainDialogGenerated::OnContextRimLabelLeft ), NULL, this ); - m_gridMiddle->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( MainDialogGenerated::OnContextMiddle ), NULL, this ); - m_gridMiddle->Disconnect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( MainDialogGenerated::OnSortMiddleGrid ), NULL, this ); - m_gridMiddle->Disconnect( wxEVT_GRID_LABEL_RIGHT_CLICK, wxGridEventHandler( MainDialogGenerated::OnContextMiddleLabel ), NULL, this ); - m_gridRight->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( MainDialogGenerated::OnRightGridDoubleClick ), NULL, this ); - m_gridRight->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( MainDialogGenerated::OnContextRim ), NULL, this ); - m_gridRight->Disconnect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( MainDialogGenerated::OnSortRightGrid ), NULL, this ); - m_gridRight->Disconnect( wxEVT_GRID_LABEL_RIGHT_CLICK, wxGridEventHandler( MainDialogGenerated::OnContextRimLabelRight ), NULL, this ); - m_bpButtonSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSaveConfig ), NULL, this ); - m_bpButtonLoad->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnLoadConfig ), NULL, this ); - m_listBoxHistory->Disconnect( wxEVT_CHAR, wxKeyEventHandler( MainDialogGenerated::OnCfgHistoryKeyEvent ), NULL, this ); - m_listBoxHistory->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnLoadFromHistory ), NULL, this ); - m_bpButtonFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigureFilter ), NULL, this ); - m_checkBoxHideFilt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnHideFilteredButton ), NULL, this ); - m_bpButtonSyncCreateLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncCreateLeft ), NULL, this ); - m_bpButtonSyncDirOverwLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDirLeft ), NULL, this ); - m_bpButtonSyncDeleteLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDeleteLeft ), NULL, this ); - m_bpButtonLeftOnly->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnLeftOnlyFiles ), NULL, this ); - m_bpButtonLeftNewer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnLeftNewerFiles ), NULL, this ); - m_bpButtonEqual->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnEqualFiles ), NULL, this ); - m_bpButtonDifferent->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnDifferentFiles ), NULL, this ); - m_bpButtonSyncDirNone->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDirNone ), NULL, this ); - m_bpButtonRightNewer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRightNewerFiles ), NULL, this ); - m_bpButtonRightOnly->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRightOnlyFiles ), NULL, this ); - m_bpButtonSyncDeleteRight->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDeleteRight ), NULL, this ); - m_bpButtonSyncDirOverwRight->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDirRight ), NULL, this ); - m_bpButtonSyncCreateRight->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncCreateRight ), NULL, this ); - m_bpButtonConflict->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConflictFiles ), NULL, this ); - + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainDialogGenerated::OnClose ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnCompare ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnStartSync ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnSwitchView ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnNewConfig ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnSaveConfig ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnLoadConfig ) ); + this->Disconnect( wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuQuit ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuGlobalSettings ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuBatchJob ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuExportFileList ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnShowHelp ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuCheckVersion ) ); + this->Disconnect( wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuAbout ) ); + m_buttonCompare->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnCompare ), NULL, this ); + m_bpButtonCmpConfig->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnCmpSettings ), NULL, this ); + m_bpButtonSyncConfig->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncSettings ), NULL, this ); + m_buttonStartSync->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnStartSync ), NULL, this ); + m_dirPickerLeft->Disconnect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( MainDialogGenerated::OnDirSelected ), NULL, this ); + m_bpButtonSwapSides->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSwapSides ), NULL, this ); + m_bpButtonAddPair->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnAddFolderPair ), NULL, this ); + m_bpButtonRemovePair->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRemoveTopFolderPair ), NULL, this ); + m_dirPickerRight->Disconnect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( MainDialogGenerated::OnDirSelected ), NULL, this ); + m_gridLeft->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( MainDialogGenerated::OnLeftGridDoubleClick ), NULL, this ); + m_gridLeft->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( MainDialogGenerated::OnContextRim ), NULL, this ); + m_gridLeft->Disconnect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( MainDialogGenerated::OnSortLeftGrid ), NULL, this ); + m_gridLeft->Disconnect( wxEVT_GRID_LABEL_RIGHT_CLICK, wxGridEventHandler( MainDialogGenerated::OnContextRimLabelLeft ), NULL, this ); + m_gridMiddle->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( MainDialogGenerated::OnContextMiddle ), NULL, this ); + m_gridMiddle->Disconnect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( MainDialogGenerated::OnSortMiddleGrid ), NULL, this ); + m_gridMiddle->Disconnect( wxEVT_GRID_LABEL_RIGHT_CLICK, wxGridEventHandler( MainDialogGenerated::OnContextMiddleLabel ), NULL, this ); + m_gridRight->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( MainDialogGenerated::OnRightGridDoubleClick ), NULL, this ); + m_gridRight->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( MainDialogGenerated::OnContextRim ), NULL, this ); + m_gridRight->Disconnect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( MainDialogGenerated::OnSortRightGrid ), NULL, this ); + m_gridRight->Disconnect( wxEVT_GRID_LABEL_RIGHT_CLICK, wxGridEventHandler( MainDialogGenerated::OnContextRimLabelRight ), NULL, this ); + m_bpButtonSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSaveConfig ), NULL, this ); + m_bpButtonLoad->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnLoadConfig ), NULL, this ); + m_listBoxHistory->Disconnect( wxEVT_CHAR, wxKeyEventHandler( MainDialogGenerated::OnCfgHistoryKeyEvent ), NULL, this ); + m_listBoxHistory->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnLoadFromHistory ), NULL, this ); + m_bpButtonFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigureFilter ), NULL, this ); + m_checkBoxHideFilt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnHideFilteredButton ), NULL, this ); + m_bpButtonSyncCreateLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncCreateLeft ), NULL, this ); + m_bpButtonSyncDirOverwLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDirLeft ), NULL, this ); + m_bpButtonSyncDeleteLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDeleteLeft ), NULL, this ); + m_bpButtonLeftOnly->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnLeftOnlyFiles ), NULL, this ); + m_bpButtonLeftNewer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnLeftNewerFiles ), NULL, this ); + m_bpButtonEqual->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnEqualFiles ), NULL, this ); + m_bpButtonDifferent->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnDifferentFiles ), NULL, this ); + m_bpButtonSyncDirNone->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDirNone ), NULL, this ); + m_bpButtonRightNewer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRightNewerFiles ), NULL, this ); + m_bpButtonRightOnly->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRightOnlyFiles ), NULL, this ); + m_bpButtonSyncDeleteRight->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDeleteRight ), NULL, this ); + m_bpButtonSyncDirOverwRight->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDirRight ), NULL, this ); + m_bpButtonSyncCreateRight->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncCreateRight ), NULL, this ); + m_bpButtonConflict->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConflictFiles ), NULL, this ); + } FolderPairGenerated::FolderPairGenerated( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style ) { - wxBoxSizer* bSizer74; - bSizer74 = new wxBoxSizer( wxHORIZONTAL ); - - m_panelLeft = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer134; - bSizer134 = new wxBoxSizer( wxHORIZONTAL ); - - m_directoryLeft = new wxTextCtrl( m_panelLeft, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizer134->Add( m_directoryLeft, 1, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - m_dirPickerLeft = new wxDirPickerCtrl( m_panelLeft, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); - m_dirPickerLeft->SetToolTip( _("Select a folder") ); - - bSizer134->Add( m_dirPickerLeft, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_panelLeft->SetSizer( bSizer134 ); - m_panelLeft->Layout(); - bSizer134->Fit( m_panelLeft ); - bSizer74->Add( m_panelLeft, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_panel20 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer95; - bSizer95 = new wxBoxSizer( wxHORIZONTAL ); - - - bSizer95->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_bpButtonLocalFilter = new wxBitmapButton( m_panel20, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); - bSizer95->Add( m_bpButtonLocalFilter, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer95->Add( 5, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bpButtonAltSyncCfg = new wxBitmapButton( m_panel20, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); - bSizer95->Add( m_bpButtonAltSyncCfg, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer95->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_panel20->SetSizer( bSizer95 ); - m_panel20->Layout(); - bSizer95->Fit( m_panel20 ); - bSizer74->Add( m_panel20, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - - m_panelRight = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer135; - bSizer135 = new wxBoxSizer( wxHORIZONTAL ); - - m_bpButtonRemovePair = new wxBitmapButton( m_panelRight, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); - m_bpButtonRemovePair->SetToolTip( _("Remove folder pair") ); - - m_bpButtonRemovePair->SetToolTip( _("Remove folder pair") ); - - bSizer135->Add( m_bpButtonRemovePair, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - m_directoryRight = new wxTextCtrl( m_panelRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizer135->Add( m_directoryRight, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_dirPickerRight = new wxDirPickerCtrl( m_panelRight, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); - m_dirPickerRight->SetToolTip( _("Select a folder") ); - - bSizer135->Add( m_dirPickerRight, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_panelRight->SetSizer( bSizer135 ); - m_panelRight->Layout(); - bSizer135->Fit( m_panelRight ); - bSizer74->Add( m_panelRight, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - this->SetSizer( bSizer74 ); - this->Layout(); - bSizer74->Fit( this ); + wxBoxSizer* bSizer74; + bSizer74 = new wxBoxSizer( wxHORIZONTAL ); + + m_panelLeft = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer134; + bSizer134 = new wxBoxSizer( wxHORIZONTAL ); + + m_directoryLeft = new wxTextCtrl( m_panelLeft, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bSizer134->Add( m_directoryLeft, 1, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + m_dirPickerLeft = new wxDirPickerCtrl( m_panelLeft, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); + m_dirPickerLeft->SetToolTip( _("Select a folder") ); + + bSizer134->Add( m_dirPickerLeft, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_panelLeft->SetSizer( bSizer134 ); + m_panelLeft->Layout(); + bSizer134->Fit( m_panelLeft ); + bSizer74->Add( m_panelLeft, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_panel20 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer95; + bSizer95 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer95->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_bpButtonLocalFilter = new wxBitmapButton( m_panel20, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); + bSizer95->Add( m_bpButtonLocalFilter, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer95->Add( 5, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bpButtonAltSyncCfg = new wxBitmapButton( m_panel20, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); + bSizer95->Add( m_bpButtonAltSyncCfg, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer95->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_panel20->SetSizer( bSizer95 ); + m_panel20->Layout(); + bSizer95->Fit( m_panel20 ); + bSizer74->Add( m_panel20, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + m_panelRight = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer135; + bSizer135 = new wxBoxSizer( wxHORIZONTAL ); + + m_bpButtonRemovePair = new wxBitmapButton( m_panelRight, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); + m_bpButtonRemovePair->SetToolTip( _("Remove folder pair") ); + + m_bpButtonRemovePair->SetToolTip( _("Remove folder pair") ); + + bSizer135->Add( m_bpButtonRemovePair, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + m_directoryRight = new wxTextCtrl( m_panelRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bSizer135->Add( m_directoryRight, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_dirPickerRight = new wxDirPickerCtrl( m_panelRight, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); + m_dirPickerRight->SetToolTip( _("Select a folder") ); + + bSizer135->Add( m_dirPickerRight, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_panelRight->SetSizer( bSizer135 ); + m_panelRight->Layout(); + bSizer135->Fit( m_panelRight ); + bSizer74->Add( m_panelRight, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + this->SetSizer( bSizer74 ); + this->Layout(); + bSizer74->Fit( this ); } FolderPairGenerated::~FolderPairGenerated() @@ -882,113 +882,113 @@ FolderPairGenerated::~FolderPairGenerated() BatchFolderPairGenerated::BatchFolderPairGenerated( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style ) { - wxBoxSizer* bSizer142; - bSizer142 = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizer140; - bSizer140 = new wxBoxSizer( wxHORIZONTAL ); - - m_panel32 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDOUBLE_BORDER ); - wxBoxSizer* bSizer147; - bSizer147 = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* bSizer136; - bSizer136 = new wxBoxSizer( wxVERTICAL ); - - m_bpButtonRemovePair = new wxBitmapButton( m_panel32, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); - m_bpButtonRemovePair->SetToolTip( _("Remove folder pair") ); - - m_bpButtonRemovePair->SetToolTip( _("Remove folder pair") ); - - bSizer136->Add( m_bpButtonRemovePair, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer147->Add( bSizer136, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - wxBoxSizer* bSizer143; - bSizer143 = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizer145; - bSizer145 = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText53 = new wxStaticText( m_panel32, wxID_ANY, _("Left"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText53->Wrap( -1 ); - m_staticText53->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); - - bSizer145->Add( m_staticText53, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer143->Add( bSizer145, 1, 0, 5 ); - - wxBoxSizer* bSizer146; - bSizer146 = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText541 = new wxStaticText( m_panel32, wxID_ANY, _("Right"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText541->Wrap( -1 ); - m_staticText541->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); - - bSizer146->Add( m_staticText541, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer143->Add( bSizer146, 1, 0, 5 ); - - bSizer147->Add( bSizer143, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 ); - - m_panel32->SetSizer( bSizer147 ); - m_panel32->Layout(); - bSizer147->Fit( m_panel32 ); - bSizer140->Add( m_panel32, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - wxBoxSizer* bSizer144; - bSizer144 = new wxBoxSizer( wxVERTICAL ); - - m_panelLeft = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer114; - bSizer114 = new wxBoxSizer( wxHORIZONTAL ); - - m_directoryLeft = new wxTextCtrl( m_panelLeft, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizer114->Add( m_directoryLeft, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_dirPickerLeft = new wxDirPickerCtrl( m_panelLeft, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); - m_dirPickerLeft->SetToolTip( _("Select a folder") ); - - bSizer114->Add( m_dirPickerLeft, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bpButtonLocalFilter = new wxBitmapButton( m_panelLeft, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); - bSizer114->Add( m_bpButtonLocalFilter, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_panelLeft->SetSizer( bSizer114 ); - m_panelLeft->Layout(); - bSizer114->Fit( m_panelLeft ); - bSizer144->Add( m_panelLeft, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - m_panelRight = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer115; - bSizer115 = new wxBoxSizer( wxHORIZONTAL ); - - m_directoryRight = new wxTextCtrl( m_panelRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizer115->Add( m_directoryRight, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_dirPickerRight = new wxDirPickerCtrl( m_panelRight, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); - m_dirPickerRight->SetToolTip( _("Select a folder") ); - - bSizer115->Add( m_dirPickerRight, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bpButtonAltSyncCfg = new wxBitmapButton( m_panelRight, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); - bSizer115->Add( m_bpButtonAltSyncCfg, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_panelRight->SetSizer( bSizer115 ); - m_panelRight->Layout(); - bSizer115->Fit( m_panelRight ); - bSizer144->Add( m_panelRight, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer140->Add( bSizer144, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer142->Add( bSizer140, 0, wxEXPAND, 5 ); - - - bSizer142->Add( 0, 5, 0, 0, 5 ); - - this->SetSizer( bSizer142 ); - this->Layout(); - bSizer142->Fit( this ); + wxBoxSizer* bSizer142; + bSizer142 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer140; + bSizer140 = new wxBoxSizer( wxHORIZONTAL ); + + m_panel32 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDOUBLE_BORDER ); + wxBoxSizer* bSizer147; + bSizer147 = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizer136; + bSizer136 = new wxBoxSizer( wxVERTICAL ); + + m_bpButtonRemovePair = new wxBitmapButton( m_panel32, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); + m_bpButtonRemovePair->SetToolTip( _("Remove folder pair") ); + + m_bpButtonRemovePair->SetToolTip( _("Remove folder pair") ); + + bSizer136->Add( m_bpButtonRemovePair, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer147->Add( bSizer136, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + wxBoxSizer* bSizer143; + bSizer143 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer145; + bSizer145 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText53 = new wxStaticText( m_panel32, wxID_ANY, _("Left"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText53->Wrap( -1 ); + m_staticText53->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); + + bSizer145->Add( m_staticText53, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer143->Add( bSizer145, 1, 0, 5 ); + + wxBoxSizer* bSizer146; + bSizer146 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText541 = new wxStaticText( m_panel32, wxID_ANY, _("Right"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText541->Wrap( -1 ); + m_staticText541->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); + + bSizer146->Add( m_staticText541, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer143->Add( bSizer146, 1, 0, 5 ); + + bSizer147->Add( bSizer143, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + m_panel32->SetSizer( bSizer147 ); + m_panel32->Layout(); + bSizer147->Fit( m_panel32 ); + bSizer140->Add( m_panel32, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + wxBoxSizer* bSizer144; + bSizer144 = new wxBoxSizer( wxVERTICAL ); + + m_panelLeft = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer114; + bSizer114 = new wxBoxSizer( wxHORIZONTAL ); + + m_directoryLeft = new wxTextCtrl( m_panelLeft, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bSizer114->Add( m_directoryLeft, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_dirPickerLeft = new wxDirPickerCtrl( m_panelLeft, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); + m_dirPickerLeft->SetToolTip( _("Select a folder") ); + + bSizer114->Add( m_dirPickerLeft, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bpButtonLocalFilter = new wxBitmapButton( m_panelLeft, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); + bSizer114->Add( m_bpButtonLocalFilter, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_panelLeft->SetSizer( bSizer114 ); + m_panelLeft->Layout(); + bSizer114->Fit( m_panelLeft ); + bSizer144->Add( m_panelLeft, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + m_panelRight = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer115; + bSizer115 = new wxBoxSizer( wxHORIZONTAL ); + + m_directoryRight = new wxTextCtrl( m_panelRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bSizer115->Add( m_directoryRight, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_dirPickerRight = new wxDirPickerCtrl( m_panelRight, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); + m_dirPickerRight->SetToolTip( _("Select a folder") ); + + bSizer115->Add( m_dirPickerRight, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bpButtonAltSyncCfg = new wxBitmapButton( m_panelRight, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); + bSizer115->Add( m_bpButtonAltSyncCfg, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_panelRight->SetSizer( bSizer115 ); + m_panelRight->Layout(); + bSizer115->Fit( m_panelRight ); + bSizer144->Add( m_panelRight, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer140->Add( bSizer144, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer142->Add( bSizer140, 0, wxEXPAND, 5 ); + + + bSizer142->Add( 0, 5, 0, 0, 5 ); + + this->SetSizer( bSizer142 ); + this->Layout(); + bSizer142->Fit( this ); } BatchFolderPairGenerated::~BatchFolderPairGenerated() @@ -997,556 +997,573 @@ BatchFolderPairGenerated::~BatchFolderPairGenerated() BatchDlgGenerated::BatchDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxSize( 400,420 ), wxDefaultSize ); - - wxBoxSizer* bSizer54; - bSizer54 = new wxBoxSizer( wxVERTICAL ); - - bSizer69 = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizer87; - bSizer87 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmap27 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), 0 ); - bSizer87->Add( m_bitmap27, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_panel8 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER|wxTAB_TRAVERSAL ); - m_panel8->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DLIGHT ) ); - - wxBoxSizer* bSizer72; - bSizer72 = new wxBoxSizer( wxVERTICAL ); - - m_staticText56 = new wxStaticText( m_panel8, wxID_ANY, _("Batch job"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText56->Wrap( -1 ); - m_staticText56->SetFont( wxFont( 16, 70, 90, 92, false, wxEmptyString ) ); - - bSizer72->Add( m_staticText56, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_panel8->SetSizer( bSizer72 ); - m_panel8->Layout(); - bSizer72->Fit( m_panel8 ); - bSizer87->Add( m_panel8, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - - bSizer87->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer69->Add( bSizer87, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - - bSizer69->Add( 0, 5, 0, 0, 5 ); - - wxBoxSizer* bSizer70; - bSizer70 = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText44 = new wxStaticText( this, wxID_ANY, _("Assemble a batch file for automated synchronization. To start in batch mode simply pass the name of the file to the FreeFileSync executable: FreeFileSync.exe <batchfile>. This can also be scheduled in your operating system's task planner."), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText44->Wrap( 500 ); - bSizer70->Add( m_staticText44, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - m_bpButtonHelp = new wxBitmapButton( this, wxID_HELP, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - m_bpButtonHelp->SetToolTip( _("Help") ); - - m_bpButtonHelp->SetToolTip( _("Help") ); - - bSizer70->Add( m_bpButtonHelp, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - bSizer69->Add( bSizer70, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - - bSizer69->Add( 0, 5, 0, 0, 5 ); - - m_staticline10 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizer69->Add( m_staticline10, 0, wxEXPAND|wxTOP, 5 ); - - m_staticText531 = new wxStaticText( this, wxID_ANY, _("Configuration overview:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText531->Wrap( -1 ); - m_staticText531->SetFont( wxFont( 10, 74, 90, 92, false, wxT("Arial Black") ) ); - - bSizer69->Add( m_staticText531, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_notebookSettings = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); - m_panelOverview = new wxPanel( m_notebookSettings, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer67; - bSizer67 = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* bSizer120; - bSizer120 = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizer175; - bSizer175 = new wxBoxSizer( wxHORIZONTAL ); - - wxStaticBoxSizer* sbSizer241; - sbSizer241 = new wxStaticBoxSizer( new wxStaticBox( m_panelOverview, wxID_ANY, _("Compare") ), wxHORIZONTAL ); - - m_bpButtonCmpConfig = new wxBitmapButton( m_panelOverview, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,42 ), wxBU_AUTODRAW ); - m_bpButtonCmpConfig->SetToolTip( _("Comparison settings") ); - - m_bpButtonCmpConfig->SetToolTip( _("Comparison settings") ); - - sbSizer241->Add( m_bpButtonCmpConfig, 0, wxALIGN_CENTER_VERTICAL, 3 ); - - - sbSizer241->Add( 10, 0, 0, 0, 5 ); - - m_staticTextCmpVariant = new wxStaticText( m_panelOverview, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextCmpVariant->Wrap( -1 ); - m_staticTextCmpVariant->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); - m_staticTextCmpVariant->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) ); - - sbSizer241->Add( m_staticTextCmpVariant, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer175->Add( sbSizer241, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer175->Add( 0, 0, 1, wxEXPAND, 5 ); - - wxStaticBoxSizer* sbSizer26; - sbSizer26 = new wxStaticBoxSizer( new wxStaticBox( m_panelOverview, wxID_ANY, _("Filter files") ), wxVERTICAL ); - - m_bpButtonFilter = new wxBitmapButton( m_panelOverview, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW|wxFULL_REPAINT_ON_RESIZE ); - sbSizer26->Add( m_bpButtonFilter, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 15 ); - - bSizer175->Add( sbSizer26, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer175->Add( 0, 0, 1, wxEXPAND, 5 ); - - wxStaticBoxSizer* sbSizer252; - sbSizer252 = new wxStaticBoxSizer( new wxStaticBox( m_panelOverview, wxID_ANY, _("Synchronize...") ), wxHORIZONTAL ); - - m_staticTextSyncVariant = new wxStaticText( m_panelOverview, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextSyncVariant->Wrap( -1 ); - m_staticTextSyncVariant->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); - m_staticTextSyncVariant->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) ); - - sbSizer252->Add( m_staticTextSyncVariant, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - - sbSizer252->Add( 10, 0, 0, 0, 5 ); - - m_bpButtonSyncConfig = new wxBitmapButton( m_panelOverview, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,42 ), wxBU_AUTODRAW ); - m_bpButtonSyncConfig->SetToolTip( _("Synchronization settings") ); - - m_bpButtonSyncConfig->SetToolTip( _("Synchronization settings") ); - - sbSizer252->Add( m_bpButtonSyncConfig, 0, wxALIGN_CENTER_VERTICAL, 3 ); - - bSizer175->Add( sbSizer252, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer120->Add( bSizer175, 0, wxEXPAND, 5 ); - - - bSizer120->Add( 0, 5, 0, 0, 5 ); - - m_scrolledWindow6 = new wxScrolledWindow( m_panelOverview, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); - m_scrolledWindow6->SetScrollRate( 5, 5 ); - wxBoxSizer* bSizer141; - bSizer141 = new wxBoxSizer( wxVERTICAL ); - - sbSizerMainPair = new wxBoxSizer( wxHORIZONTAL ); - - m_panelMainPair = new wxPanel( m_scrolledWindow6, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDOUBLE_BORDER ); - wxBoxSizer* bSizer147; - bSizer147 = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* bSizer1361; - bSizer1361 = new wxBoxSizer( wxHORIZONTAL ); - - m_bpButtonAddPair = new wxBitmapButton( m_panelMainPair, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); - m_bpButtonAddPair->SetToolTip( _("Add folder pair") ); - - m_bpButtonAddPair->SetToolTip( _("Add folder pair") ); - - bSizer1361->Add( m_bpButtonAddPair, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 3 ); - - m_bpButtonRemovePair = new wxBitmapButton( m_panelMainPair, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); - m_bpButtonRemovePair->SetToolTip( _("Remove folder pair") ); - - m_bpButtonRemovePair->SetToolTip( _("Remove folder pair") ); - - bSizer1361->Add( m_bpButtonRemovePair, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - bSizer147->Add( bSizer1361, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - wxBoxSizer* bSizer143; - bSizer143 = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizer145; - bSizer145 = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText532 = new wxStaticText( m_panelMainPair, wxID_ANY, _("Left"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText532->Wrap( -1 ); - m_staticText532->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); - - bSizer145->Add( m_staticText532, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer143->Add( bSizer145, 1, 0, 5 ); - - wxBoxSizer* bSizer146; - bSizer146 = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText5411 = new wxStaticText( m_panelMainPair, wxID_ANY, _("Right"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText5411->Wrap( -1 ); - m_staticText5411->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); - - bSizer146->Add( m_staticText5411, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer143->Add( bSizer146, 1, 0, 5 ); - - bSizer147->Add( bSizer143, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - - m_panelMainPair->SetSizer( bSizer147 ); - m_panelMainPair->Layout(); - bSizer147->Fit( m_panelMainPair ); - sbSizerMainPair->Add( m_panelMainPair, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM, 5 ); - - wxBoxSizer* bSizer158; - bSizer158 = new wxBoxSizer( wxVERTICAL ); - - m_panelLeft = new wxPanel( m_scrolledWindow6, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer1141; - bSizer1141 = new wxBoxSizer( wxHORIZONTAL ); - - m_directoryLeft = new wxTextCtrl( m_panelLeft, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizer1141->Add( m_directoryLeft, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_dirPickerLeft = new wxDirPickerCtrl( m_panelLeft, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); - m_dirPickerLeft->SetToolTip( _("Select a folder") ); - - bSizer1141->Add( m_dirPickerLeft, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bpButtonLocalFilter = new wxBitmapButton( m_panelLeft, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); - bSizer1141->Add( m_bpButtonLocalFilter, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_panelLeft->SetSizer( bSizer1141 ); - m_panelLeft->Layout(); - bSizer1141->Fit( m_panelLeft ); - bSizer158->Add( m_panelLeft, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - m_panelRight = new wxPanel( m_scrolledWindow6, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer115; - bSizer115 = new wxBoxSizer( wxHORIZONTAL ); - - m_directoryRight = new wxTextCtrl( m_panelRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizer115->Add( m_directoryRight, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_dirPickerRight = new wxDirPickerCtrl( m_panelRight, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); - m_dirPickerRight->SetToolTip( _("Select a folder") ); - - bSizer115->Add( m_dirPickerRight, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bpButtonAltSyncCfg = new wxBitmapButton( m_panelRight, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); - bSizer115->Add( m_bpButtonAltSyncCfg, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_panelRight->SetSizer( bSizer115 ); - m_panelRight->Layout(); - bSizer115->Fit( m_panelRight ); - bSizer158->Add( m_panelRight, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - - sbSizerMainPair->Add( bSizer158, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 ); - - bSizer141->Add( sbSizerMainPair, 0, wxEXPAND, 5 ); - - bSizerAddFolderPairs = new wxBoxSizer( wxVERTICAL ); - - bSizer141->Add( bSizerAddFolderPairs, 0, wxEXPAND, 5 ); - - m_scrolledWindow6->SetSizer( bSizer141 ); - m_scrolledWindow6->Layout(); - bSizer141->Fit( m_scrolledWindow6 ); - bSizer120->Add( m_scrolledWindow6, 0, wxEXPAND, 5 ); - - - bSizer120->Add( 0, 5, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - wxFlexGridSizer* fgSizer15; - fgSizer15 = new wxFlexGridSizer( 1, 2, 10, 10 ); - fgSizer15->SetFlexibleDirection( wxBOTH ); - fgSizer15->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - wxStaticBoxSizer* sbSizer24; - sbSizer24 = new wxStaticBoxSizer( new wxStaticBox( m_panelOverview, wxID_ANY, _("Status feedback") ), wxVERTICAL ); - - - sbSizer24->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_checkBoxSilent = new wxCheckBox( m_panelOverview, wxID_ANY, _("Silent mode"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkBoxSilent->SetToolTip( _("Start minimized and write status information to a logfile") ); - - sbSizer24->Add( m_checkBoxSilent, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 14 ); - - - sbSizer24->Add( 0, 0, 1, wxEXPAND, 5 ); - - fgSizer15->Add( sbSizer24, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - wxStaticBoxSizer* sbSizer25; - sbSizer25 = new wxStaticBoxSizer( new wxStaticBox( m_panelOverview, wxID_ANY, _("Error handling") ), wxHORIZONTAL ); - - wxArrayString m_choiceHandleErrorChoices; - m_choiceHandleError = new wxChoice( m_panelOverview, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceHandleErrorChoices, 0 ); - m_choiceHandleError->SetSelection( 0 ); - sbSizer25->Add( m_choiceHandleError, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - fgSizer15->Add( sbSizer25, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer120->Add( fgSizer15, 0, 0, 5 ); - - bSizer67->Add( bSizer120, 1, wxALIGN_CENTER_VERTICAL|wxALL, 10 ); - - m_panelOverview->SetSizer( bSizer67 ); - m_panelOverview->Layout(); - bSizer67->Fit( m_panelOverview ); - m_notebookSettings->AddPage( m_panelOverview, _("Overview"), true ); - m_panelLogging = new wxPanel( m_notebookSettings, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer117; - bSizer117 = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizer119; - bSizer119 = new wxBoxSizer( wxVERTICAL ); - - m_staticText120 = new wxStaticText( m_panelLogging, wxID_ANY, _("Select logfile directory:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText120->Wrap( -1 ); - bSizer119->Add( m_staticText120, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - wxStaticBoxSizer* sbSizer251; - sbSizer251 = new wxStaticBoxSizer( new wxStaticBox( m_panelLogging, wxID_ANY, _("Drag && drop") ), wxHORIZONTAL ); - - m_textCtrlLogfileDir = new wxTextCtrl( m_panelLogging, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - sbSizer251->Add( m_textCtrlLogfileDir, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_dirPickerLogfileDir = new wxDirPickerCtrl( m_panelLogging, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); - m_dirPickerLogfileDir->SetToolTip( _("Select a folder") ); - - sbSizer251->Add( m_dirPickerLogfileDir, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer119->Add( sbSizer251, 1, wxEXPAND, 5 ); - - bSizer117->Add( bSizer119, 0, wxEXPAND|wxALL, 10 ); - - m_panelLogging->SetSizer( bSizer117 ); - m_panelLogging->Layout(); - bSizer117->Fit( m_panelLogging ); - m_notebookSettings->AddPage( m_panelLogging, _("Logging"), false ); - - bSizer69->Add( m_notebookSettings, 1, wxEXPAND, 5 ); - - wxBoxSizer* bSizer68; - bSizer68 = new wxBoxSizer( wxHORIZONTAL ); - - m_buttonSave = new wxButton( this, wxID_SAVE, _("&Save"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonSave->SetDefault(); - m_buttonSave->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); - - bSizer68->Add( m_buttonSave, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_buttonLoad = new wxButton( this, wxID_OPEN, _("&Load"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonLoad->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer68->Add( m_buttonLoad, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - m_button6 = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_button6->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer68->Add( m_button6, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer69->Add( bSizer68, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - bSizer54->Add( bSizer69, 1, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 5 ); - - this->SetSizer( bSizer54 ); - this->Layout(); - bSizer54->Fit( this ); - - this->Centre( wxBOTH ); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( BatchDlgGenerated::OnClose ) ); - m_bpButtonHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnHelp ), NULL, this ); - m_bpButtonCmpConfig->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCmpSettings ), NULL, this ); - m_bpButtonFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnConfigureFilter ), NULL, this ); - m_bpButtonSyncConfig->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnSyncSettings ), NULL, this ); - m_bpButtonAddPair->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnAddFolderPair ), NULL, this ); - m_bpButtonRemovePair->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnRemoveTopFolderPair ), NULL, this ); - m_checkBoxSilent->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCheckSilent ), NULL, this ); - m_choiceHandleError->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BatchDlgGenerated::OnChangeErrorHandling ), NULL, this ); - m_buttonSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnSaveBatchJob ), NULL, this ); - m_buttonLoad->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnLoadBatchJob ), NULL, this ); - m_button6->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCancel ), NULL, this ); + this->SetSizeHints( wxSize( 460,420 ), wxDefaultSize ); + + wxBoxSizer* bSizer54; + bSizer54 = new wxBoxSizer( wxVERTICAL ); + + bSizer69 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer87; + bSizer87 = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmap27 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), 0 ); + bSizer87->Add( m_bitmap27, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_panel8 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER|wxTAB_TRAVERSAL ); + m_panel8->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DLIGHT ) ); + + wxBoxSizer* bSizer72; + bSizer72 = new wxBoxSizer( wxVERTICAL ); + + m_staticText56 = new wxStaticText( m_panel8, wxID_ANY, _("Batch job"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText56->Wrap( -1 ); + m_staticText56->SetFont( wxFont( 16, 70, 90, 92, false, wxEmptyString ) ); + + bSizer72->Add( m_staticText56, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_panel8->SetSizer( bSizer72 ); + m_panel8->Layout(); + bSizer72->Fit( m_panel8 ); + bSizer87->Add( m_panel8, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + bSizer87->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer69->Add( bSizer87, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + + bSizer69->Add( 0, 5, 0, 0, 5 ); + + wxBoxSizer* bSizer70; + bSizer70 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText44 = new wxStaticText( this, wxID_ANY, _("Assemble a batch file for automated synchronization. To start in batch mode simply pass the name of the file to the FreeFileSync executable: FreeFileSync.exe <batchfile>. This can also be scheduled in your operating system's task planner."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText44->Wrap( 500 ); + bSizer70->Add( m_staticText44, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + m_bpButtonHelp = new wxBitmapButton( this, wxID_HELP, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + m_bpButtonHelp->SetToolTip( _("Help") ); + + m_bpButtonHelp->SetToolTip( _("Help") ); + + bSizer70->Add( m_bpButtonHelp, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + bSizer69->Add( bSizer70, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + + bSizer69->Add( 0, 5, 0, 0, 5 ); + + m_staticline10 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizer69->Add( m_staticline10, 0, wxEXPAND|wxTOP, 5 ); + + m_staticText531 = new wxStaticText( this, wxID_ANY, _("Configuration overview:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText531->Wrap( -1 ); + m_staticText531->SetFont( wxFont( 10, 74, 90, 92, false, wxT("Arial Black") ) ); + + bSizer69->Add( m_staticText531, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_notebookSettings = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + m_panelOverview = new wxPanel( m_notebookSettings, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer67; + bSizer67 = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizer120; + bSizer120 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer175; + bSizer175 = new wxBoxSizer( wxHORIZONTAL ); + + wxStaticBoxSizer* sbSizer241; + sbSizer241 = new wxStaticBoxSizer( new wxStaticBox( m_panelOverview, wxID_ANY, _("Compare") ), wxHORIZONTAL ); + + m_bpButtonCmpConfig = new wxBitmapButton( m_panelOverview, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,42 ), wxBU_AUTODRAW ); + m_bpButtonCmpConfig->SetToolTip( _("Comparison settings") ); + + m_bpButtonCmpConfig->SetToolTip( _("Comparison settings") ); + + sbSizer241->Add( m_bpButtonCmpConfig, 0, wxALIGN_CENTER_VERTICAL, 3 ); + + + sbSizer241->Add( 10, 0, 0, 0, 5 ); + + m_staticTextCmpVariant = new wxStaticText( m_panelOverview, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextCmpVariant->Wrap( -1 ); + m_staticTextCmpVariant->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); + m_staticTextCmpVariant->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) ); + + sbSizer241->Add( m_staticTextCmpVariant, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer175->Add( sbSizer241, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer175->Add( 0, 0, 1, wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer26; + sbSizer26 = new wxStaticBoxSizer( new wxStaticBox( m_panelOverview, wxID_ANY, _("Filter files") ), wxVERTICAL ); + + m_bpButtonFilter = new wxBitmapButton( m_panelOverview, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW|wxFULL_REPAINT_ON_RESIZE ); + sbSizer26->Add( m_bpButtonFilter, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 15 ); + + bSizer175->Add( sbSizer26, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer175->Add( 0, 0, 1, wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer252; + sbSizer252 = new wxStaticBoxSizer( new wxStaticBox( m_panelOverview, wxID_ANY, _("Synchronize...") ), wxHORIZONTAL ); + + m_staticTextSyncVariant = new wxStaticText( m_panelOverview, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextSyncVariant->Wrap( -1 ); + m_staticTextSyncVariant->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); + m_staticTextSyncVariant->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) ); + + sbSizer252->Add( m_staticTextSyncVariant, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + + sbSizer252->Add( 10, 0, 0, 0, 5 ); + + m_bpButtonSyncConfig = new wxBitmapButton( m_panelOverview, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,42 ), wxBU_AUTODRAW ); + m_bpButtonSyncConfig->SetToolTip( _("Synchronization settings") ); + + m_bpButtonSyncConfig->SetToolTip( _("Synchronization settings") ); + + sbSizer252->Add( m_bpButtonSyncConfig, 0, wxALIGN_CENTER_VERTICAL, 3 ); + + bSizer175->Add( sbSizer252, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer120->Add( bSizer175, 0, wxEXPAND, 5 ); + + + bSizer120->Add( 0, 5, 0, 0, 5 ); + + m_scrolledWindow6 = new wxScrolledWindow( m_panelOverview, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); + m_scrolledWindow6->SetScrollRate( 5, 5 ); + wxBoxSizer* bSizer141; + bSizer141 = new wxBoxSizer( wxVERTICAL ); + + sbSizerMainPair = new wxBoxSizer( wxHORIZONTAL ); + + m_panelMainPair = new wxPanel( m_scrolledWindow6, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDOUBLE_BORDER ); + wxBoxSizer* bSizer147; + bSizer147 = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizer1361; + bSizer1361 = new wxBoxSizer( wxHORIZONTAL ); + + m_bpButtonAddPair = new wxBitmapButton( m_panelMainPair, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); + m_bpButtonAddPair->SetToolTip( _("Add folder pair") ); + + m_bpButtonAddPair->SetToolTip( _("Add folder pair") ); + + bSizer1361->Add( m_bpButtonAddPair, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 3 ); + + m_bpButtonRemovePair = new wxBitmapButton( m_panelMainPair, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); + m_bpButtonRemovePair->SetToolTip( _("Remove folder pair") ); + + m_bpButtonRemovePair->SetToolTip( _("Remove folder pair") ); + + bSizer1361->Add( m_bpButtonRemovePair, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizer147->Add( bSizer1361, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + wxBoxSizer* bSizer143; + bSizer143 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer145; + bSizer145 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText532 = new wxStaticText( m_panelMainPair, wxID_ANY, _("Left"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText532->Wrap( -1 ); + m_staticText532->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); + + bSizer145->Add( m_staticText532, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer143->Add( bSizer145, 1, 0, 5 ); + + wxBoxSizer* bSizer146; + bSizer146 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText5411 = new wxStaticText( m_panelMainPair, wxID_ANY, _("Right"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText5411->Wrap( -1 ); + m_staticText5411->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); + + bSizer146->Add( m_staticText5411, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer143->Add( bSizer146, 1, 0, 5 ); + + bSizer147->Add( bSizer143, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + m_panelMainPair->SetSizer( bSizer147 ); + m_panelMainPair->Layout(); + bSizer147->Fit( m_panelMainPair ); + sbSizerMainPair->Add( m_panelMainPair, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM, 5 ); + + wxBoxSizer* bSizer158; + bSizer158 = new wxBoxSizer( wxVERTICAL ); + + m_panelLeft = new wxPanel( m_scrolledWindow6, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer1141; + bSizer1141 = new wxBoxSizer( wxHORIZONTAL ); + + m_directoryLeft = new wxTextCtrl( m_panelLeft, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bSizer1141->Add( m_directoryLeft, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_dirPickerLeft = new wxDirPickerCtrl( m_panelLeft, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); + m_dirPickerLeft->SetToolTip( _("Select a folder") ); + + bSizer1141->Add( m_dirPickerLeft, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bpButtonLocalFilter = new wxBitmapButton( m_panelLeft, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); + bSizer1141->Add( m_bpButtonLocalFilter, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_panelLeft->SetSizer( bSizer1141 ); + m_panelLeft->Layout(); + bSizer1141->Fit( m_panelLeft ); + bSizer158->Add( m_panelLeft, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + m_panelRight = new wxPanel( m_scrolledWindow6, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer115; + bSizer115 = new wxBoxSizer( wxHORIZONTAL ); + + m_directoryRight = new wxTextCtrl( m_panelRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bSizer115->Add( m_directoryRight, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_dirPickerRight = new wxDirPickerCtrl( m_panelRight, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); + m_dirPickerRight->SetToolTip( _("Select a folder") ); + + bSizer115->Add( m_dirPickerRight, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bpButtonAltSyncCfg = new wxBitmapButton( m_panelRight, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); + bSizer115->Add( m_bpButtonAltSyncCfg, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_panelRight->SetSizer( bSizer115 ); + m_panelRight->Layout(); + bSizer115->Fit( m_panelRight ); + bSizer158->Add( m_panelRight, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + sbSizerMainPair->Add( bSizer158, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 ); + + bSizer141->Add( sbSizerMainPair, 0, wxEXPAND, 5 ); + + bSizerAddFolderPairs = new wxBoxSizer( wxVERTICAL ); + + bSizer141->Add( bSizerAddFolderPairs, 1, wxEXPAND, 5 ); + + m_scrolledWindow6->SetSizer( bSizer141 ); + m_scrolledWindow6->Layout(); + bSizer141->Fit( m_scrolledWindow6 ); + bSizer120->Add( m_scrolledWindow6, 1, wxEXPAND, 5 ); + + + bSizer120->Add( 0, 5, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + wxFlexGridSizer* fgSizer15; + fgSizer15 = new wxFlexGridSizer( 1, 2, 10, 10 ); + fgSizer15->SetFlexibleDirection( wxBOTH ); + fgSizer15->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + wxStaticBoxSizer* sbSizer24; + sbSizer24 = new wxStaticBoxSizer( new wxStaticBox( m_panelOverview, wxID_ANY, _("Status feedback") ), wxVERTICAL ); + + + sbSizer24->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_checkBoxSilent = new wxCheckBox( m_panelOverview, wxID_ANY, _("Silent mode"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxSilent->SetToolTip( _("Start minimized and write status information to a logfile") ); + + sbSizer24->Add( m_checkBoxSilent, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 14 ); + + + sbSizer24->Add( 0, 0, 1, wxEXPAND, 5 ); + + fgSizer15->Add( sbSizer24, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer25; + sbSizer25 = new wxStaticBoxSizer( new wxStaticBox( m_panelOverview, wxID_ANY, _("Error handling") ), wxHORIZONTAL ); + + wxArrayString m_choiceHandleErrorChoices; + m_choiceHandleError = new wxChoice( m_panelOverview, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceHandleErrorChoices, 0 ); + m_choiceHandleError->SetSelection( 0 ); + sbSizer25->Add( m_choiceHandleError, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + fgSizer15->Add( sbSizer25, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer120->Add( fgSizer15, 0, 0, 5 ); + + bSizer67->Add( bSizer120, 1, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 10 ); + + m_panelOverview->SetSizer( bSizer67 ); + m_panelOverview->Layout(); + bSizer67->Fit( m_panelOverview ); + m_notebookSettings->AddPage( m_panelOverview, _("Overview"), true ); + m_panelLogging = new wxPanel( m_notebookSettings, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer117; + bSizer117 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer119; + bSizer119 = new wxBoxSizer( wxVERTICAL ); + + m_staticText120 = new wxStaticText( m_panelLogging, wxID_ANY, _("Select logfile directory:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText120->Wrap( -1 ); + bSizer119->Add( m_staticText120, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxStaticBoxSizer* sbSizer251; + sbSizer251 = new wxStaticBoxSizer( new wxStaticBox( m_panelLogging, wxID_ANY, _("Drag && drop") ), wxHORIZONTAL ); + + m_textCtrlLogfileDir = new wxTextCtrl( m_panelLogging, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + sbSizer251->Add( m_textCtrlLogfileDir, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_dirPickerLogfileDir = new wxDirPickerCtrl( m_panelLogging, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); + m_dirPickerLogfileDir->SetToolTip( _("Select a folder") ); + + sbSizer251->Add( m_dirPickerLogfileDir, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer119->Add( sbSizer251, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizer152; + bSizer152 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText96 = new wxStaticText( m_panelLogging, wxID_ANY, _("Maximum number of logfiles:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText96->Wrap( -1 ); + bSizer152->Add( m_staticText96, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer152->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_spinCtrlLogCountMax = new wxSpinCtrl( m_panelLogging, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 2000000000, 0 ); + bSizer152->Add( m_spinCtrlLogCountMax, 0, wxALL, 5 ); + + bSizer119->Add( bSizer152, 0, wxEXPAND, 5 ); + + bSizer117->Add( bSizer119, 0, wxEXPAND|wxALL, 10 ); + + m_panelLogging->SetSizer( bSizer117 ); + m_panelLogging->Layout(); + bSizer117->Fit( m_panelLogging ); + m_notebookSettings->AddPage( m_panelLogging, _("Logging"), false ); + + bSizer69->Add( m_notebookSettings, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizer68; + bSizer68 = new wxBoxSizer( wxHORIZONTAL ); + + m_buttonSave = new wxButton( this, wxID_SAVE, _("&Save"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonSave->SetDefault(); + m_buttonSave->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); + + bSizer68->Add( m_buttonSave, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_buttonLoad = new wxButton( this, wxID_OPEN, _("&Load"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonLoad->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer68->Add( m_buttonLoad, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + m_button6 = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_button6->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer68->Add( m_button6, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer69->Add( bSizer68, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizer54->Add( bSizer69, 1, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 5 ); + + this->SetSizer( bSizer54 ); + this->Layout(); + bSizer54->Fit( this ); + + this->Centre( wxBOTH ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( BatchDlgGenerated::OnClose ) ); + m_bpButtonHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnHelp ), NULL, this ); + m_bpButtonCmpConfig->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCmpSettings ), NULL, this ); + m_bpButtonFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnConfigureFilter ), NULL, this ); + m_bpButtonSyncConfig->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnSyncSettings ), NULL, this ); + m_bpButtonAddPair->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnAddFolderPair ), NULL, this ); + m_bpButtonRemovePair->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnRemoveTopFolderPair ), NULL, this ); + m_checkBoxSilent->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCheckSilent ), NULL, this ); + m_choiceHandleError->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BatchDlgGenerated::OnChangeErrorHandling ), NULL, this ); + m_spinCtrlLogCountMax->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BatchDlgGenerated::OnChangeMaxLogCountTxt ), NULL, this ); + m_buttonSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnSaveBatchJob ), NULL, this ); + m_buttonLoad->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnLoadBatchJob ), NULL, this ); + m_button6->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCancel ), NULL, this ); } BatchDlgGenerated::~BatchDlgGenerated() { - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( BatchDlgGenerated::OnClose ) ); - m_bpButtonHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnHelp ), NULL, this ); - m_bpButtonCmpConfig->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCmpSettings ), NULL, this ); - m_bpButtonFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnConfigureFilter ), NULL, this ); - m_bpButtonSyncConfig->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnSyncSettings ), NULL, this ); - m_bpButtonAddPair->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnAddFolderPair ), NULL, this ); - m_bpButtonRemovePair->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnRemoveTopFolderPair ), NULL, this ); - m_checkBoxSilent->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCheckSilent ), NULL, this ); - m_choiceHandleError->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BatchDlgGenerated::OnChangeErrorHandling ), NULL, this ); - m_buttonSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnSaveBatchJob ), NULL, this ); - m_buttonLoad->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnLoadBatchJob ), NULL, this ); - m_button6->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCancel ), NULL, this ); - + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( BatchDlgGenerated::OnClose ) ); + m_bpButtonHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnHelp ), NULL, this ); + m_bpButtonCmpConfig->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCmpSettings ), NULL, this ); + m_bpButtonFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnConfigureFilter ), NULL, this ); + m_bpButtonSyncConfig->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnSyncSettings ), NULL, this ); + m_bpButtonAddPair->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnAddFolderPair ), NULL, this ); + m_bpButtonRemovePair->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnRemoveTopFolderPair ), NULL, this ); + m_checkBoxSilent->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCheckSilent ), NULL, this ); + m_choiceHandleError->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BatchDlgGenerated::OnChangeErrorHandling ), NULL, this ); + m_spinCtrlLogCountMax->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BatchDlgGenerated::OnChangeMaxLogCountTxt ), NULL, this ); + m_buttonSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnSaveBatchJob ), NULL, this ); + m_buttonLoad->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnLoadBatchJob ), NULL, this ); + m_button6->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCancel ), NULL, this ); + } CompareStatusGenerated::CompareStatusGenerated( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style ) { - wxBoxSizer* bSizer40; - bSizer40 = new wxBoxSizer( wxVERTICAL ); - - - bSizer40->Add( 0, 0, 1, wxEXPAND, 5 ); - - bSizer42 = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* bSizer157; - bSizer157 = new wxBoxSizer( wxVERTICAL ); - - bSizerFilesFound = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText321 = new wxStaticText( this, wxID_ANY, _("Elements found:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText321->Wrap( -1 ); - m_staticText321->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizerFilesFound->Add( m_staticText321, 0, wxALIGN_BOTTOM, 5 ); - - m_staticTextScanned = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextScanned->Wrap( -1 ); - m_staticTextScanned->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); - - bSizerFilesFound->Add( m_staticTextScanned, 0, wxALIGN_BOTTOM|wxLEFT, 5 ); - - bSizer157->Add( bSizerFilesFound, 0, 0, 5 ); - - bSizerFilesRemaining = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText46 = new wxStaticText( this, wxID_ANY, _("Elements remaining:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText46->Wrap( -1 ); - m_staticText46->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizerFilesRemaining->Add( m_staticText46, 0, wxALIGN_BOTTOM, 5 ); - - wxBoxSizer* bSizer154; - bSizer154 = new wxBoxSizer( wxHORIZONTAL ); - - m_staticTextFilesRemaining = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextFilesRemaining->Wrap( -1 ); - m_staticTextFilesRemaining->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); - - bSizer154->Add( m_staticTextFilesRemaining, 0, wxALIGN_BOTTOM, 5 ); - - m_staticText117 = new wxStaticText( this, wxID_ANY, _("("), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText117->Wrap( -1 ); - m_staticText117->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Arial") ) ); - - bSizer154->Add( m_staticText117, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); - - m_staticTextDataRemaining = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextDataRemaining->Wrap( -1 ); - m_staticTextDataRemaining->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Arial") ) ); - - bSizer154->Add( m_staticTextDataRemaining, 0, wxALIGN_BOTTOM, 5 ); - - m_staticText118 = new wxStaticText( this, wxID_ANY, _(")"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText118->Wrap( -1 ); - m_staticText118->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Arial") ) ); - - bSizer154->Add( m_staticText118, 0, wxALIGN_BOTTOM, 5 ); - - bSizerFilesRemaining->Add( bSizer154, 0, wxALIGN_BOTTOM|wxLEFT, 5 ); - - bSizer157->Add( bSizerFilesRemaining, 0, 0, 5 ); - - bSizer42->Add( bSizer157, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer42->Add( 0, 0, 1, wxEXPAND, 5 ); - - sSizerSpeed = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText104 = new wxStaticText( this, wxID_ANY, _("Speed:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText104->Wrap( -1 ); - m_staticText104->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - sSizerSpeed->Add( m_staticText104, 0, wxALIGN_BOTTOM, 5 ); - - m_staticTextSpeed = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextSpeed->Wrap( -1 ); - m_staticTextSpeed->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); - - sSizerSpeed->Add( m_staticTextSpeed, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); - - bSizer42->Add( sSizerSpeed, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer42->Add( 10, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - sSizerTimeRemaining = new wxBoxSizer( wxHORIZONTAL ); - - m_staticTextTimeRemFixed = new wxStaticText( this, wxID_ANY, _("Time remaining:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextTimeRemFixed->Wrap( -1 ); - m_staticTextTimeRemFixed->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - sSizerTimeRemaining->Add( m_staticTextTimeRemFixed, 0, wxALIGN_BOTTOM, 5 ); - - m_staticTextTimeRemaining = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextTimeRemaining->Wrap( -1 ); - m_staticTextTimeRemaining->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); - - sSizerTimeRemaining->Add( m_staticTextTimeRemaining, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); - - bSizer42->Add( sSizerTimeRemaining, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer42->Add( 0, 0, 1, wxEXPAND, 5 ); - - sSizerTimeElapsed = new wxBoxSizer( wxHORIZONTAL ); - - wxStaticText* m_staticText37; - m_staticText37 = new wxStaticText( this, wxID_ANY, _("Time elapsed:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText37->Wrap( -1 ); - m_staticText37->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - sSizerTimeElapsed->Add( m_staticText37, 0, wxALIGN_BOTTOM, 5 ); - - m_staticTextTimeElapsed = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextTimeElapsed->Wrap( -1 ); - m_staticTextTimeElapsed->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); - - sSizerTimeElapsed->Add( m_staticTextTimeElapsed, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); - - bSizer42->Add( sSizerTimeElapsed, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer40->Add( bSizer42, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - wxBoxSizer* bSizer48; - bSizer48 = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText30 = new wxStaticText( this, wxID_ANY, _("Operation:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText30->Wrap( -1 ); - m_staticText30->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); - - bSizer48->Add( m_staticText30, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 ); - - m_textCtrlStatus = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); - m_textCtrlStatus->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - - bSizer48->Add( m_textCtrlStatus, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer40->Add( bSizer48, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_gauge2 = new wxGauge( this, wxID_ANY, 100, wxDefaultPosition, wxSize( -1,14 ), wxGA_HORIZONTAL|wxGA_SMOOTH ); - bSizer40->Add( m_gauge2, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - - - bSizer40->Add( 0, 0, 1, wxEXPAND, 5 ); - - this->SetSizer( bSizer40 ); - this->Layout(); - bSizer40->Fit( this ); + wxBoxSizer* bSizer40; + bSizer40 = new wxBoxSizer( wxVERTICAL ); + + + bSizer40->Add( 0, 0, 1, wxEXPAND, 5 ); + + bSizer42 = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizer157; + bSizer157 = new wxBoxSizer( wxVERTICAL ); + + bSizerFilesFound = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText321 = new wxStaticText( this, wxID_ANY, _("Elements found:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText321->Wrap( -1 ); + m_staticText321->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizerFilesFound->Add( m_staticText321, 0, wxALIGN_BOTTOM, 5 ); + + m_staticTextScanned = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextScanned->Wrap( -1 ); + m_staticTextScanned->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); + + bSizerFilesFound->Add( m_staticTextScanned, 0, wxALIGN_BOTTOM|wxLEFT, 5 ); + + bSizer157->Add( bSizerFilesFound, 0, 0, 5 ); + + bSizerFilesRemaining = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText46 = new wxStaticText( this, wxID_ANY, _("Elements remaining:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText46->Wrap( -1 ); + m_staticText46->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizerFilesRemaining->Add( m_staticText46, 0, wxALIGN_BOTTOM, 5 ); + + wxBoxSizer* bSizer154; + bSizer154 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticTextFilesRemaining = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextFilesRemaining->Wrap( -1 ); + m_staticTextFilesRemaining->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); + + bSizer154->Add( m_staticTextFilesRemaining, 0, wxALIGN_BOTTOM, 5 ); + + m_staticText117 = new wxStaticText( this, wxID_ANY, _("("), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText117->Wrap( -1 ); + m_staticText117->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Arial") ) ); + + bSizer154->Add( m_staticText117, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); + + m_staticTextDataRemaining = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextDataRemaining->Wrap( -1 ); + m_staticTextDataRemaining->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Arial") ) ); + + bSizer154->Add( m_staticTextDataRemaining, 0, wxALIGN_BOTTOM, 5 ); + + m_staticText118 = new wxStaticText( this, wxID_ANY, _(")"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText118->Wrap( -1 ); + m_staticText118->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Arial") ) ); + + bSizer154->Add( m_staticText118, 0, wxALIGN_BOTTOM, 5 ); + + bSizerFilesRemaining->Add( bSizer154, 0, wxALIGN_BOTTOM|wxLEFT, 5 ); + + bSizer157->Add( bSizerFilesRemaining, 0, 0, 5 ); + + bSizer42->Add( bSizer157, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer42->Add( 0, 0, 1, wxEXPAND, 5 ); + + sSizerSpeed = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText104 = new wxStaticText( this, wxID_ANY, _("Speed:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText104->Wrap( -1 ); + m_staticText104->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + sSizerSpeed->Add( m_staticText104, 0, wxALIGN_BOTTOM, 5 ); + + m_staticTextSpeed = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextSpeed->Wrap( -1 ); + m_staticTextSpeed->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); + + sSizerSpeed->Add( m_staticTextSpeed, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); + + bSizer42->Add( sSizerSpeed, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer42->Add( 10, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + sSizerTimeRemaining = new wxBoxSizer( wxHORIZONTAL ); + + m_staticTextTimeRemFixed = new wxStaticText( this, wxID_ANY, _("Time remaining:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextTimeRemFixed->Wrap( -1 ); + m_staticTextTimeRemFixed->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + sSizerTimeRemaining->Add( m_staticTextTimeRemFixed, 0, wxALIGN_BOTTOM, 5 ); + + m_staticTextTimeRemaining = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextTimeRemaining->Wrap( -1 ); + m_staticTextTimeRemaining->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); + + sSizerTimeRemaining->Add( m_staticTextTimeRemaining, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); + + bSizer42->Add( sSizerTimeRemaining, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer42->Add( 0, 0, 1, wxEXPAND, 5 ); + + sSizerTimeElapsed = new wxBoxSizer( wxHORIZONTAL ); + + wxStaticText* m_staticText37; + m_staticText37 = new wxStaticText( this, wxID_ANY, _("Time elapsed:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText37->Wrap( -1 ); + m_staticText37->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + sSizerTimeElapsed->Add( m_staticText37, 0, wxALIGN_BOTTOM, 5 ); + + m_staticTextTimeElapsed = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextTimeElapsed->Wrap( -1 ); + m_staticTextTimeElapsed->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); + + sSizerTimeElapsed->Add( m_staticTextTimeElapsed, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); + + bSizer42->Add( sSizerTimeElapsed, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer40->Add( bSizer42, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizer48; + bSizer48 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText30 = new wxStaticText( this, wxID_ANY, _("Operation:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText30->Wrap( -1 ); + m_staticText30->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); + + bSizer48->Add( m_staticText30, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 ); + + m_textCtrlStatus = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); + m_textCtrlStatus->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + + bSizer48->Add( m_textCtrlStatus, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer40->Add( bSizer48, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_gauge2 = new wxGauge( this, wxID_ANY, 100, wxDefaultPosition, wxSize( -1,14 ), wxGA_HORIZONTAL|wxGA_SMOOTH ); + bSizer40->Add( m_gauge2, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + + bSizer40->Add( 0, 0, 1, wxEXPAND, 5 ); + + this->SetSizer( bSizer40 ); + this->Layout(); + bSizer40->Fit( this ); } CompareStatusGenerated::~CompareStatusGenerated() @@ -1555,2114 +1572,2161 @@ CompareStatusGenerated::~CompareStatusGenerated() SyncCfgDlgGenerated::SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bSizer7; - bSizer7 = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizer181; - bSizer181 = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* bSizer29; - bSizer29 = new wxBoxSizer( wxVERTICAL ); - - wxStaticBoxSizer* sbSizer7; - sbSizer7 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL ); - - m_staticText1 = new wxStaticText( this, wxID_ANY, _("Select variant:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText1->Wrap( -1 ); - m_staticText1->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); - - sbSizer7->Add( m_staticText1, 0, wxALL, 5 ); - - wxFlexGridSizer* fgSizer1; - fgSizer1 = new wxFlexGridSizer( 4, 3, 8, 5 ); - fgSizer1->SetFlexibleDirection( wxHORIZONTAL ); - fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - m_radioBtnAutomatic = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_radioBtnAutomatic->SetValue( true ); - m_radioBtnAutomatic->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - - fgSizer1->Add( m_radioBtnAutomatic, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_buttonAutomatic = new wxButton( this, wxID_ANY, _("<Automatic>"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); - m_buttonAutomatic->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - - fgSizer1->Add( m_buttonAutomatic, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - m_staticText81 = new wxStaticText( this, wxID_ANY, _("Identify and propagate changes on both sides using a database. Deletions and conflicts are detected automatically."), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText81->Wrap( 300 ); - fgSizer1->Add( m_staticText81, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - m_radioBtnMirror = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_radioBtnMirror->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - - fgSizer1->Add( m_radioBtnMirror, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_buttonOneWay = new wxButton( this, wxID_ANY, _("Mirror ->>"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); - m_buttonOneWay->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - - fgSizer1->Add( m_buttonOneWay, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - m_staticText8 = new wxStaticText( this, wxID_ANY, _("Mirror backup of left folder: Right folder will be overwritten and exactly match left folder after synchronization."), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText8->Wrap( 300 ); - fgSizer1->Add( m_staticText8, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - - m_radioBtnUpdate = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_radioBtnUpdate->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - - fgSizer1->Add( m_radioBtnUpdate, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_buttonUpdate = new wxButton( this, wxID_ANY, _("Update ->"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); - m_buttonUpdate->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - - fgSizer1->Add( m_buttonUpdate, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - m_staticText101 = new wxStaticText( this, wxID_ANY, _("Copy new or updated files to right folder."), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText101->Wrap( 300 ); - fgSizer1->Add( m_staticText101, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - m_radioBtnCustom = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_radioBtnCustom->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - m_radioBtnCustom->Enable( false ); - - fgSizer1->Add( m_radioBtnCustom, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - wxBoxSizer* bSizer65; - bSizer65 = new wxBoxSizer( wxVERTICAL ); - - - bSizer65->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_staticText23 = new wxStaticText( this, wxID_ANY, _("Custom"), wxDefaultPosition, wxSize( -1,-1 ), wxALIGN_CENTRE|wxSTATIC_BORDER ); - m_staticText23->Wrap( -1 ); - m_staticText23->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - - bSizer65->Add( m_staticText23, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - - bSizer65->Add( 0, 0, 1, wxEXPAND, 5 ); - - fgSizer1->Add( bSizer65, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - m_staticText9 = new wxStaticText( this, wxID_ANY, _("Configure your own synchronization rules."), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText9->Wrap( 300 ); - fgSizer1->Add( m_staticText9, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - sbSizer7->Add( fgSizer1, 0, 0, 5 ); - - bSizer29->Add( sbSizer7, 0, wxEXPAND, 5 ); - - - bSizer29->Add( 0, 5, 1, 0, 5 ); - - bSizer201 = new wxBoxSizer( wxHORIZONTAL ); - - sbSizerErrorHandling = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Error handling") ), wxHORIZONTAL ); - - wxArrayString m_choiceHandleErrorChoices; - m_choiceHandleError = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceHandleErrorChoices, 0 ); - m_choiceHandleError->SetSelection( 0 ); - sbSizerErrorHandling->Add( m_choiceHandleError, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer201->Add( sbSizerErrorHandling, 0, wxEXPAND|wxRIGHT, 10 ); - - wxStaticBoxSizer* sbSizer231; - sbSizer231 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Deletion handling") ), wxVERTICAL ); - - wxArrayString m_choiceHandleDeletionChoices; - m_choiceHandleDeletion = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceHandleDeletionChoices, 0 ); - m_choiceHandleDeletion->SetSelection( 0 ); - sbSizer231->Add( m_choiceHandleDeletion, 0, wxBOTTOM, 5 ); - - m_panelCustomDeletionDir = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer1151; - bSizer1151 = new wxBoxSizer( wxHORIZONTAL ); - - m_textCtrlCustomDelFolder = new wxTextCtrl( m_panelCustomDeletionDir, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_textCtrlCustomDelFolder->SetMinSize( wxSize( 200,-1 ) ); - - bSizer1151->Add( m_textCtrlCustomDelFolder, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_dirPickerCustomDelFolder = new wxDirPickerCtrl( m_panelCustomDeletionDir, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer1151->Add( m_dirPickerCustomDelFolder, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_panelCustomDeletionDir->SetSizer( bSizer1151 ); - m_panelCustomDeletionDir->Layout(); - bSizer1151->Fit( m_panelCustomDeletionDir ); - sbSizer231->Add( m_panelCustomDeletionDir, 0, 0, 5 ); - - bSizer201->Add( sbSizer231, 0, wxEXPAND, 5 ); - - bSizer29->Add( bSizer201, 0, wxTOP|wxBOTTOM, 5 ); - - - bSizer29->Add( 0, 5, 1, 0, 5 ); - - wxBoxSizer* bSizer291; - bSizer291 = new wxBoxSizer( wxHORIZONTAL ); - - m_buttonOK = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonOK->SetDefault(); - m_buttonOK->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); - - bSizer291->Add( m_buttonOK, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - m_button16 = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_button16->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer291->Add( m_button16, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer291->Add( 20, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer29->Add( bSizer291, 0, wxEXPAND, 5 ); - - bSizer181->Add( bSizer29, 0, wxEXPAND, 5 ); - - - bSizer181->Add( 10, 0, 0, 0, 5 ); - - sbSizerSyncDirections = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Configuration") ), wxVERTICAL ); - - wxGridSizer* gSizer3; - gSizer3 = new wxGridSizer( 1, 2, 0, 5 ); - - m_staticText21 = new wxStaticText( this, wxID_ANY, _("Category"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText21->Wrap( -1 ); - m_staticText21->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); - - gSizer3->Add( m_staticText21, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticText31 = new wxStaticText( this, wxID_ANY, _("Action"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText31->Wrap( -1 ); - m_staticText31->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); - - gSizer3->Add( m_staticText31, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - sbSizerSyncDirections->Add( gSizer3, 0, wxEXPAND, 5 ); - - m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - sbSizerSyncDirections->Add( m_staticline3, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxBOTTOM, 5 ); - - wxBoxSizer* bSizer121; - bSizer121 = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizer122; - bSizer122 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapLeftOnly = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); - m_bitmapLeftOnly->SetToolTip( _("Files/folders that exist on left side only") ); - - bSizer122->Add( m_bitmapLeftOnly, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer122->Add( 5, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bpButtonLeftOnly = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizer122->Add( m_bpButtonLeftOnly, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer121->Add( bSizer122, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - wxBoxSizer* bSizer123; - bSizer123 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapRightOnly = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); - m_bitmapRightOnly->SetToolTip( _("Files/folders that exist on right side only") ); - - bSizer123->Add( m_bitmapRightOnly, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer123->Add( 5, 0, 0, 0, 5 ); - - m_bpButtonRightOnly = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizer123->Add( m_bpButtonRightOnly, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer121->Add( bSizer123, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - wxBoxSizer* bSizer124; - bSizer124 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapLeftNewer = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); - m_bitmapLeftNewer->SetToolTip( _("Files that exist on both sides, left one is newer") ); - - bSizer124->Add( m_bitmapLeftNewer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer124->Add( 5, 0, 0, 0, 5 ); - - m_bpButtonLeftNewer = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizer124->Add( m_bpButtonLeftNewer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer121->Add( bSizer124, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - wxBoxSizer* bSizer125; - bSizer125 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapRightNewer = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); - m_bitmapRightNewer->SetToolTip( _("Files that exist on both sides, right one is newer") ); - - bSizer125->Add( m_bitmapRightNewer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer125->Add( 5, 0, 0, 0, 5 ); - - m_bpButtonRightNewer = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizer125->Add( m_bpButtonRightNewer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer121->Add( bSizer125, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - wxBoxSizer* bSizer126; - bSizer126 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapDifferent = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); - m_bitmapDifferent->SetToolTip( _("Files that have different content") ); - - bSizer126->Add( m_bitmapDifferent, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer126->Add( 5, 0, 0, 0, 5 ); - - m_bpButtonDifferent = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizer126->Add( m_bpButtonDifferent, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer121->Add( bSizer126, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - wxBoxSizer* bSizer127; - bSizer127 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapConflict = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); - m_bitmapConflict->SetToolTip( _("Conflicts/files that cannot be categorized") ); - - bSizer127->Add( m_bitmapConflict, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer127->Add( 5, 0, 0, 0, 5 ); - - m_bpButtonConflict = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizer127->Add( m_bpButtonConflict, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer121->Add( bSizer127, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - sbSizerSyncDirections->Add( bSizer121, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - bSizer181->Add( sbSizerSyncDirections, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - bSizer7->Add( bSizer181, 0, wxALL, 5 ); - - this->SetSizer( bSizer7 ); - this->Layout(); - bSizer7->Fit( this ); - - this->Centre( wxBOTH ); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SyncCfgDlgGenerated::OnClose ) ); - m_radioBtnAutomatic->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncAutomatic ), NULL, this ); - m_buttonAutomatic->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncAutomatic ), NULL, this ); - m_radioBtnMirror->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncLeftToRight ), NULL, this ); - m_buttonOneWay->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncLeftToRight ), NULL, this ); - m_radioBtnUpdate->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncUpdate ), NULL, this ); - m_buttonUpdate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncUpdate ), NULL, this ); - m_radioBtnCustom->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncCustom ), NULL, this ); - m_choiceHandleError->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnChangeErrorHandling ), NULL, this ); - m_choiceHandleDeletion->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnChangeDeletionHandling ), NULL, this ); - m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnApply ), NULL, this ); - m_button16->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnCancel ), NULL, this ); - m_bpButtonLeftOnly->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnExLeftSideOnly ), NULL, this ); - m_bpButtonRightOnly->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnExRightSideOnly ), NULL, this ); - m_bpButtonLeftNewer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnLeftNewer ), NULL, this ); - m_bpButtonRightNewer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnRightNewer ), NULL, this ); - m_bpButtonDifferent->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnDifferent ), NULL, this ); - m_bpButtonConflict->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnConflict ), NULL, this ); + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer7; + bSizer7 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer181; + bSizer181 = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizer29; + bSizer29 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer7; + sbSizer7 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL ); + + m_staticText1 = new wxStaticText( this, wxID_ANY, _("Select variant:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText1->Wrap( -1 ); + m_staticText1->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); + + sbSizer7->Add( m_staticText1, 0, wxALL, 5 ); + + wxFlexGridSizer* fgSizer1; + fgSizer1 = new wxFlexGridSizer( 4, 3, 8, 5 ); + fgSizer1->SetFlexibleDirection( wxHORIZONTAL ); + fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_radioBtnAutomatic = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_radioBtnAutomatic->SetValue( true ); + m_radioBtnAutomatic->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); + + fgSizer1->Add( m_radioBtnAutomatic, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_buttonAutomatic = new wxButton( this, wxID_ANY, _("<Automatic>"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); + m_buttonAutomatic->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); + + fgSizer1->Add( m_buttonAutomatic, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + m_staticText81 = new wxStaticText( this, wxID_ANY, _("Identify and propagate changes on both sides using a database. Deletions and conflicts are detected automatically."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText81->Wrap( 300 ); + fgSizer1->Add( m_staticText81, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + m_radioBtnMirror = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_radioBtnMirror->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); + + fgSizer1->Add( m_radioBtnMirror, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_buttonOneWay = new wxButton( this, wxID_ANY, _("Mirror ->>"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); + m_buttonOneWay->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); + + fgSizer1->Add( m_buttonOneWay, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + m_staticText8 = new wxStaticText( this, wxID_ANY, _("Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText8->Wrap( 300 ); + fgSizer1->Add( m_staticText8, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + m_radioBtnUpdate = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_radioBtnUpdate->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); + + fgSizer1->Add( m_radioBtnUpdate, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_buttonUpdate = new wxButton( this, wxID_ANY, _("Update ->"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); + m_buttonUpdate->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); + + fgSizer1->Add( m_buttonUpdate, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + m_staticText101 = new wxStaticText( this, wxID_ANY, _("Copy new or updated files to right folder."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText101->Wrap( 300 ); + fgSizer1->Add( m_staticText101, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + m_radioBtnCustom = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_radioBtnCustom->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); + m_radioBtnCustom->Enable( false ); + + fgSizer1->Add( m_radioBtnCustom, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + wxBoxSizer* bSizer65; + bSizer65 = new wxBoxSizer( wxVERTICAL ); + + + bSizer65->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_staticText23 = new wxStaticText( this, wxID_ANY, _("Custom"), wxDefaultPosition, wxSize( -1,-1 ), wxALIGN_CENTRE|wxSTATIC_BORDER ); + m_staticText23->Wrap( -1 ); + m_staticText23->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); + + bSizer65->Add( m_staticText23, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + + bSizer65->Add( 0, 0, 1, wxEXPAND, 5 ); + + fgSizer1->Add( bSizer65, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + m_staticText9 = new wxStaticText( this, wxID_ANY, _("Configure your own synchronization rules."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText9->Wrap( 300 ); + fgSizer1->Add( m_staticText9, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + sbSizer7->Add( fgSizer1, 0, 0, 5 ); + + bSizer29->Add( sbSizer7, 0, wxEXPAND, 5 ); + + + bSizer29->Add( 0, 5, 1, 0, 5 ); + + bSizer201 = new wxBoxSizer( wxHORIZONTAL ); + + sbSizerErrorHandling = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Error handling") ), wxHORIZONTAL ); + + wxArrayString m_choiceHandleErrorChoices; + m_choiceHandleError = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceHandleErrorChoices, 0 ); + m_choiceHandleError->SetSelection( 0 ); + sbSizerErrorHandling->Add( m_choiceHandleError, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer201->Add( sbSizerErrorHandling, 0, wxEXPAND|wxRIGHT, 10 ); + + wxStaticBoxSizer* sbSizer231; + sbSizer231 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Deletion handling") ), wxVERTICAL ); + + wxArrayString m_choiceHandleDeletionChoices; + m_choiceHandleDeletion = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceHandleDeletionChoices, 0 ); + m_choiceHandleDeletion->SetSelection( 0 ); + sbSizer231->Add( m_choiceHandleDeletion, 0, wxBOTTOM, 5 ); + + m_panelCustomDeletionDir = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer1151; + bSizer1151 = new wxBoxSizer( wxHORIZONTAL ); + + m_textCtrlCustomDelFolder = new wxTextCtrl( m_panelCustomDeletionDir, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_textCtrlCustomDelFolder->SetMinSize( wxSize( 200,-1 ) ); + + bSizer1151->Add( m_textCtrlCustomDelFolder, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_dirPickerCustomDelFolder = new wxDirPickerCtrl( m_panelCustomDeletionDir, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer1151->Add( m_dirPickerCustomDelFolder, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_panelCustomDeletionDir->SetSizer( bSizer1151 ); + m_panelCustomDeletionDir->Layout(); + bSizer1151->Fit( m_panelCustomDeletionDir ); + sbSizer231->Add( m_panelCustomDeletionDir, 0, 0, 5 ); + + bSizer201->Add( sbSizer231, 0, wxEXPAND, 5 ); + + bSizer29->Add( bSizer201, 0, wxTOP|wxBOTTOM, 5 ); + + + bSizer29->Add( 0, 5, 1, 0, 5 ); + + wxBoxSizer* bSizer291; + bSizer291 = new wxBoxSizer( wxHORIZONTAL ); + + m_buttonOK = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonOK->SetDefault(); + m_buttonOK->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); + + bSizer291->Add( m_buttonOK, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + m_button16 = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_button16->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer291->Add( m_button16, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer291->Add( 20, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer29->Add( bSizer291, 0, wxEXPAND, 5 ); + + bSizer181->Add( bSizer29, 0, wxEXPAND, 5 ); + + + bSizer181->Add( 10, 0, 0, 0, 5 ); + + sbSizerSyncDirections = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Configuration") ), wxVERTICAL ); + + wxGridSizer* gSizer3; + gSizer3 = new wxGridSizer( 1, 2, 0, 5 ); + + m_staticText21 = new wxStaticText( this, wxID_ANY, _("Category"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText21->Wrap( -1 ); + m_staticText21->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); + + gSizer3->Add( m_staticText21, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticText31 = new wxStaticText( this, wxID_ANY, _("Action"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText31->Wrap( -1 ); + m_staticText31->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); + + gSizer3->Add( m_staticText31, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + sbSizerSyncDirections->Add( gSizer3, 0, wxEXPAND, 5 ); + + m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + sbSizerSyncDirections->Add( m_staticline3, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + wxBoxSizer* bSizer121; + bSizer121 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer122; + bSizer122 = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmapLeftOnly = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); + m_bitmapLeftOnly->SetToolTip( _("Files/folders that exist on left side only") ); + + bSizer122->Add( m_bitmapLeftOnly, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer122->Add( 5, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bpButtonLeftOnly = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizer122->Add( m_bpButtonLeftOnly, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer121->Add( bSizer122, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + wxBoxSizer* bSizer123; + bSizer123 = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmapRightOnly = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); + m_bitmapRightOnly->SetToolTip( _("Files/folders that exist on right side only") ); + + bSizer123->Add( m_bitmapRightOnly, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer123->Add( 5, 0, 0, 0, 5 ); + + m_bpButtonRightOnly = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizer123->Add( m_bpButtonRightOnly, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer121->Add( bSizer123, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + wxBoxSizer* bSizer124; + bSizer124 = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmapLeftNewer = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); + m_bitmapLeftNewer->SetToolTip( _("Files that exist on both sides, left one is newer") ); + + bSizer124->Add( m_bitmapLeftNewer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer124->Add( 5, 0, 0, 0, 5 ); + + m_bpButtonLeftNewer = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizer124->Add( m_bpButtonLeftNewer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer121->Add( bSizer124, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + wxBoxSizer* bSizer125; + bSizer125 = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmapRightNewer = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); + m_bitmapRightNewer->SetToolTip( _("Files that exist on both sides, right one is newer") ); + + bSizer125->Add( m_bitmapRightNewer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer125->Add( 5, 0, 0, 0, 5 ); + + m_bpButtonRightNewer = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizer125->Add( m_bpButtonRightNewer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer121->Add( bSizer125, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + wxBoxSizer* bSizer126; + bSizer126 = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmapDifferent = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); + m_bitmapDifferent->SetToolTip( _("Files that have different content") ); + + bSizer126->Add( m_bitmapDifferent, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer126->Add( 5, 0, 0, 0, 5 ); + + m_bpButtonDifferent = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizer126->Add( m_bpButtonDifferent, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer121->Add( bSizer126, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + wxBoxSizer* bSizer127; + bSizer127 = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmapConflict = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); + m_bitmapConflict->SetToolTip( _("Conflicts/files that cannot be categorized") ); + + bSizer127->Add( m_bitmapConflict, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer127->Add( 5, 0, 0, 0, 5 ); + + m_bpButtonConflict = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizer127->Add( m_bpButtonConflict, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer121->Add( bSizer127, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + sbSizerSyncDirections->Add( bSizer121, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizer181->Add( sbSizerSyncDirections, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizer7->Add( bSizer181, 0, wxALL, 5 ); + + this->SetSizer( bSizer7 ); + this->Layout(); + bSizer7->Fit( this ); + + this->Centre( wxBOTH ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SyncCfgDlgGenerated::OnClose ) ); + m_radioBtnAutomatic->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncAutomatic ), NULL, this ); + m_buttonAutomatic->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncAutomatic ), NULL, this ); + m_radioBtnMirror->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncLeftToRight ), NULL, this ); + m_buttonOneWay->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncLeftToRight ), NULL, this ); + m_radioBtnUpdate->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncUpdate ), NULL, this ); + m_buttonUpdate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncUpdate ), NULL, this ); + m_radioBtnCustom->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncCustom ), NULL, this ); + m_choiceHandleError->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnChangeErrorHandling ), NULL, this ); + m_choiceHandleDeletion->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnChangeDeletionHandling ), NULL, this ); + m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnApply ), NULL, this ); + m_button16->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnCancel ), NULL, this ); + m_bpButtonLeftOnly->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnExLeftSideOnly ), NULL, this ); + m_bpButtonRightOnly->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnExRightSideOnly ), NULL, this ); + m_bpButtonLeftNewer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnLeftNewer ), NULL, this ); + m_bpButtonRightNewer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnRightNewer ), NULL, this ); + m_bpButtonDifferent->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnDifferent ), NULL, this ); + m_bpButtonConflict->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnConflict ), NULL, this ); } SyncCfgDlgGenerated::~SyncCfgDlgGenerated() { - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SyncCfgDlgGenerated::OnClose ) ); - m_radioBtnAutomatic->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncAutomatic ), NULL, this ); - m_buttonAutomatic->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncAutomatic ), NULL, this ); - m_radioBtnMirror->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncLeftToRight ), NULL, this ); - m_buttonOneWay->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncLeftToRight ), NULL, this ); - m_radioBtnUpdate->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncUpdate ), NULL, this ); - m_buttonUpdate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncUpdate ), NULL, this ); - m_radioBtnCustom->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncCustom ), NULL, this ); - m_choiceHandleError->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnChangeErrorHandling ), NULL, this ); - m_choiceHandleDeletion->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnChangeDeletionHandling ), NULL, this ); - m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnApply ), NULL, this ); - m_button16->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnCancel ), NULL, this ); - m_bpButtonLeftOnly->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnExLeftSideOnly ), NULL, this ); - m_bpButtonRightOnly->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnExRightSideOnly ), NULL, this ); - m_bpButtonLeftNewer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnLeftNewer ), NULL, this ); - m_bpButtonRightNewer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnRightNewer ), NULL, this ); - m_bpButtonDifferent->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnDifferent ), NULL, this ); - m_bpButtonConflict->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnConflict ), NULL, this ); - + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SyncCfgDlgGenerated::OnClose ) ); + m_radioBtnAutomatic->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncAutomatic ), NULL, this ); + m_buttonAutomatic->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncAutomatic ), NULL, this ); + m_radioBtnMirror->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncLeftToRight ), NULL, this ); + m_buttonOneWay->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncLeftToRight ), NULL, this ); + m_radioBtnUpdate->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncUpdate ), NULL, this ); + m_buttonUpdate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncUpdate ), NULL, this ); + m_radioBtnCustom->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncCustom ), NULL, this ); + m_choiceHandleError->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnChangeErrorHandling ), NULL, this ); + m_choiceHandleDeletion->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnChangeDeletionHandling ), NULL, this ); + m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnApply ), NULL, this ); + m_button16->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnCancel ), NULL, this ); + m_bpButtonLeftOnly->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnExLeftSideOnly ), NULL, this ); + m_bpButtonRightOnly->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnExRightSideOnly ), NULL, this ); + m_bpButtonLeftNewer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnLeftNewer ), NULL, this ); + m_bpButtonRightNewer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnRightNewer ), NULL, this ); + m_bpButtonDifferent->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnDifferent ), NULL, this ); + m_bpButtonConflict->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnConflict ), NULL, this ); + } CmpCfgDlgGenerated::CmpCfgDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bSizer136; - bSizer136 = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizer55; - bSizer55 = new wxBoxSizer( wxVERTICAL ); - - wxStaticBoxSizer* sbSizer6; - sbSizer6 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Compare by...") ), wxHORIZONTAL ); - - wxFlexGridSizer* fgSizer16; - fgSizer16 = new wxFlexGridSizer( 2, 3, 0, 0 ); - fgSizer16->SetFlexibleDirection( wxBOTH ); - fgSizer16->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - m_radioBtnSizeDate = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); - m_radioBtnSizeDate->SetValue( true ); - m_radioBtnSizeDate->SetToolTip( _("Files are found equal if\n - filesize\n - last write time and date\nare the same") ); - - fgSizer16->Add( m_radioBtnSizeDate, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bitmapByTime = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - m_bitmapByTime->SetToolTip( _("Files are found equal if\n - filesize\n - last write time and date\nare the same") ); - - fgSizer16->Add( m_bitmapByTime, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_buttonTimeSize = new wxButton( this, wxID_ANY, _("File size and date"), wxDefaultPosition, wxSize( -1,42 ), 0 ); - m_buttonTimeSize->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - m_buttonTimeSize->SetToolTip( _("Files are found equal if\n - filesize\n - last write time and date\nare the same") ); - - fgSizer16->Add( m_buttonTimeSize, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 5 ); - - m_radioBtnContent = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_radioBtnContent->SetToolTip( _("Files are found equal if\n - file content\nis the same") ); - - fgSizer16->Add( m_radioBtnContent, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bitmapByContent = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - m_bitmapByContent->SetToolTip( _("Files are found equal if\n - file content\nis the same") ); - - fgSizer16->Add( m_bitmapByContent, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_buttonContent = new wxButton( this, wxID_ANY, _("File content"), wxDefaultPosition, wxSize( -1,42 ), 0 ); - m_buttonContent->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - m_buttonContent->SetToolTip( _("Files are found equal if\n - file content\nis the same") ); - - fgSizer16->Add( m_buttonContent, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - sbSizer6->Add( fgSizer16, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - m_staticline14 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); - sbSizer6->Add( m_staticline14, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - - m_bpButtonHelp = new wxBitmapButton( this, wxID_HELP, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - m_bpButtonHelp->SetToolTip( _("Help") ); - - m_bpButtonHelp->SetToolTip( _("Help") ); - - sbSizer6->Add( m_bpButtonHelp, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer55->Add( sbSizer6, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 2 ); - - - bSizer55->Add( 0, 4, 0, 0, 5 ); - - wxStaticBoxSizer* sbSizer25; - sbSizer25 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Symbolic Link handling") ), wxVERTICAL ); - - wxArrayString m_choiceHandleSymlinksChoices; - m_choiceHandleSymlinks = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceHandleSymlinksChoices, 0 ); - m_choiceHandleSymlinks->SetSelection( 0 ); - sbSizer25->Add( m_choiceHandleSymlinks, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - bSizer55->Add( sbSizer25, 0, wxEXPAND|wxTOP, 5 ); - - wxBoxSizer* bSizer22; - bSizer22 = new wxBoxSizer( wxHORIZONTAL ); - - m_button10 = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_button10->SetDefault(); - m_button10->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); - - bSizer22->Add( m_button10, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_button6 = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_button6->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer22->Add( m_button6, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer55->Add( bSizer22, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - bSizer136->Add( bSizer55, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - this->SetSizer( bSizer136 ); - this->Layout(); - bSizer136->Fit( this ); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CmpCfgDlgGenerated::OnClose ) ); - m_radioBtnSizeDate->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnTimeSize ), NULL, this ); - m_buttonTimeSize->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnTimeSize ), NULL, this ); - m_radioBtnContent->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnContent ), NULL, this ); - m_buttonContent->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnContent ), NULL, this ); - m_bpButtonHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnShowHelp ), NULL, this ); - m_choiceHandleSymlinks->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnChangeErrorHandling ), NULL, this ); - m_button10->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnOkay ), NULL, this ); - m_button6->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnCancel ), NULL, this ); + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer136; + bSizer136 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer55; + bSizer55 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer6; + sbSizer6 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Compare by...") ), wxHORIZONTAL ); + + wxFlexGridSizer* fgSizer16; + fgSizer16 = new wxFlexGridSizer( 2, 3, 0, 0 ); + fgSizer16->SetFlexibleDirection( wxBOTH ); + fgSizer16->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_radioBtnSizeDate = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); + m_radioBtnSizeDate->SetValue( true ); + m_radioBtnSizeDate->SetToolTip( _("Files are found equal if\n - filesize\n - last write time and date\nare the same") ); + + fgSizer16->Add( m_radioBtnSizeDate, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bitmapByTime = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + m_bitmapByTime->SetToolTip( _("Files are found equal if\n - filesize\n - last write time and date\nare the same") ); + + fgSizer16->Add( m_bitmapByTime, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_buttonTimeSize = new wxButton( this, wxID_ANY, _("File size and date"), wxDefaultPosition, wxSize( -1,42 ), 0 ); + m_buttonTimeSize->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); + m_buttonTimeSize->SetToolTip( _("Files are found equal if\n - filesize\n - last write time and date\nare the same") ); + + fgSizer16->Add( m_buttonTimeSize, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 5 ); + + m_radioBtnContent = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_radioBtnContent->SetToolTip( _("Files are found equal if\n - file content\nis the same") ); + + fgSizer16->Add( m_radioBtnContent, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bitmapByContent = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + m_bitmapByContent->SetToolTip( _("Files are found equal if\n - file content\nis the same") ); + + fgSizer16->Add( m_bitmapByContent, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_buttonContent = new wxButton( this, wxID_ANY, _("File content"), wxDefaultPosition, wxSize( -1,42 ), 0 ); + m_buttonContent->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); + m_buttonContent->SetToolTip( _("Files are found equal if\n - file content\nis the same") ); + + fgSizer16->Add( m_buttonContent, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + sbSizer6->Add( fgSizer16, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + m_staticline14 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); + sbSizer6->Add( m_staticline14, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + m_bpButtonHelp = new wxBitmapButton( this, wxID_HELP, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + m_bpButtonHelp->SetToolTip( _("Help") ); + + m_bpButtonHelp->SetToolTip( _("Help") ); + + sbSizer6->Add( m_bpButtonHelp, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer55->Add( sbSizer6, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 2 ); + + + bSizer55->Add( 0, 4, 0, 0, 5 ); + + wxStaticBoxSizer* sbSizer25; + sbSizer25 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Symbolic Link handling") ), wxVERTICAL ); + + wxArrayString m_choiceHandleSymlinksChoices; + m_choiceHandleSymlinks = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceHandleSymlinksChoices, 0 ); + m_choiceHandleSymlinks->SetSelection( 0 ); + sbSizer25->Add( m_choiceHandleSymlinks, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizer55->Add( sbSizer25, 0, wxEXPAND|wxTOP, 5 ); + + wxBoxSizer* bSizer22; + bSizer22 = new wxBoxSizer( wxHORIZONTAL ); + + m_button10 = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_button10->SetDefault(); + m_button10->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); + + bSizer22->Add( m_button10, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_button6 = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_button6->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer22->Add( m_button6, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer55->Add( bSizer22, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizer136->Add( bSizer55, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + this->SetSizer( bSizer136 ); + this->Layout(); + bSizer136->Fit( this ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CmpCfgDlgGenerated::OnClose ) ); + m_radioBtnSizeDate->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnTimeSize ), NULL, this ); + m_buttonTimeSize->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnTimeSize ), NULL, this ); + m_radioBtnContent->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnContent ), NULL, this ); + m_buttonContent->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnContent ), NULL, this ); + m_bpButtonHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnShowHelp ), NULL, this ); + m_choiceHandleSymlinks->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnChangeErrorHandling ), NULL, this ); + m_button10->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnOkay ), NULL, this ); + m_button6->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnCancel ), NULL, this ); } CmpCfgDlgGenerated::~CmpCfgDlgGenerated() { - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CmpCfgDlgGenerated::OnClose ) ); - m_radioBtnSizeDate->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnTimeSize ), NULL, this ); - m_buttonTimeSize->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnTimeSize ), NULL, this ); - m_radioBtnContent->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnContent ), NULL, this ); - m_buttonContent->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnContent ), NULL, this ); - m_bpButtonHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnShowHelp ), NULL, this ); - m_choiceHandleSymlinks->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnChangeErrorHandling ), NULL, this ); - m_button10->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnOkay ), NULL, this ); - m_button6->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnCancel ), NULL, this ); - + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CmpCfgDlgGenerated::OnClose ) ); + m_radioBtnSizeDate->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnTimeSize ), NULL, this ); + m_buttonTimeSize->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnTimeSize ), NULL, this ); + m_radioBtnContent->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnContent ), NULL, this ); + m_buttonContent->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnContent ), NULL, this ); + m_bpButtonHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnShowHelp ), NULL, this ); + m_choiceHandleSymlinks->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnChangeErrorHandling ), NULL, this ); + m_button10->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnOkay ), NULL, this ); + m_button6->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnCancel ), NULL, this ); + } SyncStatusDlgGenerated::SyncStatusDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxSize( 470,300 ), wxDefaultSize ); - this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) ); - - wxBoxSizer* bSizer27; - bSizer27 = new wxBoxSizer( wxVERTICAL ); - - - bSizer27->Add( 0, 15, 0, wxEXPAND, 5 ); - - wxBoxSizer* bSizer37; - bSizer37 = new wxBoxSizer( wxHORIZONTAL ); - - bSizer27->Add( bSizer37, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - wxBoxSizer* bSizer42; - bSizer42 = new wxBoxSizer( wxHORIZONTAL ); - - - bSizer42->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_bitmapStatus = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 28,28 ), 0 ); - bSizer42->Add( m_bitmapStatus, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticTextStatus = new wxStaticText( this, wxID_ANY, _("Synchronizing..."), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextStatus->Wrap( -1 ); - m_staticTextStatus->SetFont( wxFont( 14, 70, 90, 92, false, wxEmptyString ) ); - - bSizer42->Add( m_staticTextStatus, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - - m_animationControl1 = new wxAnimationCtrl( this, wxID_ANY, wxNullAnimation, wxDefaultPosition, wxDefaultSize, wxAC_DEFAULT_STYLE ); - m_animationControl1->SetMinSize( wxSize( 45,45 ) ); - - bSizer42->Add( m_animationControl1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - - bSizer42->Add( 0, 0, 1, wxEXPAND, 5 ); - - bSizer27->Add( bSizer42, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 ); - - bSizer31 = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* bSizer111; - bSizer111 = new wxBoxSizer( wxVERTICAL ); - - bSizerObjectsRemaining = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText25 = new wxStaticText( this, wxID_ANY, _("Elements remaining:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText25->Wrap( -1 ); - m_staticText25->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizerObjectsRemaining->Add( m_staticText25, 0, wxALIGN_BOTTOM, 5 ); - - m_staticTextRemainingObj = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); - m_staticTextRemainingObj->Wrap( -1 ); - m_staticTextRemainingObj->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); - - bSizerObjectsRemaining->Add( m_staticTextRemainingObj, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); - - m_staticText96 = new wxStaticText( this, wxID_ANY, _("("), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText96->Wrap( -1 ); - m_staticText96->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Arial") ) ); - - bSizerObjectsRemaining->Add( m_staticText96, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); - - m_staticTextDataRemaining = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextDataRemaining->Wrap( -1 ); - m_staticTextDataRemaining->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Arial") ) ); - - bSizerObjectsRemaining->Add( m_staticTextDataRemaining, 0, wxALIGN_BOTTOM, 5 ); - - m_staticText97 = new wxStaticText( this, wxID_ANY, _(")"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText97->Wrap( -1 ); - m_staticText97->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Arial") ) ); - - bSizerObjectsRemaining->Add( m_staticText97, 0, wxALIGN_BOTTOM, 5 ); - - bSizer111->Add( bSizerObjectsRemaining, 0, 0, 5 ); - - bSizerObjectsProcessed = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText251 = new wxStaticText( this, wxID_ANY, _("Elements processed:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText251->Wrap( -1 ); - m_staticText251->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizerObjectsProcessed->Add( m_staticText251, 0, wxALIGN_BOTTOM, 5 ); - - m_staticTextProcessedObj = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); - m_staticTextProcessedObj->Wrap( -1 ); - m_staticTextProcessedObj->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); - - bSizerObjectsProcessed->Add( m_staticTextProcessedObj, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); - - m_staticText98 = new wxStaticText( this, wxID_ANY, _("("), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText98->Wrap( -1 ); - m_staticText98->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Arial") ) ); - - bSizerObjectsProcessed->Add( m_staticText98, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); - - m_staticTextDataProcessed = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextDataProcessed->Wrap( -1 ); - m_staticTextDataProcessed->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Arial") ) ); - - bSizerObjectsProcessed->Add( m_staticTextDataProcessed, 0, wxALIGN_BOTTOM, 5 ); - - m_staticText99 = new wxStaticText( this, wxID_ANY, _(")"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText99->Wrap( -1 ); - m_staticText99->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Arial") ) ); - - bSizerObjectsProcessed->Add( m_staticText99, 0, wxALIGN_BOTTOM, 5 ); - - bSizer111->Add( bSizerObjectsProcessed, 0, 0, 5 ); - - bSizer31->Add( bSizer111, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer31->Add( 0, 0, 1, wxEXPAND, 5 ); - - wxBoxSizer* bSizer114; - bSizer114 = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText55 = new wxStaticText( this, wxID_ANY, _("Time elapsed:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText55->Wrap( -1 ); - m_staticText55->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer114->Add( m_staticText55, 0, wxALIGN_BOTTOM, 5 ); - - m_staticTextTimeElapsed = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextTimeElapsed->Wrap( -1 ); - m_staticTextTimeElapsed->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); - - bSizer114->Add( m_staticTextTimeElapsed, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); - - bSizer31->Add( bSizer114, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer27->Add( bSizer31, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_textCtrlInfo = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY ); - m_textCtrlInfo->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - - bSizer27->Add( m_textCtrlInfo, 3, wxEXPAND|wxALL, 5 ); - - m_gauge1 = new wxGauge( this, wxID_ANY, 100, wxDefaultPosition, wxSize( -1,20 ), wxGA_HORIZONTAL ); - bSizer27->Add( m_gauge1, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - bSizer28 = new wxBoxSizer( wxHORIZONTAL ); - - bSizerSpeed = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText108 = new wxStaticText( this, wxID_ANY, _("Speed:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText108->Wrap( -1 ); - m_staticText108->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizerSpeed->Add( m_staticText108, 0, wxALIGN_BOTTOM, 5 ); - - m_staticTextSpeed = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextSpeed->Wrap( -1 ); - m_staticTextSpeed->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); - - bSizerSpeed->Add( m_staticTextSpeed, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); - - - bSizerSpeed->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer28->Add( bSizerSpeed, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer28->Add( 0, 0, 1, 0, 5 ); - - m_buttonOK = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( 100,32 ), 0 ); - m_buttonOK->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - m_buttonOK->Enable( false ); - m_buttonOK->Hide(); - - bSizer28->Add( m_buttonOK, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - - m_buttonPause = new wxButton( this, wxID_ANY, _("&Pause"), wxDefaultPosition, wxSize( 100,32 ), 0 ); - m_buttonPause->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer28->Add( m_buttonPause, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - - m_buttonAbort = new wxButton( this, wxID_CANCEL, _("&Abort"), wxDefaultPosition, wxSize( 100,32 ), 0 ); - m_buttonAbort->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer28->Add( m_buttonAbort, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - - - bSizer28->Add( 0, 0, 1, 0, 5 ); - - bSizerRemTime = new wxBoxSizer( wxHORIZONTAL ); - - - bSizerRemTime->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticText21 = new wxStaticText( this, wxID_ANY, _("Time remaining:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText21->Wrap( -1 ); - m_staticText21->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizerRemTime->Add( m_staticText21, 0, wxALIGN_BOTTOM, 5 ); - - m_staticTextTimeRemaining = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextTimeRemaining->Wrap( -1 ); - m_staticTextTimeRemaining->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); - - bSizerRemTime->Add( m_staticTextTimeRemaining, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); - - bSizer28->Add( bSizerRemTime, 1, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer27->Add( bSizer28, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL, 5 ); - - - bSizer27->Add( 0, 5, 0, wxEXPAND, 5 ); - - this->SetSizer( bSizer27 ); - this->Layout(); - - this->Centre( wxBOTH ); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SyncStatusDlgGenerated::OnClose ) ); - this->Connect( wxEVT_ICONIZE, wxIconizeEventHandler( SyncStatusDlgGenerated::OnIconize ) ); - m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncStatusDlgGenerated::OnOkay ), NULL, this ); - m_buttonPause->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncStatusDlgGenerated::OnPause ), NULL, this ); - m_buttonAbort->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncStatusDlgGenerated::OnAbort ), NULL, this ); + this->SetSizeHints( wxSize( 470,300 ), wxDefaultSize ); + this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) ); + + wxBoxSizer* bSizer27; + bSizer27 = new wxBoxSizer( wxVERTICAL ); + + + bSizer27->Add( 0, 15, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer37; + bSizer37 = new wxBoxSizer( wxHORIZONTAL ); + + bSizer27->Add( bSizer37, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + wxBoxSizer* bSizer42; + bSizer42 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer42->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_bitmapStatus = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 28,28 ), 0 ); + bSizer42->Add( m_bitmapStatus, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticTextStatus = new wxStaticText( this, wxID_ANY, _("Synchronizing..."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextStatus->Wrap( -1 ); + m_staticTextStatus->SetFont( wxFont( 14, 70, 90, 92, false, wxEmptyString ) ); + + bSizer42->Add( m_staticTextStatus, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + m_animationControl1 = new wxAnimationCtrl( this, wxID_ANY, wxNullAnimation, wxDefaultPosition, wxDefaultSize, wxAC_DEFAULT_STYLE ); + m_animationControl1->SetMinSize( wxSize( 45,45 ) ); + + bSizer42->Add( m_animationControl1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + + bSizer42->Add( 0, 0, 1, wxEXPAND, 5 ); + + bSizer27->Add( bSizer42, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizer31 = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizer111; + bSizer111 = new wxBoxSizer( wxVERTICAL ); + + bSizerObjectsRemaining = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText25 = new wxStaticText( this, wxID_ANY, _("Elements remaining:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText25->Wrap( -1 ); + m_staticText25->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizerObjectsRemaining->Add( m_staticText25, 0, wxALIGN_BOTTOM, 5 ); + + m_staticTextRemainingObj = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); + m_staticTextRemainingObj->Wrap( -1 ); + m_staticTextRemainingObj->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); + + bSizerObjectsRemaining->Add( m_staticTextRemainingObj, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); + + m_staticText96 = new wxStaticText( this, wxID_ANY, _("("), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText96->Wrap( -1 ); + m_staticText96->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Arial") ) ); + + bSizerObjectsRemaining->Add( m_staticText96, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); + + m_staticTextDataRemaining = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextDataRemaining->Wrap( -1 ); + m_staticTextDataRemaining->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Arial") ) ); + + bSizerObjectsRemaining->Add( m_staticTextDataRemaining, 0, wxALIGN_BOTTOM, 5 ); + + m_staticText97 = new wxStaticText( this, wxID_ANY, _(")"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText97->Wrap( -1 ); + m_staticText97->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Arial") ) ); + + bSizerObjectsRemaining->Add( m_staticText97, 0, wxALIGN_BOTTOM, 5 ); + + bSizer111->Add( bSizerObjectsRemaining, 0, 0, 5 ); + + bSizerObjectsProcessed = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText251 = new wxStaticText( this, wxID_ANY, _("Elements processed:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText251->Wrap( -1 ); + m_staticText251->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizerObjectsProcessed->Add( m_staticText251, 0, wxALIGN_BOTTOM, 5 ); + + m_staticTextProcessedObj = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); + m_staticTextProcessedObj->Wrap( -1 ); + m_staticTextProcessedObj->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); + + bSizerObjectsProcessed->Add( m_staticTextProcessedObj, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); + + m_staticText98 = new wxStaticText( this, wxID_ANY, _("("), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText98->Wrap( -1 ); + m_staticText98->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Arial") ) ); + + bSizerObjectsProcessed->Add( m_staticText98, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); + + m_staticTextDataProcessed = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextDataProcessed->Wrap( -1 ); + m_staticTextDataProcessed->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Arial") ) ); + + bSizerObjectsProcessed->Add( m_staticTextDataProcessed, 0, wxALIGN_BOTTOM, 5 ); + + m_staticText99 = new wxStaticText( this, wxID_ANY, _(")"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText99->Wrap( -1 ); + m_staticText99->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Arial") ) ); + + bSizerObjectsProcessed->Add( m_staticText99, 0, wxALIGN_BOTTOM, 5 ); + + bSizer111->Add( bSizerObjectsProcessed, 0, 0, 5 ); + + bSizer31->Add( bSizer111, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer31->Add( 0, 0, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizer114; + bSizer114 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText55 = new wxStaticText( this, wxID_ANY, _("Time elapsed:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText55->Wrap( -1 ); + m_staticText55->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer114->Add( m_staticText55, 0, wxALIGN_BOTTOM, 5 ); + + m_staticTextTimeElapsed = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextTimeElapsed->Wrap( -1 ); + m_staticTextTimeElapsed->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); + + bSizer114->Add( m_staticTextTimeElapsed, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); + + bSizer31->Add( bSizer114, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer27->Add( bSizer31, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + bSizerProgressText = new wxBoxSizer( wxVERTICAL ); + + m_textCtrlInfo = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY ); + m_textCtrlInfo->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + + bSizerProgressText->Add( m_textCtrlInfo, 3, wxEXPAND|wxALL, 5 ); + + bSizer27->Add( bSizerProgressText, 1, wxEXPAND, 5 ); + + m_gauge1 = new wxGauge( this, wxID_ANY, 100, wxDefaultPosition, wxSize( -1,20 ), wxGA_HORIZONTAL ); + bSizer27->Add( m_gauge1, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + bSizer28 = new wxBoxSizer( wxHORIZONTAL ); + + bSizerSpeed = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText108 = new wxStaticText( this, wxID_ANY, _("Speed:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText108->Wrap( -1 ); + m_staticText108->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizerSpeed->Add( m_staticText108, 0, wxALIGN_BOTTOM, 5 ); + + m_staticTextSpeed = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextSpeed->Wrap( -1 ); + m_staticTextSpeed->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); + + bSizerSpeed->Add( m_staticTextSpeed, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); + + + bSizerSpeed->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer28->Add( bSizerSpeed, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer28->Add( 0, 0, 1, 0, 5 ); + + m_buttonOK = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( 100,32 ), 0 ); + m_buttonOK->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + m_buttonOK->Enable( false ); + m_buttonOK->Hide(); + + bSizer28->Add( m_buttonOK, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + m_buttonPause = new wxButton( this, wxID_ANY, _("&Pause"), wxDefaultPosition, wxSize( 100,32 ), 0 ); + m_buttonPause->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer28->Add( m_buttonPause, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + m_buttonAbort = new wxButton( this, wxID_CANCEL, _("&Abort"), wxDefaultPosition, wxSize( 100,32 ), 0 ); + m_buttonAbort->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer28->Add( m_buttonAbort, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + + bSizer28->Add( 0, 0, 1, 0, 5 ); + + bSizerRemTime = new wxBoxSizer( wxHORIZONTAL ); + + + bSizerRemTime->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticText21 = new wxStaticText( this, wxID_ANY, _("Time remaining:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText21->Wrap( -1 ); + m_staticText21->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizerRemTime->Add( m_staticText21, 0, wxALIGN_BOTTOM, 5 ); + + m_staticTextTimeRemaining = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextTimeRemaining->Wrap( -1 ); + m_staticTextTimeRemaining->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); + + bSizerRemTime->Add( m_staticTextTimeRemaining, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); + + bSizer28->Add( bSizerRemTime, 1, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer27->Add( bSizer28, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL, 5 ); + + + bSizer27->Add( 0, 5, 0, wxEXPAND, 5 ); + + this->SetSizer( bSizer27 ); + this->Layout(); + + this->Centre( wxBOTH ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SyncStatusDlgGenerated::OnClose ) ); + this->Connect( wxEVT_ICONIZE, wxIconizeEventHandler( SyncStatusDlgGenerated::OnIconize ) ); + m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncStatusDlgGenerated::OnOkay ), NULL, this ); + m_buttonPause->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncStatusDlgGenerated::OnPause ), NULL, this ); + m_buttonAbort->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncStatusDlgGenerated::OnAbort ), NULL, this ); } SyncStatusDlgGenerated::~SyncStatusDlgGenerated() { - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SyncStatusDlgGenerated::OnClose ) ); - this->Disconnect( wxEVT_ICONIZE, wxIconizeEventHandler( SyncStatusDlgGenerated::OnIconize ) ); - m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncStatusDlgGenerated::OnOkay ), NULL, this ); - m_buttonPause->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncStatusDlgGenerated::OnPause ), NULL, this ); - m_buttonAbort->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncStatusDlgGenerated::OnAbort ), NULL, this ); - + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SyncStatusDlgGenerated::OnClose ) ); + this->Disconnect( wxEVT_ICONIZE, wxIconizeEventHandler( SyncStatusDlgGenerated::OnIconize ) ); + m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncStatusDlgGenerated::OnOkay ), NULL, this ); + m_buttonPause->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncStatusDlgGenerated::OnPause ), NULL, this ); + m_buttonAbort->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncStatusDlgGenerated::OnAbort ), NULL, this ); + +} + +LogControlGenerated::LogControlGenerated( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style ) +{ + wxBoxSizer* bSizer153; + bSizer153 = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizer154; + bSizer154 = new wxBoxSizer( wxVERTICAL ); + + m_bpButtonErrors = new ToggleButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 48,48 ), wxBU_AUTODRAW ); + bSizer154->Add( m_bpButtonErrors, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_bpButtonWarnings = new ToggleButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 48,48 ), wxBU_AUTODRAW ); + bSizer154->Add( m_bpButtonWarnings, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_bpButtonInfo = new ToggleButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 48,48 ), wxBU_AUTODRAW ); + bSizer154->Add( m_bpButtonInfo, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizer153->Add( bSizer154, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_textCtrlInfo = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_DONTWRAP|wxTE_MULTILINE|wxTE_READONLY ); + m_textCtrlInfo->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + + bSizer153->Add( m_textCtrlInfo, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + this->SetSizer( bSizer153 ); + this->Layout(); + bSizer153->Fit( this ); + + // Connect Events + m_bpButtonErrors->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogControlGenerated::OnErrors ), NULL, this ); + m_bpButtonWarnings->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogControlGenerated::OnWarnings ), NULL, this ); + m_bpButtonInfo->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogControlGenerated::OnInfo ), NULL, this ); +} + +LogControlGenerated::~LogControlGenerated() +{ + // Disconnect Events + m_bpButtonErrors->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogControlGenerated::OnErrors ), NULL, this ); + m_bpButtonWarnings->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogControlGenerated::OnWarnings ), NULL, this ); + m_bpButtonInfo->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogControlGenerated::OnInfo ), NULL, this ); + } HelpDlgGenerated::HelpDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bSizer20; - bSizer20 = new wxBoxSizer( wxVERTICAL ); - - - bSizer20->Add( 0, 10, 0, wxEXPAND, 5 ); - - wxBoxSizer* bSizer85; - bSizer85 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmap25 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), 0 ); - bSizer85->Add( m_bitmap25, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_panel8 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER|wxTAB_TRAVERSAL ); - m_panel8->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DLIGHT ) ); - - wxBoxSizer* bSizer72; - bSizer72 = new wxBoxSizer( wxHORIZONTAL ); - - - bSizer72->Add( 20, 0, 0, 0, 5 ); - - m_staticText56 = new wxStaticText( m_panel8, wxID_ANY, _("Help"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText56->Wrap( -1 ); - m_staticText56->SetFont( wxFont( 16, 70, 90, 92, false, wxEmptyString ) ); - - bSizer72->Add( m_staticText56, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer72->Add( 20, 0, 0, 0, 5 ); - - m_panel8->SetSizer( bSizer72 ); - m_panel8->Layout(); - bSizer72->Fit( m_panel8 ); - bSizer85->Add( m_panel8, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - - bSizer85->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer20->Add( bSizer85, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_notebook1 = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); - m_scrolledWindow1 = new wxScrolledWindow( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxSIMPLE_BORDER|wxVSCROLL ); - m_scrolledWindow1->SetScrollRate( 5, 5 ); - m_scrolledWindow1->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INACTIVEBORDER ) ); - - wxBoxSizer* bSizer70; - bSizer70 = new wxBoxSizer( wxVERTICAL ); - - m_staticText59 = new wxStaticText( m_scrolledWindow1, wxID_ANY, _("Compare by \"File size and date\""), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText59->Wrap( 500 ); - m_staticText59->SetFont( wxFont( 10, 70, 90, 92, true, wxEmptyString ) ); - - bSizer70->Add( m_staticText59, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_staticText60 = new wxStaticText( m_scrolledWindow1, wxID_ANY, _("This variant evaluates two equally named files as being equal when they have the same file size AND the same last write date and time."), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText60->Wrap( 500 ); - bSizer70->Add( m_staticText60, 0, wxALL, 5 ); - - m_staticText61 = new wxStaticText( m_scrolledWindow1, wxID_ANY, _("When the comparison is started with this option set the following decision tree is processed:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText61->Wrap( 500 ); - bSizer70->Add( m_staticText61, 0, wxALL, 5 ); - - m_treeCtrl1 = new wxTreeCtrl( m_scrolledWindow1, wxID_ANY, wxDefaultPosition, wxSize( -1,175 ), wxTR_DEFAULT_STYLE ); - m_treeCtrl1->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - - bSizer70->Add( m_treeCtrl1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - m_staticText63 = new wxStaticText( m_scrolledWindow1, wxID_ANY, _("As a result the files are separated into the following categories:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText63->Wrap( 500 ); - bSizer70->Add( m_staticText63, 0, wxALL, 5 ); - - m_staticText75 = new wxStaticText( m_scrolledWindow1, wxID_ANY, _("- equal"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText75->Wrap( -1 ); - bSizer70->Add( m_staticText75, 0, wxRIGHT|wxLEFT, 5 ); - - m_staticText76 = new wxStaticText( m_scrolledWindow1, wxID_ANY, _("- left newer"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText76->Wrap( -1 ); - bSizer70->Add( m_staticText76, 0, wxRIGHT|wxLEFT, 5 ); - - m_staticText77 = new wxStaticText( m_scrolledWindow1, wxID_ANY, _("- right newer"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText77->Wrap( -1 ); - bSizer70->Add( m_staticText77, 0, wxRIGHT|wxLEFT, 5 ); - - m_staticText79 = new wxStaticText( m_scrolledWindow1, wxID_ANY, _("- exists left only"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText79->Wrap( -1 ); - bSizer70->Add( m_staticText79, 0, wxRIGHT|wxLEFT, 5 ); - - m_staticText80 = new wxStaticText( m_scrolledWindow1, wxID_ANY, _("- exists right only"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText80->Wrap( -1 ); - bSizer70->Add( m_staticText80, 0, wxRIGHT|wxLEFT, 5 ); - - m_staticText78 = new wxStaticText( m_scrolledWindow1, wxID_ANY, _("- conflict"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText78->Wrap( -1 ); - bSizer70->Add( m_staticText78, 0, wxRIGHT|wxLEFT, 5 ); - - m_scrolledWindow1->SetSizer( bSizer70 ); - m_scrolledWindow1->Layout(); - bSizer70->Fit( m_scrolledWindow1 ); - m_notebook1->AddPage( m_scrolledWindow1, _("File size and date"), true ); - m_scrolledWindow5 = new wxScrolledWindow( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxSIMPLE_BORDER|wxVSCROLL ); - m_scrolledWindow5->SetScrollRate( 5, 5 ); - m_scrolledWindow5->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INACTIVEBORDER ) ); - - wxBoxSizer* bSizer74; - bSizer74 = new wxBoxSizer( wxVERTICAL ); - - m_staticText65 = new wxStaticText( m_scrolledWindow5, wxID_ANY, _("Compare by \"File content\""), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText65->Wrap( 500 ); - m_staticText65->SetFont( wxFont( 10, 70, 90, 92, true, wxEmptyString ) ); - - bSizer74->Add( m_staticText65, 0, wxALL, 5 ); - - m_staticText66 = new wxStaticText( m_scrolledWindow5, wxID_ANY, _("As the name suggests, two files which share the same name are marked as equal if and only if they have the same content. This option is useful for consistency checks rather than backup operations. Therefore the file times are not taken into account at all.\n\nWith this option enabled the decision tree is smaller:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText66->Wrap( 500 ); - bSizer74->Add( m_staticText66, 0, wxALL, 5 ); - - m_treeCtrl2 = new wxTreeCtrl( m_scrolledWindow5, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE ); - m_treeCtrl2->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - m_treeCtrl2->SetMinSize( wxSize( -1,130 ) ); - - bSizer74->Add( m_treeCtrl2, 0, wxALL|wxEXPAND, 5 ); - - m_staticText69 = new wxStaticText( m_scrolledWindow5, wxID_ANY, _("As a result the files are separated into the following categories:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText69->Wrap( 500 ); - bSizer74->Add( m_staticText69, 0, wxALL, 5 ); - - m_staticText81 = new wxStaticText( m_scrolledWindow5, wxID_ANY, _("- equal"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText81->Wrap( -1 ); - bSizer74->Add( m_staticText81, 0, wxRIGHT|wxLEFT, 5 ); - - m_staticText82 = new wxStaticText( m_scrolledWindow5, wxID_ANY, _("- different"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText82->Wrap( -1 ); - bSizer74->Add( m_staticText82, 0, wxRIGHT|wxLEFT, 5 ); - - m_staticText83 = new wxStaticText( m_scrolledWindow5, wxID_ANY, _("- exists left only"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText83->Wrap( -1 ); - bSizer74->Add( m_staticText83, 0, wxRIGHT|wxLEFT, 5 ); - - m_staticText84 = new wxStaticText( m_scrolledWindow5, wxID_ANY, _("- exists right only"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText84->Wrap( -1 ); - bSizer74->Add( m_staticText84, 0, wxRIGHT|wxLEFT, 5 ); - - m_scrolledWindow5->SetSizer( bSizer74 ); - m_scrolledWindow5->Layout(); - bSizer74->Fit( m_scrolledWindow5 ); - m_notebook1->AddPage( m_scrolledWindow5, _("File content"), false ); - - bSizer20->Add( m_notebook1, 1, wxEXPAND | wxALL, 5 ); - - m_button8 = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( 100,32 ), 0 ); - m_button8->SetDefault(); - m_button8->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer20->Add( m_button8, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - this->SetSizer( bSizer20 ); - this->Layout(); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( HelpDlgGenerated::OnClose ) ); - m_button8->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HelpDlgGenerated::OnOK ), NULL, this ); + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer20; + bSizer20 = new wxBoxSizer( wxVERTICAL ); + + + bSizer20->Add( 0, 10, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer85; + bSizer85 = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmap25 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), 0 ); + bSizer85->Add( m_bitmap25, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_panel8 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER|wxTAB_TRAVERSAL ); + m_panel8->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DLIGHT ) ); + + wxBoxSizer* bSizer72; + bSizer72 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer72->Add( 20, 0, 0, 0, 5 ); + + m_staticText56 = new wxStaticText( m_panel8, wxID_ANY, _("Help"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText56->Wrap( -1 ); + m_staticText56->SetFont( wxFont( 16, 70, 90, 92, false, wxEmptyString ) ); + + bSizer72->Add( m_staticText56, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer72->Add( 20, 0, 0, 0, 5 ); + + m_panel8->SetSizer( bSizer72 ); + m_panel8->Layout(); + bSizer72->Fit( m_panel8 ); + bSizer85->Add( m_panel8, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + bSizer85->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer20->Add( bSizer85, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_notebook1 = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + m_scrolledWindow1 = new wxScrolledWindow( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxSIMPLE_BORDER|wxVSCROLL ); + m_scrolledWindow1->SetScrollRate( 5, 5 ); + m_scrolledWindow1->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INACTIVEBORDER ) ); + + wxBoxSizer* bSizer70; + bSizer70 = new wxBoxSizer( wxVERTICAL ); + + m_staticText59 = new wxStaticText( m_scrolledWindow1, wxID_ANY, _("Compare by \"File size and date\""), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText59->Wrap( 500 ); + m_staticText59->SetFont( wxFont( 10, 70, 90, 92, true, wxEmptyString ) ); + + bSizer70->Add( m_staticText59, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_staticText60 = new wxStaticText( m_scrolledWindow1, wxID_ANY, _("This variant evaluates two equally named files as being equal when they have the same file size AND the same last write date and time."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText60->Wrap( 500 ); + bSizer70->Add( m_staticText60, 0, wxALL, 5 ); + + m_staticText61 = new wxStaticText( m_scrolledWindow1, wxID_ANY, _("When the comparison is started with this option set the following decision tree is processed:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText61->Wrap( 500 ); + bSizer70->Add( m_staticText61, 0, wxALL, 5 ); + + m_treeCtrl1 = new wxTreeCtrl( m_scrolledWindow1, wxID_ANY, wxDefaultPosition, wxSize( -1,175 ), wxTR_DEFAULT_STYLE ); + m_treeCtrl1->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + + bSizer70->Add( m_treeCtrl1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + m_staticText63 = new wxStaticText( m_scrolledWindow1, wxID_ANY, _("As a result the files are separated into the following categories:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText63->Wrap( 500 ); + bSizer70->Add( m_staticText63, 0, wxALL, 5 ); + + m_staticText75 = new wxStaticText( m_scrolledWindow1, wxID_ANY, _("- equal"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText75->Wrap( -1 ); + bSizer70->Add( m_staticText75, 0, wxRIGHT|wxLEFT, 5 ); + + m_staticText76 = new wxStaticText( m_scrolledWindow1, wxID_ANY, _("- left newer"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText76->Wrap( -1 ); + bSizer70->Add( m_staticText76, 0, wxRIGHT|wxLEFT, 5 ); + + m_staticText77 = new wxStaticText( m_scrolledWindow1, wxID_ANY, _("- right newer"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText77->Wrap( -1 ); + bSizer70->Add( m_staticText77, 0, wxRIGHT|wxLEFT, 5 ); + + m_staticText79 = new wxStaticText( m_scrolledWindow1, wxID_ANY, _("- exists left only"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText79->Wrap( -1 ); + bSizer70->Add( m_staticText79, 0, wxRIGHT|wxLEFT, 5 ); + + m_staticText80 = new wxStaticText( m_scrolledWindow1, wxID_ANY, _("- exists right only"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText80->Wrap( -1 ); + bSizer70->Add( m_staticText80, 0, wxRIGHT|wxLEFT, 5 ); + + m_staticText78 = new wxStaticText( m_scrolledWindow1, wxID_ANY, _("- conflict"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText78->Wrap( -1 ); + bSizer70->Add( m_staticText78, 0, wxRIGHT|wxLEFT, 5 ); + + m_scrolledWindow1->SetSizer( bSizer70 ); + m_scrolledWindow1->Layout(); + bSizer70->Fit( m_scrolledWindow1 ); + m_notebook1->AddPage( m_scrolledWindow1, _("File size and date"), true ); + m_scrolledWindow5 = new wxScrolledWindow( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxSIMPLE_BORDER|wxVSCROLL ); + m_scrolledWindow5->SetScrollRate( 5, 5 ); + m_scrolledWindow5->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INACTIVEBORDER ) ); + + wxBoxSizer* bSizer74; + bSizer74 = new wxBoxSizer( wxVERTICAL ); + + m_staticText65 = new wxStaticText( m_scrolledWindow5, wxID_ANY, _("Compare by \"File content\""), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText65->Wrap( 500 ); + m_staticText65->SetFont( wxFont( 10, 70, 90, 92, true, wxEmptyString ) ); + + bSizer74->Add( m_staticText65, 0, wxALL, 5 ); + + m_staticText66 = new wxStaticText( m_scrolledWindow5, wxID_ANY, _("As the name suggests, two files which share the same name are marked as equal if and only if they have the same content. This option is useful for consistency checks rather than backup operations. Therefore the file times are not taken into account at all.\n\nWith this option enabled the decision tree is smaller:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText66->Wrap( 500 ); + bSizer74->Add( m_staticText66, 0, wxALL, 5 ); + + m_treeCtrl2 = new wxTreeCtrl( m_scrolledWindow5, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE ); + m_treeCtrl2->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + m_treeCtrl2->SetMinSize( wxSize( -1,130 ) ); + + bSizer74->Add( m_treeCtrl2, 0, wxALL|wxEXPAND, 5 ); + + m_staticText69 = new wxStaticText( m_scrolledWindow5, wxID_ANY, _("As a result the files are separated into the following categories:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText69->Wrap( 500 ); + bSizer74->Add( m_staticText69, 0, wxALL, 5 ); + + m_staticText81 = new wxStaticText( m_scrolledWindow5, wxID_ANY, _("- equal"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText81->Wrap( -1 ); + bSizer74->Add( m_staticText81, 0, wxRIGHT|wxLEFT, 5 ); + + m_staticText82 = new wxStaticText( m_scrolledWindow5, wxID_ANY, _("- different"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText82->Wrap( -1 ); + bSizer74->Add( m_staticText82, 0, wxRIGHT|wxLEFT, 5 ); + + m_staticText83 = new wxStaticText( m_scrolledWindow5, wxID_ANY, _("- exists left only"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText83->Wrap( -1 ); + bSizer74->Add( m_staticText83, 0, wxRIGHT|wxLEFT, 5 ); + + m_staticText84 = new wxStaticText( m_scrolledWindow5, wxID_ANY, _("- exists right only"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText84->Wrap( -1 ); + bSizer74->Add( m_staticText84, 0, wxRIGHT|wxLEFT, 5 ); + + m_scrolledWindow5->SetSizer( bSizer74 ); + m_scrolledWindow5->Layout(); + bSizer74->Fit( m_scrolledWindow5 ); + m_notebook1->AddPage( m_scrolledWindow5, _("File content"), false ); + + bSizer20->Add( m_notebook1, 1, wxEXPAND | wxALL, 5 ); + + m_button8 = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( 100,32 ), 0 ); + m_button8->SetDefault(); + m_button8->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer20->Add( m_button8, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + this->SetSizer( bSizer20 ); + this->Layout(); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( HelpDlgGenerated::OnClose ) ); + m_button8->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HelpDlgGenerated::OnOK ), NULL, this ); } HelpDlgGenerated::~HelpDlgGenerated() { - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( HelpDlgGenerated::OnClose ) ); - m_button8->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HelpDlgGenerated::OnOK ), NULL, this ); - + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( HelpDlgGenerated::OnClose ) ); + m_button8->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HelpDlgGenerated::OnOK ), NULL, this ); + } AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bSizer31; - bSizer31 = new wxBoxSizer( wxVERTICAL ); - - - bSizer31->Add( 0, 5, 0, 0, 5 ); - - m_panel5 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxSIMPLE_BORDER|wxTAB_TRAVERSAL ); - m_panel5->SetBackgroundColour( wxColour( 255, 255, 255 ) ); - - wxBoxSizer* bSizer36; - bSizer36 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmap11 = new wxStaticBitmap( m_panel5, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 404,55 ), 0 ); - bSizer36->Add( m_bitmap11, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_panel5->SetSizer( bSizer36 ); - m_panel5->Layout(); - bSizer36->Fit( m_panel5 ); - bSizer31->Add( m_panel5, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_build = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_build->Wrap( -1 ); - m_build->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) ); - - bSizer31->Add( m_build, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - - bSizer31->Add( 0, 10, 0, 0, 5 ); - - wxBoxSizer* bSizer53; - bSizer53 = new wxBoxSizer( wxVERTICAL ); - - m_scrolledWindowCodeInfo = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDOUBLE_BORDER|wxHSCROLL|wxVSCROLL ); - m_scrolledWindowCodeInfo->SetScrollRate( 5, 5 ); - m_scrolledWindowCodeInfo->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - m_scrolledWindowCodeInfo->SetMinSize( wxSize( -1,120 ) ); - - bSizerCodeInfo = new wxBoxSizer( wxVERTICAL ); - - m_staticText72 = new wxStaticText( m_scrolledWindowCodeInfo, wxID_ANY, _("Source code written completely in C++ utilizing:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText72->Wrap( -1 ); - m_staticText72->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - - bSizerCodeInfo->Add( m_staticText72, 0, wxTOP|wxBOTTOM|wxLEFT|wxEXPAND, 5 ); - - m_staticText73 = new wxStaticText( m_scrolledWindowCodeInfo, wxID_ANY, _(" MinGW \t- Windows port of GNU Compiler Collection\n wxWidgets \t- Open-Source GUI framework\n wxFormBuilder\t- wxWidgets GUI-builder\n CodeBlocks \t- Open-Source IDE"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText73->Wrap( -1 ); - bSizerCodeInfo->Add( m_staticText73, 0, wxALL|wxEXPAND, 5 ); - - m_hyperlink21 = new wxHyperlinkCtrl( m_scrolledWindowCodeInfo, wxID_ANY, _("- ZenJu -"), wxT("mailto:zhnmju123@gmx.de"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink21->SetFont( wxFont( 10, 74, 93, 92, false, wxT("Segoe Print") ) ); - m_hyperlink21->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - m_hyperlink21->SetToolTip( _("zhnmju123@gmx.de") ); - - bSizerCodeInfo->Add( m_hyperlink21, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_scrolledWindowCodeInfo->SetSizer( bSizerCodeInfo ); - m_scrolledWindowCodeInfo->Layout(); - bSizerCodeInfo->Fit( m_scrolledWindowCodeInfo ); - bSizer53->Add( m_scrolledWindowCodeInfo, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM, 10 ); - - m_scrolledWindowTranslators = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxDOUBLE_BORDER|wxHSCROLL|wxVSCROLL ); - m_scrolledWindowTranslators->SetScrollRate( 5, 5 ); - m_scrolledWindowTranslators->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - m_scrolledWindowTranslators->SetMinSize( wxSize( -1,140 ) ); - m_scrolledWindowTranslators->SetMaxSize( wxSize( -1,145 ) ); - - bSizerTranslators = new wxBoxSizer( wxVERTICAL ); - - m_staticText54 = new wxStaticText( m_scrolledWindowTranslators, wxID_ANY, _("Big thanks for localizing FreeFileSync goes out to:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText54->Wrap( -1 ); - m_staticText54->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); - - bSizerTranslators->Add( m_staticText54, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM, 5 ); - - - bSizerTranslators->Add( 0, 5, 0, 0, 5 ); - - fgSizerTranslators = new wxFlexGridSizer( 50, 3, 5, 20 ); - fgSizerTranslators->SetFlexibleDirection( wxBOTH ); - fgSizerTranslators->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - bSizerTranslators->Add( fgSizerTranslators, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_scrolledWindowTranslators->SetSizer( bSizerTranslators ); - m_scrolledWindowTranslators->Layout(); - bSizerTranslators->Fit( m_scrolledWindowTranslators ); - bSizer53->Add( m_scrolledWindowTranslators, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM, 5 ); - - bSizer31->Add( bSizer53, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT|wxEXPAND, 25 ); - - m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizer31->Add( m_staticline3, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); - - m_staticText131 = new wxStaticText( this, wxID_ANY, _("Feedback and suggestions are welcome at:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText131->Wrap( -1 ); - m_staticText131->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - - bSizer31->Add( m_staticText131, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_staticline12 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizer31->Add( m_staticline12, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); - - wxBoxSizer* bSizer104; - bSizer104 = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizer103; - bSizer103 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmap9 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 48,48 ), 0 ); - m_bitmap9->SetToolTip( _("FreeFileSync at Sourceforge") ); - - bSizer103->Add( m_bitmap9, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_hyperlink1 = new wxHyperlinkCtrl( this, wxID_ANY, _("Homepage"), wxT("http://sourceforge.net/projects/freefilesync/"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink1->SetFont( wxFont( 10, 70, 90, 92, true, wxEmptyString ) ); - m_hyperlink1->SetToolTip( _("http://sourceforge.net/projects/freefilesync/") ); - - bSizer103->Add( m_hyperlink1, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer103->Add( 20, 0, 1, wxEXPAND, 5 ); - - m_hyperlink6 = new wxHyperlinkCtrl( this, wxID_ANY, _("Report translation error"), wxT("http://sourceforge.net/projects/freefilesync/forums/forum/976976"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink6->SetFont( wxFont( 10, 70, 90, 92, true, wxEmptyString ) ); - m_hyperlink6->SetToolTip( _("http://sourceforge.net/projects/freefilesync/forums/forum/976976") ); - - bSizer103->Add( m_hyperlink6, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - bSizer104->Add( bSizer103, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - wxBoxSizer* bSizer108; - bSizer108 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmap10 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 48,48 ), 0 ); - m_bitmap10->SetToolTip( _("Email") ); - - bSizer108->Add( m_bitmap10, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_hyperlink2 = new wxHyperlinkCtrl( this, wxID_ANY, _("Email"), wxT("mailto:zhnmju123@gmx.de"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink2->SetFont( wxFont( 10, 70, 90, 92, true, wxEmptyString ) ); - m_hyperlink2->SetToolTip( _("zhnmju123@gmx.de") ); - - bSizer108->Add( m_hyperlink2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer108->Add( 30, 0, 1, wxEXPAND, 5 ); - - m_animationControl1 = new wxAnimationCtrl( this, wxID_ANY, wxNullAnimation, wxDefaultPosition, wxSize( -1,-1 ), wxAC_DEFAULT_STYLE ); - m_animationControl1->SetToolTip( _("Donate with PayPal") ); - m_animationControl1->SetMinSize( wxSize( 48,48 ) ); - - bSizer108->Add( m_animationControl1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_hyperlink3 = new wxHyperlinkCtrl( this, wxID_ANY, _("If you like FFS"), wxT("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=zhnmju123%40gmx%2ede&no_shipping=0&no_note=1&tax=0¤cy_code=EUR&lc=EN&bn=PP%2dDonationsBF&charset=UTF%2d8"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink3->SetFont( wxFont( 10, 70, 90, 92, true, wxEmptyString ) ); - m_hyperlink3->SetToolTip( _("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=zhnmju123%40gmx%2ede&no_shipping=0&no_note=1&tax=0¤cy_code=EUR&lc=EN&bn=PP%2dDonationsBF&charset=UTF%2d8") ); - - bSizer108->Add( m_hyperlink3, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - bSizer104->Add( bSizer108, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - bSizer31->Add( bSizer104, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizer31->Add( m_staticline2, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); - - wxStaticBoxSizer* sbSizer14; - sbSizer14 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Published under the GNU General Public License:") ), wxHORIZONTAL ); - - - sbSizer14->Add( 0, 0, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - - m_bitmap13 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 88,31 ), 0 ); - sbSizer14->Add( m_bitmap13, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_hyperlink5 = new wxHyperlinkCtrl( this, wxID_ANY, _("http://www.gnu.org/licenses/gpl.html"), wxT("http://www.gnu.org/licenses/gpl.html"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - sbSizer14->Add( m_hyperlink5, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - - sbSizer14->Add( 0, 0, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer31->Add( sbSizer14, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxRIGHT|wxLEFT, 5 ); - - m_buttonOkay = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( 100,32 ), 0 ); - m_buttonOkay->SetDefault(); - m_buttonOkay->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer31->Add( m_buttonOkay, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); - - this->SetSizer( bSizer31 ); - this->Layout(); - bSizer31->Fit( this ); - - this->Centre( wxBOTH ); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( AboutDlgGenerated::OnClose ) ); - m_buttonOkay->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AboutDlgGenerated::OnOK ), NULL, this ); + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer31; + bSizer31 = new wxBoxSizer( wxVERTICAL ); + + + bSizer31->Add( 0, 5, 0, 0, 5 ); + + m_panel5 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxSIMPLE_BORDER|wxTAB_TRAVERSAL ); + m_panel5->SetBackgroundColour( wxColour( 255, 255, 255 ) ); + + wxBoxSizer* bSizer36; + bSizer36 = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmap11 = new wxStaticBitmap( m_panel5, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 404,55 ), 0 ); + bSizer36->Add( m_bitmap11, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_panel5->SetSizer( bSizer36 ); + m_panel5->Layout(); + bSizer36->Fit( m_panel5 ); + bSizer31->Add( m_panel5, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_build = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_build->Wrap( -1 ); + m_build->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) ); + + bSizer31->Add( m_build, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + bSizer31->Add( 0, 10, 0, 0, 5 ); + + wxBoxSizer* bSizer53; + bSizer53 = new wxBoxSizer( wxVERTICAL ); + + m_scrolledWindowCodeInfo = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDOUBLE_BORDER|wxHSCROLL|wxVSCROLL ); + m_scrolledWindowCodeInfo->SetScrollRate( 5, 5 ); + m_scrolledWindowCodeInfo->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + m_scrolledWindowCodeInfo->SetMinSize( wxSize( -1,120 ) ); + + bSizerCodeInfo = new wxBoxSizer( wxVERTICAL ); + + m_staticText72 = new wxStaticText( m_scrolledWindowCodeInfo, wxID_ANY, _("Source code written completely in C++ utilizing:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText72->Wrap( -1 ); + m_staticText72->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); + + bSizerCodeInfo->Add( m_staticText72, 0, wxTOP|wxBOTTOM|wxLEFT|wxEXPAND, 5 ); + + m_staticText73 = new wxStaticText( m_scrolledWindowCodeInfo, wxID_ANY, _(" MinGW \t- Windows port of GNU Compiler Collection\n wxWidgets \t- Open-Source GUI framework\n wxFormBuilder\t- wxWidgets GUI-builder\n CodeBlocks \t- Open-Source IDE"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText73->Wrap( -1 ); + bSizerCodeInfo->Add( m_staticText73, 0, wxALL|wxEXPAND, 5 ); + + m_hyperlink21 = new wxHyperlinkCtrl( m_scrolledWindowCodeInfo, wxID_ANY, _("- ZenJu -"), wxT("mailto:zhnmju123@gmx.de"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink21->SetFont( wxFont( 10, 74, 93, 92, false, wxT("Segoe Print") ) ); + m_hyperlink21->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + m_hyperlink21->SetToolTip( _("zhnmju123@gmx.de") ); + + bSizerCodeInfo->Add( m_hyperlink21, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_scrolledWindowCodeInfo->SetSizer( bSizerCodeInfo ); + m_scrolledWindowCodeInfo->Layout(); + bSizerCodeInfo->Fit( m_scrolledWindowCodeInfo ); + bSizer53->Add( m_scrolledWindowCodeInfo, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM, 10 ); + + m_scrolledWindowTranslators = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxDOUBLE_BORDER|wxHSCROLL|wxVSCROLL ); + m_scrolledWindowTranslators->SetScrollRate( 5, 5 ); + m_scrolledWindowTranslators->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + m_scrolledWindowTranslators->SetMinSize( wxSize( -1,140 ) ); + m_scrolledWindowTranslators->SetMaxSize( wxSize( -1,145 ) ); + + bSizerTranslators = new wxBoxSizer( wxVERTICAL ); + + m_staticText54 = new wxStaticText( m_scrolledWindowTranslators, wxID_ANY, _("Big thanks for localizing FreeFileSync goes out to:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText54->Wrap( -1 ); + m_staticText54->SetFont( wxFont( 8, 70, 90, 92, false, wxEmptyString ) ); + + bSizerTranslators->Add( m_staticText54, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM, 5 ); + + + bSizerTranslators->Add( 0, 5, 0, 0, 5 ); + + fgSizerTranslators = new wxFlexGridSizer( 50, 3, 5, 20 ); + fgSizerTranslators->SetFlexibleDirection( wxBOTH ); + fgSizerTranslators->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + bSizerTranslators->Add( fgSizerTranslators, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_scrolledWindowTranslators->SetSizer( bSizerTranslators ); + m_scrolledWindowTranslators->Layout(); + bSizerTranslators->Fit( m_scrolledWindowTranslators ); + bSizer53->Add( m_scrolledWindowTranslators, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM, 5 ); + + bSizer31->Add( bSizer53, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT|wxEXPAND, 25 ); + + m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizer31->Add( m_staticline3, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + m_staticText131 = new wxStaticText( this, wxID_ANY, _("Feedback and suggestions are welcome at:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText131->Wrap( -1 ); + m_staticText131->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); + + bSizer31->Add( m_staticText131, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_staticline12 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizer31->Add( m_staticline12, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + wxBoxSizer* bSizer156; + bSizer156 = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmap9 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 48,48 ), 0 ); + m_bitmap9->SetToolTip( _("FreeFileSync at Sourceforge") ); + + bSizer156->Add( m_bitmap9, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + m_hyperlink1 = new wxHyperlinkCtrl( this, wxID_ANY, _("Homepage"), wxT("http://sourceforge.net/projects/freefilesync/"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink1->SetFont( wxFont( 10, 70, 90, 92, true, wxEmptyString ) ); + m_hyperlink1->SetToolTip( _("http://sourceforge.net/projects/freefilesync/") ); + + bSizer156->Add( m_hyperlink1, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer156->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_hyperlink3 = new wxHyperlinkCtrl( this, wxID_ANY, _("If you like FFS"), wxT("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=zhnmju123%40gmx%2ede&no_shipping=0&no_note=1&tax=0¤cy_code=EUR&lc=EN&bn=PP%2dDonationsBF&charset=UTF%2d8"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink3->SetFont( wxFont( 10, 70, 90, 92, true, wxEmptyString ) ); + m_hyperlink3->SetToolTip( _("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=zhnmju123%40gmx%2ede&no_shipping=0&no_note=1&tax=0¤cy_code=EUR&lc=EN&bn=PP%2dDonationsBF&charset=UTF%2d8") ); + + bSizer156->Add( m_hyperlink3, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_animationControl1 = new wxAnimationCtrl( this, wxID_ANY, wxNullAnimation, wxDefaultPosition, wxSize( -1,-1 ), wxAC_DEFAULT_STYLE ); + m_animationControl1->SetToolTip( _("Donate with PayPal") ); + m_animationControl1->SetMinSize( wxSize( 48,48 ) ); + + bSizer156->Add( m_animationControl1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + bSizer31->Add( bSizer156, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxRIGHT|wxLEFT, 10 ); + + wxBoxSizer* bSizer158; + bSizer158 = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmap10 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 48,48 ), 0 ); + m_bitmap10->SetToolTip( _("Email") ); + + bSizer158->Add( m_bitmap10, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + m_hyperlink2 = new wxHyperlinkCtrl( this, wxID_ANY, _("Email"), wxT("mailto:zhnmju123@gmx.de"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink2->SetFont( wxFont( 10, 70, 90, 92, true, wxEmptyString ) ); + m_hyperlink2->SetToolTip( _("zhnmju123@gmx.de") ); + + bSizer158->Add( m_hyperlink2, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer158->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_hyperlink6 = new wxHyperlinkCtrl( this, wxID_ANY, _("Report translation error"), wxT("http://sourceforge.net/projects/freefilesync/forums/forum/976976"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink6->SetFont( wxFont( 10, 70, 90, 92, true, wxEmptyString ) ); + m_hyperlink6->SetToolTip( _("http://sourceforge.net/projects/freefilesync/forums/forum/976976") ); + + bSizer158->Add( m_hyperlink6, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_bitmapTransl = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 48,48 ), 0 ); + m_bitmapTransl->SetToolTip( _("Report translation error") ); + + bSizer158->Add( m_bitmapTransl, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + bSizer31->Add( bSizer158, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxRIGHT|wxLEFT, 10 ); + + m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizer31->Add( m_staticline2, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + wxStaticBoxSizer* sbSizer14; + sbSizer14 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Published under the GNU General Public License:") ), wxHORIZONTAL ); + + + sbSizer14->Add( 0, 0, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + m_bitmap13 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 88,31 ), 0 ); + sbSizer14->Add( m_bitmap13, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_hyperlink5 = new wxHyperlinkCtrl( this, wxID_ANY, _("http://www.gnu.org/licenses/gpl.html"), wxT("http://www.gnu.org/licenses/gpl.html"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + sbSizer14->Add( m_hyperlink5, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + + sbSizer14->Add( 0, 0, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer31->Add( sbSizer14, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + m_buttonOkay = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( 100,32 ), 0 ); + m_buttonOkay->SetDefault(); + m_buttonOkay->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer31->Add( m_buttonOkay, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); + + this->SetSizer( bSizer31 ); + this->Layout(); + bSizer31->Fit( this ); + + this->Centre( wxBOTH ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( AboutDlgGenerated::OnClose ) ); + m_buttonOkay->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AboutDlgGenerated::OnOK ), NULL, this ); } AboutDlgGenerated::~AboutDlgGenerated() { - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( AboutDlgGenerated::OnClose ) ); - m_buttonOkay->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AboutDlgGenerated::OnOK ), NULL, this ); - + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( AboutDlgGenerated::OnClose ) ); + m_buttonOkay->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AboutDlgGenerated::OnOK ), NULL, this ); + } ErrorDlgGenerated::ErrorDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bSizer24; - bSizer24 = new wxBoxSizer( wxVERTICAL ); - - - bSizer24->Add( 0, 10, 0, wxEXPAND, 5 ); - - wxBoxSizer* bSizer26; - bSizer26 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmap10 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 48,48 ), 0 ); - bSizer26->Add( m_bitmap10, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_textCtrl8 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE|wxTE_READONLY ); - m_textCtrl8->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - - bSizer26->Add( m_textCtrl8, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 ); - - bSizer24->Add( bSizer26, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - m_checkBoxIgnoreErrors = new wxCheckBox( this, wxID_ANY, _("Ignore subsequent errors"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkBoxIgnoreErrors->SetToolTip( _("Hide further error messages during the current process") ); - - bSizer24->Add( m_checkBoxIgnoreErrors, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP, 10 ); - - - bSizer24->Add( 0, 5, 0, wxEXPAND, 5 ); - - wxBoxSizer* bSizer25; - bSizer25 = new wxBoxSizer( wxHORIZONTAL ); - - m_buttonIgnore = new wxButton( this, wxID_OK, _("&Ignore"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonIgnore->SetDefault(); - m_buttonIgnore->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer25->Add( m_buttonIgnore, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); - - m_buttonRetry = new wxButton( this, wxID_RETRY, _("&Retry"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonRetry->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer25->Add( m_buttonRetry, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); - - m_buttonAbort = new wxButton( this, wxID_CANCEL, _("&Abort"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonAbort->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer25->Add( m_buttonAbort, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); - - - bSizer25->Add( 5, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer24->Add( bSizer25, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - this->SetSizer( bSizer24 ); - this->Layout(); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( ErrorDlgGenerated::OnClose ) ); - m_buttonIgnore->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnIgnore ), NULL, this ); - m_buttonRetry->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnRetry ), NULL, this ); - m_buttonAbort->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnAbort ), NULL, this ); + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer24; + bSizer24 = new wxBoxSizer( wxVERTICAL ); + + + bSizer24->Add( 0, 10, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer26; + bSizer26 = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmap10 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 48,48 ), 0 ); + bSizer26->Add( m_bitmap10, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_textCtrl8 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE|wxTE_READONLY ); + m_textCtrl8->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + + bSizer26->Add( m_textCtrl8, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + bSizer24->Add( bSizer26, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + m_checkBoxIgnoreErrors = new wxCheckBox( this, wxID_ANY, _("Ignore subsequent errors"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxIgnoreErrors->SetToolTip( _("Hide further error messages during the current process") ); + + bSizer24->Add( m_checkBoxIgnoreErrors, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP, 10 ); + + + bSizer24->Add( 0, 5, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer25; + bSizer25 = new wxBoxSizer( wxHORIZONTAL ); + + m_buttonIgnore = new wxButton( this, wxID_OK, _("&Ignore"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonIgnore->SetDefault(); + m_buttonIgnore->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer25->Add( m_buttonIgnore, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_buttonRetry = new wxButton( this, wxID_RETRY, _("&Retry"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonRetry->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer25->Add( m_buttonRetry, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_buttonAbort = new wxButton( this, wxID_CANCEL, _("&Abort"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonAbort->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer25->Add( m_buttonAbort, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); + + + bSizer25->Add( 5, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer24->Add( bSizer25, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + this->SetSizer( bSizer24 ); + this->Layout(); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( ErrorDlgGenerated::OnClose ) ); + m_buttonIgnore->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnIgnore ), NULL, this ); + m_buttonRetry->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnRetry ), NULL, this ); + m_buttonAbort->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnAbort ), NULL, this ); } ErrorDlgGenerated::~ErrorDlgGenerated() { - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( ErrorDlgGenerated::OnClose ) ); - m_buttonIgnore->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnIgnore ), NULL, this ); - m_buttonRetry->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnRetry ), NULL, this ); - m_buttonAbort->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnAbort ), NULL, this ); - + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( ErrorDlgGenerated::OnClose ) ); + m_buttonIgnore->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnIgnore ), NULL, this ); + m_buttonRetry->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnRetry ), NULL, this ); + m_buttonAbort->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnAbort ), NULL, this ); + } WarningDlgGenerated::WarningDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bSizer24; - bSizer24 = new wxBoxSizer( wxVERTICAL ); - - - bSizer24->Add( 0, 10, 0, wxEXPAND, 5 ); - - wxBoxSizer* bSizer26; - bSizer26 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmap10 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 48,48 ), 0 ); - bSizer26->Add( m_bitmap10, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_textCtrl8 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE|wxTE_READONLY ); - m_textCtrl8->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - - bSizer26->Add( m_textCtrl8, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 ); - - bSizer24->Add( bSizer26, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - m_checkBoxDontShowAgain = new wxCheckBox( this, wxID_ANY, _("Do not show this dialog again"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer24->Add( m_checkBoxDontShowAgain, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP, 10 ); - - - bSizer24->Add( 0, 5, 0, wxEXPAND, 5 ); - - wxBoxSizer* bSizer25; - bSizer25 = new wxBoxSizer( wxHORIZONTAL ); - - m_buttonIgnore = new wxButton( this, wxID_IGNORE, _("&Ignore"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonIgnore->SetDefault(); - m_buttonIgnore->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer25->Add( m_buttonIgnore, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); - - m_buttonSwitch = new wxButton( this, wxID_MORE, _("&Switch"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonSwitch->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer25->Add( m_buttonSwitch, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); - - m_buttonAbort = new wxButton( this, wxID_CANCEL, _("&Abort"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonAbort->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer25->Add( m_buttonAbort, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); - - - bSizer25->Add( 5, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer24->Add( bSizer25, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - this->SetSizer( bSizer24 ); - this->Layout(); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( WarningDlgGenerated::OnClose ) ); - m_buttonIgnore->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WarningDlgGenerated::OnIgnore ), NULL, this ); - m_buttonSwitch->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WarningDlgGenerated::OnSwitch ), NULL, this ); - m_buttonAbort->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WarningDlgGenerated::OnAbort ), NULL, this ); + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer24; + bSizer24 = new wxBoxSizer( wxVERTICAL ); + + + bSizer24->Add( 0, 10, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer26; + bSizer26 = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmap10 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 48,48 ), 0 ); + bSizer26->Add( m_bitmap10, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_textCtrl8 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE|wxTE_READONLY ); + m_textCtrl8->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + + bSizer26->Add( m_textCtrl8, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + bSizer24->Add( bSizer26, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + m_checkBoxDontShowAgain = new wxCheckBox( this, wxID_ANY, _("Do not show this dialog again"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer24->Add( m_checkBoxDontShowAgain, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP, 10 ); + + + bSizer24->Add( 0, 5, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer25; + bSizer25 = new wxBoxSizer( wxHORIZONTAL ); + + m_buttonIgnore = new wxButton( this, wxID_IGNORE, _("&Ignore"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonIgnore->SetDefault(); + m_buttonIgnore->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer25->Add( m_buttonIgnore, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_buttonSwitch = new wxButton( this, wxID_MORE, _("&Switch"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonSwitch->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer25->Add( m_buttonSwitch, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_buttonAbort = new wxButton( this, wxID_CANCEL, _("&Abort"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonAbort->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer25->Add( m_buttonAbort, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); + + + bSizer25->Add( 5, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer24->Add( bSizer25, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + this->SetSizer( bSizer24 ); + this->Layout(); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( WarningDlgGenerated::OnClose ) ); + m_buttonIgnore->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WarningDlgGenerated::OnIgnore ), NULL, this ); + m_buttonSwitch->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WarningDlgGenerated::OnSwitch ), NULL, this ); + m_buttonAbort->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WarningDlgGenerated::OnAbort ), NULL, this ); } WarningDlgGenerated::~WarningDlgGenerated() { - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( WarningDlgGenerated::OnClose ) ); - m_buttonIgnore->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WarningDlgGenerated::OnIgnore ), NULL, this ); - m_buttonSwitch->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WarningDlgGenerated::OnSwitch ), NULL, this ); - m_buttonAbort->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WarningDlgGenerated::OnAbort ), NULL, this ); - + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( WarningDlgGenerated::OnClose ) ); + m_buttonIgnore->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WarningDlgGenerated::OnIgnore ), NULL, this ); + m_buttonSwitch->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WarningDlgGenerated::OnSwitch ), NULL, this ); + m_buttonAbort->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WarningDlgGenerated::OnAbort ), NULL, this ); + } QuestionDlgGenerated::QuestionDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bSizer24; - bSizer24 = new wxBoxSizer( wxVERTICAL ); - - - bSizer24->Add( 0, 10, 0, wxEXPAND, 5 ); - - wxBoxSizer* bSizer26; - bSizer26 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmap10 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 48,48 ), 0 ); - bSizer26->Add( m_bitmap10, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_textCtrl8 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE|wxTE_READONLY ); - m_textCtrl8->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - - bSizer26->Add( m_textCtrl8, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 ); - - bSizer24->Add( bSizer26, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - m_checkBoxDontAskAgain = new wxCheckBox( this, wxID_ANY, _("Do not show this dialog again"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer24->Add( m_checkBoxDontAskAgain, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP, 10 ); - - - bSizer24->Add( 0, 5, 0, wxEXPAND, 5 ); - - wxBoxSizer* bSizer25; - bSizer25 = new wxBoxSizer( wxHORIZONTAL ); - - m_buttonYes = new wxButton( this, wxID_YES, _("&Yes"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonYes->SetDefault(); - m_buttonYes->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer25->Add( m_buttonYes, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); - - m_buttonNo = new wxButton( this, wxID_NO, _("&No"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonNo->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer25->Add( m_buttonNo, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); - - m_buttonCancel = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonCancel->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer25->Add( m_buttonCancel, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); - - - bSizer25->Add( 5, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer24->Add( bSizer25, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - this->SetSizer( bSizer24 ); - this->Layout(); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( QuestionDlgGenerated::OnClose ) ); - m_buttonYes->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( QuestionDlgGenerated::OnYes ), NULL, this ); - m_buttonNo->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( QuestionDlgGenerated::OnNo ), NULL, this ); - m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( QuestionDlgGenerated::OnCancel ), NULL, this ); + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer24; + bSizer24 = new wxBoxSizer( wxVERTICAL ); + + + bSizer24->Add( 0, 10, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer26; + bSizer26 = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmap10 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 48,48 ), 0 ); + bSizer26->Add( m_bitmap10, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_textCtrl8 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE|wxTE_READONLY ); + m_textCtrl8->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + + bSizer26->Add( m_textCtrl8, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + bSizer24->Add( bSizer26, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + m_checkBoxDontAskAgain = new wxCheckBox( this, wxID_ANY, _("Do not show this dialog again"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer24->Add( m_checkBoxDontAskAgain, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP, 10 ); + + + bSizer24->Add( 0, 5, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer25; + bSizer25 = new wxBoxSizer( wxHORIZONTAL ); + + m_buttonYes = new wxButton( this, wxID_YES, _("&Yes"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonYes->SetDefault(); + m_buttonYes->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer25->Add( m_buttonYes, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_buttonNo = new wxButton( this, wxID_NO, _("&No"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonNo->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer25->Add( m_buttonNo, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_buttonCancel = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonCancel->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer25->Add( m_buttonCancel, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); + + + bSizer25->Add( 5, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer24->Add( bSizer25, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + this->SetSizer( bSizer24 ); + this->Layout(); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( QuestionDlgGenerated::OnClose ) ); + m_buttonYes->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( QuestionDlgGenerated::OnYes ), NULL, this ); + m_buttonNo->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( QuestionDlgGenerated::OnNo ), NULL, this ); + m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( QuestionDlgGenerated::OnCancel ), NULL, this ); } QuestionDlgGenerated::~QuestionDlgGenerated() { - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( QuestionDlgGenerated::OnClose ) ); - m_buttonYes->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( QuestionDlgGenerated::OnYes ), NULL, this ); - m_buttonNo->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( QuestionDlgGenerated::OnNo ), NULL, this ); - m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( QuestionDlgGenerated::OnCancel ), NULL, this ); - + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( QuestionDlgGenerated::OnClose ) ); + m_buttonYes->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( QuestionDlgGenerated::OnYes ), NULL, this ); + m_buttonNo->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( QuestionDlgGenerated::OnNo ), NULL, this ); + m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( QuestionDlgGenerated::OnCancel ), NULL, this ); + } DeleteDlgGenerated::DeleteDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bSizer24; - bSizer24 = new wxBoxSizer( wxVERTICAL ); - - - bSizer24->Add( 0, 10, 0, wxEXPAND, 5 ); - - wxBoxSizer* bSizer41; - bSizer41 = new wxBoxSizer( wxHORIZONTAL ); - - - bSizer41->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_bitmap12 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), 0 ); - bSizer41->Add( m_bitmap12, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticTextHeader = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextHeader->Wrap( -1 ); - m_staticTextHeader->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer41->Add( m_staticTextHeader, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - - bSizer41->Add( 0, 0, 1, wxEXPAND, 5 ); - - bSizer24->Add( bSizer41, 0, wxEXPAND, 5 ); - - wxBoxSizer* bSizer99; - bSizer99 = new wxBoxSizer( wxHORIZONTAL ); - - m_checkBoxDeleteBothSides = new wxCheckBox( this, wxID_ANY, _("Delete on both sides"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkBoxDeleteBothSides->SetToolTip( _("Delete on both sides even if the file is selected on one side only") ); - - bSizer99->Add( m_checkBoxDeleteBothSides, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer99->Add( 0, 0, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - - m_checkBoxUseRecycler = new wxCheckBox( this, wxID_ANY, _("Use Recycle Bin"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkBoxUseRecycler->SetValue(true); - bSizer99->Add( m_checkBoxUseRecycler, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer24->Add( bSizer99, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 10 ); - - m_textCtrlMessage = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE|wxTE_READONLY ); - m_textCtrlMessage->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - - bSizer24->Add( m_textCtrlMessage, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - wxBoxSizer* bSizer25; - bSizer25 = new wxBoxSizer( wxHORIZONTAL ); - - m_buttonOK = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonOK->SetDefault(); - m_buttonOK->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); - - bSizer25->Add( m_buttonOK, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); - - m_buttonCancel = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonCancel->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer25->Add( m_buttonCancel, 0, wxALL, 5 ); - - bSizer24->Add( bSizer25, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - this->SetSizer( bSizer24 ); - this->Layout(); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DeleteDlgGenerated::OnClose ) ); - m_checkBoxDeleteBothSides->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DeleteDlgGenerated::OnDelOnBothSides ), NULL, this ); - m_checkBoxUseRecycler->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DeleteDlgGenerated::OnUseRecycler ), NULL, this ); - m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DeleteDlgGenerated::OnOK ), NULL, this ); - m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DeleteDlgGenerated::OnCancel ), NULL, this ); + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer24; + bSizer24 = new wxBoxSizer( wxVERTICAL ); + + + bSizer24->Add( 0, 10, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer41; + bSizer41 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer41->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_bitmap12 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), 0 ); + bSizer41->Add( m_bitmap12, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticTextHeader = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextHeader->Wrap( -1 ); + m_staticTextHeader->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer41->Add( m_staticTextHeader, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + bSizer41->Add( 0, 0, 1, wxEXPAND, 5 ); + + bSizer24->Add( bSizer41, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer99; + bSizer99 = new wxBoxSizer( wxHORIZONTAL ); + + m_checkBoxDeleteBothSides = new wxCheckBox( this, wxID_ANY, _("Delete on both sides"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxDeleteBothSides->SetToolTip( _("Delete on both sides even if the file is selected on one side only") ); + + bSizer99->Add( m_checkBoxDeleteBothSides, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer99->Add( 0, 0, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + m_checkBoxUseRecycler = new wxCheckBox( this, wxID_ANY, _("Use Recycle Bin"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxUseRecycler->SetValue(true); + bSizer99->Add( m_checkBoxUseRecycler, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer24->Add( bSizer99, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 10 ); + + m_textCtrlMessage = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE|wxTE_READONLY ); + m_textCtrlMessage->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + + bSizer24->Add( m_textCtrlMessage, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + wxBoxSizer* bSizer25; + bSizer25 = new wxBoxSizer( wxHORIZONTAL ); + + m_buttonOK = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonOK->SetDefault(); + m_buttonOK->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); + + bSizer25->Add( m_buttonOK, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_buttonCancel = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonCancel->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer25->Add( m_buttonCancel, 0, wxALL, 5 ); + + bSizer24->Add( bSizer25, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + this->SetSizer( bSizer24 ); + this->Layout(); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DeleteDlgGenerated::OnClose ) ); + m_checkBoxDeleteBothSides->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DeleteDlgGenerated::OnDelOnBothSides ), NULL, this ); + m_checkBoxUseRecycler->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DeleteDlgGenerated::OnUseRecycler ), NULL, this ); + m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DeleteDlgGenerated::OnOK ), NULL, this ); + m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DeleteDlgGenerated::OnCancel ), NULL, this ); } DeleteDlgGenerated::~DeleteDlgGenerated() { - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DeleteDlgGenerated::OnClose ) ); - m_checkBoxDeleteBothSides->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DeleteDlgGenerated::OnDelOnBothSides ), NULL, this ); - m_checkBoxUseRecycler->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DeleteDlgGenerated::OnUseRecycler ), NULL, this ); - m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DeleteDlgGenerated::OnOK ), NULL, this ); - m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DeleteDlgGenerated::OnCancel ), NULL, this ); - + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DeleteDlgGenerated::OnClose ) ); + m_checkBoxDeleteBothSides->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DeleteDlgGenerated::OnDelOnBothSides ), NULL, this ); + m_checkBoxUseRecycler->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DeleteDlgGenerated::OnUseRecycler ), NULL, this ); + m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DeleteDlgGenerated::OnOK ), NULL, this ); + m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DeleteDlgGenerated::OnCancel ), NULL, this ); + } FilterDlgGenerated::FilterDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bSizer21; - bSizer21 = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizer86; - bSizer86 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmap26 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), 0 ); - bSizer86->Add( m_bitmap26, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_panel8 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER|wxTAB_TRAVERSAL ); - m_panel8->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DLIGHT ) ); - - wxBoxSizer* bSizer72; - bSizer72 = new wxBoxSizer( wxVERTICAL ); - - m_staticTexHeader = new wxStaticText( m_panel8, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTexHeader->Wrap( -1 ); - m_staticTexHeader->SetFont( wxFont( 16, 70, 90, 92, false, wxEmptyString ) ); - - bSizer72->Add( m_staticTexHeader, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); - - m_panel8->SetSizer( bSizer72 ); - m_panel8->Layout(); - bSizer72->Fit( m_panel8 ); - bSizer86->Add( m_panel8, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - - bSizer86->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer21->Add( bSizer86, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM, 5 ); - - wxBoxSizer* bSizer70; - bSizer70 = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText44 = new wxStaticText( this, wxID_ANY, _("Only files/directories that pass filtering will be selected for synchronization. The filter will be applied to the name relative(!) to the base synchronization directories."), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText44->Wrap( 400 ); - bSizer70->Add( m_staticText44, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_bpButtonHelp = new wxBitmapButton( this, wxID_HELP, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - m_bpButtonHelp->SetToolTip( _("Help") ); - - m_bpButtonHelp->SetToolTip( _("Help") ); - - bSizer70->Add( m_bpButtonHelp, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - bSizer21->Add( bSizer70, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 10 ); - - - bSizer21->Add( 0, 5, 0, 0, 5 ); - - m_panel13 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer69; - bSizer69 = new wxBoxSizer( wxVERTICAL ); - - m_staticline10 = new wxStaticLine( m_panel13, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizer69->Add( m_staticline10, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); - - wxBoxSizer* bSizer52; - bSizer52 = new wxBoxSizer( wxVERTICAL ); - - m_staticText45 = new wxStaticText( m_panel13, wxID_ANY, _("Hints:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText45->Wrap( -1 ); - m_staticText45->SetFont( wxFont( 10, 70, 90, 92, true, wxEmptyString ) ); - - bSizer52->Add( m_staticText45, 0, wxBOTTOM, 5 ); - - m_staticText83 = new wxStaticText( m_panel13, wxID_ANY, _("1. Enter relative file or directory names separated by ';' or a new line."), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText83->Wrap( -1 ); - bSizer52->Add( m_staticText83, 0, 0, 5 ); - - m_staticText84 = new wxStaticText( m_panel13, wxID_ANY, _("2. Use wildcard characters '*' and '?'."), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText84->Wrap( -1 ); - bSizer52->Add( m_staticText84, 0, 0, 5 ); - - m_staticText85 = new wxStaticText( m_panel13, wxID_ANY, _("3. Exclude files directly on main grid via context menu."), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText85->Wrap( -1 ); - bSizer52->Add( m_staticText85, 0, 0, 5 ); - - bSizer69->Add( bSizer52, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 10 ); - - wxStaticBoxSizer* sbSizer21; - sbSizer21 = new wxStaticBoxSizer( new wxStaticBox( m_panel13, wxID_ANY, _("Example") ), wxVERTICAL ); - - wxBoxSizer* bSizer66; - bSizer66 = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText181 = new wxStaticText( m_panel13, wxID_ANY, _("Include: *.doc;*.zip;*.exe\nExclude: \\stuff\\temp\\*"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText181->Wrap( -1 ); - bSizer66->Add( m_staticText181, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticText1811 = new wxStaticText( m_panel13, wxID_ANY, _("Synchronize all .doc, .zip and .exe files except everything in subfolder \"temp\"."), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText1811->Wrap( 250 ); - m_staticText1811->SetFont( wxFont( 8, 70, 93, 90, false, wxEmptyString ) ); - - bSizer66->Add( m_staticText1811, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - sbSizer21->Add( bSizer66, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 5 ); - - bSizer69->Add( sbSizer21, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_panel13->SetSizer( bSizer69 ); - m_panel13->Layout(); - bSizer69->Fit( m_panel13 ); - bSizer21->Add( m_panel13, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxEXPAND, 5 ); - - wxStaticBoxSizer* sbSizer8; - sbSizer8 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL ); - - wxFlexGridSizer* fgSizer3; - fgSizer3 = new wxFlexGridSizer( 2, 2, 0, 0 ); - fgSizer3->AddGrowableCol( 1 ); - fgSizer3->AddGrowableRow( 1 ); - fgSizer3->SetFlexibleDirection( wxBOTH ); - fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - - fgSizer3->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_staticText15 = new wxStaticText( this, wxID_ANY, _("Include"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText15->Wrap( -1 ); - m_staticText15->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); - - fgSizer3->Add( m_staticText15, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_bitmap8 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), 0 ); - fgSizer3->Add( m_bitmap8, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_textCtrlInclude = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE ); - fgSizer3->Add( m_textCtrlInclude, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - sbSizer8->Add( fgSizer3, 1, wxEXPAND, 5 ); - - wxFlexGridSizer* fgSizer4; - fgSizer4 = new wxFlexGridSizer( 2, 2, 0, 0 ); - fgSizer4->AddGrowableCol( 1 ); - fgSizer4->AddGrowableRow( 1 ); - fgSizer4->SetFlexibleDirection( wxBOTH ); - fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - - fgSizer4->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_staticText16 = new wxStaticText( this, wxID_ANY, _("Exclude"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText16->Wrap( -1 ); - m_staticText16->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); - - fgSizer4->Add( m_staticText16, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_bitmap9 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), 0 ); - fgSizer4->Add( m_bitmap9, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_textCtrlExclude = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE ); - fgSizer4->Add( m_textCtrlExclude, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - sbSizer8->Add( fgSizer4, 1, wxEXPAND, 5 ); - - bSizer21->Add( sbSizer8, 1, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - - - bSizer21->Add( 0, 0, 0, 0, 5 ); - - wxBoxSizer* bSizer22; - bSizer22 = new wxBoxSizer( wxHORIZONTAL ); - - m_button9 = new wxButton( this, wxID_DEFAULT, _("&Default"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_button9->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer22->Add( m_button9, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer22->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_button10 = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_button10->SetDefault(); - m_button10->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); - - bSizer22->Add( m_button10, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_button17 = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_button17->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer22->Add( m_button17, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - bSizer21->Add( bSizer22, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM|wxEXPAND, 5 ); - - this->SetSizer( bSizer21 ); - this->Layout(); - bSizer21->Fit( this ); - - this->Centre( wxBOTH ); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( FilterDlgGenerated::OnClose ) ); - m_bpButtonHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnHelp ), NULL, this ); - m_button9->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnDefault ), NULL, this ); - m_button10->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnApply ), NULL, this ); - m_button17->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnCancel ), NULL, this ); + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer21; + bSizer21 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer86; + bSizer86 = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmap26 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), 0 ); + bSizer86->Add( m_bitmap26, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_panel8 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER|wxTAB_TRAVERSAL ); + m_panel8->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DLIGHT ) ); + + wxBoxSizer* bSizer72; + bSizer72 = new wxBoxSizer( wxVERTICAL ); + + m_staticTexHeader = new wxStaticText( m_panel8, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTexHeader->Wrap( -1 ); + m_staticTexHeader->SetFont( wxFont( 16, 70, 90, 92, false, wxEmptyString ) ); + + bSizer72->Add( m_staticTexHeader, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); + + m_panel8->SetSizer( bSizer72 ); + m_panel8->Layout(); + bSizer72->Fit( m_panel8 ); + bSizer86->Add( m_panel8, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + bSizer86->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer21->Add( bSizer86, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM, 5 ); + + wxBoxSizer* bSizer70; + bSizer70 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText44 = new wxStaticText( this, wxID_ANY, _("Only files/directories that pass filtering will be selected for synchronization. The filter will be applied to the name relative(!) to the base synchronization directories."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText44->Wrap( 400 ); + bSizer70->Add( m_staticText44, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_bpButtonHelp = new wxBitmapButton( this, wxID_HELP, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + m_bpButtonHelp->SetToolTip( _("Help") ); + + m_bpButtonHelp->SetToolTip( _("Help") ); + + bSizer70->Add( m_bpButtonHelp, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + bSizer21->Add( bSizer70, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 10 ); + + + bSizer21->Add( 0, 5, 0, 0, 5 ); + + m_panel13 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer69; + bSizer69 = new wxBoxSizer( wxVERTICAL ); + + m_staticline10 = new wxStaticLine( m_panel13, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizer69->Add( m_staticline10, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + wxBoxSizer* bSizer52; + bSizer52 = new wxBoxSizer( wxVERTICAL ); + + m_staticText45 = new wxStaticText( m_panel13, wxID_ANY, _("Hints:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText45->Wrap( -1 ); + m_staticText45->SetFont( wxFont( 10, 70, 90, 92, true, wxEmptyString ) ); + + bSizer52->Add( m_staticText45, 0, wxBOTTOM, 5 ); + + m_staticText83 = new wxStaticText( m_panel13, wxID_ANY, _("1. Enter relative file or directory names separated by ';' or a new line."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText83->Wrap( -1 ); + bSizer52->Add( m_staticText83, 0, 0, 5 ); + + m_staticText84 = new wxStaticText( m_panel13, wxID_ANY, _("2. Use wildcard characters '*' and '?'."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText84->Wrap( -1 ); + bSizer52->Add( m_staticText84, 0, 0, 5 ); + + m_staticText85 = new wxStaticText( m_panel13, wxID_ANY, _("3. Exclude files directly on main grid via context menu."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText85->Wrap( -1 ); + bSizer52->Add( m_staticText85, 0, 0, 5 ); + + bSizer69->Add( bSizer52, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 10 ); + + wxStaticBoxSizer* sbSizer21; + sbSizer21 = new wxStaticBoxSizer( new wxStaticBox( m_panel13, wxID_ANY, _("Example") ), wxVERTICAL ); + + wxBoxSizer* bSizer66; + bSizer66 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText181 = new wxStaticText( m_panel13, wxID_ANY, _("Include: *.doc;*.zip;*.exe\nExclude: \\stuff\\temp\\*"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText181->Wrap( -1 ); + bSizer66->Add( m_staticText181, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticText1811 = new wxStaticText( m_panel13, wxID_ANY, _("Synchronize all .doc, .zip and .exe files except everything in subfolder \"temp\"."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText1811->Wrap( 250 ); + m_staticText1811->SetFont( wxFont( 8, 70, 93, 90, false, wxEmptyString ) ); + + bSizer66->Add( m_staticText1811, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + sbSizer21->Add( bSizer66, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 5 ); + + bSizer69->Add( sbSizer21, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_panel13->SetSizer( bSizer69 ); + m_panel13->Layout(); + bSizer69->Fit( m_panel13 ); + bSizer21->Add( m_panel13, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer8; + sbSizer8 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL ); + + wxFlexGridSizer* fgSizer3; + fgSizer3 = new wxFlexGridSizer( 2, 2, 0, 0 ); + fgSizer3->AddGrowableCol( 1 ); + fgSizer3->AddGrowableRow( 1 ); + fgSizer3->SetFlexibleDirection( wxBOTH ); + fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + + fgSizer3->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_staticText15 = new wxStaticText( this, wxID_ANY, _("Include"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText15->Wrap( -1 ); + m_staticText15->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); + + fgSizer3->Add( m_staticText15, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_bitmap8 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), 0 ); + fgSizer3->Add( m_bitmap8, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_textCtrlInclude = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE ); + fgSizer3->Add( m_textCtrlInclude, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + sbSizer8->Add( fgSizer3, 1, wxEXPAND, 5 ); + + wxFlexGridSizer* fgSizer4; + fgSizer4 = new wxFlexGridSizer( 2, 2, 0, 0 ); + fgSizer4->AddGrowableCol( 1 ); + fgSizer4->AddGrowableRow( 1 ); + fgSizer4->SetFlexibleDirection( wxBOTH ); + fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + + fgSizer4->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_staticText16 = new wxStaticText( this, wxID_ANY, _("Exclude"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText16->Wrap( -1 ); + m_staticText16->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); + + fgSizer4->Add( m_staticText16, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_bitmap9 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), 0 ); + fgSizer4->Add( m_bitmap9, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_textCtrlExclude = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE ); + fgSizer4->Add( m_textCtrlExclude, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + sbSizer8->Add( fgSizer4, 1, wxEXPAND, 5 ); + + bSizer21->Add( sbSizer8, 1, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + + bSizer21->Add( 0, 0, 0, 0, 5 ); + + wxBoxSizer* bSizer22; + bSizer22 = new wxBoxSizer( wxHORIZONTAL ); + + m_button9 = new wxButton( this, wxID_DEFAULT, _("&Default"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_button9->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer22->Add( m_button9, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer22->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_button10 = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_button10->SetDefault(); + m_button10->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); + + bSizer22->Add( m_button10, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_button17 = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_button17->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer22->Add( m_button17, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + bSizer21->Add( bSizer22, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM|wxEXPAND, 5 ); + + this->SetSizer( bSizer21 ); + this->Layout(); + bSizer21->Fit( this ); + + this->Centre( wxBOTH ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( FilterDlgGenerated::OnClose ) ); + m_bpButtonHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnHelp ), NULL, this ); + m_button9->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnDefault ), NULL, this ); + m_button10->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnApply ), NULL, this ); + m_button17->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnCancel ), NULL, this ); } FilterDlgGenerated::~FilterDlgGenerated() { - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( FilterDlgGenerated::OnClose ) ); - m_bpButtonHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnHelp ), NULL, this ); - m_button9->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnDefault ), NULL, this ); - m_button10->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnApply ), NULL, this ); - m_button17->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnCancel ), NULL, this ); - + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( FilterDlgGenerated::OnClose ) ); + m_bpButtonHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnHelp ), NULL, this ); + m_button9->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnDefault ), NULL, this ); + m_button10->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnApply ), NULL, this ); + m_button17->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FilterDlgGenerated::OnCancel ), NULL, this ); + } CustomizeColsDlgGenerated::CustomizeColsDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bSizer96; - bSizer96 = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizer99; - bSizer99 = new wxBoxSizer( wxHORIZONTAL ); - - wxArrayString m_checkListColumnsChoices; - m_checkListColumns = new wxCheckListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_checkListColumnsChoices, 0 ); - bSizer99->Add( m_checkListColumns, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - wxBoxSizer* bSizer98; - bSizer98 = new wxBoxSizer( wxVERTICAL ); - - m_bpButton29 = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - m_bpButton29->SetToolTip( _("Move column up") ); - - m_bpButton29->SetToolTip( _("Move column up") ); - - bSizer98->Add( m_bpButton29, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_bpButton30 = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - m_bpButton30->SetToolTip( _("Move column down") ); - - m_bpButton30->SetToolTip( _("Move column down") ); - - bSizer98->Add( m_bpButton30, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - bSizer99->Add( bSizer98, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer96->Add( bSizer99, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - wxBoxSizer* bSizer97; - bSizer97 = new wxBoxSizer( wxHORIZONTAL ); - - m_button9 = new wxButton( this, wxID_DEFAULT, _("&Default"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_button9->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer97->Add( m_button9, 0, wxALL, 5 ); - - - bSizer97->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_button28 = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_button28->SetDefault(); - m_button28->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); - - bSizer97->Add( m_button28, 0, wxALL, 5 ); - - m_button29 = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_button29->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer97->Add( m_button29, 0, wxALL, 5 ); - - bSizer96->Add( bSizer97, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - - this->SetSizer( bSizer96 ); - this->Layout(); - bSizer96->Fit( this ); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CustomizeColsDlgGenerated::OnClose ) ); - m_bpButton29->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CustomizeColsDlgGenerated::OnMoveUp ), NULL, this ); - m_bpButton30->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CustomizeColsDlgGenerated::OnMoveDown ), NULL, this ); - m_button9->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CustomizeColsDlgGenerated::OnDefault ), NULL, this ); - m_button28->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CustomizeColsDlgGenerated::OnOkay ), NULL, this ); - m_button29->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CustomizeColsDlgGenerated::OnCancel ), NULL, this ); + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer96; + bSizer96 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer99; + bSizer99 = new wxBoxSizer( wxHORIZONTAL ); + + wxArrayString m_checkListColumnsChoices; + m_checkListColumns = new wxCheckListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_checkListColumnsChoices, 0 ); + bSizer99->Add( m_checkListColumns, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxBoxSizer* bSizer98; + bSizer98 = new wxBoxSizer( wxVERTICAL ); + + m_bpButton29 = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + m_bpButton29->SetToolTip( _("Move column up") ); + + m_bpButton29->SetToolTip( _("Move column up") ); + + bSizer98->Add( m_bpButton29, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_bpButton30 = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + m_bpButton30->SetToolTip( _("Move column down") ); + + m_bpButton30->SetToolTip( _("Move column down") ); + + bSizer98->Add( m_bpButton30, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + bSizer99->Add( bSizer98, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer96->Add( bSizer99, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + wxBoxSizer* bSizer97; + bSizer97 = new wxBoxSizer( wxHORIZONTAL ); + + m_button9 = new wxButton( this, wxID_DEFAULT, _("&Default"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_button9->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer97->Add( m_button9, 0, wxALL, 5 ); + + + bSizer97->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_button28 = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_button28->SetDefault(); + m_button28->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); + + bSizer97->Add( m_button28, 0, wxALL, 5 ); + + m_button29 = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_button29->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer97->Add( m_button29, 0, wxALL, 5 ); + + bSizer96->Add( bSizer97, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + this->SetSizer( bSizer96 ); + this->Layout(); + bSizer96->Fit( this ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CustomizeColsDlgGenerated::OnClose ) ); + m_bpButton29->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CustomizeColsDlgGenerated::OnMoveUp ), NULL, this ); + m_bpButton30->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CustomizeColsDlgGenerated::OnMoveDown ), NULL, this ); + m_button9->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CustomizeColsDlgGenerated::OnDefault ), NULL, this ); + m_button28->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CustomizeColsDlgGenerated::OnOkay ), NULL, this ); + m_button29->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CustomizeColsDlgGenerated::OnCancel ), NULL, this ); } CustomizeColsDlgGenerated::~CustomizeColsDlgGenerated() { - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CustomizeColsDlgGenerated::OnClose ) ); - m_bpButton29->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CustomizeColsDlgGenerated::OnMoveUp ), NULL, this ); - m_bpButton30->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CustomizeColsDlgGenerated::OnMoveDown ), NULL, this ); - m_button9->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CustomizeColsDlgGenerated::OnDefault ), NULL, this ); - m_button28->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CustomizeColsDlgGenerated::OnOkay ), NULL, this ); - m_button29->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CustomizeColsDlgGenerated::OnCancel ), NULL, this ); - + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CustomizeColsDlgGenerated::OnClose ) ); + m_bpButton29->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CustomizeColsDlgGenerated::OnMoveUp ), NULL, this ); + m_bpButton30->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CustomizeColsDlgGenerated::OnMoveDown ), NULL, this ); + m_button9->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CustomizeColsDlgGenerated::OnDefault ), NULL, this ); + m_button28->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CustomizeColsDlgGenerated::OnOkay ), NULL, this ); + m_button29->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CustomizeColsDlgGenerated::OnCancel ), NULL, this ); + } GlobalSettingsDlgGenerated::GlobalSettingsDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxSize( 280,230 ), wxDefaultSize ); - - wxBoxSizer* bSizer95; - bSizer95 = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizer86; - bSizer86 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapSettings = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), 0 ); - bSizer86->Add( m_bitmapSettings, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - - - bSizer86->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_panel8 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER|wxTAB_TRAVERSAL ); - m_panel8->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DLIGHT ) ); - - wxBoxSizer* bSizer72; - bSizer72 = new wxBoxSizer( wxVERTICAL ); - - m_staticText56 = new wxStaticText( m_panel8, wxID_ANY, _("Global settings"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText56->Wrap( -1 ); - m_staticText56->SetFont( wxFont( 16, 70, 90, 92, false, wxEmptyString ) ); - - bSizer72->Add( m_staticText56, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); - - m_panel8->SetSizer( bSizer72 ); - m_panel8->Layout(); - bSizer72->Fit( m_panel8 ); - bSizer86->Add( m_panel8, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - bSizer95->Add( bSizer86, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - - bSizer95->Add( 0, 10, 0, 0, 5 ); - - wxStaticBoxSizer* sbSizer23; - sbSizer23 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL ); - - m_checkBoxCopyLocked = new wxCheckBox( this, wxID_ANY, _("Copy locked files"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkBoxCopyLocked->SetToolTip( _("Copy shared or locked files using Volume Shadow Copy Service\n(Requires Administrator rights)") ); - - sbSizer23->Add( m_checkBoxCopyLocked, 0, wxALL|wxEXPAND, 5 ); - - m_checkBoxCopyPermissions = new wxCheckBox( this, wxID_ANY, _("Copy filesystem permissions"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkBoxCopyPermissions->SetToolTip( _("Transfer file and directory permissions\n(Requires Administrator rights)") ); - - sbSizer23->Add( m_checkBoxCopyPermissions, 0, wxALL|wxEXPAND, 5 ); - - m_staticline10 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - sbSizer23->Add( m_staticline10, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM, 5 ); - - wxBoxSizer* bSizer101; - bSizer101 = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText100 = new wxStaticText( this, wxID_ANY, _("Hidden dialogs:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText100->Wrap( -1 ); - bSizer101->Add( m_staticText100, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer101->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_buttonResetDialogs = new wxButtonWithImage( this, wxID_ANY, _("Reset"), wxDefaultPosition, wxSize( 80,-1 ), 0 ); - m_buttonResetDialogs->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - m_buttonResetDialogs->SetToolTip( _("Show hidden dialogs") ); - - bSizer101->Add( m_buttonResetDialogs, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - - sbSizer23->Add( bSizer101, 0, wxEXPAND, 5 ); - - bSizer95->Add( sbSizer23, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - - - bSizer95->Add( 0, 10, 0, 0, 5 ); - - wxStaticBoxSizer* sbSizer26; - sbSizer26 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("External applications") ), wxHORIZONTAL ); - - - sbSizer26->Add( 5, 0, 0, 0, 5 ); - - m_gridCustomCommand = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); - - // Grid - m_gridCustomCommand->CreateGrid( 5, 2 ); - m_gridCustomCommand->EnableEditing( true ); - m_gridCustomCommand->EnableGridLines( true ); - m_gridCustomCommand->EnableDragGridSize( false ); - m_gridCustomCommand->SetMargins( 0, 0 ); - - // Columns - m_gridCustomCommand->SetColSize( 0, 129 ); - m_gridCustomCommand->SetColSize( 1, 179 ); - m_gridCustomCommand->EnableDragColMove( false ); - m_gridCustomCommand->EnableDragColSize( true ); - m_gridCustomCommand->SetColLabelSize( 20 ); - m_gridCustomCommand->SetColLabelValue( 0, _("Description") ); - m_gridCustomCommand->SetColLabelValue( 1, _("Command line") ); - m_gridCustomCommand->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - - // Rows - m_gridCustomCommand->EnableDragRowSize( false ); - m_gridCustomCommand->SetRowLabelSize( 0 ); - m_gridCustomCommand->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - - // Label Appearance - - // Cell Defaults - m_gridCustomCommand->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); - sbSizer26->Add( m_gridCustomCommand, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - wxBoxSizer* bSizer157; - bSizer157 = new wxBoxSizer( wxVERTICAL ); - - m_bpButtonAddRow = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); - bSizer157->Add( m_bpButtonAddRow, 0, 0, 5 ); - - m_bpButtonRemoveRow = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); - bSizer157->Add( m_bpButtonRemoveRow, 0, 0, 5 ); - - sbSizer26->Add( bSizer157, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - - sbSizer26->Add( 5, 0, 0, 0, 5 ); - - bSizer95->Add( sbSizer26, 1, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - - wxBoxSizer* bSizer97; - bSizer97 = new wxBoxSizer( wxHORIZONTAL ); - - m_button9 = new wxButton( this, wxID_DEFAULT, _("&Default"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_button9->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer97->Add( m_button9, 0, wxALL, 5 ); - - - bSizer97->Add( 0, 0, 1, 0, 5 ); - - m_buttonOkay = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonOkay->SetDefault(); - m_buttonOkay->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); - - bSizer97->Add( m_buttonOkay, 0, wxALL, 5 ); - - m_button29 = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_button29->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer97->Add( m_button29, 0, wxALL, 5 ); - - bSizer95->Add( bSizer97, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - this->SetSizer( bSizer95 ); - this->Layout(); - bSizer95->Fit( this ); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( GlobalSettingsDlgGenerated::OnClose ) ); - m_buttonResetDialogs->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GlobalSettingsDlgGenerated::OnResetDialogs ), NULL, this ); - m_bpButtonAddRow->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GlobalSettingsDlgGenerated::OnAddRow ), NULL, this ); - m_bpButtonRemoveRow->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GlobalSettingsDlgGenerated::OnRemoveRow ), NULL, this ); - m_button9->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GlobalSettingsDlgGenerated::OnDefault ), NULL, this ); - m_buttonOkay->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GlobalSettingsDlgGenerated::OnOkay ), NULL, this ); - m_button29->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GlobalSettingsDlgGenerated::OnCancel ), NULL, this ); + this->SetSizeHints( wxSize( 280,230 ), wxDefaultSize ); + + wxBoxSizer* bSizer95; + bSizer95 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer86; + bSizer86 = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmapSettings = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), 0 ); + bSizer86->Add( m_bitmapSettings, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + + bSizer86->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_panel8 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER|wxTAB_TRAVERSAL ); + m_panel8->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DLIGHT ) ); + + wxBoxSizer* bSizer72; + bSizer72 = new wxBoxSizer( wxVERTICAL ); + + m_staticText56 = new wxStaticText( m_panel8, wxID_ANY, _("Global settings"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText56->Wrap( -1 ); + m_staticText56->SetFont( wxFont( 16, 70, 90, 92, false, wxEmptyString ) ); + + bSizer72->Add( m_staticText56, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); + + m_panel8->SetSizer( bSizer72 ); + m_panel8->Layout(); + bSizer72->Fit( m_panel8 ); + bSizer86->Add( m_panel8, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + bSizer95->Add( bSizer86, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + + bSizer95->Add( 0, 10, 0, 0, 5 ); + + wxStaticBoxSizer* sbSizer23; + sbSizer23 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL ); + + m_checkBoxCopyLocked = new wxCheckBox( this, wxID_ANY, _("Copy locked files"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxCopyLocked->SetToolTip( _("Copy shared or locked files using Volume Shadow Copy Service\n(Requires Administrator rights)") ); + + sbSizer23->Add( m_checkBoxCopyLocked, 0, wxALL|wxEXPAND, 5 ); + + m_checkBoxCopyPermissions = new wxCheckBox( this, wxID_ANY, _("Copy filesystem permissions"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxCopyPermissions->SetToolTip( _("Transfer file and directory permissions\n(Requires Administrator rights)") ); + + sbSizer23->Add( m_checkBoxCopyPermissions, 0, wxALL|wxEXPAND, 5 ); + + m_staticline10 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + sbSizer23->Add( m_staticline10, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM, 5 ); + + wxBoxSizer* bSizer101; + bSizer101 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText100 = new wxStaticText( this, wxID_ANY, _("Hidden dialogs:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText100->Wrap( -1 ); + bSizer101->Add( m_staticText100, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer101->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_buttonResetDialogs = new wxButtonWithImage( this, wxID_ANY, _("Reset"), wxDefaultPosition, wxSize( 80,-1 ), 0 ); + m_buttonResetDialogs->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + m_buttonResetDialogs->SetToolTip( _("Show hidden dialogs") ); + + bSizer101->Add( m_buttonResetDialogs, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + sbSizer23->Add( bSizer101, 0, wxEXPAND, 5 ); + + bSizer95->Add( sbSizer23, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + + bSizer95->Add( 0, 10, 0, 0, 5 ); + + wxStaticBoxSizer* sbSizer26; + sbSizer26 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("External applications") ), wxHORIZONTAL ); + + + sbSizer26->Add( 5, 0, 0, 0, 5 ); + + m_gridCustomCommand = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + // Grid + m_gridCustomCommand->CreateGrid( 5, 2 ); + m_gridCustomCommand->EnableEditing( true ); + m_gridCustomCommand->EnableGridLines( true ); + m_gridCustomCommand->EnableDragGridSize( false ); + m_gridCustomCommand->SetMargins( 0, 0 ); + + // Columns + m_gridCustomCommand->SetColSize( 0, 129 ); + m_gridCustomCommand->SetColSize( 1, 179 ); + m_gridCustomCommand->EnableDragColMove( false ); + m_gridCustomCommand->EnableDragColSize( true ); + m_gridCustomCommand->SetColLabelSize( 20 ); + m_gridCustomCommand->SetColLabelValue( 0, _("Description") ); + m_gridCustomCommand->SetColLabelValue( 1, _("Command line") ); + m_gridCustomCommand->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Rows + m_gridCustomCommand->EnableDragRowSize( false ); + m_gridCustomCommand->SetRowLabelSize( 0 ); + m_gridCustomCommand->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Label Appearance + + // Cell Defaults + m_gridCustomCommand->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); + sbSizer26->Add( m_gridCustomCommand, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + wxBoxSizer* bSizer157; + bSizer157 = new wxBoxSizer( wxVERTICAL ); + + m_bpButtonAddRow = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); + bSizer157->Add( m_bpButtonAddRow, 0, 0, 5 ); + + m_bpButtonRemoveRow = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); + bSizer157->Add( m_bpButtonRemoveRow, 0, 0, 5 ); + + sbSizer26->Add( bSizer157, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + + sbSizer26->Add( 5, 0, 0, 0, 5 ); + + bSizer95->Add( sbSizer26, 1, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + wxBoxSizer* bSizer97; + bSizer97 = new wxBoxSizer( wxHORIZONTAL ); + + m_button9 = new wxButton( this, wxID_DEFAULT, _("&Default"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_button9->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer97->Add( m_button9, 0, wxALL, 5 ); + + + bSizer97->Add( 0, 0, 1, 0, 5 ); + + m_buttonOkay = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonOkay->SetDefault(); + m_buttonOkay->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); + + bSizer97->Add( m_buttonOkay, 0, wxALL, 5 ); + + m_button29 = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_button29->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer97->Add( m_button29, 0, wxALL, 5 ); + + bSizer95->Add( bSizer97, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + this->SetSizer( bSizer95 ); + this->Layout(); + bSizer95->Fit( this ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( GlobalSettingsDlgGenerated::OnClose ) ); + m_buttonResetDialogs->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GlobalSettingsDlgGenerated::OnResetDialogs ), NULL, this ); + m_bpButtonAddRow->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GlobalSettingsDlgGenerated::OnAddRow ), NULL, this ); + m_bpButtonRemoveRow->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GlobalSettingsDlgGenerated::OnRemoveRow ), NULL, this ); + m_button9->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GlobalSettingsDlgGenerated::OnDefault ), NULL, this ); + m_buttonOkay->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GlobalSettingsDlgGenerated::OnOkay ), NULL, this ); + m_button29->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GlobalSettingsDlgGenerated::OnCancel ), NULL, this ); } GlobalSettingsDlgGenerated::~GlobalSettingsDlgGenerated() { - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( GlobalSettingsDlgGenerated::OnClose ) ); - m_buttonResetDialogs->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GlobalSettingsDlgGenerated::OnResetDialogs ), NULL, this ); - m_bpButtonAddRow->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GlobalSettingsDlgGenerated::OnAddRow ), NULL, this ); - m_bpButtonRemoveRow->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GlobalSettingsDlgGenerated::OnRemoveRow ), NULL, this ); - m_button9->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GlobalSettingsDlgGenerated::OnDefault ), NULL, this ); - m_buttonOkay->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GlobalSettingsDlgGenerated::OnOkay ), NULL, this ); - m_button29->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GlobalSettingsDlgGenerated::OnCancel ), NULL, this ); - + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( GlobalSettingsDlgGenerated::OnClose ) ); + m_buttonResetDialogs->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GlobalSettingsDlgGenerated::OnResetDialogs ), NULL, this ); + m_bpButtonAddRow->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GlobalSettingsDlgGenerated::OnAddRow ), NULL, this ); + m_bpButtonRemoveRow->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GlobalSettingsDlgGenerated::OnRemoveRow ), NULL, this ); + m_button9->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GlobalSettingsDlgGenerated::OnDefault ), NULL, this ); + m_buttonOkay->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GlobalSettingsDlgGenerated::OnOkay ), NULL, this ); + m_button29->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GlobalSettingsDlgGenerated::OnCancel ), NULL, this ); + } SyncPreviewDlgGenerated::SyncPreviewDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bSizer134; - bSizer134 = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizer158; - bSizer158 = new wxBoxSizer( wxHORIZONTAL ); - - m_buttonStartSync = new wxButtonWithImage( this, wxID_ANY, _("Start"), wxDefaultPosition, wxSize( -1,40 ), 0 ); - m_buttonStartSync->SetDefault(); - m_buttonStartSync->SetFont( wxFont( 14, 70, 90, 92, false, wxT("Arial Black") ) ); - m_buttonStartSync->SetToolTip( _("Start synchronization") ); - - bSizer158->Add( m_buttonStartSync, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticline16 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); - bSizer158->Add( m_staticline16, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - - wxStaticBoxSizer* sbSizer28; - sbSizer28 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Variant") ), wxVERTICAL ); - - m_staticTextVariant = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextVariant->Wrap( -1 ); - m_staticTextVariant->SetFont( wxFont( 10, 70, 90, 92, false, wxT("Arial Black") ) ); - - sbSizer28->Add( m_staticTextVariant, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - bSizer158->Add( sbSizer28, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - bSizer134->Add( bSizer158, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - m_staticline14 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizer134->Add( m_staticline14, 0, wxEXPAND, 5 ); - - wxBoxSizer* bSizer141; - bSizer141 = new wxBoxSizer( wxHORIZONTAL ); - - wxStaticBoxSizer* sbSizer161; - sbSizer161 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Statistics") ), wxVERTICAL ); - - wxBoxSizer* bSizer157; - bSizer157 = new wxBoxSizer( wxHORIZONTAL ); - - wxFlexGridSizer* fgSizer5; - fgSizer5 = new wxFlexGridSizer( 4, 2, 0, 5 ); - fgSizer5->SetFlexibleDirection( wxHORIZONTAL ); - fgSizer5->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - - fgSizer5->Add( 0, 0, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_staticText94 = new wxStaticText( this, wxID_ANY, _("Left"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText94->Wrap( -1 ); - m_staticText94->SetFont( wxFont( 9, 70, 90, 92, false, wxEmptyString ) ); - - fgSizer5->Add( m_staticText94, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_bitmapCreate = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - m_bitmapCreate->SetToolTip( _("Number of files and directories that will be created") ); - - fgSizer5->Add( m_bitmapCreate, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_textCtrlCreateL = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), wxTE_READONLY ); - m_textCtrlCreateL->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) ); - m_textCtrlCreateL->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - m_textCtrlCreateL->SetToolTip( _("Number of files and directories that will be created") ); - - fgSizer5->Add( m_textCtrlCreateL, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bitmapUpdate = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - m_bitmapUpdate->SetToolTip( _("Number of files that will be overwritten") ); - - fgSizer5->Add( m_bitmapUpdate, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_textCtrlUpdateL = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), wxTE_READONLY ); - m_textCtrlUpdateL->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) ); - m_textCtrlUpdateL->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - m_textCtrlUpdateL->SetToolTip( _("Number of files that will be overwritten") ); - - fgSizer5->Add( m_textCtrlUpdateL, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bitmapDelete = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - m_bitmapDelete->SetToolTip( _("Number of files and directories that will be deleted") ); - - fgSizer5->Add( m_bitmapDelete, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_textCtrlDeleteL = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), wxTE_READONLY ); - m_textCtrlDeleteL->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) ); - m_textCtrlDeleteL->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - m_textCtrlDeleteL->SetToolTip( _("Number of files and directories that will be deleted") ); - - fgSizer5->Add( m_textCtrlDeleteL, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer157->Add( fgSizer5, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - - wxFlexGridSizer* fgSizer51; - fgSizer51 = new wxFlexGridSizer( 3, 1, 0, 5 ); - fgSizer51->SetFlexibleDirection( wxHORIZONTAL ); - fgSizer51->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - m_staticText95 = new wxStaticText( this, wxID_ANY, _("Right"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText95->Wrap( -1 ); - m_staticText95->SetFont( wxFont( 9, 70, 90, 92, false, wxEmptyString ) ); - - fgSizer51->Add( m_staticText95, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_textCtrlCreateR = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), wxTE_READONLY ); - m_textCtrlCreateR->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) ); - m_textCtrlCreateR->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - m_textCtrlCreateR->SetToolTip( _("Number of files and directories that will be created") ); - - fgSizer51->Add( m_textCtrlCreateR, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_textCtrlUpdateR = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), wxTE_READONLY ); - m_textCtrlUpdateR->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) ); - m_textCtrlUpdateR->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - m_textCtrlUpdateR->SetToolTip( _("Number of files that will be overwritten") ); - - fgSizer51->Add( m_textCtrlUpdateR, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_textCtrlDeleteR = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), wxTE_READONLY ); - m_textCtrlDeleteR->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) ); - m_textCtrlDeleteR->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - m_textCtrlDeleteR->SetToolTip( _("Number of files and directories that will be deleted") ); - - fgSizer51->Add( m_textCtrlDeleteR, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer157->Add( fgSizer51, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - - sbSizer161->Add( bSizer157, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - - sbSizer161->Add( 0, 10, 0, 0, 5 ); - - wxBoxSizer* bSizer156; - bSizer156 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapData = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - m_bitmapData->SetToolTip( _("Total amount of data that will be transferred") ); - - bSizer156->Add( m_bitmapData, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxRIGHT, 5 ); - - - bSizer156->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_textCtrlData = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), wxTE_READONLY ); - m_textCtrlData->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) ); - m_textCtrlData->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - m_textCtrlData->SetToolTip( _("Total amount of data that will be transferred") ); - - bSizer156->Add( m_textCtrlData, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer156->Add( 0, 0, 1, wxEXPAND, 5 ); - - sbSizer161->Add( bSizer156, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - - bSizer141->Add( sbSizer161, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); - - bSizer134->Add( bSizer141, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_staticline12 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizer134->Add( m_staticline12, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); - - wxBoxSizer* bSizer142; - bSizer142 = new wxBoxSizer( wxHORIZONTAL ); - - m_checkBoxDontShowAgain = new wxCheckBox( this, wxID_ANY, _("Do not show this dialog again"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer142->Add( m_checkBoxDontShowAgain, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer142->Add( 10, 0, 1, 0, 5 ); - - m_button16 = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_button16->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer142->Add( m_button16, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - bSizer134->Add( bSizer142, 0, wxEXPAND, 5 ); - - this->SetSizer( bSizer134 ); - this->Layout(); - bSizer134->Fit( this ); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SyncPreviewDlgGenerated::OnClose ) ); - m_buttonStartSync->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncPreviewDlgGenerated::OnStartSync ), NULL, this ); - m_button16->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncPreviewDlgGenerated::OnCancel ), NULL, this ); + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer134; + bSizer134 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer158; + bSizer158 = new wxBoxSizer( wxHORIZONTAL ); + + m_buttonStartSync = new wxButtonWithImage( this, wxID_ANY, _("Start"), wxDefaultPosition, wxSize( -1,40 ), 0 ); + m_buttonStartSync->SetDefault(); + m_buttonStartSync->SetFont( wxFont( 14, 70, 90, 92, false, wxT("Arial Black") ) ); + m_buttonStartSync->SetToolTip( _("Start synchronization") ); + + bSizer158->Add( m_buttonStartSync, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticline16 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); + bSizer158->Add( m_staticline16, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + wxStaticBoxSizer* sbSizer28; + sbSizer28 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Variant") ), wxVERTICAL ); + + m_staticTextVariant = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextVariant->Wrap( -1 ); + m_staticTextVariant->SetFont( wxFont( 10, 70, 90, 92, false, wxT("Arial Black") ) ); + + sbSizer28->Add( m_staticTextVariant, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizer158->Add( sbSizer28, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + bSizer134->Add( bSizer158, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + m_staticline14 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizer134->Add( m_staticline14, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer141; + bSizer141 = new wxBoxSizer( wxHORIZONTAL ); + + wxStaticBoxSizer* sbSizer161; + sbSizer161 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Statistics") ), wxVERTICAL ); + + wxBoxSizer* bSizer157; + bSizer157 = new wxBoxSizer( wxHORIZONTAL ); + + wxFlexGridSizer* fgSizer5; + fgSizer5 = new wxFlexGridSizer( 4, 2, 0, 5 ); + fgSizer5->SetFlexibleDirection( wxHORIZONTAL ); + fgSizer5->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + + fgSizer5->Add( 0, 0, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_staticText94 = new wxStaticText( this, wxID_ANY, _("Left"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText94->Wrap( -1 ); + m_staticText94->SetFont( wxFont( 9, 70, 90, 92, false, wxEmptyString ) ); + + fgSizer5->Add( m_staticText94, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_bitmapCreate = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + m_bitmapCreate->SetToolTip( _("Number of files and directories that will be created") ); + + fgSizer5->Add( m_bitmapCreate, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_textCtrlCreateL = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), wxTE_READONLY ); + m_textCtrlCreateL->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) ); + m_textCtrlCreateL->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + m_textCtrlCreateL->SetToolTip( _("Number of files and directories that will be created") ); + + fgSizer5->Add( m_textCtrlCreateL, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bitmapUpdate = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + m_bitmapUpdate->SetToolTip( _("Number of files that will be overwritten") ); + + fgSizer5->Add( m_bitmapUpdate, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_textCtrlUpdateL = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), wxTE_READONLY ); + m_textCtrlUpdateL->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) ); + m_textCtrlUpdateL->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + m_textCtrlUpdateL->SetToolTip( _("Number of files that will be overwritten") ); + + fgSizer5->Add( m_textCtrlUpdateL, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bitmapDelete = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + m_bitmapDelete->SetToolTip( _("Number of files and directories that will be deleted") ); + + fgSizer5->Add( m_bitmapDelete, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_textCtrlDeleteL = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), wxTE_READONLY ); + m_textCtrlDeleteL->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) ); + m_textCtrlDeleteL->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + m_textCtrlDeleteL->SetToolTip( _("Number of files and directories that will be deleted") ); + + fgSizer5->Add( m_textCtrlDeleteL, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer157->Add( fgSizer5, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + wxFlexGridSizer* fgSizer51; + fgSizer51 = new wxFlexGridSizer( 3, 1, 0, 5 ); + fgSizer51->SetFlexibleDirection( wxHORIZONTAL ); + fgSizer51->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticText95 = new wxStaticText( this, wxID_ANY, _("Right"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText95->Wrap( -1 ); + m_staticText95->SetFont( wxFont( 9, 70, 90, 92, false, wxEmptyString ) ); + + fgSizer51->Add( m_staticText95, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_textCtrlCreateR = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), wxTE_READONLY ); + m_textCtrlCreateR->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) ); + m_textCtrlCreateR->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + m_textCtrlCreateR->SetToolTip( _("Number of files and directories that will be created") ); + + fgSizer51->Add( m_textCtrlCreateR, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_textCtrlUpdateR = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), wxTE_READONLY ); + m_textCtrlUpdateR->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) ); + m_textCtrlUpdateR->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + m_textCtrlUpdateR->SetToolTip( _("Number of files that will be overwritten") ); + + fgSizer51->Add( m_textCtrlUpdateR, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_textCtrlDeleteR = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), wxTE_READONLY ); + m_textCtrlDeleteR->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) ); + m_textCtrlDeleteR->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + m_textCtrlDeleteR->SetToolTip( _("Number of files and directories that will be deleted") ); + + fgSizer51->Add( m_textCtrlDeleteR, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer157->Add( fgSizer51, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + sbSizer161->Add( bSizer157, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + + sbSizer161->Add( 0, 10, 0, 0, 5 ); + + wxBoxSizer* bSizer156; + bSizer156 = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmapData = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + m_bitmapData->SetToolTip( _("Total amount of data that will be transferred") ); + + bSizer156->Add( m_bitmapData, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxRIGHT, 5 ); + + + bSizer156->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_textCtrlData = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), wxTE_READONLY ); + m_textCtrlData->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) ); + m_textCtrlData->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + m_textCtrlData->SetToolTip( _("Total amount of data that will be transferred") ); + + bSizer156->Add( m_textCtrlData, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer156->Add( 0, 0, 1, wxEXPAND, 5 ); + + sbSizer161->Add( bSizer156, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + bSizer141->Add( sbSizer161, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); + + bSizer134->Add( bSizer141, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_staticline12 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizer134->Add( m_staticline12, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + wxBoxSizer* bSizer142; + bSizer142 = new wxBoxSizer( wxHORIZONTAL ); + + m_checkBoxDontShowAgain = new wxCheckBox( this, wxID_ANY, _("Do not show this dialog again"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer142->Add( m_checkBoxDontShowAgain, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer142->Add( 10, 0, 1, 0, 5 ); + + m_button16 = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_button16->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer142->Add( m_button16, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizer134->Add( bSizer142, 0, wxEXPAND, 5 ); + + this->SetSizer( bSizer134 ); + this->Layout(); + bSizer134->Fit( this ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SyncPreviewDlgGenerated::OnClose ) ); + m_buttonStartSync->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncPreviewDlgGenerated::OnStartSync ), NULL, this ); + m_button16->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncPreviewDlgGenerated::OnCancel ), NULL, this ); } SyncPreviewDlgGenerated::~SyncPreviewDlgGenerated() { - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SyncPreviewDlgGenerated::OnClose ) ); - m_buttonStartSync->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncPreviewDlgGenerated::OnStartSync ), NULL, this ); - m_button16->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncPreviewDlgGenerated::OnCancel ), NULL, this ); - + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SyncPreviewDlgGenerated::OnClose ) ); + m_buttonStartSync->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncPreviewDlgGenerated::OnStartSync ), NULL, this ); + m_button16->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncPreviewDlgGenerated::OnCancel ), NULL, this ); + } PopupFrameGenerated1::PopupFrameGenerated1( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - this->SetBackgroundColour( wxColour( 255, 255, 255 ) ); - - wxBoxSizer* bSizer158; - bSizer158 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapLeft = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - bSizer158->Add( m_bitmapLeft, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticTextMain = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextMain->Wrap( 600 ); - bSizer158->Add( m_staticTextMain, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - this->SetSizer( bSizer158 ); - this->Layout(); - bSizer158->Fit( this ); + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + this->SetBackgroundColour( wxColour( 255, 255, 255 ) ); + + wxBoxSizer* bSizer158; + bSizer158 = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmapLeft = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + bSizer158->Add( m_bitmapLeft, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticTextMain = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextMain->Wrap( 600 ); + bSizer158->Add( m_staticTextMain, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + this->SetSizer( bSizer158 ); + this->Layout(); + bSizer158->Fit( this ); } PopupFrameGenerated1::~PopupFrameGenerated1() @@ -3671,67 +3735,67 @@ PopupFrameGenerated1::~PopupFrameGenerated1() SearchDialogGenerated::SearchDialogGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bSizer161; - bSizer161 = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* bSizer166; - bSizer166 = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizer162; - bSizer162 = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText101 = new wxStaticText( this, wxID_ANY, _("Find what:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText101->Wrap( -1 ); - bSizer162->Add( m_staticText101, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_textCtrlSearchTxt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 220,-1 ), 0 ); - bSizer162->Add( m_textCtrlSearchTxt, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer166->Add( bSizer162, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - - bSizer166->Add( 0, 10, 0, 0, 5 ); - - m_checkBoxMatchCase = new wxCheckBox( this, wxID_ANY, _("Match case"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer166->Add( m_checkBoxMatchCase, 0, wxALL, 5 ); - - bSizer161->Add( bSizer166, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - wxBoxSizer* bSizer97; - bSizer97 = new wxBoxSizer( wxVERTICAL ); - - m_buttonFindNext = new wxButton( this, wxID_OK, _("&Find next"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonFindNext->SetDefault(); - m_buttonFindNext->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); - - bSizer97->Add( m_buttonFindNext, 0, wxALL|wxEXPAND, 5 ); - - m_button29 = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_button29->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer97->Add( m_button29, 0, wxALL|wxEXPAND, 5 ); - - bSizer161->Add( bSizer97, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - this->SetSizer( bSizer161 ); - this->Layout(); - bSizer161->Fit( this ); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SearchDialogGenerated::OnClose ) ); - m_textCtrlSearchTxt->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( SearchDialogGenerated::OnText ), NULL, this ); - m_buttonFindNext->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SearchDialogGenerated::OnFindNext ), NULL, this ); - m_button29->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SearchDialogGenerated::OnCancel ), NULL, this ); + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer161; + bSizer161 = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizer166; + bSizer166 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer162; + bSizer162 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText101 = new wxStaticText( this, wxID_ANY, _("Find what:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText101->Wrap( -1 ); + bSizer162->Add( m_staticText101, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_textCtrlSearchTxt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 220,-1 ), 0 ); + bSizer162->Add( m_textCtrlSearchTxt, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer166->Add( bSizer162, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + + bSizer166->Add( 0, 10, 0, 0, 5 ); + + m_checkBoxMatchCase = new wxCheckBox( this, wxID_ANY, _("Match case"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer166->Add( m_checkBoxMatchCase, 0, wxALL, 5 ); + + bSizer161->Add( bSizer166, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + wxBoxSizer* bSizer97; + bSizer97 = new wxBoxSizer( wxVERTICAL ); + + m_buttonFindNext = new wxButton( this, wxID_OK, _("&Find next"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonFindNext->SetDefault(); + m_buttonFindNext->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); + + bSizer97->Add( m_buttonFindNext, 0, wxALL|wxEXPAND, 5 ); + + m_button29 = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_button29->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer97->Add( m_button29, 0, wxALL|wxEXPAND, 5 ); + + bSizer161->Add( bSizer97, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + this->SetSizer( bSizer161 ); + this->Layout(); + bSizer161->Fit( this ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SearchDialogGenerated::OnClose ) ); + m_textCtrlSearchTxt->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( SearchDialogGenerated::OnText ), NULL, this ); + m_buttonFindNext->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SearchDialogGenerated::OnFindNext ), NULL, this ); + m_button29->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SearchDialogGenerated::OnCancel ), NULL, this ); } SearchDialogGenerated::~SearchDialogGenerated() { - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SearchDialogGenerated::OnClose ) ); - m_textCtrlSearchTxt->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( SearchDialogGenerated::OnText ), NULL, this ); - m_buttonFindNext->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SearchDialogGenerated::OnFindNext ), NULL, this ); - m_button29->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SearchDialogGenerated::OnCancel ), NULL, this ); - + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SearchDialogGenerated::OnClose ) ); + m_textCtrlSearchTxt->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( SearchDialogGenerated::OnText ), NULL, this ); + m_buttonFindNext->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SearchDialogGenerated::OnFindNext ), NULL, this ); + m_button29->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SearchDialogGenerated::OnCancel ), NULL, this ); + } diff --git a/ui/gui_generated.h b/ui/gui_generated.h index 07531fb0..7e7a6b20 100644 --- a/ui/gui_generated.h +++ b/ui/gui_generated.h @@ -43,6 +43,7 @@ class wxButtonWithImage; #include <wx/statline.h> #include <wx/frame.h> #include <wx/choice.h> +#include <wx/spinctrl.h> #include <wx/notebook.h> #include <wx/dialog.h> #include <wx/gauge.h> @@ -58,1011 +59,1043 @@ class wxButtonWithImage; /////////////////////////////////////////////////////////////////////////////// /// Class MainDialogGenerated /////////////////////////////////////////////////////////////////////////////// -class MainDialogGenerated : public wxFrame +class MainDialogGenerated : public wxFrame { - private: - - protected: - wxMenuBar* m_menubar1; - wxMenu* m_menuFile; - wxMenuItem* m_menuItem10; - wxMenuItem* m_menuItem11; - wxMenuItem* m_menuItemSwitchView; - wxMenuItem* m_menuItemNew; - wxMenuItem* m_menuItemSave; - wxMenuItem* m_menuItemLoad; - wxMenu* m_menuAdvanced; - wxMenu* m_menuLanguages; - wxMenuItem* m_menuItemGlobSett; - wxMenuItem* m_menuItem7; - wxMenu* m_menuHelp; - wxMenuItem* m_menuItemCheckVer; - wxMenuItem* m_menuItemAbout; - wxBoxSizer* bSizerPanelHolder; - wxPanel* m_panelTopButtons; - wxBoxSizer* bSizerTopButtons; - - wxStaticText* m_staticTextCmpVariant; - - wxButtonWithImage* m_buttonCompare; - wxButton* m_buttonAbort; - wxBitmapButton* m_bpButtonCmpConfig; - - - wxStaticText* m_staticTextSyncVariant; - wxBitmapButton* m_bpButtonSyncConfig; - wxButtonWithImage* m_buttonStartSync; - - wxPanel* m_panelDirectoryPairs; - wxStaticBoxSizer* sbSizerDirLeft; - wxPanel* m_panelTopMiddle; - - wxBitmapButton* m_bpButtonSwapSides; - - - - wxStaticBoxSizer* sbSizerDirRight; - wxBitmapButton* m_bpButtonAddPair; - wxScrolledWindow* m_scrolledWindowFolderPairs; - wxBoxSizer* bSizerAddFolderPairs; - wxPanel* m_panelGrids; - wxBoxSizer* bSizerGridHolder; - CustomGridLeft* m_gridLeft; - wxPanel* m_panelMiddle; - CustomGridMiddle* m_gridMiddle; - CustomGridRight* m_gridRight; - wxPanel* m_panelConfig; - wxBoxSizer* bSizerConfig; - - wxBitmapButton* m_bpButtonSave; - wxBitmapButton* m_bpButtonLoad; - wxListBox* m_listBoxHistory; - wxPanel* m_panelFilter; - - wxBitmapButton* m_bpButtonFilter; - wxCheckBox* m_checkBoxHideFilt; - wxPanel* m_panelStatistics; - wxBoxSizer* bSizerStatistics; - - wxStaticBitmap* m_bitmapCreate; - wxTextCtrl* m_textCtrlCreate; - wxStaticBitmap* m_bitmapDelete; - wxTextCtrl* m_textCtrlDelete; - wxStaticBitmap* m_bitmapUpdate; - wxTextCtrl* m_textCtrlUpdate; - wxStaticBitmap* m_bitmapData; - wxTextCtrl* m_textCtrlData; - - wxPanel* m_panelViewFilter; - wxBoxSizer* bSizerViewFilter; - - ToggleButton* m_bpButtonSyncCreateLeft; - ToggleButton* m_bpButtonSyncDirOverwLeft; - ToggleButton* m_bpButtonSyncDeleteLeft; - ToggleButton* m_bpButtonLeftOnly; - ToggleButton* m_bpButtonLeftNewer; - ToggleButton* m_bpButtonEqual; - ToggleButton* m_bpButtonDifferent; - ToggleButton* m_bpButtonSyncDirNone; - ToggleButton* m_bpButtonRightNewer; - ToggleButton* m_bpButtonRightOnly; - ToggleButton* m_bpButtonSyncDeleteRight; - ToggleButton* m_bpButtonSyncDirOverwRight; - ToggleButton* m_bpButtonSyncCreateRight; - ToggleButton* m_bpButtonConflict; - - wxPanel* m_panelStatusBar; - - wxStaticText* m_staticTextStatusLeft; - - wxStaticLine* m_staticline9; - - wxStaticText* m_staticTextStatusMiddle; - - wxStaticLine* m_staticline10; - - wxStaticText* m_staticTextStatusRight; - - wxStaticBitmap* m_bitmap15; - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnCompare( wxCommandEvent& event ) { event.Skip(); } - virtual void OnStartSync( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSwitchView( wxCommandEvent& event ) { event.Skip(); } - virtual void OnNewConfig( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSaveConfig( wxCommandEvent& event ) { event.Skip(); } - virtual void OnLoadConfig( wxCommandEvent& event ) { event.Skip(); } - virtual void OnMenuQuit( wxCommandEvent& event ) { event.Skip(); } - virtual void OnMenuGlobalSettings( wxCommandEvent& event ) { event.Skip(); } - virtual void OnMenuBatchJob( wxCommandEvent& event ) { event.Skip(); } - virtual void OnMenuExportFileList( wxCommandEvent& event ) { event.Skip(); } - virtual void OnShowHelp( wxCommandEvent& event ) { event.Skip(); } - virtual void OnMenuCheckVersion( wxCommandEvent& event ) { event.Skip(); } - virtual void OnMenuAbout( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCmpSettings( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSyncSettings( wxCommandEvent& event ) { event.Skip(); } - virtual void OnDirSelected( wxFileDirPickerEvent& event ) { event.Skip(); } - virtual void OnSwapSides( wxCommandEvent& event ) { event.Skip(); } - virtual void OnAddFolderPair( wxCommandEvent& event ) { event.Skip(); } - virtual void OnRemoveTopFolderPair( wxCommandEvent& event ) { event.Skip(); } - virtual void OnLeftGridDoubleClick( wxGridEvent& event ) { event.Skip(); } - virtual void OnContextRim( wxGridEvent& event ) { event.Skip(); } - virtual void OnSortLeftGrid( wxGridEvent& event ) { event.Skip(); } - virtual void OnContextRimLabelLeft( wxGridEvent& event ) { event.Skip(); } - virtual void OnContextMiddle( wxGridEvent& event ) { event.Skip(); } - virtual void OnSortMiddleGrid( wxGridEvent& event ) { event.Skip(); } - virtual void OnContextMiddleLabel( wxGridEvent& event ) { event.Skip(); } - virtual void OnRightGridDoubleClick( wxGridEvent& event ) { event.Skip(); } - virtual void OnSortRightGrid( wxGridEvent& event ) { event.Skip(); } - virtual void OnContextRimLabelRight( wxGridEvent& event ) { event.Skip(); } - virtual void OnCfgHistoryKeyEvent( wxKeyEvent& event ) { event.Skip(); } - virtual void OnLoadFromHistory( wxCommandEvent& event ) { event.Skip(); } - virtual void OnConfigureFilter( wxCommandEvent& event ) { event.Skip(); } - virtual void OnHideFilteredButton( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSyncCreateLeft( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSyncDirLeft( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSyncDeleteLeft( wxCommandEvent& event ) { event.Skip(); } - virtual void OnLeftOnlyFiles( wxCommandEvent& event ) { event.Skip(); } - virtual void OnLeftNewerFiles( wxCommandEvent& event ) { event.Skip(); } - virtual void OnEqualFiles( wxCommandEvent& event ) { event.Skip(); } - virtual void OnDifferentFiles( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSyncDirNone( wxCommandEvent& event ) { event.Skip(); } - virtual void OnRightNewerFiles( wxCommandEvent& event ) { event.Skip(); } - virtual void OnRightOnlyFiles( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSyncDeleteRight( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSyncDirRight( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSyncCreateRight( wxCommandEvent& event ) { event.Skip(); } - virtual void OnConflictFiles( wxCommandEvent& event ) { event.Skip(); } - - - public: - wxPanel* m_panelTopLeft; - CustomComboBox* m_directoryLeft; - wxDirPickerCtrl* m_dirPickerLeft; - wxBitmapButton* m_bpButtonLocalFilter; - wxBitmapButton* m_bpButtonAltSyncCfg; - wxPanel* m_panelTopRight; - wxBitmapButton* m_bpButtonRemovePair; - CustomComboBox* m_directoryRight; - wxDirPickerCtrl* m_dirPickerRight; - wxPanel* m_panelLeft; - wxPanel* m_panelRight; - - MainDialogGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); - - ~MainDialogGenerated(); - +private: + +protected: + wxMenuBar* m_menubar1; + wxMenu* m_menuFile; + wxMenuItem* m_menuItem10; + wxMenuItem* m_menuItem11; + wxMenuItem* m_menuItemSwitchView; + wxMenuItem* m_menuItemNew; + wxMenuItem* m_menuItemSave; + wxMenuItem* m_menuItemLoad; + wxMenu* m_menuAdvanced; + wxMenu* m_menuLanguages; + wxMenuItem* m_menuItemGlobSett; + wxMenuItem* m_menuItem7; + wxMenu* m_menuHelp; + wxMenuItem* m_menuItemCheckVer; + wxMenuItem* m_menuItemAbout; + wxBoxSizer* bSizerPanelHolder; + wxPanel* m_panelTopButtons; + wxBoxSizer* bSizerTopButtons; + + wxStaticText* m_staticTextCmpVariant; + + wxButtonWithImage* m_buttonCompare; + wxButton* m_buttonAbort; + wxBitmapButton* m_bpButtonCmpConfig; + + + wxStaticText* m_staticTextSyncVariant; + wxBitmapButton* m_bpButtonSyncConfig; + wxButtonWithImage* m_buttonStartSync; + + wxPanel* m_panelDirectoryPairs; + wxStaticBoxSizer* sbSizerDirLeft; + wxPanel* m_panelTopMiddle; + + wxBitmapButton* m_bpButtonSwapSides; + + + + wxStaticBoxSizer* sbSizerDirRight; + wxBitmapButton* m_bpButtonAddPair; + wxScrolledWindow* m_scrolledWindowFolderPairs; + wxBoxSizer* bSizerAddFolderPairs; + wxPanel* m_panelGrids; + wxBoxSizer* bSizerGridHolder; + CustomGridLeft* m_gridLeft; + wxPanel* m_panelMiddle; + CustomGridMiddle* m_gridMiddle; + CustomGridRight* m_gridRight; + wxPanel* m_panelConfig; + wxBoxSizer* bSizerConfig; + + wxBitmapButton* m_bpButtonSave; + wxBitmapButton* m_bpButtonLoad; + wxListBox* m_listBoxHistory; + wxPanel* m_panelFilter; + + wxBitmapButton* m_bpButtonFilter; + wxCheckBox* m_checkBoxHideFilt; + wxPanel* m_panelStatistics; + wxBoxSizer* bSizerStatistics; + + wxStaticBitmap* m_bitmapCreate; + wxTextCtrl* m_textCtrlCreate; + wxStaticBitmap* m_bitmapUpdate; + wxTextCtrl* m_textCtrlUpdate; + wxStaticBitmap* m_bitmapDelete; + wxTextCtrl* m_textCtrlDelete; + wxStaticBitmap* m_bitmapData; + wxTextCtrl* m_textCtrlData; + + wxPanel* m_panelViewFilter; + wxBoxSizer* bSizerViewFilter; + + ToggleButton* m_bpButtonSyncCreateLeft; + ToggleButton* m_bpButtonSyncDirOverwLeft; + ToggleButton* m_bpButtonSyncDeleteLeft; + ToggleButton* m_bpButtonLeftOnly; + ToggleButton* m_bpButtonLeftNewer; + ToggleButton* m_bpButtonEqual; + ToggleButton* m_bpButtonDifferent; + ToggleButton* m_bpButtonSyncDirNone; + ToggleButton* m_bpButtonRightNewer; + ToggleButton* m_bpButtonRightOnly; + ToggleButton* m_bpButtonSyncDeleteRight; + ToggleButton* m_bpButtonSyncDirOverwRight; + ToggleButton* m_bpButtonSyncCreateRight; + ToggleButton* m_bpButtonConflict; + + wxPanel* m_panelStatusBar; + + wxStaticText* m_staticTextStatusLeft; + + wxStaticLine* m_staticline9; + + wxStaticText* m_staticTextStatusMiddle; + + wxStaticLine* m_staticline10; + + wxStaticText* m_staticTextStatusRight; + + wxStaticBitmap* m_bitmap15; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } + virtual void OnCompare( wxCommandEvent& event ) { event.Skip(); } + virtual void OnStartSync( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSwitchView( wxCommandEvent& event ) { event.Skip(); } + virtual void OnNewConfig( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSaveConfig( wxCommandEvent& event ) { event.Skip(); } + virtual void OnLoadConfig( wxCommandEvent& event ) { event.Skip(); } + virtual void OnMenuQuit( wxCommandEvent& event ) { event.Skip(); } + virtual void OnMenuGlobalSettings( wxCommandEvent& event ) { event.Skip(); } + virtual void OnMenuBatchJob( wxCommandEvent& event ) { event.Skip(); } + virtual void OnMenuExportFileList( wxCommandEvent& event ) { event.Skip(); } + virtual void OnShowHelp( wxCommandEvent& event ) { event.Skip(); } + virtual void OnMenuCheckVersion( wxCommandEvent& event ) { event.Skip(); } + virtual void OnMenuAbout( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCmpSettings( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSyncSettings( wxCommandEvent& event ) { event.Skip(); } + virtual void OnDirSelected( wxFileDirPickerEvent& event ) { event.Skip(); } + virtual void OnSwapSides( wxCommandEvent& event ) { event.Skip(); } + virtual void OnAddFolderPair( wxCommandEvent& event ) { event.Skip(); } + virtual void OnRemoveTopFolderPair( wxCommandEvent& event ) { event.Skip(); } + virtual void OnLeftGridDoubleClick( wxGridEvent& event ) { event.Skip(); } + virtual void OnContextRim( wxGridEvent& event ) { event.Skip(); } + virtual void OnSortLeftGrid( wxGridEvent& event ) { event.Skip(); } + virtual void OnContextRimLabelLeft( wxGridEvent& event ) { event.Skip(); } + virtual void OnContextMiddle( wxGridEvent& event ) { event.Skip(); } + virtual void OnSortMiddleGrid( wxGridEvent& event ) { event.Skip(); } + virtual void OnContextMiddleLabel( wxGridEvent& event ) { event.Skip(); } + virtual void OnRightGridDoubleClick( wxGridEvent& event ) { event.Skip(); } + virtual void OnSortRightGrid( wxGridEvent& event ) { event.Skip(); } + virtual void OnContextRimLabelRight( wxGridEvent& event ) { event.Skip(); } + virtual void OnCfgHistoryKeyEvent( wxKeyEvent& event ) { event.Skip(); } + virtual void OnLoadFromHistory( wxCommandEvent& event ) { event.Skip(); } + virtual void OnConfigureFilter( wxCommandEvent& event ) { event.Skip(); } + virtual void OnHideFilteredButton( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSyncCreateLeft( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSyncDirLeft( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSyncDeleteLeft( wxCommandEvent& event ) { event.Skip(); } + virtual void OnLeftOnlyFiles( wxCommandEvent& event ) { event.Skip(); } + virtual void OnLeftNewerFiles( wxCommandEvent& event ) { event.Skip(); } + virtual void OnEqualFiles( wxCommandEvent& event ) { event.Skip(); } + virtual void OnDifferentFiles( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSyncDirNone( wxCommandEvent& event ) { event.Skip(); } + virtual void OnRightNewerFiles( wxCommandEvent& event ) { event.Skip(); } + virtual void OnRightOnlyFiles( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSyncDeleteRight( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSyncDirRight( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSyncCreateRight( wxCommandEvent& event ) { event.Skip(); } + virtual void OnConflictFiles( wxCommandEvent& event ) { event.Skip(); } + + +public: + wxPanel* m_panelTopLeft; + CustomComboBox* m_directoryLeft; + wxDirPickerCtrl* m_dirPickerLeft; + wxBitmapButton* m_bpButtonLocalFilter; + wxBitmapButton* m_bpButtonAltSyncCfg; + wxPanel* m_panelTopRight; + wxBitmapButton* m_bpButtonRemovePair; + CustomComboBox* m_directoryRight; + wxDirPickerCtrl* m_dirPickerRight; + wxPanel* m_panelLeft; + wxPanel* m_panelRight; + + MainDialogGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); + + ~MainDialogGenerated(); + }; /////////////////////////////////////////////////////////////////////////////// /// Class FolderPairGenerated /////////////////////////////////////////////////////////////////////////////// -class FolderPairGenerated : public wxPanel +class FolderPairGenerated : public wxPanel { - private: - - protected: - - - - - public: - wxPanel* m_panelLeft; - wxTextCtrl* m_directoryLeft; - wxDirPickerCtrl* m_dirPickerLeft; - wxPanel* m_panel20; - wxBitmapButton* m_bpButtonLocalFilter; - wxBitmapButton* m_bpButtonAltSyncCfg; - wxPanel* m_panelRight; - wxBitmapButton* m_bpButtonRemovePair; - wxTextCtrl* m_directoryRight; - wxDirPickerCtrl* m_dirPickerRight; - - FolderPairGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); - ~FolderPairGenerated(); - +private: + +protected: + + + + +public: + wxPanel* m_panelLeft; + wxTextCtrl* m_directoryLeft; + wxDirPickerCtrl* m_dirPickerLeft; + wxPanel* m_panel20; + wxBitmapButton* m_bpButtonLocalFilter; + wxBitmapButton* m_bpButtonAltSyncCfg; + wxPanel* m_panelRight; + wxBitmapButton* m_bpButtonRemovePair; + wxTextCtrl* m_directoryRight; + wxDirPickerCtrl* m_dirPickerRight; + + FolderPairGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); + ~FolderPairGenerated(); + }; /////////////////////////////////////////////////////////////////////////////// /// Class BatchFolderPairGenerated /////////////////////////////////////////////////////////////////////////////// -class BatchFolderPairGenerated : public wxPanel +class BatchFolderPairGenerated : public wxPanel { - private: - - protected: - wxPanel* m_panel32; - wxStaticText* m_staticText53; - wxStaticText* m_staticText541; - wxPanel* m_panelLeft; - wxPanel* m_panelRight; - - - public: - wxBitmapButton* m_bpButtonRemovePair; - wxTextCtrl* m_directoryLeft; - wxDirPickerCtrl* m_dirPickerLeft; - wxBitmapButton* m_bpButtonLocalFilter; - wxTextCtrl* m_directoryRight; - wxDirPickerCtrl* m_dirPickerRight; - wxBitmapButton* m_bpButtonAltSyncCfg; - - BatchFolderPairGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); - ~BatchFolderPairGenerated(); - +private: + +protected: + wxPanel* m_panel32; + wxStaticText* m_staticText53; + wxStaticText* m_staticText541; + wxPanel* m_panelLeft; + wxPanel* m_panelRight; + + +public: + wxBitmapButton* m_bpButtonRemovePair; + wxTextCtrl* m_directoryLeft; + wxDirPickerCtrl* m_dirPickerLeft; + wxBitmapButton* m_bpButtonLocalFilter; + wxTextCtrl* m_directoryRight; + wxDirPickerCtrl* m_dirPickerRight; + wxBitmapButton* m_bpButtonAltSyncCfg; + + BatchFolderPairGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); + ~BatchFolderPairGenerated(); + }; /////////////////////////////////////////////////////////////////////////////// /// Class BatchDlgGenerated /////////////////////////////////////////////////////////////////////////////// -class BatchDlgGenerated : public wxDialog +class BatchDlgGenerated : public wxDialog { - private: - - protected: - wxBoxSizer* bSizer69; - wxStaticBitmap* m_bitmap27; - wxPanel* m_panel8; - wxStaticText* m_staticText56; - - - wxStaticText* m_staticText44; - wxBitmapButton* m_bpButtonHelp; - - wxStaticLine* m_staticline10; - wxStaticText* m_staticText531; - wxNotebook* m_notebookSettings; - wxPanel* m_panelOverview; - wxBitmapButton* m_bpButtonCmpConfig; - - wxStaticText* m_staticTextCmpVariant; - - wxBitmapButton* m_bpButtonFilter; - - wxStaticText* m_staticTextSyncVariant; - - wxBitmapButton* m_bpButtonSyncConfig; - - wxBoxSizer* sbSizerMainPair; - wxPanel* m_panelMainPair; - wxStaticText* m_staticText532; - wxStaticText* m_staticText5411; - wxBoxSizer* bSizerAddFolderPairs; - - - wxCheckBox* m_checkBoxSilent; - - wxChoice* m_choiceHandleError; - wxPanel* m_panelLogging; - wxStaticText* m_staticText120; - wxTextCtrl* m_textCtrlLogfileDir; - wxDirPickerCtrl* m_dirPickerLogfileDir; - wxButton* m_buttonSave; - wxButton* m_buttonLoad; - wxButton* m_button6; - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnHelp( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCmpSettings( wxCommandEvent& event ) { event.Skip(); } - virtual void OnConfigureFilter( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSyncSettings( wxCommandEvent& event ) { event.Skip(); } - virtual void OnAddFolderPair( wxCommandEvent& event ) { event.Skip(); } - virtual void OnRemoveTopFolderPair( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCheckSilent( wxCommandEvent& event ) { event.Skip(); } - virtual void OnChangeErrorHandling( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSaveBatchJob( wxCommandEvent& event ) { event.Skip(); } - virtual void OnLoadBatchJob( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } - - - public: - wxScrolledWindow* m_scrolledWindow6; - wxBitmapButton* m_bpButtonAddPair; - wxBitmapButton* m_bpButtonRemovePair; - wxPanel* m_panelLeft; - wxTextCtrl* m_directoryLeft; - wxDirPickerCtrl* m_dirPickerLeft; - wxBitmapButton* m_bpButtonLocalFilter; - wxPanel* m_panelRight; - wxTextCtrl* m_directoryRight; - wxDirPickerCtrl* m_dirPickerRight; - wxBitmapButton* m_bpButtonAltSyncCfg; - - BatchDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Create a batch job"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); - ~BatchDlgGenerated(); - +private: + +protected: + wxBoxSizer* bSizer69; + wxStaticBitmap* m_bitmap27; + wxPanel* m_panel8; + wxStaticText* m_staticText56; + + + wxStaticText* m_staticText44; + wxBitmapButton* m_bpButtonHelp; + + wxStaticLine* m_staticline10; + wxStaticText* m_staticText531; + wxNotebook* m_notebookSettings; + wxPanel* m_panelOverview; + wxBitmapButton* m_bpButtonCmpConfig; + + wxStaticText* m_staticTextCmpVariant; + + wxBitmapButton* m_bpButtonFilter; + + wxStaticText* m_staticTextSyncVariant; + + wxBitmapButton* m_bpButtonSyncConfig; + + wxBoxSizer* sbSizerMainPair; + wxPanel* m_panelMainPair; + wxStaticText* m_staticText532; + wxStaticText* m_staticText5411; + wxBoxSizer* bSizerAddFolderPairs; + + + wxCheckBox* m_checkBoxSilent; + + wxChoice* m_choiceHandleError; + wxPanel* m_panelLogging; + wxStaticText* m_staticText120; + wxTextCtrl* m_textCtrlLogfileDir; + wxDirPickerCtrl* m_dirPickerLogfileDir; + wxStaticText* m_staticText96; + + wxSpinCtrl* m_spinCtrlLogCountMax; + wxButton* m_buttonSave; + wxButton* m_buttonLoad; + wxButton* m_button6; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } + virtual void OnHelp( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCmpSettings( wxCommandEvent& event ) { event.Skip(); } + virtual void OnConfigureFilter( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSyncSettings( wxCommandEvent& event ) { event.Skip(); } + virtual void OnAddFolderPair( wxCommandEvent& event ) { event.Skip(); } + virtual void OnRemoveTopFolderPair( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCheckSilent( wxCommandEvent& event ) { event.Skip(); } + virtual void OnChangeErrorHandling( wxCommandEvent& event ) { event.Skip(); } + virtual void OnChangeMaxLogCountTxt( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSaveBatchJob( wxCommandEvent& event ) { event.Skip(); } + virtual void OnLoadBatchJob( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } + + +public: + wxScrolledWindow* m_scrolledWindow6; + wxBitmapButton* m_bpButtonAddPair; + wxBitmapButton* m_bpButtonRemovePair; + wxPanel* m_panelLeft; + wxTextCtrl* m_directoryLeft; + wxDirPickerCtrl* m_dirPickerLeft; + wxBitmapButton* m_bpButtonLocalFilter; + wxPanel* m_panelRight; + wxTextCtrl* m_directoryRight; + wxDirPickerCtrl* m_dirPickerRight; + wxBitmapButton* m_bpButtonAltSyncCfg; + + BatchDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Create a batch job"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~BatchDlgGenerated(); + }; /////////////////////////////////////////////////////////////////////////////// /// Class CompareStatusGenerated /////////////////////////////////////////////////////////////////////////////// -class CompareStatusGenerated : public wxPanel +class CompareStatusGenerated : public wxPanel { - private: - - protected: - - wxBoxSizer* bSizer42; - wxBoxSizer* bSizerFilesFound; - wxStaticText* m_staticText321; - wxStaticText* m_staticTextScanned; - wxBoxSizer* bSizerFilesRemaining; - wxStaticText* m_staticText46; - wxStaticText* m_staticTextFilesRemaining; - wxStaticText* m_staticText117; - wxStaticText* m_staticTextDataRemaining; - wxStaticText* m_staticText118; - - wxBoxSizer* sSizerSpeed; - wxStaticText* m_staticText104; - wxStaticText* m_staticTextSpeed; - - wxBoxSizer* sSizerTimeRemaining; - wxStaticText* m_staticTextTimeRemFixed; - wxStaticText* m_staticTextTimeRemaining; - - wxBoxSizer* sSizerTimeElapsed; - wxStaticText* m_staticTextTimeElapsed; - wxStaticText* m_staticText30; - wxTextCtrl* m_textCtrlStatus; - wxGauge* m_gauge2; - - - public: - - CompareStatusGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxRAISED_BORDER|wxTAB_TRAVERSAL ); - ~CompareStatusGenerated(); - +private: + +protected: + + wxBoxSizer* bSizer42; + wxBoxSizer* bSizerFilesFound; + wxStaticText* m_staticText321; + wxStaticText* m_staticTextScanned; + wxBoxSizer* bSizerFilesRemaining; + wxStaticText* m_staticText46; + wxStaticText* m_staticTextFilesRemaining; + wxStaticText* m_staticText117; + wxStaticText* m_staticTextDataRemaining; + wxStaticText* m_staticText118; + + wxBoxSizer* sSizerSpeed; + wxStaticText* m_staticText104; + wxStaticText* m_staticTextSpeed; + + wxBoxSizer* sSizerTimeRemaining; + wxStaticText* m_staticTextTimeRemFixed; + wxStaticText* m_staticTextTimeRemaining; + + wxBoxSizer* sSizerTimeElapsed; + wxStaticText* m_staticTextTimeElapsed; + wxStaticText* m_staticText30; + wxTextCtrl* m_textCtrlStatus; + wxGauge* m_gauge2; + + +public: + + CompareStatusGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxRAISED_BORDER|wxTAB_TRAVERSAL ); + ~CompareStatusGenerated(); + }; /////////////////////////////////////////////////////////////////////////////// /// Class SyncCfgDlgGenerated /////////////////////////////////////////////////////////////////////////////// -class SyncCfgDlgGenerated : public wxDialog +class SyncCfgDlgGenerated : public wxDialog { - private: - - protected: - wxStaticText* m_staticText1; - wxRadioButton* m_radioBtnAutomatic; - wxButton* m_buttonAutomatic; - wxStaticText* m_staticText81; - wxRadioButton* m_radioBtnMirror; - wxButton* m_buttonOneWay; - wxStaticText* m_staticText8; - wxRadioButton* m_radioBtnUpdate; - wxButton* m_buttonUpdate; - wxStaticText* m_staticText101; - wxRadioButton* m_radioBtnCustom; - - wxStaticText* m_staticText23; - - wxStaticText* m_staticText9; - - wxBoxSizer* bSizer201; - wxStaticBoxSizer* sbSizerErrorHandling; - wxChoice* m_choiceHandleError; - wxChoice* m_choiceHandleDeletion; - wxPanel* m_panelCustomDeletionDir; - wxTextCtrl* m_textCtrlCustomDelFolder; - wxDirPickerCtrl* m_dirPickerCustomDelFolder; - - wxButton* m_buttonOK; - wxButton* m_button16; - - - wxStaticBoxSizer* sbSizerSyncDirections; - wxStaticText* m_staticText21; - wxStaticText* m_staticText31; - wxStaticLine* m_staticline3; - wxStaticBitmap* m_bitmapLeftOnly; - - wxBitmapButton* m_bpButtonLeftOnly; - wxStaticBitmap* m_bitmapRightOnly; - - wxBitmapButton* m_bpButtonRightOnly; - wxStaticBitmap* m_bitmapLeftNewer; - - wxBitmapButton* m_bpButtonLeftNewer; - wxStaticBitmap* m_bitmapRightNewer; - - wxBitmapButton* m_bpButtonRightNewer; - wxStaticBitmap* m_bitmapDifferent; - - wxBitmapButton* m_bpButtonDifferent; - wxStaticBitmap* m_bitmapConflict; - - wxBitmapButton* m_bpButtonConflict; - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnSyncAutomatic( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSyncLeftToRight( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSyncUpdate( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSyncCustom( wxCommandEvent& event ) { event.Skip(); } - virtual void OnChangeErrorHandling( wxCommandEvent& event ) { event.Skip(); } - virtual void OnChangeDeletionHandling( wxCommandEvent& event ) { event.Skip(); } - virtual void OnApply( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } - virtual void OnExLeftSideOnly( wxCommandEvent& event ) { event.Skip(); } - virtual void OnExRightSideOnly( wxCommandEvent& event ) { event.Skip(); } - virtual void OnLeftNewer( wxCommandEvent& event ) { event.Skip(); } - virtual void OnRightNewer( wxCommandEvent& event ) { event.Skip(); } - virtual void OnDifferent( wxCommandEvent& event ) { event.Skip(); } - virtual void OnConflict( wxCommandEvent& event ) { event.Skip(); } - - - public: - - SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Synchronization settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE ); - ~SyncCfgDlgGenerated(); - +private: + +protected: + wxStaticText* m_staticText1; + wxRadioButton* m_radioBtnAutomatic; + wxButton* m_buttonAutomatic; + wxStaticText* m_staticText81; + wxRadioButton* m_radioBtnMirror; + wxButton* m_buttonOneWay; + wxStaticText* m_staticText8; + wxRadioButton* m_radioBtnUpdate; + wxButton* m_buttonUpdate; + wxStaticText* m_staticText101; + wxRadioButton* m_radioBtnCustom; + + wxStaticText* m_staticText23; + + wxStaticText* m_staticText9; + + wxBoxSizer* bSizer201; + wxStaticBoxSizer* sbSizerErrorHandling; + wxChoice* m_choiceHandleError; + wxChoice* m_choiceHandleDeletion; + wxPanel* m_panelCustomDeletionDir; + wxTextCtrl* m_textCtrlCustomDelFolder; + wxDirPickerCtrl* m_dirPickerCustomDelFolder; + + wxButton* m_buttonOK; + wxButton* m_button16; + + + wxStaticBoxSizer* sbSizerSyncDirections; + wxStaticText* m_staticText21; + wxStaticText* m_staticText31; + wxStaticLine* m_staticline3; + wxStaticBitmap* m_bitmapLeftOnly; + + wxBitmapButton* m_bpButtonLeftOnly; + wxStaticBitmap* m_bitmapRightOnly; + + wxBitmapButton* m_bpButtonRightOnly; + wxStaticBitmap* m_bitmapLeftNewer; + + wxBitmapButton* m_bpButtonLeftNewer; + wxStaticBitmap* m_bitmapRightNewer; + + wxBitmapButton* m_bpButtonRightNewer; + wxStaticBitmap* m_bitmapDifferent; + + wxBitmapButton* m_bpButtonDifferent; + wxStaticBitmap* m_bitmapConflict; + + wxBitmapButton* m_bpButtonConflict; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } + virtual void OnSyncAutomatic( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSyncLeftToRight( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSyncUpdate( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSyncCustom( wxCommandEvent& event ) { event.Skip(); } + virtual void OnChangeErrorHandling( wxCommandEvent& event ) { event.Skip(); } + virtual void OnChangeDeletionHandling( wxCommandEvent& event ) { event.Skip(); } + virtual void OnApply( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } + virtual void OnExLeftSideOnly( wxCommandEvent& event ) { event.Skip(); } + virtual void OnExRightSideOnly( wxCommandEvent& event ) { event.Skip(); } + virtual void OnLeftNewer( wxCommandEvent& event ) { event.Skip(); } + virtual void OnRightNewer( wxCommandEvent& event ) { event.Skip(); } + virtual void OnDifferent( wxCommandEvent& event ) { event.Skip(); } + virtual void OnConflict( wxCommandEvent& event ) { event.Skip(); } + + +public: + + SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Synchronization settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE ); + ~SyncCfgDlgGenerated(); + }; /////////////////////////////////////////////////////////////////////////////// /// Class CmpCfgDlgGenerated /////////////////////////////////////////////////////////////////////////////// -class CmpCfgDlgGenerated : public wxDialog +class CmpCfgDlgGenerated : public wxDialog { - private: - - protected: - wxRadioButton* m_radioBtnSizeDate; - wxStaticBitmap* m_bitmapByTime; - wxButton* m_buttonTimeSize; - wxRadioButton* m_radioBtnContent; - wxStaticBitmap* m_bitmapByContent; - wxButton* m_buttonContent; - wxStaticLine* m_staticline14; - wxBitmapButton* m_bpButtonHelp; - - wxChoice* m_choiceHandleSymlinks; - wxButton* m_button10; - wxButton* m_button6; - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnTimeSize( wxCommandEvent& event ) { event.Skip(); } - virtual void OnContent( wxCommandEvent& event ) { event.Skip(); } - virtual void OnShowHelp( wxCommandEvent& event ) { event.Skip(); } - virtual void OnChangeErrorHandling( wxCommandEvent& event ) { event.Skip(); } - virtual void OnOkay( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } - - - public: - - CmpCfgDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Comparison settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); - ~CmpCfgDlgGenerated(); - +private: + +protected: + wxRadioButton* m_radioBtnSizeDate; + wxStaticBitmap* m_bitmapByTime; + wxButton* m_buttonTimeSize; + wxRadioButton* m_radioBtnContent; + wxStaticBitmap* m_bitmapByContent; + wxButton* m_buttonContent; + wxStaticLine* m_staticline14; + wxBitmapButton* m_bpButtonHelp; + + wxChoice* m_choiceHandleSymlinks; + wxButton* m_button10; + wxButton* m_button6; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } + virtual void OnTimeSize( wxCommandEvent& event ) { event.Skip(); } + virtual void OnContent( wxCommandEvent& event ) { event.Skip(); } + virtual void OnShowHelp( wxCommandEvent& event ) { event.Skip(); } + virtual void OnChangeErrorHandling( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOkay( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } + + +public: + + CmpCfgDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Comparison settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + ~CmpCfgDlgGenerated(); + }; /////////////////////////////////////////////////////////////////////////////// /// Class SyncStatusDlgGenerated /////////////////////////////////////////////////////////////////////////////// -class SyncStatusDlgGenerated : public wxFrame +class SyncStatusDlgGenerated : public wxFrame { - private: - - protected: - - - wxStaticBitmap* m_bitmapStatus; - wxStaticText* m_staticTextStatus; - wxAnimationCtrl* m_animationControl1; - - wxBoxSizer* bSizer31; - wxBoxSizer* bSizerObjectsRemaining; - wxStaticText* m_staticText25; - wxStaticText* m_staticTextRemainingObj; - wxStaticText* m_staticText96; - wxStaticText* m_staticTextDataRemaining; - wxStaticText* m_staticText97; - wxBoxSizer* bSizerObjectsProcessed; - wxStaticText* m_staticText251; - wxStaticText* m_staticTextProcessedObj; - wxStaticText* m_staticText98; - wxStaticText* m_staticTextDataProcessed; - wxStaticText* m_staticText99; - - wxStaticText* m_staticText55; - wxStaticText* m_staticTextTimeElapsed; - wxTextCtrl* m_textCtrlInfo; - wxBoxSizer* bSizer28; - wxBoxSizer* bSizerSpeed; - wxStaticText* m_staticText108; - wxStaticText* m_staticTextSpeed; - - - wxButton* m_buttonOK; - wxButton* m_buttonPause; - wxButton* m_buttonAbort; - - wxBoxSizer* bSizerRemTime; - - wxStaticText* m_staticText21; - wxStaticText* m_staticTextTimeRemaining; - - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnIconize( wxIconizeEvent& event ) { event.Skip(); } - virtual void OnOkay( wxCommandEvent& event ) { event.Skip(); } - virtual void OnPause( wxCommandEvent& event ) { event.Skip(); } - virtual void OnAbort( wxCommandEvent& event ) { event.Skip(); } - - - public: - wxGauge* m_gauge1; - - SyncStatusDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 638,350 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); - - ~SyncStatusDlgGenerated(); - +private: + +protected: + + + wxStaticBitmap* m_bitmapStatus; + wxStaticText* m_staticTextStatus; + wxAnimationCtrl* m_animationControl1; + + wxBoxSizer* bSizer31; + wxBoxSizer* bSizerObjectsRemaining; + wxStaticText* m_staticText25; + wxStaticText* m_staticTextRemainingObj; + wxStaticText* m_staticText96; + wxStaticText* m_staticTextDataRemaining; + wxStaticText* m_staticText97; + wxBoxSizer* bSizerObjectsProcessed; + wxStaticText* m_staticText251; + wxStaticText* m_staticTextProcessedObj; + wxStaticText* m_staticText98; + wxStaticText* m_staticTextDataProcessed; + wxStaticText* m_staticText99; + + wxStaticText* m_staticText55; + wxStaticText* m_staticTextTimeElapsed; + wxBoxSizer* bSizerProgressText; + wxTextCtrl* m_textCtrlInfo; + wxBoxSizer* bSizer28; + wxBoxSizer* bSizerSpeed; + wxStaticText* m_staticText108; + wxStaticText* m_staticTextSpeed; + + + wxButton* m_buttonOK; + wxButton* m_buttonPause; + wxButton* m_buttonAbort; + + wxBoxSizer* bSizerRemTime; + + wxStaticText* m_staticText21; + wxStaticText* m_staticTextTimeRemaining; + + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } + virtual void OnIconize( wxIconizeEvent& event ) { event.Skip(); } + virtual void OnOkay( wxCommandEvent& event ) { event.Skip(); } + virtual void OnPause( wxCommandEvent& event ) { event.Skip(); } + virtual void OnAbort( wxCommandEvent& event ) { event.Skip(); } + + +public: + wxGauge* m_gauge1; + + SyncStatusDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 638,350 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); + + ~SyncStatusDlgGenerated(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +/// Class LogControlGenerated +/////////////////////////////////////////////////////////////////////////////// +class LogControlGenerated : public wxPanel +{ +private: + +protected: + ToggleButton* m_bpButtonErrors; + ToggleButton* m_bpButtonWarnings; + ToggleButton* m_bpButtonInfo; + wxTextCtrl* m_textCtrlInfo; + + // Virtual event handlers, overide them in your derived class + virtual void OnErrors( wxCommandEvent& event ) { event.Skip(); } + virtual void OnWarnings( wxCommandEvent& event ) { event.Skip(); } + virtual void OnInfo( wxCommandEvent& event ) { event.Skip(); } + + +public: + + LogControlGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); + ~LogControlGenerated(); + }; /////////////////////////////////////////////////////////////////////////////// /// Class HelpDlgGenerated /////////////////////////////////////////////////////////////////////////////// -class HelpDlgGenerated : public wxDialog +class HelpDlgGenerated : public wxDialog { - private: - - protected: - - wxStaticBitmap* m_bitmap25; - wxPanel* m_panel8; - - wxStaticText* m_staticText56; - - - wxNotebook* m_notebook1; - wxScrolledWindow* m_scrolledWindow1; - wxStaticText* m_staticText59; - wxStaticText* m_staticText60; - wxStaticText* m_staticText61; - wxTreeCtrl* m_treeCtrl1; - wxStaticText* m_staticText63; - wxStaticText* m_staticText75; - wxStaticText* m_staticText76; - wxStaticText* m_staticText77; - wxStaticText* m_staticText79; - wxStaticText* m_staticText80; - wxStaticText* m_staticText78; - wxScrolledWindow* m_scrolledWindow5; - wxStaticText* m_staticText65; - wxStaticText* m_staticText66; - wxTreeCtrl* m_treeCtrl2; - wxStaticText* m_staticText69; - wxStaticText* m_staticText81; - wxStaticText* m_staticText82; - wxStaticText* m_staticText83; - wxStaticText* m_staticText84; - wxButton* m_button8; - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnOK( wxCommandEvent& event ) { event.Skip(); } - - - public: - - HelpDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 579,543 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); - ~HelpDlgGenerated(); - +private: + +protected: + + wxStaticBitmap* m_bitmap25; + wxPanel* m_panel8; + + wxStaticText* m_staticText56; + + + wxNotebook* m_notebook1; + wxScrolledWindow* m_scrolledWindow1; + wxStaticText* m_staticText59; + wxStaticText* m_staticText60; + wxStaticText* m_staticText61; + wxTreeCtrl* m_treeCtrl1; + wxStaticText* m_staticText63; + wxStaticText* m_staticText75; + wxStaticText* m_staticText76; + wxStaticText* m_staticText77; + wxStaticText* m_staticText79; + wxStaticText* m_staticText80; + wxStaticText* m_staticText78; + wxScrolledWindow* m_scrolledWindow5; + wxStaticText* m_staticText65; + wxStaticText* m_staticText66; + wxTreeCtrl* m_treeCtrl2; + wxStaticText* m_staticText69; + wxStaticText* m_staticText81; + wxStaticText* m_staticText82; + wxStaticText* m_staticText83; + wxStaticText* m_staticText84; + wxButton* m_button8; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } + virtual void OnOK( wxCommandEvent& event ) { event.Skip(); } + + +public: + + HelpDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 579,543 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~HelpDlgGenerated(); + }; /////////////////////////////////////////////////////////////////////////////// /// Class AboutDlgGenerated /////////////////////////////////////////////////////////////////////////////// -class AboutDlgGenerated : public wxDialog +class AboutDlgGenerated : public wxDialog { - private: - - protected: - - wxPanel* m_panel5; - wxStaticBitmap* m_bitmap11; - wxStaticText* m_build; - - wxScrolledWindow* m_scrolledWindowCodeInfo; - wxBoxSizer* bSizerCodeInfo; - wxStaticText* m_staticText72; - wxStaticText* m_staticText73; - wxHyperlinkCtrl* m_hyperlink21; - wxScrolledWindow* m_scrolledWindowTranslators; - wxBoxSizer* bSizerTranslators; - wxStaticText* m_staticText54; - - wxFlexGridSizer* fgSizerTranslators; - wxStaticLine* m_staticline3; - wxStaticText* m_staticText131; - wxStaticLine* m_staticline12; - wxStaticBitmap* m_bitmap9; - wxHyperlinkCtrl* m_hyperlink1; - - wxHyperlinkCtrl* m_hyperlink6; - wxStaticBitmap* m_bitmap10; - wxHyperlinkCtrl* m_hyperlink2; - - wxAnimationCtrl* m_animationControl1; - wxHyperlinkCtrl* m_hyperlink3; - wxStaticLine* m_staticline2; - - wxStaticBitmap* m_bitmap13; - wxHyperlinkCtrl* m_hyperlink5; - - wxButton* m_buttonOkay; - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnOK( wxCommandEvent& event ) { event.Skip(); } - - - public: - - AboutDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE ); - ~AboutDlgGenerated(); - +private: + +protected: + + wxPanel* m_panel5; + wxStaticBitmap* m_bitmap11; + wxStaticText* m_build; + + wxScrolledWindow* m_scrolledWindowCodeInfo; + wxBoxSizer* bSizerCodeInfo; + wxStaticText* m_staticText72; + wxStaticText* m_staticText73; + wxHyperlinkCtrl* m_hyperlink21; + wxScrolledWindow* m_scrolledWindowTranslators; + wxBoxSizer* bSizerTranslators; + wxStaticText* m_staticText54; + + wxFlexGridSizer* fgSizerTranslators; + wxStaticLine* m_staticline3; + wxStaticText* m_staticText131; + wxStaticLine* m_staticline12; + wxStaticBitmap* m_bitmap9; + wxHyperlinkCtrl* m_hyperlink1; + + wxHyperlinkCtrl* m_hyperlink3; + wxAnimationCtrl* m_animationControl1; + wxStaticBitmap* m_bitmap10; + wxHyperlinkCtrl* m_hyperlink2; + + wxHyperlinkCtrl* m_hyperlink6; + wxStaticBitmap* m_bitmapTransl; + wxStaticLine* m_staticline2; + + wxStaticBitmap* m_bitmap13; + wxHyperlinkCtrl* m_hyperlink5; + + wxButton* m_buttonOkay; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } + virtual void OnOK( wxCommandEvent& event ) { event.Skip(); } + + +public: + + AboutDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE ); + ~AboutDlgGenerated(); + }; /////////////////////////////////////////////////////////////////////////////// /// Class ErrorDlgGenerated /////////////////////////////////////////////////////////////////////////////// -class ErrorDlgGenerated : public wxDialog +class ErrorDlgGenerated : public wxDialog { - private: - - protected: - - wxStaticBitmap* m_bitmap10; - wxTextCtrl* m_textCtrl8; - wxCheckBox* m_checkBoxIgnoreErrors; - - wxButton* m_buttonIgnore; - wxButton* m_buttonRetry; - wxButton* m_buttonAbort; - - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnIgnore( wxCommandEvent& event ) { event.Skip(); } - virtual void OnRetry( wxCommandEvent& event ) { event.Skip(); } - virtual void OnAbort( wxCommandEvent& event ) { event.Skip(); } - - - public: - - ErrorDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Error"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 460,250 ), long style = wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER ); - ~ErrorDlgGenerated(); - +private: + +protected: + + wxStaticBitmap* m_bitmap10; + wxTextCtrl* m_textCtrl8; + wxCheckBox* m_checkBoxIgnoreErrors; + + wxButton* m_buttonIgnore; + wxButton* m_buttonRetry; + wxButton* m_buttonAbort; + + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } + virtual void OnIgnore( wxCommandEvent& event ) { event.Skip(); } + virtual void OnRetry( wxCommandEvent& event ) { event.Skip(); } + virtual void OnAbort( wxCommandEvent& event ) { event.Skip(); } + + +public: + + ErrorDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Error"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 460,250 ), long style = wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER ); + ~ErrorDlgGenerated(); + }; /////////////////////////////////////////////////////////////////////////////// /// Class WarningDlgGenerated /////////////////////////////////////////////////////////////////////////////// -class WarningDlgGenerated : public wxDialog +class WarningDlgGenerated : public wxDialog { - private: - - protected: - - wxTextCtrl* m_textCtrl8; - wxCheckBox* m_checkBoxDontShowAgain; - - wxButton* m_buttonIgnore; - wxButton* m_buttonSwitch; - wxButton* m_buttonAbort; - - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnIgnore( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSwitch( wxCommandEvent& event ) { event.Skip(); } - virtual void OnAbort( wxCommandEvent& event ) { event.Skip(); } - - - public: - wxStaticBitmap* m_bitmap10; - - WarningDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Warning"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 460,250 ), long style = wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER ); - ~WarningDlgGenerated(); - +private: + +protected: + + wxTextCtrl* m_textCtrl8; + wxCheckBox* m_checkBoxDontShowAgain; + + wxButton* m_buttonIgnore; + wxButton* m_buttonSwitch; + wxButton* m_buttonAbort; + + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } + virtual void OnIgnore( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSwitch( wxCommandEvent& event ) { event.Skip(); } + virtual void OnAbort( wxCommandEvent& event ) { event.Skip(); } + + +public: + wxStaticBitmap* m_bitmap10; + + WarningDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Warning"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 460,250 ), long style = wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER ); + ~WarningDlgGenerated(); + }; /////////////////////////////////////////////////////////////////////////////// /// Class QuestionDlgGenerated /////////////////////////////////////////////////////////////////////////////// -class QuestionDlgGenerated : public wxDialog +class QuestionDlgGenerated : public wxDialog { - private: - - protected: - - wxStaticBitmap* m_bitmap10; - wxTextCtrl* m_textCtrl8; - wxCheckBox* m_checkBoxDontAskAgain; - - wxButton* m_buttonYes; - wxButton* m_buttonNo; - wxButton* m_buttonCancel; - - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnYes( wxCommandEvent& event ) { event.Skip(); } - virtual void OnNo( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } - - - public: - - QuestionDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Question"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 420,198 ), long style = wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER ); - ~QuestionDlgGenerated(); - +private: + +protected: + + wxStaticBitmap* m_bitmap10; + wxTextCtrl* m_textCtrl8; + wxCheckBox* m_checkBoxDontAskAgain; + + wxButton* m_buttonYes; + wxButton* m_buttonNo; + wxButton* m_buttonCancel; + + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } + virtual void OnYes( wxCommandEvent& event ) { event.Skip(); } + virtual void OnNo( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } + + +public: + + QuestionDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Question"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 420,198 ), long style = wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER ); + ~QuestionDlgGenerated(); + }; /////////////////////////////////////////////////////////////////////////////// /// Class DeleteDlgGenerated /////////////////////////////////////////////////////////////////////////////// -class DeleteDlgGenerated : public wxDialog +class DeleteDlgGenerated : public wxDialog { - private: - - protected: - - - wxStaticBitmap* m_bitmap12; - wxStaticText* m_staticTextHeader; - - wxCheckBox* m_checkBoxDeleteBothSides; - - wxCheckBox* m_checkBoxUseRecycler; - wxTextCtrl* m_textCtrlMessage; - wxButton* m_buttonOK; - wxButton* m_buttonCancel; - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnDelOnBothSides( wxCommandEvent& event ) { event.Skip(); } - virtual void OnUseRecycler( wxCommandEvent& event ) { event.Skip(); } - virtual void OnOK( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } - - - public: - - DeleteDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Confirm"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 553,336 ), long style = wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER ); - ~DeleteDlgGenerated(); - +private: + +protected: + + + wxStaticBitmap* m_bitmap12; + wxStaticText* m_staticTextHeader; + + wxCheckBox* m_checkBoxDeleteBothSides; + + wxCheckBox* m_checkBoxUseRecycler; + wxTextCtrl* m_textCtrlMessage; + wxButton* m_buttonOK; + wxButton* m_buttonCancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } + virtual void OnDelOnBothSides( wxCommandEvent& event ) { event.Skip(); } + virtual void OnUseRecycler( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOK( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } + + +public: + + DeleteDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Confirm"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 553,336 ), long style = wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER ); + ~DeleteDlgGenerated(); + }; /////////////////////////////////////////////////////////////////////////////// /// Class FilterDlgGenerated /////////////////////////////////////////////////////////////////////////////// -class FilterDlgGenerated : public wxDialog +class FilterDlgGenerated : public wxDialog { - private: - - protected: - wxStaticBitmap* m_bitmap26; - wxPanel* m_panel8; - wxStaticText* m_staticTexHeader; - - wxStaticText* m_staticText44; - wxBitmapButton* m_bpButtonHelp; - - wxPanel* m_panel13; - wxStaticLine* m_staticline10; - wxStaticText* m_staticText45; - wxStaticText* m_staticText83; - wxStaticText* m_staticText84; - wxStaticText* m_staticText85; - wxStaticText* m_staticText181; - wxStaticText* m_staticText1811; - - wxStaticText* m_staticText15; - wxStaticBitmap* m_bitmap8; - wxTextCtrl* m_textCtrlInclude; - - wxStaticText* m_staticText16; - wxStaticBitmap* m_bitmap9; - wxTextCtrl* m_textCtrlExclude; - - wxButton* m_button9; - - wxButton* m_button10; - wxButton* m_button17; - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnHelp( wxCommandEvent& event ) { event.Skip(); } - virtual void OnDefault( wxCommandEvent& event ) { event.Skip(); } - virtual void OnApply( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } - - - public: - - FilterDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Configure filter"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); - ~FilterDlgGenerated(); - +private: + +protected: + wxStaticBitmap* m_bitmap26; + wxPanel* m_panel8; + wxStaticText* m_staticTexHeader; + + wxStaticText* m_staticText44; + wxBitmapButton* m_bpButtonHelp; + + wxPanel* m_panel13; + wxStaticLine* m_staticline10; + wxStaticText* m_staticText45; + wxStaticText* m_staticText83; + wxStaticText* m_staticText84; + wxStaticText* m_staticText85; + wxStaticText* m_staticText181; + wxStaticText* m_staticText1811; + + wxStaticText* m_staticText15; + wxStaticBitmap* m_bitmap8; + wxTextCtrl* m_textCtrlInclude; + + wxStaticText* m_staticText16; + wxStaticBitmap* m_bitmap9; + wxTextCtrl* m_textCtrlExclude; + + wxButton* m_button9; + + wxButton* m_button10; + wxButton* m_button17; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } + virtual void OnHelp( wxCommandEvent& event ) { event.Skip(); } + virtual void OnDefault( wxCommandEvent& event ) { event.Skip(); } + virtual void OnApply( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } + + +public: + + FilterDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Configure filter"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~FilterDlgGenerated(); + }; /////////////////////////////////////////////////////////////////////////////// /// Class CustomizeColsDlgGenerated /////////////////////////////////////////////////////////////////////////////// -class CustomizeColsDlgGenerated : public wxDialog +class CustomizeColsDlgGenerated : public wxDialog { - private: - - protected: - wxCheckListBox* m_checkListColumns; - wxBitmapButton* m_bpButton29; - wxBitmapButton* m_bpButton30; - wxButton* m_button9; - - wxButton* m_button28; - wxButton* m_button29; - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnMoveUp( wxCommandEvent& event ) { event.Skip(); } - virtual void OnMoveDown( wxCommandEvent& event ) { event.Skip(); } - virtual void OnDefault( wxCommandEvent& event ) { event.Skip(); } - virtual void OnOkay( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } - - - public: - - CustomizeColsDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Customize columns"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); - ~CustomizeColsDlgGenerated(); - +private: + +protected: + wxCheckListBox* m_checkListColumns; + wxBitmapButton* m_bpButton29; + wxBitmapButton* m_bpButton30; + wxButton* m_button9; + + wxButton* m_button28; + wxButton* m_button29; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } + virtual void OnMoveUp( wxCommandEvent& event ) { event.Skip(); } + virtual void OnMoveDown( wxCommandEvent& event ) { event.Skip(); } + virtual void OnDefault( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOkay( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } + + +public: + + CustomizeColsDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Customize columns"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + ~CustomizeColsDlgGenerated(); + }; /////////////////////////////////////////////////////////////////////////////// /// Class GlobalSettingsDlgGenerated /////////////////////////////////////////////////////////////////////////////// -class GlobalSettingsDlgGenerated : public wxDialog +class GlobalSettingsDlgGenerated : public wxDialog { - private: - - protected: - wxStaticBitmap* m_bitmapSettings; - - wxPanel* m_panel8; - wxStaticText* m_staticText56; - - wxCheckBox* m_checkBoxCopyLocked; - wxCheckBox* m_checkBoxCopyPermissions; - wxStaticLine* m_staticline10; - wxStaticText* m_staticText100; - - wxButtonWithImage* m_buttonResetDialogs; - - - wxGrid* m_gridCustomCommand; - wxBitmapButton* m_bpButtonAddRow; - wxBitmapButton* m_bpButtonRemoveRow; - - wxButton* m_button9; - - wxButton* m_buttonOkay; - wxButton* m_button29; - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnResetDialogs( wxCommandEvent& event ) { event.Skip(); } - virtual void OnAddRow( wxCommandEvent& event ) { event.Skip(); } - virtual void OnRemoveRow( wxCommandEvent& event ) { event.Skip(); } - virtual void OnDefault( wxCommandEvent& event ) { event.Skip(); } - virtual void OnOkay( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } - - - public: - - GlobalSettingsDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Global settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); - ~GlobalSettingsDlgGenerated(); - +private: + +protected: + wxStaticBitmap* m_bitmapSettings; + + wxPanel* m_panel8; + wxStaticText* m_staticText56; + + wxCheckBox* m_checkBoxCopyLocked; + wxCheckBox* m_checkBoxCopyPermissions; + wxStaticLine* m_staticline10; + wxStaticText* m_staticText100; + + wxButtonWithImage* m_buttonResetDialogs; + + + wxGrid* m_gridCustomCommand; + wxBitmapButton* m_bpButtonAddRow; + wxBitmapButton* m_bpButtonRemoveRow; + + wxButton* m_button9; + + wxButton* m_buttonOkay; + wxButton* m_button29; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } + virtual void OnResetDialogs( wxCommandEvent& event ) { event.Skip(); } + virtual void OnAddRow( wxCommandEvent& event ) { event.Skip(); } + virtual void OnRemoveRow( wxCommandEvent& event ) { event.Skip(); } + virtual void OnDefault( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOkay( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } + + +public: + + GlobalSettingsDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Global settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~GlobalSettingsDlgGenerated(); + }; /////////////////////////////////////////////////////////////////////////////// /// Class SyncPreviewDlgGenerated /////////////////////////////////////////////////////////////////////////////// -class SyncPreviewDlgGenerated : public wxDialog +class SyncPreviewDlgGenerated : public wxDialog { - private: - - protected: - wxButtonWithImage* m_buttonStartSync; - wxStaticLine* m_staticline16; - wxStaticText* m_staticTextVariant; - wxStaticLine* m_staticline14; - - wxStaticText* m_staticText94; - wxStaticBitmap* m_bitmapCreate; - wxTextCtrl* m_textCtrlCreateL; - wxStaticBitmap* m_bitmapUpdate; - wxTextCtrl* m_textCtrlUpdateL; - wxStaticBitmap* m_bitmapDelete; - wxTextCtrl* m_textCtrlDeleteL; - wxStaticText* m_staticText95; - wxTextCtrl* m_textCtrlCreateR; - wxTextCtrl* m_textCtrlUpdateR; - wxTextCtrl* m_textCtrlDeleteR; - - wxStaticBitmap* m_bitmapData; - - wxTextCtrl* m_textCtrlData; - - wxStaticLine* m_staticline12; - wxCheckBox* m_checkBoxDontShowAgain; - - wxButton* m_button16; - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnStartSync( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } - - - public: - - SyncPreviewDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Synchronization Preview"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); - ~SyncPreviewDlgGenerated(); - +private: + +protected: + wxButtonWithImage* m_buttonStartSync; + wxStaticLine* m_staticline16; + wxStaticText* m_staticTextVariant; + wxStaticLine* m_staticline14; + + wxStaticText* m_staticText94; + wxStaticBitmap* m_bitmapCreate; + wxTextCtrl* m_textCtrlCreateL; + wxStaticBitmap* m_bitmapUpdate; + wxTextCtrl* m_textCtrlUpdateL; + wxStaticBitmap* m_bitmapDelete; + wxTextCtrl* m_textCtrlDeleteL; + wxStaticText* m_staticText95; + wxTextCtrl* m_textCtrlCreateR; + wxTextCtrl* m_textCtrlUpdateR; + wxTextCtrl* m_textCtrlDeleteR; + + wxStaticBitmap* m_bitmapData; + + wxTextCtrl* m_textCtrlData; + + wxStaticLine* m_staticline12; + wxCheckBox* m_checkBoxDontShowAgain; + + wxButton* m_button16; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } + virtual void OnStartSync( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } + + +public: + + SyncPreviewDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Synchronization Preview"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + ~SyncPreviewDlgGenerated(); + }; /////////////////////////////////////////////////////////////////////////////// /// Class PopupFrameGenerated1 /////////////////////////////////////////////////////////////////////////////// -class PopupFrameGenerated1 : public wxFrame +class PopupFrameGenerated1 : public wxFrame { - private: - - protected: - - public: - wxStaticBitmap* m_bitmapLeft; - wxStaticText* m_staticTextMain; - - PopupFrameGenerated1( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP|wxSTATIC_BORDER ); - - ~PopupFrameGenerated1(); - +private: + +protected: + +public: + wxStaticBitmap* m_bitmapLeft; + wxStaticText* m_staticTextMain; + + PopupFrameGenerated1( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP|wxSTATIC_BORDER ); + + ~PopupFrameGenerated1(); + }; /////////////////////////////////////////////////////////////////////////////// /// Class SearchDialogGenerated /////////////////////////////////////////////////////////////////////////////// -class SearchDialogGenerated : public wxDialog +class SearchDialogGenerated : public wxDialog { - private: - - protected: - wxStaticText* m_staticText101; - wxTextCtrl* m_textCtrlSearchTxt; - - wxCheckBox* m_checkBoxMatchCase; - wxButton* m_buttonFindNext; - wxButton* m_button29; - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnText( wxCommandEvent& event ) { event.Skip(); } - virtual void OnFindNext( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } - - - public: - - SearchDialogGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE ); - ~SearchDialogGenerated(); - +private: + +protected: + wxStaticText* m_staticText101; + wxTextCtrl* m_textCtrlSearchTxt; + + wxCheckBox* m_checkBoxMatchCase; + wxButton* m_buttonFindNext; + wxButton* m_button29; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } + virtual void OnText( wxCommandEvent& event ) { event.Skip(); } + virtual void OnFindNext( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } + + +public: + + SearchDialogGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE ); + ~SearchDialogGenerated(); + }; #endif //__gui_generated__ diff --git a/ui/gui_status_handler.cpp b/ui/gui_status_handler.cpp index 2be1e0db..0543922c 100644 --- a/ui/gui_status_handler.cpp +++ b/ui/gui_status_handler.cpp @@ -84,20 +84,20 @@ void CompareStatusHandler::initNewProcess(int objectsTotal, wxLongLong dataTotal switch (currentProcess) { - case StatusHandler::PROCESS_SCANNING: - break; - case StatusHandler::PROCESS_COMPARING_CONTENT: - { - wxWindowUpdateLocker dummy(mainDialog); - mainDialog->compareStatus->switchToCompareBytewise(objectsTotal, dataTotal); - mainDialog->Layout(); //show progress bar... - mainDialog->Refresh(); //remove distortion... - } - break; - case StatusHandler::PROCESS_SYNCHRONIZING: - case StatusHandler::PROCESS_NONE: - assert(false); + case StatusHandler::PROCESS_SCANNING: + break; + case StatusHandler::PROCESS_COMPARING_CONTENT: + { + wxWindowUpdateLocker dummy(mainDialog); + mainDialog->compareStatus->switchToCompareBytewise(objectsTotal, dataTotal); + mainDialog->Layout(); //show progress bar... + mainDialog->Refresh(); //remove distortion... + } break; + case StatusHandler::PROCESS_SYNCHRONIZING: + case StatusHandler::PROCESS_NONE: + assert(false); + break; } } @@ -107,16 +107,16 @@ void CompareStatusHandler::updateProcessedData(int objectsProcessed, wxLongLong { switch (currentProcess) { - case StatusHandler::PROCESS_SCANNING: - mainDialog->compareStatus->incScannedObjects_NoUpdate(objectsProcessed); - break; - case StatusHandler::PROCESS_COMPARING_CONTENT: - mainDialog->compareStatus->incProcessedCmpData_NoUpdate(objectsProcessed, dataProcessed); - break; - case StatusHandler::PROCESS_SYNCHRONIZING: - case StatusHandler::PROCESS_NONE: - assert(false); - break; + case StatusHandler::PROCESS_SCANNING: + mainDialog->compareStatus->incScannedObjects_NoUpdate(objectsProcessed); + break; + case StatusHandler::PROCESS_COMPARING_CONTENT: + mainDialog->compareStatus->incProcessedCmpData_NoUpdate(objectsProcessed, dataProcessed); + break; + case StatusHandler::PROCESS_SYNCHRONIZING: + case StatusHandler::PROCESS_NONE: + assert(false); + break; } } @@ -135,15 +135,15 @@ ErrorHandler::Response CompareStatusHandler::reportError(const wxString& message errorDlg.Raise(); switch (static_cast<ErrorDlg::ReturnCodes>(errorDlg.ShowModal())) { - case ErrorDlg::BUTTON_IGNORE: - ignoreErrors = ignoreNextErrors; - return ErrorHandler::IGNORE_ERROR; + case ErrorDlg::BUTTON_IGNORE: + ignoreErrors = ignoreNextErrors; + return ErrorHandler::IGNORE_ERROR; - case ErrorDlg::BUTTON_RETRY: - return ErrorHandler::RETRY; + case ErrorDlg::BUTTON_RETRY: + return ErrorHandler::RETRY; - case ErrorDlg::BUTTON_ABORT: - abortThisProcess(); + case ErrorDlg::BUTTON_ABORT: + abortThisProcess(); } assert(false); @@ -155,6 +155,7 @@ void CompareStatusHandler::reportFatalError(const wxString& errorMessage) { mainDialog->compareStatus->updateStatusPanelNow(); + //show message and abort: currently there are no fatal errors during comparison that can be ignored bool dummy = false; ErrorDlg errorDlg(NULL, ErrorDlg::BUTTON_ABORT, @@ -181,15 +182,15 @@ void CompareStatusHandler::reportWarning(const wxString& warningMessage, bool& w warningDlg.Raise(); switch (static_cast<WarningDlg::Response>(warningDlg.ShowModal())) { - case WarningDlg::BUTTON_IGNORE: - warningActive = !dontWarnAgain; - break; + case WarningDlg::BUTTON_IGNORE: + warningActive = !dontWarnAgain; + break; - case WarningDlg::BUTTON_SWITCH: - assert(false); - case WarningDlg::BUTTON_ABORT: - abortThisProcess(); - break; + case WarningDlg::BUTTON_SWITCH: + assert(false); + case WarningDlg::BUTTON_ABORT: + abortThisProcess(); + break; } } @@ -215,47 +216,33 @@ void CompareStatusHandler::abortThisProcess() //######################################################################################################## -SyncStatusHandler::SyncStatusHandler(wxTopLevelWindow* parentDlg, bool ignoreAllErrors, const wxString& jobName) : +SyncStatusHandler::SyncStatusHandler(MainDialog* parentDlg, bool ignoreAllErrors, const wxString& jobName) : + mainDialog(parentDlg), syncStatusFrame(*this, parentDlg, false, jobName), - ignoreErrors(ignoreAllErrors) {} + ignoreErrors(ignoreAllErrors) +{ +} SyncStatusHandler::~SyncStatusHandler() { - const int totalErrors = errorLog.errorsTotal(); //evaluate before finalizing log + const int totalErrors = errorLog.typeCount(TYPE_ERROR | TYPE_FATAL_ERROR); //evaluate before finalizing log //finalize error log if (abortIsRequested()) - errorLog.logError(wxString(_("Synchronization aborted!")) + wxT(" \n") + _("You may try to synchronize remaining items again (WITHOUT having to re-compare)!")); - else if (totalErrors) - errorLog.logWarning(wxString(_("Synchronization completed with errors!")) + wxT(" \n") + _("You may try to synchronize remaining items again (WITHOUT having to re-compare)!")); + errorLog.logMsg(wxString(_("Synchronization aborted!")) + wxT(" \n") + _("You may try to synchronize remaining items again (WITHOUT having to re-compare)!"), TYPE_ERROR); + else if (totalErrors > 0) + errorLog.logMsg(wxString(_("Synchronization completed with errors!")) + wxT(" \n") + _("You may try to synchronize remaining items again (WITHOUT having to re-compare)!"), TYPE_WARNING); else - errorLog.logInfo(_("Synchronization completed successfully!")); - - - //print the results list - wxString finalMessage; - if (totalErrors > 0) - { - wxString header(_("Warning: Synchronization failed for %x item(s):")); - header.Replace(wxT("%x"), ffs3::numberToStringSep(totalErrors), false); - finalMessage += header + wxT("\n\n"); - } - - const ErrorLogging::MessageEntry& messages = errorLog.getFormattedMessages(); - for (ErrorLogging::MessageEntry::const_iterator i = messages.begin(); i != messages.end(); ++i) - { - finalMessage += *i; - finalMessage += wxT("\n\n"); - } + errorLog.logMsg(_("Synchronization completed successfully!"), TYPE_INFO); //notify to syncStatusFrame that current process has ended if (abortIsRequested()) - syncStatusFrame.processHasFinished(SyncStatus::ABORTED, finalMessage); //enable okay and close events + syncStatusFrame.processHasFinished(SyncStatus::ABORTED, errorLog); //enable okay and close events else if (totalErrors > 0) - syncStatusFrame.processHasFinished(SyncStatus::FINISHED_WITH_ERROR, finalMessage); + syncStatusFrame.processHasFinished(SyncStatus::FINISHED_WITH_ERROR, errorLog); else - syncStatusFrame.processHasFinished(SyncStatus::FINISHED_WITH_SUCCESS, finalMessage); + syncStatusFrame.processHasFinished(SyncStatus::FINISHED_WITH_SUCCESS, errorLog); } @@ -263,7 +250,7 @@ inline void SyncStatusHandler::reportInfo(const Zstring& text) { //if (currentProcess == StatusHandler::PROCESS_SYNCHRONIZING) - //errorLog.logInfo(zToWx(text)); -> don't spam with file copy info: visually identifying warning messages has priority! + errorLog.logMsg(zToWx(text), TYPE_INFO); syncStatusFrame.setStatusText_NoUpdate(text); } @@ -273,15 +260,15 @@ void SyncStatusHandler::initNewProcess(int objectsTotal, wxLongLong dataTotal, P { switch (processID) { - case StatusHandler::PROCESS_SYNCHRONIZING: - syncStatusFrame.resetGauge(objectsTotal, dataTotal); - syncStatusFrame.setCurrentStatus(SyncStatus::SYNCHRONIZING); - break; - case StatusHandler::PROCESS_SCANNING: - case StatusHandler::PROCESS_COMPARING_CONTENT: - case StatusHandler::PROCESS_NONE: - assert(false); - break; + case StatusHandler::PROCESS_SYNCHRONIZING: + syncStatusFrame.resetGauge(objectsTotal, dataTotal); + syncStatusFrame.setCurrentStatus(SyncStatus::SYNCHRONIZING); + break; + case StatusHandler::PROCESS_SCANNING: + case StatusHandler::PROCESS_COMPARING_CONTENT: + case StatusHandler::PROCESS_NONE: + assert(false); + break; } } @@ -297,7 +284,7 @@ ErrorHandler::Response SyncStatusHandler::reportError(const wxString& errorMessa { if (ignoreErrors) { - errorLog.logError(errorMessage); + errorLog.logMsg(errorMessage, TYPE_ERROR); return ErrorHandler::IGNORE_ERROR; } @@ -312,35 +299,34 @@ ErrorHandler::Response SyncStatusHandler::reportError(const wxString& errorMessa const ErrorDlg::ReturnCodes rv = static_cast<ErrorDlg::ReturnCodes>(errorDlg.ShowModal()); switch (rv) { - case ErrorDlg::BUTTON_IGNORE: - ignoreErrors = ignoreNextErrors; - errorLog.logError(errorMessage); - return ErrorHandler::IGNORE_ERROR; + case ErrorDlg::BUTTON_IGNORE: + ignoreErrors = ignoreNextErrors; + errorLog.logMsg(errorMessage, TYPE_ERROR); + return ErrorHandler::IGNORE_ERROR; - case ErrorDlg::BUTTON_RETRY: - return ErrorHandler::RETRY; + case ErrorDlg::BUTTON_RETRY: + return ErrorHandler::RETRY; - case ErrorDlg::BUTTON_ABORT: - errorLog.logError(errorMessage); - abortThisProcess(); + case ErrorDlg::BUTTON_ABORT: + errorLog.logMsg(errorMessage, TYPE_ERROR); + abortThisProcess(); } assert (false); - errorLog.logError(errorMessage); + errorLog.logMsg(errorMessage, TYPE_ERROR); return ErrorHandler::IGNORE_ERROR; } void SyncStatusHandler::reportFatalError(const wxString& errorMessage) { - errorLog.logFatalError(errorMessage); - abortThisProcess(); + errorLog.logMsg(errorMessage, TYPE_FATAL_ERROR); } void SyncStatusHandler::reportWarning(const wxString& warningMessage, bool& warningActive) { - errorLog.logWarning(warningMessage); + errorLog.logMsg(warningMessage, TYPE_WARNING); if (ignoreErrors || !warningActive) //if errors are ignored, then warnings should also return; @@ -358,15 +344,15 @@ void SyncStatusHandler::reportWarning(const wxString& warningMessage, bool& warn const WarningDlg::Response rv = static_cast<WarningDlg::Response>(warningDlg.ShowModal()); switch (rv) { - case WarningDlg::BUTTON_IGNORE: //no unhandled error situation! - warningActive = !dontWarnAgain; - return; - - case WarningDlg::BUTTON_SWITCH: - assert(false); - case WarningDlg::BUTTON_ABORT: - abortThisProcess(); - return; + case WarningDlg::BUTTON_IGNORE: //no unhandled error situation! + warningActive = !dontWarnAgain; + return; + + case WarningDlg::BUTTON_SWITCH: + assert(false); + case WarningDlg::BUTTON_ABORT: + abortThisProcess(); + return; } assert(false); @@ -374,12 +360,6 @@ void SyncStatusHandler::reportWarning(const wxString& warningMessage, bool& warn } -void SyncStatusHandler::logInfo(const wxString& infoMessage) -{ - errorLog.logInfo(infoMessage); -} - - void SyncStatusHandler::forceUiRefresh() { syncStatusFrame.updateStatusDialogNow(); diff --git a/ui/gui_status_handler.h b/ui/gui_status_handler.h index f504270b..c0e75a8d 100644 --- a/ui/gui_status_handler.h +++ b/ui/gui_status_handler.h @@ -48,7 +48,7 @@ private: class SyncStatusHandler : public StatusHandler { public: - SyncStatusHandler(wxTopLevelWindow* parentDlg, bool ignoreAllErrors, const wxString& jobName); + SyncStatusHandler(MainDialog* parentDlg, bool ignoreAllErrors, const wxString& jobName); ~SyncStatusHandler(); virtual void initNewProcess(int objectsTotal, wxLongLong dataTotal, Process processID); @@ -59,11 +59,11 @@ public: virtual ErrorHandler::Response reportError(const wxString& text); virtual void reportFatalError(const wxString& errorMessage); virtual void reportWarning(const wxString& warningMessage, bool& warningActive); - void logInfo(const wxString& infoMessage); private: virtual void abortThisProcess(); + MainDialog* mainDialog; //optional SyncStatus syncStatusFrame; //the window managed by SyncStatus has longer lifetime than this handler! bool ignoreErrors; ffs3::ErrorLogging errorLog; diff --git a/ui/is_null_filter.h b/ui/is_null_filter.h index 7c8826d6..21981a03 100644 --- a/ui/is_null_filter.h +++ b/ui/is_null_filter.h @@ -16,7 +16,7 @@ namespace ffs3 inline bool isNullFilter(const FilterConfig& filterCfg) { - return NameFilter(filterCfg.includeFilter, filterCfg.excludeFilter).isNull(); + return NameFilter(filterCfg.includeFilter, filterCfg.excludeFilter).isNull(); } } diff --git a/ui/main_dlg.cpp b/ui/main_dlg.cpp index c8106cf9..97093e7b 100644 --- a/ui/main_dlg.cpp +++ b/ui/main_dlg.cpp @@ -27,7 +27,7 @@ #include "../shared/localization.h" #include "../shared/string_conv.h" #include "small_dlgs.h" -#include "mouse_move_dlg.h" +#include "../shared/mouse_move_dlg.h" #include "progress_indicator.h" #include "msg_popup.h" #include "../shared/dir_name.h" @@ -88,47 +88,47 @@ public: switch (xmlAccess::getMergeType(droppedFiles)) //throw () { - case xmlAccess::MERGE_BATCH: - if (droppedFiles.size() == 1) - { - BatchDialog* batchDlg = new BatchDialog(&mainDlg_, droppedFiles[0]); - if (batchDlg->ShowModal() == BatchDialog::BATCH_FILE_SAVED) - mainDlg_.pushStatusInformation(_("Batch file created successfully!")); - return false; - } - //fall-through for multiple *.ffs_batch files! + case xmlAccess::MERGE_BATCH: + if (droppedFiles.size() == 1) + { + BatchDialog batchDlg(&mainDlg_, droppedFiles[0]); + if (batchDlg.ShowModal() == BatchDialog::BATCH_FILE_SAVED) + mainDlg_.pushStatusInformation(_("Batch file created successfully!")); + return false; + } + //fall-through for multiple *.ffs_batch files! - case xmlAccess::MERGE_GUI: - case xmlAccess::MERGE_GUI_BATCH: - if (droppedFiles.size() == 1) - { - mainDlg_.loadConfiguration(droppedFiles[0]); - return false; - } - else - { - xmlAccess::XmlGuiConfig guiCfg; - try + case xmlAccess::MERGE_GUI: + case xmlAccess::MERGE_GUI_BATCH: + if (droppedFiles.size() == 1) { - convertConfig(droppedFiles, guiCfg); //throw (xmlAccess::XmlError) + mainDlg_.loadConfiguration(droppedFiles[0]); + return false; } - catch (const xmlAccess::XmlError& error) + else { - if (error.getSeverity() == xmlAccess::XmlError::WARNING) - wxMessageBox(error.msg(), _("Warning"), wxOK | wxICON_WARNING); - else + xmlAccess::XmlGuiConfig guiCfg; + try { - wxMessageBox(error.msg(), _("Error"), wxOK | wxICON_ERROR); - return false; + convertConfig(droppedFiles, guiCfg); //throw (xmlAccess::XmlError) + } + catch (const xmlAccess::XmlError& error) + { + if (error.getSeverity() == xmlAccess::XmlError::WARNING) + wxMessageBox(error.msg(), _("Warning"), wxOK | wxICON_WARNING); + else + { + wxMessageBox(error.msg(), _("Error"), wxOK | wxICON_ERROR); + return false; + } } + mainDlg_.setCurrentConfiguration(guiCfg); + return false; } - mainDlg_.setCurrentConfiguration(guiCfg); - return false; - } - case xmlAccess::MERGE_OTHER: - //=> return true: change directory selection via drag and drop - break; + case xmlAccess::MERGE_OTHER: + //=> return true: change directory selection via drag and drop + break; } @@ -173,18 +173,6 @@ public: mainDlg(mainDialog) {} private: - virtual void OnLocalFilterCfgRemoveConfirm(wxCommandEvent& event) - { - FolderPairPanelBasic<GuiPanel>::OnLocalFilterCfgRemoveConfirm(event); - mainDlg.updateFilterConfig(); //update filter - } - - virtual void OnAltSyncCfgRemoveConfirm(wxCommandEvent& event) - { - FolderPairPanelBasic<GuiPanel>::OnAltSyncCfgRemoveConfirm(event); - mainDlg.updateSyncConfig(); - } - virtual wxWindow* getParentWindow() { return &mainDlg; @@ -197,7 +185,13 @@ private: virtual void OnAltSyncCfgChange() { - mainDlg.updateSyncConfig(); + mainDlg.applySyncConfig(); + } + + virtual void OnAltSyncCfgRemoveConfirm(wxCommandEvent& event) + { + FolderPairPanelBasic<GuiPanel>::OnAltSyncCfgRemoveConfirm(event); + mainDlg.applySyncConfig(); } virtual void OnLocalFilterCfgChange() @@ -205,6 +199,12 @@ private: mainDlg.updateFilterConfig(); //re-apply filter } + virtual void OnLocalFilterCfgRemoveConfirm(wxCommandEvent& event) + { + FolderPairPanelBasic<GuiPanel>::OnLocalFilterCfgRemoveConfirm(event); + mainDlg.updateFilterConfig(); //update filter + } + MainDialog& mainDlg; }; @@ -339,16 +339,51 @@ struct DirNotFound }; +#ifdef FFS_WIN +class PanelMoveWindow : public MouseMoveWindow +{ +public: + PanelMoveWindow(MainDialog& mainDlg) : + MouseMoveWindow(mainDlg, + mainDlg.m_panelTopButtons, + //mainDlg.m_panelDirectoryPairs, + mainDlg.m_panelConfig, + mainDlg.m_panelFilter, + mainDlg.m_panelViewFilter, + mainDlg.m_panelStatistics, + mainDlg.m_panelStatusBar), + mainDlg_(mainDlg) {} + + virtual bool allowMove(const wxMouseEvent& event) + { + wxPanel* panel = dynamic_cast<wxPanel*>(event.GetEventObject()); + + const wxAuiPaneInfo& paneInfo = mainDlg_.auiMgr.GetPane(panel); + if (paneInfo.IsOk() && + paneInfo.IsFloating()) + return false; //prevent main dialog move + + return true;; //allow dialog move + } + +private: + MainDialog& mainDlg_; +}; +#endif + + //################################################################################################################################## MainDialog::MainDialog(const wxString& cfgFileName, xmlAccess::XmlGlobalSettings& settings) : MainDialogGenerated(NULL) { xmlAccess::XmlGuiConfig guiCfg; //structure to receive gui settings, already defaulted!! - const wxString currentConfigFile = cfgFileName.empty() ? lastConfigFileName() : cfgFileName; + wxString currentConfigFile = cfgFileName; //this one has priority + if (currentConfigFile.empty()) currentConfigFile = settings.gui.lastUsedConfigFile; //next: suggest name of last used selection + if (currentConfigFile.empty() || !fileExists(wxToZ(currentConfigFile))) currentConfigFile = lastConfigFileName(); //if above fails... bool loadCfgSuccess = false; - if (!cfgFileName.empty() || fileExists(wxToZ(lastConfigFileName()))) + if (!cfgFileName.empty() || fileExists(wxToZ(currentConfigFile))) try { //load XML @@ -376,39 +411,6 @@ MainDialog::MainDialog(const wxString& cfgFileName, xmlAccess::XmlGlobalSettings } -#ifdef FFS_WIN -class PanelMoveWindow : public MouseMoveWindow -{ -public: - PanelMoveWindow(MainDialog& mainDlg) : - MouseMoveWindow(mainDlg, - mainDlg.m_panelTopButtons, - //mainDlg.m_panelDirectoryPairs, - mainDlg.m_panelConfig, - mainDlg.m_panelFilter, - mainDlg.m_panelViewFilter, - mainDlg.m_panelStatistics, - mainDlg.m_panelStatusBar), - mainDlg_(mainDlg) {} - - virtual bool allowMove(const wxMouseEvent& event) - { - wxPanel* panel = dynamic_cast<wxPanel*>(event.GetEventObject()); - - const wxAuiPaneInfo& paneInfo = mainDlg_.auiMgr.GetPane(panel); - if ( paneInfo.IsOk() && - paneInfo.IsFloating()) - return false; //prevent main dialog move - - return true;; //allow dialog move - } - -private: - MainDialog& mainDlg_; -}; -#endif - - MainDialog::MainDialog(const xmlAccess::XmlGuiConfig& guiCfg, xmlAccess::XmlGlobalSettings& settings, bool startComparison) : @@ -441,7 +443,7 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig guiCfg, m_panelStatusBar->SetLayoutDirection(wxLayout_LeftToRight); //------------------------------------------------------------------------------------------------------ -//---------------- support for dockable gui style -------------------------------- + //---------------- support for dockable gui style -------------------------------- bSizerPanelHolder->Detach(m_panelTopButtons); bSizerPanelHolder->Detach(m_panelDirectoryPairs); bSizerPanelHolder->Detach(m_panelGrids); @@ -476,7 +478,7 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig guiCfg, wxAuiPaneInfo().Name(wxT("Panel5")).Bottom().Row(1).Position(1).Caption(_("Filter files")).MinSize(-1, m_panelFilter->GetSize().GetHeight())); auiMgr.AddPane(m_panelViewFilter, - wxAuiPaneInfo().Name(wxT("Panel6")).Bottom().Row(1).Position(2).Caption(_("Filter view")).MinSize(m_bpButtonSyncDirNone->GetSize().GetWidth(), m_panelViewFilter->GetSize().GetHeight())); + wxAuiPaneInfo().Name(wxT("Panel6")).Bottom().Row(1).Position(2).Caption(_("Select view")).MinSize(m_bpButtonSyncDirNone->GetSize().GetWidth(), m_panelViewFilter->GetSize().GetHeight())); auiMgr.AddPane(m_panelStatistics, wxAuiPaneInfo().Name(wxT("Panel7")).Bottom().Row(1).Position(3).Caption(_("Statistics")).MinSize(m_panelStatistics->GetSize().GetWidth() / 2, m_panelStatistics->GetSize().GetHeight())); @@ -486,21 +488,22 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig guiCfg, auiMgr.Update(); defaultPerspective = auiMgr.SavePerspective(); -//---------------------------------------------------------------------------------- -//register view layout context menu + //---------------------------------------------------------------------------------- + //register view layout context menu m_panelTopButtons->Connect(wxEVT_RIGHT_DOWN, wxMouseEventHandler(MainDialog::OnContextSetLayout), NULL, this); m_panelConfig ->Connect(wxEVT_RIGHT_DOWN, wxMouseEventHandler(MainDialog::OnContextSetLayout), NULL, this); m_panelFilter ->Connect(wxEVT_RIGHT_DOWN, wxMouseEventHandler(MainDialog::OnContextSetLayout), NULL, this); m_panelViewFilter->Connect(wxEVT_RIGHT_DOWN, wxMouseEventHandler(MainDialog::OnContextSetLayout), NULL, this); m_panelStatistics->Connect(wxEVT_RIGHT_DOWN, wxMouseEventHandler(MainDialog::OnContextSetLayout), NULL, this); m_panelStatusBar ->Connect(wxEVT_RIGHT_DOWN, wxMouseEventHandler(MainDialog::OnContextSetLayout), NULL, this); -//---------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------- globalSettings = &settings; gridDataView.reset(new ffs3::GridView); contextMenu.reset(new wxMenu); //initialize right-click context menu; will be dynamically re-created on each R-mouse-click cleanedUp = false; + processingGlobalKeyEvent = false; lastSortColumn = -1; lastSortGrid = NULL; @@ -514,7 +517,7 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig guiCfg, SetTitle(wxString(wxT("FreeFileSync - ")) + _("Folder Comparison and Synchronization")); - SetIcon(*GlobalResources::getInstance().programIcon); //set application icon + SetIcon(*GlobalResources::instance().programIcon); //set application icon //notify about (logical) application main window => program won't quit, but stay on this dialog ffs3::AppMainWindow::setMainWindow(this); @@ -529,35 +532,35 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig guiCfg, setCurrentConfiguration(guiCfg); //set icons for this dialog - m_buttonCompare->setBitmapFront(GlobalResources::getInstance().getImageByName(wxT("compare"))); - m_bpButtonSyncConfig->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("syncConfig"))); - m_bpButtonCmpConfig->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("cmpConfig"))); - m_bpButtonSave->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("save"))); - m_bpButtonLoad->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("load"))); - m_bpButtonAddPair->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("addFolderPair"))); - m_bitmap15->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("statusEdge"))); - - m_bitmapCreate->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("create"))); - m_bitmapUpdate->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("update"))); - m_bitmapDelete->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("delete"))); - m_bitmapData->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("data"))); + m_buttonCompare->setBitmapFront(GlobalResources::instance().getImage(wxT("compare"))); + m_bpButtonSyncConfig->SetBitmapLabel(GlobalResources::instance().getImage(wxT("syncConfig"))); + m_bpButtonCmpConfig->SetBitmapLabel(GlobalResources::instance().getImage(wxT("cmpConfig"))); + m_bpButtonSave->SetBitmapLabel(GlobalResources::instance().getImage(wxT("save"))); + m_bpButtonLoad->SetBitmapLabel(GlobalResources::instance().getImage(wxT("load"))); + m_bpButtonAddPair->SetBitmapLabel(GlobalResources::instance().getImage(wxT("addFolderPair"))); + m_bitmap15->SetBitmap(GlobalResources::instance().getImage(wxT("statusEdge"))); + + m_bitmapCreate->SetBitmap(GlobalResources::instance().getImage(wxT("create"))); + m_bitmapUpdate->SetBitmap(GlobalResources::instance().getImage(wxT("update"))); + m_bitmapDelete->SetBitmap(GlobalResources::instance().getImage(wxT("delete"))); + m_bitmapData ->SetBitmap(GlobalResources::instance().getImage(wxT("data"))); m_panelTopButtons->Layout(); //wxButtonWithImage size might have changed //menu icons: workaround for wxWidgets: small hack to update menu items: actually this is a wxWidgets bug (affects Windows- and Linux-build) MenuItemUpdater updateMenuFile(m_menuFile); - updateMenuFile.addForUpdate(m_menuItem10, GlobalResources::getInstance().getImageByName(wxT("compareSmall"))); - updateMenuFile.addForUpdate(m_menuItem11, GlobalResources::getInstance().getImageByName(wxT("syncSmall"))); - updateMenuFile.addForUpdate(m_menuItemNew, GlobalResources::getInstance().getImageByName(wxT("newSmall"))); - updateMenuFile.addForUpdate(m_menuItemSave, GlobalResources::getInstance().getImageByName(wxT("saveSmall"))); - updateMenuFile.addForUpdate(m_menuItemLoad, GlobalResources::getInstance().getImageByName(wxT("loadSmall"))); + updateMenuFile.addForUpdate(m_menuItem10, GlobalResources::instance().getImage(wxT("compareSmall"))); + updateMenuFile.addForUpdate(m_menuItem11, GlobalResources::instance().getImage(wxT("syncSmall"))); + updateMenuFile.addForUpdate(m_menuItemNew, GlobalResources::instance().getImage(wxT("newSmall"))); + updateMenuFile.addForUpdate(m_menuItemSave, GlobalResources::instance().getImage(wxT("saveSmall"))); + updateMenuFile.addForUpdate(m_menuItemLoad, GlobalResources::instance().getImage(wxT("loadSmall"))); MenuItemUpdater updateMenuAdv(m_menuAdvanced); - updateMenuAdv.addForUpdate(m_menuItemGlobSett, GlobalResources::getInstance().getImageByName(wxT("settingsSmall"))); - updateMenuAdv.addForUpdate(m_menuItem7, GlobalResources::getInstance().getImageByName(wxT("batchSmall"))); + updateMenuAdv.addForUpdate(m_menuItemGlobSett, GlobalResources::instance().getImage(wxT("settingsSmall"))); + updateMenuAdv.addForUpdate(m_menuItem7, GlobalResources::instance().getImage(wxT("batchSmall"))); MenuItemUpdater updateMenuHelp(m_menuHelp); - updateMenuHelp.addForUpdate(m_menuItemAbout, GlobalResources::getInstance().getImageByName(wxT("aboutSmall"))); + updateMenuHelp.addForUpdate(m_menuItemAbout, GlobalResources::instance().getImage(wxT("aboutSmall"))); #ifdef FFS_LINUX if (!ffs3::isPortableVersion()) //disable update check for Linux installer-based version -> handled by .deb @@ -568,7 +571,7 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig guiCfg, for (std::vector<LocInfoLine>::const_iterator i = LocalizationInfo::getMapping().begin(); i != LocalizationInfo::getMapping().end(); ++i) { wxMenuItem* newItem = new wxMenuItem(m_menuLanguages, wxID_ANY, i->languageName, wxEmptyString, wxITEM_NORMAL ); - newItem->SetBitmap(GlobalResources::getInstance().getImageByName(i->languageFlag)); + newItem->SetBitmap(GlobalResources::instance().getImage(i->languageFlag)); //map menu item IDs with language IDs: evaluated when processing event handler languageMenuItemMap.insert(std::map<MenuItemID, LanguageID>::value_type(newItem->GetId(), i->languageID)); @@ -586,6 +589,7 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig guiCfg, //register global hotkeys (without explicit menu entry) wxTheApp->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MainDialog::OnGlobalKeyEvent), NULL, this); + Connect(wxEVT_IDLE, wxEventHandler(MainDialog::OnIdleEvent), NULL, this); Connect(wxEVT_SIZE, wxSizeEventHandler(MainDialog::OnResize), NULL, this); @@ -626,21 +630,23 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig guiCfg, //asynchronous call to wxWindow::Layout(): fix superfluous frame on right and bottom when FFS is started in fullscreen mode Connect(wxEVT_IDLE, wxIdleEventHandler(MainDialog::OnLayoutWindowAsync), NULL, this); -//---------------------------------------------------------------------------------------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------------------------------------------------------------------------------------- //some convenience: if FFS is started with a *.ffs_gui file as commandline parameter AND all directories contained exist, comparison shall be started right off if (startComparison) { const ffs3::MainConfiguration currMainCfg = getCurrentConfiguration().mainCfg; const bool allFoldersExist = !DirNotFound()(currMainCfg.firstPair) && std::find_if(currMainCfg.additionalPairs.begin(), currMainCfg.additionalPairs.end(), - DirNotFound()) == currMainCfg.additionalPairs.end(); + DirNotFound()) == currMainCfg.additionalPairs.end(); if (allFoldersExist) { wxCommandEvent dummy2(wxEVT_COMMAND_BUTTON_CLICKED); m_buttonCompare->GetEventHandler()->AddPendingEvent(dummy2); //simulate button click on "compare" } } -//---------------------------------------------------------------------------------------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------------------------------------------------------------------------------------- + + addFileToCfgHistory(lastConfigFileName()); //make sure <Last session> is always part of history list } @@ -650,16 +656,20 @@ void MainDialog::cleanUp(bool saveLastUsedConfig) { cleanedUp = true; - //no need for wxEventHandler::Disconnect() here; done automatically when window is destoyed! + //important! event source wxTheApp is NOT dependent on this instance -> disconnect! + wxTheApp->Disconnect(wxEVT_KEY_DOWN, wxKeyEventHandler(MainDialog::OnGlobalKeyEvent), NULL, this); + + //no need for wxEventHandler::Disconnect() here; event sources are components of this window and are destroyed, too m_gridLeft ->release(); //handle wxGrid-related callback on grid data after MainDialog has died... (Linux only) m_gridMiddle->release(); m_gridRight ->release(); + writeGlobalSettings(); //set before saving last used config since this will reset "currentConfigFileName" + //save configuration if (saveLastUsedConfig) writeConfigurationToXml(lastConfigFileName()); //don't throw exceptions in destructors - writeGlobalSettings(); } } @@ -673,11 +683,11 @@ void MainDialog::readGlobalSettings() posYNotMaximized = globalSettings->gui.posYNotMaximized; //apply window size and position - if ( widthNotMaximized != wxDefaultCoord && - heightNotMaximized != wxDefaultCoord && - posXNotMaximized != wxDefaultCoord && - posYNotMaximized != wxDefaultCoord && - wxDisplay::GetFromPoint(wxPoint(posXNotMaximized, posYNotMaximized)) != wxNOT_FOUND) //make sure upper left corner is in visible view + if (widthNotMaximized != wxDefaultCoord && + heightNotMaximized != wxDefaultCoord && + posXNotMaximized != wxDefaultCoord && + posYNotMaximized != wxDefaultCoord && + wxDisplay::GetFromPoint(wxPoint(posXNotMaximized, posYNotMaximized)) != wxNOT_FOUND) //make sure upper left corner is in visible view SetSize(posXNotMaximized, posYNotMaximized, widthNotMaximized, heightNotMaximized); else Centre(); @@ -706,7 +716,7 @@ void MainDialog::readGlobalSettings() m_gridLeft->enableFileIcons(globalSettings->gui.showFileIconsLeft); m_gridRight->enableFileIcons(globalSettings->gui.showFileIconsRight); -//------------------------------------------------------------------------------------------------ + //------------------------------------------------------------------------------------------------ //wxAuiManager erroneously loads panel captions, we don't want that typedef std::vector<std::pair<wxString, wxString> > CaptionNameMapping; CaptionNameMapping captionNameMap; @@ -742,7 +752,8 @@ void MainDialog::writeGlobalSettings() if (m_listBoxHistory->GetClientObject(i)) cfgFileHistory.push_back(static_cast<wxClientDataString*>(m_listBoxHistory->GetClientObject(i))->name_); - globalSettings->gui.cfgFileHistory = cfgFileHistory; + globalSettings->gui.cfgFileHistory = cfgFileHistory; + globalSettings->gui.lastUsedConfigFile = currentConfigFileName; //write list of last used folders globalSettings->gui.folderHistoryLeft.clear(); @@ -914,20 +925,19 @@ public: return DeleteFilesHandler::IGNORE_ERROR; bool ignoreNextErrors = false; - ErrorDlg* errorDlg = new ErrorDlg(NULL, - ErrorDlg::BUTTON_IGNORE | ErrorDlg::BUTTON_RETRY | ErrorDlg::BUTTON_ABORT, - errorMessage, ignoreNextErrors); - const int rv = errorDlg->ShowModal(); - errorDlg->Destroy(); + ErrorDlg errorDlg(NULL, + ErrorDlg::BUTTON_IGNORE | ErrorDlg::BUTTON_RETRY | ErrorDlg::BUTTON_ABORT, + errorMessage, ignoreNextErrors); + const int rv = errorDlg.ShowModal(); switch (static_cast<ErrorDlg::ReturnCodes>(rv)) { - case ErrorDlg::BUTTON_IGNORE: - ignoreErrors = ignoreNextErrors; - return DeleteFilesHandler::IGNORE_ERROR; - case ErrorDlg::BUTTON_RETRY: - return DeleteFilesHandler::RETRY; - case ErrorDlg::BUTTON_ABORT: - throw ffs3::AbortThisProcess(); + case ErrorDlg::BUTTON_IGNORE: + ignoreErrors = ignoreNextErrors; + return DeleteFilesHandler::IGNORE_ERROR; + case ErrorDlg::BUTTON_RETRY: + return DeleteFilesHandler::RETRY; + case ErrorDlg::BUTTON_ABORT: + throw ffs3::AbortThisProcess(); } assert (false); @@ -1169,6 +1179,7 @@ void MainDialog::clearStatusBar() void MainDialog::disableAllElements() { //disenables all elements (except abort button) that might receive user input during long-running processes: comparison, deletion + m_panelViewFilter ->Disable(); m_bpButtonCmpConfig ->Disable(); m_panelFilter ->Disable(); m_panelConfig ->Disable(); @@ -1196,6 +1207,7 @@ void MainDialog::disableAllElements() void MainDialog::enableAllElements() { + m_panelViewFilter ->Enable(); m_bpButtonCmpConfig ->Enable(); m_panelFilter ->Enable(); m_panelConfig ->Enable(); @@ -1235,7 +1247,7 @@ void MainDialog::OnResize(wxSizeEvent& event) //test ALL parameters at once, since width/height are invalid if the window is minimized (eg x,y == -32000; height = 28, width = 160) //note: negative values for x and y are possible when using multiple monitors! if (width > 0 && height > 0 && x >= -3360 && y >= -200 && - wxDisplay::GetFromPoint(wxPoint(x, y)) != wxNOT_FOUND) //make sure upper left corner is in visible view + wxDisplay::GetFromPoint(wxPoint(x, y)) != wxNOT_FOUND) //make sure upper left corner is in visible view { widthNotMaximized = width; //visible coordinates x < 0 and y < 0 are possible with dual monitors! heightNotMaximized = height; @@ -1312,68 +1324,69 @@ void MainDialog::onGridLeftButtonEvent(wxKeyEvent& event) if (event.ControlDown()) switch (keyCode) { - case 'C': - case WXK_INSERT: //CTRL + C || CTRL + INS - copySelectionToClipboard(m_gridLeft); - return; // -> swallow event! don't allow default grid commands! + case 'C': + case WXK_INSERT: //CTRL + C || CTRL + INS + copySelectionToClipboard(m_gridLeft); + return; // -> swallow event! don't allow default grid commands! - case 'A': //CTRL + A - m_gridLeft->SelectAll(); - return; + case 'A': //CTRL + A + m_gridLeft->SelectAll(); + return; - case WXK_NUMPAD_ADD: //CTRL + '+' - m_gridLeft->autoSizeColumns(); - return; + case WXK_NUMPAD_ADD: //CTRL + '+' + m_gridLeft->autoSizeColumns(); + return; } else if (event.AltDown()) switch (keyCode) { - case WXK_LEFT: //ALT + <- - { - wxCommandEvent dummy; - OnContextSyncDirLeft(dummy); - } - return; + case WXK_LEFT: //ALT + <- + { + wxCommandEvent dummy; + OnContextSyncDirLeft(dummy); + } + return; - case WXK_RIGHT: //ALT + -> - { - wxCommandEvent dummy; - OnContextSyncDirRight(dummy); - } - return; + case WXK_RIGHT: //ALT + -> + { + wxCommandEvent dummy; + OnContextSyncDirRight(dummy); + } + return; - case WXK_UP: /* ALT + /|\ */ - case WXK_DOWN: /* ALT + \|/ */ - { - wxCommandEvent dummy; - OnContextSyncDirNone(dummy); - } - return; + case WXK_UP: /* ALT + /|\ */ + case WXK_DOWN: /* ALT + \|/ */ + { + wxCommandEvent dummy; + OnContextSyncDirNone(dummy); + } + return; } else switch (keyCode) { - case WXK_DELETE: - case WXK_NUMPAD_DELETE: - deleteSelectedFiles(); - return; + case WXK_DELETE: + case WXK_NUMPAD_DELETE: + deleteSelectedFiles(); + return; - case WXK_SPACE: - { - wxCommandEvent dummy; - OnContextFilterTemp(dummy); - } - return; + case WXK_SPACE: + case WXK_NUMPAD_SPACE: + { + wxCommandEvent dummy; + OnContextFilterTemp(dummy); + } + return; - case WXK_RETURN: - case WXK_NUMPAD_ENTER: - { - if (!globalSettings->gui.externelApplications.empty()) - openExternalApplication(globalSettings->gui.externelApplications[0].second); //open with first external application - } - return; + case WXK_RETURN: + case WXK_NUMPAD_ENTER: + { + if (!globalSettings->gui.externelApplications.empty()) + openExternalApplication(globalSettings->gui.externelApplications[0].second); //open with first external application + } + return; } event.Skip(); //unknown keypress: propagate @@ -1387,10 +1400,10 @@ void MainDialog::onGridMiddleButtonEvent(wxKeyEvent& event) if (event.ControlDown()) switch (keyCode) { - case 'C': - case WXK_INSERT: //CTRL + C || CTRL + INS - copySelectionToClipboard(m_gridMiddle); - return; + case 'C': + case WXK_INSERT: //CTRL + C || CTRL + INS + copySelectionToClipboard(m_gridMiddle); + return; } event.Skip(); //unknown keypress: propagate @@ -1404,68 +1417,69 @@ void MainDialog::onGridRightButtonEvent(wxKeyEvent& event) if (event.ControlDown()) switch (keyCode) { - case 'C': - case WXK_INSERT: //CTRL + C || CTRL + INS - copySelectionToClipboard(m_gridRight); - return; + case 'C': + case WXK_INSERT: //CTRL + C || CTRL + INS + copySelectionToClipboard(m_gridRight); + return; - case 'A': //CTRL + A - m_gridRight->SelectAll(); - return; + case 'A': //CTRL + A + m_gridRight->SelectAll(); + return; - case WXK_NUMPAD_ADD: //CTRL + '+' - m_gridRight->autoSizeColumns(); - return; + case WXK_NUMPAD_ADD: //CTRL + '+' + m_gridRight->autoSizeColumns(); + return; } else if (event.AltDown()) switch (keyCode) { - case WXK_LEFT: //ALT + <- - { - wxCommandEvent dummy; - OnContextSyncDirLeft(dummy); - } - return; + case WXK_LEFT: //ALT + <- + { + wxCommandEvent dummy; + OnContextSyncDirLeft(dummy); + } + return; - case WXK_RIGHT: //ALT + -> - { - wxCommandEvent dummy; - OnContextSyncDirRight(dummy); - } - return; + case WXK_RIGHT: //ALT + -> + { + wxCommandEvent dummy; + OnContextSyncDirRight(dummy); + } + return; - case WXK_UP: /* ALT + /|\ */ - case WXK_DOWN: /* ALT + \|/ */ - { - wxCommandEvent dummy; - OnContextSyncDirNone(dummy); - } - return; + case WXK_UP: /* ALT + /|\ */ + case WXK_DOWN: /* ALT + \|/ */ + { + wxCommandEvent dummy; + OnContextSyncDirNone(dummy); + } + return; } else switch (keyCode) { - case WXK_DELETE: - case WXK_NUMPAD_DELETE: - deleteSelectedFiles(); - return; + case WXK_DELETE: + case WXK_NUMPAD_DELETE: + deleteSelectedFiles(); + return; - case WXK_SPACE: - { - wxCommandEvent dummy; - OnContextFilterTemp(dummy); - } - return; + case WXK_SPACE: + case WXK_NUMPAD_SPACE: + { + wxCommandEvent dummy; + OnContextFilterTemp(dummy); + } + return; - case WXK_RETURN: - case WXK_NUMPAD_ENTER: - { - if (!globalSettings->gui.externelApplications.empty()) - openExternalApplication(globalSettings->gui.externelApplications[0].second); //open with first external application - } - return; + case WXK_RETURN: + case WXK_NUMPAD_ENTER: + { + if (!globalSettings->gui.externelApplications.empty()) + openExternalApplication(globalSettings->gui.externelApplications[0].second); //open with first external application + } + return; } event.Skip(); //unknown keypress: propagate @@ -1474,25 +1488,78 @@ void MainDialog::onGridRightButtonEvent(wxKeyEvent& event) void MainDialog::OnGlobalKeyEvent(wxKeyEvent& event) //process key events without explicit menu entry :) { + //avoid recursion!!! -> this ugly construct seems to be the only (portable) way to avoid re-entrancy + //recursion may happen in multiple situations: e.g. modal dialogs, wxGrid::ProcessEvent()! + if (processingGlobalKeyEvent || + !IsEnabled() || !m_gridLeft->IsEnabled()) //only handle if main window is in use + { + event.Skip(); + return; + } + class PreventRecursion + { + public: + PreventRecursion(bool& active) : active_(active) + { + active_ = true; + } + ~PreventRecursion() + { + active_ = false; + } + private: + bool& active_; + } dummy(processingGlobalKeyEvent); + //---------------------------------------------------- + + const int keyCode = event.GetKeyCode(); + //CTRL + X if (event.ControlDown()) switch (keyCode) { - case 'F': //CTRL + F - ffs3::startFind(*this, *m_gridLeft, *m_gridRight, globalSettings->gui.textSearchRespectCase); - return; //-> swallow event! + case 'F': //CTRL + F + { + ffs3::startFind(*this, *m_gridLeft, *m_gridRight, globalSettings->gui.textSearchRespectCase); + return; //-> swallow event! + } + break; } - else if (event.AltDown()) - ; - else - switch (keyCode) - { + + switch (keyCode) + { case WXK_F3: //F3 case WXK_NUMPAD_F3: // + { ffs3::findNext(*this, *m_gridLeft, *m_gridRight, globalSettings->gui.textSearchRespectCase); return; //-> swallow event! } + break; + + //redirect certain (unhandled) keys directly to grid! + case WXK_PAGEUP: + case WXK_PAGEDOWN: + case WXK_HOME: + case WXK_END: + case WXK_NUMPAD_UP: + case WXK_NUMPAD_DOWN: + case WXK_NUMPAD_LEFT: + case WXK_NUMPAD_RIGHT: + case WXK_NUMPAD_PAGEUP: + case WXK_NUMPAD_PAGEDOWN: + case WXK_NUMPAD_HOME: + case WXK_NUMPAD_END: + if (wxWindow::FindFocus() != m_directoryLeft && //don't propagate keyboard commands if currently changing directory field + wxWindow::FindFocus() != m_directoryRight) + { + m_gridLeft->SetFocus(); + m_gridLeft->GetEventHandler()->ProcessEvent(event); //propagating event catched at wxTheApp to child leads to recursion, but we prevented it... + event.Skip(false); //definitively handled now! + return; + } + break; + } event.Skip(); } @@ -1513,15 +1580,7 @@ struct SelectedExtension : public wxObject Zstring extension; }; -struct FilterObject -{ - FilterObject(const Zstring& relName, bool isDirectory) : - relativeName(relName), - isDir(isDirectory) {} - Zstring relativeName; - bool isDir; -}; -typedef std::vector<FilterObject> FilterObjList; +typedef std::vector<std::pair<Zstring, bool> > FilterObjList; //relative name |-> "is directory flag" struct FilterObjContainer : public wxObject { @@ -1555,13 +1614,16 @@ void MainDialog::OnContextRim(wxGridEvent& event) //------------------------------------------------------------------------------ - const std::set<size_t> selectionLeft = getSelectedRows(m_gridLeft); - const std::set<size_t> selectionRight = getSelectedRows(m_gridRight); + std::set<size_t> selection; + + { + const std::set<size_t> selectionLeft = getSelectedRows(m_gridLeft); + const std::set<size_t> selectionRight = getSelectedRows(m_gridRight); + selection.insert(selectionLeft .begin(), selectionLeft .end()); + selection.insert(selectionRight.begin(), selectionRight.end()); + } - const size_t selectionBegin = selectionLeft.size() + selectionRight.size() == 0 ? 0 : - selectionLeft.size() == 0 ? *selectionRight.begin() : - selectionRight.size() == 0 ? *selectionLeft.begin() : - std::min(*selectionLeft.begin(), *selectionRight.begin()); + const size_t selectionBegin = selection.size() == 0 ? 0 : *selection.begin(); const FileSystemObject* fsObj = gridDataView->getObject(selectionBegin); @@ -1572,30 +1634,30 @@ void MainDialog::OnContextRim(wxGridEvent& event) contextMenu.reset(new wxMenu); if (syncPreview->previewIsEnabled() && - fsObj && fsObj->getSyncOperation() != SO_EQUAL) + fsObj && fsObj->getSyncOperation() != SO_EQUAL) { - if (selectionLeft.size() + selectionRight.size() > 0) + if (selection.size() > 0) { //CONTEXT_SYNC_DIR_LEFT wxMenuItem* menuItemSyncDirLeft = new wxMenuItem(contextMenu.get(), ++contextItemID, wxString(_("Set direction:")) + - wxT(" ") + getSymbol(fsObj->testSyncOperation(true, SYNC_DIR_LEFT)) + - wxT("\tALT + LEFT")); //Linux needs a direction, "<-", because it has no context menu icons! + wxT(" ") + getSymbol(fsObj->testSyncOperation(true, SYNC_DIR_LEFT)) + + wxT("\tALT + LEFT")); //Linux needs a direction, "<-", because it has no context menu icons! menuItemSyncDirLeft->SetBitmap(getSyncOpImage(fsObj->testSyncOperation(true, SYNC_DIR_LEFT))); contextMenu->Append(menuItemSyncDirLeft); contextMenu->Connect(contextItemID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::OnContextSyncDirLeft), NULL, this); //CONTEXT_SYNC_DIR_NONE wxMenuItem* menuItemSyncDirNone = new wxMenuItem(contextMenu.get(), ++contextItemID, wxString(_("Set direction:")) + - wxT(" ") + getSymbol(fsObj->testSyncOperation(true, SYNC_DIR_NONE)) + - wxT("\tALT + UP")); + wxT(" ") + getSymbol(fsObj->testSyncOperation(true, SYNC_DIR_NONE)) + + wxT("\tALT + UP")); menuItemSyncDirNone->SetBitmap(getSyncOpImage(fsObj->testSyncOperation(true, SYNC_DIR_NONE))); contextMenu->Append(menuItemSyncDirNone); contextMenu->Connect(contextItemID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::OnContextSyncDirNone), NULL, this); //CONTEXT_SYNC_DIR_RIGHT wxMenuItem* menuItemSyncDirRight = new wxMenuItem(contextMenu.get(), ++contextItemID, wxString(_("Set direction:")) + - wxT(" ") + getSymbol(fsObj->testSyncOperation(true, SYNC_DIR_RIGHT)) + - wxT("\tALT + RIGHT")); + wxT(" ") + getSymbol(fsObj->testSyncOperation(true, SYNC_DIR_RIGHT)) + + wxT("\tALT + RIGHT")); menuItemSyncDirRight->SetBitmap(getSyncOpImage(fsObj->testSyncOperation(true, SYNC_DIR_RIGHT))); contextMenu->Append(menuItemSyncDirRight); contextMenu->Connect(contextItemID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::OnContextSyncDirRight), NULL, this); @@ -1606,18 +1668,18 @@ void MainDialog::OnContextRim(wxGridEvent& event) //CONTEXT_FILTER_TEMP - if (fsObj && (selectionLeft.size() + selectionRight.size() > 0)) + if (fsObj && (selection.size() > 0)) { if (fsObj->isActive()) { wxMenuItem* menuItemExclTemp = new wxMenuItem(contextMenu.get(), ++contextItemID, wxString(_("Exclude temporarily")) + wxT("\tSPACE")); - menuItemExclTemp->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("checkboxFalse"))); + menuItemExclTemp->SetBitmap(GlobalResources::instance().getImage(wxT("checkboxFalse"))); contextMenu->Append(menuItemExclTemp); } else { wxMenuItem* menuItemInclTemp = new wxMenuItem(contextMenu.get(), ++contextItemID, wxString(_("Include temporarily")) + wxT("\tSPACE")); - menuItemInclTemp->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("checkboxTrue"))); + menuItemInclTemp->SetBitmap(GlobalResources::instance().getImage(wxT("checkboxTrue"))); contextMenu->Append(menuItemInclTemp); } } @@ -1633,53 +1695,50 @@ void MainDialog::OnContextRim(wxGridEvent& event) //get list of relative file/dir-names for filtering FilterObjList exFilterCandidateObj; - class AddFilter : public FSObjectVisitor { - public: - AddFilter(FilterObjList& fl) : filterList_(fl) {} - virtual void visit(const FileMapping& fileObj) + class AddFilter : public FSObjectVisitor { - filterList_.push_back(FilterObject(fileObj.getObjRelativeName(), false)); - } - virtual void visit(const SymLinkMapping& linkObj) - { - filterList_.push_back(FilterObject(linkObj.getObjRelativeName(), false)); - } - virtual void visit(const DirMapping& dirObj) - { - filterList_.push_back(FilterObject(dirObj.getObjRelativeName(), true)); - } + public: + AddFilter(FilterObjList& fl) : filterList_(fl) {} - private: - FilterObjList& filterList_; - } newFilterEntry(exFilterCandidateObj); + virtual void visit(const FileMapping& fileObj) + { + filterList_.push_back(std::make_pair(fileObj.getObjRelativeName(), false)); + } + virtual void visit(const SymLinkMapping& linkObj) + { + filterList_.push_back(std::make_pair(linkObj.getObjRelativeName(), false)); + } + virtual void visit(const DirMapping& dirObj) + { + filterList_.push_back(std::make_pair(dirObj.getObjRelativeName(), true)); + } + private: + FilterObjList& filterList_; + } + newFilterEntry(exFilterCandidateObj); - for (std::set<size_t>::const_iterator i = selectionLeft.begin(); i != selectionLeft.end(); ++i) - { - const FileSystemObject* currObj = gridDataView->getObject(*i); - if (currObj && !currObj->isEmpty<LEFT_SIDE>()) - currObj->accept(newFilterEntry); - } - for (std::set<size_t>::const_iterator i = selectionRight.begin(); i != selectionRight.end(); ++i) - { - const FileSystemObject* currObj = gridDataView->getObject(*i); - if (currObj && !currObj->isEmpty<RIGHT_SIDE>()) - currObj->accept(newFilterEntry); + for (std::set<size_t>::const_iterator i = selection.begin(); i != selection.end(); ++i) + { + const FileSystemObject* currObj = gridDataView->getObject(*i); + if (currObj) + currObj->accept(newFilterEntry); + } } //############################################################################################### //CONTEXT_EXCLUDE_EXT - if (exFilterCandidateObj.size() > 0 && !exFilterCandidateObj[0].isDir) + if (exFilterCandidateObj.size() > 0 && !exFilterCandidateObj.begin()->second) //non empty && no directory { - const Zstring filename = exFilterCandidateObj[0].relativeName.AfterLast(common::FILE_NAME_SEPARATOR); + const Zstring filename = exFilterCandidateObj.begin()->first.AfterLast(common::FILE_NAME_SEPARATOR); if (filename.find(Zchar('.')) != Zstring::npos) //be careful: AfterLast would return the whole string if '.' were not found! { const Zstring extension = filename.AfterLast(Zchar('.')); //add context menu item wxMenuItem* menuItemExclExt = new wxMenuItem(contextMenu.get(), ++contextItemID, wxString(_("Exclude via filter:")) + wxT(" ") + wxT("*.") + zToWx(extension)); - menuItemExclExt->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("filterSmall"))); + menuItemExclExt->SetBitmap(GlobalResources::instance().getImage(wxT("filterSmall"))); contextMenu->Append(menuItemExclExt); //connect event @@ -1696,13 +1755,13 @@ void MainDialog::OnContextRim(wxGridEvent& event) ++contextItemID; wxMenuItem* menuItemExclObj = NULL; if (exFilterCandidateObj.size() == 1) - menuItemExclObj = new wxMenuItem(contextMenu.get(), contextItemID, wxString(_("Exclude via filter:")) + wxT(" ") + zToWx(exFilterCandidateObj[0].relativeName.AfterLast(common::FILE_NAME_SEPARATOR))); + menuItemExclObj = new wxMenuItem(contextMenu.get(), contextItemID, wxString(_("Exclude via filter:")) + wxT(" ") + zToWx(exFilterCandidateObj.begin()->first.AfterLast(common::FILE_NAME_SEPARATOR))); else if (exFilterCandidateObj.size() > 1) menuItemExclObj = new wxMenuItem(contextMenu.get(), contextItemID, wxString(_("Exclude via filter:")) + wxT(" ") + _("<multiple selection>")); if (menuItemExclObj != NULL) { - menuItemExclObj->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("filterSmall"))); + menuItemExclObj->SetBitmap(GlobalResources::instance().getImage(wxT("filterSmall"))); contextMenu->Append(menuItemExclObj); //connect event @@ -1720,11 +1779,11 @@ void MainDialog::OnContextRim(wxGridEvent& event) contextMenu->AppendSeparator(); const bool externalAppEnabled = (m_gridLeft->isLeadGrid() || m_gridRight->isLeadGrid()) && - (selectionLeft.size() + selectionRight.size() == 1); + selection.size() == 1; for (xmlAccess::ExternalApps::iterator i = globalSettings->gui.externelApplications.begin(); - i != globalSettings->gui.externelApplications.end(); - ++i) + i != globalSettings->gui.externelApplications.end(); + ++i) { //some trick to translate default external apps on the fly: 1. "open in explorer" 2. "start directly" wxString description = wxGetTranslation(i->first); @@ -1752,8 +1811,8 @@ void MainDialog::OnContextRim(wxGridEvent& event) //CONTEXT_CLIPBOARD contextMenu->Append(++contextItemID, _("Copy to clipboard\tCTRL+C")); - if ( (m_gridLeft->isLeadGrid() && selectionLeft.size()) || - (m_gridRight->isLeadGrid() && selectionRight.size())) + if (!selection.empty() && + (m_gridLeft->isLeadGrid() || m_gridRight->isLeadGrid())) contextMenu->Enable(contextItemID, true); else contextMenu->Enable(contextItemID, false); @@ -1763,7 +1822,7 @@ void MainDialog::OnContextRim(wxGridEvent& event) //CONTEXT_DELETE_FILES contextMenu->Append(++contextItemID, _("Delete files\tDEL")); - if (selectionLeft.size() + selectionRight.size() == 0) + if (selection.size() == 0) contextMenu->Enable(contextItemID, false); contextMenu->Connect(contextItemID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::OnContextDeleteFiles), NULL, this); @@ -1820,13 +1879,13 @@ void MainDialog::OnContextExcludeObject(wxCommandEvent& event) if (objCont->selectedObjects.size() > 0) //check needed to determine if filtering is needed { Zstring newExclude; - for (std::vector<FilterObject>::const_iterator i = objCont->selectedObjects.begin(); i != objCont->selectedObjects.end(); ++i) + for (FilterObjList::const_iterator i = objCont->selectedObjects.begin(); i != objCont->selectedObjects.end(); ++i) { if (i != objCont->selectedObjects.begin()) newExclude += Zstr("\n"); - newExclude += common::FILE_NAME_SEPARATOR + i->relativeName; - if (i->isDir) + newExclude += common::FILE_NAME_SEPARATOR + i->first; + if (i->second) //is directory newExclude += common::FILE_NAME_SEPARATOR; } @@ -2019,9 +2078,9 @@ void MainDialog::OnContextMiddleLabel(wxGridEvent& event) contextMenu->Connect(contextItemID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::OnContextComparisonView), NULL, this); if (syncPreview->previewIsEnabled()) - itemSyncPreview->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("syncViewSmall"))); + itemSyncPreview->SetBitmap(GlobalResources::instance().getImage(wxT("syncViewSmall"))); else - itemCmpResult->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("cmpViewSmall"))); + itemCmpResult->SetBitmap(GlobalResources::instance().getImage(wxT("cmpViewSmall"))); contextMenu->Append(itemCmpResult); contextMenu->Append(itemSyncPreview); @@ -2147,7 +2206,7 @@ void MainDialog::addFileToCfgHistory(const wxString& filename) for (int i = 0; i < static_cast<int>(m_listBoxHistory->GetCount()); ++i) if (m_listBoxHistory->GetClientObject(i)) { - const wxString& filenameTmp = static_cast<wxClientDataString*>(m_listBoxHistory->GetClientObject(i))->name_; + const wxString& filenameTmp = static_cast<wxClientDataString*>(m_listBoxHistory->GetClientObject(i))->name_; //tests if the same filenames are specified, even if they are relative to the current working directory/include symlinks or \\?\ prefix if (util::sameFileSpecified(wxToZ(filename), wxToZ(filenameTmp))) @@ -2206,18 +2265,18 @@ bool MainDialog::trySaveConfig() //return true if saved successfully defaultFileName.Replace(wxT(".ffs_batch"), wxT(".ffs_gui"), false); - wxFileDialog* filePicker = new wxFileDialog(this, wxEmptyString, wxEmptyString, defaultFileName, wxString(_("FreeFileSync configuration")) + wxT(" (*.ffs_gui)|*.ffs_gui"), wxFD_SAVE); - if (filePicker->ShowModal() == wxID_OK) + wxFileDialog filePicker(this, wxEmptyString, wxEmptyString, defaultFileName, wxString(_("FreeFileSync configuration")) + wxT(" (*.ffs_gui)|*.ffs_gui"), wxFD_SAVE); //creating this on freestore leads to memleak! + if (filePicker.ShowModal() == wxID_OK) { - const wxString newFileName = filePicker->GetPath(); + const wxString newFileName = filePicker.GetPath(); if (ffs3::fileExists(wxToZ(newFileName))) { - QuestionDlg* messageDlg = new QuestionDlg(this, - QuestionDlg::BUTTON_YES | QuestionDlg::BUTTON_CANCEL, - wxString(_("File already exists. Overwrite?")) + wxT(" \"") + newFileName + wxT("\"")); + QuestionDlg messageDlg(this, + QuestionDlg::BUTTON_YES | QuestionDlg::BUTTON_CANCEL, + wxString(_("File already exists. Overwrite?")) + wxT(" \"") + newFileName + wxT("\"")); - if (messageDlg->ShowModal() != QuestionDlg::BUTTON_YES) + if (messageDlg.ShowModal() != QuestionDlg::BUTTON_YES) return trySaveConfig(); //retry } @@ -2234,14 +2293,14 @@ bool MainDialog::trySaveConfig() //return true if saved successfully void MainDialog::OnLoadConfig(wxCommandEvent& event) { - wxFileDialog* filePicker = new wxFileDialog(this, - wxEmptyString, - wxEmptyString, - wxEmptyString, - wxString(_("FreeFileSync configuration")) + wxT(" (*.ffs_gui;*.ffs_batch)|*.ffs_gui;*.ffs_batch"), wxFD_OPEN); + wxFileDialog filePicker(this, + wxEmptyString, + wxEmptyString, + wxEmptyString, + wxString(_("FreeFileSync configuration")) + wxT(" (*.ffs_gui;*.ffs_batch)|*.ffs_gui;*.ffs_batch"), wxFD_OPEN); - if (filePicker->ShowModal() == wxID_OK) - loadConfiguration(filePicker->GetPath()); + if (filePicker.ShowModal() == wxID_OK) + loadConfiguration(filePicker.GetPath()); } @@ -2259,12 +2318,12 @@ void MainDialog::OnNewConfig(wxCommandEvent& event) void MainDialog::OnLoadFromHistory(wxCommandEvent& event) { - const int selectedItem = m_listBoxHistory->GetSelection(); - if ( selectedItem != wxNOT_FOUND && - m_listBoxHistory->GetClientObject(selectedItem)) + if (event.GetClientObject()) { - const wxString filename = static_cast<wxClientDataString*>(m_listBoxHistory->GetClientObject(selectedItem))->name_; + const wxString filename = static_cast<wxClientDataString*>(event.GetClientObject())->name_; loadConfiguration(filename); + + addFileToCfgHistory(currentConfigFileName); //in case user cancelled saving old config: restore selection to currently active config file } } @@ -2278,22 +2337,22 @@ bool MainDialog::saveOldConfig() //return false on user abort { bool dontShowAgain = !globalSettings->optDialogs.popupOnConfigChange; - QuestionDlg* notifyChangeDlg = new QuestionDlg(this, - QuestionDlg::BUTTON_YES | QuestionDlg::BUTTON_NO | QuestionDlg::BUTTON_CANCEL, - _("Save changes to current configuration?"), - &dontShowAgain); + QuestionDlg notifyChangeDlg(this, + QuestionDlg::BUTTON_YES | QuestionDlg::BUTTON_NO | QuestionDlg::BUTTON_CANCEL, + _("Save changes to current configuration?"), + &dontShowAgain); - switch (notifyChangeDlg->ShowModal()) + switch (notifyChangeDlg.ShowModal()) { - case QuestionDlg::BUTTON_YES: - if (!trySaveConfig()) + case QuestionDlg::BUTTON_YES: + if (!trySaveConfig()) + return false; + break; + case QuestionDlg::BUTTON_NO: + globalSettings->optDialogs.popupOnConfigChange = !dontShowAgain; + break; + case QuestionDlg::BUTTON_CANCEL: return false; - break; - case QuestionDlg::BUTTON_NO: - globalSettings->optDialogs.popupOnConfigChange = !dontShowAgain; - break; - case QuestionDlg::BUTTON_CANCEL: - return false; } } } @@ -2347,31 +2406,27 @@ void MainDialog::OnClose(wxCloseEvent& event) { if (m_buttonAbort->IsShown()) //delegate to "abort" button if available { - wxCommandEvent dummy(wxEVT_COMMAND_BUTTON_CLICKED); - m_buttonAbort->ProcessEvent(dummy); + wxCommandEvent dummy(wxEVT_COMMAND_BUTTON_CLICKED); //simulate button click + m_buttonAbort->GetEventHandler()->ProcessEvent(dummy); - if (event.CanVeto()) event.Veto(); //that's what we want here - else Destroy(); //shouldn't be necessary + if (event.CanVeto()) + { + event.Veto(); //that's what we want here + return; + } } - else + else //regular destruction handling { - const bool cancelled = !saveOldConfig(); //notify user about changed settings - if (cancelled && event.CanVeto()) + if (event.CanVeto()) { - event.Veto(); - return; + const bool cancelled = !saveOldConfig(); //notify user about changed settings + if (cancelled) + { + event.Veto(); + return; + } } - - Destroy(); } -} - - -void MainDialog::OnQuit(wxCommandEvent &event) -{ - if (!saveOldConfig()) //notify user about changed settings - return; - Destroy(); } @@ -2461,7 +2516,7 @@ void MainDialog::setLastUsedConfig(const wxString& filename, const xmlAccess::Xm } else { - SetTitle(wxString(wxT("FreeFileSync - ")) + filename); + SetTitle(filename); currentConfigFileName = filename; } @@ -2555,9 +2610,9 @@ xmlAccess::XmlGuiConfig MainDialog::getCurrentConfiguration() const //first folder pair guiCfg.mainCfg.firstPair = FolderPairEnh(firstFolderPair->getLeftDir(), - firstFolderPair->getRightDir(), - firstFolderPair->getAltSyncConfig(), - firstFolderPair->getAltFilterConfig()); + firstFolderPair->getRightDir(), + firstFolderPair->getAltSyncConfig(), + firstFolderPair->getAltFilterConfig()); //add additional pairs guiCfg.mainCfg.additionalPairs.clear(); @@ -2601,7 +2656,7 @@ void MainDialog::refreshGridAfterFilterChange(const int delay) } -void MainDialog::OnHideFilteredButton(wxCommandEvent &event) +void MainDialog::OnHideFilteredButton(wxCommandEvent& event) { //toggle showing filtered rows currentCfg.hideFilteredElements = !currentCfg.hideFilteredElements; @@ -2612,11 +2667,11 @@ void MainDialog::OnHideFilteredButton(wxCommandEvent &event) m_gridRight->ClearSelection(); updateGuiGrid(); -// event.Skip(); + // event.Skip(); } -void MainDialog::OnConfigureFilter(wxCommandEvent &event) +void MainDialog::OnConfigureFilter(wxCommandEvent& event) { if (showFilterDialog(true, //is main filter dialog currentCfg.mainCfg.globalFilter.includeFilter, @@ -2754,75 +2809,75 @@ void MainDialog::OnSyncDirNone(wxCommandEvent& event) void MainDialog::initViewFilterButtons() { //compare result buttons - m_bpButtonLeftOnly->init(GlobalResources::getInstance().getImageByName(wxT("leftOnlyAct")), + m_bpButtonLeftOnly->init(GlobalResources::instance().getImage(wxT("leftOnlyAct")), _("Hide files that exist on left side only"), - GlobalResources::getInstance().getImageByName(wxT("leftOnlyDeact")), + GlobalResources::instance().getImage(wxT("leftOnlyDeact")), _("Show files that exist on left side only")); - m_bpButtonRightOnly->init(GlobalResources::getInstance().getImageByName(wxT("rightOnlyAct")), + m_bpButtonRightOnly->init(GlobalResources::instance().getImage(wxT("rightOnlyAct")), _("Hide files that exist on right side only"), - GlobalResources::getInstance().getImageByName(wxT("rightOnlyDeact")), + GlobalResources::instance().getImage(wxT("rightOnlyDeact")), _("Show files that exist on right side only")); - m_bpButtonLeftNewer->init(GlobalResources::getInstance().getImageByName(wxT("leftNewerAct")), + m_bpButtonLeftNewer->init(GlobalResources::instance().getImage(wxT("leftNewerAct")), _("Hide files that are newer on left"), - GlobalResources::getInstance().getImageByName(wxT("leftNewerDeact")), + GlobalResources::instance().getImage(wxT("leftNewerDeact")), _("Show files that are newer on left")); - m_bpButtonRightNewer->init(GlobalResources::getInstance().getImageByName(wxT("rightNewerAct")), + m_bpButtonRightNewer->init(GlobalResources::instance().getImage(wxT("rightNewerAct")), _("Hide files that are newer on right"), - GlobalResources::getInstance().getImageByName(wxT("rightNewerDeact")), + GlobalResources::instance().getImage(wxT("rightNewerDeact")), _("Show files that are newer on right")); - m_bpButtonEqual->init(GlobalResources::getInstance().getImageByName(wxT("equalAct")), + m_bpButtonEqual->init(GlobalResources::instance().getImage(wxT("equalAct")), _("Hide files that are equal"), - GlobalResources::getInstance().getImageByName(wxT("equalDeact")), + GlobalResources::instance().getImage(wxT("equalDeact")), _("Show files that are equal")); - m_bpButtonDifferent->init(GlobalResources::getInstance().getImageByName(wxT("differentAct")), + m_bpButtonDifferent->init(GlobalResources::instance().getImage(wxT("differentAct")), _("Hide files that are different"), - GlobalResources::getInstance().getImageByName(wxT("differentDeact")), + GlobalResources::instance().getImage(wxT("differentDeact")), _("Show files that are different")); - m_bpButtonConflict->init(GlobalResources::getInstance().getImageByName(wxT("conflictAct")), + m_bpButtonConflict->init(GlobalResources::instance().getImage(wxT("conflictAct")), _("Hide conflicts"), - GlobalResources::getInstance().getImageByName(wxT("conflictDeact")), + GlobalResources::instance().getImage(wxT("conflictDeact")), _("Show conflicts")); //sync preview buttons - m_bpButtonSyncCreateLeft->init(GlobalResources::getInstance().getImageByName(wxT("syncCreateLeftAct")), + m_bpButtonSyncCreateLeft->init(GlobalResources::instance().getImage(wxT("syncCreateLeftAct")), _("Hide files that will be created on the left side"), - GlobalResources::getInstance().getImageByName(wxT("syncCreateLeftDeact")), + GlobalResources::instance().getImage(wxT("syncCreateLeftDeact")), _("Show files that will be created on the left side")); - m_bpButtonSyncCreateRight->init(GlobalResources::getInstance().getImageByName(wxT("syncCreateRightAct")), + m_bpButtonSyncCreateRight->init(GlobalResources::instance().getImage(wxT("syncCreateRightAct")), _("Hide files that will be created on the right side"), - GlobalResources::getInstance().getImageByName(wxT("syncCreateRightDeact")), + GlobalResources::instance().getImage(wxT("syncCreateRightDeact")), _("Show files that will be created on the right side")); - m_bpButtonSyncDeleteLeft->init(GlobalResources::getInstance().getImageByName(wxT("syncDeleteLeftAct")), + m_bpButtonSyncDeleteLeft->init(GlobalResources::instance().getImage(wxT("syncDeleteLeftAct")), _("Hide files that will be deleted on the left side"), - GlobalResources::getInstance().getImageByName(wxT("syncDeleteLeftDeact")), + GlobalResources::instance().getImage(wxT("syncDeleteLeftDeact")), _("Show files that will be deleted on the left side")); - m_bpButtonSyncDeleteRight->init(GlobalResources::getInstance().getImageByName(wxT("syncDeleteRightAct")), + m_bpButtonSyncDeleteRight->init(GlobalResources::instance().getImage(wxT("syncDeleteRightAct")), _("Hide files that will be deleted on the right side"), - GlobalResources::getInstance().getImageByName(wxT("syncDeleteRightDeact")), + GlobalResources::instance().getImage(wxT("syncDeleteRightDeact")), _("Show files that will be deleted on the right side")); - m_bpButtonSyncDirOverwLeft->init(GlobalResources::getInstance().getImageByName(wxT("syncDirLeftAct")), + m_bpButtonSyncDirOverwLeft->init(GlobalResources::instance().getImage(wxT("syncDirLeftAct")), _("Hide files that will be overwritten on left side"), - GlobalResources::getInstance().getImageByName(wxT("syncDirLeftDeact")), + GlobalResources::instance().getImage(wxT("syncDirLeftDeact")), _("Show files that will be overwritten on left side")); - m_bpButtonSyncDirOverwRight->init(GlobalResources::getInstance().getImageByName(wxT("syncDirRightAct")), + m_bpButtonSyncDirOverwRight->init(GlobalResources::instance().getImage(wxT("syncDirRightAct")), _("Hide files that will be overwritten on right side"), - GlobalResources::getInstance().getImageByName(wxT("syncDirRightDeact")), + GlobalResources::instance().getImage(wxT("syncDirRightDeact")), _("Show files that will be overwritten on right side")); - m_bpButtonSyncDirNone->init(GlobalResources::getInstance().getImageByName(wxT("syncDirNoneAct")), + m_bpButtonSyncDirNone->init(GlobalResources::instance().getImage(wxT("syncDirNoneAct")), _("Hide files that won't be copied"), - GlobalResources::getInstance().getImageByName(wxT("syncDirNoneDeact")), + GlobalResources::instance().getImage(wxT("syncDirNoneDeact")), _("Show files that won't be copied")); //compare result buttons @@ -2850,12 +2905,12 @@ void MainDialog::updateFilterButtons() //global filter: test for Null-filter if (isNullFilter(currentCfg.mainCfg.globalFilter)) { - m_bpButtonFilter->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("filterOff"))); + m_bpButtonFilter->SetBitmapLabel(GlobalResources::instance().getImage(wxT("filterOff"))); m_bpButtonFilter->SetToolTip(_("No filter selected")); } else { - m_bpButtonFilter->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("filterOn"))); + m_bpButtonFilter->SetBitmapLabel(GlobalResources::instance().getImage(wxT("filterOn"))); m_bpButtonFilter->SetToolTip(_("Filter is active")); } @@ -2871,7 +2926,7 @@ void MainDialog::updateFilterButtons() } -void MainDialog::OnCompare(wxCommandEvent &event) +void MainDialog::OnCompare(wxCommandEvent& event) { //PERF_START; clearStatusBar(); @@ -2880,7 +2935,7 @@ void MainDialog::OnCompare(wxCommandEvent &event) //prevent temporary memory peak by clearing old result list gridDataView->clearAllRows(); - updateGuiGrid(); //refresh GUI grid + //updateGuiGrid(); -> don't resize grid to keep scroll position! bool aborted = false; try @@ -2987,7 +3042,7 @@ void MainDialog::updateGuiGrid() m_gridRight->autoSizeColumns(); //update sync preview statistics - calculatePreview(); + updateStatistics(); auiMgr.Update(); //fix small display distortion, if view filter panel is empty @@ -2997,7 +3052,7 @@ void MainDialog::updateGuiGrid() } -void MainDialog::calculatePreview() +void MainDialog::updateStatistics() { //update preview of bytes to be transferred: const SyncStatistics st(gridDataView->getDataTentative()); @@ -3009,7 +3064,7 @@ void MainDialog::calculatePreview() m_textCtrlCreate->SetValue(toCreate); m_textCtrlUpdate->SetValue(toUpdate); m_textCtrlDelete->SetValue(toDelete); - m_textCtrlData->SetValue(data); + m_textCtrlData ->SetValue(data); } @@ -3022,14 +3077,14 @@ void MainDialog::OnSwitchView(wxCommandEvent& event) void MainDialog::OnSyncSettings(wxCommandEvent& event) { - SyncCfgDialog* syncDlg = new SyncCfgDialog(this, - currentCfg.mainCfg.compareVar, - currentCfg.mainCfg.syncConfiguration, - currentCfg.mainCfg.handleDeletion, - currentCfg.mainCfg.customDeletionDirectory, - ¤tCfg.ignoreErrors); - if (syncDlg->ShowModal() == SyncCfgDialog::BUTTON_APPLY) - updateSyncConfig(); + SyncCfgDialog syncDlg(this, + currentCfg.mainCfg.compareVar, + currentCfg.mainCfg.syncConfiguration, + currentCfg.mainCfg.handleDeletion, + currentCfg.mainCfg.customDeletionDirectory, + ¤tCfg.ignoreErrors); + if (syncDlg.ShowModal() == SyncCfgDialog::BUTTON_APPLY) + applySyncConfig(); } @@ -3045,9 +3100,9 @@ void MainDialog::OnCmpSettings(wxCommandEvent& event) if (ffs3::showCompareCfgDialog(windowPos, currentCfg.mainCfg.compareVar, currentCfg.mainCfg.handleSymlinks) == DefaultReturnCode::BUTTON_OKAY && - //check if settings were changed at all - (compareVarOld != currentCfg.mainCfg.compareVar || - handleSymlinksOld != currentCfg.mainCfg.handleSymlinks)) + //check if settings were changed at all + (compareVarOld != currentCfg.mainCfg.compareVar || + handleSymlinksOld != currentCfg.mainCfg.handleSymlinks)) { //update compare variant name m_staticTextCmpVariant->SetLabel(wxString(wxT("(")) + getVariantName(currentCfg.mainCfg.compareVar) + wxT(")")); @@ -3063,12 +3118,12 @@ void MainDialog::OnCmpSettings(wxCommandEvent& event) //convenience: change sync view switch (currentCfg.mainCfg.compareVar) { - case CMP_BY_TIME_SIZE: - syncPreview->enablePreview(true); - break; - case CMP_BY_CONTENT: - syncPreview->enablePreview(false); - break; + case CMP_BY_TIME_SIZE: + syncPreview->enablePreview(true); + break; + case CMP_BY_CONTENT: + syncPreview->enablePreview(false); + break; } m_buttonCompare->SetFocus(); @@ -3090,9 +3145,9 @@ void MainDialog::OnStartSync(wxCommandEvent& event) bool dontShowAgain = false; if (ffs3::showSyncPreviewDlg( - getCurrentConfiguration().mainCfg.getSyncVariantName(), - ffs3::SyncStatistics(gridDataView->getDataTentative()), - dontShowAgain) != DefaultReturnCode::BUTTON_OKAY) + getCurrentConfiguration().mainCfg.getSyncVariantName(), + ffs3::SyncStatistics(gridDataView->getDataTentative()), + dontShowAgain) != DefaultReturnCode::BUTTON_OKAY) return; globalSettings->optDialogs.showSummaryBeforeSync = !dontShowAgain; @@ -3108,10 +3163,6 @@ void MainDialog::OnStartSync(wxCommandEvent& event) //class handling status updates and error messages SyncStatusHandler statusHandler(this, currentCfg.ignoreErrors, ffs3::extractJobName(currentConfigFileName)); - //check if there are files/folders to be sync'ed at all - if (!synchronizationNeeded(gridDataView->getDataTentative())) - statusHandler.logInfo(_("Nothing to synchronize according to configuration!")); //inform about this special case - //start synchronization and mark all elements processed ffs3::SyncProcess synchronization( globalSettings->optDialogs, @@ -3162,7 +3213,7 @@ void MainDialog::OnRightGridDoubleClick(wxGridEvent& event) { if (!globalSettings->gui.externelApplications.empty()) openExternalApplication(event.GetRow(), false, globalSettings->gui.externelApplications[0].second); -// event.Skip(); + // event.Skip(); } @@ -3186,27 +3237,27 @@ void MainDialog::OnSortLeftGrid(wxGridEvent& event) const xmlAccess::ColumnTypes columnType = m_gridLeft->getTypeAtPos(currentSortColumn); switch (columnType) { - case xmlAccess::FULL_PATH: - st = GridView::SORT_BY_REL_NAME; - break; - case xmlAccess::FILENAME: - st = GridView::SORT_BY_FILENAME; - break; - case xmlAccess::REL_PATH: - st = GridView::SORT_BY_REL_NAME; - break; - case xmlAccess::DIRECTORY: - st = GridView::SORT_BY_DIRECTORY; - break; - case xmlAccess::SIZE: - st = GridView::SORT_BY_FILESIZE; - break; - case xmlAccess::DATE: - st = GridView::SORT_BY_DATE; - break; - case xmlAccess::EXTENSION: - st = GridView::SORT_BY_EXTENSION; - break; + case xmlAccess::FULL_PATH: + st = GridView::SORT_BY_REL_NAME; + break; + case xmlAccess::FILENAME: + st = GridView::SORT_BY_FILENAME; + break; + case xmlAccess::REL_PATH: + st = GridView::SORT_BY_REL_NAME; + break; + case xmlAccess::DIRECTORY: + st = GridView::SORT_BY_DIRECTORY; + break; + case xmlAccess::SIZE: + st = GridView::SORT_BY_FILESIZE; + break; + case xmlAccess::DATE: + st = GridView::SORT_BY_DATE; + break; + case xmlAccess::EXTENSION: + st = GridView::SORT_BY_EXTENSION; + break; } const bool sortAscending = sortDefault ? @@ -3230,27 +3281,27 @@ void MainDialog::OnSortMiddleGrid(wxGridEvent& event) //sorting middle grid is more or less useless: therefore let's toggle view instead! syncPreview->enablePreview(!syncPreview->previewIsEnabled()); //toggle view -// //determine direction for std::sort() -// static bool sortDefault = true; -// if (lastSortColumn != 0 || lastSortGrid != m_gridMiddle) -// sortDefault = true; -// else -// sortDefault = !sortDefault; -// lastSortColumn = 0; -// lastSortGrid = m_gridMiddle; -// -// //start sort -// if (syncPreview->previewIsEnabled()) -// gridDataView->sortView(GridView::SORT_BY_SYNC_DIRECTION, true, sortDefault); -// else -// gridDataView->sortView(GridView::SORT_BY_CMP_RESULT, true, sortDefault); -// -// updateGuiGrid(); //refresh gridDataView -// -// //set sort direction indicator on UI -// m_gridLeft->setSortMarker(CustomGrid::SortMarker(-1, CustomGrid::ASCENDING)); -// m_gridRight->setSortMarker(CustomGrid::SortMarker(-1, CustomGrid::ASCENDING)); -// m_gridMiddle->setSortMarker(CustomGrid::SortMarker(0, sortDefault ? CustomGrid::ASCENDING : CustomGrid::DESCENDING)); + // //determine direction for std::sort() + // static bool sortDefault = true; + // if (lastSortColumn != 0 || lastSortGrid != m_gridMiddle) + // sortDefault = true; + // else + // sortDefault = !sortDefault; + // lastSortColumn = 0; + // lastSortGrid = m_gridMiddle; + // + // //start sort + // if (syncPreview->previewIsEnabled()) + // gridDataView->sortView(GridView::SORT_BY_SYNC_DIRECTION, true, sortDefault); + // else + // gridDataView->sortView(GridView::SORT_BY_CMP_RESULT, true, sortDefault); + // + // updateGuiGrid(); //refresh gridDataView + // + // //set sort direction indicator on UI + // m_gridLeft->setSortMarker(CustomGrid::SortMarker(-1, CustomGrid::ASCENDING)); + // m_gridRight->setSortMarker(CustomGrid::SortMarker(-1, CustomGrid::ASCENDING)); + // m_gridMiddle->setSortMarker(CustomGrid::SortMarker(0, sortDefault ? CustomGrid::ASCENDING : CustomGrid::DESCENDING)); } @@ -3274,27 +3325,27 @@ void MainDialog::OnSortRightGrid(wxGridEvent& event) const xmlAccess::ColumnTypes columnType = m_gridRight->getTypeAtPos(currentSortColumn); switch (columnType) { - case xmlAccess::FULL_PATH: - st = GridView::SORT_BY_REL_NAME; - break; - case xmlAccess::FILENAME: - st = GridView::SORT_BY_FILENAME; - break; - case xmlAccess::REL_PATH: - st = GridView::SORT_BY_REL_NAME; - break; - case xmlAccess::DIRECTORY: - st = GridView::SORT_BY_DIRECTORY; - break; - case xmlAccess::SIZE: - st = GridView::SORT_BY_FILESIZE; - break; - case xmlAccess::DATE: - st = GridView::SORT_BY_DATE; - break; - case xmlAccess::EXTENSION: - st = GridView::SORT_BY_EXTENSION; - break; + case xmlAccess::FULL_PATH: + st = GridView::SORT_BY_REL_NAME; + break; + case xmlAccess::FILENAME: + st = GridView::SORT_BY_FILENAME; + break; + case xmlAccess::REL_PATH: + st = GridView::SORT_BY_REL_NAME; + break; + case xmlAccess::DIRECTORY: + st = GridView::SORT_BY_DIRECTORY; + break; + case xmlAccess::SIZE: + st = GridView::SORT_BY_FILESIZE; + break; + case xmlAccess::DATE: + st = GridView::SORT_BY_DATE; + break; + case xmlAccess::EXTENSION: + st = GridView::SORT_BY_EXTENSION; + break; } const bool sortAscending = sortDefault ? @@ -3389,15 +3440,15 @@ void MainDialog::updateGridViewData() if (syncPreview->previewIsEnabled()) { const GridView::StatusSyncPreview result = gridDataView->updateSyncPreview(currentCfg.hideFilteredElements, - m_bpButtonSyncCreateLeft-> isActive(), - m_bpButtonSyncCreateRight-> isActive(), - m_bpButtonSyncDeleteLeft-> isActive(), - m_bpButtonSyncDeleteRight-> isActive(), - m_bpButtonSyncDirOverwLeft-> isActive(), - m_bpButtonSyncDirOverwRight->isActive(), - m_bpButtonSyncDirNone-> isActive(), - m_bpButtonEqual-> isActive(), - m_bpButtonConflict-> isActive()); + m_bpButtonSyncCreateLeft-> isActive(), + m_bpButtonSyncCreateRight-> isActive(), + m_bpButtonSyncDeleteLeft-> isActive(), + m_bpButtonSyncDeleteRight-> isActive(), + m_bpButtonSyncDirOverwLeft-> isActive(), + m_bpButtonSyncDirOverwRight->isActive(), + m_bpButtonSyncDirNone-> isActive(), + m_bpButtonEqual-> isActive(), + m_bpButtonConflict-> isActive()); filesOnLeftView = result.filesOnLeftView; foldersOnLeftView = result.foldersOnLeftView; @@ -3418,15 +3469,15 @@ void MainDialog::updateGridViewData() m_bpButtonEqual-> Show(result.existsSyncEqual); m_bpButtonConflict-> Show(result.existsConflict); - if ( m_bpButtonSyncCreateLeft-> IsShown() || - m_bpButtonSyncCreateRight-> IsShown() || - m_bpButtonSyncDeleteLeft-> IsShown() || - m_bpButtonSyncDeleteRight-> IsShown() || - m_bpButtonSyncDirOverwLeft-> IsShown() || - m_bpButtonSyncDirOverwRight->IsShown() || - m_bpButtonSyncDirNone-> IsShown() || - m_bpButtonEqual-> IsShown() || - m_bpButtonConflict-> IsShown()) + if (m_bpButtonSyncCreateLeft-> IsShown() || + m_bpButtonSyncCreateRight-> IsShown() || + m_bpButtonSyncDeleteLeft-> IsShown() || + m_bpButtonSyncDeleteRight-> IsShown() || + m_bpButtonSyncDirOverwLeft-> IsShown() || + m_bpButtonSyncDirOverwRight->IsShown() || + m_bpButtonSyncDirNone-> IsShown() || + m_bpButtonEqual-> IsShown() || + m_bpButtonConflict-> IsShown()) { m_panelViewFilter->Show(); m_panelViewFilter->Layout(); @@ -3438,13 +3489,13 @@ void MainDialog::updateGridViewData() else { const GridView::StatusCmpResult result = gridDataView->updateCmpResult(currentCfg.hideFilteredElements, - m_bpButtonLeftOnly-> isActive(), - m_bpButtonRightOnly-> isActive(), - m_bpButtonLeftNewer-> isActive(), - m_bpButtonRightNewer->isActive(), - m_bpButtonDifferent-> isActive(), - m_bpButtonEqual-> isActive(), - m_bpButtonConflict-> isActive()); + m_bpButtonLeftOnly-> isActive(), + m_bpButtonRightOnly-> isActive(), + m_bpButtonLeftNewer-> isActive(), + m_bpButtonRightNewer->isActive(), + m_bpButtonDifferent-> isActive(), + m_bpButtonEqual-> isActive(), + m_bpButtonConflict-> isActive()); filesOnLeftView = result.filesOnLeftView; foldersOnLeftView = result.foldersOnLeftView; @@ -3462,13 +3513,13 @@ void MainDialog::updateGridViewData() m_bpButtonEqual-> Show(result.existsEqual); m_bpButtonConflict-> Show(result.existsConflict); - if ( m_bpButtonLeftOnly-> IsShown() || - m_bpButtonRightOnly-> IsShown() || - m_bpButtonLeftNewer-> IsShown() || - m_bpButtonRightNewer->IsShown() || - m_bpButtonDifferent-> IsShown() || - m_bpButtonEqual-> IsShown() || - m_bpButtonConflict-> IsShown()) + if (m_bpButtonLeftOnly-> IsShown() || + m_bpButtonRightOnly-> IsShown() || + m_bpButtonLeftNewer-> IsShown() || + m_bpButtonRightNewer->IsShown() || + m_bpButtonDifferent-> IsShown() || + m_bpButtonEqual-> IsShown() || + m_bpButtonConflict-> IsShown()) { m_panelViewFilter->Show(); m_panelViewFilter->Layout(); @@ -3484,10 +3535,10 @@ void MainDialog::updateGridViewData() wxString statusMiddleNew; wxString statusRightNew; -//################################################# -//format numbers to text: + //################################################# + //format numbers to text: -//show status information on "root" level. + //show status information on "root" level. if (foldersOnLeftView) { if (foldersOnLeftView == 1) @@ -3606,7 +3657,7 @@ void MainDialog::OnAddFolderPair(wxCommandEvent& event) //clear grids gridDataView->clearAllRows(); - updateSyncConfig(); //mainly to update sync dir description text + applySyncConfig(); //mainly to update sync dir description text } @@ -3617,7 +3668,7 @@ void MainDialog::updateFilterConfig() } -void MainDialog::updateSyncConfig() +void MainDialog::applySyncConfig() { //update sync variant name m_staticTextSyncVariant->SetLabel(wxString(wxT("(")) + getCurrentConfiguration().mainCfg.getSyncVariantName() + wxT(")")); @@ -3636,11 +3687,11 @@ void MainDialog::updateSyncConfig() if (warningSyncDatabase_) { bool dontWarnAgain = false; - WarningDlg* warningDlg = new WarningDlg(parent_, //show popup and ask user how to handle warning - WarningDlg::BUTTON_IGNORE, - text, - dontWarnAgain); - if (warningDlg->ShowModal() == WarningDlg::BUTTON_IGNORE) + WarningDlg warningDlg(parent_, //show popup and ask user how to handle warning + WarningDlg::BUTTON_IGNORE, + text, + dontWarnAgain); + if (warningDlg.ShowModal() == WarningDlg::BUTTON_IGNORE) warningSyncDatabase_ = !dontWarnAgain; } } @@ -3671,13 +3722,13 @@ void MainDialog::OnRemoveTopFolderPair(wxCommandEvent& event) removeAddFolderPair(0); //remove second folder pair (first of additional folder pairs) -//------------------------------------------------------------------ + //------------------------------------------------------------------ //disable the sync button syncPreview->enableSynchronization(false); //clear grids gridDataView->clearAllRows(); - updateSyncConfig(); //mainly to update sync dir description text + applySyncConfig(); //mainly to update sync dir description text } } @@ -3692,13 +3743,13 @@ void MainDialog::OnRemoveFolderPair(wxCommandEvent& event) { removeAddFolderPair(i - additionalFolderPairs.begin()); -//------------------------------------------------------------------ + //------------------------------------------------------------------ //disable the sync button syncPreview->enableSynchronization(false); //clear grids gridDataView->clearAllRows(); - updateSyncConfig(); //mainly to update sync dir description text + applySyncConfig(); //mainly to update sync dir description text return; } } @@ -3714,30 +3765,30 @@ void MainDialog::updateGuiForFolderPair() m_panelTopRight->Layout(); //adapt local filter and sync cfg for first folder pair - if ( additionalFolderPairs.size() == 0 && - firstFolderPair->getAltSyncConfig().get() == NULL && - NameFilter(firstFolderPair->getAltFilterConfig().includeFilter, - firstFolderPair->getAltFilterConfig().excludeFilter).isNull()) + if (additionalFolderPairs.size() == 0 && + firstFolderPair->getAltSyncConfig().get() == NULL && + NameFilter(firstFolderPair->getAltFilterConfig().includeFilter, + firstFolderPair->getAltFilterConfig().excludeFilter).isNull()) { m_bpButtonLocalFilter->Hide(); m_bpButtonAltSyncCfg->Hide(); - m_bpButtonSwapSides->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("swap"))); + m_bpButtonSwapSides->SetBitmapLabel(GlobalResources::instance().getImage(wxT("swap"))); } else { m_bpButtonLocalFilter->Show(); m_bpButtonAltSyncCfg->Show(); - m_bpButtonSwapSides->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("swapSlim"))); + m_bpButtonSwapSides->SetBitmapLabel(GlobalResources::instance().getImage(wxT("swapSlim"))); } m_panelTopMiddle->Layout(); - int addPairHeight = 0; - if (additionalFolderPairs.size() > 0) - addPairHeight = std::min<double>(1.5, additionalFolderPairs.size()) * //have 0.5 * height indicate that more folders are there - additionalFolderPairs[0]->GetSize().GetHeight(); + int addPairHeight = 0; + if (additionalFolderPairs.size() > 0) + addPairHeight = std::min<double>(1.5, additionalFolderPairs.size()) * //have 0.5 * height indicate that more folders are there + additionalFolderPairs[0]->GetSize().GetHeight(); //ensure additional folder pairs are at least partially visible auiMgr.GetPane(m_panelDirectoryPairs).MinSize(-1, m_panelTopLeft->GetSize().GetHeight() + addPairHeight); @@ -3756,7 +3807,6 @@ void MainDialog::addFolderPair(const std::vector<FolderPairEnh>& newPairs, bool if (!newPairs.empty()) { - int pairHeight = 0; for (std::vector<FolderPairEnh>::const_iterator i = newPairs.begin(); i != newPairs.end(); ++i) { //add new folder pair @@ -3778,9 +3828,6 @@ void MainDialog::addFolderPair(const std::vector<FolderPairEnh>& newPairs, bool additionalFolderPairs.push_back(newPair); } - //get size of scrolled window - pairHeight = newPair->GetSize().GetHeight(); - //register events newPair->m_bpButtonRemovePair->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MainDialog::OnRemoveFolderPair), NULL, this); @@ -3795,7 +3842,7 @@ void MainDialog::addFolderPair(const std::vector<FolderPairEnh>& newPairs, bool //m_scrolledWindowFolderPairs->SetMinSize(wxSize( -1, pairHeight * static_cast<int>(visiblePairs))); //update controls -// m_scrolledWindowFolderPairs->Fit(); //adjust scrolled window size + // m_scrolledWindowFolderPairs->Fit(); //adjust scrolled window size // m_scrolledWindowFolderPairs->Layout(); //adjust stuff inside scrolled window //bSizer1->Layout(); } @@ -3860,18 +3907,18 @@ void MainDialog::OnMenuExportFileList(wxCommandEvent& event) { //get a filename const wxString defaultFileName = wxT("FileList.csv"); //proposal - wxFileDialog* filePicker = new wxFileDialog(this, wxEmptyString, wxEmptyString, defaultFileName, wxString(_("Comma separated list")) + wxT(" (*.csv)|*.csv"), wxFD_SAVE); + wxFileDialog filePicker(this, wxEmptyString, wxEmptyString, defaultFileName, wxString(_("Comma separated list")) + wxT(" (*.csv)|*.csv"), wxFD_SAVE); //creating this on freestore leads to memleak! - if (filePicker->ShowModal() == wxID_OK) + if (filePicker.ShowModal() == wxID_OK) { - const wxString newFileName = filePicker->GetPath(); + const wxString newFileName = filePicker.GetPath(); if (ffs3::fileExists(wxToZ(newFileName))) { - QuestionDlg* messageDlg = new QuestionDlg(this, - QuestionDlg::BUTTON_YES | QuestionDlg::BUTTON_CANCEL, - wxString(_("File already exists. Overwrite?")) + wxT(" \"") + newFileName + wxT("\"")); + QuestionDlg messageDlg(this, + QuestionDlg::BUTTON_YES | QuestionDlg::BUTTON_CANCEL, + wxString(_("File already exists. Overwrite?")) + wxT(" \"") + newFileName + wxT("\"")); - if (messageDlg->ShowModal() != QuestionDlg::BUTTON_YES) + if (messageDlg.ShowModal() != QuestionDlg::BUTTON_YES) { OnMenuExportFileList(event); //retry return; @@ -3906,19 +3953,22 @@ void MainDialog::OnMenuExportFileList(wxCommandEvent& event) exportString += '\n'; //write header - for (int k = 0; k < m_gridLeft->GetNumberCols(); ++k) + const int colsLeft = m_gridLeft->GetNumberCols(); + for (int k = 0; k < colsLeft; ++k) { exportString += m_gridLeft->GetColLabelValue(k); exportString += ';'; } - for (int k = 0; k < m_gridMiddle->GetNumberCols(); ++k) + const int colsMiddle = m_gridMiddle->GetNumberCols(); + for (int k = 0; k < colsMiddle; ++k) { exportString += m_gridMiddle->GetColLabelValue(k); exportString += ';'; } - for (int k = 0; k < m_gridRight->GetNumberCols(); ++k) + const int colsRight = m_gridRight->GetNumberCols(); + for (int k = 0; k < colsRight; ++k) { exportString += m_gridRight->GetColLabelValue(k); if (k != m_gridRight->GetNumberCols() - 1) @@ -3927,27 +3977,28 @@ void MainDialog::OnMenuExportFileList(wxCommandEvent& event) exportString += '\n'; //begin work - for (int i = 0; i < m_gridLeft->GetNumberRows(); ++i) + const int rowsTotal = m_gridLeft->GetNumberRows(); + for (int i = 0; i < rowsTotal; ++i) { - for (int k = 0; k < m_gridLeft->GetNumberCols(); ++k) + for (int k = 0; k < colsLeft; ++k) { exportString += m_gridLeft->GetCellValue(i, k); exportString += ';'; } - for (int k = 0; k < m_gridMiddle->GetNumberCols(); ++k) + for (int k = 0; k < colsMiddle; ++k) { exportString += m_gridMiddle->GetCellValue(i, k); exportString += ';'; } - for (int k = 0; k < m_gridRight->GetNumberCols(); ++k) + for (int k = 0; k < colsRight; ++k) { exportString += m_gridRight->GetCellValue(i, k); - if (k != m_gridRight->GetNumberCols() - 1) - exportString+= ';'; + if (k != colsRight - 1) + exportString += ';'; } - exportString+= '\n'; + exportString += '\n'; } //write export file @@ -3973,8 +4024,8 @@ void MainDialog::OnMenuBatchJob(wxCommandEvent& event) const xmlAccess::XmlBatchConfig batchCfg = convertGuiToBatch(currCfg); - BatchDialog* batchDlg = new BatchDialog(this, batchCfg); - if (batchDlg->ShowModal() == BatchDialog::BATCH_FILE_SAVED) + BatchDialog batchDlg(this, batchCfg); + if (batchDlg.ShowModal() == BatchDialog::BATCH_FILE_SAVED) pushStatusInformation(_("Batch file created successfully!")); } @@ -4025,10 +4076,7 @@ void MainDialog::OnShowHelp(wxCommandEvent& event) void MainDialog::OnMenuQuit(wxCommandEvent& event) { - if (!saveOldConfig()) //notify user about changed settings - return; - - Destroy(); + Close(); } //######################################################################################################### @@ -4104,13 +4152,13 @@ void MainDialog::SyncPreview::enableSynchronization(bool value) { synchronizationEnabled = true; mainDlg_->m_buttonStartSync->SetForegroundColour(*wxBLACK); - mainDlg_->m_buttonStartSync->setBitmapFront(GlobalResources::getInstance().getImageByName(wxT("sync"))); + mainDlg_->m_buttonStartSync->setBitmapFront(GlobalResources::instance().getImage(wxT("sync"))); } else { synchronizationEnabled = false; mainDlg_->m_buttonStartSync->SetForegroundColour(wxColor(128, 128, 128)); //Some colors seem to have problems with 16Bit color depth, well this one hasn't! - mainDlg_->m_buttonStartSync->setBitmapFront(GlobalResources::getInstance().getImageByName(wxT("syncDisabled"))); + mainDlg_->m_buttonStartSync->setBitmapFront(GlobalResources::instance().getImage(wxT("syncDisabled"))); } } diff --git a/ui/main_dlg.h b/ui/main_dlg.h index 3559aff8..ca466240 100644 --- a/ui/main_dlg.h +++ b/ui/main_dlg.h @@ -23,6 +23,7 @@ class IconUpdater; class DirectoryPair; class DirectoryPairFirst; class CompareStatus; +class SyncStatusHandler; class PanelMoveWindow; @@ -47,6 +48,7 @@ public: private: friend class CompareStatusHandler; + friend class SyncStatusHandler; friend class ManualDeletionHandler; friend class DirectoryPairFirst; friend class DirectoryNameMainImpl; @@ -205,19 +207,18 @@ private: void OnCmpSettings( wxCommandEvent& event); void OnStartSync( wxCommandEvent& event); void OnClose( wxCloseEvent& event); - void OnQuit( wxCommandEvent& event); void OnGlobalFilterOpenContext(wxCommandEvent& event); void OnGlobalFilterRemConfirm(wxCommandEvent& event); - void calculatePreview(); + void updateStatistics(); void OnAddFolderPair( wxCommandEvent& event); void OnRemoveFolderPair( wxCommandEvent& event); void OnRemoveTopFolderPair( wxCommandEvent& event); void updateFilterConfig(); - void updateSyncConfig(); + void applySyncConfig(); //menu events void OnMenuGlobalSettings( wxCommandEvent& event); @@ -235,7 +236,7 @@ private: typedef int LanguageID; std::map<MenuItemID, LanguageID> languageMenuItemMap; //needed to attach menu item events -//*********************************************** + //*********************************************** //application variables are stored here: //global settings used by GUI and batch mode @@ -244,7 +245,7 @@ private: //UI view of FolderComparison structure std::auto_ptr<ffs3::GridView> gridDataView; -//------------------------------------- + //------------------------------------- //functional configuration xmlAccess::XmlGuiConfig currentCfg; @@ -257,10 +258,10 @@ private: int heightNotMaximized; int posXNotMaximized; int posYNotMaximized; -//------------------------------------- + //------------------------------------- -//*********************************************** + //*********************************************** std::auto_ptr<wxMenu> contextMenu; //status information @@ -279,6 +280,8 @@ private: //update icons periodically: one updater instance for both left and right grids std::auto_ptr<IconUpdater> updateFileIcons; + bool processingGlobalKeyEvent; //indicator to notify recursion in OnGlobalKeyEvent() + //encapsulation of handling of sync preview class SyncPreview //encapsulates MainDialog functionality for synchronization preview (friend class) { diff --git a/ui/msg_popup.cpp b/ui/msg_popup.cpp index 0b6d3584..3dff49d2 100644 --- a/ui/msg_popup.cpp +++ b/ui/msg_popup.cpp @@ -6,7 +6,7 @@ // #include "msg_popup.h" #include "../library/resources.h" -#include "mouse_move_dlg.h" +#include "../shared/mouse_move_dlg.h" ErrorDlg::ErrorDlg(wxWindow* parentWindow, const int activeButtons, const wxString messageText, bool& ignoreNextErrors) : @@ -18,7 +18,7 @@ ErrorDlg::ErrorDlg(wxWindow* parentWindow, const int activeButtons, const wxStri this, m_bitmap10); //ownership passed to "this" #endif - m_bitmap10->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("error"))); + m_bitmap10->SetBitmap(GlobalResources::instance().getImage(wxT("error"))); m_textCtrl8->SetValue(messageText); m_checkBoxIgnoreErrors->SetValue(ignoreNextErrors); @@ -82,7 +82,7 @@ WarningDlg::WarningDlg(wxWindow* parentWindow, int activeButtons, const wxStrin this, m_bitmap10); //ownership passed to "this" #endif - m_bitmap10->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("warning"))); + m_bitmap10->SetBitmap(GlobalResources::instance().getImage(wxT("warning"))); m_textCtrl8->SetValue(messageText); m_checkBoxDontShowAgain->SetValue(dontShowAgain); @@ -144,7 +144,7 @@ QuestionDlg::QuestionDlg(wxWindow* parentWindow, int activeButtons, const wxStri this, m_bitmap10); //ownership passed to "this" #endif - m_bitmap10->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("question"))); + m_bitmap10->SetBitmap(GlobalResources::instance().getImage(wxT("question"))); m_textCtrl8->SetValue(messageText); if (dontShowAgain) m_checkBoxDontAskAgain->SetValue(*dontShowAgain); diff --git a/ui/progress_indicator.cpp b/ui/progress_indicator.cpp index 541e2694..7431a4c1 100644 --- a/ui/progress_indicator.cpp +++ b/ui/progress_indicator.cpp @@ -16,7 +16,9 @@ #include "../shared/global_func.h" #include "tray_icon.h" #include <boost/shared_ptr.hpp> -#include "mouse_move_dlg.h" +#include "../shared/mouse_move_dlg.h" +#include "../library/error_log.h" +#include "../shared/toggle_button.h" #ifdef FFS_WIN #include "../shared/taskbar.h" @@ -293,13 +295,13 @@ void CompareStatus::CompareStatusImpl::showProgressExternally(const wxString& pr const size_t total = 100000; switch (status) { - case SCANNING: - taskbar_->setStatus(TaskbarProgress::STATUS_INDETERMINATE); - break; - case COMPARING_CONTENT: - taskbar_->setStatus(TaskbarProgress::STATUS_NORMAL); - taskbar_->setProgress(current, total); - break; + case SCANNING: + taskbar_->setStatus(TaskbarProgress::STATUS_INDETERMINATE); + break; + case COMPARING_CONTENT: + taskbar_->setStatus(TaskbarProgress::STATUS_NORMAL); + taskbar_->setProgress(current, total); + break; } } #endif @@ -318,12 +320,12 @@ void CompareStatus::CompareStatusImpl::updateStatusPanelNow() //write status information to taskbar, parent title ect. switch (status) { - case SCANNING: - showProgressExternally(numberToStringSep(scannedObjects) + wxT(" - ") + _("Scanning...")); - break; - case COMPARING_CONTENT: - showProgressExternally(formatPercentage(currentData, totalData) + wxT(" - ") + _("Comparing content..."), percent); - break; + case SCANNING: + showProgressExternally(numberToStringSep(scannedObjects) + wxT(" - ") + _("Scanning...")); + break; + case COMPARING_CONTENT: + showProgressExternally(formatPercentage(currentData, totalData) + wxT(" - ") + _("Comparing content..."), percent); + break; } @@ -386,6 +388,98 @@ void CompareStatus::CompareStatusImpl::updateStatusPanelNow() //######################################################################################## +class LogControl : public LogControlGenerated +{ +public: + LogControl(wxWindow* parent, const ErrorLogging& log) : LogControlGenerated(parent), log_(log) + { + const int errorCount = log_.typeCount(TYPE_ERROR) + log_.typeCount(TYPE_FATAL_ERROR); + const int warningCount = log_.typeCount(TYPE_WARNING); + const int infoCount = log_.typeCount(TYPE_INFO); + + m_bpButtonErrors->init(GlobalResources::instance().getImage(wxT("log error")), _("Error") + wxString::Format(wxT(" (%d)"), errorCount), + GlobalResources::instance().getImage(wxT("log error inactive")), _("Error") + wxString::Format(wxT(" (%d)"), errorCount)); + + m_bpButtonWarnings->init(GlobalResources::instance().getImage(wxT("log warning")), _("Warning") + wxString::Format(wxT(" (%d)"), warningCount), + GlobalResources::instance().getImage(wxT("log warning inactive")), _("Warning") + wxString::Format(wxT(" (%d)"), warningCount)); + + m_bpButtonInfo->init(GlobalResources::instance().getImage(wxT("log info")), _("Info") + wxString::Format(wxT(" (%d)"), infoCount), + GlobalResources::instance().getImage(wxT("log info inactive")), _("Info") + wxString::Format(wxT(" (%d)"), infoCount)); + + m_bpButtonErrors ->setActive(true); + m_bpButtonWarnings->setActive(true); + m_bpButtonInfo ->setActive(false); + + m_bpButtonErrors ->Show(errorCount != 0); + m_bpButtonWarnings->Show(warningCount != 0); + m_bpButtonInfo ->Show(infoCount != 0); + + updateLogText(); + } + + virtual void OnErrors(wxCommandEvent& event) + { + m_bpButtonErrors->toggle(); + updateLogText(); + } + + virtual void OnWarnings(wxCommandEvent& event) + { + m_bpButtonWarnings->toggle(); + updateLogText(); + } + + virtual void OnInfo(wxCommandEvent& event) + { + m_bpButtonInfo->toggle(); + updateLogText(); + } + +private: + void updateLogText() + { + int includedTypes = 0; + if (m_bpButtonErrors->isActive()) + includedTypes |= TYPE_ERROR | TYPE_FATAL_ERROR; + + if (m_bpButtonWarnings->isActive()) + includedTypes |= TYPE_WARNING; + + if (m_bpButtonInfo->isActive()) + includedTypes |= TYPE_INFO; + + const std::vector<wxString>& messages = log_.getFormattedMessages(includedTypes); + + wxString newLogText; + + if (!messages.empty()) + for (std::vector<wxString>::const_iterator i = messages.begin(); i != messages.end(); ++i) + { + newLogText += *i; + newLogText += wxT("\n\n"); + } + else //if no messages match selected view filter, show final status message at least + { + const std::vector<wxString>& allMessages = log_.getFormattedMessages(); + if (!allMessages.empty()) + newLogText = allMessages.back(); + } + +#ifndef _MSC_VER +#warning design okay? +#endif + + wxWindowUpdateLocker dummy(m_textCtrlInfo); + m_textCtrlInfo->ChangeValue(newLogText); + m_textCtrlInfo->ShowPosition(m_textCtrlInfo->GetLastPosition()); + } + + const ErrorLogging log_; +}; + + +//######################################################################################## + class SyncStatus::SyncStatusImpl : public SyncStatusDlgGenerated { public: @@ -399,7 +493,7 @@ public: void updateStatusDialogNow(); void setCurrentStatus(SyncStatus::SyncStatusID id); - void processHasFinished(SyncStatus::SyncStatusID id, const wxString& finalMessage); //essential to call this in StatusUpdater derived class destructor at the LATEST(!) to prevent access to currentStatusUpdater + void processHasFinished(SyncStatus::SyncStatusID id, const ErrorLogging& log); //essential to call this in StatusUpdater derived class destructor at the LATEST(!) to prevent access to currentStatusUpdater void minimizeToTray(); @@ -512,9 +606,9 @@ void SyncStatus::setCurrentStatus(SyncStatusID id) pimpl->setCurrentStatus(id); } -void SyncStatus::processHasFinished(SyncStatusID id, const wxString& finalMessage) +void SyncStatus::processHasFinished(SyncStatusID id, const ErrorLogging& log) { - pimpl->processHasFinished(id, finalMessage); + pimpl->processHasFinished(id, log); } //######################################################################################## @@ -550,7 +644,7 @@ SyncStatus::SyncStatusImpl::SyncStatusImpl(StatusHandler& updater, wxTopLevelWin if (mainDialog) //save old title (will be used as progress indicator) titelTextBackup = mainDialog->GetTitle(); - m_animationControl1->SetAnimation(*GlobalResources::getInstance().animationSync); + m_animationControl1->SetAnimation(*GlobalResources::instance().animationSync); m_animationControl1->Play(); m_staticTextSpeed->SetLabel(wxT("-")); @@ -563,7 +657,7 @@ SyncStatus::SyncStatusImpl::SyncStatusImpl(StatusHandler& updater, wxTopLevelWin if (IsShown()) //don't steal focus when starting in sys-tray! m_buttonAbort->SetFocus(); - if (mainDialog) //disable (main) window while this status dialog is shown + if (mainDialog) mainDialog->Disable(); timeElapsed.Start(); //measure total time @@ -580,7 +674,7 @@ SyncStatus::SyncStatusImpl::SyncStatusImpl(StatusHandler& updater, wxTopLevelWin bSizerObjectsProcessed->Show(false); //bSizerDataProcessed->Show(false); - SetIcon(*GlobalResources::getInstance().programIcon); //set application icon + SetIcon(*GlobalResources::instance().programIcon); //set application icon //register key event Connect(wxEVT_CHAR_HOOK, wxKeyEventHandler(SyncStatusImpl::OnKeyPressed), NULL, this); @@ -665,16 +759,18 @@ void SyncStatus::SyncStatusImpl::showProgressExternally(const wxString& progress progressTextLast = progressText; progressPercentLast = percent; + wxString progressTextFmt = progressText; + progressTextFmt.Replace(wxT("\n"), wxT(" - ")); if (mainDialog) //show percentage in maindialog title (and thereby in taskbar) { - if (mainDialog->GetTitle() != progressText) - mainDialog->SetTitle(progressText); + if (mainDialog->GetTitle() != progressTextFmt) + mainDialog->SetTitle(progressTextFmt); } else //show percentage in this dialog's title (and thereby in taskbar) { - if (this->GetTitle() != progressText) - this->SetTitle(progressText); + if (this->GetTitle() != progressTextFmt) + this->SetTitle(progressTextFmt); } #ifdef FFS_WIN @@ -688,24 +784,24 @@ void SyncStatus::SyncStatusImpl::showProgressExternally(const wxString& progress switch (currentStatus) { - case SyncStatus::SCANNING: - taskbar_->setStatus(TaskbarProgress::STATUS_INDETERMINATE); - break; - case SyncStatus::FINISHED_WITH_SUCCESS: - case SyncStatus::COMPARING_CONTENT: - case SyncStatus::SYNCHRONIZING: - taskbar_->setStatus(TaskbarProgress::STATUS_NORMAL); - taskbar_->setProgress(current, total); - break; - case SyncStatus::PAUSE: - taskbar_->setStatus(TaskbarProgress::STATUS_PAUSED); - taskbar_->setProgress(current, total); - break; - case SyncStatus::ABORTED: - case SyncStatus::FINISHED_WITH_ERROR: - taskbar_->setStatus(TaskbarProgress::STATUS_ERROR); - taskbar_->setProgress(current, total); - break; + case SyncStatus::SCANNING: + taskbar_->setStatus(TaskbarProgress::STATUS_INDETERMINATE); + break; + case SyncStatus::FINISHED_WITH_SUCCESS: + case SyncStatus::COMPARING_CONTENT: + case SyncStatus::SYNCHRONIZING: + taskbar_->setStatus(TaskbarProgress::STATUS_NORMAL); + taskbar_->setProgress(current, total); + break; + case SyncStatus::PAUSE: + taskbar_->setStatus(TaskbarProgress::STATUS_PAUSED); + taskbar_->setProgress(current, total); + break; + case SyncStatus::ABORTED: + case SyncStatus::FINISHED_WITH_ERROR: + taskbar_->setStatus(TaskbarProgress::STATUS_ERROR); + taskbar_->setProgress(current, total); + break; } } #endif @@ -724,25 +820,25 @@ void SyncStatus::SyncStatusImpl::updateStatusDialogNow() const wxString postFix = jobName_.empty() ? wxString() : (wxT("\n\"") + jobName_ + wxT("\"")); switch (currentStatus) { - case SyncStatus::SCANNING: - showProgressExternally(numberToStringSep(scannedObjects) + wxT(" - ") + _("Scanning...") + postFix); - break; - case SyncStatus::COMPARING_CONTENT: - showProgressExternally(formatPercentage(currentData, totalData) + wxT(" - ") + _("Comparing content...") + postFix, percent); - break; - case SyncStatus::SYNCHRONIZING: - showProgressExternally(formatPercentage(currentData, totalData) + wxT(" - ") + _("Synchronizing...") + postFix, percent); - break; - case SyncStatus::PAUSE: - showProgressExternally((totalData != 0 ? formatPercentage(currentData, totalData) + wxT(" - ") : wxString()) + _("Paused") + postFix, percent); - break; - case SyncStatus::ABORTED: - showProgressExternally(_("Aborted") + postFix, percent); - break; - case SyncStatus::FINISHED_WITH_SUCCESS: - case SyncStatus::FINISHED_WITH_ERROR: - showProgressExternally(_("Completed") + postFix, percent); - break; + case SyncStatus::SCANNING: + showProgressExternally(numberToStringSep(scannedObjects) + wxT(" - ") + _("Scanning...") + postFix); + break; + case SyncStatus::COMPARING_CONTENT: + showProgressExternally(formatPercentage(currentData, totalData) + wxT(" - ") + _("Comparing content...") + postFix, percent); + break; + case SyncStatus::SYNCHRONIZING: + showProgressExternally(formatPercentage(currentData, totalData) + wxT(" - ") + _("Synchronizing...") + postFix, percent); + break; + case SyncStatus::PAUSE: + showProgressExternally((totalData != 0 ? formatPercentage(currentData, totalData) + wxT(" - ") : wxString()) + _("Paused") + postFix, percent); + break; + case SyncStatus::ABORTED: + showProgressExternally(_("Aborted") + postFix, percent); + break; + case SyncStatus::FINISHED_WITH_SUCCESS: + case SyncStatus::FINISHED_WITH_ERROR: + showProgressExternally(_("Completed") + postFix, percent); + break; } //write regular status information (whether dialog is visible or not) @@ -836,40 +932,40 @@ void SyncStatus::SyncStatusImpl::setCurrentStatus(SyncStatus::SyncStatusID id) { switch (id) { - case SyncStatus::ABORTED: - m_bitmapStatus->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("statusError"))); - m_staticTextStatus->SetLabel(_("Aborted")); - break; - - case SyncStatus::FINISHED_WITH_SUCCESS: - m_bitmapStatus->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("statusSuccess"))); - m_staticTextStatus->SetLabel(_("Completed")); - break; - - case SyncStatus::FINISHED_WITH_ERROR: - m_bitmapStatus->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("statusWarning"))); - m_staticTextStatus->SetLabel(_("Completed")); - break; - - case SyncStatus::PAUSE: - m_bitmapStatus->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("statusPause"))); - m_staticTextStatus->SetLabel(_("Paused")); - break; - - case SyncStatus::SCANNING: - m_bitmapStatus->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("statusScanning"))); - m_staticTextStatus->SetLabel(_("Scanning...")); - break; - - case SyncStatus::COMPARING_CONTENT: - m_bitmapStatus->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("statusBinaryCompare"))); - m_staticTextStatus->SetLabel(_("Comparing content...")); - break; - - case SyncStatus::SYNCHRONIZING: - m_bitmapStatus->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("statusSyncing"))); - m_staticTextStatus->SetLabel(_("Synchronizing...")); - break; + case SyncStatus::ABORTED: + m_bitmapStatus->SetBitmap(GlobalResources::instance().getImage(wxT("statusError"))); + m_staticTextStatus->SetLabel(_("Aborted")); + break; + + case SyncStatus::FINISHED_WITH_SUCCESS: + m_bitmapStatus->SetBitmap(GlobalResources::instance().getImage(wxT("statusSuccess"))); + m_staticTextStatus->SetLabel(_("Completed")); + break; + + case SyncStatus::FINISHED_WITH_ERROR: + m_bitmapStatus->SetBitmap(GlobalResources::instance().getImage(wxT("statusWarning"))); + m_staticTextStatus->SetLabel(_("Completed")); + break; + + case SyncStatus::PAUSE: + m_bitmapStatus->SetBitmap(GlobalResources::instance().getImage(wxT("statusPause"))); + m_staticTextStatus->SetLabel(_("Paused")); + break; + + case SyncStatus::SCANNING: + m_bitmapStatus->SetBitmap(GlobalResources::instance().getImage(wxT("statusScanning"))); + m_staticTextStatus->SetLabel(_("Scanning...")); + break; + + case SyncStatus::COMPARING_CONTENT: + m_bitmapStatus->SetBitmap(GlobalResources::instance().getImage(wxT("statusBinaryCompare"))); + m_staticTextStatus->SetLabel(_("Comparing content...")); + break; + + case SyncStatus::SYNCHRONIZING: + m_bitmapStatus->SetBitmap(GlobalResources::instance().getImage(wxT("statusSyncing"))); + m_staticTextStatus->SetLabel(_("Synchronizing...")); + break; } currentStatus = id; @@ -877,7 +973,7 @@ void SyncStatus::SyncStatusImpl::setCurrentStatus(SyncStatus::SyncStatusID id) } -void SyncStatus::SyncStatusImpl::processHasFinished(SyncStatus::SyncStatusID id, const wxString& finalMessage) //essential to call this in StatusHandler derived class destructor +void SyncStatus::SyncStatusImpl::processHasFinished(SyncStatus::SyncStatusID id, const ErrorLogging& log) //essential to call this in StatusHandler derived class destructor { //at the LATEST(!) to prevent access to currentStatusHandler //enable okay and close events; may be set in this method ONLY @@ -906,8 +1002,8 @@ void SyncStatus::SyncStatusImpl::processHasFinished(SyncStatus::SyncStatusID id, bSizerRemTime->Show(false); //if everything was processed successfully, hide remaining statistics (is 0 anyway) - if ( totalObjects == currentObjects && - totalData == currentData) + if (totalObjects == currentObjects && + totalData == currentData) { bSizerObjectsRemaining->Show(false); @@ -918,7 +1014,12 @@ void SyncStatus::SyncStatusImpl::processHasFinished(SyncStatus::SyncStatusID id, } updateStatusDialogNow(); //keep this sequence to avoid display distortion, if e.g. only 1 item is sync'ed - m_textCtrlInfo->SetValue(finalMessage); // + + //hide progress text control and show log control instead + m_textCtrlInfo->Hide(); + LogControl* logControl = new LogControl(this, log); + bSizerProgressText->Add(logControl, 3, wxEXPAND | wxALL, 5); + Layout(); // //Raise(); -> don't! user may be watching a movie in the meantime ;) @@ -984,13 +1085,16 @@ void SyncStatus::SyncStatusImpl::OnClose(wxCloseEvent& event) if (m_buttonAbort->IsShown()) //delegate to "abort" button if available { wxCommandEvent dummy(wxEVT_COMMAND_BUTTON_CLICKED); - m_buttonAbort->ProcessEvent(dummy); + m_buttonAbort->GetEventHandler()->ProcessEvent(dummy); - if (event.CanVeto()) event.Veto(); //that's what we want here - else Destroy(); //shouldn't be necessary + if (event.CanVeto()) + { + event.Veto(); //that's what we want here + return; + } } - else - Destroy(); + + Destroy(); } diff --git a/ui/progress_indicator.h b/ui/progress_indicator.h index 9e139ae5..4bf0c048 100644 --- a/ui/progress_indicator.h +++ b/ui/progress_indicator.h @@ -11,6 +11,11 @@ #include <wx/toplevel.h> #include "../library/status_handler.h" +namespace ffs3 +{ +class ErrorLogging; +} + class CompareStatus { @@ -67,7 +72,7 @@ public: //essential to call one of these two methods in StatusUpdater derived class destructor at the LATEST(!) //to prevent access to callback to updater (e.g. request abort) - void processHasFinished(SyncStatusID id, const wxString& finalMessage); + void processHasFinished(SyncStatusID id, const ffs3::ErrorLogging& log); void closeWindowDirectly(); //don't wait for user private: diff --git a/ui/search.cpp b/ui/search.cpp index d27e3009..e6fa4255 100644 --- a/ui/search.cpp +++ b/ui/search.cpp @@ -9,7 +9,7 @@ #include <wx/msgdlg.h> #include <wx/utils.h> #include <utility> -#include "mouse_move_dlg.h" +#include "../shared/mouse_move_dlg.h" class SearchDlg : public SearchDialogGenerated @@ -143,10 +143,10 @@ std::pair<int, int> searchGrid(const wxGrid& grid, int cursorRow = const_cast<wxGrid&>(grid).GetGridCursorRow(); int cursorColumn = const_cast<wxGrid&>(grid).GetGridCursorCol(); - if ( cursorRow < 0 || - cursorRow >= rowCount || - cursorColumn < 0 || - cursorColumn >= columnCount) + if (cursorRow < 0 || + cursorRow >= rowCount || + cursorColumn < 0 || + cursorColumn >= columnCount) { //cursor not on valid position... cursorRow = 0; @@ -210,8 +210,8 @@ void executeSearch(bool forceShowDialog, if (forceShowDialog || lastSearchString.IsEmpty()) { - SearchDlg* searchDlg = new SearchDlg(parentWindow, lastSearchString, respectCase); //wxWidgets deletion handling -> deleted by parentWindow - if (static_cast<SearchDlg::ReturnCodes>(searchDlg->ShowModal()) != SearchDlg::BUTTON_OKAY) + SearchDlg searchDlg(parentWindow, lastSearchString, respectCase); //wxWidgets deletion handling -> deleted by parentWindow + if (static_cast<SearchDlg::ReturnCodes>(searchDlg.ShowModal()) != SearchDlg::BUTTON_OKAY) return; searchDialogWasShown = true; diff --git a/ui/small_dlgs.cpp b/ui/small_dlgs.cpp index 0e93337e..542b7d2c 100644 --- a/ui/small_dlgs.cpp +++ b/ui/small_dlgs.cpp @@ -19,7 +19,7 @@ #include "../shared/build_info.h" #include <wx/wupdlock.h> #include <wx/msgdlg.h> -#include "mouse_move_dlg.h" +#include "../shared/mouse_move_dlg.h" using namespace ffs3; @@ -43,16 +43,17 @@ AboutDlg::AboutDlg(wxWindow* window) : AboutDlgGenerated(window) m_bitmap11); //ownership passed to "this" #endif - m_bitmap9->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("website"))); - m_bitmap10->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("email"))); - m_bitmap11->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("logo"))); - m_bitmap13->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("gpl"))); + m_bitmap9->SetBitmap(GlobalResources::instance().getImage(wxT("website"))); + m_bitmap10->SetBitmap(GlobalResources::instance().getImage(wxT("email"))); + m_bitmap11->SetBitmap(GlobalResources::instance().getImage(wxT("logo"))); + m_bitmap13->SetBitmap(GlobalResources::instance().getImage(wxT("gpl"))); + m_bitmapTransl->SetBitmap(GlobalResources::instance().getImage(wxT("translation"))); //create language credits for (std::vector<LocInfoLine>::const_iterator i = LocalizationInfo::getMapping().begin(); i != LocalizationInfo::getMapping().end(); ++i) { //flag - wxStaticBitmap* staticBitmapFlag = new wxStaticBitmap(m_scrolledWindowTranslators, wxID_ANY, GlobalResources::getInstance().getImageByName(i->languageFlag), wxDefaultPosition, wxSize(-1,11), 0 ); + wxStaticBitmap* staticBitmapFlag = new wxStaticBitmap(m_scrolledWindowTranslators, wxID_ANY, GlobalResources::instance().getImage(i->languageFlag), wxDefaultPosition, wxSize(-1,11), 0 ); fgSizerTranslators->Add(staticBitmapFlag, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); //language name @@ -89,7 +90,7 @@ AboutDlg::AboutDlg(wxWindow* window) : AboutDlgGenerated(window) m_build->SetLabel(buildFormatted); - m_animationControl1->SetAnimation(*GlobalResources::getInstance().animationMoney); + m_animationControl1->SetAnimation(*GlobalResources::instance().animationMoney); m_animationControl1->Play(); m_buttonOkay->SetFocus(); @@ -111,9 +112,8 @@ void AboutDlg::OnOK(wxCommandEvent& event) void ffs3::showAboutDialog() { - AboutDlg* aboutDlg = new AboutDlg(NULL); - aboutDlg->ShowModal(); - aboutDlg->Destroy(); + AboutDlg aboutDlg(NULL); + aboutDlg.ShowModal(); } //######################################################################################## @@ -138,7 +138,7 @@ HelpDlg::HelpDlg(wxWindow* window) : HelpDlgGenerated(window) m_notebook1->SetFocus(); - m_bitmap25->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("help"))); + m_bitmap25->SetBitmap(GlobalResources::instance().getImage(wxT("help"))); //populate decision trees: "compare by date" wxTreeItemId treeRoot = m_treeCtrl1->AddRoot(_("DECISION TREE")); @@ -186,9 +186,8 @@ void HelpDlg::OnOK(wxCommandEvent& event) void ffs3::showHelpDialog() { - HelpDlg* helpDlg = new HelpDlg(NULL); - helpDlg->ShowModal(); - helpDlg->Destroy(); + HelpDlg helpDlg(NULL); + helpDlg.ShowModal(); } //######################################################################################## @@ -234,10 +233,10 @@ FilterDlg::FilterDlg(wxWindow* window, this, m_bitmap26, m_staticTexHeader, m_bitmap8, m_bitmap9); //ownership passed to "this" #endif - m_bitmap8->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("include"))); - m_bitmap9->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("exclude"))); - m_bitmap26->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("filterOn"))); - m_bpButtonHelp->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("help"))); + m_bitmap8->SetBitmap(GlobalResources::instance().getImage(wxT("include"))); + m_bitmap9->SetBitmap(GlobalResources::instance().getImage(wxT("exclude"))); + m_bitmap26->SetBitmap(GlobalResources::instance().getImage(wxT("filterOn"))); + m_bpButtonHelp->SetBitmapLabel(GlobalResources::instance().getImage(wxT("help"))); m_textCtrlInclude->SetValue(zToWx(includeFilter)); m_textCtrlExclude->SetValue(zToWx(excludeFilter)); @@ -312,18 +311,17 @@ void FilterDlg::OnClose(wxCloseEvent& event) DefaultReturnCode::Response ffs3::showFilterDialog(bool isGlobalFilter, - Zstring& filterIncl, - Zstring& filterExcl) + Zstring& filterIncl, + Zstring& filterExcl) { DefaultReturnCode::Response rv = DefaultReturnCode::BUTTON_CANCEL; - FilterDlg* filterDlg = new FilterDlg(NULL, - isGlobalFilter, //is main filter dialog - filterIncl, - filterExcl); - if (filterDlg->ShowModal() == FilterDlg::BUTTON_APPLY) + FilterDlg filterDlg(NULL, + isGlobalFilter, //is main filter dialog + filterIncl, + filterExcl); + if (filterDlg.ShowModal() == FilterDlg::BUTTON_APPLY) rv = DefaultReturnCode::BUTTON_OKAY; - filterDlg->Destroy(); return rv; } //######################################################################################## @@ -393,18 +391,18 @@ void DeleteDialog::updateTexts() if (m_checkBoxUseRecycler->GetValue()) { m_staticTextHeader->SetLabel(_("Do you really want to move the following object(s) to the Recycle Bin?")); - m_bitmap12->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("recycler"))); + m_bitmap12->SetBitmap(GlobalResources::instance().getImage(wxT("recycler"))); } else { m_staticTextHeader->SetLabel(_("Do you really want to delete the following object(s)?")); - m_bitmap12->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("deleteFile"))); + m_bitmap12->SetBitmap(GlobalResources::instance().getImage(wxT("deleteFile"))); } const std::pair<wxString, int> delInfo = ffs3::deleteFromGridAndHDPreview( - rowsToDeleteOnLeft, - rowsToDeleteOnRight, - m_checkBoxDeleteBothSides->GetValue()); + rowsToDeleteOnLeft, + rowsToDeleteOnRight, + m_checkBoxDeleteBothSides->GetValue()); const wxString filesToDelete = delInfo.first; totalDelCount = delInfo.second; @@ -444,10 +442,10 @@ void DeleteDialog::OnUseRecycler(wxCommandEvent& event) DefaultReturnCode::Response ffs3::showDeleteDialog(const std::vector<ffs3::FileSystemObject*>& rowsOnLeft, - const std::vector<ffs3::FileSystemObject*>& rowsOnRight, - bool& deleteOnBothSides, - bool& useRecycleBin, - int& totalDeleteCount) + const std::vector<ffs3::FileSystemObject*>& rowsOnRight, + bool& deleteOnBothSides, + bool& useRecycleBin, + int& totalDeleteCount) { DefaultReturnCode::Response rv = DefaultReturnCode::BUTTON_CANCEL; @@ -496,8 +494,8 @@ CustomizeColsDlg::CustomizeColsDlg(wxWindow* window, xmlAccess::ColumnAttributes this); //ownership passed to "this" #endif - m_bpButton29->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("moveUp"))); - m_bpButton30->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("moveDown"))); + m_bpButton29->SetBitmapLabel(GlobalResources::instance().getImage(wxT("moveUp"))); + m_bpButton30->SetBitmapLabel(GlobalResources::instance().getImage(wxT("moveDown"))); xmlAccess::ColumnAttributes columnSettings = attr; @@ -597,10 +595,9 @@ DefaultReturnCode::Response ffs3::showCustomizeColsDlg(xmlAccess::ColumnAttribut { DefaultReturnCode::Response rv = DefaultReturnCode::BUTTON_CANCEL; - CustomizeColsDlg* customizeDlg = new CustomizeColsDlg(NULL, attr); - if (customizeDlg->ShowModal() == CustomizeColsDlg::BUTTON_OKAY) + CustomizeColsDlg customizeDlg(NULL, attr); + if (customizeDlg.ShowModal() == CustomizeColsDlg::BUTTON_OKAY) rv = DefaultReturnCode::BUTTON_OKAY; - customizeDlg->Destroy(); return rv; } @@ -644,11 +641,11 @@ SyncPreviewDlg::SyncPreviewDlg(wxWindow* parentWindow, using ffs3::numberToStringSep; - m_buttonStartSync->setBitmapFront(GlobalResources::getInstance().getImageByName(wxT("startSync"))); - m_bitmapCreate->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("create"))); - m_bitmapUpdate->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("update"))); - m_bitmapDelete->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("delete"))); - m_bitmapData->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("data"))); + m_buttonStartSync->setBitmapFront(GlobalResources::instance().getImage(wxT("startSync"))); + m_bitmapCreate->SetBitmap(GlobalResources::instance().getImage(wxT("create"))); + m_bitmapUpdate->SetBitmap(GlobalResources::instance().getImage(wxT("update"))); + m_bitmapDelete->SetBitmap(GlobalResources::instance().getImage(wxT("delete"))); + m_bitmapData->SetBitmap(GlobalResources::instance().getImage(wxT("data"))); m_staticTextVariant->SetLabel(variantName); m_textCtrlData->SetValue(ffs3::formatFilesizeToShortString(statistics.getDataToProcess())); @@ -694,16 +691,14 @@ DefaultReturnCode::Response ffs3::showSyncPreviewDlg( { DefaultReturnCode::Response rv = DefaultReturnCode::BUTTON_CANCEL; - SyncPreviewDlg* preview = new SyncPreviewDlg(NULL, - variantName, - statistics, - dontShowAgain); + SyncPreviewDlg preview(NULL, + variantName, + statistics, + dontShowAgain); - if (preview->ShowModal() == SyncPreviewDlg::BUTTON_START) + if (preview.ShowModal() == SyncPreviewDlg::BUTTON_START) rv = DefaultReturnCode::BUTTON_OKAY; - preview->Destroy(); - return rv; } //######################################################################################## @@ -751,15 +746,15 @@ void setValue(wxChoice& choiceCtrl, ffs3::SymLinkHandling value) switch (value) { - case ffs3::SYMLINK_IGNORE: - choiceCtrl.SetSelection(0); - break; - case ffs3::SYMLINK_USE_DIRECTLY: - choiceCtrl.SetSelection(1); - break; - case ffs3::SYMLINK_FOLLOW_LINK: - choiceCtrl.SetSelection(2); - break; + case ffs3::SYMLINK_IGNORE: + choiceCtrl.SetSelection(0); + break; + case ffs3::SYMLINK_USE_DIRECTLY: + choiceCtrl.SetSelection(1); + break; + case ffs3::SYMLINK_FOLLOW_LINK: + choiceCtrl.SetSelection(2); + break; } } @@ -768,15 +763,15 @@ ffs3::SymLinkHandling getValue(const wxChoice& choiceCtrl) { switch (choiceCtrl.GetSelection()) { - case 0: - return ffs3::SYMLINK_IGNORE; - case 1: - return ffs3::SYMLINK_USE_DIRECTLY; - case 2: - return ffs3::SYMLINK_FOLLOW_LINK; - default: - assert(false); - return ffs3::SYMLINK_IGNORE; + case 0: + return ffs3::SYMLINK_IGNORE; + case 1: + return ffs3::SYMLINK_USE_DIRECTLY; + case 2: + return ffs3::SYMLINK_FOLLOW_LINK; + default: + assert(false); + return ffs3::SYMLINK_IGNORE; } } } @@ -797,20 +792,20 @@ CompareCfgDialog::CompareCfgDialog(wxWindow* parentWindow, //move dialog up so that compare-config button and first config-variant are on same level Move(wxPoint(position.x, std::max(0, position.y - (m_buttonTimeSize->GetScreenPosition() - GetScreenPosition()).y))); - m_bpButtonHelp->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("help"))); - m_bitmapByTime->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("cmpByTime"))); - m_bitmapByContent->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("cmpByContent"))); + m_bpButtonHelp->SetBitmapLabel(GlobalResources::instance().getImage(wxT("help"))); + m_bitmapByTime->SetBitmap(GlobalResources::instance().getImage(wxT("cmpByTime"))); + m_bitmapByContent->SetBitmap(GlobalResources::instance().getImage(wxT("cmpByContent"))); switch (cmpVar) { - case CMP_BY_TIME_SIZE: - m_radioBtnSizeDate->SetValue(true); - m_buttonContent->SetFocus(); //set focus on the other button - break; - case CMP_BY_CONTENT: - m_radioBtnContent->SetValue(true); - m_buttonTimeSize->SetFocus(); //set focus on the other button - break; + case CMP_BY_TIME_SIZE: + m_radioBtnSizeDate->SetValue(true); + m_buttonContent->SetFocus(); //set focus on the other button + break; + case CMP_BY_CONTENT: + m_radioBtnContent->SetValue(true); + m_buttonTimeSize->SetFocus(); //set focus on the other button + break; } @@ -865,8 +860,8 @@ void CompareCfgDialog::OnContent(wxCommandEvent& event) void CompareCfgDialog::OnShowHelp(wxCommandEvent& event) { - HelpDlg* helpDlg = new HelpDlg(this); - helpDlg->ShowModal(); + HelpDlg helpDlg(this); + helpDlg.ShowModal(); } @@ -919,10 +914,10 @@ GlobalSettingsDlg::GlobalSettingsDlg(wxWindow* window, xmlAccess::XmlGlobalSetti this, m_bitmapSettings, m_staticText56); //ownership passed to "this" #endif - m_bitmapSettings->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("settings"))); - m_buttonResetDialogs->setBitmapFront(GlobalResources::getInstance().getImageByName(wxT("warningSmall")), 5); - m_bpButtonAddRow->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("addFolderPair"))); - m_bpButtonRemoveRow->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("removeFolderPair"))); + m_bitmapSettings->SetBitmap(GlobalResources::instance().getImage(wxT("settings"))); + m_buttonResetDialogs->setBitmapFront(GlobalResources::instance().getImage(wxT("warningSmall")), 5); + m_bpButtonAddRow->SetBitmapLabel(GlobalResources::instance().getImage(wxT("addFolderPair"))); + m_bpButtonRemoveRow->SetBitmapLabel(GlobalResources::instance().getImage(wxT("removeFolderPair"))); m_checkBoxCopyLocked->SetValue(globalSettings.copyLockedFiles); m_checkBoxCopyPermissions->SetValue(globalSettings.copyFilePermissions); @@ -961,11 +956,11 @@ void GlobalSettingsDlg::OnOkay(wxCommandEvent& event) void GlobalSettingsDlg::OnResetDialogs(wxCommandEvent& event) { - QuestionDlg* messageDlg = new QuestionDlg(this, - QuestionDlg::BUTTON_YES | QuestionDlg::BUTTON_CANCEL, - _("Re-enable all hidden dialogs?")); + QuestionDlg messageDlg(this, + QuestionDlg::BUTTON_YES | QuestionDlg::BUTTON_CANCEL, + _("Restore all hidden dialogs?")); - if (messageDlg->ShowModal() == QuestionDlg::BUTTON_YES) + if (messageDlg.ShowModal() == QuestionDlg::BUTTON_YES) settings.optDialogs.resetDialogs(); } @@ -1055,11 +1050,9 @@ DefaultReturnCode::Response ffs3::showGlobalSettingsDlg(xmlAccess::XmlGlobalSett { DefaultReturnCode::Response rv = DefaultReturnCode::BUTTON_CANCEL; - wxDialog* settingsDlg = new GlobalSettingsDlg(NULL, globalSettings); - if (settingsDlg->ShowModal() == GlobalSettingsDlg::BUTTON_OKAY) + GlobalSettingsDlg settingsDlg(NULL, globalSettings); + if (settingsDlg.ShowModal() == GlobalSettingsDlg::BUTTON_OKAY) rv = DefaultReturnCode::BUTTON_OKAY; - settingsDlg->Destroy(); - return rv; } diff --git a/ui/small_dlgs.h b/ui/small_dlgs.h index 73253b15..2c120c54 100644 --- a/ui/small_dlgs.h +++ b/ui/small_dlgs.h @@ -29,8 +29,8 @@ void showAboutDialog(); void showHelpDialog(); DefaultReturnCode::Response showFilterDialog(bool isGlobalFilter, - Zstring& filterIncl, - Zstring& filterExcl); + Zstring& filterIncl, + Zstring& filterExcl); DefaultReturnCode::Response showDeleteDialog( const std::vector<FileSystemObject*>& rowsOnLeft, diff --git a/ui/sync_cfg.cpp b/ui/sync_cfg.cpp index 371f90cb..bbfcda06 100644 --- a/ui/sync_cfg.cpp +++ b/ui/sync_cfg.cpp @@ -9,7 +9,7 @@ #include "../library/resources.h" #include "../shared/dir_name.h" #include <wx/wupdlock.h> -#include "mouse_move_dlg.h" +#include "../shared/mouse_move_dlg.h" #include "../shared/string_conv.h" using namespace ffs3; @@ -51,12 +51,12 @@ SyncCfgDialog::SyncCfgDialog(wxWindow* window, updateConfigIcons(cmpVariant, currentSyncConfig); //set icons for this dialog - m_bitmapLeftOnly->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("leftOnly"))); - m_bitmapRightOnly->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("rightOnly"))); - m_bitmapLeftNewer->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("leftNewer"))); - m_bitmapRightNewer->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("rightNewer"))); - m_bitmapDifferent->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("different"))); - m_bitmapConflict->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("conflictGrey"))); + m_bitmapLeftOnly->SetBitmap(GlobalResources::instance().getImage(wxT("leftOnly"))); + m_bitmapRightOnly->SetBitmap(GlobalResources::instance().getImage(wxT("rightOnly"))); + m_bitmapLeftNewer->SetBitmap(GlobalResources::instance().getImage(wxT("leftNewer"))); + m_bitmapRightNewer->SetBitmap(GlobalResources::instance().getImage(wxT("rightNewer"))); + m_bitmapDifferent->SetBitmap(GlobalResources::instance().getImage(wxT("different"))); + m_bitmapConflict->SetBitmap(GlobalResources::instance().getImage(wxT("conflictGrey"))); bSizer201->Layout(); //wxButtonWithImage size might have changed @@ -101,18 +101,18 @@ void SyncCfgDialog::updateConfigIcons(const ffs3::CompareVariant cmpVar, const f //set radiobuttons -> have no parameter-ownership at all! switch (ffs3::getVariant(currentSyncConfig)) { - case SyncConfiguration::AUTOMATIC: - m_radioBtnAutomatic->SetValue(true); //automatic mode - break; - case SyncConfiguration::MIRROR: - m_radioBtnMirror->SetValue(true); //one way -> - break; - case SyncConfiguration::UPDATE: - m_radioBtnUpdate->SetValue(true); //Update -> - break; - case SyncConfiguration::CUSTOM: - m_radioBtnCustom->SetValue(true); //custom - break; + case SyncConfiguration::AUTOMATIC: + m_radioBtnAutomatic->SetValue(true); //automatic mode + break; + case SyncConfiguration::MIRROR: + m_radioBtnMirror->SetValue(true); //one way -> + break; + case SyncConfiguration::UPDATE: + m_radioBtnUpdate->SetValue(true); //Update -> + break; + case SyncConfiguration::CUSTOM: + m_radioBtnCustom->SetValue(true); //custom + break; } GetSizer()->SetSizeHints(this); //this works like a charm for GTK2 with window resizing problems!!! (includes call to Fit()) @@ -154,19 +154,19 @@ void SyncCfgDialog::updateConfigIcons(const CompareVariant compareVar, switch (compareVar) { - case CMP_BY_TIME_SIZE: - buttonDifferent ->Hide(); + case CMP_BY_TIME_SIZE: + buttonDifferent ->Hide(); - bitmapDifferent ->Hide(); - break; + bitmapDifferent ->Hide(); + break; - case CMP_BY_CONTENT: - buttonLeftNewer ->Hide(); - buttonRightNewer->Hide(); + case CMP_BY_CONTENT: + buttonLeftNewer ->Hide(); + buttonRightNewer->Hide(); - bitmapLeftNewer ->Hide(); - bitmapRightNewer->Hide(); - break; + bitmapLeftNewer ->Hide(); + bitmapRightNewer->Hide(); + break; } if (syncConfig.automatic) //automatic mode needs no sync-directions @@ -174,98 +174,98 @@ void SyncCfgDialog::updateConfigIcons(const CompareVariant compareVar, switch (syncConfig.exLeftSideOnly) { - case SYNC_DIR_RIGHT: - buttonLeftOnly->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowRightCr"))); - buttonLeftOnly->SetToolTip(getDescription(SO_CREATE_NEW_RIGHT)); - break; - case SYNC_DIR_LEFT: - buttonLeftOnly->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("deleteLeft"))); - buttonLeftOnly->SetToolTip(getDescription(SO_DELETE_LEFT)); - break; - case SYNC_DIR_NONE: - buttonLeftOnly->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowNone"))); - buttonLeftOnly->SetToolTip(getDescription(SO_DO_NOTHING)); - break; + case SYNC_DIR_RIGHT: + buttonLeftOnly->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowRightCr"))); + buttonLeftOnly->SetToolTip(getDescription(SO_CREATE_NEW_RIGHT)); + break; + case SYNC_DIR_LEFT: + buttonLeftOnly->SetBitmapLabel(GlobalResources::instance().getImage(wxT("deleteLeft"))); + buttonLeftOnly->SetToolTip(getDescription(SO_DELETE_LEFT)); + break; + case SYNC_DIR_NONE: + buttonLeftOnly->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowNone"))); + buttonLeftOnly->SetToolTip(getDescription(SO_DO_NOTHING)); + break; } switch (syncConfig.exRightSideOnly) { - case SYNC_DIR_RIGHT: - buttonRightOnly->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("deleteRight"))); - buttonRightOnly->SetToolTip(getDescription(SO_DELETE_RIGHT)); - break; - case SYNC_DIR_LEFT: - buttonRightOnly->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowLeftCr"))); - buttonRightOnly->SetToolTip(getDescription(SO_CREATE_NEW_LEFT)); - break; - case SYNC_DIR_NONE: - buttonRightOnly->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowNone"))); - buttonRightOnly->SetToolTip(getDescription(SO_DO_NOTHING)); - break; + case SYNC_DIR_RIGHT: + buttonRightOnly->SetBitmapLabel(GlobalResources::instance().getImage(wxT("deleteRight"))); + buttonRightOnly->SetToolTip(getDescription(SO_DELETE_RIGHT)); + break; + case SYNC_DIR_LEFT: + buttonRightOnly->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowLeftCr"))); + buttonRightOnly->SetToolTip(getDescription(SO_CREATE_NEW_LEFT)); + break; + case SYNC_DIR_NONE: + buttonRightOnly->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowNone"))); + buttonRightOnly->SetToolTip(getDescription(SO_DO_NOTHING)); + break; } switch (syncConfig.leftNewer) { - case SYNC_DIR_RIGHT: - buttonLeftNewer->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowRight"))); - buttonLeftNewer->SetToolTip(getDescription(SO_OVERWRITE_RIGHT)); - break; - case SYNC_DIR_LEFT: - buttonLeftNewer->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowLeft"))); - buttonLeftNewer->SetToolTip(getDescription(SO_OVERWRITE_LEFT)); - break; - case SYNC_DIR_NONE: - buttonLeftNewer->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowNone"))); - buttonLeftNewer->SetToolTip(getDescription(SO_DO_NOTHING)); - break; + case SYNC_DIR_RIGHT: + buttonLeftNewer->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowRight"))); + buttonLeftNewer->SetToolTip(getDescription(SO_OVERWRITE_RIGHT)); + break; + case SYNC_DIR_LEFT: + buttonLeftNewer->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowLeft"))); + buttonLeftNewer->SetToolTip(getDescription(SO_OVERWRITE_LEFT)); + break; + case SYNC_DIR_NONE: + buttonLeftNewer->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowNone"))); + buttonLeftNewer->SetToolTip(getDescription(SO_DO_NOTHING)); + break; } switch (syncConfig.rightNewer) { - case SYNC_DIR_RIGHT: - buttonRightNewer->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowRight"))); - buttonRightNewer->SetToolTip(getDescription(SO_OVERWRITE_RIGHT)); - break; - case SYNC_DIR_LEFT: - buttonRightNewer->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowLeft"))); - buttonRightNewer->SetToolTip(getDescription(SO_OVERWRITE_LEFT)); - break; - case SYNC_DIR_NONE: - buttonRightNewer->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowNone"))); - buttonRightNewer->SetToolTip(getDescription(SO_DO_NOTHING)); - break; + case SYNC_DIR_RIGHT: + buttonRightNewer->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowRight"))); + buttonRightNewer->SetToolTip(getDescription(SO_OVERWRITE_RIGHT)); + break; + case SYNC_DIR_LEFT: + buttonRightNewer->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowLeft"))); + buttonRightNewer->SetToolTip(getDescription(SO_OVERWRITE_LEFT)); + break; + case SYNC_DIR_NONE: + buttonRightNewer->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowNone"))); + buttonRightNewer->SetToolTip(getDescription(SO_DO_NOTHING)); + break; } switch (syncConfig.different) { - case SYNC_DIR_RIGHT: - buttonDifferent->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowRight"))); - buttonDifferent->SetToolTip(getDescription(SO_OVERWRITE_RIGHT)); - break; - case SYNC_DIR_LEFT: - buttonDifferent->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowLeft"))); - buttonDifferent->SetToolTip(getDescription(SO_OVERWRITE_LEFT)); - break; - case SYNC_DIR_NONE: - buttonDifferent->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowNone"))); - buttonDifferent->SetToolTip(getDescription(SO_DO_NOTHING)); - break; + case SYNC_DIR_RIGHT: + buttonDifferent->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowRight"))); + buttonDifferent->SetToolTip(getDescription(SO_OVERWRITE_RIGHT)); + break; + case SYNC_DIR_LEFT: + buttonDifferent->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowLeft"))); + buttonDifferent->SetToolTip(getDescription(SO_OVERWRITE_LEFT)); + break; + case SYNC_DIR_NONE: + buttonDifferent->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowNone"))); + buttonDifferent->SetToolTip(getDescription(SO_DO_NOTHING)); + break; } switch (syncConfig.conflict) { - case SYNC_DIR_RIGHT: - buttonConflict->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowRight"))); - buttonConflict->SetToolTip(getDescription(SO_OVERWRITE_RIGHT)); - break; - case SYNC_DIR_LEFT: - buttonConflict->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowLeft"))); - buttonConflict->SetToolTip(getDescription(SO_OVERWRITE_LEFT)); - break; - case SYNC_DIR_NONE: - buttonConflict->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("conflict"))); - buttonConflict->SetToolTip(_("Leave as unresolved conflict")); - break; + case SYNC_DIR_RIGHT: + buttonConflict->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowRight"))); + buttonConflict->SetToolTip(getDescription(SO_OVERWRITE_RIGHT)); + break; + case SYNC_DIR_LEFT: + buttonConflict->SetBitmapLabel(GlobalResources::instance().getImage(wxT("arrowLeft"))); + buttonConflict->SetToolTip(getDescription(SO_OVERWRITE_LEFT)); + break; + case SYNC_DIR_NONE: + buttonConflict->SetBitmapLabel(GlobalResources::instance().getImage(wxT("conflict"))); + buttonConflict->SetToolTip(_("Leave as unresolved conflict")); + break; } } @@ -341,18 +341,18 @@ void updateToolTipDeletionHandling(wxChoice* choiceHandleError, wxPanel* customD switch (value) { - case ffs3::DELETE_PERMANENTLY: - choiceHandleError->SetToolTip(_("Delete or overwrite files permanently")); - break; - - case ffs3::MOVE_TO_RECYCLE_BIN: - choiceHandleError->SetToolTip(_("Use Recycle Bin when deleting or overwriting files")); - break; - - case ffs3::MOVE_TO_CUSTOM_DIRECTORY: - choiceHandleError->SetToolTip(_("Move files into a time-stamped subdirectory")); - customDir->Enable(); - break; + case ffs3::DELETE_PERMANENTLY: + choiceHandleError->SetToolTip(_("Delete or overwrite files permanently")); + break; + + case ffs3::MOVE_TO_RECYCLE_BIN: + choiceHandleError->SetToolTip(_("Use Recycle Bin when deleting or overwriting files")); + break; + + case ffs3::MOVE_TO_CUSTOM_DIRECTORY: + choiceHandleError->SetToolTip(_("Move files into a time-stamped subdirectory")); + customDir->Enable(); + break; } } @@ -361,15 +361,15 @@ ffs3::DeletionPolicy SyncCfgDialog::getDeletionHandling() { switch (m_choiceHandleDeletion->GetSelection()) { - case 0: - return ffs3::DELETE_PERMANENTLY; - case 1: - return ffs3::MOVE_TO_RECYCLE_BIN; - case 2: - return ffs3::MOVE_TO_CUSTOM_DIRECTORY; - default: - assert(false); - return ffs3::MOVE_TO_RECYCLE_BIN; + case 0: + return ffs3::DELETE_PERMANENTLY; + case 1: + return ffs3::MOVE_TO_RECYCLE_BIN; + case 2: + return ffs3::MOVE_TO_CUSTOM_DIRECTORY; + default: + assert(false); + return ffs3::MOVE_TO_RECYCLE_BIN; } } @@ -379,19 +379,19 @@ void SyncCfgDialog::setDeletionHandling(ffs3::DeletionPolicy newValue) m_choiceHandleDeletion->Clear(); m_choiceHandleDeletion->Append(_("Delete permanently")); m_choiceHandleDeletion->Append(_("Use Recycle Bin")); - m_choiceHandleDeletion->Append(_("User-defined directory")); + m_choiceHandleDeletion->Append(_("Versioning")); switch (newValue) { - case ffs3::DELETE_PERMANENTLY: - m_choiceHandleDeletion->SetSelection(0); - break; - case ffs3::MOVE_TO_RECYCLE_BIN: - m_choiceHandleDeletion->SetSelection(1); - break; - case ffs3::MOVE_TO_CUSTOM_DIRECTORY: - m_choiceHandleDeletion->SetSelection(2); - break; + case ffs3::DELETE_PERMANENTLY: + m_choiceHandleDeletion->SetSelection(0); + break; + case ffs3::MOVE_TO_RECYCLE_BIN: + m_choiceHandleDeletion->SetSelection(1); + break; + case ffs3::MOVE_TO_CUSTOM_DIRECTORY: + m_choiceHandleDeletion->SetSelection(2); + break; } updateToolTipDeletionHandling(m_choiceHandleDeletion, m_panelCustomDeletionDir, newValue); @@ -429,15 +429,15 @@ void toggleSyncDirection(SyncDirection& current) { switch (current) { - case SYNC_DIR_RIGHT: - current = SYNC_DIR_LEFT; - break; - case SYNC_DIR_LEFT: - current = SYNC_DIR_NONE; - break; - case SYNC_DIR_NONE: - current = SYNC_DIR_RIGHT; - break; + case SYNC_DIR_RIGHT: + current = SYNC_DIR_LEFT; + break; + case SYNC_DIR_LEFT: + current = SYNC_DIR_NONE; + break; + case SYNC_DIR_NONE: + current = SYNC_DIR_RIGHT; + break; } } diff --git a/ui/tray_icon.cpp b/ui/tray_icon.cpp index 087ee9d3..c307c7ab 100644 --- a/ui/tray_icon.cpp +++ b/ui/tray_icon.cpp @@ -27,9 +27,9 @@ wxIcon generateIcon(size_t percent) //generate icon with progress indicator percent = std::min(percent, static_cast<size_t>(100)); //handle invalid input #ifdef FFS_WIN - static const wxBitmap trayIcon = GlobalResources::getInstance().getImageByName(wxT("FFS_tray_win.png")); + static const wxBitmap trayIcon = GlobalResources::instance().getImage(wxT("FFS_tray_win.png")); #elif defined FFS_LINUX - static const wxBitmap trayIcon = GlobalResources::getInstance().getImageByName(wxT("FFS_tray_linux.png")); + static const wxBitmap trayIcon = GlobalResources::instance().getImage(wxT("FFS_tray_linux.png")); #endif const int indicatorHeight = roundNum((trayIcon.GetHeight() * percent) / 100.0); @@ -41,8 +41,8 @@ wxIcon generateIcon(size_t percent) //generate icon with progress indicator wxImage genImage(trayIcon.ConvertToImage()); - if ( genImage.GetWidth() > 0 && - genImage.GetHeight() > 0) + if (genImage.GetWidth() > 0 && + genImage.GetHeight() > 0) { const int indicatorWidth = genImage.GetWidth() * .4; const int indicatorXBegin = std::ceil((genImage.GetWidth() - indicatorWidth) / 2.0); @@ -131,7 +131,7 @@ private: }; -MinimizeToTray::MinimizeToTray(wxTopLevelWindow* callerWnd, wxWindow* secondWnd) : +MinimizeToTray::MinimizeToTray(wxTopLevelWindow* callerWnd, wxTopLevelWindow* secondWnd) : callerWnd_(callerWnd), secondWnd_(secondWnd), trayIcon(new TaskBarImpl(this)) @@ -157,7 +157,10 @@ void MinimizeToTray::resumeFromTray() //remove trayIcon and restore windows: Mi if (trayIcon) { if (secondWnd_) + { + secondWnd_->Iconize(false); secondWnd_->Show(); + } if (callerWnd_) //usecase: avoid dialog flashing in batch silent mode { @@ -198,11 +201,11 @@ void MinimizeToTray::OnContextMenuSelection(wxCommandEvent& event) const Selection eventId = static_cast<Selection>(event.GetId()); switch (eventId) { - case CONTEXT_ABOUT: - ffs3::showAboutDialog(); - break; - case CONTEXT_RESTORE: - resumeFromTray(); + case CONTEXT_ABOUT: + ffs3::showAboutDialog(); + break; + case CONTEXT_RESTORE: + resumeFromTray(); } } diff --git a/ui/tray_icon.h b/ui/tray_icon.h index 1207d1fa..af9200d1 100644 --- a/ui/tray_icon.h +++ b/ui/tray_icon.h @@ -14,7 +14,7 @@ class MinimizeToTray : private wxEvtHandler { public: - MinimizeToTray(wxTopLevelWindow* callerWnd, wxWindow* secondWnd = NULL); //ensure callerWind has longer lifetime! + MinimizeToTray(wxTopLevelWindow* callerWnd, wxTopLevelWindow* secondWnd = NULL); //ensure both windows have longer lifetime than this instance! ~MinimizeToTray(); //show windows again void setToolTip(const wxString& toolTipText, size_t percent = 0); //percent (optional), number between [0, 100], for small progress indicator @@ -26,7 +26,7 @@ private: void resumeFromTray(); wxTopLevelWindow* callerWnd_; - wxWindow* secondWnd_; + wxTopLevelWindow* secondWnd_; class TaskBarImpl; TaskBarImpl* trayIcon; //actual tray icon (don't use inheritance to enable delayed deletion) }; diff --git a/version/version.h b/version/version.h index febc8f0f..808504b8 100644 --- a/version/version.h +++ b/version/version.h @@ -2,5 +2,5 @@ namespace ffs3 { - const wxString currentVersion = wxT("3.13"); //internal linkage! +const wxString currentVersion = wxT("3.14"); //internal linkage! } diff --git a/version/version.rc b/version/version.rc index 23330588..2d2c3ac5 100644 --- a/version/version.rc +++ b/version/version.rc @@ -1,2 +1,2 @@ -#define VER_FREEFILESYNC 3,13,0,0 -#define VER_FREEFILESYNC_STR "3.13\0" +#define VER_FREEFILESYNC 3,14,0,0 +#define VER_FREEFILESYNC_STR "3.14\0" |