diff options
-rw-r--r-- | Application.cpp | 229 | ||||
-rw-r--r-- | Application.h | 5 | ||||
-rw-r--r-- | BUILD/Changelog.txt | 18 | ||||
-rw-r--r-- | BUILD/FreeFileSync.chm | bin | 671846 -> 671721 bytes | |||
-rw-r--r-- | BUILD/Help/html/Links.html | 4 | ||||
-rw-r--r-- | BUILD/Help/html/Macros.html | 8 | ||||
-rw-r--r-- | BUILD/Invisible.vbs | 4 | ||||
-rw-r--r-- | BUILD/Languages/chinese_simple.lng | 82 | ||||
-rw-r--r-- | BUILD/Languages/chinese_traditional.lng | 76 | ||||
-rw-r--r-- | BUILD/Languages/czech.lng | 100 | ||||
-rw-r--r-- | BUILD/Languages/danish.lng | 100 | ||||
-rw-r--r-- | BUILD/Languages/dutch.lng | 92 | ||||
-rw-r--r-- | BUILD/Languages/english_uk.lng | 94 | ||||
-rw-r--r-- | BUILD/Languages/finnish.lng | 492 | ||||
-rw-r--r-- | BUILD/Languages/french.lng | 94 | ||||
-rw-r--r-- | BUILD/Languages/german.lng | 92 | ||||
-rw-r--r-- | BUILD/Languages/greek.lng | 452 | ||||
-rw-r--r-- | BUILD/Languages/hebrew.lng | 100 | ||||
-rw-r--r-- | BUILD/Languages/hungarian.lng | 88 | ||||
-rw-r--r-- | BUILD/Languages/italian.lng | 174 | ||||
-rw-r--r-- | BUILD/Languages/japanese.lng | 86 | ||||
-rw-r--r-- | BUILD/Languages/korean.lng | 94 | ||||
-rw-r--r-- | BUILD/Languages/polish.lng | 106 | ||||
-rw-r--r-- | BUILD/Languages/portuguese.lng | 100 | ||||
-rw-r--r-- | BUILD/Languages/portuguese_br.lng | 100 | ||||
-rw-r--r-- | BUILD/Languages/romanian.lng | 106 | ||||
-rw-r--r-- | BUILD/Languages/russian.lng | 108 | ||||
-rw-r--r-- | BUILD/Languages/slovenian.lng | 106 | ||||
-rw-r--r-- | BUILD/Languages/spanish.lng | 88 | ||||
-rw-r--r-- | BUILD/Languages/swedish.lng | 94 | ||||
-rw-r--r-- | BUILD/Languages/turkish.lng | 492 | ||||
-rw-r--r-- | BUILD/Languages/ukrainian.lng | 229 | ||||
-rw-r--r-- | BUILD/Resources.zip | bin | 250353 -> 250353 bytes | |||
-rw-r--r-- | FreeFileSync - wxWidgets v2.9.2 Beta.vcxproj | 308 | ||||
-rw-r--r-- | FreeFileSync.cbp | 403 | ||||
-rw-r--r-- | FreeFileSync.vcxproj | 105 | ||||
-rw-r--r-- | Makefile | 88 | ||||
-rw-r--r-- | RealtimeSync/RealtimeSync.cbp | 71 | ||||
-rw-r--r-- | RealtimeSync/RealtimeSync.vcxproj | 71 | ||||
-rw-r--r-- | RealtimeSync/application.cpp | 44 | ||||
-rw-r--r-- | RealtimeSync/gui_generated.cpp | 55 | ||||
-rw-r--r-- | RealtimeSync/gui_generated.h | 29 | ||||
-rw-r--r-- | RealtimeSync/main_dlg.cpp | 32 | ||||
-rw-r--r-- | RealtimeSync/main_dlg.h | 4 | ||||
-rw-r--r-- | RealtimeSync/makefile | 36 | ||||
-rw-r--r-- | RealtimeSync/resources.cpp | 57 | ||||
-rw-r--r-- | RealtimeSync/resources.h | 20 | ||||
-rw-r--r-- | RealtimeSync/tray_menu.cpp | 22 | ||||
-rw-r--r-- | RealtimeSync/watcher.cpp | 76 | ||||
-rw-r--r-- | RealtimeSync/watcher.h | 4 | ||||
-rw-r--r-- | RealtimeSync/xml_ffs.cpp | 15 | ||||
-rw-r--r-- | RealtimeSync/xml_proc.cpp | 16 | ||||
-rw-r--r-- | RealtimeSync/xml_proc.h | 2 | ||||
-rw-r--r-- | algorithm.cpp | 60 | ||||
-rw-r--r-- | algorithm.h | 2 | ||||
-rw-r--r-- | comparison.cpp | 52 | ||||
-rw-r--r-- | comparison.h | 12 | ||||
-rw-r--r-- | file_hierarchy.cpp | 1 | ||||
-rw-r--r-- | file_hierarchy.h | 12 | ||||
-rw-r--r-- | lib/Batch.ico (renamed from library/Batch.ico) | bin | 139831 -> 139831 bytes | |||
-rw-r--r-- | lib/FindFilePlus/FindFilePlus.vcxproj (renamed from shared/FindFilePlus/FindFilePlus.vcxproj) | 8 | ||||
-rw-r--r-- | lib/FindFilePlus/dll_main.cpp (renamed from shared/Thumbnail/dll_main.cpp) | 7 | ||||
-rw-r--r-- | lib/FindFilePlus/find_file_plus.cpp (renamed from shared/FindFilePlus/find_file_plus.cpp) | 91 | ||||
-rw-r--r-- | lib/FindFilePlus/find_file_plus.h (renamed from shared/FindFilePlus/find_file_plus.h) | 10 | ||||
-rw-r--r-- | lib/FindFilePlus/init_dll_binding.h (renamed from shared/resolve_path.h) | 20 | ||||
-rw-r--r-- | lib/FindFilePlus/load_dll.cpp (renamed from shared/FindFilePlus/load_dll.cpp) | 6 | ||||
-rw-r--r-- | lib/FindFilePlus/load_dll.h (renamed from shared/FindFilePlus/load_dll.h) | 26 | ||||
-rw-r--r-- | lib/FreeFileSync.ico (renamed from library/FreeFileSync.ico) | bin | 132167 -> 132167 bytes | |||
-rw-r--r-- | lib/IFileOperation/FileOperation_Vista.vcxproj (renamed from shared/IFileOperation/FileOperation_Vista.vcxproj) | 12 | ||||
-rw-r--r-- | lib/IFileOperation/dll_main.cpp (renamed from shared/FindFilePlus/dll_main.cpp) | 0 | ||||
-rw-r--r-- | lib/IFileOperation/file_op.cpp (renamed from shared/IFileOperation/file_op.cpp) | 39 | ||||
-rw-r--r-- | lib/IFileOperation/file_op.h (renamed from shared/IFileOperation/file_op.h) | 4 | ||||
-rw-r--r-- | lib/ShadowCopy/LockFile.cpp (renamed from shared/ShadowCopy/LockFile.cpp) | 0 | ||||
-rw-r--r-- | lib/ShadowCopy/Shadow_2003.vcxproj (renamed from shared/ShadowCopy/Shadow_2003.vcxproj) | 12 | ||||
-rw-r--r-- | lib/ShadowCopy/Shadow_XP.vcxproj (renamed from shared/ShadowCopy/Shadow_XP.vcxproj) | 12 | ||||
-rw-r--r-- | lib/ShadowCopy/dll_main.cpp (renamed from shared/IFileOperation/dll_main.cpp) | 0 | ||||
-rw-r--r-- | lib/ShadowCopy/shadow.cpp (renamed from shared/ShadowCopy/shadow.cpp) | 35 | ||||
-rw-r--r-- | lib/ShadowCopy/shadow.h (renamed from shared/ShadowCopy/shadow.h) | 41 | ||||
-rw-r--r-- | lib/SyncDB.ico (renamed from library/SyncDB.ico) | bin | 145378 -> 145378 bytes | |||
-rw-r--r-- | lib/Thumbnail/Thumbnail.vcxproj (renamed from shared/Thumbnail/Thumbnail.vcxproj) | 4 | ||||
-rw-r--r-- | lib/Thumbnail/dll_main.cpp (renamed from shared/ShadowCopy/dll_main.cpp) | 0 | ||||
-rw-r--r-- | lib/Thumbnail/thumbnail.cpp (renamed from shared/Thumbnail/thumbnail.cpp) | 28 | ||||
-rw-r--r-- | lib/Thumbnail/thumbnail.h (renamed from shared/Thumbnail/thumbnail.h) | 6 | ||||
-rw-r--r-- | lib/binary.cpp (renamed from library/binary.cpp) | 6 | ||||
-rw-r--r-- | lib/binary.h (renamed from library/binary.h) | 6 | ||||
-rw-r--r-- | lib/cmp_filetime.h (renamed from library/cmp_filetime.h) | 9 | ||||
-rw-r--r-- | lib/custom_grid.cpp (renamed from library/custom_grid.cpp) | 78 | ||||
-rw-r--r-- | lib/custom_grid.h (renamed from library/custom_grid.h) | 4 | ||||
-rw-r--r-- | lib/db_file.cpp (renamed from library/db_file.cpp) | 61 | ||||
-rw-r--r-- | lib/db_file.h (renamed from library/db_file.h) | 2 | ||||
-rw-r--r-- | lib/detect_renaming.cpp (renamed from library/detect_renaming.cpp) | 0 | ||||
-rw-r--r-- | lib/detect_renaming.h (renamed from library/detect_renaming.h) | 0 | ||||
-rw-r--r-- | lib/dir_exist_async.h (renamed from library/dir_exist_async.h) | 23 | ||||
-rw-r--r-- | lib/dir_lock.cpp (renamed from library/dir_lock.cpp) | 65 | ||||
-rw-r--r-- | lib/dir_lock.h (renamed from library/dir_lock.h) | 2 | ||||
-rw-r--r-- | lib/dir_name.cpp (renamed from shared/dir_name.cpp) | 20 | ||||
-rw-r--r-- | lib/dir_name.h (renamed from shared/dir_name.h) | 2 | ||||
-rw-r--r-- | lib/error_log.cpp (renamed from library/error_log.cpp) | 27 | ||||
-rw-r--r-- | lib/error_log.h (renamed from library/error_log.h) | 11 | ||||
-rw-r--r-- | lib/ffs_paths.h (renamed from shared/standard_paths.cpp) | 67 | ||||
-rw-r--r-- | lib/folder_history_box.cpp (renamed from shared/folder_history_box.cpp) | 23 | ||||
-rw-r--r-- | lib/folder_history_box.h (renamed from shared/folder_history_box.h) | 17 | ||||
-rw-r--r-- | lib/hard_filter.cpp (renamed from library/hard_filter.cpp) | 34 | ||||
-rw-r--r-- | lib/hard_filter.h (renamed from library/hard_filter.h) | 2 | ||||
-rw-r--r-- | lib/help_provider.h | 59 | ||||
-rw-r--r-- | lib/icon_buffer.cpp (renamed from library/icon_buffer.cpp) | 47 | ||||
-rw-r--r-- | lib/icon_buffer.h (renamed from library/icon_buffer.h) | 2 | ||||
-rw-r--r-- | lib/localization.cpp (renamed from shared/localization.cpp) | 18 | ||||
-rw-r--r-- | lib/localization.h (renamed from shared/localization.h) | 0 | ||||
-rw-r--r-- | lib/lock_holder.h (renamed from library/lock_holder.h) | 9 | ||||
-rw-r--r-- | lib/norm_filter.h (renamed from library/norm_filter.h) | 19 | ||||
-rw-r--r-- | lib/parallel_scan.cpp (renamed from library/parallel_scan.cpp) | 43 | ||||
-rw-r--r-- | lib/parallel_scan.h (renamed from library/parallel_scan.h) | 2 | ||||
-rw-r--r-- | lib/parse_lng.h (renamed from shared/parse_lng.h) | 40 | ||||
-rw-r--r-- | lib/parse_plural.h (renamed from shared/parse_plural.h) | 4 | ||||
-rw-r--r-- | lib/process_xml.cpp (renamed from library/process_xml.cpp) | 70 | ||||
-rw-r--r-- | lib/process_xml.h (renamed from library/process_xml.h) | 6 | ||||
-rw-r--r-- | lib/recycler.cpp (renamed from shared/recycler.cpp) | 32 | ||||
-rw-r--r-- | lib/recycler.h (renamed from shared/recycler.h) | 4 | ||||
-rw-r--r-- | lib/resolve_path.cpp (renamed from shared/resolve_path.cpp) | 343 | ||||
-rw-r--r-- | lib/resolve_path.h | 26 | ||||
-rw-r--r-- | lib/resources.cpp (renamed from library/resources.cpp) | 51 | ||||
-rw-r--r-- | lib/resources.h (renamed from library/resources.h) | 23 | ||||
-rw-r--r-- | lib/shadow.cpp (renamed from shared/shadow.cpp) | 22 | ||||
-rw-r--r-- | lib/shadow.h (renamed from shared/shadow.h) | 8 | ||||
-rw-r--r-- | lib/soft_filter.h (renamed from library/soft_filter.h) | 8 | ||||
-rw-r--r-- | lib/statistics.cpp (renamed from library/statistics.cpp) | 151 | ||||
-rw-r--r-- | lib/statistics.h (renamed from library/statistics.h) | 23 | ||||
-rw-r--r-- | lib/status_handler.cpp (renamed from library/status_handler.cpp) | 0 | ||||
-rw-r--r-- | lib/status_handler.h (renamed from library/status_handler.h) | 8 | ||||
-rw-r--r-- | lib/xml_base.cpp (renamed from shared/xml_base.cpp) | 42 | ||||
-rw-r--r-- | lib/xml_base.h | 42 | ||||
-rw-r--r-- | resource.rc | 6 | ||||
-rw-r--r-- | shared/app_main.cpp | 29 | ||||
-rw-r--r-- | shared/c_dll.h | 131 | ||||
-rw-r--r-- | shared/check_exist.h | 88 | ||||
-rw-r--r-- | shared/dir_picker_i18n.h | 30 | ||||
-rw-r--r-- | shared/global_func.h | 27 | ||||
-rw-r--r-- | shared/guid.h | 19 | ||||
-rw-r--r-- | shared/help_provider.cpp | 44 | ||||
-rw-r--r-- | shared/i18n.cpp | 21 | ||||
-rw-r--r-- | shared/last_error.h | 24 | ||||
-rw-r--r-- | shared/loki/AbstractFactory.h | 185 | ||||
-rw-r--r-- | shared/loki/Allocator.h | 153 | ||||
-rw-r--r-- | shared/loki/AssocVector.h | 358 | ||||
-rw-r--r-- | shared/loki/CHANGES | 446 | ||||
-rw-r--r-- | shared/loki/CachedFactory.h | 1179 | ||||
-rw-r--r-- | shared/loki/CheckReturn.h | 165 | ||||
-rw-r--r-- | shared/loki/Checker.h | 516 | ||||
-rw-r--r-- | shared/loki/ConstPolicy.h | 61 | ||||
-rw-r--r-- | shared/loki/DataGenerators.h | 113 | ||||
-rw-r--r-- | shared/loki/EmptyType.h | 49 | ||||
-rw-r--r-- | shared/loki/Factory.h | 1084 | ||||
-rw-r--r-- | shared/loki/Function.h | 373 | ||||
-rw-r--r-- | shared/loki/Functor.h | 1790 | ||||
-rw-r--r-- | shared/loki/HierarchyGenerators.h | 291 | ||||
-rw-r--r-- | shared/loki/Key.h | 766 | ||||
-rw-r--r-- | shared/loki/LevelMutex.h | 1211 | ||||
-rw-r--r-- | shared/loki/LockingPtr.h | 110 | ||||
-rw-r--r-- | shared/loki/LokiExport.h | 69 | ||||
-rw-r--r-- | shared/loki/LokiTypeInfo.h | 103 | ||||
-rw-r--r-- | shared/loki/MultiMethods.h | 415 | ||||
-rw-r--r-- | shared/loki/NullType.h | 34 | ||||
-rw-r--r-- | shared/loki/OrderedStatic.h | 225 | ||||
-rw-r--r-- | shared/loki/Pimpl.h | 198 | ||||
-rw-r--r-- | shared/loki/RefToValue.h | 70 | ||||
-rw-r--r-- | shared/loki/Register.h | 134 | ||||
-rw-r--r-- | shared/loki/SPCachedFactory.h | 204 | ||||
-rw-r--r-- | shared/loki/SafeBits.h | 514 | ||||
-rw-r--r-- | shared/loki/SafeFormat.h | 682 | ||||
-rw-r--r-- | shared/loki/ScopeGuard.h | 669 | ||||
-rw-r--r-- | shared/loki/Sequence.h | 49 | ||||
-rw-r--r-- | shared/loki/Singleton.h | 889 | ||||
-rw-r--r-- | shared/loki/SmallObj.cpp | 1226 | ||||
-rw-r--r-- | shared/loki/SmallObj.h | 644 | ||||
-rw-r--r-- | shared/loki/SmartPtr.h | 1778 | ||||
-rw-r--r-- | shared/loki/StrongPtr.h | 1697 | ||||
-rw-r--r-- | shared/loki/Threads.h | 609 | ||||
-rw-r--r-- | shared/loki/Tuple.h | 22 | ||||
-rw-r--r-- | shared/loki/TypeManip.h | 290 | ||||
-rw-r--r-- | shared/loki/TypeTraits.h | 2236 | ||||
-rw-r--r-- | shared/loki/Typelist.h | 459 | ||||
-rw-r--r-- | shared/loki/TypelistMacros.h | 353 | ||||
-rw-r--r-- | shared/loki/Visitor.h | 355 | ||||
-rw-r--r-- | shared/loki/readme.txt | 12 | ||||
-rw-r--r-- | shared/loki/static_check.h | 45 | ||||
-rw-r--r-- | shared/serialize.cpp | 51 | ||||
-rw-r--r-- | shared/standard_paths.h | 26 | ||||
-rw-r--r-- | shared/toggle_button.cpp | 50 | ||||
-rw-r--r-- | shared/util.cpp | 189 | ||||
-rw-r--r-- | shared/util.h | 74 | ||||
-rw-r--r-- | shared/xml_base.h | 21 | ||||
-rw-r--r-- | shared/xml_error.h | 35 | ||||
-rw-r--r-- | structures.cpp | 6 | ||||
-rw-r--r-- | structures.h | 6 | ||||
-rw-r--r-- | synchronization.cpp | 102 | ||||
-rw-r--r-- | synchronization.h | 4 | ||||
-rw-r--r-- | ui/Taskbar_Seven/Taskbar_Seven.vcxproj (renamed from shared/Taskbar_Seven/Taskbar_Seven.vcxproj) | 5 | ||||
-rw-r--r-- | ui/Taskbar_Seven/dll_main.cpp (renamed from shared/Taskbar_Seven/dll_main.cpp) | 0 | ||||
-rw-r--r-- | ui/Taskbar_Seven/taskbar.cpp (renamed from shared/Taskbar_Seven/taskbar.cpp) | 36 | ||||
-rw-r--r-- | ui/Taskbar_Seven/taskbar.h (renamed from shared/Taskbar_Seven/taskbar.h) | 16 | ||||
-rw-r--r-- | ui/batch_config.cpp | 39 | ||||
-rw-r--r-- | ui/batch_config.h | 4 | ||||
-rw-r--r-- | ui/batch_status_handler.cpp | 30 | ||||
-rw-r--r-- | ui/batch_status_handler.h | 6 | ||||
-rw-r--r-- | ui/check_version.cpp | 9 | ||||
-rw-r--r-- | ui/folder_pair.h | 11 | ||||
-rw-r--r-- | ui/grid_view.cpp | 2 | ||||
-rw-r--r-- | ui/gui_generated.cpp | 7329 | ||||
-rw-r--r-- | ui/gui_generated.h | 1673 | ||||
-rw-r--r-- | ui/gui_status_handler.cpp | 4 | ||||
-rw-r--r-- | ui/gui_status_handler.h | 6 | ||||
-rw-r--r-- | ui/main_dlg.cpp | 304 | ||||
-rw-r--r-- | ui/main_dlg.h | 14 | ||||
-rw-r--r-- | ui/msg_popup.cpp | 5 | ||||
-rw-r--r-- | ui/msg_popup.h | 1 | ||||
-rw-r--r-- | ui/progress_indicator.cpp | 277 | ||||
-rw-r--r-- | ui/progress_indicator.h | 4 | ||||
-rw-r--r-- | ui/search.cpp | 2 | ||||
-rw-r--r-- | ui/small_dlgs.cpp | 34 | ||||
-rw-r--r-- | ui/small_dlgs.h | 2 | ||||
-rw-r--r-- | ui/sorting.h | 6 | ||||
-rw-r--r-- | ui/switch_to_gui.cpp | 27 | ||||
-rw-r--r-- | ui/switch_to_gui.h | 25 | ||||
-rw-r--r-- | ui/sync_cfg.cpp | 16 | ||||
-rw-r--r-- | ui/sync_cfg.h | 2 | ||||
-rw-r--r-- | ui/taskbar.cpp (renamed from shared/taskbar.cpp) | 39 | ||||
-rw-r--r-- | ui/taskbar.h (renamed from shared/taskbar.h) | 4 | ||||
-rw-r--r-- | ui/tray_icon.cpp | 5 | ||||
-rw-r--r-- | ui/wx_form_build_hide_warnings.h (renamed from shared/help_provider.h) | 15 | ||||
-rw-r--r-- | version/version.h | 2 | ||||
-rw-r--r-- | version/version.rc | 4 | ||||
-rw-r--r-- | wx+/app_main.h (renamed from shared/app_main.h) | 38 | ||||
-rw-r--r-- | wx+/button.cpp (renamed from shared/custom_button.cpp) | 83 | ||||
-rw-r--r-- | wx+/button.h (renamed from shared/custom_button.h) | 24 | ||||
-rw-r--r-- | wx+/choice_enum.h (renamed from shared/wx_choice_enum.h) | 11 | ||||
-rw-r--r-- | wx+/dir_picker.h | 31 | ||||
-rw-r--r-- | wx+/file_drop.h (renamed from shared/file_drop.h) | 2 | ||||
-rw-r--r-- | wx+/format_unit.cpp | 232 | ||||
-rw-r--r-- | wx+/format_unit.h | 64 | ||||
-rw-r--r-- | wx+/graph.cpp | 540 | ||||
-rw-r--r-- | wx+/graph.h | 325 | ||||
-rw-r--r-- | wx+/image_tools.h (renamed from shared/image_tools.h) | 0 | ||||
-rw-r--r-- | wx+/mouse_move_dlg.cpp (renamed from shared/mouse_move_dlg.cpp) | 41 | ||||
-rw-r--r-- | wx+/mouse_move_dlg.h (renamed from shared/mouse_move_dlg.h) | 2 | ||||
-rw-r--r-- | wx+/pch.h (renamed from shared/pch.h) | 7 | ||||
-rw-r--r-- | wx+/serialize.h (renamed from shared/serialize.h) | 80 | ||||
-rw-r--r-- | wx+/shell_execute.h (renamed from shared/shell_execute.h) | 8 | ||||
-rw-r--r-- | wx+/string_conv.h (renamed from shared/string_conv.h) | 4 | ||||
-rw-r--r-- | wx+/timespan.h (renamed from shared/wx_timespan.h) | 0 | ||||
-rw-r--r-- | wx+/toggle_button.h (renamed from shared/toggle_button.h) | 49 | ||||
-rw-r--r-- | wx+/tooltip.cpp (renamed from shared/custom_tooltip.cpp) | 61 | ||||
-rw-r--r-- | wx+/tooltip.h (renamed from shared/custom_tooltip.h) | 9 | ||||
-rw-r--r-- | zen/assert_static.h (renamed from shared/assert_static.h) | 14 | ||||
-rw-r--r-- | zen/base64.h (renamed from shared/base64.h) | 0 | ||||
-rw-r--r-- | zen/basic_math.h | 356 | ||||
-rw-r--r-- | zen/build_info.h (renamed from shared/build_info.h) | 4 | ||||
-rw-r--r-- | zen/com_error.h (renamed from shared/com_error.h) | 20 | ||||
-rw-r--r-- | zen/com_ptr.h (renamed from shared/com_ptr.h) | 16 | ||||
-rw-r--r-- | zen/com_util.h (renamed from shared/com_util.h) | 18 | ||||
-rw-r--r-- | zen/debug_log.h (renamed from shared/debug_log.h) | 18 | ||||
-rw-r--r-- | zen/debug_new.cpp (renamed from shared/debug_new.cpp) | 22 | ||||
-rw-r--r-- | zen/debug_new.h (renamed from shared/debug_new.h) | 1 | ||||
-rw-r--r-- | zen/dir_watcher.cpp (renamed from shared/dir_watcher.cpp) | 108 | ||||
-rw-r--r-- | zen/dir_watcher.h (renamed from shared/dir_watcher.h) | 4 | ||||
-rw-r--r-- | zen/disable_standby.h (renamed from shared/disable_standby.h) | 4 | ||||
-rw-r--r-- | zen/dll.h (renamed from shared/dll_loader.h) | 40 | ||||
-rw-r--r-- | zen/dst_hack.cpp (renamed from shared/dst_hack.cpp) | 32 | ||||
-rw-r--r-- | zen/dst_hack.h (renamed from shared/dst_hack.h) | 2 | ||||
-rw-r--r-- | zen/file_error.h (renamed from shared/file_error.h) | 6 | ||||
-rw-r--r-- | zen/file_handling.cpp (renamed from shared/file_handling.cpp) | 145 | ||||
-rw-r--r-- | zen/file_handling.h (renamed from shared/file_handling.h) | 8 | ||||
-rw-r--r-- | zen/file_id.cpp (renamed from shared/file_id.cpp) | 16 | ||||
-rw-r--r-- | zen/file_id.h (renamed from shared/file_id.h) | 9 | ||||
-rw-r--r-- | zen/file_id_internal.h (renamed from shared/file_id_internal.h) | 2 | ||||
-rw-r--r-- | zen/file_io.cpp (renamed from shared/file_io.cpp) | 6 | ||||
-rw-r--r-- | zen/file_io.h (renamed from shared/file_io.h) | 5 | ||||
-rw-r--r-- | zen/file_traverser.cpp (renamed from shared/file_traverser.cpp) | 376 | ||||
-rw-r--r-- | zen/file_traverser.h (renamed from shared/file_traverser.h) | 6 | ||||
-rw-r--r-- | zen/file_update_handle.h (renamed from shared/file_update_handle.h) | 6 | ||||
-rw-r--r-- | zen/fixed_list.h (renamed from shared/fixed_list.h) | 26 | ||||
-rw-r--r-- | zen/guid.h (renamed from shared/guid.cpp) | 20 | ||||
-rw-r--r-- | zen/i18n.h (renamed from shared/i18n.h) | 63 | ||||
-rw-r--r-- | zen/int64.h (renamed from shared/int64.h) | 90 | ||||
-rw-r--r-- | zen/last_error.h (renamed from shared/last_error.cpp) | 57 | ||||
-rw-r--r-- | zen/long_path_prefix.h (renamed from shared/long_path_prefix.h) | 30 | ||||
-rw-r--r-- | zen/notify_removal.cpp (renamed from shared/notify_removal.cpp) | 12 | ||||
-rw-r--r-- | zen/notify_removal.h (renamed from shared/notify_removal.h) | 8 | ||||
-rw-r--r-- | zen/perf.h (renamed from shared/perf.h) | 13 | ||||
-rw-r--r-- | zen/privilege.cpp (renamed from shared/privilege.cpp) | 8 | ||||
-rw-r--r-- | zen/privilege.h (renamed from shared/privilege.h) | 9 | ||||
-rw-r--r-- | zen/read_txt.cpp (renamed from shared/parse_txt.cpp) | 4 | ||||
-rw-r--r-- | zen/read_txt.h (renamed from shared/parse_txt.h) | 0 | ||||
-rw-r--r-- | zen/scope_guard.h | 77 | ||||
-rw-r--r-- | zen/stl_tools.h (renamed from shared/stl_tools.h) | 0 | ||||
-rw-r--r-- | zen/string_base.h (renamed from shared/zbase.h) | 227 | ||||
-rw-r--r-- | zen/string_tools.h (renamed from shared/string_tools.h) | 318 | ||||
-rw-r--r-- | zen/string_traits.h | 176 | ||||
-rw-r--r-- | zen/symlink_target.h (renamed from shared/symlink_target.h) | 17 | ||||
-rw-r--r-- | zen/thread.h | 92 | ||||
-rw-r--r-- | zen/type_tools.h | 74 | ||||
-rw-r--r-- | zen/type_traits.h | 88 | ||||
-rw-r--r-- | zen/utf8.h (renamed from shared/string_utf8.h) | 47 | ||||
-rw-r--r-- | zen/warn_static.h (renamed from shared/warn_static.h) | 13 | ||||
-rw-r--r-- | zen/win.h | 30 | ||||
-rw-r--r-- | zen/win_ver.h | 72 | ||||
-rw-r--r-- | zen/zstring.cpp (renamed from shared/zstring.cpp) | 55 | ||||
-rw-r--r-- | zen/zstring.h (renamed from shared/zstring.h) | 10 |
308 files changed, 12192 insertions, 33603 deletions
diff --git a/Application.cpp b/Application.cpp index 638cffbc..1a08c55c 100644 --- a/Application.cpp +++ b/Application.cpp @@ -14,25 +14,23 @@ #include "ui/batch_status_handler.h" #include "ui/check_version.h" #include <wx/file.h> -#include "library/resources.h" +#include "lib/resources.h" #include "ui/switch_to_gui.h" -#include "shared/standard_paths.h" -#include "shared/i18n.h" -#include "shared/app_main.h" +#include "lib/ffs_paths.h" +#include <wx+/app_main.h> #include <wx/sound.h> -#include "shared/file_handling.h" -#include "shared/string_conv.h" -#include "shared/util.h" +#include <zen/file_handling.h> +#include <wx+/string_conv.h> #include <wx/log.h> -#include "library/lock_holder.h" +#include "lib/lock_holder.h" #ifdef FFS_LINUX #include <gtkmm/main.h> #include <gtk/gtk.h> #endif - using namespace zen; +using namespace xmlAccess; IMPLEMENT_APP(Application) @@ -53,25 +51,12 @@ bool Application::OnInit() void Application::OnStartApplication(wxIdleEvent&) { - using namespace zen; - Disconnect(wxEVT_IDLE, wxIdleEventHandler(Application::OnStartApplication), NULL, this); - struct HandleAppExit //wxWidgets app exit handling is a bit weird... we want the app to exit only if the logical main window is closed - { - HandleAppExit() - { - wxTheApp->SetExitOnFrameDelete(false); //avoid popup-windows from becoming temporary top windows leading to program exit after closure - } - - ~HandleAppExit() - { - if (!zen::AppMainWindow::mainWindowWasSet()) - wxTheApp->ExitMainLoop(); //quit application, if no main window was set (batch silent mode) - } - - } dummy; - + //wxWidgets app exit handling is quite weird... we want the app to exit only if the logical main window is closed + wxTheApp->SetExitOnFrameDelete(false); //avoid popup-windows from becoming temporary top windows leading to program exit after closure + wxApp* app = wxTheApp; + ZEN_ON_BLOCK_EXIT(if (!mainWindowWasSet()) app->ExitMainLoop();); //quit application, if no main window was set (batch silent mode) //if appname is not set, the default is the executable's name! SetAppName(wxT("FreeFileSync")); @@ -79,7 +64,7 @@ void Application::OnStartApplication(wxIdleEvent&) #ifdef FFS_LINUX Gtk::Main::init_gtkmm_internals(); - ::gtk_rc_parse((Zstring(zen::getResourceDir()) + "styles.rc").c_str()); //remove inner border from bitmap buttons + ::gtk_rc_parse((Zstring(getResourceDir()) + "styles.rc").c_str()); //remove inner border from bitmap buttons #endif @@ -91,67 +76,117 @@ void Application::OnStartApplication(wxIdleEvent&) try //load global settings from XML: they are written on exit, so read them FIRST { - if (fileExists(toZ(xmlAccess::getGlobalConfigFile()))) - xmlAccess::readConfig(globalSettings); + if (fileExists(toZ(getGlobalConfigFile()))) + readConfig(globalSettings); //else: globalSettings already has default values } catch (const xmlAccess::FfsXmlError& error) { //show messagebox and continue - if (error.getSeverity() == xmlAccess::FfsXmlError::WARNING) + if (error.getSeverity() == FfsXmlError::WARNING) ; //wxMessageBox(error.msg(), _("Warning"), wxOK | wxICON_WARNING); -> ignore parsing errors: should be migration problems only *cross-fingers* else wxMessageBox(error.msg(), _("Error"), wxOK | wxICON_ERROR); } //set program language - zen::setLanguage(globalSettings.programLanguage); + setLanguage(globalSettings.programLanguage); //test if FFS is to be started on UI with config file passed as commandline parameter + std::vector<wxString> commandArgs; + for (int i = 1; i < argc; ++i) + commandArgs.push_back(argv[i]); - //try to set config/batch-filename set by %1 parameter - wxString cfgFilename; - if (argc > 1) + bool gotDirNames = false; + for (auto iter = commandArgs.begin(); iter != commandArgs.end(); ++iter) { - const wxString arg1(argv[1]); - - if (fileExists(toZ(arg1))) //load file specified by %1 parameter: - cfgFilename = arg1; - else if (fileExists(toZ(arg1 + wxT(".ffs_batch")))) - cfgFilename = arg1 + wxT(".ffs_batch"); - else if (fileExists(toZ(arg1 + wxT(".ffs_gui")))) - cfgFilename = arg1 + wxT(".ffs_gui"); - else + Zstring filename = toZ(*iter); + + if (iter == commandArgs.begin() && dirExists(filename)) //detect which "mode" by testing first command line argument { - wxMessageBox(wxString(_("File does not exist:")) + wxT(" \"") + arg1 + wxT("\""), _("Error"), wxOK | wxICON_ERROR); - returnValue = -13; - return; + gotDirNames = true; + break; } - } - if (!cfgFilename.empty()) - { - //load file specified by %1 parameter: - const xmlAccess::XmlType xmlConfigType = xmlAccess::getXmlType(cfgFilename); - switch (xmlConfigType) + if (!fileExists(filename)) //be a little tolerant { - case xmlAccess::XML_TYPE_GUI: //start in GUI mode (configuration file specified) - runGuiMode(cfgFilename, globalSettings); - break; - - case xmlAccess::XML_TYPE_BATCH: //start in commandline mode - runBatchMode(cfgFilename, globalSettings); - break; - - case xmlAccess::XML_TYPE_GLOBAL: - case xmlAccess::XML_TYPE_OTHER: - wxMessageBox(wxString(_("The file does not contain a valid configuration:")) + wxT(" \"") + cfgFilename + wxT("\""), _("Error"), wxOK | wxICON_ERROR); - break; + if (fileExists(filename + Zstr(".ffs_batch"))) + filename = filename + Zstr(".ffs_batch"); + else if (fileExists(filename + Zstr(".ffs_gui"))) + filename = filename + Zstr(".ffs_gui"); + else + { + wxMessageBox(wxString(_("File does not exist:")) + wxT(" \"") + filename + wxT("\""), _("Error"), wxOK | wxICON_ERROR); + return; + } } } - else //start in GUI mode (standard) - runGuiMode(wxEmptyString, globalSettings); + + if (commandArgs.empty()) + runGuiMode(commandArgs, globalSettings); + else if (gotDirNames) //mode 1: create temp configuration based on directory names passed + { + XmlGuiConfig guiCfg; + guiCfg.mainCfg.syncCfg.directionCfg.var = DirectionConfig::MIRROR; + + for (auto iter = commandArgs.begin(); iter != commandArgs.end(); ++iter) + { + size_t index = iter - commandArgs.begin(); + Zstring dirname = toZ(*iter); + + FolderPairEnh& fp = [&]() -> FolderPairEnh& + { + if (index < 2) + return guiCfg.mainCfg.firstPair; + + guiCfg.mainCfg.additionalPairs.resize((index - 2) / 2 + 1); + return guiCfg.mainCfg.additionalPairs.back(); + }(); + + if (index % 2 == 0) + fp.leftDirectory = dirname; + else if (index % 2 == 1) + fp.rightDirectory = dirname; + } + + runGuiMode(guiCfg, globalSettings); + } + else //mode 2: try to set config/batch-filename set by %1 parameter + switch (getMergeType(commandArgs)) //throw () + { + case MERGE_BATCH: //pure batch config files + if (commandArgs.size() == 1) + runBatchMode(commandArgs[0], globalSettings); + else + runGuiMode(commandArgs, globalSettings); + break; + + case MERGE_GUI: //pure gui config files + case MERGE_GUI_BATCH: //gui and batch files + runGuiMode(commandArgs, globalSettings); + break; + + case MERGE_OTHER: //= none or unknown; + //commandArgs are not empty and contain at least one non-gui/non-batch config file: find it! + std::find_if(commandArgs.begin(), commandArgs.end(), + [](const wxString& filename) -> bool + { + switch (getXmlType(filename)) //throw() + { + case XML_TYPE_GLOBAL: + case XML_TYPE_OTHER: + wxMessageBox(wxString(_("The file does not contain a valid configuration:")) + wxT(" \"") + filename + wxT("\""), _("Error"), wxOK | wxICON_ERROR); + return true; + + case XML_TYPE_GUI: + case XML_TYPE_BATCH: + break; + } + return false; + }); + break; + } } @@ -170,7 +205,7 @@ int Application::OnRun() catch (const std::exception& e) //catch all STL exceptions { //unfortunately it's not always possible to display a message box in this erroneous situation, however (non-stream) file output always works! - wxFile safeOutput(zen::getConfigDir() + wxT("LastError.txt"), wxFile::write); + wxFile safeOutput(getConfigDir() + wxT("LastError.txt"), wxFile::write); safeOutput.Write(wxString::FromAscii(e.what())); wxSafeShowMessage(_("An exception occurred!") + L" - FFS", wxString::FromAscii(e.what())); @@ -178,7 +213,7 @@ int Application::OnRun() } catch (...) //catch the rest { - wxFile safeOutput(zen::getConfigDir() + wxT("LastError.txt"), wxFile::write); + wxFile safeOutput(getConfigDir() + wxT("LastError.txt"), wxFile::write); safeOutput.Write(wxT("Unknown exception!")); wxSafeShowMessage(_("An exception occurred!"), wxT("Unknown exception!")); @@ -192,7 +227,7 @@ int Application::OnRun() int Application::OnExit() { //get program language - globalSettings.programLanguage = zen::getLanguage(); + globalSettings.programLanguage = getLanguage(); try //save global settings to XML { @@ -208,21 +243,29 @@ int Application::OnExit() } -void Application::runGuiMode(const wxString& cfgFileName, xmlAccess::XmlGlobalSettings& settings) +void Application::runGuiMode(const xmlAccess::XmlGuiConfig& guiCfg, xmlAccess::XmlGlobalSettings& settings) +{ + MainDialog* frame = new MainDialog(std::vector<wxString>(), guiCfg, settings, true); + frame->Show(); +} + + +void Application::runGuiMode(const std::vector<wxString>& cfgFileNames, xmlAccess::XmlGlobalSettings& settings) { - MainDialog* frame = new MainDialog(cfgFileName, settings); + MainDialog* frame = new MainDialog(cfgFileNames, settings); frame->Show(); } + void Application::runBatchMode(const wxString& filename, xmlAccess::XmlGlobalSettings& globSettings) { using namespace xmlAccess; - + using namespace zen; //load XML settings - xmlAccess::XmlBatchConfig batchCfg; //structure to receive gui settings + XmlBatchConfig batchCfg; //structure to receive gui settings try { - xmlAccess::readConfig(filename, batchCfg); + readConfig(filename, batchCfg); } catch (const xmlAccess::FfsXmlError& error) { @@ -233,25 +276,36 @@ void Application::runBatchMode(const wxString& filename, xmlAccess::XmlGlobalSet //regular check for program updates -> disabled for batch //if (!batchCfg.silent) - // zen::checkForUpdatePeriodically(globSettings.lastUpdateCheck); + // checkForUpdatePeriodically(globSettings.lastUpdateCheck); try //begin of synchronization process (all in one try-catch block) { - const SwitchToGui switchBatchToGui(batchCfg, globSettings); //prepare potential operational switch + const SwitchToGui switchBatchToGui(filename, batchCfg, globSettings); //prepare potential operational switch //class handling status updates and error messages BatchStatusHandler statusHandler(batchCfg.silent, - zen::extractJobName(filename), + extractJobName(filename), batchCfg.logFileDirectory, batchCfg.logFileCountMax, batchCfg.handleError, switchBatchToGui, returnValue); - const std::vector<zen::FolderPairCfg> cmpConfig = zen::extractCompareCfg(batchCfg.mainCfg); + const std::vector<FolderPairCfg> cmpConfig = extractCompareCfg(batchCfg.mainCfg); + + bool allowPwPrompt = false; + switch (batchCfg.handleError) + { + case ON_ERROR_POPUP: + allowPwPrompt = true; + break; + case ON_ERROR_IGNORE: + case ON_ERROR_EXIT: + break; + } //batch mode: place directory locks on directories during both comparison AND synchronization - LockHolder dummy; + LockHolder dummy(allowPwPrompt); std::for_each(cmpConfig.begin(), cmpConfig.end(), [&](const FolderPairCfg& fpCfg) { @@ -260,15 +314,16 @@ void Application::runBatchMode(const wxString& filename, xmlAccess::XmlGlobalSet }); //COMPARE DIRECTORIES - zen::CompareProcess cmpProc(globSettings.fileTimeTolerance, - globSettings.optDialogs, - statusHandler); + CompareProcess cmpProc(globSettings.fileTimeTolerance, + globSettings.optDialogs, + allowPwPrompt, + statusHandler); - zen::FolderComparison folderCmp; + FolderComparison folderCmp; cmpProc.startCompareProcess(cmpConfig, folderCmp); //START SYNCHRONIZATION - zen::SyncProcess syncProc( + SyncProcess syncProc( globSettings.optDialogs, globSettings.verifyFileCopy, globSettings.copyLockedFiles, @@ -276,7 +331,7 @@ void Application::runBatchMode(const wxString& filename, xmlAccess::XmlGlobalSet globSettings.transactionalFileCopy, statusHandler); - const std::vector<zen::FolderPairSyncCfg> syncProcessCfg = zen::extractSyncCfg(batchCfg.mainCfg); + const std::vector<FolderPairSyncCfg> syncProcessCfg = extractSyncCfg(batchCfg.mainCfg); assert(syncProcessCfg.size() == folderCmp.size()); syncProc.startSynchronizationProcess(syncProcessCfg, folderCmp); @@ -284,8 +339,8 @@ void Application::runBatchMode(const wxString& filename, xmlAccess::XmlGlobalSet //play (optional) sound notification after sync has completed if (!batchCfg.silent) { - const wxString soundFile = zen::getResourceDir() + wxT("Sync_Complete.wav"); - if (zen::fileExists(zen::toZ(soundFile))) + const wxString soundFile = getResourceDir() + wxT("Sync_Complete.wav"); + if (fileExists(toZ(soundFile))) wxSound::Play(soundFile, wxSOUND_ASYNC); //warning: this may fail and show a wxWidgets error message! => must not play when running FFS as a service! } } diff --git a/Application.h b/Application.h index d26fd59f..050db138 100644 --- a/Application.h +++ b/Application.h @@ -8,7 +8,7 @@ #define FREEFILESYNCAPP_H #include <wx/app.h> -#include "library/process_xml.h" +#include "lib/process_xml.h" class Application : public wxApp @@ -21,7 +21,8 @@ public: void OnStartApplication(wxIdleEvent& event); private: - void runGuiMode(const wxString& cfgFileName, xmlAccess::XmlGlobalSettings& settings); + void runGuiMode(const xmlAccess::XmlGuiConfig& guiCfg, xmlAccess::XmlGlobalSettings& settings); + void runGuiMode(const std::vector<wxString>& cfgFileName, xmlAccess::XmlGlobalSettings& settings); void runBatchMode(const wxString& filename, xmlAccess::XmlGlobalSettings& globSettings); xmlAccess::XmlGlobalSettings globalSettings; //settings used by GUI, batch mode or both diff --git a/BUILD/Changelog.txt b/BUILD/Changelog.txt index 428f11ee..b1c298c0 100644 --- a/BUILD/Changelog.txt +++ b/BUILD/Changelog.txt @@ -2,6 +2,24 @@ |FreeFileSync| -------------- +Changelog v4.2 +--------------- + + +Changelog v4.1 +--------------- +Improved synchronization progress dialog +Show all available aliases in directory history list +Show password prompt when connecting to mapped network share +Removed busy cursor after program startup +RealtimeSync: atomically detect missing directories +Handle not existing reference by volume name as an invalid path +Improved startup responsiveness by checking dir/file existence asynchronously +Fixed loading incorrect directory name when using multiple folder pairs +Allow passing multiple configurations via command line +Allow passing multiple directory names via command line + + Changelog v4.0 --------------- Thumbnail list view diff --git a/BUILD/FreeFileSync.chm b/BUILD/FreeFileSync.chm Binary files differindex 891d3310..4ecd5aa0 100644 --- a/BUILD/FreeFileSync.chm +++ b/BUILD/FreeFileSync.chm diff --git a/BUILD/Help/html/Links.html b/BUILD/Help/html/Links.html index 71a55ebb..527146d4 100644 --- a/BUILD/Help/html/Links.html +++ b/BUILD/Help/html/Links.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="20110819;12441400"> + <META NAME="CHANGED" CONTENT="20110928;12294600"> <STYLE TYPE="text/css"> <!-- @page { margin: 2cm } @@ -37,6 +37,6 @@ report directly to:<BR><A HREF="http://sourceforge.net/tracker/?group_id=234430" <P STYLE="margin-bottom: 0cm"><BR> </P> <P STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif">Support -the FreeFileSync project:<BR><A HREF="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=zhnmju123%40gmx%2Ede&no_shipping=0&no_note=1&tax=0&currency_code=EUR&lc=EN&bn=PP%2DDonationsBF&charset=UTF%2D8">Paypal</A></FONT></P> +the FreeFileSync project:<BR><A HREF="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=zhnmju123@gmx.de&lc=US&currency_code=EUR">Paypal</A></FONT></P> </BODY> </HTML>
\ No newline at end of file diff --git a/BUILD/Help/html/Macros.html b/BUILD/Help/html/Macros.html index d3c48d1d..405eb50a 100644 --- a/BUILD/Help/html/Macros.html +++ b/BUILD/Help/html/Macros.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="20110909;23060200"> + <META NAME="CHANGED" CONTENT="20111003;13383700"> <META NAME="Info 1" CONTENT=""> <META NAME="Info 2" CONTENT=""> <META NAME="Info 3" CONTENT=""> @@ -90,9 +90,9 @@ folder locations </B><SPAN STYLE="font-weight: normal">(Windows)</SPAN></FONT></ <FONT FACE="Courier New, monospace">C:\Users\username\Favorites<BR>%csidl_Templates% </FONT>e. g. <FONT FACE="Courier New, monospace">C:\Users\username\Templates<BR>%csidl_Resources% </FONT>e. g. <FONT FACE="Courier New, monospace">C:\Windows\Resources</FONT></FONT></P> -</SPAN><BR CLEAR=LEFT>Note: Each user configuration folder has a -public version. E.g. <FONT FACE="Courier New, monospace">csidl_MyMusic</FONT> -→ <FONT FACE="Courier New, monospace">csidl_PublicMusic</FONT> +</SPAN><BR CLEAR=LEFT>Note: Each macro for a user folder has a public +version. E.g. <FONT FACE="Courier New, monospace">csidl_MyMusic</FONT> +→ <FONT FACE="Courier New, monospace">csidl_PublicMusic</FONT> </P> <P STYLE="margin-bottom: 0cm"><BR> </P> diff --git a/BUILD/Invisible.vbs b/BUILD/Invisible.vbs index 47c60726..8d1b7b80 100644 --- a/BUILD/Invisible.vbs +++ b/BUILD/Invisible.vbs @@ -2,8 +2,8 @@ set argIn = WScript.Arguments num = argIn.Count if num = 0 then - WScript.Echo "Call a batch file silently" & VbCrLf & VbCrLf &_ - "Usage: WScript Invisible.vbs MyBatchfile.cmd <command line arguments>" + WScript.Echo "Call a Windows batch file (*.cmd, *.bat) without showing the console window" & VbCrLf & VbCrLf &_ + "Command line:" & VbCrLf & "WScript Invisible.vbs MyBatchfile.cmd <command line arguments>" WScript.Quit 1 end if diff --git a/BUILD/Languages/chinese_simple.lng b/BUILD/Languages/chinese_simple.lng index 72707f4d..2d7a702c 100644 --- a/BUILD/Languages/chinese_simple.lng +++ b/BUILD/Languages/chinese_simple.lng @@ -25,6 +25,12 @@ <source>Browse</source> <target>浏览</target> +<source>Windows Error Code %x:</source> +<target>Windows错误代码 %x:</target> + +<source>Linux Error Code %x:</source> +<target>Linux错误代码 %x:</target> + <source>Invalid command line: %x</source> <target>无效的命令行: %x</target> @@ -223,30 +229,6 @@ <source>/sec</source> <target>/秒</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>%x 分</pluralform> -</target> - -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>%x 小时</pluralform> -</target> - -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>%x 天</pluralform> -</target> - <source>S&ave configuration...</source> <target>保存配置(&A)...</target> @@ -405,27 +387,21 @@ The command line is executed each time: <source>Operation aborted!</source> <target>操作已取消!</target> -<source>Could not load a required DLL:</source> -<target>不能加载所需的动态连接库:</target> - <source>Endless loop when traversing directory:</source> <target>遍历目录时出现无限循环:</target> <source>Error traversing directory:</source> <target>遍历目录出错:</target> -<source>Windows Error Code %x:</source> -<target>Windows错误代码 %x:</target> - -<source>Linux Error Code %x:</source> -<target>Linux错误代码 %x:</target> - <source>Error setting privilege:</source> <target>设置权限时出错:</target> <source>Error moving to Recycle Bin:</source> <target>移动到回收站出错:</target> +<source>Could not load a required DLL:</source> +<target>不能加载所需的动态连接库:</target> + <source>Error writing to synchronization database:</source> <target>向同步数据库中写入时出错:</target> @@ -450,6 +426,30 @@ The command line is executed each time: <source>%x%</source> <target>%x%</target> +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>%x 分</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>%x 小时</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>%x 天</pluralform> +</target> + <source>Could not read values for the following XML nodes:</source> <target>不能从如下XML节点读取数值:</target> @@ -648,10 +648,13 @@ The command line is executed each time: <source>&Cancel</source> <target>取消(&C)</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>操作:</target> + +<source>Items found:</source> <target>已找到的元素:</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>剩余的元素:</target> <source>Speed:</source> @@ -663,9 +666,6 @@ The command line is executed each time: <source>Time elapsed:</source> <target>已用时间:</target> -<source>Operation:</source> -<target>操作:</target> - <source>Select variant:</source> <target>选择变化的:</target> @@ -765,7 +765,7 @@ is the same <source>Synchronizing...</source> <target>同步中...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>已处理的元素:</target> <source>&Pause</source> @@ -894,8 +894,8 @@ Exclude: \stuff\temp\* <source>Transactional file copy</source> <target>事务文件复制</target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> -<target>首先写文件到临时文件(*.ffs_tmp)然后重命名. 如此保证了一致性,即使在出现致命错误的情况下.</target> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> +<target></target> <source>Copy locked files</source> <target>复制被锁定的文件</target> diff --git a/BUILD/Languages/chinese_traditional.lng b/BUILD/Languages/chinese_traditional.lng index 62b2912e..25bcd84d 100644 --- a/BUILD/Languages/chinese_traditional.lng +++ b/BUILD/Languages/chinese_traditional.lng @@ -25,6 +25,12 @@ <source>Browse</source> <target>瀏覽</target> +<source>Windows Error Code %x:</source> +<target>Windows 錯誤代碼 %x:</target> + +<source>Linux Error Code %x:</source> +<target>Linux 錯誤代碼 %x:</target> + <source>Invalid command line: %x</source> <target>無效的命令列:%x</target> @@ -223,30 +229,6 @@ <source>/sec</source> <target>/秒</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>%x 分</pluralform> -</target> - -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>%x 小時</pluralform> -</target> - -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>%x 天</pluralform> -</target> - <source>S&ave configuration...</source> <target>儲存配置(&A)...</target> @@ -411,12 +393,6 @@ The command line is executed each time: <source>Error traversing directory:</source> <target>遍歷目錄錯誤:</target> -<source>Windows Error Code %x:</source> -<target>Windows 錯誤代碼 %x:</target> - -<source>Linux Error Code %x:</source> -<target>Linux 錯誤代碼 %x:</target> - <source>Error setting privilege:</source> <target>設定權限錯誤:</target> @@ -450,6 +426,30 @@ The command line is executed each time: <source>%x%</source> <target>%x%</target> +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>%x 分</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>%x 小時</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>%x 天</pluralform> +</target> + <source>Could not read values for the following XML nodes:</source> <target>無法讀取 XML 之後節點的值:</target> @@ -648,10 +648,13 @@ The command line is executed each time: <source>&Cancel</source> <target>取消(&C)</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>操作:</target> + +<source>Items found:</source> <target>尋找要素:</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>剩餘要素:</target> <source>Speed:</source> @@ -663,9 +666,6 @@ The command line is executed each time: <source>Time elapsed:</source> <target>經過時間:</target> -<source>Operation:</source> -<target>操作:</target> - <source>Select variant:</source> <target>選擇變數:</target> @@ -756,7 +756,7 @@ is the same <source>Synchronizing...</source> <target>正在同步...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>已處理要素:</target> <source>&Pause</source> @@ -885,8 +885,8 @@ Exclude: \stuff\temp\* <source>Transactional file copy</source> <target>異動檔案副本</target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> -<target>第一次將檔寫入到一個暫存 (*.ffs_tmp) 順便將它們重新命名。即使在嚴重錯誤的情況下,還可確保一致的狀態。</target> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> +<target></target> <source>Copy locked files</source> <target>複製被鎖定的檔案</target> diff --git a/BUILD/Languages/czech.lng b/BUILD/Languages/czech.lng index f7da8b36..6589b85d 100644 --- a/BUILD/Languages/czech.lng +++ b/BUILD/Languages/czech.lng @@ -25,6 +25,12 @@ <source>Browse</source> <target>Procházet</target> +<source>Windows Error Code %x:</source> +<target>Chybový kód Windows %x:</target> + +<source>Linux Error Code %x:</source> +<target>Chybový kód Linux %x:</target> + <source>Invalid command line: %x</source> <target>Neplatný příkaz: %x</target> @@ -229,36 +235,6 @@ <source>/sec</source> <target>/s</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>1 minuta</pluralform> -<pluralform>%x minuty</pluralform> -<pluralform>%x minut</pluralform> -</target> - -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>1 hodina</pluralform> -<pluralform>%x hodiny</pluralform> -<pluralform>%x hodin</pluralform> -</target> - -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>1 den</pluralform> -<pluralform>%x dny</pluralform> -<pluralform>%x dnů</pluralform> -</target> - <source>S&ave configuration...</source> <target>&Uložení konfigurace...</target> @@ -423,12 +399,6 @@ Příkazová řádka je spuštěna pokaždé když: <source>Error traversing directory:</source> <target>Chyba procházení adresáře:</target> -<source>Windows Error Code %x:</source> -<target>Chybový kód Windows %x:</target> - -<source>Linux Error Code %x:</source> -<target>Chybový kód Linux %x:</target> - <source>Error setting privilege:</source> <target>Chyba nastavení práv:</target> @@ -462,6 +432,36 @@ Příkazová řádka je spuštěna pokaždé když: <source>%x%</source> <target>%x%</target> +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>1 minuta</pluralform> +<pluralform>%x minuty</pluralform> +<pluralform>%x minut</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>1 hodina</pluralform> +<pluralform>%x hodiny</pluralform> +<pluralform>%x hodin</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>1 den</pluralform> +<pluralform>%x dny</pluralform> +<pluralform>%x dnů</pluralform> +</target> + <source>Could not read values for the following XML nodes:</source> <target>Nelze načíst hodnoty následujících XML elementy:</target> @@ -660,10 +660,13 @@ Příkazová řádka je spuštěna pokaždé když: <source>&Cancel</source> <target>&Zrušit</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>Operace:</target> + +<source>Items found:</source> <target>Nalezeno položek:</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>Zbývá položek:</target> <source>Speed:</source> @@ -675,9 +678,6 @@ Příkazová řádka je spuštěna pokaždé když: <source>Time elapsed:</source> <target>Uplynulý čas:</target> -<source>Operation:</source> -<target>Operace:</target> - <source>Select variant:</source> <target>Vyberte variantu:</target> @@ -777,7 +777,7 @@ je stejný <source>Synchronizing...</source> <target>Synchronizuji...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>Zpracováno položek:</target> <source>&Pause</source> @@ -906,8 +906,8 @@ Vynechat: \někde\něco\* <source>Transactional file copy</source> <target>Bezpečné kopírování souborů</target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> -<target>Kopíruje data nejprve do pomocného souboru (*.ffs_tmp) a poté teprve soubor přejmenuje. Tento postup zajišťuje bezpečné chování i v případě chyby během přenosu</target> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> +<target></target> <source>Copy locked files</source> <target>Kopírovat zamčené soubory</target> @@ -1002,6 +1002,18 @@ Přenést přístupová oprávnění souborů a adresářů <source>Auto-adjust columns</source> <target>Automaticky přizpůsobit šířku</target> +<source>Icon size:</source> +<target></target> + +<source>Small</source> +<target></target> + +<source>Medium</source> +<target></target> + +<source>Large</source> +<target></target> + <source>Include all rows</source> <target>Použít všechny řádky</target> diff --git a/BUILD/Languages/danish.lng b/BUILD/Languages/danish.lng index 4b52e2f7..8b02fc1f 100644 --- a/BUILD/Languages/danish.lng +++ b/BUILD/Languages/danish.lng @@ -25,6 +25,12 @@ <source>Browse</source> <target>Gennemse</target> +<source>Windows Error Code %x:</source> +<target>Windows Fejl kode %x:</target> + +<source>Linux Error Code %x:</source> +<target>Linux Fejl kode %x:</target> + <source>Invalid command line: %x</source> <target>Ugyldig kommando: %x</target> @@ -226,33 +232,6 @@ <source>/sec</source> <target>/sek</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</target> - -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>1 timer</pluralform> -<pluralform>%x timer</pluralform> -</target> - -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>1 dag</pluralform> -<pluralform>%x dage</pluralform> -</target> - <source>S&ave configuration...</source> <target>G&em konfiguration...</target> @@ -411,27 +390,21 @@ Kommando linjen bliver afviklet hver gang: <source>Operation aborted!</source> <target>Operation afbrudt!</target> -<source>Could not load a required DLL:</source> -<target>Kunne ikke hente en krævet DLL:</target> - <source>Endless loop when traversing directory:</source> <target>Uendelig løkke ved gennemgang af bibliotek:</target> <source>Error traversing directory:</source> <target>Fejl i gennemgang af bibliotek:</target> -<source>Windows Error Code %x:</source> -<target>Windows Fejl kode %x:</target> - -<source>Linux Error Code %x:</source> -<target>Linux Fejl kode %x:</target> - <source>Error setting privilege:</source> <target>Fejl i at sætte privilegier:</target> <source>Error moving to Recycle Bin:</source> <target>Fejl i at flytte til skraldespand:</target> +<source>Could not load a required DLL:</source> +<target>Kunne ikke hente en krævet DLL:</target> + <source>Error writing to synchronization database:</source> <target>Fejl i skrivning til synkroniserings databasen:</target> @@ -456,6 +429,33 @@ Kommando linjen bliver afviklet hver gang: <source>%x%</source> <target>%x%</target> +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>1 timer</pluralform> +<pluralform>%x timer</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>1 dag</pluralform> +<pluralform>%x dage</pluralform> +</target> + <source>Could not read values for the following XML nodes:</source> <target>Kunne ikke læse værdierne for følgende XML punkter:</target> @@ -654,10 +654,13 @@ Kommando linjen bliver afviklet hver gang: <source>&Cancel</source> <target>&Anuller</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>Igang:</target> + +<source>Items found:</source> <target>Enheder fundet:</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>Enheder tilbage:</target> <source>Speed:</source> @@ -669,9 +672,6 @@ Kommando linjen bliver afviklet hver gang: <source>Time elapsed:</source> <target>Tid gået:</target> -<source>Operation:</source> -<target>Igang:</target> - <source>Select variant:</source> <target>Vælg variant:</target> @@ -771,7 +771,7 @@ er det samme <source>Synchronizing...</source> <target>Synkroniserer...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>Enheder behandlet:</target> <source>&Pause</source> @@ -900,8 +900,8 @@ Udeluk: \ting\temp\* <source>Transactional file copy</source> <target>Transaktionel fil kopiering</target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> -<target>Skriv filer til en midlertidig (*.ffs_tmp) først og omdøb dem. Dette garanterer en sikkerhed, selv i situationer med fatale fejl.</target> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> +<target></target> <source>Copy locked files</source> <target>Kopier låste filer</target> @@ -996,6 +996,18 @@ Overfør fil og biblioteks tilladelser <source>Auto-adjust columns</source> <target>Auto-juster kolonner</target> +<source>Icon size:</source> +<target></target> + +<source>Small</source> +<target></target> + +<source>Medium</source> +<target></target> + +<source>Large</source> +<target></target> + <source>Include all rows</source> <target>Inkluder alle rækker</target> diff --git a/BUILD/Languages/dutch.lng b/BUILD/Languages/dutch.lng index 3a93e3fb..da3e2ae0 100644 --- a/BUILD/Languages/dutch.lng +++ b/BUILD/Languages/dutch.lng @@ -25,6 +25,12 @@ <source>Browse</source> <target>Verkennen</target> +<source>Windows Error Code %x:</source> +<target>Windows Fout Code %x:</target> + +<source>Linux Error Code %x:</source> +<target>Linux Fout Code %x:</target> + <source>Invalid command line: %x</source> <target></target> @@ -223,33 +229,6 @@ <source>/sec</source> <target>/sec</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</target> - -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>1 uur</pluralform> -<pluralform>%x uren</pluralform> -</target> - -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>1 dag</pluralform> -<pluralform>%x dagen</pluralform> -</target> - <source>S&ave configuration...</source> <target>Sl&a configuratie op...</target> @@ -414,12 +393,6 @@ De opdrachtregel wordt telkens uitgevoerd indien: <source>Error traversing directory:</source> <target>Fout tijdens doorzoeken van map:</target> -<source>Windows Error Code %x:</source> -<target>Windows Fout Code %x:</target> - -<source>Linux Error Code %x:</source> -<target>Linux Fout Code %x:</target> - <source>Error setting privilege:</source> <target>Fout tijdens instellen van privileges:</target> @@ -453,6 +426,33 @@ De opdrachtregel wordt telkens uitgevoerd indien: <source>%x%</source> <target>%x%</target> +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>1 uur</pluralform> +<pluralform>%x uren</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>1 dag</pluralform> +<pluralform>%x dagen</pluralform> +</target> + <source>Could not read values for the following XML nodes:</source> <target>Kon geen waarden inlezen voor de volgende XML punten:</target> @@ -651,10 +651,13 @@ De opdrachtregel wordt telkens uitgevoerd indien: <source>&Cancel</source> <target>&Annuleren</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>Bewerking:</target> + +<source>Items found:</source> <target>Onderdelen gevonden:</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>Onderdelen te gaan:</target> <source>Speed:</source> @@ -666,9 +669,6 @@ De opdrachtregel wordt telkens uitgevoerd indien: <source>Time elapsed:</source> <target>Verstreken tijd:</target> -<source>Operation:</source> -<target>Bewerking:</target> - <source>Select variant:</source> <target>Selecteer een variant:</target> @@ -763,7 +763,7 @@ overeenkomt <source>Synchronizing...</source> <target>Synchroniseert...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>Onderdelen verwerkt:</target> <source>&Pause</source> @@ -892,7 +892,7 @@ Uitsluiten: \stuff\temp\* <source>Transactional file copy</source> <target></target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> <target></target> <source>Copy locked files</source> @@ -988,6 +988,18 @@ Zet bestand en map permissies over <source>Auto-adjust columns</source> <target>Kolommen automatisch aanpassen</target> +<source>Icon size:</source> +<target></target> + +<source>Small</source> +<target></target> + +<source>Medium</source> +<target></target> + +<source>Large</source> +<target></target> + <source>Include all rows</source> <target>Alle rijen opnemen</target> diff --git a/BUILD/Languages/english_uk.lng b/BUILD/Languages/english_uk.lng index 0c3478fa..e7c8a3ef 100644 --- a/BUILD/Languages/english_uk.lng +++ b/BUILD/Languages/english_uk.lng @@ -25,6 +25,12 @@ <source>Browse</source> <target>Browse</target> +<source>Windows Error Code %x:</source> +<target>Windows Error Code %x:</target> + +<source>Linux Error Code %x:</source> +<target>Linux Error Code %x:</target> + <source>Invalid command line: %x</source> <target>Invalid command line: %x</target> @@ -226,33 +232,6 @@ <source>/sec</source> <target>/sec</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</target> - -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</target> - -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</target> - <source>S&ave configuration...</source> <target>S&ave configuration...</target> @@ -417,12 +396,6 @@ The command line is executed each time: <source>Error traversing directory:</source> <target>Error traversing directory:</target> -<source>Windows Error Code %x:</source> -<target>Windows Error Code %x:</target> - -<source>Linux Error Code %x:</source> -<target>Linux Error Code %x:</target> - <source>Error setting privilege:</source> <target>Error setting privilege:</target> @@ -456,6 +429,33 @@ The command line is executed each time: <source>%x%</source> <target>%x%</target> +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</target> + <source>Could not read values for the following XML nodes:</source> <target>Could not read values for the following XML nodes:</target> @@ -654,10 +654,13 @@ The command line is executed each time: <source>&Cancel</source> <target>&Cancel</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>Operation:</target> + +<source>Items found:</source> <target>Elements found:</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>Elements remaining:</target> <source>Speed:</source> @@ -669,9 +672,6 @@ The command line is executed each time: <source>Time elapsed:</source> <target>Time elapsed:</target> -<source>Operation:</source> -<target>Operation:</target> - <source>Select variant:</source> <target>Select variant:</target> @@ -771,7 +771,7 @@ is the same <source>Synchronizing...</source> <target>Synchronising...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>Elements processed:</target> <source>&Pause</source> @@ -900,8 +900,8 @@ Exclude: \stuff\temp\* <source>Transactional file copy</source> <target>Transactional file copy</target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> -<target>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</target> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> +<target></target> <source>Copy locked files</source> <target>Copy locked files</target> @@ -996,6 +996,18 @@ Transfer file and directory permissions <source>Auto-adjust columns</source> <target>Auto-adjust columns</target> +<source>Icon size:</source> +<target></target> + +<source>Small</source> +<target></target> + +<source>Medium</source> +<target></target> + +<source>Large</source> +<target></target> + <source>Include all rows</source> <target>Include all rows</target> diff --git a/BUILD/Languages/finnish.lng b/BUILD/Languages/finnish.lng index 698bef7a..843470c0 100644 --- a/BUILD/Languages/finnish.lng +++ b/BUILD/Languages/finnish.lng @@ -8,13 +8,13 @@ </header> <source>Searching for directory %x...</source> -<target></target> +<target>Hakemistoja etsitään %x...</target> <source>Show in Explorer</source> <target>Näytä Explorerissa</target> <source>Open with default application</source> -<target>Avaa oletus sovelluksessa</target> +<target>Avaa oletussovelluksessa</target> <source>Browse directory</source> <target>Selaa hakemistoa</target> @@ -22,38 +22,11 @@ <source>RealtimeSync - Automated Synchronization</source> <target>RealtimeSync - Automaattinen täsmäytys</target> -<source>Browse</source> -<target>Selaa</target> - -<source>Invalid command line: %x</source> -<target></target> - -<source>Error resolving symbolic link:</source> -<target>Virhe selvittäessä symbolista linkkiä:</target> - -<source>Show pop-up</source> -<target></target> - -<source>Show pop-up on errors or warnings</source> -<target></target> - -<source>Ignore errors</source> -<target>Älä huomioi virheitä</target> - -<source>Hide all error and warning messages</source> -<target>Piilota kaikki virhe- ja varoitusviestit</target> - -<source>Exit instantly</source> -<target>Poistu välittömästi</target> - -<source>Abort synchronization immediately</source> -<target>Lopeta täsmäytys välittömästi</target> - <source>Select alternate comparison settings</source> -<target></target> +<target>Valitse vaihtoehtoinen vertailuasetus</target> <source>Select alternate synchronization settings</source> -<target>Valitse toiset asetukset täsmäytykselles</target> +<target>Valitse täsmäykselle toinen asetus</target> <source>No filter selected</source> <target>Suodin valitsematta</target> @@ -107,7 +80,46 @@ <target>Etsi</target> <source>Select time span</source> -<target></target> +<target>Valitse aikajana</target> + +<source>Show pop-up</source> +<target>Näytä Pop-Up</target> + +<source>Show pop-up on errors or warnings</source> +<target>Näytä Pop-Up (virheet, varoitukset)</target> + +<source>Ignore errors</source> +<target>Älä huomioi virheitä</target> + +<source>Hide all error and warning messages</source> +<target>Piilota kaikki virhe- ja varoitusviestit</target> + +<source>Exit instantly</source> +<target>Poistu välittömästi</target> + +<source>Abort synchronization immediately</source> +<target>Lopeta täsmäytys välittömästi</target> + +<source>Browse</source> +<target>Selaa</target> + +<source>Error reading from synchronization database:</source> +<target>Virhe lukiessa täsmäyksen tietokantaa:</target> + +<source>Error writing to synchronization database:</source> +<target>Virhe kirjottaessa täsmäyksen tietokantaa:</target> + +<source>Invalid command line: %x</source> +<target>Virheellinen komentokehote: %x</target> + +<source>Windows Error Code %x:</source> +<target>Windows virhekoodi %x:</target> + +<source>Linux Error Code %x:</source> +<target>Linux virhekoodi %x:</target> + +<source>Error resolving symbolic link:</source> +<target>Virhe selvittäessä pikakuvaketta:</target> <source>%x MB</source> <target>%x MB</target> @@ -166,11 +178,8 @@ <source>One of the FreeFileSync database files is not yet existing:</source> <target>Jokin FreeFileSynk tietokannan tiedostoista puuttuu vielä:</target> -<source>Error reading from synchronization database:</source> -<target>Virhe lukiessa täsmäytyksen tietokantaa:</target> - <source>Database files do not share a common synchronization session:</source> -<target></target> +<target>Kannan tiedostot ovat eri sessioista:</target> <source>An exception occurred!</source> <target>Virhe havaittu!</target> @@ -193,12 +202,18 @@ <pluralform>%x s</pluralform> </target> +<source>Drag && drop</source> +<target>Vedä ja pudota</target> + <source>Info</source> <target>Info</target> <source>Fatal Error</source> <target>Kohtalokas virhe</target> +<source>Error reading file:</source> +<target>Virhe lukiessa tiedostoa:</target> + <source>Scanning:</source> <target>Haen:</target> @@ -209,7 +224,10 @@ <pluralform>[1 Thread]</pluralform> <pluralform>[%x Threads]</pluralform> </source> -<target></target> +<target> +<pluralform>[1 säije]</pluralform> +<pluralform>[%x säikeitä]</pluralform> +</target> <source>Invalid FreeFileSync config file!</source> <target>Virheellinen FreeFileSync asetustiedosto!</target> @@ -220,35 +238,29 @@ <source>Error parsing configuration file:</source> <target>Virhe jäsentäessä asetustiedostoa:</target> -<source>/sec</source> -<target>/s</target> +<source>Error moving to Recycle Bin:</source> +<target>Virhe siirtäessä Roskakoriin:</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</target> +<source>Could not load a required DLL:</source> +<target>Tarvittu DLL ei lataudu:</target> -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>1 tunti</pluralform> -<pluralform>%x tuntia</pluralform> -</target> +<source>Error accessing Volume Shadow Copy Service!</source> +<target>Virhe kutsuttaessa Volume Shadow Services!</target> -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>1 päivä</pluralform> -<pluralform>%x päivää</pluralform> -</target> +<source>Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit version.</source> +<target>WOW64 varjokopiointia ei tueta. Käytä FreeFileSync 64-bittistä versiota.</target> + +<source>Could not determine volume name for file:</source> +<target>Levyasemaa ei tunnistettu tiedostolle:</target> + +<source>Volume name %x not part of filename %y!</source> +<target>Osan nimi %x ei esiinny tiedostonimessä %y!</target> + +<source>/sec</source> +<target>/s</target> + +<source>Could not read values for the following XML nodes:</source> +<target>Tietoja lukeminen epäonnistui, XML jäsen:</target> <source>S&ave configuration...</source> <target>Asetukset t&allennetaan...</target> @@ -278,7 +290,7 @@ <target>1. Valitse seurattavat hakemistot</target> <source>2. Enter a command line.</source> -<target>2. Anna komentokehoite</target> +<target>2. Anna komentokehote</target> <source>3. Press 'Start'.</source> <target>3. Paina 'Käynnistä'.</target> @@ -310,7 +322,7 @@ Komento suoritetaan kun: <target>Komentokehote</target> <source>Minimum Idle Time [seconds]</source> -<target>Minimi joutoaika [sekunttia]</target> +<target>Minimi joutoaika [sekuntia]</target> <source>Idle time between detection of last change and execution of command line in seconds</source> <target>Joutoaika viimeisen muutos havainnon ja käskyn suorittamisen välillä, sekunneissa</target> @@ -340,121 +352,7 @@ Komento suoritetaan kun: <target>Odottaa puuttuvia hakemistoja...</target> <source>A directory input field is empty.</source> -<target>Hekemistokenttä on tyhjä.</target> - -<source>Drag && drop</source> -<target>Vedä ja pudota</target> - -<source>Could not initialize directory monitoring:</source> -<target>Hakemiston tarkkailua ei voitu käynnistää:</target> - -<source>Error when monitoring directories.</source> -<target>Virhe seuratessa hakemistoa.</target> - -<source>Conversion error:</source> -<target>Konversio virhe:</target> - -<source>Error deleting file:</source> -<target>Virhe poistettaessa tiedostoa:</target> - -<source>Error moving file:</source> -<target>Virhe siirtäessä tiedostoa:</target> - -<source>Target file already existing!</source> -<target>Kohde tiedosto on jo olemassa!</target> - -<source>Error moving directory:</source> -<target>Virhe siirtäessä hakemistoa:</target> - -<source>Target directory already existing!</source> -<target>Haluttu tiedosto on jo olemassa!</target> - -<source>Error deleting directory:</source> -<target>Virhe poistettaessa hakemistoa:</target> - -<source>Error changing modification time:</source> -<target>Virhe muuttaessa tiedoston aikaa:</target> - -<source>Error loading library function:</source> -<target>Virhe ladattaessa kirjastotoimintoa:</target> - -<source>Error reading security context:</source> -<target>Virhe lukiessa tuvatietoja:</target> - -<source>Error writing security context:</source> -<target>Virhe kirjottaessa turvatietoja:</target> - -<source>Error copying file permissions:</source> -<target>Virhe kopioitaessa tiedoston oikeuksia:</target> - -<source>Error creating directory:</source> -<target>Virhe hakemistoa luotassa:</target> - -<source>Error copying symbolic link:</source> -<target>Symbolisen linkin kopiointi epäonnistui:</target> - -<source>Error copying file:</source> -<target>Virhe kopioitaessa tiedostoa:</target> - -<source>Error opening file:</source> -<target>Virhe avatessa tiedostoa:</target> - -<source>Error writing file:</source> -<target>Virhe kirjottaessa tiedostoa:</target> - -<source>Error reading file:</source> -<target>Virhe lukiessa tiedostoa:</target> - -<source>Operation aborted!</source> -<target>Toiminto lopetettiin!</target> - -<source>Endless loop when traversing directory:</source> -<target>Suorita hakemiston läpikulku jatkuvana:</target> - -<source>Error traversing directory:</source> -<target>Virhe hakemistoa läpikäydessä:</target> - -<source>Windows Error Code %x:</source> -<target>Windows virhekoodi %x:</target> - -<source>Linux Error Code %x:</source> -<target>Linux virhekoodi %x:</target> - -<source>Error setting privilege:</source> -<target>Virte oikeuksia asettaessa:</target> - -<source>Error moving to Recycle Bin:</source> -<target>Virhe siirtäessä Roskakoriin:</target> - -<source>Could not load a required DLL:</source> -<target>Tarvittu DLL ei lataudu:</target> - -<source>Error writing to synchronization database:</source> -<target>Virhe kirjottaessa täsmäytyksen tietokantaa:</target> - -<source>Error accessing Volume Shadow Copy Service!</source> -<target></target> - -<source>Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit version.</source> -<target>WOW64 varjokopiointia ei tueta. Käytä FreeFileSync 64-bittistä versiota.</target> - -<source>Could not determine volume name for file:</source> -<target>Levyasemaa ei tunnistettu tiedostolle:</target> - -<source>Volume name %x not part of filename %y!</source> -<target>Osan nimi %x ei esiinny tiedostonimessä %y!</target> - -<source>%x TB</source> -<target>%x TB</target> - -<source>%x PB</source> -<target>%x PB</target> - -<source>%x%</source> -<target>%x%</target> - -<source>Could not read values for the following XML nodes:</source> -<target>Tietoja lukeminen epäonnistui, XML jäsen:</target> +<target>Hakemistokenttä on tyhjä.</target> <source>Logging</source> <target>Kirjaa</target> @@ -607,13 +505,13 @@ Komento suoritetaan kun: <target>Eräajo</target> <source>Create a batch file for automated synchronization. To start in batch mode simply double-click the file or execute via command line: FreeFileSync.exe <ffs_batch file>. This can also be scheduled in your operating system's task planner.</source> -<target></target> +<target>Luo eräajotiedosto automaattiselle täsmäykselle. Käynnistä tuplaklikillä tai suorita komentokehoitteessa: FreeFileSync.exe <ffs_batch file>. Voidaan ajastaa käyttöjärjestelmässä (Tehtävien ajoitus).</target> <source>Help</source> <target>Ohje</target> <source>Filter files</source> -<target>Suodata tiedostoja</target> +<target>Suodata tiedostot</target> <source>Error handling</source> <target>Virhe käsitellessä</target> @@ -631,7 +529,7 @@ Komento suoritetaan kun: <target>Tilan palaute</target> <source>Run minimized</source> -<target></target> +<target>Suorita pienennettynä</target> <source>Maximum number of logfiles:</source> <target>Lokitiedostojen enimmäismäärä:</target> @@ -640,7 +538,7 @@ Komento suoritetaan kun: <target>Hakemisto lokitiedostoille:</target> <source>Batch settings</source> -<target></target> +<target>Eräajo asetukset</target> <source>&Save</source> <target>&Tallenna</target> @@ -651,10 +549,13 @@ Komento suoritetaan kun: <source>&Cancel</source> <target>&Lopeta</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>Toiminto:</target> + +<source>Items found:</source> <target>Osia löytyi:</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>Osia jäljellä:</target> <source>Speed:</source> @@ -666,9 +567,6 @@ Komento suoritetaan kun: <source>Time elapsed:</source> <target>Kulunut aika:</target> -<source>Operation:</source> -<target>Toiminto:</target> - <source>Select variant:</source> <target>Valitse vaihtoehto:</target> @@ -694,7 +592,7 @@ Komento suoritetaan kun: <target>Oma määritelmä</target> <source>Configure your own synchronization rules.</source> -<target>Määrittele oma täsmäytyssääntö.</target> +<target>Määrittele oma täsmäyssääntö.</target> <source>Deletion handling</source> <target>Poistotapa</target> @@ -727,7 +625,7 @@ Komento suoritetaan kun: <target>Tiedostojen sisältö on eri</target> <source>Conflict/file cannot be categorized</source> -<target>Poikeaman/tiedoston luokittelu ei onnistu</target> +<target>Poikkeaman/tiedoston luokittelu ei onnistu</target> <source>Compare by...</source> <target>Vertaile...</target> @@ -738,10 +636,15 @@ Files are found equal if - file size are the same </source> -<target></target> +<target> +Tiedostot samat jos + - viimeinen kirjoitusaika ja pvm + - tiedostokoko +ovat samat +</target> <source>File time and size</source> -<target></target> +<target>Tiedoston aika ja koko</target> <source> Files are found equal if @@ -763,7 +666,7 @@ on sama <source>Synchronizing...</source> <target>Täsmäytetään...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>Osia käsitelty:</target> <source>&Pause</source> @@ -837,7 +740,7 @@ Only files/directories that match all filter settings will be selected for synch Note: The name filter must be specified relative(!) to main synchronization directories. </source> <target> -Täsmäytykseen valitaan vain ne tiedostot/hakemistot jotka täyttävät kaikkia kriteerejä. +Täsmäykseen valitaan vain ne tiedostot/hakemistot jotka täyttävät kaikkia kriteerejä. HUOM: Nimetty suodin on oltava määritelty relatiivisesti(!) päähakemistoon nähden. </target> @@ -875,10 +778,10 @@ Sulje pois: \stuff\temp\* <target>Sulje pois</target> <source>Minimum file size</source> -<target></target> +<target>Tiedoston pienin koko</target> <source>Maximum file size</source> -<target></target> +<target>Tiedoston suurin koko</target> <source>&Default</source> <target>&Vakio</target> @@ -890,10 +793,10 @@ Sulje pois: \stuff\temp\* <target>Siirrä sarake alas</target> <source>Transactional file copy</source> -<target></target> +<target>Transaktio pohjainen kopiointi</target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> -<target></target> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> +<target>Kirjoittaa ensin tilapäistiedostoon (*.ffs_tmp) ja nimeä sen uudestaan. Varmistaa eheyden myös Fataali Virheen tapahtuessa.</target> <source>Copy locked files</source> <target>Kopioi lukitut tiedostot</target> @@ -908,25 +811,25 @@ Kopioi jaetut/lukitut tiedostot Volume Shadow Copy prosessilla </target> <source>Copy file access permissions</source> -<target></target> +<target>Kopioi tiedoston käyttöoikeuksia</target> <source> Transfer file and directory permissions (Requires Administrator rights) </source> <target> -Siirrä tiedosto- ja hekimisto-oikeuksia +Siirrä tiedosto- ja hakemisto-oikeuksia (Vaatii Järjestelmävalvojan oikeuksia) </target> <source>Hidden dialogs:</source> -<target>Piiloitetut ikkunat:</target> +<target>Piilotetut ikkunat:</target> <source>Reset</source> <target>Palauta</target> <source>Show hidden dialogs</source> -<target>Näytä piiloitetut ikkunat</target> +<target>Näytä piilotetut ikkunat</target> <source>External applications</source> <target>Ulkopuolinen sovellus</target> @@ -947,7 +850,10 @@ Siirrä tiedosto- ja hekimisto-oikeuksia <target>Täsmää kirjainkoko</target> <source>&Find next</source> -<target>&Esi seuraava</target> +<target>&Etsi seuraava</target> + +<source>Operation aborted!</source> +<target>Toiminto lopetettiin!</target> <source>Main bar</source> <target>Päävalikko</target> @@ -983,11 +889,23 @@ Siirrä tiedosto- ja hekimisto-oikeuksia <target>Sovita...</target> <source>Select time span...</source> -<target></target> +<target>Valitse aikajana...</target> <source>Auto-adjust columns</source> <target>Säädä sarakeleveys automaattisesti</target> +<source>Icon size:</source> +<target>Koko, kuvake:</target> + +<source>Small</source> +<target>Pieni</target> + +<source>Medium</source> +<target>Keskikoko</target> + +<source>Large</source> +<target>Iso</target> + <source>Include all rows</source> <target>Sisällytä kaikki rivit</target> @@ -1028,7 +946,7 @@ Siirrä tiedosto- ja hekimisto-oikeuksia <target>Näytä vain oikealla esiintyvät tiedostot</target> <source>Hide files that are newer on left</source> -<target>Piilota vasemalla olevat uudemmat tiedostot</target> +<target>Piilota vasemmalla olevat uudemmat tiedostot</target> <source>Show files that are newer on left</source> <target>Näytä vasemmalla olevat uudemmat tiedostot</target> @@ -1073,7 +991,7 @@ Siirrä tiedosto- ja hekimisto-oikeuksia <target>Piilota tiedostot jotka poistetaan vasemmalta</target> <source>Show files that will be deleted on the left side</source> -<target>Näytä vasemmallta poistettavat tiedostot</target> +<target>Näytä vasemmalta poistettavat tiedostot</target> <source>Hide files that will be deleted on the right side</source> <target>Piilota tiedostot jotka poistetaan oikealta</target> @@ -1103,7 +1021,7 @@ Siirrä tiedosto- ja hekimisto-oikeuksia <target>Kaikki hakemistot täsmäävät!</target> <source>Please run a Compare first before synchronizing!</source> -<target>Aja tarkistus ennen täsmäytystä.</target> +<target>Aja Tarkistus ennen täsmäystä.</target> <source>Comma separated list</source> <target>CSV-muotoinen lista</target> @@ -1114,6 +1032,9 @@ Siirrä tiedosto- ja hekimisto-oikeuksia <source>File list exported!</source> <target>Tiedosto lista viety!</target> +<source>Error writing file:</source> +<target>Virhe kirjottaessa tiedostoa:</target> + <source>Batch file created successfully!</source> <target>Eräajotiedoston luonti onnistui!</target> @@ -1184,19 +1105,19 @@ Siirrä tiedosto- ja hekimisto-oikeuksia <target>Lepotilassa</target> <source>Last x hours</source> -<target></target> +<target>Viimeiset x tuntia</target> <source>Today</source> -<target></target> +<target>Tänään</target> <source>This week</source> -<target></target> +<target>Tällä viikolla</target> <source>This month</source> -<target></target> +<target>Tässä kuussa</target> <source>This year</source> -<target></target> +<target>Tänä vuonna</target> <source>Byte</source> <target>tavua</target> @@ -1223,7 +1144,7 @@ Siirrä tiedosto- ja hekimisto-oikeuksia <target>Seuraa</target> <source>Copy NTFS permissions</source> -<target></target> +<target>Monista NTFS oikeudet</target> <source>Integrate external applications into context menu. The following macros are available:</source> <target>Liitä ulkoinen sovellus viitekehysvalikkoon. Seuraavat makrot ovat valittavissa:</target> @@ -1241,7 +1162,7 @@ Siirrä tiedosto- ja hekimisto-oikeuksia <target>- Toisen puolen vastaavuus on %dir</target> <source>Restore all hidden dialogs?</source> -<target>Palauta piiloitetut ikkunat?</target> +<target>Palauta piilotetut ikkunat?</target> <source> <pluralform>Do you really want to move the following object to the Recycle Bin?</pluralform> @@ -1279,23 +1200,122 @@ Siirrä tiedosto- ja hekimisto-oikeuksia <source>Move files into a time-stamped subdirectory</source> <target>Siirrä tiedostot aikaleimattuun hakemistoon</target> +<source>%x TB</source> +<target>%x TB</target> + +<source>%x PB</source> +<target>%x PB</target> + +<source>%x%</source> +<target>%x%</target> + +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>1 tunti</pluralform> +<pluralform>%x tuntia</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>1 päivä</pluralform> +<pluralform>%x päivää</pluralform> +</target> + +<source>Could not initialize directory monitoring:</source> +<target>Hakemiston tarkkailua ei voitu käynnistää:</target> + +<source>Error when monitoring directories.</source> +<target>Virhe seuratessa hakemistoa.</target> + +<source>Conversion error:</source> +<target>Konversio virhe:</target> + +<source>Error deleting file:</source> +<target>Virhe poistettaessa tiedostoa:</target> + +<source>Error moving file:</source> +<target>Virhe siirtäessä tiedostoa:</target> + +<source>Target file already existing!</source> +<target>Kohde tiedosto on jo olemassa!</target> + +<source>Error moving directory:</source> +<target>Virhe siirtäessä hakemistoa:</target> + +<source>Target directory already existing!</source> +<target>Haluttu tiedosto on jo olemassa!</target> + +<source>Error deleting directory:</source> +<target>Virhe poistettaessa hakemistoa:</target> + +<source>Error changing modification time:</source> +<target>Virhe muuttaessa tiedoston aikaa:</target> + +<source>Error loading library function:</source> +<target>Virhe ladattaessa kirjastotoimintoa:</target> + +<source>Error reading security context:</source> +<target>Virhe lukiessa turvatietoja:</target> + +<source>Error writing security context:</source> +<target>Virhe kirjottaessa turvatietoja:</target> + +<source>Error copying file permissions:</source> +<target>Virhe kopioitaessa tiedoston oikeuksia:</target> + +<source>Error creating directory:</source> +<target>Virhe hakemistoa luotassa:</target> + +<source>Error copying symbolic link:</source> +<target>Symbolisen linkin kopiointi epäonnistui:</target> + +<source>Error copying file:</source> +<target>Virhe kopioitaessa tiedostoa:</target> + +<source>Error opening file:</source> +<target>Virhe avatessa tiedostoa:</target> + +<source>Endless loop when traversing directory:</source> +<target>Suorita hakemiston läpikulku jatkuvana:</target> + +<source>Error traversing directory:</source> +<target>Virhe hakemistoa läpikäydessä:</target> + +<source>Error setting privilege:</source> +<target>Virhe, asettaessa oikeuksia:</target> + <source>Both sides have changed since last synchronization!</source> -<target>Molemmat puolet muuttuneet edellisestä täsmäytyksestä!</target> +<target>Molemmat puolet muuttuneet edellisestä täsmäyksestä!</target> <source>Cannot determine sync-direction:</source> -<target>Tuntematon täsmäytys suunta:</target> +<target>Tuntematon suunta täsmäykselle:</target> <source>No change since last synchronization!</source> -<target>Ei muutoksia edellisen täsmäytyksen jälkeen!</target> +<target>Ei muutoksia edellisen täsmäyksen jälkeen!</target> <source>Filter settings have changed!</source> <target>Suodinasetukset muutettu!</target> <source>The file was not processed by last synchronization!</source> -<target>Tiedostoa ei käsitelty viime täsmäytyksessä!</target> +<target>Tiedostoa ei käsitelty viime täsmäyksessä!</target> <source>Setting default synchronization directions: Old files will be overwritten with newer files.</source> -<target>Aseta oletettu suunta täsmäytykselle: Vanhat tiedostot ylikirjoitetaan uudemilla tiedostoilla.</target> +<target>Aseta oletussuunta täsmäykselle: Vanhat tiedostot ylikirjoitetaan uudemilla tiedostoilla.</target> <source>The file does not contain a valid configuration:</source> <target>Asetustiedosto ei ole kelvollinen:</target> @@ -1307,7 +1327,7 @@ Siirrä tiedosto- ja hekimisto-oikeuksia <target>Puuttuva hakemisto:</target> <source>Directories are dependent! Be careful when setting up synchronization rules:</source> -<target>Hakemistot riippuvuussuhteessa! Aseta täsmäytyssääntöjä varovasti:</target> +<target>Hakemistot riippuvuussuhteessa! Aseta täsmäyssääntöjä varovasti:</target> <source>Comparing content of files %x</source> <target>Vertaa tiedostojen %x tietosisältöä</target> @@ -1376,40 +1396,40 @@ Siirrä tiedosto- ja hekimisto-oikeuksia <target>Poista hakemisto %x</target> <source>Deleting symbolic link %x</source> -<target></target> +<target>Pistetaan pikakuvake %x</target> <source>Moving file %x to recycle bin</source> -<target></target> +<target>Siirrä tiedosto %x roskakoriin</target> <source>Moving folder %x to recycle bin</source> -<target></target> +<target>Siirrä hakemisto %x roskakoriin</target> <source>Moving symbolic link %x to recycle bin</source> -<target></target> +<target>Siirrä pikakuvake %x roskakoriin</target> <source>Moving file %x to %y</source> -<target></target> +<target>Siirrä tiedosto %x -> %y</target> <source>Moving folder %x to %y</source> -<target></target> +<target>Siirrä hakemisto %x -> %y</target> <source>Moving symbolic link %x to %y</source> -<target></target> +<target>Siirrä pikakuvike %x -> %y</target> <source>Creating file %x</source> -<target></target> +<target>Luodaan tiedosto %x</target> <source>Creating symbolic link %x</source> -<target></target> +<target>Luodaan pikakuvake %x</target> <source>Creating folder %x</source> <target>Luo hakemisto %x</target> <source>Overwriting file %x</source> -<target></target> +<target>Korvaa tiedosto %x</target> <source>Overwriting symbolic link %x</source> -<target></target> +<target>Korvaa pikakuvake %x</target> <source>Verifying file %x</source> <target>Tarkistan tiedostoa %x</target> @@ -1430,7 +1450,7 @@ Siirrä tiedosto- ja hekimisto-oikeuksia <target>Ratkaisemattomia ristiriitoja!</target> <source>You can ignore conflicts and continue synchronization.</source> -<target>Voit jatkaa täsmäytystä, ristiriidoista huolimatta.</target> +<target>Voit jatkaa täsmäystä, ristiriidoista huolimatta.</target> <source>Significant difference detected:</source> <target>Merkittävä eroavavuus todettu:</target> @@ -1448,10 +1468,10 @@ Siirrä tiedosto- ja hekimisto-oikeuksia <target>Levytilaa jäljellä:</target> <source>Recycle Bin is not available for the following paths! Files will be deleted permanently instead:</source> -<target></target> +<target>Roskakori puuttuu tässä polussa! Tiedostot poistetaan pysyvästi:</target> <source>A directory will be modified which is part of multiple folder pairs! Please review synchronization settings!</source> -<target>Moniosaisen hakemistoparin hakemisto muutetaan! Tarkista täsmäytys asetuksia!</target> +<target>Moniosaisen hakemistoparin hakemisto muutetaan! Tarkista täsmäysasetuksia!</target> <source>Processing folder pair:</source> <target>Käsitellään hakemistoparia:</target> diff --git a/BUILD/Languages/french.lng b/BUILD/Languages/french.lng index f8c57231..9c9add60 100644 --- a/BUILD/Languages/french.lng +++ b/BUILD/Languages/french.lng @@ -25,6 +25,12 @@ <source>Browse</source> <target>Parcourir</target> +<source>Windows Error Code %x:</source> +<target>Code erreur Windows %x:</target> + +<source>Linux Error Code %x:</source> +<target>Code erreur Linux %x:</target> + <source>Invalid command line: %x</source> <target>Ligne de commande incorrecte : %x</target> @@ -226,33 +232,6 @@ <source>/sec</source> <target>/sec</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>%x min</pluralform> -<pluralform>%x min</pluralform> -</target> - -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>%x heure</pluralform> -<pluralform>%x heures</pluralform> -</target> - -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>%x jour</pluralform> -<pluralform>%x jours</pluralform> -</target> - <source>S&ave configuration...</source> <target>S&auvegarder la configuration...</target> @@ -417,12 +396,6 @@ La ligne de commande est exécutée chaque fois que : <source>Error traversing directory:</source> <target>Erreur lors du parcours du répertoire :</target> -<source>Windows Error Code %x:</source> -<target>Code erreur Windows %x:</target> - -<source>Linux Error Code %x:</source> -<target>Code erreur Linux %x:</target> - <source>Error setting privilege:</source> <target>Erreur de paramétrage de privilège</target> @@ -456,6 +429,33 @@ La ligne de commande est exécutée chaque fois que : <source>%x%</source> <target>%x %</target> +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>%x min</pluralform> +<pluralform>%x min</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>%x heure</pluralform> +<pluralform>%x heures</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>%x jour</pluralform> +<pluralform>%x jours</pluralform> +</target> + <source>Could not read values for the following XML nodes:</source> <target>Impossible de lire les valeurs des noeuds XML suivants :</target> @@ -654,10 +654,13 @@ La ligne de commande est exécutée chaque fois que : <source>&Cancel</source> <target>&Annuler</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>Opération :</target> + +<source>Items found:</source> <target>Elements trouvés :</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>Elements restants :</target> <source>Speed:</source> @@ -669,9 +672,6 @@ La ligne de commande est exécutée chaque fois que : <source>Time elapsed:</source> <target>Temps écoulé :</target> -<source>Operation:</source> -<target>Opération :</target> - <source>Select variant:</source> <target>Choisissez une variante :</target> @@ -771,7 +771,7 @@ est identique <source>Synchronizing...</source> <target>Synchronisation en cours...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>Elements traités :</target> <source>&Pause</source> @@ -900,8 +900,8 @@ Exclude: \stuff\temp\* <source>Transactional file copy</source> <target>Copie de fichiers transactionnelle</target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> -<target>L'écriture préalable de fichiers dans un répertoire temporaire (*.ffs_tmp) avant de les renommer garantit la cohérence et la sécurité en cas d'erreur fatale.</target> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> +<target></target> <source>Copy locked files</source> <target>Copier les fichiers verrouillés</target> @@ -996,6 +996,18 @@ Transfert des attributs système des fichiers et des répertoires <source>Auto-adjust columns</source> <target>Auto-ajustement des colonnes</target> +<source>Icon size:</source> +<target></target> + +<source>Small</source> +<target></target> + +<source>Medium</source> +<target></target> + +<source>Large</source> +<target></target> + <source>Include all rows</source> <target>Inclure toutes les lignes</target> diff --git a/BUILD/Languages/german.lng b/BUILD/Languages/german.lng index d71dde81..52ef867a 100644 --- a/BUILD/Languages/german.lng +++ b/BUILD/Languages/german.lng @@ -25,6 +25,12 @@ <source>Browse</source> <target>Auswählen</target> +<source>Windows Error Code %x:</source> +<target>Windows Fehlercode %x:</target> + +<source>Linux Error Code %x:</source> +<target>Linux Fehlercode %x:</target> + <source>Invalid command line: %x</source> <target>Ungültige Befehlszeile: %x</target> @@ -226,33 +232,6 @@ <source>/sec</source> <target>/s</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>1 Min.</pluralform> -<pluralform>%x Min.</pluralform> -</target> - -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>1 Stunde</pluralform> -<pluralform>%x Stunden</pluralform> -</target> - -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>1 Tag</pluralform> -<pluralform>%x Tage</pluralform> -</target> - <source>S&ave configuration...</source> <target>Konfiguration s&peichern...</target> @@ -417,12 +396,6 @@ Die Befehlszeile wird ausgeführt wenn: <source>Error traversing directory:</source> <target>Fehler beim Durchsuchen des Verzeichnisses:</target> -<source>Windows Error Code %x:</source> -<target>Windows Fehlercode %x:</target> - -<source>Linux Error Code %x:</source> -<target>Linux Fehlercode %x:</target> - <source>Error setting privilege:</source> <target>Fehler beim Setzen des Privilegs:</target> @@ -456,6 +429,33 @@ Die Befehlszeile wird ausgeführt wenn: <source>%x%</source> <target>%x%</target> +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>1 Min.</pluralform> +<pluralform>%x Min.</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>1 Stunde</pluralform> +<pluralform>%x Stunden</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>1 Tag</pluralform> +<pluralform>%x Tage</pluralform> +</target> + <source>Could not read values for the following XML nodes:</source> <target>Die folgenden XML Knoten konnten nicht gelesen werden:</target> @@ -654,10 +654,13 @@ Die Befehlszeile wird ausgeführt wenn: <source>&Cancel</source> <target>&Abbrechen</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>Vorgang:</target> + +<source>Items found:</source> <target>Gefundene Elemente:</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>Verbleibende Elemente:</target> <source>Speed:</source> @@ -669,9 +672,6 @@ Die Befehlszeile wird ausgeführt wenn: <source>Time elapsed:</source> <target>Vergangene Zeit:</target> -<source>Operation:</source> -<target>Vorgang:</target> - <source>Select variant:</source> <target>Variante auswählen:</target> @@ -771,7 +771,7 @@ gleich ist <source>Synchronizing...</source> <target>Synchronisiere...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>Verarbeitete Elemente:</target> <source>&Pause</source> @@ -900,7 +900,7 @@ Ausschließen: \stuff\temp\* <source>Transactional file copy</source> <target>Kopiere Dateien als Transaktion</target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> <target>Dateien zuerst temporär schreiben (*.ffs_tmp), anschließend umbenennen. Dadurch wird ein konsistenter Status auch im größten Fehlerfall sichergestellt.</target> <source>Copy locked files</source> @@ -996,6 +996,18 @@ Transfer file and directory permissions <source>Auto-adjust columns</source> <target>Spalten automatisch ausrichten</target> +<source>Icon size:</source> +<target>Symbolgröße</target> + +<source>Small</source> +<target>Klein</target> + +<source>Medium</source> +<target>Mittel</target> + +<source>Large</source> +<target>Groß</target> + <source>Include all rows</source> <target>Alle Zeilen einschließen</target> diff --git a/BUILD/Languages/greek.lng b/BUILD/Languages/greek.lng index 07f01fd2..d7305afb 100644 --- a/BUILD/Languages/greek.lng +++ b/BUILD/Languages/greek.lng @@ -8,7 +8,7 @@ </header> <source>Searching for directory %x...</source> -<target></target> +<target>Αναζήτηση υποκαταλόγου %x...</target> <source>Show in Explorer</source> <target>Εμφάνιση στην Εξερεύνηση</target> @@ -22,35 +22,8 @@ <source>RealtimeSync - Automated Synchronization</source> <target>RealtimeSync - Αυτοματοποιημένος Συγχρονισμός</target> -<source>Browse</source> -<target>Αναζήτηση</target> - -<source>Invalid command line: %x</source> -<target></target> - -<source>Error resolving symbolic link:</source> -<target>Σφάλμα κατά την επίλυση του συμβολικού δεσμού:</target> - -<source>Show pop-up</source> -<target></target> - -<source>Show pop-up on errors or warnings</source> -<target></target> - -<source>Ignore errors</source> -<target>Παράβλεψη των σφαλμάτων</target> - -<source>Hide all error and warning messages</source> -<target>Απόκρυψη όλων των σφαλμάτων και προειδοποιήσεων</target> - -<source>Exit instantly</source> -<target>Άμεση έξοδος</target> - -<source>Abort synchronization immediately</source> -<target>Άμεση ματαίωση του συγχρονισμού</target> - <source>Select alternate comparison settings</source> -<target></target> +<target>Επιλογή διαφοροποιημένων ρυθμίσεων σύγκρισης</target> <source>Select alternate synchronization settings</source> <target>Επιλογή διαφοροποιημένων ρυθμίσεων συγχρονισμού</target> @@ -107,7 +80,46 @@ <target>Αναζήτηση</target> <source>Select time span</source> -<target></target> +<target>Επιλογή χρονικού διαστήματος</target> + +<source>Show pop-up</source> +<target>Εμφάνιση αναδυόμενου παράθυρου</target> + +<source>Show pop-up on errors or warnings</source> +<target>Εμφάνιση αναδυόμενου παράθυρου σε σφάλματα ή προειδοποιήσεις</target> + +<source>Ignore errors</source> +<target>Παράβλεψη των σφαλμάτων</target> + +<source>Hide all error and warning messages</source> +<target>Απόκρυψη όλων των σφαλμάτων και προειδοποιήσεων</target> + +<source>Exit instantly</source> +<target>Άμεση έξοδος</target> + +<source>Abort synchronization immediately</source> +<target>Άμεση ματαίωση του συγχρονισμού</target> + +<source>Browse</source> +<target>Αναζήτηση</target> + +<source>Error reading from synchronization database:</source> +<target>Σφάλμα κατά την ανάγνωση από τη βάση δεδομένων συγχρονισμού:</target> + +<source>Error writing to synchronization database:</source> +<target>Σφάλμα κατά την εγγραφή στη βάση δεδομένων συγχρονισμού:</target> + +<source>Invalid command line: %x</source> +<target>Σφάλμα στη γραμμή εντολών: %x</target> + +<source>Windows Error Code %x:</source> +<target>Κωδικός Σφάλματος των Windows %x:</target> + +<source>Linux Error Code %x:</source> +<target>Κωδικός Σφάλματος του Linux %x:</target> + +<source>Error resolving symbolic link:</source> +<target>Σφάλμα κατά την επίλυση του συμβολικού δεσμού:</target> <source>%x MB</source> <target>%x MB</target> @@ -166,11 +178,8 @@ <source>One of the FreeFileSync database files is not yet existing:</source> <target>Μια από τις βάσεις δεδομένων του FreeFileSync δεν υπάρχει ακόμα:</target> -<source>Error reading from synchronization database:</source> -<target>Σφάλμα κατά την ανάγνωση από τη βάση δεδομένων συγχρονισμού:</target> - <source>Database files do not share a common synchronization session:</source> -<target></target> +<target>Οι βάσεις δεδομένων δεν έχουν δημιουργηθεί από τον ίδιο συγχρονισμό:</target> <source>An exception occurred!</source> <target>Παρουσιάστηκε σφάλμα!</target> @@ -193,12 +202,18 @@ <pluralform>%x δ/λεπτα</pluralform> </target> +<source>Drag && drop</source> +<target>Μεταφορά && Απόθεση</target> + <source>Info</source> <target>Πληροφορίες</target> <source>Fatal Error</source> <target>Σημαντικό Σφάλμα</target> +<source>Error reading file:</source> +<target>Σφάλμα κατά την ανάγνωση του αρχείου:</target> + <source>Scanning:</source> <target>Ανίχνευση:</target> @@ -209,52 +224,49 @@ <pluralform>[1 Thread]</pluralform> <pluralform>[%x Threads]</pluralform> </source> -<target></target> +<target> +<pluralform>[1 Νήμα]</pluralform> +<pluralform>[%x Νήματα]</pluralform> +</target> <source>Invalid FreeFileSync config file!</source> <target>Το αρχείο διάταξης του FreeFileSync δεν είναι έγκυρο!</target> -<source>File does not exist:</source> -<target>Το αρχείο δεν υπάρχει:</target> - <source>Error parsing configuration file:</source> <target>Σφάλμα κατά την ανάλυση του αρχείου διάταξης:</target> +<source>Error moving to Recycle Bin:</source> +<target>Σφάλμα κατά τη μεταφορά στον Κάδο Ανακύκλωσης:</target> + +<source>Could not load a required DLL:</source> +<target>Δεν φορτώθηκε μια απαιτούμενη βιβλιοθήκη DLL:</target> + +<source>Error accessing Volume Shadow Copy Service!</source> +<target>Σφάλμα κατά την πρόσβαση στην υπηρεσία Volume Shadow Copy!</target> + +<source>Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit version.</source> +<target>Δεν είναι δυνατή η δημιουργία σκιώδους αντίγραφου σε WOW64. Χρησιμοποιείστε την 64-bit έκδοση του FreeFileSync.</target> + +<source>Could not determine volume name for file:</source> +<target>Δεν ήταν δυνατό να προσδιοριστεί το όνομα τόμου για το αρχείο:</target> + +<source>Volume name %x not part of filename %y!</source> +<target>Το όνομα τόμου %x δεν είναι μέρος του ονόματος του αρχείου %y!</target> + <source>/sec</source> <target>/δευτερόλεπτο</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>1 λεπτό</pluralform> -<pluralform>%x λεπτά</pluralform> -</target> - -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>1 ώρα</pluralform> -<pluralform>%x ώρες</pluralform> -</target> +<source>File does not exist:</source> +<target>Το αρχείο δεν υπάρχει:</target> -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>1 μέρα</pluralform> -<pluralform>%x μέρες</pluralform> -</target> +<source>Could not read values for the following XML nodes:</source> +<target>Δεν αναγνώστηκαν τιμές για τους ακόλουθους κόμβους XML:</target> <source>S&ave configuration...</source> <target>Α&ποθήκευση διάταξης...</target> <source>&Load configuration...</source> -<target>Ά&νοιγμα διάταξης...</target> +<target>&Άνοιγμα διάταξης...</target> <source>&Quit</source> <target>&Έξοδος</target> @@ -342,120 +354,6 @@ The command line is executed each time: <source>A directory input field is empty.</source> <target>Ένα πεδίο εισόδου είναι κενό.</target> -<source>Drag && drop</source> -<target>Μεταφορά && Απόθεση</target> - -<source>Could not initialize directory monitoring:</source> -<target>Δεν ήταν δυνατό να γίνει έναρξη παρακολούθησης του υποκαταλόγου:</target> - -<source>Error when monitoring directories.</source> -<target>Σφάλμα κατά την παρακολούθηση υποκαταλόγων.</target> - -<source>Conversion error:</source> -<target>Σφάλμα μετατροπής:</target> - -<source>Error deleting file:</source> -<target>Σφάλμα κατά τη διαγραφή του αρχείου:</target> - -<source>Error moving file:</source> -<target>Σφάλμα κατά τη μεταφορά του αρχείου:</target> - -<source>Target file already existing!</source> -<target>Το αρχείο προορισμού υπάρχει ήδη!</target> - -<source>Error moving directory:</source> -<target>Σφάλμα κατά τη μεταφορά του υποκαταλόγου:</target> - -<source>Target directory already existing!</source> -<target>Ο υποκατάλογος προορισμού υπάρχει ήδη!</target> - -<source>Error deleting directory:</source> -<target>Σφάλμα κατά τη διαγραφή του υποκαταλόγου:</target> - -<source>Error changing modification time:</source> -<target>Σφάλμα κατά την αλλαγή της ώρας τροποποίησης:</target> - -<source>Error loading library function:</source> -<target>Σφάλμα κατά τη φόρτωση της συνάρτησης βιβλιοθήκης:</target> - -<source>Error reading security context:</source> -<target>Σφάλμα κατά την ανάγνωση του πλαισίου ασφαλείας:</target> - -<source>Error writing security context:</source> -<target>Σφάλμα κατά την εγγραφή του πλαισίου ασφάλειας:</target> - -<source>Error copying file permissions:</source> -<target>Σφάλμα κατά την αντιγραφή των αδειών των αρχείων:</target> - -<source>Error creating directory:</source> -<target>Σφάλμα κατά τη δημιουργία του υποκαταλόγου:</target> - -<source>Error copying symbolic link:</source> -<target>Σφάλμα κατά την αντιγραφή του συμβολικού δεσμού:</target> - -<source>Error copying file:</source> -<target>Σφάλμα κατά την αντιγραφή του αρχείου:</target> - -<source>Error opening file:</source> -<target>Σφάλμα κατά το άνοιγμα του αρχείου:</target> - -<source>Error writing file:</source> -<target>Σφάλμα κατά την εγγραφή του αρχείου:</target> - -<source>Error reading file:</source> -<target>Σφάλμα κατά την ανάγνωση του αρχείου:</target> - -<source>Operation aborted!</source> -<target>Η λειτουργία ματαιώθηκε!</target> - -<source>Endless loop when traversing directory:</source> -<target>Ατέρμονος βρόχος κατά την την ανάλυση του υποκαταλόγου:</target> - -<source>Error traversing directory:</source> -<target>Σφάλμα κατά την ανάλυση του υποκαταλόγου:</target> - -<source>Windows Error Code %x:</source> -<target>Κωδικός Σφάλματος των Windows %x:</target> - -<source>Linux Error Code %x:</source> -<target>Κωδικός Σφάλματος του Linux %x:</target> - -<source>Error setting privilege:</source> -<target>Σφάλμα κατά τον ορισμό δικαιωμάτων:</target> - -<source>Error moving to Recycle Bin:</source> -<target>Σφάλμα κατά τη μεταφορά στον Κάδο Ανακύκλωσης:</target> - -<source>Could not load a required DLL:</source> -<target>Δεν φορτώθηκε μια απαιτούμενη βιβλιοθήκη DLL:</target> - -<source>Error writing to synchronization database:</source> -<target>Σφάλμα κατά την εγγραφή στη βάση δεδομένων συγχρονισμού:</target> - -<source>Error accessing Volume Shadow Copy Service!</source> -<target></target> - -<source>Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit version.</source> -<target>Δεν είναι δυνατή η δημιουργία σκιώδους αντίγραφου σε WOW64. Χρησιμοποιείστε την 64-bit έκδοση του FreeFileSync.</target> - -<source>Could not determine volume name for file:</source> -<target>Δεν ήταν δυνατό να προσδιοριστεί το όνομα τόμου για το αρχείο:</target> - -<source>Volume name %x not part of filename %y!</source> -<target>Το όνομα τόμου %x δεν είναι μέρος του ονόματος του αρχείου %y!</target> - -<source>%x TB</source> -<target>%x TB</target> - -<source>%x PB</source> -<target>%x PB</target> - -<source>%x%</source> -<target>%x%</target> - -<source>Could not read values for the following XML nodes:</source> -<target>Δεν αναγνώστηκαν τιμές για τους ακόλουθους κόμβους XML:</target> - <source>Logging</source> <target>Καταγραφή μηνυμάτων</target> @@ -607,7 +505,7 @@ The command line is executed each time: <target>Δέσμη ενεργειών</target> <source>Create a batch file for automated synchronization. To start in batch mode simply double-click the file or execute via command line: FreeFileSync.exe <ffs_batch file>. This can also be scheduled in your operating system's task planner.</source> -<target></target> +<target>Δημιουργία ενός αρχείου δέσμης ενεργειών για αυτόματο συγχρονισμό. Για την έναρξη σε λειτουργία δέσμης, απλά κάντε διπλό κλικ στο αρχείο ή εκτελέστε το μέσω της γραμμής εντολών: FreeFileSync.exe <αρχείο δέσμης>. Αυτή η λειτουργία μπορεί να προγραμματιστεί και στο χρονοδιάγραμμα εργασιών του λειτουργικού σας συστήματος.</target> <source>Help</source> <target>Βοήθεια</target> @@ -631,16 +529,16 @@ The command line is executed each time: <target>Αναφορά κατάστασης</target> <source>Run minimized</source> -<target></target> +<target>Να εκτελεστεί ελαχιστοποιημένο</target> <source>Maximum number of logfiles:</source> <target>Μέγιστος αριθμός αρχείων καταγραφής:</target> <source>Select logfile directory:</source> -<target>Επιλέξτε έναν κατάλογο για το αρχείο καταγραφής:</target> +<target>Επιλέξτε έναν κατάλογο για τα αρχεία καταγραφής:</target> <source>Batch settings</source> -<target></target> +<target>Ρυθμίσεις δέσμης ενεργειών</target> <source>&Save</source> <target>&Αποθήκευση</target> @@ -651,10 +549,13 @@ The command line is executed each time: <source>&Cancel</source> <target>&Άκυρο</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>Λειτουργία:</target> + +<source>Items found:</source> <target>Βρέθηκαν στοιχεία:</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>Περισσεύουν στοιχεία:</target> <source>Speed:</source> @@ -666,9 +567,6 @@ The command line is executed each time: <source>Time elapsed:</source> <target>Πέρασε χρόνος:</target> -<source>Operation:</source> -<target>Λειτουργία:</target> - <source>Select variant:</source> <target>Επιλέξτε μια μέθοδο:</target> @@ -738,10 +636,15 @@ Files are found equal if - file size are the same </source> -<target></target> +<target> +Τα αρχεία θεωρούνται ίδια εάν + - η ημερομηνία και ώρα τελευταίας τροποποίησης + - το μέγεθός τους +είναι ίδια +</target> <source>File time and size</source> -<target></target> +<target>Ημερομηνία και μέγεθος αρχείων</target> <source> Files are found equal if @@ -751,7 +654,7 @@ is the same <target> Τα αρχεία θεωρούνται ίδια, εάν - το περιεχόμενό τους -είναι ίδιο. +είναι ίδιο </target> <source>File content</source> @@ -763,7 +666,7 @@ is the same <source>Synchronizing...</source> <target>Γίνεται συγχρονισμός...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>Επεξεργάστηκαν στοιχεία:</target> <source>&Pause</source> @@ -875,10 +778,10 @@ Exclude: \stuff\temp\* <target>Εξαίρεση</target> <source>Minimum file size</source> -<target></target> +<target>Ελάχιστο μέγεθος αρχείου</target> <source>Maximum file size</source> -<target></target> +<target>Μέγιστο μέγεθος αρχείου</target> <source>&Default</source> <target>&Προεπιλογή</target> @@ -890,10 +793,10 @@ Exclude: \stuff\temp\* <target>Μετακίνηση της στήλης κάτω</target> <source>Transactional file copy</source> -<target></target> +<target>Συνδιαλλακτική αντιγραφή αρχείων</target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> -<target></target> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> +<target>Εγγραφή πρώτα σε προσωρινό αρχείο (*.ffs_tmp) και μετά μετονομασία του. Αυτή η ρύθμιση εγγυάται συνέπεια ακόμα και στην περίπτωση σοβαρού σφάλματος.</target> <source>Copy locked files</source> <target>Αντιγραφή κλειδωμένων αρχείων</target> @@ -908,7 +811,7 @@ Copy shared or locked files using Volume Shadow Copy Service </target> <source>Copy file access permissions</source> -<target></target> +<target>Αντιγραφή των αδειών προσπέλασης των αρχείων</target> <source> Transfer file and directory permissions @@ -949,6 +852,9 @@ Transfer file and directory permissions <source>&Find next</source> <target>&Εύρεση επομένου</target> +<source>Operation aborted!</source> +<target>Η λειτουργία ματαιώθηκε!</target> + <source>Main bar</source> <target>Γραμμή εργαλείων</target> @@ -983,11 +889,23 @@ Transfer file and directory permissions <target>Προσαρμογή...</target> <source>Select time span...</source> -<target></target> +<target>Επιλέξτε το χρονικό εύρος...</target> <source>Auto-adjust columns</source> <target>Αυτόματη προσαρμογή των στηλών</target> +<source>Icon size:</source> +<target>Μέγεθος εικονιδίων:</target> + +<source>Small</source> +<target>Μικρό</target> + +<source>Medium</source> +<target>Μεσαίο</target> + +<source>Large</source> +<target>Μεγάλο</target> + <source>Include all rows</source> <target>Συμπερίληψη όλων των γραμμών</target> @@ -1114,6 +1032,9 @@ Transfer file and directory permissions <source>File list exported!</source> <target>Ο κατάλογος των αρχείων έχει εξαχθεί!</target> +<source>Error writing file:</source> +<target>Σφάλμα κατά την εγγραφή του αρχείου:</target> + <source>Batch file created successfully!</source> <target>Το αρχείο δέσμης ενεργειών δημιουργήθηκε επιτυχώς!</target> @@ -1184,19 +1105,19 @@ Transfer file and directory permissions <target>Ανενεργό</target> <source>Last x hours</source> -<target></target> +<target>Τελευταίες x ώρες</target> <source>Today</source> -<target></target> +<target>Σήμερα</target> <source>This week</source> -<target></target> +<target>Αυτήν την εβδομάδα</target> <source>This month</source> -<target></target> +<target>Αυτόν το μήνα</target> <source>This year</source> -<target></target> +<target>Αυτό το έτος</target> <source>Byte</source> <target>Byte</target> @@ -1223,7 +1144,7 @@ Transfer file and directory permissions <target>Ως περιεχόμενο</target> <source>Copy NTFS permissions</source> -<target></target> +<target>Αντιγραφή αδειών προσπέλασης NTFS</target> <source>Integrate external applications into context menu. The following macros are available:</source> <target>Ένταξη εξωτερικών εφαρμογών στο μενού περιβάλλοντος. Οι ακόλουθες μακροεντολές είναι διαθέσιμες:</target> @@ -1279,6 +1200,105 @@ Transfer file and directory permissions <source>Move files into a time-stamped subdirectory</source> <target>Μεταφορά των αρχείων σε έναν υποκατάλογο με ένδειξη ώρας</target> +<source>%x TB</source> +<target>%x TB</target> + +<source>%x PB</source> +<target>%x PB</target> + +<source>%x%</source> +<target>%x%</target> + +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>1 λεπτό</pluralform> +<pluralform>%x λεπτά</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>1 ώρα</pluralform> +<pluralform>%x ώρες</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>1 μέρα</pluralform> +<pluralform>%x μέρες</pluralform> +</target> + +<source>Could not initialize directory monitoring:</source> +<target>Δεν ήταν δυνατό να γίνει έναρξη παρακολούθησης του υποκαταλόγου:</target> + +<source>Error when monitoring directories.</source> +<target>Σφάλμα κατά την παρακολούθηση υποκαταλόγων.</target> + +<source>Conversion error:</source> +<target>Σφάλμα μετατροπής:</target> + +<source>Error deleting file:</source> +<target>Σφάλμα κατά τη διαγραφή του αρχείου:</target> + +<source>Error moving file:</source> +<target>Σφάλμα κατά τη μεταφορά του αρχείου:</target> + +<source>Target file already existing!</source> +<target>Το αρχείο προορισμού υπάρχει ήδη!</target> + +<source>Error moving directory:</source> +<target>Σφάλμα κατά τη μεταφορά του υποκαταλόγου:</target> + +<source>Target directory already existing!</source> +<target>Ο υποκατάλογος προορισμού υπάρχει ήδη!</target> + +<source>Error deleting directory:</source> +<target>Σφάλμα κατά τη διαγραφή του υποκαταλόγου:</target> + +<source>Error changing modification time:</source> +<target>Σφάλμα κατά την αλλαγή της ώρας τροποποίησης:</target> + +<source>Error loading library function:</source> +<target>Σφάλμα κατά τη φόρτωση της συνάρτησης βιβλιοθήκης:</target> + +<source>Error reading security context:</source> +<target>Σφάλμα κατά την ανάγνωση του πλαισίου ασφαλείας:</target> + +<source>Error writing security context:</source> +<target>Σφάλμα κατά την εγγραφή του πλαισίου ασφάλειας:</target> + +<source>Error copying file permissions:</source> +<target>Σφάλμα κατά την αντιγραφή των αδειών των αρχείων:</target> + +<source>Error creating directory:</source> +<target>Σφάλμα κατά τη δημιουργία του υποκαταλόγου:</target> + +<source>Error copying symbolic link:</source> +<target>Σφάλμα κατά την αντιγραφή του συμβολικού δεσμού:</target> + +<source>Error copying file:</source> +<target>Σφάλμα κατά την αντιγραφή του αρχείου:</target> + +<source>Error opening file:</source> +<target>Σφάλμα κατά το άνοιγμα του αρχείου:</target> + +<source>Endless loop when traversing directory:</source> +<target>Ατέρμονος βρόχος κατά την την ανάλυση του υποκαταλόγου:</target> + +<source>Error traversing directory:</source> +<target>Σφάλμα κατά την ανάλυση του υποκαταλόγου:</target> + +<source>Error setting privilege:</source> +<target>Σφάλμα κατά τον ορισμό δικαιωμάτων:</target> + <source>Both sides have changed since last synchronization!</source> <target>Και οι δυο πλευρές έχουν αλλάξει από τον τελευταίο συγχρονισμό!</target> @@ -1376,40 +1396,40 @@ Transfer file and directory permissions <target>Διαγραφή του υποκαταλόγου %x</target> <source>Deleting symbolic link %x</source> -<target></target> +<target>Διαγραφή του συμβολικού δεσμού %x</target> <source>Moving file %x to recycle bin</source> -<target></target> +<target>Μεταφορά του αρχείου %x στον κάδο ανακύκλωσης</target> <source>Moving folder %x to recycle bin</source> -<target></target> +<target>Μεταφορά του υποκαταλόγου %x στον κάδο ανακύκλωσης</target> <source>Moving symbolic link %x to recycle bin</source> -<target></target> +<target>Μεταφορά του συμβολικού δεσμού %x στον κάδο ανακύκλωσης</target> <source>Moving file %x to %y</source> -<target></target> +<target>Μεταφορά του αρχείου %x στο %y</target> <source>Moving folder %x to %y</source> -<target></target> +<target>Μεταφορά του υποκαταλόγου %x στο %y</target> <source>Moving symbolic link %x to %y</source> -<target></target> +<target>Μεταφορά του συμβολικού δεσμού %x στο %y</target> <source>Creating file %x</source> -<target></target> +<target>Δημιουργία του αρχείου %x</target> <source>Creating symbolic link %x</source> -<target></target> +<target>Δημιουργία του συμβολικού δεσμού %x</target> <source>Creating folder %x</source> <target>Δημιουργία του υποκαταλόγου %x</target> <source>Overwriting file %x</source> -<target></target> +<target>Αντικατάσταση του αρχείου %x</target> <source>Overwriting symbolic link %x</source> -<target></target> +<target>Αντικατάσταση του συμβολικού δεσμού %x</target> <source>Verifying file %x</source> <target>Επικύρωση του αρχείου %x</target> @@ -1448,7 +1468,7 @@ Transfer file and directory permissions <target>Διαθέσιμος ελεύθερος χώρος δίσκου:</target> <source>Recycle Bin is not available for the following paths! Files will be deleted permanently instead:</source> -<target></target> +<target>Ο Κάδος Ανακύκλωσης δεν είναι διαθέσιμος για τις ακόλουθες διαδρομές! Τα αρχεία θα διαγραφούν μόνιμα:</target> <source>A directory will be modified which is part of multiple folder pairs! Please review synchronization settings!</source> <target>Θα τροποποιηθεί ένας υποκατάλογος που ανήκει σε πολλαπλά ζεύγη υποκαταλόγων! Παρακαλώ αναθεωρείστε τις ρυθμίσεις συγχρονισμού.</target> diff --git a/BUILD/Languages/hebrew.lng b/BUILD/Languages/hebrew.lng index 783227a6..eaf1aee6 100644 --- a/BUILD/Languages/hebrew.lng +++ b/BUILD/Languages/hebrew.lng @@ -25,6 +25,12 @@ <source>Browse</source> <target>עיין</target> +<source>Windows Error Code %x:</source> +<target>קוד שגיאת חלונות %x:</target> + +<source>Linux Error Code %x:</source> +<target>קוד שגיאת לינוקס %x:</target> + <source>Invalid command line: %x</source> <target>שורת פקודה בלתי חוקית: %x</target> @@ -226,33 +232,6 @@ <source>/sec</source> <target>/שנ</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>1 דקה</pluralform> -<pluralform>%x דקות</pluralform> -</target> - -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>1 שעה</pluralform> -<pluralform>%x שעות</pluralform> -</target> - -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>1 יום</pluralform> -<pluralform>%x ימים</pluralform> -</target> - <source>S&ave configuration...</source> <target>&שמור תצורה...</target> @@ -411,27 +390,21 @@ The command line is executed each time: <source>Operation aborted!</source> <target>הפעולה בוטלה!</target> -<source>Could not load a required DLL:</source> -<target>:נדרש DLL לא יכל לטעון</target> - <source>Endless loop when traversing directory:</source> <target>נוצרת לולאה אינסופית בחצית מחיצות</target> <source>Error traversing directory:</source> <target>שגיאה בהצלבת מחיצות</target> -<source>Windows Error Code %x:</source> -<target>קוד שגיאת חלונות %x:</target> - -<source>Linux Error Code %x:</source> -<target>קוד שגיאת לינוקס %x:</target> - <source>Error setting privilege:</source> <target>שגיאה בהשמת פריווילגיה</target> <source>Error moving to Recycle Bin:</source> <target>שגיאה בהעברה לסל המיחזור:</target> +<source>Could not load a required DLL:</source> +<target>:נדרש DLL לא יכל לטעון</target> + <source>Error writing to synchronization database:</source> <target>שגיאה ברישום לבסיס נתוני סנכרון:</target> @@ -456,6 +429,33 @@ The command line is executed each time: <source>%x%</source> <target>%x%</target> +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>1 דקה</pluralform> +<pluralform>%x דקות</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>1 שעה</pluralform> +<pluralform>%x שעות</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>1 יום</pluralform> +<pluralform>%x ימים</pluralform> +</target> + <source>Could not read values for the following XML nodes:</source> <target>XML לא יכול לקרא ערכים מצמתי :</target> @@ -654,10 +654,13 @@ The command line is executed each time: <source>&Cancel</source> <target>&בטל</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>פעולה:</target> + +<source>Items found:</source> <target>אלמנטים נמצאו:</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>אלמנתים נותרו:</target> <source>Speed:</source> @@ -669,9 +672,6 @@ The command line is executed each time: <source>Time elapsed:</source> <target>זמן עבר:</target> -<source>Operation:</source> -<target>פעולה:</target> - <source>Select variant:</source> <target>בחר משתנה:</target> @@ -771,7 +771,7 @@ is the same <source>Synchronizing...</source> <target>מסנכרן...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>אלמנטים עובדו:</target> <source>&Pause</source> @@ -900,8 +900,8 @@ Exclude: \stuff\temp\* <source>Transactional file copy</source> <target>העתקת קובץ בעסקה</target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> -<target>רשום קבצים כזמניים (*.ffs_tmp) ואח"כ שנה שמם. פעולה זו מבטיחה עקביות משתני נמצב גם במקרה של שגיאה קטלנית</target> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> +<target></target> <source>Copy locked files</source> <target>העתק קבצים נעולים</target> @@ -996,6 +996,18 @@ Transfer file and directory permissions <source>Auto-adjust columns</source> <target>עימוד אוטומטי</target> +<source>Icon size:</source> +<target></target> + +<source>Small</source> +<target></target> + +<source>Medium</source> +<target></target> + +<source>Large</source> +<target></target> + <source>Include all rows</source> <target>כלול את כל השורות</target> diff --git a/BUILD/Languages/hungarian.lng b/BUILD/Languages/hungarian.lng index 2fbca577..22414ea0 100644 --- a/BUILD/Languages/hungarian.lng +++ b/BUILD/Languages/hungarian.lng @@ -25,6 +25,12 @@ <source>Browse</source> <target>Tallózás</target> +<source>Windows Error Code %x:</source> +<target>Windows hibakód %x:</target> + +<source>Linux Error Code %x:</source> +<target>Linux hibakód %x:</target> + <source>Invalid command line: %x</source> <target>Érvénytelen parancssor: %x</target> @@ -226,33 +232,6 @@ <source>/sec</source> <target>/másodperc</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>1 perc</pluralform> -<pluralform>%x perc</pluralform> -</target> - -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>1 óra</pluralform> -<pluralform>%x óra</pluralform> -</target> - -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>1 nap</pluralform> -<pluralform>%x nap</pluralform> -</target> - <source>S&ave configuration...</source> <target>Beállítások mentés&e...</target> @@ -411,27 +390,21 @@ A parancssor végrehajtódik minden alkalommal, ha: <source>Operation aborted!</source> <target>Művelet megszakítva!</target> -<source>Could not load a required DLL:</source> -<target>A szükséges DLL betöltése sikertelen:</target> - <source>Endless loop when traversing directory:</source> <target>Végtelen hurok a mappák bejárásakor:</target> <source>Error traversing directory:</source> <target>A mappa átnézése sikertelen:</target> -<source>Windows Error Code %x:</source> -<target>Windows hibakód %x:</target> - -<source>Linux Error Code %x:</source> -<target>Linux hibakód %x:</target> - <source>Error setting privilege:</source> <target>Hiba történt a jogok beállítása közben:</target> <source>Error moving to Recycle Bin:</source> <target>A Lomtárba (Recycle Bin) mozgatás sikertelen:</target> +<source>Could not load a required DLL:</source> +<target>A szükséges DLL betöltése sikertelen:</target> + <source>Error writing to synchronization database:</source> <target>Hiba történt a szinkronizációs adatbázis írása közben:</target> @@ -456,6 +429,33 @@ A parancssor végrehajtódik minden alkalommal, ha: <source>%x%</source> <target>%x%</target> +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>1 perc</pluralform> +<pluralform>%x perc</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>1 óra</pluralform> +<pluralform>%x óra</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>1 nap</pluralform> +<pluralform>%x nap</pluralform> +</target> + <source>Could not read values for the following XML nodes:</source> <target>A következő XML-csomópontok értékének beolvasása sikertelen:</target> @@ -654,10 +654,13 @@ A parancssor végrehajtódik minden alkalommal, ha: <source>&Cancel</source> <target>&Mégsem</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>Művelet:</target> + +<source>Items found:</source> <target>Talált elemek száma:</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>Hátralévő elemek száma:</target> <source>Speed:</source> @@ -669,9 +672,6 @@ A parancssor végrehajtódik minden alkalommal, ha: <source>Time elapsed:</source> <target>Eltelt idő:</target> -<source>Operation:</source> -<target>Művelet:</target> - <source>Select variant:</source> <target>Változat kiválasztása:</target> @@ -769,7 +769,7 @@ A fájlok megegyeznek, ha megegyezik <source>Synchronizing...</source> <target>Szinkronizálás folyamatban...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>Feldolgozott elemek száma:</target> <source>&Pause</source> @@ -901,8 +901,8 @@ Kizárni: \stuff\temp\* <source>Transactional file copy</source> <target>Tranzakciós fájlmásolás</target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> -<target>A fájlok először ideglenes fájlokba (*.ffs_tmp) lesznek írva, majd azok át lesznek nevezve. Ez egyező állapotot garantál még végzetes hiba esetén is.</target> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> +<target></target> <source>Copy locked files</source> <target>Zárolt fájlok másolása</target> diff --git a/BUILD/Languages/italian.lng b/BUILD/Languages/italian.lng index 45866294..47224e77 100644 --- a/BUILD/Languages/italian.lng +++ b/BUILD/Languages/italian.lng @@ -8,7 +8,7 @@ </header> <source>Searching for directory %x...</source> -<target></target> +<target>Ricerca directory %x in corso...</target> <source>Show in Explorer</source> <target>Mostra in Esplora Risorse</target> @@ -25,17 +25,23 @@ <source>Browse</source> <target>Sfoglia</target> +<source>Windows Error Code %x:</source> +<target>Errore Windows Codice %x:</target> + +<source>Linux Error Code %x:</source> +<target>Errore Linux Codice %x:</target> + <source>Invalid command line: %x</source> -<target></target> +<target>Linea di comando non valida: %x</target> <source>Error resolving symbolic link:</source> <target>Errore nella risoluzione di collegamento simbolico:</target> <source>Show pop-up</source> -<target></target> +<target>Mostra pop-up</target> <source>Show pop-up on errors or warnings</source> -<target></target> +<target>Mostra pop-up di errori o avvisi</target> <source>Ignore errors</source> <target>Ignora gli errori</target> @@ -50,7 +56,7 @@ <target>Interrompi immediatamente la sincronizzazione</target> <source>Select alternate comparison settings</source> -<target></target> +<target>Seleziona impostazioni di comparazione alternative</target> <source>Select alternate synchronization settings</source> <target>Seleziona impostazioni di sincronizzazione alternative</target> @@ -107,7 +113,7 @@ <target>Trova</target> <source>Select time span</source> -<target></target> +<target>Seleziona intervallo di tempo</target> <source>%x MB</source> <target>%x MB</target> @@ -170,7 +176,7 @@ <target>Errore in lettura dal database di sincronizzione:</target> <source>Database files do not share a common synchronization session:</source> -<target></target> +<target>I file database non condividono una comune sessione di sincronizzazione:</target> <source>An exception occurred!</source> <target>Si è verificato un problema!</target> @@ -209,7 +215,10 @@ <pluralform>[1 Thread]</pluralform> <pluralform>[%x Threads]</pluralform> </source> -<target></target> +<target> +<pluralform>[1 Thread]</pluralform> +<pluralform>[%x Threads]</pluralform> +</target> <source>Invalid FreeFileSync config file!</source> <target>File di configurazione FreeFileSync non valido!</target> @@ -223,33 +232,6 @@ <source>/sec</source> <target>/sec</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</target> - -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>1 ora</pluralform> -<pluralform>%x ore</pluralform> -</target> - -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>1 giorno</pluralform> -<pluralform>%x giorni</pluralform> -</target> - <source>S&ave configuration...</source> <target>S&alva la configurazione...</target> @@ -414,12 +396,6 @@ La linea di comando è eseguita ogni volta che: <source>Error traversing directory:</source> <target>Errore nel percorso della directory:</target> -<source>Windows Error Code %x:</source> -<target>Errore Windows Codice %x:</target> - -<source>Linux Error Code %x:</source> -<target>Errore Linux Codice %x:</target> - <source>Error setting privilege:</source> <target>Errore nell'impostazione dei privilegi:</target> @@ -433,7 +409,7 @@ La linea di comando è eseguita ogni volta che: <target>Errore in scrittura sul database di sincronizzazione:</target> <source>Error accessing Volume Shadow Copy Service!</source> -<target></target> +<target>Errore in accesso al Servizio Volume Shadow Copy</target> <source>Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit version.</source> <target>La creazione di copie shadow su WOW64 non e' supportata. Utilizzare FreeFileSync in versione 64-bit.</target> @@ -453,6 +429,33 @@ La linea di comando è eseguita ogni volta che: <source>%x%</source> <target>%x%</target> +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>1 ora</pluralform> +<pluralform>%x ore</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>1 giorno</pluralform> +<pluralform>%x giorni</pluralform> +</target> + <source>Could not read values for the following XML nodes:</source> <target>Impossibile leggere i valori per i seguenti nodi XML:</target> @@ -607,7 +610,7 @@ La linea di comando è eseguita ogni volta che: <target>Batch job</target> <source>Create a batch file for automated synchronization. To start in batch mode simply double-click the file or execute via command line: FreeFileSync.exe <ffs_batch file>. This can also be scheduled in your operating system's task planner.</source> -<target></target> +<target>Crea un batch file per una sincronizzazione automatizzata. Per partire in modalità batch è sufficiente fare doppio click sul file o eseguire da linea di comando: FreeFileSync.exe <ffs_batch file>. Puoi anche schedulare l'esecuzione nelle operazioni pianificate del suo sistema operativo.</target> <source>Help</source> <target>Aiuto</target> @@ -631,7 +634,7 @@ La linea di comando è eseguita ogni volta che: <target>Feedback di stato</target> <source>Run minimized</source> -<target></target> +<target>Avvia minimizzato</target> <source>Maximum number of logfiles:</source> <target>Numero massimo di logfiles:</target> @@ -640,7 +643,7 @@ La linea di comando è eseguita ogni volta che: <target>Seleziona cartella per il file di log:</target> <source>Batch settings</source> -<target></target> +<target>Impostazioni Batch</target> <source>&Save</source> <target>&Salva</target> @@ -651,10 +654,13 @@ La linea di comando è eseguita ogni volta che: <source>&Cancel</source> <target>&Annulla</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>Operazione:</target> + +<source>Items found:</source> <target>Elementi trovati:</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>Elementi rimanenti:</target> <source>Speed:</source> @@ -666,9 +672,6 @@ La linea di comando è eseguita ogni volta che: <source>Time elapsed:</source> <target>Tempo trascorso:</target> -<source>Operation:</source> -<target>Operazione:</target> - <source>Select variant:</source> <target>Selezionare una variante:</target> @@ -738,10 +741,15 @@ Files are found equal if - file size are the same </source> -<target></target> +<target> +I file sono considerati identici se + - data e ora di ultima modifica + - dimensione +sono identici +</target> <source>File time and size</source> -<target></target> +<target>Ora e dimensione file</target> <source> Files are found equal if @@ -763,7 +771,7 @@ I file sono considerati identici se <source>Synchronizing...</source> <target>Sincronizzazione in corso...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>Elementi processati:</target> <source>&Pause</source> @@ -875,10 +883,10 @@ Escludi: \stuff\temp\* <target>Escludi</target> <source>Minimum file size</source> -<target></target> +<target>Dimensione minima file</target> <source>Maximum file size</source> -<target></target> +<target>Dimensione massima file</target> <source>&Default</source> <target>&Default</target> @@ -890,9 +898,9 @@ Escludi: \stuff\temp\* <target>Sposta colonna giu'</target> <source>Transactional file copy</source> -<target></target> +<target>Copia transazionale file</target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> <target></target> <source>Copy locked files</source> @@ -908,7 +916,7 @@ Copia file condivisi o bloccati usando il Servizio Volume Shadow Copy </target> <source>Copy file access permissions</source> -<target></target> +<target>Copia permessi di accesso file</target> <source> Transfer file and directory permissions @@ -983,11 +991,23 @@ Trasferisci file e permessi sulle cartelle <target>Personalizza...</target> <source>Select time span...</source> -<target></target> +<target>Seleziona intervallo di tempo...</target> <source>Auto-adjust columns</source> <target>Larghezza automatica colonne</target> +<source>Icon size:</source> +<target></target> + +<source>Small</source> +<target></target> + +<source>Medium</source> +<target></target> + +<source>Large</source> +<target></target> + <source>Include all rows</source> <target>Includi tutte le righe</target> @@ -1184,19 +1204,19 @@ Trasferisci file e permessi sulle cartelle <target>Inattivo</target> <source>Last x hours</source> -<target></target> +<target>Ultime x ore</target> <source>Today</source> -<target></target> +<target>Oggi</target> <source>This week</source> -<target></target> +<target>Questa settimana</target> <source>This month</source> -<target></target> +<target>Questo mese</target> <source>This year</source> -<target></target> +<target>Quest'anno</target> <source>Byte</source> <target>Byte</target> @@ -1223,7 +1243,7 @@ Trasferisci file e permessi sulle cartelle <target>Segui</target> <source>Copy NTFS permissions</source> -<target></target> +<target>Copia permessi NTFS</target> <source>Integrate external applications into context menu. The following macros are available:</source> <target>Integra applicazioni esterne nel menu contestuale. Sono disponibili le seguenti macro:</target> @@ -1376,40 +1396,40 @@ Trasferisci file e permessi sulle cartelle <target>Eliminazione cartella %x</target> <source>Deleting symbolic link %x</source> -<target></target> +<target>Cancellazione link simbolico %x in corso</target> <source>Moving file %x to recycle bin</source> -<target></target> +<target>Spostamento file %x nel cestino in corso</target> <source>Moving folder %x to recycle bin</source> -<target></target> +<target>Spostamento cartella %x nel cestino in corso</target> <source>Moving symbolic link %x to recycle bin</source> -<target></target> +<target>Spostamento link simbolico %x nel cestino in corso</target> <source>Moving file %x to %y</source> -<target></target> +<target>Spostamento file %x su %y</target> <source>Moving folder %x to %y</source> -<target></target> +<target>Spostamento cartella %x su %y</target> <source>Moving symbolic link %x to %y</source> -<target></target> +<target>Spostamento link simbolico %x su %y</target> <source>Creating file %x</source> -<target></target> +<target>Creazione file %x</target> <source>Creating symbolic link %x</source> -<target></target> +<target>Creazione link simbolico %x</target> <source>Creating folder %x</source> <target>Creazione cartella %x</target> <source>Overwriting file %x</source> -<target></target> +<target>Sovrascrittura file %x</target> <source>Overwriting symbolic link %x</source> -<target></target> +<target>Sovrascrittura link simbolico %x</target> <source>Verifying file %x</source> <target>Verifica di file %x</target> @@ -1448,7 +1468,7 @@ Trasferisci file e permessi sulle cartelle <target>Spazio libero su disco disponibile:</target> <source>Recycle Bin is not available for the following paths! Files will be deleted permanently instead:</source> -<target></target> +<target>Cestino non disponibile per i seguenti percorsi! I file verranno cancellati in modo permanente:</target> <source>A directory will be modified which is part of multiple folder pairs! Please review synchronization settings!</source> <target>Una directory che fa parte di più coppie di cartelle sarà modificata! Ricontrolla le impostazioni di sincronizzazione!</target> diff --git a/BUILD/Languages/japanese.lng b/BUILD/Languages/japanese.lng index 7731c0d7..564fb241 100644 --- a/BUILD/Languages/japanese.lng +++ b/BUILD/Languages/japanese.lng @@ -25,6 +25,12 @@ <source>Browse</source> <target>参照</target> +<source>Windows Error Code %x:</source> +<target>Windows エラーコード %x:</target> + +<source>Linux Error Code %x:</source> +<target>Linux エラーコード %x:</target> + <source>Invalid command line: %x</source> <target></target> @@ -221,30 +227,6 @@ <source>/sec</source> <target>/秒</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>%x 分.</pluralform> -</target> - -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>%x 時間</pluralform> -</target> - -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>%x 日</pluralform> -</target> - <source>S&ave configuration...</source> <target>構成設定を保存(&A)...</target> @@ -409,12 +391,6 @@ The command line is executed each time: <source>Error traversing directory:</source> <target>ディレクトリの移動エラー:</target> -<source>Windows Error Code %x:</source> -<target>Windows エラーコード %x:</target> - -<source>Linux Error Code %x:</source> -<target>Linux エラーコード %x:</target> - <source>Error setting privilege:</source> <target>特権の設定エラー:</target> @@ -448,6 +424,30 @@ The command line is executed each time: <source>%x%</source> <target>%x%</target> +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>%x 分.</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>%x 時間</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>%x 日</pluralform> +</target> + <source>Could not read values for the following XML nodes:</source> <target>以下の XMLノードの値を読み込むことが出来ません:</target> @@ -646,10 +646,13 @@ The command line is executed each time: <source>&Cancel</source> <target>キャンセル(&C)</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>操作:</target> + +<source>Items found:</source> <target>見つかった要素:</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>残りの要素:</target> <source>Speed:</source> @@ -661,9 +664,6 @@ The command line is executed each time: <source>Time elapsed:</source> <target>経過時間:</target> -<source>Operation:</source> -<target>操作:</target> - <source>Select variant:</source> <target>変数を選択:</target> @@ -758,7 +758,7 @@ is the same <source>Synchronizing...</source> <target>同期処理中...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>処理された要素:</target> <source>&Pause</source> @@ -887,7 +887,7 @@ Exclude: \stuff\temp\* <source>Transactional file copy</source> <target></target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> <target></target> <source>Copy locked files</source> @@ -983,6 +983,18 @@ Transfer file and directory permissions <source>Auto-adjust columns</source> <target>列の自動調整</target> +<source>Icon size:</source> +<target></target> + +<source>Small</source> +<target></target> + +<source>Medium</source> +<target></target> + +<source>Large</source> +<target></target> + <source>Include all rows</source> <target>すべての行を含める</target> diff --git a/BUILD/Languages/korean.lng b/BUILD/Languages/korean.lng index 1d433404..d2774556 100644 --- a/BUILD/Languages/korean.lng +++ b/BUILD/Languages/korean.lng @@ -25,6 +25,12 @@ <source>Browse</source> <target>찾아보기</target> +<source>Windows Error Code %x:</source> +<target>윈도우 에러 코드 %x:</target> + +<source>Linux Error Code %x:</source> +<target>리눅스 에러 코드 %x:</target> + <source>Invalid command line: %x</source> <target>잘못된 명령줄 : %x</target> @@ -223,30 +229,6 @@ <source>/sec</source> <target>/초</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>%x분</pluralform> -</target> - -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>%x시간</pluralform> -</target> - -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>%x일</pluralform> -</target> - <source>S&ave configuration...</source> <target>설정 저장</target> @@ -405,27 +387,21 @@ The command line is executed each time: <source>Operation aborted!</source> <target>작업 중단!</target> -<source>Could not load a required DLL:</source> -<target>필요한 DLL을 로드할 수 없습니다 :</target> - <source>Endless loop when traversing directory:</source> <target>디렉토리 이동 중 무한 루프 발생 :</target> <source>Error traversing directory:</source> <target>디렉토리 이동 중 발생한 오류 :</target> -<source>Windows Error Code %x:</source> -<target>윈도우 에러 코드 %x:</target> - -<source>Linux Error Code %x:</source> -<target>리눅스 에러 코드 %x:</target> - <source>Error setting privilege:</source> <target>권한 설정 중 발생한 오류 :</target> <source>Error moving to Recycle Bin:</source> <target>휴지통으로 이동 중 발생한 오류 :</target> +<source>Could not load a required DLL:</source> +<target>필요한 DLL을 로드할 수 없습니다 :</target> + <source>Error writing to synchronization database:</source> <target>동기화 데이터베이스에 쓰던 중 발생한 오류 :</target> @@ -450,6 +426,30 @@ The command line is executed each time: <source>%x%</source> <target>%x%</target> +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>%x분</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>%x시간</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>%x일</pluralform> +</target> + <source>Could not read values for the following XML nodes:</source> <target>다음 XML 노드 값을 읽어 들일 수 없습니다 :</target> @@ -648,10 +648,13 @@ The command line is executed each time: <source>&Cancel</source> <target>취소(&C)</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>작업 :</target> + +<source>Items found:</source> <target>발견된 요소 :</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>남은 요소 :</target> <source>Speed:</source> @@ -663,9 +666,6 @@ The command line is executed each time: <source>Time elapsed:</source> <target>경과 시간 :</target> -<source>Operation:</source> -<target>작업 :</target> - <source>Select variant:</source> <target>옵션 선택 :</target> @@ -765,7 +765,7 @@ is the same <source>Synchronizing...</source> <target>동기화 작업 중...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>처리된 요소 :</target> <source>&Pause</source> @@ -894,8 +894,8 @@ Exclude: \stuff\temp\* <source>Transactional file copy</source> <target>트랜잭션 파일 복사</target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> -<target>우선 임시 (*.ffs_tmp)에 파일을 작성하고 파일명을 변경하세요. 이 같은 조치는 치명적인 오류 상황에서도 일관성 있는 상태를 보장합니다.</target> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> +<target></target> <source>Copy locked files</source> <target>락 걸린 파일 복사</target> @@ -990,6 +990,18 @@ Transfer file and directory permissions <source>Auto-adjust columns</source> <target>열 자동정렬</target> +<source>Icon size:</source> +<target></target> + +<source>Small</source> +<target></target> + +<source>Medium</source> +<target></target> + +<source>Large</source> +<target></target> + <source>Include all rows</source> <target>모든 행 포함</target> diff --git a/BUILD/Languages/polish.lng b/BUILD/Languages/polish.lng index ca75fd95..a6034607 100644 --- a/BUILD/Languages/polish.lng +++ b/BUILD/Languages/polish.lng @@ -25,6 +25,12 @@ <source>Browse</source> <target>Przeglądaj</target> +<source>Windows Error Code %x:</source> +<target>Błąd systemu Windows %x:</target> + +<source>Linux Error Code %x:</source> +<target>Błąd systemu linux %x:</target> + <source>Invalid command line: %x</source> <target>Nieprawidłowa komenda: %x</target> @@ -229,36 +235,6 @@ <source>/sec</source> <target>/sekundę</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>1 minuta</pluralform> -<pluralform>%x minuty</pluralform> -<pluralform>%x minut</pluralform> -</target> - -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>1 godzina</pluralform> -<pluralform>%x godziny</pluralform> -<pluralform>%x godzin</pluralform> -</target> - -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>1 dzień</pluralform> -<pluralform>%x dni</pluralform> -<pluralform>%x dni</pluralform> -</target> - <source>S&ave configuration...</source> <target>Z&apisz konfigurację...</target> @@ -417,27 +393,21 @@ Komenda jest wykonwywana za każdym razem gdy: <source>Operation aborted!</source> <target>Operacja przerwana!</target> -<source>Could not load a required DLL:</source> -<target>Nie można załadować wymaganej biblioteki DLL:</target> - <source>Endless loop when traversing directory:</source> <target>Zapętlenie podczas przeglądania katalogu:</target> <source>Error traversing directory:</source> <target>Błąd podczas odczytywania katalogu:</target> -<source>Windows Error Code %x:</source> -<target>Błąd systemu Windows %x:</target> - -<source>Linux Error Code %x:</source> -<target>Błąd systemu linux %x:</target> - <source>Error setting privilege:</source> <target>Błąd ustawiania uprawnień:</target> <source>Error moving to Recycle Bin:</source> <target>Błąd podczas przenoszenia do kosza:</target> +<source>Could not load a required DLL:</source> +<target>Nie można załadować wymaganej biblioteki DLL:</target> + <source>Error writing to synchronization database:</source> <target>Błąd zapisu do bazy danych synchronizacji:</target> @@ -462,6 +432,36 @@ Komenda jest wykonwywana za każdym razem gdy: <source>%x%</source> <target>%x%</target> +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>1 minuta</pluralform> +<pluralform>%x minuty</pluralform> +<pluralform>%x minut</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>1 godzina</pluralform> +<pluralform>%x godziny</pluralform> +<pluralform>%x godzin</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>1 dzień</pluralform> +<pluralform>%x dni</pluralform> +<pluralform>%x dni</pluralform> +</target> + <source>Could not read values for the following XML nodes:</source> <target>Nie można odczytać wartości dla danych gałęzi XML:</target> @@ -660,10 +660,13 @@ Komenda jest wykonwywana za każdym razem gdy: <source>&Cancel</source> <target>&Anuluj</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>Operacja:</target> + +<source>Items found:</source> <target>Znalezione elementy:</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>Pozostałe elementy:</target> <source>Speed:</source> @@ -675,9 +678,6 @@ Komenda jest wykonwywana za każdym razem gdy: <source>Time elapsed:</source> <target>Czas:</target> -<source>Operation:</source> -<target>Operacja:</target> - <source>Select variant:</source> <target>Wybierz wariant:</target> @@ -777,7 +777,7 @@ jest identyczna <source>Synchronizing...</source> <target>Synchronizuję...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>Przetworzeone elementy:</target> <source>&Pause</source> @@ -906,8 +906,8 @@ Wyklucz: \moje\temp\* <source>Transactional file copy</source> <target>Transakcyjne kopiowanie pliku</target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> -<target>Zapisz pliki tymczasowo pod nazwą (*.ffs_tmp), a następnie zmień nazwę. Gwarantuje to spójność kopiowania nawat podczas awarii.</target> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> +<target></target> <source>Copy locked files</source> <target>Kopiuj zablokowane pliki</target> @@ -1002,6 +1002,18 @@ Transfer uprawnień plików i katalogów <source>Auto-adjust columns</source> <target>Autodopasowanie kolumn</target> +<source>Icon size:</source> +<target></target> + +<source>Small</source> +<target></target> + +<source>Medium</source> +<target></target> + +<source>Large</source> +<target></target> + <source>Include all rows</source> <target>Dołącz wszystkie rzędy</target> diff --git a/BUILD/Languages/portuguese.lng b/BUILD/Languages/portuguese.lng index 15d0e501..393b5257 100644 --- a/BUILD/Languages/portuguese.lng +++ b/BUILD/Languages/portuguese.lng @@ -25,6 +25,12 @@ <source>Browse</source> <target>Procurar</target> +<source>Windows Error Code %x:</source> +<target>Código de erro do Windows %x:</target> + +<source>Linux Error Code %x:</source> +<target>Código de erro do Linux %x:</target> + <source>Invalid command line: %x</source> <target>Linha de comando inválida: %x</target> @@ -226,33 +232,6 @@ <source>/sec</source> <target>/seg</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>1 min</pluralform> -<pluralform>%x mins</pluralform> -</target> - -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>1 hora</pluralform> -<pluralform>%x horas</pluralform> -</target> - -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>1 dia</pluralform> -<pluralform>%x dias</pluralform> -</target> - <source>S&ave configuration...</source> <target>G&uardar a configuração...</target> @@ -411,27 +390,21 @@ A linha de comandos é executada cada vez que: <source>Operation aborted!</source> <target>Operação abortada!</target> -<source>Could not load a required DLL:</source> -<target>Não foi possível carregar a DLL:</target> - <source>Endless loop when traversing directory:</source> <target>Loop infinito ao percorrer directório:</target> <source>Error traversing directory:</source> <target>Erro ao percorrer a pasta:</target> -<source>Windows Error Code %x:</source> -<target>Código de erro do Windows %x:</target> - -<source>Linux Error Code %x:</source> -<target>Código de erro do Linux %x:</target> - <source>Error setting privilege:</source> <target>Erro ao estabelecer privilégios:</target> <source>Error moving to Recycle Bin:</source> <target>Erro ao mover para a Reciclagem:</target> +<source>Could not load a required DLL:</source> +<target>Não foi possível carregar a DLL:</target> + <source>Error writing to synchronization database:</source> <target>Erro na escrita da base de dados de sincronização:</target> @@ -456,6 +429,33 @@ A linha de comandos é executada cada vez que: <source>%x%</source> <target>%x%</target> +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>1 min</pluralform> +<pluralform>%x mins</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>1 hora</pluralform> +<pluralform>%x horas</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>1 dia</pluralform> +<pluralform>%x dias</pluralform> +</target> + <source>Could not read values for the following XML nodes:</source> <target>Não foi possível ler os valores dos seguintes nós XML:</target> @@ -654,10 +654,13 @@ A linha de comandos é executada cada vez que: <source>&Cancel</source> <target>&Cancelar</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>Operação:</target> + +<source>Items found:</source> <target>Elementos encontrados:</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>Elementos restantes:</target> <source>Speed:</source> @@ -669,9 +672,6 @@ A linha de comandos é executada cada vez que: <source>Time elapsed:</source> <target>Tempo passado:</target> -<source>Operation:</source> -<target>Operação:</target> - <source>Select variant:</source> <target>Selecione uma variante:</target> @@ -770,7 +770,7 @@ Os ficheiros são considerados iguais se <source>Synchronizing...</source> <target>A sincronizar...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>Elementos processados:</target> <source>&Pause</source> @@ -899,8 +899,8 @@ Excluir: \stuff\temp\* <source>Transactional file copy</source> <target>Copia ficheiro transacional</target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> -<target>Escrever num ficheiro temporário (*.ffs_tmp) e renomear. Garante consistência mesmo em situações de falha crítica.</target> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> +<target></target> <source>Copy locked files</source> <target>Copiar ficheiros bloqueados</target> @@ -995,6 +995,18 @@ Transferir ficheiro e permissões <source>Auto-adjust columns</source> <target>Auto ajustar colunas</target> +<source>Icon size:</source> +<target></target> + +<source>Small</source> +<target></target> + +<source>Medium</source> +<target></target> + +<source>Large</source> +<target></target> + <source>Include all rows</source> <target>Incluir todas as linhas</target> diff --git a/BUILD/Languages/portuguese_br.lng b/BUILD/Languages/portuguese_br.lng index 700abdf2..6ac527bd 100644 --- a/BUILD/Languages/portuguese_br.lng +++ b/BUILD/Languages/portuguese_br.lng @@ -25,6 +25,12 @@ <source>Browse</source> <target>Procurar</target> +<source>Windows Error Code %x:</source> +<target>Código de Erro do Windows %x:</target> + +<source>Linux Error Code %x:</source> +<target>Código de Erro do Linux %x:</target> + <source>Invalid command line: %x</source> <target>Linha de comando inválida: %x</target> @@ -226,33 +232,6 @@ <source>/sec</source> <target>/seg</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</target> - -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>1 hora</pluralform> -<pluralform>%x horas</pluralform> -</target> - -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>1 dia</pluralform> -<pluralform>%x dias</pluralform> -</target> - <source>S&ave configuration...</source> <target>S&alvar configuração...</target> @@ -411,27 +390,21 @@ A linha de comando é executada cada vez que: <source>Operation aborted!</source> <target>Operação cancelada!</target> -<source>Could not load a required DLL:</source> -<target>Não foi possível carregar uma DLL requerida:</target> - <source>Endless loop when traversing directory:</source> <target>Loop infinito quando percorrendo diretório:</target> <source>Error traversing directory:</source> <target>Erro ao percorrer diretório:</target> -<source>Windows Error Code %x:</source> -<target>Código de Erro do Windows %x:</target> - -<source>Linux Error Code %x:</source> -<target>Código de Erro do Linux %x:</target> - <source>Error setting privilege:</source> <target>Erro ao definir privilégio:</target> <source>Error moving to Recycle Bin:</source> <target>Erro ao mover para a Lixeira:</target> +<source>Could not load a required DLL:</source> +<target>Não foi possível carregar uma DLL requerida:</target> + <source>Error writing to synchronization database:</source> <target>Erro ao escrever no banco de dados de sincronização:</target> @@ -456,6 +429,33 @@ A linha de comando é executada cada vez que: <source>%x%</source> <target>%x%</target> +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>1 hora</pluralform> +<pluralform>%x horas</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>1 dia</pluralform> +<pluralform>%x dias</pluralform> +</target> + <source>Could not read values for the following XML nodes:</source> <target>Não foi possível ler os valores para os seguintes nós XML:</target> @@ -654,10 +654,13 @@ A linha de comando é executada cada vez que: <source>&Cancel</source> <target>&Cancelar</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>Operação:</target> + +<source>Items found:</source> <target>Elementos encontrados:</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>Elementos faltantes:</target> <source>Speed:</source> @@ -669,9 +672,6 @@ A linha de comando é executada cada vez que: <source>Time elapsed:</source> <target>Tempo passado:</target> -<source>Operation:</source> -<target>Operação:</target> - <source>Select variant:</source> <target>Selecione um modo:</target> @@ -771,7 +771,7 @@ Os arquivos são considerados iguais se <source>Synchronizing...</source> <target>Sincronizando...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>Elementos processados:</target> <source>&Pause</source> @@ -900,8 +900,8 @@ Excluir: \stuff\temp\* <source>Transactional file copy</source> <target>Cópia de arquivo transacional</target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> -<target>Copia os arquivos para um temporário (*.ffs_tmp) primeiro e depois os renomeia. Isso garante um estado consistente mesmo em situações de erro fatal.</target> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> +<target></target> <source>Copy locked files</source> <target>Copiar arquivos bloqueados (em uso)</target> @@ -996,6 +996,18 @@ Transfere as permissões de arquivos e diretórios <source>Auto-adjust columns</source> <target>Autoajustar colunas</target> +<source>Icon size:</source> +<target></target> + +<source>Small</source> +<target></target> + +<source>Medium</source> +<target></target> + +<source>Large</source> +<target></target> + <source>Include all rows</source> <target>Incluir todas as linhas</target> diff --git a/BUILD/Languages/romanian.lng b/BUILD/Languages/romanian.lng index a2c21e54..efc632ac 100644 --- a/BUILD/Languages/romanian.lng +++ b/BUILD/Languages/romanian.lng @@ -25,6 +25,12 @@ <source>Browse</source> <target>Explorează</target> +<source>Windows Error Code %x:</source> +<target>Codul Erorii Windows %x:</target> + +<source>Linux Error Code %x:</source> +<target>Codul Erorii Linux %x:</target> + <source>Invalid command line: %x</source> <target>Linie de comandă nevalidă: %x</target> @@ -229,36 +235,6 @@ <source>/sec</source> <target>/sec</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -<pluralform>%x de min</pluralform> -</target> - -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>1 oră</pluralform> -<pluralform>%x ore</pluralform> -<pluralform>%x de ore</pluralform> -</target> - -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>1 zi</pluralform> -<pluralform>%x zile</pluralform> -<pluralform>%x de zile</pluralform> -</target> - <source>S&ave configuration...</source> <target>S&alvează Configurația...</target> @@ -417,27 +393,21 @@ Linia de comandă este executată de fiecare dată cînd: <source>Operation aborted!</source> <target>Operație abandonată!</target> -<source>Could not load a required DLL:</source> -<target>Nu pot încărca o filă DLL necesară:</target> - <source>Endless loop when traversing directory:</source> <target>Buclă infinită la parcurgerea dosarului:</target> <source>Error traversing directory:</source> <target>Eroare la parcurgerea dosarului:</target> -<source>Windows Error Code %x:</source> -<target>Codul Erorii Windows %x:</target> - -<source>Linux Error Code %x:</source> -<target>Codul Erorii Linux %x:</target> - <source>Error setting privilege:</source> <target>Eroare la setarea privilegiului:</target> <source>Error moving to Recycle Bin:</source> <target>Eroare la mutarea în Reciclator:</target> +<source>Could not load a required DLL:</source> +<target>Nu pot încărca o filă DLL necesară:</target> + <source>Error writing to synchronization database:</source> <target>Eroare la scrierea în baza de date a sincronizării:</target> @@ -462,6 +432,36 @@ Linia de comandă este executată de fiecare dată cînd: <source>%x%</source> <target>%x%</target> +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +<pluralform>%x de min</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>1 oră</pluralform> +<pluralform>%x ore</pluralform> +<pluralform>%x de ore</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>1 zi</pluralform> +<pluralform>%x zile</pluralform> +<pluralform>%x de zile</pluralform> +</target> + <source>Could not read values for the following XML nodes:</source> <target>Nu pot citi valorile pentru următoarele noduri XML:</target> @@ -660,10 +660,13 @@ Linia de comandă este executată de fiecare dată cînd: <source>&Cancel</source> <target>&Anulează</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>Operație:</target> + +<source>Items found:</source> <target>Elemente Găsite:</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>Elemente Rămase:</target> <source>Speed:</source> @@ -675,9 +678,6 @@ Linia de comandă este executată de fiecare dată cînd: <source>Time elapsed:</source> <target>Timp Scurs:</target> -<source>Operation:</source> -<target>Operație:</target> - <source>Select variant:</source> <target>Selectează Varianta de Sincronizare:</target> @@ -777,7 +777,7 @@ este același <source>Synchronizing...</source> <target>Sincronizare Aflată în Curs...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>Elemente Procesate:</target> <source>&Pause</source> @@ -906,8 +906,8 @@ Excluse: \stuff\temp\* <source>Transactional file copy</source> <target>Copiere tranzacțională a filelor</target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> -<target>Filele sînt scrise mai întîi cu un nume temporar (*.ffs_tmp), apoi renumite. Aceasta garantează consecvența stării lor chiar în situații de erori fatale.</target> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> +<target></target> <source>Copy locked files</source> <target>Copiere și a filelor zăvorîte [locked]</target> @@ -1002,6 +1002,18 @@ Transferă permisiunile filelor și dosarelor <source>Auto-adjust columns</source> <target>Autoajustează Coloanele</target> +<source>Icon size:</source> +<target></target> + +<source>Small</source> +<target></target> + +<source>Medium</source> +<target></target> + +<source>Large</source> +<target></target> + <source>Include all rows</source> <target>Include Toate Rîndurile</target> diff --git a/BUILD/Languages/russian.lng b/BUILD/Languages/russian.lng index 0057d050..24b5e0c3 100644 --- a/BUILD/Languages/russian.lng +++ b/BUILD/Languages/russian.lng @@ -25,6 +25,12 @@ <source>Browse</source> <target>Обзор</target> +<source>Windows Error Code %x:</source> +<target>Код ошибки Windows %x:</target> + +<source>Linux Error Code %x:</source> +<target>Код ошибки Linux %x:</target> + <source>Invalid command line: %x</source> <target>Неверная командная строка: %x</target> @@ -171,7 +177,7 @@ <target>Ошибка при чтении из базы данных синхронизации:</target> <source>Database files do not share a common synchronization session:</source> -<target>Файлы баз данных не имеют общей сессии синхронизации:***</target> +<target>Файлы баз данных не имеют общей сессии синхронизации:</target> <source>An exception occurred!</source> <target>Исключение произошло!</target> @@ -229,36 +235,6 @@ <source>/sec</source> <target>/с</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>%x минута</pluralform> -<pluralform>%x минуты</pluralform> -<pluralform>%x минут</pluralform> -</target> - -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>%x час</pluralform> -<pluralform>%x часа</pluralform> -<pluralform>%x часов</pluralform> -</target> - -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>%x день</pluralform> -<pluralform>%x дня</pluralform> -<pluralform>%x дней</pluralform> -</target> - <source>S&ave configuration...</source> <target>Сохранить настройки синхронизации...</target> @@ -417,27 +393,21 @@ The command line is executed each time: <source>Operation aborted!</source> <target>Операция отменена!</target> -<source>Could not load a required DLL:</source> -<target>Не удалось загрузить необходимые DLL:</target> - <source>Endless loop when traversing directory:</source> <target>Зацикливание при встрече пересекающихся путей:</target> <source>Error traversing directory:</source> <target>Ошибка при пересечении папок:</target> -<source>Windows Error Code %x:</source> -<target>Код ошибки Windows %x:</target> - -<source>Linux Error Code %x:</source> -<target>Код ошибки Linux %x:</target> - <source>Error setting privilege:</source> <target>Ошибка установки привилегий:</target> <source>Error moving to Recycle Bin:</source> <target>Ошибка при перемещении в "Корзину":</target> +<source>Could not load a required DLL:</source> +<target>Не удалось загрузить необходимые DLL:</target> + <source>Error writing to synchronization database:</source> <target>Ошибка при записи в базу данных синхронизации:</target> @@ -462,6 +432,36 @@ The command line is executed each time: <source>%x%</source> <target>%x%</target> +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>%x минута</pluralform> +<pluralform>%x минуты</pluralform> +<pluralform>%x минут</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>%x час</pluralform> +<pluralform>%x часа</pluralform> +<pluralform>%x часов</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>%x день</pluralform> +<pluralform>%x дня</pluralform> +<pluralform>%x дней</pluralform> +</target> + <source>Could not read values for the following XML nodes:</source> <target>Не удалось прочитать значения для следующих XML записей:</target> @@ -663,10 +663,13 @@ The command line is executed each time: <source>&Cancel</source> <target>&Отмена</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>Операция:</target> + +<source>Items found:</source> <target>Элементов найдено:</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>Элементов осталось:</target> <source>Speed:</source> @@ -678,9 +681,6 @@ The command line is executed each time: <source>Time elapsed:</source> <target>Времени прошло:</target> -<source>Operation:</source> -<target>Операция:</target> - <source>Select variant:</source> <target>Выберите вариант:</target> @@ -775,7 +775,7 @@ is the same <source>Synchronizing...</source> <target>Синхронизация...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>Элементов обработано:</target> <source>&Pause</source> @@ -904,8 +904,8 @@ Exclude: \stuff\temp\* <source>Transactional file copy</source> <target>Безопасное копирование файлов</target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> -<target>Сначала файлы копируются во временные (*.ffs_tmp) и затем переименовываются. Это гарантирует, что заменяемые файлы не будут испорчены, в случае возникновения фатальной ошибки копирования.</target> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> +<target>Сначала копировать во временные файлы (*.ffs_tmp), затем переименовывать их. Это гарантирует целостность заменяемых файлов в случае возникновения фатальной ошибки копирования.</target> <source>Copy locked files</source> <target>Копирование заблокированных файлов</target> @@ -1001,6 +1001,18 @@ Transfer file and directory permissions <source>Auto-adjust columns</source> <target>Автовыравнивание ширины колонок</target> +<source>Icon size:</source> +<target>Размер иконок:</target> + +<source>Small</source> +<target>- маленький</target> + +<source>Medium</source> +<target>- средний</target> + +<source>Large</source> +<target>- большой</target> + <source>Include all rows</source> <target>Отметить все</target> diff --git a/BUILD/Languages/slovenian.lng b/BUILD/Languages/slovenian.lng index ef5e3eb1..3fd7a777 100644 --- a/BUILD/Languages/slovenian.lng +++ b/BUILD/Languages/slovenian.lng @@ -25,6 +25,12 @@ <source>Browse</source> <target>Brskaj</target> +<source>Windows Error Code %x:</source> +<target>Windows koda napake %x:</target> + +<source>Linux Error Code %x:</source> +<target>Linux koda napake %x:</target> + <source>Invalid command line: %x</source> <target>Napačna ukazna vrstica: %x</target> @@ -232,39 +238,6 @@ <source>/sec</source> <target>/sek</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -<pluralform>%x min</pluralform> -<pluralform>%x min</pluralform> -</target> - -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>1 ura</pluralform> -<pluralform>%x uri</pluralform> -<pluralform>%x ure</pluralform> -<pluralform>%x ur</pluralform> -</target> - -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>1 dan</pluralform> -<pluralform>%x dni</pluralform> -<pluralform>%x dni</pluralform> -<pluralform>%x dni</pluralform> -</target> - <source>S&ave configuration...</source> <target>Shr&ani konfiguracijo...</target> @@ -429,12 +402,6 @@ Ukazna vrstica se izvrši vsakič ko: <source>Error traversing directory:</source> <target>Napaka pri prehajanju imenika:</target> -<source>Windows Error Code %x:</source> -<target>Windows koda napake %x:</target> - -<source>Linux Error Code %x:</source> -<target>Linux koda napake %x:</target> - <source>Error setting privilege:</source> <target>Napaka pri nastavljanju privilegija:</target> @@ -468,6 +435,39 @@ Ukazna vrstica se izvrši vsakič ko: <source>%x%</source> <target>%x%</target> +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +<pluralform>%x min</pluralform> +<pluralform>%x min</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>1 ura</pluralform> +<pluralform>%x uri</pluralform> +<pluralform>%x ure</pluralform> +<pluralform>%x ur</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>1 dan</pluralform> +<pluralform>%x dni</pluralform> +<pluralform>%x dni</pluralform> +<pluralform>%x dni</pluralform> +</target> + <source>Could not read values for the following XML nodes:</source> <target>Ne morem brati vrednosti za naslednja XML vozlišča:</target> @@ -666,10 +666,13 @@ Ukazna vrstica se izvrši vsakič ko: <source>&Cancel</source> <target>&Prekliči</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>Operacija:</target> + +<source>Items found:</source> <target>Najdenih elementov:</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>Preostalih elementov:</target> <source>Speed:</source> @@ -681,9 +684,6 @@ Ukazna vrstica se izvrši vsakič ko: <source>Time elapsed:</source> <target>Pretečen čas:</target> -<source>Operation:</source> -<target>Operacija:</target> - <source>Select variant:</source> <target>Izberite varianto:</target> @@ -783,7 +783,7 @@ enaka <source>Synchronizing...</source> <target>Sinhroniziram...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>Obdelanih elementov:</target> <source>&Pause</source> @@ -912,8 +912,8 @@ Izključi: \stuff\temp\* <source>Transactional file copy</source> <target>Transakcijsko kopiranje datotek</target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> -<target>Najprej zapisuj datoteke v začasno (*.ffs_tmp) in jih nato preimenuj. To zagotavlja konsistentno stanje celo v situacijah usodnih napak.</target> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> +<target></target> <source>Copy locked files</source> <target>Kopiraj zaklenjene datoteke</target> @@ -1008,6 +1008,18 @@ Prenesi dovoljenja datotek in imenikov <source>Auto-adjust columns</source> <target>Samo-prilagodi stolpce</target> +<source>Icon size:</source> +<target></target> + +<source>Small</source> +<target></target> + +<source>Medium</source> +<target></target> + +<source>Large</source> +<target></target> + <source>Include all rows</source> <target>Vključi se vrstice</target> diff --git a/BUILD/Languages/spanish.lng b/BUILD/Languages/spanish.lng index 36835e0a..5ebb2739 100644 --- a/BUILD/Languages/spanish.lng +++ b/BUILD/Languages/spanish.lng @@ -25,6 +25,12 @@ <source>Browse</source> <target>Examinar</target> +<source>Windows Error Code %x:</source> +<target>Código de error de Windows %x:</target> + +<source>Linux Error Code %x:</source> +<target>Código de error de Linux %x:</target> + <source>Invalid command line: %x</source> <target>Línea de comandos errónea: %x</target> @@ -226,33 +232,6 @@ <source>/sec</source> <target>/seg</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>1 minuto</pluralform> -<pluralform>%x minutos</pluralform> -</target> - -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>1 hora</pluralform> -<pluralform>%x horas</pluralform> -</target> - -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>1 día</pluralform> -<pluralform>%x días</pluralform> -</target> - <source>S&ave configuration...</source> <target>G&uardar configuración...</target> @@ -411,27 +390,21 @@ La línea de comandos se ejecuta cada vez: <source>Operation aborted!</source> <target>¡Operación abortada!</target> -<source>Could not load a required DLL:</source> -<target>No se ha podido cargar el DLL solicitado:</target> - <source>Endless loop when traversing directory:</source> <target>Bucle infinito al buscar en el directorio:</target> <source>Error traversing directory:</source> <target>Error al buscar en el directorio:</target> -<source>Windows Error Code %x:</source> -<target>Código de error de Windows %x:</target> - -<source>Linux Error Code %x:</source> -<target>Código de error de Linux %x:</target> - <source>Error setting privilege:</source> <target>Error al establecer privilegios:</target> <source>Error moving to Recycle Bin:</source> <target>Error al mover a la Papelera de Reciclaje:</target> +<source>Could not load a required DLL:</source> +<target>No se ha podido cargar el DLL solicitado:</target> + <source>Error writing to synchronization database:</source> <target>Error al escribir en la base de datos de sincronización:</target> @@ -456,6 +429,33 @@ La línea de comandos se ejecuta cada vez: <source>%x%</source> <target>%x%</target> +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>1 minuto</pluralform> +<pluralform>%x minutos</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>1 hora</pluralform> +<pluralform>%x horas</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>1 día</pluralform> +<pluralform>%x días</pluralform> +</target> + <source>Could not read values for the following XML nodes:</source> <target>No se ha podido leer los valores para los siguientes nodos XML:</target> @@ -654,10 +654,13 @@ La línea de comandos se ejecuta cada vez: <source>&Cancel</source> <target>&Cancelar</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>Operación:</target> + +<source>Items found:</source> <target>Elementos encontrados:</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>Elementos restantes:</target> <source>Speed:</source> @@ -669,9 +672,6 @@ La línea de comandos se ejecuta cada vez: <source>Time elapsed:</source> <target>Tiempo transcurrido:</target> -<source>Operation:</source> -<target>Operación:</target> - <source>Select variant:</source> <target>Seleccione un tipo:</target> @@ -771,7 +771,7 @@ es el mismo <source>Synchronizing...</source> <target>Sincronizando...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>Elementos procesados:</target> <source>&Pause</source> @@ -900,8 +900,8 @@ Excluir: \stuff\temp\* <source>Transactional file copy</source> <target>Copia de archivos transaccionales</target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> -<target>Escribir archivos temporales (*.ffs_tmp) primero y reescribirlos después. Esto asegura un estado de consistencia incluso en situaciones de error fatal.</target> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> +<target></target> <source>Copy locked files</source> <target>Copiar archivos bloqueados</target> diff --git a/BUILD/Languages/swedish.lng b/BUILD/Languages/swedish.lng index d1c7dd20..7991c1e1 100644 --- a/BUILD/Languages/swedish.lng +++ b/BUILD/Languages/swedish.lng @@ -25,6 +25,12 @@ <source>Browse</source> <target>Bläddra</target> +<source>Windows Error Code %x:</source> +<target>Windows Felkod %x:</target> + +<source>Linux Error Code %x:</source> +<target>Linux Felkod %x:</target> + <source>Invalid command line: %x</source> <target>Ogiltig kommandorad: %x</target> @@ -226,33 +232,6 @@ <source>/sec</source> <target>/s</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</target> - -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>1 timma</pluralform> -<pluralform>%x timmar</pluralform> -</target> - -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>1 dag</pluralform> -<pluralform>%x dagar</pluralform> -</target> - <source>S&ave configuration...</source> <target>S¶ inställningar...</target> @@ -417,12 +396,6 @@ Kommandot verkställes när: <source>Error traversing directory:</source> <target>Accessfel på katalog:</target> -<source>Windows Error Code %x:</source> -<target>Windows Felkod %x:</target> - -<source>Linux Error Code %x:</source> -<target>Linux Felkod %x:</target> - <source>Error setting privilege:</source> <target>Kan inte ange privilegie:</target> @@ -456,6 +429,33 @@ Kommandot verkställes när: <source>%x%</source> <target>%x%</target> +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>1 timma</pluralform> +<pluralform>%x timmar</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>1 dag</pluralform> +<pluralform>%x dagar</pluralform> +</target> + <source>Could not read values for the following XML nodes:</source> <target>Kan inte läsa värden för följande XML-noder:</target> @@ -654,10 +654,13 @@ Kommandot verkställes när: <source>&Cancel</source> <target>&Avbryt</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>Arbetsuppgift:</target> + +<source>Items found:</source> <target>Funna poster:</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>Återstående poster:</target> <source>Speed:</source> @@ -669,9 +672,6 @@ Kommandot verkställes när: <source>Time elapsed:</source> <target>Förfluten tid:</target> -<source>Operation:</source> -<target>Arbetsuppgift:</target> - <source>Select variant:</source> <target>Välj variant:</target> @@ -771,7 +771,7 @@ Filerna betecknas som lika om, <source>Synchronizing...</source> <target>Synkroniserar...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>Processade poster</target> <source>&Pause</source> @@ -900,8 +900,8 @@ Undanta: \stuff\temp\* <source>Transactional file copy</source> <target>Transaktionell filkopiering</target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> -<target>Skriver först filer till en temporär fil(*.ffs_tmp), och byter namn på dom. Detta garanterar ett konsekvent tillstånd även i situationer av allvarliga fel.</target> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> +<target></target> <source>Copy locked files</source> <target>Kopiera låsta filer</target> @@ -996,6 +996,18 @@ Transfer file and directory permissions <source>Auto-adjust columns</source> <target>Autojustera kollumner</target> +<source>Icon size:</source> +<target></target> + +<source>Small</source> +<target></target> + +<source>Medium</source> +<target></target> + +<source>Large</source> +<target></target> + <source>Include all rows</source> <target>Inkludera alla rader</target> diff --git a/BUILD/Languages/turkish.lng b/BUILD/Languages/turkish.lng index 1ba8ff30..f988cd5c 100644 --- a/BUILD/Languages/turkish.lng +++ b/BUILD/Languages/turkish.lng @@ -8,7 +8,7 @@ </header> <source>Searching for directory %x...</source> -<target></target> +<target>%x klasörü aranıyor...</target> <source>Show in Explorer</source> <target>Tarayıcıda Göster</target> @@ -22,44 +22,17 @@ <source>RealtimeSync - Automated Synchronization</source> <target>RealtimeSync - Kendiliğinden Eşleştirme</target> -<source>Browse</source> -<target>Gözat</target> - -<source>Invalid command line: %x</source> -<target></target> - -<source>Error resolving symbolic link:</source> -<target>Sembolik bağlantı çözümlenirken hata:</target> - -<source>Show pop-up</source> -<target></target> - -<source>Show pop-up on errors or warnings</source> -<target></target> - -<source>Ignore errors</source> -<target>Hataları yoksay</target> - -<source>Hide all error and warning messages</source> -<target>Tüm hata ve uyarı iletilerini gizler</target> - -<source>Exit instantly</source> -<target>Hemen çık</target> - -<source>Abort synchronization immediately</source> -<target>Eşleştirmeyi hemen bırak</target> - <source>Select alternate comparison settings</source> -<target></target> +<target>Alternatif karşılaştırma ayarlarını seçin</target> <source>Select alternate synchronization settings</source> <target>Alternatif eşleştirme ayarlarını seçin</target> <source>No filter selected</source> -<target>Hiç süzgeç seçilmedi</target> +<target>Seçilmiş süzgeç yok</target> <source>Filter is active</source> -<target>Etkin süzgeç</target> +<target>Süzgeç etkin</target> <source>Remove alternate settings</source> <target>Alternatif ayarları sil</target> @@ -68,7 +41,7 @@ <target>Süzgeç ayarlarını temizle</target> <source>Create a batch job</source> -<target>Toplu komut işi oluştur</target> +<target>Toplu iş oluştur</target> <source>Synchronization settings</source> <target>Eşleştirme ayarları</target> @@ -107,7 +80,46 @@ <target>Bul</target> <source>Select time span</source> -<target></target> +<target>Zaman aralığı</target> + +<source>Show pop-up</source> +<target>Açılır pencerede göster</target> + +<source>Show pop-up on errors or warnings</source> +<target>Hata ya da uyarıları açılır pencerede gösterir</target> + +<source>Ignore errors</source> +<target>Hataları yoksay</target> + +<source>Hide all error and warning messages</source> +<target>Tüm hata ve uyarı iletilerini gizler</target> + +<source>Exit instantly</source> +<target>İşlemi sonlandır</target> + +<source>Abort synchronization immediately</source> +<target>Eşleştirmeyi hemen bırakır</target> + +<source>Browse</source> +<target>Gözat</target> + +<source>Error reading from synchronization database:</source> +<target>Eşleştirme veri tabanı okunurken hata:</target> + +<source>Error writing to synchronization database:</source> +<target>Eşleştirme veri tabanına yazılırken hata:</target> + +<source>Invalid command line: %x</source> +<target>Geçersiz komut satırı: %x</target> + +<source>Windows Error Code %x:</source> +<target>Windows Hata Kodu %x:</target> + +<source>Linux Error Code %x:</source> +<target>Linux Hata Kodu %x:</target> + +<source>Error resolving symbolic link:</source> +<target>Sembolik bağlantı çözümlenirken hata:</target> <source>%x MB</source> <target>%x MB</target> @@ -166,11 +178,8 @@ <source>One of the FreeFileSync database files is not yet existing:</source> <target>FreeFileSync veritabanı dosyalarından biri henüz yok:</target> -<source>Error reading from synchronization database:</source> -<target>Eşleştirme veri tabanı okunurken hata:</target> - <source>Database files do not share a common synchronization session:</source> -<target></target> +<target>Veritabanıdosyaları ortak bir eşleştirmeoturumunu paylaşmıyor:</target> <source>An exception occurred!</source> <target>Olağan dışı bir durum oluştu!</target> @@ -193,12 +202,18 @@ <pluralform>%x saniye</pluralform> </target> +<source>Drag && drop</source> +<target>Klasör ya da dosyaları buraya sürükleyip bırakabilirsiniz</target> + <source>Info</source> <target>Bilgi</target> <source>Fatal Error</source> <target>Ölümcül Hata</target> +<source>Error reading file:</source> +<target>Dosya okunurken hata:</target> + <source>Scanning:</source> <target>Taranıyor:</target> @@ -209,7 +224,10 @@ <pluralform>[1 Thread]</pluralform> <pluralform>[%x Threads]</pluralform> </source> -<target></target> +<target> +<pluralform>[1 İş]</pluralform> +<pluralform>[%x İş]</pluralform> +</target> <source>Invalid FreeFileSync config file!</source> <target>Geçersiz FreeFileSync yapılandırma dosyası!</target> @@ -220,35 +238,29 @@ <source>Error parsing configuration file:</source> <target>Yapılandırma dosyası çözümlenirken hata:</target> -<source>/sec</source> -<target>/san</target> +<source>Error moving to Recycle Bin:</source> +<target>Geri Dönüşüm Kutusu'na atılırken hata:</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>1 dakika</pluralform> -<pluralform>%x dakika</pluralform> -</target> +<source>Could not load a required DLL:</source> +<target>Gerekli bir DLL yüklenemedi:</target> -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>1 saat</pluralform> -<pluralform>%x saat</pluralform> -</target> +<source>Error accessing Volume Shadow Copy Service!</source> +<target>Gölge Kopya Hizmetine erişilirken hata oldu!</target> -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>1 gün</pluralform> -<pluralform>%x gün</pluralform> -</target> +<source>Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit version.</source> +<target>WOW64 üzerinde gölge kopyalama desteklenmiyor. FreeFileSync 64-bit sürümünü kullanın</target> + +<source>Could not determine volume name for file:</source> +<target>Şu dosya için birim adı belirlenemedi:</target> + +<source>Volume name %x not part of filename %y!</source> +<target>%x birim adı, %y dosya adının parçası değil!</target> + +<source>/sec</source> +<target>/san</target> + +<source>Could not read values for the following XML nodes:</source> +<target>Şu XML düğümlerindeki değerler okunamadı:</target> <source>S&ave configuration...</source> <target>Y&apılandırmayı kaydet...</target> @@ -342,131 +354,17 @@ Her seferinde çalıştırılacak komut satırı: <source>A directory input field is empty.</source> <target>Bir klasör giriş alanı boş</target> -<source>Drag && drop</source> -<target>Klasör ya da dosyaları buraya sürükleyip bırakabilirsiniz</target> - -<source>Could not initialize directory monitoring:</source> -<target>Klasör izlemesi başlatılamadı:</target> - -<source>Error when monitoring directories.</source> -<target>Klasörler izlenirken hata.</target> - -<source>Conversion error:</source> -<target>Dönüştürme hatası:</target> - -<source>Error deleting file:</source> -<target>Dosya silinirken hata:</target> - -<source>Error moving file:</source> -<target>Dosya taşınırken hata:</target> - -<source>Target file already existing!</source> -<target>Hedef dosya zaten var!</target> - -<source>Error moving directory:</source> -<target>Klasör taşınırken hata:</target> - -<source>Target directory already existing!</source> -<target>Hedef klasör zaten var!</target> - -<source>Error deleting directory:</source> -<target>Klasör silinirken hata:</target> - -<source>Error changing modification time:</source> -<target>Değişiklik tarihini değiştirirken hata:</target> - -<source>Error loading library function:</source> -<target>Kütüphane işlevi yüklenirken hata:</target> - -<source>Error reading security context:</source> -<target>Güüvenlik bağlamı okunurken hata:</target> - -<source>Error writing security context:</source> -<target>Güvenlik bağlamı yazılırken hata:</target> - -<source>Error copying file permissions:</source> -<target>Dosya izinleri kopyalanırken hata:</target> - -<source>Error creating directory:</source> -<target>Klasör oluşturulurken hata:</target> - -<source>Error copying symbolic link:</source> -<target>Sembolik bağlantı kopyalanırken hata:</target> - -<source>Error copying file:</source> -<target>Dosya kopyalanırken hata:</target> - -<source>Error opening file:</source> -<target>Dosya açılırken hata:</target> - -<source>Error writing file:</source> -<target>Dosya yazılırken hata:</target> - -<source>Error reading file:</source> -<target>Dosya okunurken hata:</target> - -<source>Operation aborted!</source> -<target>İşlemden vazgeçildi!</target> - -<source>Endless loop when traversing directory:</source> -<target>Klasörlerde dolaşırken sonsuz döngü:</target> - -<source>Error traversing directory:</source> -<target>Klasörde dolaşırken hata:</target> - -<source>Windows Error Code %x:</source> -<target>Windows Hata Kodu %x:</target> - -<source>Linux Error Code %x:</source> -<target>Linux Hata Kodu %x:</target> - -<source>Error setting privilege:</source> -<target>İzinler ayarlanırken hata:</target> - -<source>Error moving to Recycle Bin:</source> -<target>Geri Dönüşüm Kutusu'na atılırken hata:</target> - -<source>Could not load a required DLL:</source> -<target>Gerekli bir DLL yüklenemedi:</target> - -<source>Error writing to synchronization database:</source> -<target>Eşleştirme veri tabanına yazılırken hata:</target> - -<source>Error accessing Volume Shadow Copy Service!</source> -<target></target> - -<source>Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit version.</source> -<target>WOW64 üzerinde gölge kopyalama desteklenmiyor. FreeFileSync 64-bit sürümünü kullanın</target> - -<source>Could not determine volume name for file:</source> -<target>Şu dosya için birim adı belirlenemedi:</target> - -<source>Volume name %x not part of filename %y!</source> -<target>%x birim adı, %y dosya adının parçası değil!</target> - -<source>%x TB</source> -<target>%x TB</target> - -<source>%x PB</source> -<target>%x PB</target> - -<source>%x%</source> -<target>%x%</target> - -<source>Could not read values for the following XML nodes:</source> -<target>Şu XML düğümlerindeki değerler okunamadı:</target> - <source>Logging</source> <target>Günlükleme</target> <source>FreeFileSync batch file</source> -<target>FreeFileSync toplu komut dosyası</target> +<target>FreeFileSync toplu iş dosyası</target> <source>FreeFileSync configuration</source> <target>FreeFileSync yapılandırması</target> <source>FreeFileSync Batch Job</source> -<target>FreeFileSync Toplu Komut İşi</target> +<target>FreeFileSync Toplu İşi</target> <source>Unable to create logfile!</source> <target>Günlük dosyası oluşturulamıyor!</target> @@ -541,7 +439,7 @@ Her seferinde çalıştırılacak komut satırı: <target>&Genel ayarlar...</target> <source>&Create batch job...</source> -<target>&Toplu komut işi oluştur...</target> +<target>&Toplu iş oluştur...</target> <source>&Export file list...</source> <target>Dosya list&esini ver...</target> @@ -577,10 +475,10 @@ Her seferinde çalıştırılacak komut satırı: <target>Sağ ve sol yanı değiştir</target> <source>Save current configuration to file</source> -<target>Geçerli yapılandırmayı dosyaya kaydet</target> +<target>Geçerli yapılandırmayı dosyaya kaydeder</target> <source>Load configuration from file</source> -<target>Dosyadan yapılandırmayı yükle</target> +<target>Yapılandırma dosyasından ayarları alır</target> <source>Last used configurations (press DEL to remove from list)</source> <target>Son kullanılan yapılandırmalar (listeden silmek için DEL tuşuna basın)</target> @@ -589,7 +487,7 @@ Her seferinde çalıştırılacak komut satırı: <target>Dışlanan ögeleri gizle</target> <source>Hide filtered or temporarily excluded files</source> -<target>Süzülmüş ya da geçici olarak dışlanmış dosyaları gizle</target> +<target>Süzülmüş ya da geçici olarak dışlanmış dosyaları gizler</target> <source>Number of files and directories that will be created</source> <target>Oluşturulacak dosya ve klasör sayısı</target> @@ -604,10 +502,10 @@ Her seferinde çalıştırılacak komut satırı: <target>Aktarılacak toplam veri miktarı</target> <source>Batch job</source> -<target>Toplu komut işi</target> +<target>Toplu iş</target> <source>Create a batch file for automated synchronization. To start in batch mode simply double-click the file or execute via command line: FreeFileSync.exe <ffs_batch file>. This can also be scheduled in your operating system's task planner.</source> -<target></target> +<target>Otomatik eşleştirme için bir toplu iş dosyası oluşturabilirsiniz. İşlemi başlatmak için dosyaya çift tıklayabilir ya da komut satırını " FreeFileSync.exe <ffs_iş dosyası>" şeklinde kullabilirsiniz. Ayrıca bu dosyayı işletim sisteminizin görev zamanlayıcısı ile istediğiniz zamanlarda çalıştırabilirsiniz.</target> <source>Help</source> <target>Yardım</target> @@ -616,7 +514,7 @@ Her seferinde çalıştırılacak komut satırı: <target>Dosya süzgeci</target> <source>Error handling</source> -<target>Hata olduğunda:</target> +<target>Hata olursa:</target> <source>Left</source> <target>Sol</target> @@ -625,22 +523,22 @@ Her seferinde çalıştırılacak komut satırı: <target>Sağ</target> <source>Overview</source> -<target>Özet</target> +<target>Genel</target> <source>Status feedback</source> <target>Durum geri bildirimi</target> <source>Run minimized</source> -<target></target> +<target>Görev çubuğunda başlat</target> <source>Maximum number of logfiles:</source> -<target>En fazla günlük dosyası sayısı:</target> +<target>Tutulacak en fazla günlük dosyası sayısı:</target> <source>Select logfile directory:</source> -<target>Kayıt dosyası klasörünü seçin:</target> +<target>Kayıt dosyası klasörü:</target> <source>Batch settings</source> -<target></target> +<target>İş ayarları</target> <source>&Save</source> <target>&Kaydet</target> @@ -651,10 +549,13 @@ Her seferinde çalıştırılacak komut satırı: <source>&Cancel</source> <target>İ&ptal</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>İşlem:</target> + +<source>Items found:</source> <target>Bulunan bileşenler:</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>Kalan bileşenler:</target> <source>Speed:</source> @@ -666,11 +567,8 @@ Her seferinde çalıştırılacak komut satırı: <source>Time elapsed:</source> <target>Geçen zaman:</target> -<source>Operation:</source> -<target>İşlem:</target> - <source>Select variant:</source> -<target>Değişkeni seçin:</target> +<target>Davranışı seçin:</target> <source><Automatic></source> <target><Kendiliğinden></target> @@ -738,10 +636,15 @@ Files are found equal if - file size are the same </source> -<target></target> +<target> +Dosyaların eşit sayılması için + - son yazma tarih ve saati + - dosya boyutu +aynı olmalıdır +</target> <source>File time and size</source> -<target></target> +<target>Dosya tarih ve saati</target> <source> Files are found equal if @@ -749,9 +652,9 @@ Files are found equal if is the same </source> <target> -Eşit dosyalar aranırken +Dosyaların eşit sayılması için - dosya içeriği -aynı olanlara bakılır +aynı olmalıdır </target> <source>File content</source> @@ -763,7 +666,7 @@ aynı olanlara bakılır <source>Synchronizing...</source> <target>Eşleştiriliyor...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>İşlenen bileşenler:</target> <source>&Pause</source> @@ -773,7 +676,7 @@ aynı olanlara bakılır <target>Kaynak kodu C++ kullanılarak yazılmıştır:</target> <source>Big thanks for localizing FreeFileSync goes out to:</source> -<target>FreeFileSync çevirisinden dolayı çok teşekkürler:</target> +<target>FreeFileSync çevirmenlerine çok teşekkürler:</target> <source>Feedback and suggestions are welcome at:</source> <target>Geri bildirim ve önerileriniz için:</target> @@ -794,10 +697,10 @@ aynı olanlara bakılır <target>E-posta</target> <source>Report translation error</source> -<target>Çeviri hatasını bildir</target> +<target>Çeviri hatası bildirin</target> <source>Published under the GNU General Public License:</source> -<target>GNU Genel Kamu Lisansına şartları altında yayınlanmıştır:</target> +<target>GNU Genel Kamu Lisansı şartları altında yayınlanmıştır:</target> <source>Ignore subsequent errors</source> <target>Sonraki hataları yoksay</target> @@ -837,7 +740,7 @@ Only files/directories that match all filter settings will be selected for synch Note: The name filter must be specified relative(!) to main synchronization directories. </source> <target> -Yalnızca tüm süzgeç koşullarına uyan dosya ve klasörler eşleştirilecek. +Yalnızca tüm süzgeç koşullarına uyan dosya ve klasörler eşleştirilir. Not: Ad süzgeci kök eşleştirme klasörüne göre bağıl(!) olarak belirtilmelidir. </target> @@ -875,10 +778,10 @@ Katma: \stuff\temp\* <target>Dışlanacaklar:</target> <source>Minimum file size</source> -<target></target> +<target>En küçük dosya boyutu</target> <source>Maximum file size</source> -<target></target> +<target>En büyük dosya boyutu</target> <source>&Default</source> <target>&Varsayılan</target> @@ -890,10 +793,10 @@ Katma: \stuff\temp\* <target>Sütunu aşağı taşı</target> <source>Transactional file copy</source> -<target></target> +<target>Aşamalı kopyalama kullan</target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> -<target></target> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> +<target>Kopyalama önce geçici bir dosyaya (*.ffs_tmp) yapılır. Sonra dosya yeniden adlandırılır. Böylece hatalara karşı daha sağlıklı bir durum sağlanır</target> <source>Copy locked files</source> <target>Kilitli dosyaları da kopyala</target> @@ -903,19 +806,19 @@ Copy shared or locked files using Volume Shadow Copy Service (Requires Administrator rights) </source> <target> -Paylaşılmış ya da kilitli dosyaları Birim Gölge Kopya Hizmetini - kullanarak kopyala (Yönetici izinlerine gerek duyar) +Paylaşılan ya da kilitli dosyaları Gölge Kopya Hizmetini + kullanarak kopyalar (Yönetici izinlerine gerek duyar) </target> <source>Copy file access permissions</source> -<target></target> +<target>Dosya erişim izinlerini kopyala</target> <source> Transfer file and directory permissions (Requires Administrator rights) </source> <target> -Dosya ve klasör izinlerini de aktar +Dosya ve klasör izinlerini de aktarır (Yönetici izinlerine gerek duyar) </target> @@ -949,6 +852,9 @@ Dosya ve klasör izinlerini de aktar <source>&Find next</source> <target>&Sonrakini bul</target> +<source>Operation aborted!</source> +<target>İşlemden vazgeçildi!</target> + <source>Main bar</source> <target>Ana çubuk</target> @@ -983,11 +889,23 @@ Dosya ve klasör izinlerini de aktar <target>Özelleştir...</target> <source>Select time span...</source> -<target></target> +<target>Zaman aralığını seçin...</target> <source>Auto-adjust columns</source> <target>Sütunları kendiliğinden hizala</target> +<source>Icon size:</source> +<target>Simge boyutu:</target> + +<source>Small</source> +<target>Küçük</target> + +<source>Medium</source> +<target>Orta</target> + +<source>Large</source> +<target>Büyük</target> + <source>Include all rows</source> <target>Tüm satırları kat</target> @@ -1114,6 +1032,9 @@ Dosya ve klasör izinlerini de aktar <source>File list exported!</source> <target>Dosya listesi verilmiş!</target> +<source>Error writing file:</source> +<target>Dosya yazılırken hata:</target> + <source>Batch file created successfully!</source> <target>Toplu komut dosyası sorunsuz oluşturuldu!</target> @@ -1184,19 +1105,19 @@ Dosya ve klasör izinlerini de aktar <target>Devre dışı</target> <source>Last x hours</source> -<target></target> +<target>Son x saat</target> <source>Today</source> -<target></target> +<target>Bugün</target> <source>This week</source> -<target></target> +<target>Bu hafta</target> <source>This month</source> -<target></target> +<target>Bu ay</target> <source>This year</source> -<target></target> +<target>Bu yıl</target> <source>Byte</source> <target>Bayt</target> @@ -1223,7 +1144,7 @@ Dosya ve klasör izinlerini de aktar <target>İzle</target> <source>Copy NTFS permissions</source> -<target></target> +<target>NTFS izinlerini de kopyala</target> <source>Integrate external applications into context menu. The following macros are available:</source> <target>Dış uygulamaları sağ tuş menüsüne ekler. Şu makrolar kullanılabilir:</target> @@ -1274,11 +1195,110 @@ Dosya ve klasör izinlerini de aktar <target>Dosya silme ve üzerine yazma sırasında Geri Dönüşüm Kutusu'nu kullanır</target> <source>Versioning</source> -<target>Sürümlendirme</target> +<target>Eski sürüm olarak sakla</target> <source>Move files into a time-stamped subdirectory</source> <target>Dosyaları zaman damgasıyla bir alt klasöre taşır</target> +<source>%x TB</source> +<target>%x TB</target> + +<source>%x PB</source> +<target>%x PB</target> + +<source>%x%</source> +<target>%x%</target> + +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>1 dakika</pluralform> +<pluralform>%x dakika</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>1 saat</pluralform> +<pluralform>%x saat</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>1 gün</pluralform> +<pluralform>%x gün</pluralform> +</target> + +<source>Could not initialize directory monitoring:</source> +<target>Klasör izlemesi başlatılamadı:</target> + +<source>Error when monitoring directories.</source> +<target>Klasörler izlenirken hata.</target> + +<source>Conversion error:</source> +<target>Dönüştürme hatası:</target> + +<source>Error deleting file:</source> +<target>Dosya silinirken hata:</target> + +<source>Error moving file:</source> +<target>Dosya taşınırken hata:</target> + +<source>Target file already existing!</source> +<target>Hedef dosya zaten var!</target> + +<source>Error moving directory:</source> +<target>Klasör taşınırken hata:</target> + +<source>Target directory already existing!</source> +<target>Hedef klasör zaten var!</target> + +<source>Error deleting directory:</source> +<target>Klasör silinirken hata:</target> + +<source>Error changing modification time:</source> +<target>Değişiklik tarihini değiştirirken hata:</target> + +<source>Error loading library function:</source> +<target>Kütüphane işlevi yüklenirken hata:</target> + +<source>Error reading security context:</source> +<target>Güüvenlik bağlamı okunurken hata:</target> + +<source>Error writing security context:</source> +<target>Güvenlik bağlamı yazılırken hata:</target> + +<source>Error copying file permissions:</source> +<target>Dosya izinleri kopyalanırken hata:</target> + +<source>Error creating directory:</source> +<target>Klasör oluşturulurken hata:</target> + +<source>Error copying symbolic link:</source> +<target>Sembolik bağlantı kopyalanırken hata:</target> + +<source>Error copying file:</source> +<target>Dosya kopyalanırken hata:</target> + +<source>Error opening file:</source> +<target>Dosya açılırken hata:</target> + +<source>Endless loop when traversing directory:</source> +<target>Klasörlerde dolaşırken sonsuz döngü:</target> + +<source>Error traversing directory:</source> +<target>Klasörde dolaşırken hata:</target> + +<source>Error setting privilege:</source> +<target>İzinler ayarlanırken hata:</target> + <source>Both sides have changed since last synchronization!</source> <target>Son eşleştirmeden bu yana iki yanın içeriği de değişmiş!</target> @@ -1376,40 +1396,40 @@ Dosya ve klasör izinlerini de aktar <target>%x klasörü siliniyor</target> <source>Deleting symbolic link %x</source> -<target></target> +<target>%x sembolik bağlantısı siliniyor</target> <source>Moving file %x to recycle bin</source> -<target></target> +<target>%x dosyası geri dönüşüm kutusuna atılıyor</target> <source>Moving folder %x to recycle bin</source> -<target></target> +<target>%x klasörü geri dönüşüm kutusuna atılıyor</target> <source>Moving symbolic link %x to recycle bin</source> -<target></target> +<target>%x sembolik bağlantısı geri dönüşüm kutusuna atılıyor</target> <source>Moving file %x to %y</source> -<target></target> +<target>%x dosyası %y içine taşınıyor</target> <source>Moving folder %x to %y</source> -<target></target> +<target>%x klasörü %y içine taşınıyor</target> <source>Moving symbolic link %x to %y</source> -<target></target> +<target>%x sembolik bağlantısı %y içine taşınıyor</target> <source>Creating file %x</source> -<target></target> +<target>%x dosyası oluşturuluyor</target> <source>Creating symbolic link %x</source> -<target></target> +<target>%x sembolik bağlantısı oluşturuluyor</target> <source>Creating folder %x</source> <target>%x klasörü oluşturuluyor</target> <source>Overwriting file %x</source> -<target></target> +<target>%x dosyasının üzerine yazılıyor</target> <source>Overwriting symbolic link %x</source> -<target></target> +<target>%x sembolik bağlantısının üzerine yazılıyor</target> <source>Verifying file %x</source> <target>%x dosyası doğrulanıyor</target> @@ -1448,7 +1468,7 @@ Dosya ve klasör izinlerini de aktar <target>Kullanılabilir disk alanı:</target> <source>Recycle Bin is not available for the following paths! Files will be deleted permanently instead:</source> -<target></target> +<target>Şu yollar için geri dönüşüm kutusu kullanılamaz! Dosyalar anında ve tamamen silinir:</target> <source>A directory will be modified which is part of multiple folder pairs! Please review synchronization settings!</source> <target>Ç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!</target> diff --git a/BUILD/Languages/ukrainian.lng b/BUILD/Languages/ukrainian.lng index 6b08cfe7..73265e99 100644 --- a/BUILD/Languages/ukrainian.lng +++ b/BUILD/Languages/ukrainian.lng @@ -8,7 +8,7 @@ </header> <source>Searching for directory %x...</source> -<target></target> +<target>Пошук каталогу %x...</target> <source>Show in Explorer</source> <target>Показати у Провіднику</target> @@ -25,17 +25,23 @@ <source>Browse</source> <target>Переглянути</target> +<source>Windows Error Code %x:</source> +<target>Код помилки Windows %x:</target> + +<source>Linux Error Code %x:</source> +<target>Код помилки Linux %x:</target> + <source>Invalid command line: %x</source> -<target></target> +<target>Неправильний командний рядок: %x</target> <source>Error resolving symbolic link:</source> <target>Помилка при вирішені символічного посилання:</target> <source>Show pop-up</source> -<target></target> +<target>Показувати виринаючі вікна</target> <source>Show pop-up on errors or warnings</source> -<target></target> +<target>Показувати виринаючі вікна при помилках та попередженнях</target> <source>Ignore errors</source> <target>Ігнорувати помилки</target> @@ -50,7 +56,7 @@ <target>Перервати синхронізацію негайно</target> <source>Select alternate comparison settings</source> -<target></target> +<target>Вибрати альтернативні налаштування порівняння</target> <source>Select alternate synchronization settings</source> <target>Вибрати альтернативні налаштування синхронізації</target> @@ -107,7 +113,7 @@ <target>Знайти</target> <source>Select time span</source> -<target></target> +<target>Виберіть часовий інтервал</target> <source>%x MB</source> <target>%x МБ</target> @@ -144,7 +150,7 @@ <target>Повний шлях</target> <source>Filename</source> -<target>Ім’я файла</target> +<target>Ім’я файлу</target> <source>Relative path</source> <target>Відносний шлях</target> @@ -165,19 +171,19 @@ <target>Вступна синхронізація:</target> <source>One of the FreeFileSync database files is not yet existing:</source> -<target>Файла бази даних FreeFileSync ще не існує:</target> +<target>Файлу бази даних FreeFileSync ще не існує:</target> <source>Error reading from synchronization database:</source> <target>Помилка при читанні з бази даних синхронізації:</target> <source>Database files do not share a common synchronization session:</source> -<target></target> +<target>Файли бази даних не мають спільної сесії синхронізації</target> <source>An exception occurred!</source> <target>Відбулось виключення!</target> <source>Error reading file attributes:</source> -<target>Помилка при читанні параметрів файла:</target> +<target>Помилка при читанні параметрів файлу:</target> <source>Waiting while directory is locked (%x)...</source> <target>Очікування зняття блокування з каталогу (%x)...</target> @@ -211,7 +217,11 @@ <pluralform>[1 Thread]</pluralform> <pluralform>[%x Threads]</pluralform> </source> -<target></target> +<target> +<pluralform>[1 Нить виконання]</pluralform> +<pluralform>[%x Ниті виконання]</pluralform> +<pluralform>[%x Нитей виконання]</pluralform> +</target> <source>Invalid FreeFileSync config file!</source> <target>Неправильний файл конфігурації FreeFileSync!</target> @@ -220,41 +230,11 @@ <target>Файл не існує:</target> <source>Error parsing configuration file:</source> -<target>Помилка при анализі файла налаштувань синхронізації:</target> +<target>Помилка при анализі файлу налаштувань синхронізації:</target> <source>/sec</source> <target>/сек</target> -<source> -<pluralform>1 min</pluralform> -<pluralform>%x min</pluralform> -</source> -<target> -<pluralform>%x хв</pluralform> -<pluralform>%x хв</pluralform> -<pluralform>%x хв</pluralform> -</target> - -<source> -<pluralform>1 hour</pluralform> -<pluralform>%x hours</pluralform> -</source> -<target> -<pluralform>%x година</pluralform> -<pluralform>%x години</pluralform> -<pluralform>%x годин</pluralform> -</target> - -<source> -<pluralform>1 day</pluralform> -<pluralform>%x days</pluralform> -</source> -<target> -<pluralform>%x день</pluralform> -<pluralform>%x дні</pluralform> -<pluralform>%x днів</pluralform> -</target> - <source>S&ave configuration...</source> <target>Зберегти налаштування...</target> @@ -360,10 +340,10 @@ The command line is executed each time: <target>Помилка перетворення:</target> <source>Error deleting file:</source> -<target>Помилка при вилученні файла:</target> +<target>Помилка при вилученні файлу:</target> <source>Error moving file:</source> -<target>Помилка переміщення файла:</target> +<target>Помилка переміщення файлу:</target> <source>Target file already existing!</source> <target>Кінцевий файл уже існує!</target> @@ -378,7 +358,7 @@ The command line is executed each time: <target>Помилка при вилученні каталогу:</target> <source>Error changing modification time:</source> -<target>Помилка при зміні часу модификації файла:</target> +<target>Помилка при зміні часу модификації файлу:</target> <source>Error loading library function:</source> <target>Помилка при завантаженні функції бібліотеки:</target> @@ -399,16 +379,16 @@ The command line is executed each time: <target>Помилка при копіюванні символьного посилання:</target> <source>Error copying file:</source> -<target>Помилка при копіюванні файла:</target> +<target>Помилка при копіюванні файлу:</target> <source>Error opening file:</source> -<target>Помилка при відкриванні файла:</target> +<target>Помилка при відкриванні файлу:</target> <source>Error writing file:</source> -<target>Помилка при записі файла:</target> +<target>Помилка при записі файлу:</target> <source>Error reading file:</source> -<target>Помилка при читанні файла:</target> +<target>Помилка при читанні файлу:</target> <source>Operation aborted!</source> <target>Операція відмінена!</target> @@ -419,12 +399,6 @@ The command line is executed each time: <source>Error traversing directory:</source> <target>Помилка обходу каталогу:</target> -<source>Windows Error Code %x:</source> -<target>Код помилки Windows %x:</target> - -<source>Linux Error Code %x:</source> -<target>Код помилки Linux %x:</target> - <source>Error setting privilege:</source> <target>Помилка встановлення привилеїв:</target> @@ -438,16 +412,16 @@ The command line is executed each time: <target>Помилка при записі у базу данних синхронізації:</target> <source>Error accessing Volume Shadow Copy Service!</source> -<target></target> +<target>Помилка доступу до послуги Тіньового Копіювання Тому</target> <source>Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit version.</source> <target>Створення тіньових копій на WOW64 не підтримується. Будь ласка, використайте FreeFileSync 64-розрядної версії.</target> <source>Could not determine volume name for file:</source> -<target>Не вдалося визначити назву тому для файла:</target> +<target>Не вдалося визначити назву тому для файлу:</target> <source>Volume name %x not part of filename %y!</source> -<target>Ім’я тому %x не є частиною імені файла %y!</target> +<target>Ім’я тому %x не є частиною імені файлу %y!</target> <source>%x TB</source> <target>%x ТБ</target> @@ -458,6 +432,36 @@ The command line is executed each time: <source>%x%</source> <target>%x%</target> +<source> +<pluralform>1 min</pluralform> +<pluralform>%x min</pluralform> +</source> +<target> +<pluralform>%x хв</pluralform> +<pluralform>%x хв</pluralform> +<pluralform>%x хв</pluralform> +</target> + +<source> +<pluralform>1 hour</pluralform> +<pluralform>%x hours</pluralform> +</source> +<target> +<pluralform>%x година</pluralform> +<pluralform>%x години</pluralform> +<pluralform>%x годин</pluralform> +</target> + +<source> +<pluralform>1 day</pluralform> +<pluralform>%x days</pluralform> +</source> +<target> +<pluralform>%x день</pluralform> +<pluralform>%x дні</pluralform> +<pluralform>%x днів</pluralform> +</target> + <source>Could not read values for the following XML nodes:</source> <target>Не вдалося прочитати значення таких XML записів:</target> @@ -585,7 +589,7 @@ The command line is executed each time: <target>Зберегти активні налаштування в файлі</target> <source>Load configuration from file</source> -<target>Завантажити налаштування синхронізації з файла</target> +<target>Завантажити налаштування синхронізації з файлу</target> <source>Last used configurations (press DEL to remove from list)</source> <target> @@ -615,7 +619,7 @@ The command line is executed each time: <target>Пакетне завдання</target> <source>Create a batch file for automated synchronization. To start in batch mode simply double-click the file or execute via command line: FreeFileSync.exe <ffs_batch file>. This can also be scheduled in your operating system's task planner.</source> -<target></target> +<target>Створіть пакетний файл для автоматичної синхронізації. Для виконання пакетної синхронізації просто двічі клацніть файл мишкою або скористайтесь командним рядком: FreeFileSync.exe <ffs_batch file>. Можна також використати планувальник завдань операційної системи</target> <source>Help</source> <target>Допомога</target> @@ -639,7 +643,7 @@ The command line is executed each time: <target>Статус оберненого зв’язку</target> <source>Run minimized</source> -<target></target> +<target>Запустити згорнутим</target> <source>Maximum number of logfiles:</source> <target>Максимальна кількість лог-файлів:</target> @@ -648,7 +652,7 @@ The command line is executed each time: <target>Виберіть каталог для лог-файлів:</target> <source>Batch settings</source> -<target></target> +<target>Налаштування пакетного завдання</target> <source>&Save</source> <target>&Зберегти</target> @@ -659,10 +663,13 @@ The command line is executed each time: <source>&Cancel</source> <target>&Відмінити</target> -<source>Elements found:</source> +<source>Operation:</source> +<target>Операція:</target> + +<source>Items found:</source> <target>Елементів знайдено:</target> -<source>Elements remaining:</source> +<source>Items remaining:</source> <target>Елементів залишилось:</target> <source>Speed:</source> @@ -674,9 +681,6 @@ The command line is executed each time: <source>Time elapsed:</source> <target>Пройшло часу:</target> -<source>Operation:</source> -<target>Операція:</target> - <source>Select variant:</source> <target>Виберіть варіант:</target> @@ -746,10 +750,15 @@ Files are found equal if - file size are the same </source> -<target></target> +<target> +Файли вважаються однаковими якщо + - дата і час останнього запису + - розмір файлів +співпадають +</target> <source>File time and size</source> -<target></target> +<target>Дата та розмір файлу</target> <source> Files are found equal if @@ -759,7 +768,7 @@ is the same <target>Файли вважаються рівними, якщо вміст файлів однаковий</target> <source>File content</source> -<target>Вміст файла</target> +<target>Вміст файлу</target> <source>Symbolic Link handling</source> <target>Обробка символьного посилання</target> @@ -767,7 +776,7 @@ is the same <source>Synchronizing...</source> <target>Синхронізація...</target> -<source>Elements processed:</source> +<source>Items processed:</source> <target>Елементів оброблено:</target> <source>&Pause</source> @@ -879,10 +888,10 @@ Exclude: \stuff\temp\* <target>Виключити</target> <source>Minimum file size</source> -<target></target> +<target>Мінімальний розмір файлу</target> <source>Maximum file size</source> -<target></target> +<target>Максимальний розмір файлу</target> <source>&Default</source> <target>&За замовчуванням</target> @@ -894,10 +903,10 @@ Exclude: \stuff\temp\* <target>Перемістити донизу</target> <source>Transactional file copy</source> -<target></target> +<target>Копіювання файлів з використанням трансакцій</target> -<source>Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.</source> -<target></target> +<source>Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.</source> +<target>Записати до тимчасового файлу (*.ffs_tmp), а потім перейменувати. Це гарантує збереження даних навіть при критичній помилці.</target> <source>Copy locked files</source> <target>Копіювати заблоковані файли</target> @@ -913,14 +922,14 @@ Copy shared or locked files using Volume Shadow Copy Service </target> <source>Copy file access permissions</source> -<target></target> +<target>Копіювати права доступу до файлу</target> <source> Transfer file and directory permissions (Requires Administrator rights) </source> <target> -Передача прав доступу файла/каталогу +Передача прав доступу файлу/каталогу (потрібні права Адміністратора) </target> @@ -988,11 +997,23 @@ Transfer file and directory permissions <target>Вибрати колонки...</target> <source>Select time span...</source> -<target></target> +<target>Виберіть інтервал часу...</target> <source>Auto-adjust columns</source> <target>Автовирівнювання ширини колонок</target> +<source>Icon size:</source> +<target>Розмір іконки:</target> + +<source>Small</source> +<target>Малий</target> + +<source>Medium</source> +<target>середній</target> + +<source>Large</source> +<target>великий</target> + <source>Include all rows</source> <target>Відмінити всі</target> @@ -1193,19 +1214,19 @@ Transfer file and directory permissions <target>Неактивний</target> <source>Last x hours</source> -<target></target> +<target>Останні x годин</target> <source>Today</source> -<target></target> +<target>Сьогодні</target> <source>This week</source> -<target></target> +<target>Цього тижня</target> <source>This month</source> -<target></target> +<target>Цього місяця</target> <source>This year</source> -<target></target> +<target>Цього року</target> <source>Byte</source> <target>Байт</target> @@ -1232,13 +1253,13 @@ Transfer file and directory permissions <target>Послідовно</target> <source>Copy NTFS permissions</source> -<target></target> +<target>Копіювати права доступу NTFS</target> <source>Integrate external applications into context menu. The following macros are available:</source> <target>Інтеграція зовнішніх додатків в контекстному меню. Доступні макроси:</target> <source>- full file or directory name</source> -<target>- повне ім’я файла чи каталога</target> +<target>- повне ім’я файлу чи каталога</target> <source>- directory part only</source> <target>- лише каталог</target> @@ -1378,55 +1399,55 @@ Transfer file and directory permissions <target>Нічого не робити</target> <source>Copy file attributes only to left</source> -<target>Зкопіювати ліворуч лише атрибути файла</target> +<target>Зкопіювати ліворуч лише атрибути файлу</target> <source>Copy file attributes only to right</source> -<target>Зкопіювати праворуч лише атрибути файла</target> +<target>Зкопіювати праворуч лише атрибути файлу</target> <source>Deleting file %x</source> -<target>Вилучення файла %x</target> +<target>Вилучення файлу %x</target> <source>Deleting folder %x</source> <target>Вилучення папки %x</target> <source>Deleting symbolic link %x</source> -<target></target> +<target>Вилучення символьного посилання %x</target> <source>Moving file %x to recycle bin</source> -<target></target> +<target>Переміщення файлу %x у Корзину</target> <source>Moving folder %x to recycle bin</source> -<target></target> +<target>Переміщення папки %x у Корзину</target> <source>Moving symbolic link %x to recycle bin</source> -<target></target> +<target>Переміщення символьного посилання %x у Корзину</target> <source>Moving file %x to %y</source> -<target></target> +<target>Переміщення файлу %x до %y</target> <source>Moving folder %x to %y</source> -<target></target> +<target>Переміщення папки %x до %y</target> <source>Moving symbolic link %x to %y</source> -<target></target> +<target>Переміщення символьного посилання %x до %y</target> <source>Creating file %x</source> -<target></target> +<target>Створення файлу %x</target> <source>Creating symbolic link %x</source> -<target></target> +<target>Створення символьного посилання %x</target> <source>Creating folder %x</source> <target>Створення папки %x</target> <source>Overwriting file %x</source> -<target></target> +<target>Перезапис файлу %x</target> <source>Overwriting symbolic link %x</source> -<target></target> +<target>Перезапис символьного посилання %x</target> <source>Verifying file %x</source> -<target>Перевірка файла %x</target> +<target>Перевірка файлу %x</target> <source>Updating attributes of %x</source> <target>Оновлення атрибутів %x</target> @@ -1435,7 +1456,7 @@ Transfer file and directory permissions <target>Кінцевий каталог не повинен бути порожнім</target> <source>User-defined directory for deletion was not specified!</source> -<target>Каталог для вилучення користувачем вказана не була!</target> +<target>Каталог для вилучення користувачем не був вказаний!</target> <source>Source directory does not exist anymore:</source> <target>Каталог-джерело вже не існує:</target> @@ -1462,7 +1483,7 @@ Transfer file and directory permissions <target>Доступно вільного місця на диску:</target> <source>Recycle Bin is not available for the following paths! Files will be deleted permanently instead:</source> -<target></target> +<target>Корзина для цього шляху недоступна. Файли будуть вилучені назавжди:</target> <source>A directory will be modified which is part of multiple folder pairs! Please review synchronization settings!</source> <target>Каталог, який є частиною декількох пар папок, буде змінений. Будь ласка, перевірте налаштування синхронізації!</target> @@ -1477,7 +1498,7 @@ Transfer file and directory permissions <target>Нічого синхронізувати згідно з налаштуваннями синхронізації!</target> <source>Error copying locked file %x!</source> -<target>Помилка при копіюванні заблокованого файла %x!</target> +<target>Помилка при копіюванні заблокованого файлу %x!</target> <source>Data verification error: Source and target file have different content!</source> <target>Помилка перевірки даних: вхідний і вихідний файли мають різний вміст!</target> diff --git a/BUILD/Resources.zip b/BUILD/Resources.zip Binary files differindex 68d20ebd..e1ede907 100644 --- a/BUILD/Resources.zip +++ b/BUILD/Resources.zip diff --git a/FreeFileSync - wxWidgets v2.9.2 Beta.vcxproj b/FreeFileSync - wxWidgets v2.9.2 Beta.vcxproj deleted file mode 100644 index 6504a03f..00000000 --- a/FreeFileSync - wxWidgets v2.9.2 Beta.vcxproj +++ /dev/null @@ -1,308 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{86C36CC7-9418-4253-9929-829486F59A00}</ProjectGuid> - <Keyword>Win32Proj</Keyword> - <RootNamespace>FreeFileSync</RootNamespace> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>Windows7.1SDK</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>Windows7.1SDK</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <WholeProgramOptimization>true</WholeProgramOptimization> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>Windows7.1SDK</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <WholeProgramOptimization>true</WholeProgramOptimization> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>Windows7.1SDK</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>true</LinkIncremental> - <OutDir>BUILD\Bin\</OutDir> - <IntDir>OBJ\$(ProjectName)_$(Configuration)_$(PlatformName)_VCPP\</IntDir> - <TargetName>$(ProjectName)_$(PlatformName)_beta</TargetName> - <GenerateManifest>false</GenerateManifest> - <EmbedManifest>true</EmbedManifest> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <LinkIncremental>true</LinkIncremental> - <OutDir>BUILD\Bin\</OutDir> - <IntDir>OBJ\$(ProjectName)_$(Configuration)_$(PlatformName)_VCPP\</IntDir> - <TargetName>$(ProjectName)_$(PlatformName)</TargetName> - <GenerateManifest>false</GenerateManifest> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <LinkIncremental>false</LinkIncremental> - <OutDir>BUILD\Bin\</OutDir> - <IntDir>OBJ\$(ProjectName)_$(Configuration)_$(PlatformName)_VCPP\</IntDir> - <GenerateManifest>false</GenerateManifest> - <TargetName>$(ProjectName)_$(PlatformName)_beta</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <LinkIncremental>false</LinkIncremental> - <OutDir>BUILD\Bin\</OutDir> - <IntDir>OBJ\$(ProjectName)_$(Configuration)_$(PlatformName)_VCPP\</IntDir> - <GenerateManifest>false</GenerateManifest> - <TargetName>$(ProjectName)_$(PlatformName)</TargetName> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <PrecompiledHeader>Use</PrecompiledHeader> - <WarningLevel>Level4</WarningLevel> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>ZEN_PLATFORM_WINDOWS;wxUSE_UNICODE;__WXMSW__;FFS_WIN;WXINTL_NO_GETTEXT_MACRO;__WXDEBUG__;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>.\shared;C:\Program Files\C++\wxWidgets-2.9.2\include;C:\Program Files\C++\wxWidgets-2.9.2\lib\vc_lib\mswud;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> - <PrecompiledHeaderFile>$(ProjectDir)shared\pch.h</PrecompiledHeaderFile> - <DisableSpecificWarnings>4996;4100;</DisableSpecificWarnings> - <MultiProcessorCompilation>false</MultiProcessorCompilation> - <DisableLanguageExtensions>false</DisableLanguageExtensions> - <PrecompiledHeaderOutputFile>$(IntDir)pch.obj</PrecompiledHeaderOutputFile> - <ForcedIncludeFiles>$(ProjectDir)shared/i18n.h;$(ProjectDir)shared/pch.h</ForcedIncludeFiles> - <DebugInformationFormat>EditAndContinue</DebugInformationFormat> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> - </ClCompile> - <Link> - <SubSystem>Windows</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - <SuppressStartupBanner>true</SuppressStartupBanner> - <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> - <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:\Program Files\C++\wxWidgets-2.9.2\lib\vc_lib;C:\Program Files\C++\Boost\stage\lib</AdditionalLibraryDirectories> - <LinkStatus> - </LinkStatus> - </Link> - <ResourceCompile> - <AdditionalIncludeDirectories>C:\Program Files\C++\wxWidgets-2.9.2\include;C:\Program Files\C++\wxWidgets-2.9.2\lib\vc_lib\mswud</AdditionalIncludeDirectories> - <PreprocessorDefinitions>%(PreprocessorDefinitions);</PreprocessorDefinitions> - </ResourceCompile> - <Manifest> - <SuppressDependencyElement> - </SuppressDependencyElement> - </Manifest> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <PrecompiledHeader>Use</PrecompiledHeader> - <WarningLevel>Level4</WarningLevel> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>ZEN_PLATFORM_WINDOWS;wxUSE_UNICODE;__WXMSW__;FFS_WIN;WXINTL_NO_GETTEXT_MACRO;__WXDEBUG__;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>.\shared;C:\Program Files\C++\wxWidgets-x64\include;C:\Program Files\C++\wxWidgets-x64\lib\vc_lib\mswud;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> - <PrecompiledHeaderFile>$(ProjectDir)shared\pch.h</PrecompiledHeaderFile> - <DisableSpecificWarnings>4996;4100;</DisableSpecificWarnings> - <MultiProcessorCompilation>false</MultiProcessorCompilation> - <DisableLanguageExtensions>false</DisableLanguageExtensions> - <PrecompiledHeaderOutputFile>$(IntDir)pch.obj</PrecompiledHeaderOutputFile> - <ForcedIncludeFiles>$(ProjectDir)shared/i18n.h;$(ProjectDir)shared/pch.h</ForcedIncludeFiles> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - <SuppressStartupBanner>true</SuppressStartupBanner> - </ClCompile> - <Link> - <SubSystem>Windows</SubSystem> - <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> - <AdditionalLibraryDirectories>C:\Program Files\C++\wxWidgets-x64\lib\vc_lib;C:\Program Files\C++\Boost\stage64\lib</AdditionalLibraryDirectories> - <LinkStatus> - </LinkStatus> - </Link> - <ResourceCompile> - <AdditionalIncludeDirectories>C:\Program Files\C++\wxWidgets-2.9.2\include;C:\Program Files\C++\wxWidgets-2.9.2\lib\vc_lib\mswud</AdditionalIncludeDirectories> - <PreprocessorDefinitions>%(PreprocessorDefinitions);WX_CPU_AMD64</PreprocessorDefinitions> - </ResourceCompile> - <Manifest> - <SuppressDependencyElement> - </SuppressDependencyElement> - </Manifest> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <WarningLevel>Level4</WarningLevel> - <PrecompiledHeader>NotUsing</PrecompiledHeader> - <Optimization>MaxSpeed</Optimization> - <FunctionLevelLinking>true</FunctionLevelLinking> - <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>ZEN_PLATFORM_WINDOWS;wxUSE_UNICODE;__WXMSW__;FFS_WIN;WXINTL_NO_GETTEXT_MACRO;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>.\shared;C:\Program Files\C++\wxWidgets-2.9.2\include;C:\Program Files\C++\wxWidgets-2.9.2\lib\vc_lib\mswu;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> - <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <DisableSpecificWarnings>4996;4100;</DisableSpecificWarnings> - <RuntimeLibrary>MultiThreaded</RuntimeLibrary> - <MultiProcessorCompilation>true</MultiProcessorCompilation> - <DisableLanguageExtensions>false</DisableLanguageExtensions> - <ForcedIncludeFiles>$(ProjectDir)shared/i18n.h;</ForcedIncludeFiles> - </ClCompile> - <Link> - <SubSystem>Windows</SubSystem> - <GenerateDebugInformation>false</GenerateDebugInformation> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - <SuppressStartupBanner>true</SuppressStartupBanner> - <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:\Program Files\C++\wxWidgets-2.9.2\lib\vc_lib;C:\Program Files\C++\Boost\stage\lib</AdditionalLibraryDirectories> - <LinkStatus> - </LinkStatus> - </Link> - <ResourceCompile> - <AdditionalIncludeDirectories>C:\Program Files\C++\wxWidgets-2.9.2\include;C:\Program Files\C++\wxWidgets-2.9.2\lib\vc_lib\mswu</AdditionalIncludeDirectories> - <PreprocessorDefinitions>%(PreprocessorDefinitions);</PreprocessorDefinitions> - <Culture> - </Culture> - </ResourceCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <WarningLevel>Level4</WarningLevel> - <PrecompiledHeader>NotUsing</PrecompiledHeader> - <Optimization>MaxSpeed</Optimization> - <FunctionLevelLinking>true</FunctionLevelLinking> - <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>ZEN_PLATFORM_WINDOWS;wxUSE_UNICODE;__WXMSW__;FFS_WIN;WXINTL_NO_GETTEXT_MACRO;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>.\shared;C:\Program Files\C++\wxWidgets-x64\include;C:\Program Files\C++\wxWidgets-x64\lib\vc_lib\mswu;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> - <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <DisableSpecificWarnings>4512;4996;4100;4127</DisableSpecificWarnings> - <RuntimeLibrary>MultiThreaded</RuntimeLibrary> - <MultiProcessorCompilation>true</MultiProcessorCompilation> - <DisableLanguageExtensions>false</DisableLanguageExtensions> - <SuppressStartupBanner>true</SuppressStartupBanner> - <ForcedIncludeFiles>$(ProjectDir)shared/i18n.h;</ForcedIncludeFiles> - </ClCompile> - <Link> - <SubSystem>Windows</SubSystem> - <GenerateDebugInformation>false</GenerateDebugInformation> - <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> - <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> - <AdditionalLibraryDirectories>C:\Program Files\C++\wxWidgets-x64\lib\vc_lib;C:\Program Files\C++\Boost\stage64\lib</AdditionalLibraryDirectories> - <LinkStatus> - </LinkStatus> - </Link> - <ResourceCompile> - <AdditionalIncludeDirectories>C:\Program Files\C++\wxWidgets-2.9.2\include;C:\Program Files\C++\wxWidgets-2.9.2\lib\vc_lib\mswu</AdditionalIncludeDirectories> - <PreprocessorDefinitions>%(PreprocessorDefinitions);WX_CPU_AMD64</PreprocessorDefinitions> - <Culture> - </Culture> - </ResourceCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="algorithm.cpp"> - <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> - <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> - </ClCompile> - <ClCompile Include="application.cpp" /> - <ClCompile Include="comparison.cpp" /> - <ClCompile Include="file_hierarchy.cpp" /> - <ClCompile Include="library\binary.cpp" /> - <ClCompile Include="library\custom_grid.cpp" /> - <ClCompile Include="library\db_file.cpp" /> - <ClCompile Include="library\dir_lock.cpp" /> - <ClCompile Include="library\error_log.cpp" /> - <ClCompile Include="library\filter.cpp" /> - <ClCompile Include="library\icon_buffer.cpp" /> - <ClCompile Include="library\process_xml.cpp" /> - <ClCompile Include="library\resources.cpp" /> - <ClCompile Include="library\statistics.cpp" /> - <ClCompile Include="library\status_handler.cpp" /> - <ClCompile Include="shared\app_main.cpp" /> - <ClCompile Include="shared\custom_button.cpp" /> - <ClCompile Include="shared\folder_history_box.cpp" /> - <ClCompile Include="shared\custom_tooltip.cpp" /> - <ClCompile Include="shared\dir_name.cpp" /> - <ClCompile Include="shared\dst_hack.cpp" /> - <ClCompile Include="shared\file_handling.cpp" /> - <ClCompile Include="shared\file_id.cpp" /> - <ClCompile Include="shared\file_io.cpp" /> - <ClCompile Include="shared\file_traverser.cpp" /> - <ClCompile Include="shared\guid.cpp" /> - <ClCompile Include="shared\help_provider.cpp" /> - <ClCompile Include="shared\i18n.cpp" /> - <ClCompile Include="shared\localization.cpp" /> - <ClCompile Include="shared\mouse_move_dlg.cpp" /> - <ClCompile Include="shared\privilege.cpp" /> - <ClCompile Include="shared\recycler.cpp" /> - <ClCompile Include="shared\resolve_path.cpp" /> - <ClCompile Include="shared\serialize.cpp" /> - <ClCompile Include="shared\shadow.cpp" /> - <ClCompile Include="shared\standard_paths.cpp" /> - <ClCompile Include="shared\last_error.cpp" /> - <ClCompile Include="shared\taskbar.cpp" /> - <ClCompile Include="shared\toggle_button.cpp" /> - <ClCompile Include="shared\util.cpp" /> - <ClCompile Include="shared\xml_base.cpp" /> - <ClCompile Include="shared\zstring.cpp" /> - <ClCompile Include="structures.cpp" /> - <ClCompile Include="synchronization.cpp" /> - <ClCompile Include="ui\batch_config.cpp" /> - <ClCompile Include="ui\batch_status_handler.cpp" /> - <ClCompile Include="ui\check_version.cpp" /> - <ClCompile Include="ui\grid_view.cpp" /> - <ClCompile Include="ui\gui_generated.cpp" /> - <ClCompile Include="ui\gui_status_handler.cpp" /> - <ClCompile Include="ui\main_dlg.cpp" /> - <ClCompile Include="ui\msg_popup.cpp" /> - <ClCompile Include="ui\progress_indicator.cpp" /> - <ClCompile Include="ui\search.cpp" /> - <ClCompile Include="ui\small_dlgs.cpp" /> - <ClCompile Include="ui\switch_to_gui.cpp" /> - <ClCompile Include="ui\sync_cfg.cpp" /> - <ClCompile Include="ui\tray_icon.cpp" /> - </ItemGroup> - <ItemGroup> - <ResourceCompile Include="resource.rc" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project>
\ No newline at end of file diff --git a/FreeFileSync.cbp b/FreeFileSync.cbp index 62c8f985..7273796e 100644 --- a/FreeFileSync.cbp +++ b/FreeFileSync.cbp @@ -23,7 +23,7 @@ <Linker> <Add option="-s" /> <Add option="-static" /> - <Add library="libboost_thread-mgw45-mt-s-1_47.a" /> + <Add library="libboost_thread-mgw46-mt-s-1_47.a" /> <Add library="libwxmsw28u_aui.a" /> <Add library="libwxmsw28u_adv.a" /> <Add library="libwxmsw28u_core.a" /> @@ -45,12 +45,12 @@ <Compiler> <Add option="-g" /> <Add option="-Winvalid-pch" /> - <Add option='-include "shared/pch.h"' /> + <Add option='-include "wx+/pch.h"' /> <Add option="-D__WXDEBUG__" /> <Add directory="C:\Programme\C++\wxWidgets\lib\gcc_dll\mswud" /> </Compiler> <Linker> - <Add library="libboost_thread-mgw45-mt-sd-1_47.a" /> + <Add library="libboost_thread-mgw46-mt-sd-1_47.a" /> <Add library="libwxmsw28ud_aui.a" /> <Add library="libwxmsw28ud_adv.a" /> <Add library="libwxmsw28ud_core.a" /> @@ -70,14 +70,14 @@ <Compiler> <Add option="-g" /> <Add option="-Winvalid-pch" /> - <Add option='-include "shared/pch.h"' /> + <Add option='-include "wx+/pch.h"' /> <Add option="-D__WXDEBUG__" /> <Add directory="C:\Programme\C++\wxWidgets\lib\gcc_dll\mswud" /> - <Add directory="library\gtest" /> - <Add directory="library\gtest\include" /> + <Add directory="lib\gtest" /> + <Add directory="lib\gtest\include" /> </Compiler> <Linker> - <Add library="libboost_thread-mgw45-mt-sd-1_47.a" /> + <Add library="libboost_thread-mgw46-mt-sd-1_47.a" /> <Add library="libwxmsw28ud_adv.a" /> <Add library="libwxmsw28ud_core.a" /> <Add library="libwxbase28ud.a" /> @@ -92,14 +92,15 @@ <Add option="-Winit-self" /> <Add option="-Wredundant-decls" /> <Add option="-Wcast-align" /> + <Add option="-Wunreachable-code" /> <Add option="-Wmissing-include-dirs" /> <Add option="-Wswitch-enum" /> <Add option="-Wmain" /> <Add option="-Wall" /> + <Add option="-std=gnu++0x" /> <Add option="-pipe" /> <Add option="-mthreads" /> - <Add option="-std=gnu++0x" /> - <Add option='-include "shared/warn_static.h"' /> + <Add option='-include "zen/warn_static.h"' /> <Add option="-D__GNUWIN32__" /> <Add option="-D__WXMSW__" /> <Add option="-DFFS_WIN" /> @@ -109,7 +110,8 @@ <Add option="-DZEN_PLATFORM_WINDOWS" /> <Add directory="C:\Programme\C++\wxWidgets\include" /> <Add directory="C:\Program Files\C++\Boost" /> - <Add directory="shared" /> + <Add directory="." /> + <Add directory=".\zenXml" /> </Compiler> <ResourceCompiler> <Add directory="C:\Programme\C++\wxWidgets\include" /> @@ -134,335 +136,314 @@ <Option target="<{~None~}>" /> </Unit> <Unit filename="algorithm.cpp" /> - <Unit filename="algorithm.h"> - <Option target="<{~None~}>" /> - </Unit> + <Unit filename="algorithm.h" /> <Unit filename="application.cpp"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="application.h"> - <Option target="<{~None~}>" /> - </Unit> + <Unit filename="application.h" /> <Unit filename="comparison.cpp" /> - <Unit filename="comparison.h"> - <Option target="<{~None~}>" /> - </Unit> + <Unit filename="comparison.h" /> <Unit filename="file_hierarchy.cpp" /> <Unit filename="file_hierarchy.h" /> - <Unit filename="library\binary.cpp" /> - <Unit filename="library\binary.h" /> - <Unit filename="library\custom_grid.cpp"> - <Option target="Release" /> - <Option target="Debug-DLL" /> - </Unit> - <Unit filename="library\custom_grid.h"> - <Option target="<{~None~}>" /> - </Unit> - <Unit filename="library\db_file.cpp" /> - <Unit filename="library\db_file.h"> - <Option target="Release" /> - <Option target="Debug-DLL" /> - </Unit> - <Unit filename="library\detect_renaming.h" /> - <Unit filename="library\dir_exist_async.h" /> - <Unit filename="library\dir_lock.cpp" /> - <Unit filename="library\dir_lock.h" /> - <Unit filename="library\error_log.cpp"> - <Option target="Release" /> - <Option target="Debug-DLL" /> - </Unit> - <Unit filename="library\error_log.h"> - <Option target="Release" /> - <Option target="Debug-DLL" /> - </Unit> - <Unit filename="library\gtest\main.cpp"> + <Unit filename="lib\binary.cpp" /> + <Unit filename="lib\binary.h" /> + <Unit filename="lib\cmp_filetime.h" /> + <Unit filename="lib\custom_grid.cpp"> + <Option target="Release" /> + <Option target="Debug-DLL" /> + </Unit> + <Unit filename="lib\custom_grid.h" /> + <Unit filename="lib\db_file.cpp" /> + <Unit filename="lib\db_file.h" /> + <Unit filename="lib\dir_exist_async.h" /> + <Unit filename="lib\dir_lock.cpp" /> + <Unit filename="lib\dir_lock.h" /> + <Unit filename="lib\dir_name.cpp" /> + <Unit filename="lib\dir_name.h" /> + <Unit filename="lib\error_log.cpp" /> + <Unit filename="lib\error_log.h" /> + <Unit filename="lib\ffs_paths.h" /> + <Unit filename="lib\folder_history_box.cpp" /> + <Unit filename="lib\folder_history_box.h" /> + <Unit filename="lib\gtest\main.cpp"> <Option target="Unit Test" /> </Unit> - <Unit filename="library\gtest\src\gtest-all.cc"> + <Unit filename="lib\gtest\src\gtest-all.cc"> <Option target="Unit Test" /> </Unit> - <Unit filename="library\gtest\src\gtest-internal-inl.h"> + <Unit filename="lib\gtest\unittest.h"> <Option target="Unit Test" /> </Unit> - <Unit filename="library\gtest\unittest.h"> - <Option target="<{~None~}>" /> - </Unit> - <Unit filename="library\gtest\unittest1.cpp"> + <Unit filename="lib\gtest\unittest1.cpp"> <Option target="Unit Test" /> </Unit> - <Unit filename="library\gtest\unittest2.cpp"> + <Unit filename="lib\gtest\unittest2.cpp"> <Option target="Unit Test" /> </Unit> - <Unit filename="library\gtest\unittest3.cpp"> + <Unit filename="lib\gtest\unittest3.cpp"> <Option target="Unit Test" /> </Unit> - <Unit filename="library\hard_filter.cpp" /> - <Unit filename="library\hard_filter.h" /> - <Unit filename="library\icon_buffer.cpp"> + <Unit filename="lib\hard_filter.cpp" /> + <Unit filename="lib\hard_filter.h" /> + <Unit filename="lib\help_provider.h" /> + <Unit filename="lib\icon_buffer.cpp" /> + <Unit filename="lib\icon_buffer.h" /> + <Unit filename="lib\localization.cpp" /> + <Unit filename="lib\localization.h" /> + <Unit filename="lib\lock_holder.h" /> + <Unit filename="lib\norm_filter.h" /> + <Unit filename="lib\parallel_scan.cpp" /> + <Unit filename="lib\parallel_scan.h" /> + <Unit filename="lib\parse_lng.h" /> + <Unit filename="lib\parse_plural.h" /> + <Unit filename="lib\process_xml.cpp" /> + <Unit filename="lib\process_xml.h" /> + <Unit filename="lib\recycler.cpp" /> + <Unit filename="lib\recycler.h" /> + <Unit filename="lib\resolve_path.cpp" /> + <Unit filename="lib\resolve_path.h" /> + <Unit filename="lib\resources.cpp" /> + <Unit filename="lib\resources.h" /> + <Unit filename="lib\shadow.cpp" /> + <Unit filename="lib\shadow.h" /> + <Unit filename="lib\soft_filter.h" /> + <Unit filename="lib\statistics.cpp" /> + <Unit filename="lib\statistics.h" /> + <Unit filename="lib\status_handler.cpp" /> + <Unit filename="lib\status_handler.h" /> + <Unit filename="lib\xml_base.cpp" /> + <Unit filename="lib\xml_base.h" /> + <Unit filename="resource.rc"> + <Option compilerVar="WINDRES" /> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="library\icon_buffer.h"> + <Unit filename="structures.cpp" /> + <Unit filename="structures.h" /> + <Unit filename="synchronization.cpp" /> + <Unit filename="synchronization.h" /> + <Unit filename="ui\batch_config.cpp"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="library\lock_holder.h" /> - <Unit filename="library\norm_filter.h" /> - <Unit filename="library\parallel_scan.cpp" /> - <Unit filename="library\parallel_scan.h" /> - <Unit filename="library\process_xml.cpp" /> - <Unit filename="library\process_xml.h"> - <Option target="<{~None~}>" /> - </Unit> - <Unit filename="library\resources.cpp" /> - <Unit filename="library\resources.h"> - <Option target="<{~None~}>" /> - </Unit> - <Unit filename="library\soft_filter.h" /> - <Unit filename="library\statistics.cpp"> + <Unit filename="ui\batch_config.h"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="library\statistics.h"> - <Option target="<{~None~}>" /> - </Unit> - <Unit filename="library\status_handler.cpp" /> - <Unit filename="library\status_handler.h"> - <Option target="<{~None~}>" /> - </Unit> - <Unit filename="resource.rc"> - <Option compilerVar="WINDRES" /> + <Unit filename="ui\batch_status_handler.cpp"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="shared\FindFilePlus\find_file_plus.h" /> - <Unit filename="shared\Recycler.h" /> - <Unit filename="shared\app_main.cpp"> + <Unit filename="ui\batch_status_handler.h" /> + <Unit filename="ui\check_version.cpp"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="shared\app_main.h"> - <Option target="Release" /> - <Option target="Debug-DLL" /> + <Unit filename="ui\check_version.h"> + <Option target="<{~None~}>" /> </Unit> - <Unit filename="shared\boost_thread_wrap.h" /> - <Unit filename="shared\build_info.h" /> - <Unit filename="shared\check_exist.h" /> - <Unit filename="shared\custom_button.cpp"> + <Unit filename="ui\folder_pair.h"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="shared\custom_button.h"> + <Unit filename="ui\grid_view.cpp"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="shared\custom_tooltip.cpp"> - <Option target="Release" /> - <Option target="Debug-DLL" /> + <Unit filename="ui\grid_view.h"> + <Option target="<{~None~}>" /> </Unit> - <Unit filename="shared\custom_tooltip.h"> + <Unit filename="ui\gui_generated.cpp"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="shared\dir_name.cpp" /> - <Unit filename="shared\dir_name.h" /> - <Unit filename="shared\dir_picker_i18n.h" /> - <Unit filename="shared\disable_standby.h" /> - <Unit filename="shared\dll_loader.h" /> - <Unit filename="shared\dst_hack.cpp" /> - <Unit filename="shared\dst_hack.h" /> - <Unit filename="shared\file_drop.h" /> - <Unit filename="shared\file_error.h" /> - <Unit filename="shared\file_handling.cpp" /> - <Unit filename="shared\file_handling.h" /> - <Unit filename="shared\file_id.cpp" /> - <Unit filename="shared\file_id.h" /> - <Unit filename="shared\file_io.cpp" /> - <Unit filename="shared\file_io.h" /> - <Unit filename="shared\file_traverser.cpp" /> - <Unit filename="shared\file_traverser.h" /> - <Unit filename="shared\file_update_handle.h" /> - <Unit filename="shared\folder_history_box.cpp" /> - <Unit filename="shared\folder_history_box.h" /> - <Unit filename="shared\global_func.h" /> - <Unit filename="shared\guid.cpp" /> - <Unit filename="shared\guid.h" /> - <Unit filename="shared\help_provider.cpp"> - <Option target="Release" /> - <Option target="Debug-DLL" /> + <Unit filename="ui\gui_generated.h"> + <Option target="<{~None~}>" /> </Unit> - <Unit filename="shared\help_provider.h"> + <Unit filename="ui\gui_status_handler.cpp"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="shared\i18n.cpp" /> - <Unit filename="shared\i18n.h" /> - <Unit filename="shared\int64.h" /> - <Unit filename="shared\last_error.cpp" /> - <Unit filename="shared\last_error.h" /> - <Unit filename="shared\localization.cpp" /> - <Unit filename="shared\localization.h" /> - <Unit filename="shared\long_path_prefix.h" /> - <Unit filename="shared\mouse_move_dlg.cpp"> + <Unit filename="ui\gui_status_handler.h"> + <Option target="<{~None~}>" /> + </Unit> + <Unit filename="ui\main_dlg.cpp"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="shared\parse_plural.h" /> - <Unit filename="shared\parse_txt.h" /> - <Unit filename="shared\pch.h"> - <Option compile="1" /> - <Option weight="0" /> - <Option target="Unit Test" /> - <Option target="Debug-DLL" /> + <Unit filename="ui\main_dlg.h"> + <Option target="<{~None~}>" /> </Unit> - <Unit filename="shared\privilege.cpp" /> - <Unit filename="shared\privilege.h" /> - <Unit filename="shared\recycler.cpp" /> - <Unit filename="shared\recycler.h" /> - <Unit filename="shared\resolve_path.cpp" /> - <Unit filename="shared\resolve_path.h" /> - <Unit filename="shared\serialize.cpp" /> - <Unit filename="shared\serialize.h" /> - <Unit filename="shared\shadow.cpp" /> - <Unit filename="shared\shadow.h" /> - <Unit filename="shared\standard_paths.cpp" /> - <Unit filename="shared\standard_paths.h" /> - <Unit filename="shared\string_conv.h" /> - <Unit filename="shared\string_tools.h" /> - <Unit filename="shared\symlink_target.h" /> - <Unit filename="shared\system_constants.h" /> - <Unit filename="shared\taskbar.cpp"> + <Unit filename="ui\msg_popup.cpp"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="shared\taskbar.h"> + <Unit filename="ui\msg_popup.h" /> + <Unit filename="ui\progress_indicator.cpp"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="shared\toggle_button.cpp"> + <Unit filename="ui\progress_indicator.h" /> + <Unit filename="ui\search.cpp"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="shared\toggle_button.h"> + <Unit filename="ui\search.h" /> + <Unit filename="ui\small_dlgs.cpp"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="shared\util.cpp" /> - <Unit filename="shared\util.h" /> - <Unit filename="shared\wx_choice_enum.h" /> - <Unit filename="shared\xml_base.cpp" /> - <Unit filename="shared\xml_base.h" /> - <Unit filename="shared\xml_error.h" /> - <Unit filename="shared\zbase.h" /> - <Unit filename="shared\zstring.cpp" /> - <Unit filename="shared\zstring.h" /> - <Unit filename="structures.cpp" /> - <Unit filename="structures.h"> + <Unit filename="ui\small_dlgs.h"> <Option target="<{~None~}>" /> </Unit> - <Unit filename="synchronization.cpp" /> - <Unit filename="synchronization.h"> + <Unit filename="ui\sorting.h"> <Option target="<{~None~}>" /> </Unit> - <Unit filename="ui\batch_config.cpp"> + <Unit filename="ui\switch_to_gui.h"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="ui\batch_config.h"> + <Unit filename="ui\sync_cfg.cpp"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="ui\batch_status_handler.cpp"> + <Unit filename="ui\sync_cfg.h"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="ui\batch_status_handler.h" /> - <Unit filename="ui\check_version.cpp"> + <Unit filename="ui\taskbar.cpp" /> + <Unit filename="ui\taskbar.h" /> + <Unit filename="ui\tray_icon.cpp"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="ui\check_version.h"> - <Option target="<{~None~}>" /> - </Unit> - <Unit filename="ui\folder_pair.h"> + <Unit filename="ui\tray_icon.h" /> + <Unit filename="wx+\app_main.h"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="ui\grid_view.cpp"> + <Unit filename="wx+\button.cpp"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="ui\grid_view.h"> - <Option target="<{~None~}>" /> - </Unit> - <Unit filename="ui\gui_generated.cpp"> + <Unit filename="wx+\button.h"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="ui\gui_generated.h"> - <Option target="<{~None~}>" /> + <Unit filename="wx+\choice_enum.h"> + <Option target="Release" /> + <Option target="Debug-DLL" /> </Unit> - <Unit filename="ui\gui_status_handler.cpp"> + <Unit filename="wx+\dir_picker.h"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="ui\gui_status_handler.h"> - <Option target="<{~None~}>" /> + <Unit filename="wx+\file_drop.h"> + <Option target="Release" /> + <Option target="Debug-DLL" /> </Unit> - <Unit filename="ui\main_dlg.cpp"> + <Unit filename="wx+\format_unit.cpp" /> + <Unit filename="wx+\format_unit.h"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="ui\main_dlg.h"> - <Option target="<{~None~}>" /> + <Unit filename="wx+\graph.cpp"> + <Option target="Release" /> + <Option target="Debug-DLL" /> </Unit> - <Unit filename="ui\msg_popup.cpp"> + <Unit filename="wx+\graph.h"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="ui\msg_popup.h" /> - <Unit filename="ui\progress_indicator.cpp"> + <Unit filename="wx+\image_tools.h"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="ui\progress_indicator.h" /> - <Unit filename="ui\search.cpp"> + <Unit filename="wx+\mouse_move_dlg.cpp"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="ui\search.h" /> - <Unit filename="ui\small_dlgs.cpp"> + <Unit filename="wx+\mouse_move_dlg.h"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="ui\small_dlgs.h"> - <Option target="<{~None~}>" /> + <Unit filename="wx+\pch.h"> + <Option compile="1" /> + <Option weight="0" /> + <Option target="Debug-DLL" /> + <Option target="Unit Test" /> </Unit> - <Unit filename="ui\sorting.h"> - <Option target="<{~None~}>" /> + <Unit filename="wx+\serialize.h"> + <Option target="Release" /> + <Option target="Debug-DLL" /> </Unit> - <Unit filename="ui\switch_to_gui.cpp"> + <Unit filename="wx+\shell_execute.h"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="ui\switch_to_gui.h"> + <Unit filename="wx+\string_conv.h"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="ui\sync_cfg.cpp"> + <Unit filename="wx+\toggle_button.h"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="ui\sync_cfg.h"> + <Unit filename="wx+\tooltip.cpp"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="ui\tray_icon.cpp"> + <Unit filename="wx+\tooltip.h"> <Option target="Release" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="ui\tray_icon.h" /> + <Unit filename="zen\assert_static.h" /> + <Unit filename="zen\base64.h" /> + <Unit filename="zen\build_info.h" /> + <Unit filename="zen\c_dll.h" /> + <Unit filename="zen\com_error.h" /> + <Unit filename="zen\com_ptr.h" /> + <Unit filename="zen\com_util.h" /> + <Unit filename="zen\debug_log.h" /> + <Unit filename="zen\dir_watcher.h" /> + <Unit filename="zen\disable_standby.h" /> + <Unit filename="zen\dll.h" /> + <Unit filename="zen\dst_hack.cpp" /> + <Unit filename="zen\dst_hack.h" /> + <Unit filename="zen\file_error.h" /> + <Unit filename="zen\file_handling.cpp" /> + <Unit filename="zen\file_handling.h" /> + <Unit filename="zen\file_id.cpp" /> + <Unit filename="zen\file_id.h" /> + <Unit filename="zen\file_id_internal.h" /> + <Unit filename="zen\file_io.cpp" /> + <Unit filename="zen\file_io.h" /> + <Unit filename="zen\file_traverser.cpp" /> + <Unit filename="zen\file_traverser.h" /> + <Unit filename="zen\file_update_handle.h" /> + <Unit filename="zen\fixed_list.h" /> + <Unit filename="zen\guid.h" /> + <Unit filename="zen\i18n.h" /> + <Unit filename="zen\int64.h" /> + <Unit filename="zen\last_error.h" /> + <Unit filename="zen\long_path_prefix.h" /> + <Unit filename="zen\notify_removal.h" /> + <Unit filename="zen\perf.h" /> + <Unit filename="zen\privilege.cpp" /> + <Unit filename="zen\privilege.h" /> + <Unit filename="zen\read_txt.h" /> + <Unit filename="zen\stl_tools.h" /> + <Unit filename="zen\string_base.h" /> + <Unit filename="zen\string_tools.h" /> + <Unit filename="zen\string_traits.h" /> + <Unit filename="zen\symlink_target.h" /> + <Unit filename="zen\thread.h" /> + <Unit filename="zen\utf8.h" /> + <Unit filename="zen\warn_static.h" /> + <Unit filename="zen\win.h" /> + <Unit filename="zen\zstring.cpp" /> + <Unit filename="zen\zstring.h" /> <Extensions> <code_completion /> <envvars /> diff --git a/FreeFileSync.vcxproj b/FreeFileSync.vcxproj index 65fd497b..e16d4f24 100644 --- a/FreeFileSync.vcxproj +++ b/FreeFileSync.vcxproj @@ -100,12 +100,12 @@ <WarningLevel>Level4</WarningLevel> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>ZEN_PLATFORM_WINDOWS;wxUSE_UNICODE;__WXMSW__;FFS_WIN;WXINTL_NO_GETTEXT_MACRO;__WXDEBUG__;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>.\shared;C:\Program Files\C++\wxWidgets\include;C:\Program Files\C++\wxWidgets\lib\vc_lib\mswud;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> - <PrecompiledHeaderFile>$(ProjectDir)shared\pch.h</PrecompiledHeaderFile> - <DisableSpecificWarnings>4100;4996</DisableSpecificWarnings> + <AdditionalIncludeDirectories>.;./zenXml;C:\Program Files\C++\wxWidgets\include;C:\Program Files\C++\wxWidgets\lib\vc_lib\mswud;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> + <PrecompiledHeaderFile>wx+\pch.h</PrecompiledHeaderFile> + <DisableSpecificWarnings>4100;4996;4267;4512</DisableSpecificWarnings> <MultiProcessorCompilation>true</MultiProcessorCompilation> <PrecompiledHeaderOutputFile>$(IntDir)pch.obj</PrecompiledHeaderOutputFile> - <ForcedIncludeFiles>$(ProjectDir)shared/pch.h;$(SolutionDir)shared/warn_static.h</ForcedIncludeFiles> + <ForcedIncludeFiles>zen/warn_static.h;wx+\pch.h</ForcedIncludeFiles> <DebugInformationFormat>EditAndContinue</DebugInformationFormat> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> <MinimalRebuild>false</MinimalRebuild> @@ -134,12 +134,12 @@ <WarningLevel>Level4</WarningLevel> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>ZEN_PLATFORM_WINDOWS;wxUSE_UNICODE;__WXMSW__;FFS_WIN;WXINTL_NO_GETTEXT_MACRO;__WXDEBUG__;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>.\shared;C:\Program Files\C++\wxWidgets-x64\include;C:\Program Files\C++\wxWidgets-x64\lib\vc_lib\mswud;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> - <PrecompiledHeaderFile>$(ProjectDir)shared\pch.h</PrecompiledHeaderFile> - <DisableSpecificWarnings>4100;4996</DisableSpecificWarnings> + <AdditionalIncludeDirectories>.;./zenXml;C:\Program Files\C++\wxWidgets-x64\include;C:\Program Files\C++\wxWidgets-x64\lib\vc_lib\mswud;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> + <PrecompiledHeaderFile>wx+\pch.h</PrecompiledHeaderFile> + <DisableSpecificWarnings>4100;4996;4267;4512</DisableSpecificWarnings> <MultiProcessorCompilation>true</MultiProcessorCompilation> <PrecompiledHeaderOutputFile>$(IntDir)pch.obj</PrecompiledHeaderOutputFile> - <ForcedIncludeFiles>$(ProjectDir)shared/pch.h;$(SolutionDir)shared/warn_static.h</ForcedIncludeFiles> + <ForcedIncludeFiles>zen/warn_static.h;wx+\pch.h</ForcedIncludeFiles> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <MinimalRebuild>false</MinimalRebuild> </ClCompile> @@ -168,13 +168,13 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <PreprocessorDefinitions>ZEN_PLATFORM_WINDOWS;wxUSE_UNICODE;__WXMSW__;FFS_WIN;WXINTL_NO_GETTEXT_MACRO;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>.\shared;C:\Program Files\C++\wxWidgets\include;C:\Program Files\C++\wxWidgets\lib\vc_lib\mswu;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>.;./zenXml;C:\Program Files\C++\wxWidgets\include;C:\Program Files\C++\wxWidgets\lib\vc_lib\mswu;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <DisableSpecificWarnings>4100;4996</DisableSpecificWarnings> + <DisableSpecificWarnings>4100;4996;4267;4512</DisableSpecificWarnings> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <MultiProcessorCompilation>true</MultiProcessorCompilation> <InlineFunctionExpansion>Default</InlineFunctionExpansion> - <ForcedIncludeFiles>$(SolutionDir)shared/warn_static.h;</ForcedIncludeFiles> + <ForcedIncludeFiles>zen/warn_static.h</ForcedIncludeFiles> </ClCompile> <Link> <SubSystem>Windows</SubSystem> @@ -202,12 +202,12 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <PreprocessorDefinitions>ZEN_PLATFORM_WINDOWS;wxUSE_UNICODE;__WXMSW__;FFS_WIN;WXINTL_NO_GETTEXT_MACRO;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>.\shared;C:\Program Files\C++\wxWidgets-x64\include;C:\Program Files\C++\wxWidgets-x64\lib\vc_lib\mswu;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>.;./zenXml;C:\Program Files\C++\wxWidgets-x64\include;C:\Program Files\C++\wxWidgets-x64\lib\vc_lib\mswu;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <DisableSpecificWarnings>4512;4996;4100;4127</DisableSpecificWarnings> + <DisableSpecificWarnings>4100;4996;4267;4512</DisableSpecificWarnings> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <MultiProcessorCompilation>true</MultiProcessorCompilation> - <ForcedIncludeFiles>$(SolutionDir)shared/warn_static.h;</ForcedIncludeFiles> + <ForcedIncludeFiles>zen/warn_static.h</ForcedIncludeFiles> </ClCompile> <Link> <SubSystem>Windows</SubSystem> @@ -240,46 +240,25 @@ <ClCompile Include="application.cpp" /> <ClCompile Include="comparison.cpp" /> <ClCompile Include="file_hierarchy.cpp" /> - <ClCompile Include="library\binary.cpp" /> - <ClCompile Include="library\custom_grid.cpp" /> - <ClCompile Include="library\db_file.cpp" /> - <ClCompile Include="library\dir_lock.cpp" /> - <ClCompile Include="library\error_log.cpp" /> - <ClCompile Include="library\hard_filter.cpp" /> - <ClCompile Include="library\icon_buffer.cpp" /> - <ClCompile Include="library\parallel_scan.cpp" /> - <ClCompile Include="library\process_xml.cpp" /> - <ClCompile Include="library\resources.cpp" /> - <ClCompile Include="library\statistics.cpp" /> - <ClCompile Include="library\status_handler.cpp" /> - <ClCompile Include="shared\app_main.cpp" /> - <ClCompile Include="shared\custom_button.cpp" /> - <ClCompile Include="shared\folder_history_box.cpp" /> - <ClCompile Include="shared\custom_tooltip.cpp" /> - <ClCompile Include="shared\dir_name.cpp" /> - <ClCompile Include="shared\dst_hack.cpp" /> - <ClCompile Include="shared\file_handling.cpp" /> - <ClCompile Include="shared\file_id.cpp" /> - <ClCompile Include="shared\file_io.cpp" /> - <ClCompile Include="shared\file_traverser.cpp" /> - <ClCompile Include="shared\guid.cpp" /> - <ClCompile Include="shared\help_provider.cpp" /> - <ClCompile Include="shared\i18n.cpp" /> - <ClCompile Include="shared\localization.cpp" /> - <ClCompile Include="shared\mouse_move_dlg.cpp" /> - <ClCompile Include="shared\privilege.cpp" /> - <ClCompile Include="shared\recycler.cpp" /> - <ClCompile Include="shared\resolve_path.cpp" /> - <ClCompile Include="shared\serialize.cpp" /> - <ClCompile Include="shared\shadow.cpp" /> - <ClCompile Include="shared\standard_paths.cpp" /> - <ClCompile Include="shared\last_error.cpp" /> - <ClCompile Include="shared\taskbar.cpp" /> - <ClCompile Include="shared\toggle_button.cpp" /> - <ClCompile Include="shared\util.cpp" /> - <ClCompile Include="shared\xml_base.cpp" /> - <ClCompile Include="shared\zenXml\unit_test.cpp" /> - <ClCompile Include="shared\zstring.cpp" /> + <ClCompile Include="lib\binary.cpp" /> + <ClCompile Include="lib\custom_grid.cpp" /> + <ClCompile Include="lib\db_file.cpp" /> + <ClCompile Include="lib\dir_lock.cpp" /> + <ClCompile Include="lib\dir_name.cpp" /> + <ClCompile Include="lib\error_log.cpp" /> + <ClCompile Include="lib\folder_history_box.cpp" /> + <ClCompile Include="lib\hard_filter.cpp" /> + <ClCompile Include="lib\icon_buffer.cpp" /> + <ClCompile Include="lib\localization.cpp" /> + <ClCompile Include="lib\parallel_scan.cpp" /> + <ClCompile Include="lib\process_xml.cpp" /> + <ClCompile Include="lib\recycler.cpp" /> + <ClCompile Include="lib\resolve_path.cpp" /> + <ClCompile Include="lib\resources.cpp" /> + <ClCompile Include="lib\shadow.cpp" /> + <ClCompile Include="lib\statistics.cpp" /> + <ClCompile Include="lib\status_handler.cpp" /> + <ClCompile Include="lib\xml_base.cpp" /> <ClCompile Include="structures.cpp" /> <ClCompile Include="synchronization.cpp" /> <ClCompile Include="ui\batch_config.cpp" /> @@ -293,9 +272,22 @@ <ClCompile Include="ui\progress_indicator.cpp" /> <ClCompile Include="ui\search.cpp" /> <ClCompile Include="ui\small_dlgs.cpp" /> - <ClCompile Include="ui\switch_to_gui.cpp" /> <ClCompile Include="ui\sync_cfg.cpp" /> + <ClCompile Include="ui\taskbar.cpp" /> <ClCompile Include="ui\tray_icon.cpp" /> + <ClCompile Include="wx+\button.cpp" /> + <ClCompile Include="wx+\format_unit.cpp" /> + <ClCompile Include="wx+\graph.cpp" /> + <ClCompile Include="wx+\mouse_move_dlg.cpp" /> + <ClCompile Include="wx+\tooltip.cpp" /> + <ClCompile Include="zenXml\zenxml\unit_test.cpp" /> + <ClCompile Include="zen\dst_hack.cpp" /> + <ClCompile Include="zen\file_handling.cpp" /> + <ClCompile Include="zen\file_id.cpp" /> + <ClCompile Include="zen\file_io.cpp" /> + <ClCompile Include="zen\file_traverser.cpp" /> + <ClCompile Include="zen\privilege.cpp" /> + <ClCompile Include="zen\zstring.cpp" /> </ItemGroup> <ItemGroup> <ResourceCompile Include="resource.rc" /> @@ -305,9 +297,6 @@ <SubType>Designer</SubType> </None> </ItemGroup> - <ItemGroup> - <ClInclude Include="shared\pch.h" /> - </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> @@ -4,7 +4,7 @@ BINDIR = $(DESTDIR)$(prefix)/bin SHAREDIR = $(DESTDIR)$(prefix)/share APPSHAREDIR = $(SHAREDIR)/$(APPNAME) -COMMON_COMPILE_FLAGS = -Wall -pipe `pkg-config --cflags gtk+-2.0` -O3 -pthread -std=gnu++0x -DNDEBUG -DwxUSE_UNICODE -DFFS_LINUX -DZEN_PLATFORM_OTHER -DWXINTL_NO_GETTEXT_MACRO -I./shared +COMMON_COMPILE_FLAGS = -Wall -pipe `pkg-config --cflags gtk+-2.0` -O3 -pthread -std=gnu++0x -DNDEBUG -DwxUSE_UNICODE -DFFS_LINUX -DZEN_PLATFORM_OTHER -DWXINTL_NO_GETTEXT_MACRO -I. -I./zenXml COMMON_LINK_FLAGS = -O3 -pthread #default build @@ -37,62 +37,54 @@ FFS_CPPFLAGS += `pkg-config --cflags unity` -DHAVE_UBUNTU_UNITY LINKFLAGS += `pkg-config --libs unity` endif -FILE_LIST= #internal list of all *.cpp files needed for compilation -FILE_LIST+=structures.cpp +FILE_LIST= #internal list of all *.cpp files needed for compilation FILE_LIST+=algorithm.cpp +FILE_LIST+=application.cpp FILE_LIST+=comparison.cpp -FILE_LIST+=synchronization.cpp FILE_LIST+=file_hierarchy.cpp -FILE_LIST+=application.cpp -FILE_LIST+=ui/gui_generated.cpp -FILE_LIST+=shared/util.cpp -FILE_LIST+=ui/grid_view.cpp -FILE_LIST+=ui/main_dlg.cpp +FILE_LIST+=lib/binary.cpp +FILE_LIST+=lib/custom_grid.cpp +FILE_LIST+=lib/db_file.cpp +FILE_LIST+=lib/dir_lock.cpp +FILE_LIST+=lib/dir_name.cpp +FILE_LIST+=lib/error_log.cpp +FILE_LIST+=lib/folder_history_box.cpp +FILE_LIST+=lib/hard_filter.cpp +FILE_LIST+=lib/icon_buffer.cpp +FILE_LIST+=lib/localization.cpp +FILE_LIST+=lib/parallel_scan.cpp +FILE_LIST+=lib/process_xml.cpp +FILE_LIST+=lib/recycler.cpp +FILE_LIST+=lib/resolve_path.cpp +FILE_LIST+=lib/resources.cpp +FILE_LIST+=lib/statistics.cpp +FILE_LIST+=lib/status_handler.cpp +FILE_LIST+=lib/xml_base.cpp +FILE_LIST+=structures.cpp +FILE_LIST+=synchronization.cpp FILE_LIST+=ui/batch_config.cpp -FILE_LIST+=ui/sync_cfg.cpp -FILE_LIST+=ui/check_version.cpp FILE_LIST+=ui/batch_status_handler.cpp +FILE_LIST+=ui/check_version.cpp +FILE_LIST+=ui/grid_view.cpp +FILE_LIST+=ui/gui_generated.cpp FILE_LIST+=ui/gui_status_handler.cpp -FILE_LIST+=ui/tray_icon.cpp -FILE_LIST+=ui/search.cpp -FILE_LIST+=ui/switch_to_gui.cpp +FILE_LIST+=ui/main_dlg.cpp FILE_LIST+=ui/msg_popup.cpp FILE_LIST+=ui/progress_indicator.cpp -FILE_LIST+=library/parallel_scan.cpp -FILE_LIST+=library/custom_grid.cpp -FILE_LIST+=library/error_log.cpp -FILE_LIST+=library/status_handler.cpp -FILE_LIST+=library/resources.cpp +FILE_LIST+=ui/search.cpp FILE_LIST+=ui/small_dlgs.cpp -FILE_LIST+=library/process_xml.cpp -FILE_LIST+=library/icon_buffer.cpp -FILE_LIST+=library/statistics.cpp -FILE_LIST+=library/hard_filter.cpp -FILE_LIST+=library/binary.cpp -FILE_LIST+=library/db_file.cpp -FILE_LIST+=library/dir_lock.cpp -FILE_LIST+=shared/i18n.cpp -FILE_LIST+=shared/localization.cpp -FILE_LIST+=shared/file_io.cpp -FILE_LIST+=shared/taskbar.cpp -FILE_LIST+=shared/dir_name.cpp -FILE_LIST+=shared/guid.cpp -FILE_LIST+=shared/xml_base.cpp -FILE_LIST+=shared/last_error.cpp -FILE_LIST+=shared/custom_tooltip.cpp -FILE_LIST+=shared/file_handling.cpp -FILE_LIST+=shared/resolve_path.cpp -FILE_LIST+=shared/file_traverser.cpp -FILE_LIST+=shared/standard_paths.cpp -FILE_LIST+=shared/zstring.cpp -FILE_LIST+=shared/app_main.cpp -FILE_LIST+=shared/custom_button.cpp -FILE_LIST+=shared/toggle_button.cpp -FILE_LIST+=shared/folder_history_box.cpp -FILE_LIST+=shared/serialize.cpp -FILE_LIST+=shared/file_id.cpp -FILE_LIST+=shared/recycler.cpp -FILE_LIST+=shared/help_provider.cpp +FILE_LIST+=ui/sync_cfg.cpp +FILE_LIST+=ui/taskbar.cpp +FILE_LIST+=ui/tray_icon.cpp +FILE_LIST+=wx+/button.cpp +FILE_LIST+=wx+/format_unit.cpp +FILE_LIST+=wx+/graph.cpp +FILE_LIST+=wx+/tooltip.cpp +FILE_LIST+=zen/file_handling.cpp +FILE_LIST+=zen/file_id.cpp +FILE_LIST+=zen/file_io.cpp +FILE_LIST+=zen/file_traverser.cpp +FILE_LIST+=zen/zstring.cpp #list of all *.o files OBJECT_LIST=$(foreach file, $(FILE_LIST), OBJ/FFS_Release_GCC_Make/$(subst .cpp,.o,$(notdir $(file)))) diff --git a/RealtimeSync/RealtimeSync.cbp b/RealtimeSync/RealtimeSync.cbp index 5a928487..5c14d918 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_47.a" /> + <Add library="libboost_thread-mgw46-mt-s-1_47.a" /> <Add directory="C:\Programme\C++\wxWidgets\lib\gcc_lib" /> </Linker> </Target> @@ -41,7 +41,7 @@ <Compiler> <Add option="-g" /> <Add option="-Winvalid-pch" /> - <Add option='-include "../shared/pch.h"' /> + <Add option='-include "../wx+/pch.h"' /> <Add option="-D__WXDEBUG__" /> <Add directory="C:\Program Files\C++\wxWidgets\lib\gcc_dll\mswud" /> </Compiler> @@ -51,7 +51,7 @@ <Add library="libwxbase28ud.a" /> <Add library="libwxpngd.a" /> <Add library="libwxzlibd.a" /> - <Add library="libboost_thread-mgw45-mt-sd-1_47.a" /> + <Add library="libboost_thread-mgw46-mt-sd-1_47.a" /> <Add directory="C:\Program Files\C++\wxWidgets\lib\gcc_dll" /> </Linker> </Target> @@ -65,7 +65,7 @@ <Add option="-pipe" /> <Add option="-mthreads" /> <Add option="-std=gnu++0x" /> - <Add option='-include "../shared/warn_static.h"' /> + <Add option='-include "../zen/warn_static.h"' /> <Add option="-D__GNUWIN32__" /> <Add option="-D__WXMSW__" /> <Add option="-DwxUSE_UNICODE" /> @@ -76,7 +76,7 @@ <Add option="-DWXINTL_NO_GETTEXT_MACRO" /> <Add directory="C:\Programme\C++\wxWidgets\include" /> <Add directory="C:\Program Files\C++\Boost" /> - <Add directory="..\shared" /> + <Add directory="..\." /> </Compiler> <ResourceCompiler> <Add directory="C:\Programme\C++\wxWidgets\include" /> @@ -103,7 +103,6 @@ <Unit filename="gui_generated.h" /> <Unit filename="main_dlg.cpp" /> <Unit filename="main_dlg.h" /> - <Unit filename="notify.h" /> <Unit filename="resource.rc"> <Option compilerVar="WINDRES" /> </Unit> @@ -117,51 +116,29 @@ <Unit filename="xml_ffs.h" /> <Unit filename="xml_proc.cpp" /> <Unit filename="xml_proc.h" /> - <Unit filename="..\Shared\custom_button.cpp" /> - <Unit filename="..\Shared\custom_button.h" /> - <Unit filename="..\Shared\dir_name.cpp" /> - <Unit filename="..\Shared\dir_name.h" /> - <Unit filename="..\Shared\zstring.cpp" /> - <Unit filename="..\Shared\zstring.h" /> - <Unit filename="..\library\process_xml.cpp" /> - <Unit filename="..\shared\dir_watcher.cpp" /> - <Unit filename="..\shared\dir_watcher.h" /> - <Unit filename="..\shared\dll_loader.h" /> - <Unit filename="..\shared\dst_hack.cpp" /> - <Unit filename="..\shared\dst_hack.h" /> - <Unit filename="..\shared\file_error.h" /> - <Unit filename="..\shared\file_handling.cpp" /> - <Unit filename="..\shared\file_handling.h" /> - <Unit filename="..\shared\file_id.cpp" /> - <Unit filename="..\shared\file_io.cpp" /> - <Unit filename="..\shared\file_traverser.cpp" /> - <Unit filename="..\shared\folder_history_box.cpp" /> - <Unit filename="..\shared\global_func.h" /> - <Unit filename="..\shared\help_provider.cpp" /> - <Unit filename="..\shared\i18n.cpp" /> - <Unit filename="..\shared\i18n.h" /> - <Unit filename="..\shared\last_error.cpp" /> - <Unit filename="..\shared\last_error.h" /> - <Unit filename="..\shared\localization.cpp" /> - <Unit filename="..\shared\long_path_prefix.h" /> - <Unit filename="..\shared\mouse_move_dlg.cpp" /> - <Unit filename="..\shared\notify_removal.cpp" /> - <Unit filename="..\shared\notify_removal.h" /> - <Unit filename="..\shared\pch.h"> + <Unit filename="..\lib\dir_name.cpp" /> + <Unit filename="..\lib\folder_history_box.cpp" /> + <Unit filename="..\lib\localization.cpp" /> + <Unit filename="..\lib\process_xml.cpp" /> + <Unit filename="..\lib\resolve_path.cpp" /> + <Unit filename="..\lib\xml_base.cpp" /> + <Unit filename="..\structures.cpp" /> + <Unit filename="..\wx+\button.cpp" /> + <Unit filename="..\wx+\format_unit.cpp" /> + <Unit filename="..\wx+\mouse_move_dlg.cpp" /> + <Unit filename="..\wx+\pch.h"> <Option compile="1" /> <Option weight="0" /> <Option target="Debug-DLL" /> </Unit> - <Unit filename="..\shared\privilege.cpp" /> - <Unit filename="..\shared\resolve_path.cpp" /> - <Unit filename="..\shared\resolve_path.h" /> - <Unit filename="..\shared\shell_execute.h" /> - <Unit filename="..\shared\standard_paths.cpp" /> - <Unit filename="..\shared\standard_paths.h" /> - <Unit filename="..\shared\util.cpp" /> - <Unit filename="..\shared\xml_base.cpp" /> - <Unit filename="..\shared\xml_base.h" /> - <Unit filename="..\structures.cpp" /> + <Unit filename="..\zen\dir_watcher.cpp" /> + <Unit filename="..\zen\dst_hack.cpp" /> + <Unit filename="..\zen\file_handling.cpp" /> + <Unit filename="..\zen\file_io.cpp" /> + <Unit filename="..\zen\file_traverser.cpp" /> + <Unit filename="..\zen\notify_removal.cpp" /> + <Unit filename="..\zen\privilege.cpp" /> + <Unit filename="..\zen\zstring.cpp" /> <Extensions> <code_completion /> <envvars /> diff --git a/RealtimeSync/RealtimeSync.vcxproj b/RealtimeSync/RealtimeSync.vcxproj index f6f018a1..81b51005 100644 --- a/RealtimeSync/RealtimeSync.vcxproj +++ b/RealtimeSync/RealtimeSync.vcxproj @@ -100,13 +100,13 @@ <WarningLevel>Level4</WarningLevel> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>ZEN_PLATFORM_WINDOWS;wxUSE_UNICODE;__WXMSW__;FFS_WIN;WXINTL_NO_GETTEXT_MACRO;__WXDEBUG__</PreprocessorDefinitions> - <AdditionalIncludeDirectories>..\shared;C:\Program Files\C++\wxWidgets\include;C:\Program Files\C++\wxWidgets\lib\vc_lib\mswud;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> - <PrecompiledHeaderFile>$(ProjectDir)/../shared/pch.h</PrecompiledHeaderFile> - <DisableSpecificWarnings>4100;4996</DisableSpecificWarnings> + <AdditionalIncludeDirectories>..;../zenXml;C:\Program Files\C++\wxWidgets\include;C:\Program Files\C++\wxWidgets\lib\vc_lib\mswud;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> + <PrecompiledHeaderFile>wx+/pch.h</PrecompiledHeaderFile> + <DisableSpecificWarnings>4100;4996;4267;4512</DisableSpecificWarnings> <MultiProcessorCompilation>false</MultiProcessorCompilation> <DisableLanguageExtensions>false</DisableLanguageExtensions> <PrecompiledHeaderOutputFile>$(IntDir)pch.obj</PrecompiledHeaderOutputFile> - <ForcedIncludeFiles>$(SolutionDir)shared/warn_static.h;$(ProjectDir)/../shared/pch.h</ForcedIncludeFiles> + <ForcedIncludeFiles>zen/warn_static.h;wx+/pch.h</ForcedIncludeFiles> <DebugInformationFormat>EditAndContinue</DebugInformationFormat> </ClCompile> <Link> @@ -130,13 +130,13 @@ <WarningLevel>Level4</WarningLevel> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>ZEN_PLATFORM_WINDOWS;wxUSE_UNICODE;__WXMSW__;FFS_WIN;WXINTL_NO_GETTEXT_MACRO;__WXDEBUG__</PreprocessorDefinitions> - <AdditionalIncludeDirectories>..\shared;C:\Program Files\C++\wxWidgets-x64\include;C:\Program Files\C++\wxWidgets-x64\lib\vc_lib\mswud;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> - <PrecompiledHeaderFile>$(ProjectDir)/../shared/pch.h</PrecompiledHeaderFile> - <DisableSpecificWarnings>4100;4996</DisableSpecificWarnings> + <AdditionalIncludeDirectories>..;../zenXml;C:\Program Files\C++\wxWidgets-x64\include;C:\Program Files\C++\wxWidgets-x64\lib\vc_lib\mswud;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> + <PrecompiledHeaderFile>wx+/pch.h</PrecompiledHeaderFile> + <DisableSpecificWarnings>4100;4996;4267;4512</DisableSpecificWarnings> <MultiProcessorCompilation>false</MultiProcessorCompilation> <DisableLanguageExtensions>false</DisableLanguageExtensions> <PrecompiledHeaderOutputFile>$(IntDir)pch.obj</PrecompiledHeaderOutputFile> - <ForcedIncludeFiles>$(SolutionDir)shared/warn_static.h;$(ProjectDir)/../shared/pch.h</ForcedIncludeFiles> + <ForcedIncludeFiles>zen/warn_static.h;wx+/pch.h</ForcedIncludeFiles> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <SuppressStartupBanner>true</SuppressStartupBanner> </ClCompile> @@ -163,13 +163,13 @@ <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> <PreprocessorDefinitions>ZEN_PLATFORM_WINDOWS;wxUSE_UNICODE;__WXMSW__;FFS_WIN;WXINTL_NO_GETTEXT_MACRO;NDEBUG</PreprocessorDefinitions> - <AdditionalIncludeDirectories>..\shared;C:\Program Files\C++\wxWidgets\include;C:\Program Files\C++\wxWidgets\lib\vc_lib\mswu;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..;../zenXml;C:\Program Files\C++\wxWidgets\include;C:\Program Files\C++\wxWidgets\lib\vc_lib\mswu;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <DisableSpecificWarnings>4100;4996</DisableSpecificWarnings> + <DisableSpecificWarnings>4100;4996;4267;4512</DisableSpecificWarnings> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <MultiProcessorCompilation>true</MultiProcessorCompilation> <DisableLanguageExtensions>false</DisableLanguageExtensions> - <ForcedIncludeFiles>$(SolutionDir)shared/warn_static.h;</ForcedIncludeFiles> + <ForcedIncludeFiles>zen/warn_static.h</ForcedIncludeFiles> </ClCompile> <Link> <SubSystem>Windows</SubSystem> @@ -198,14 +198,14 @@ <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> <PreprocessorDefinitions>ZEN_PLATFORM_WINDOWS;wxUSE_UNICODE;__WXMSW__;FFS_WIN;WXINTL_NO_GETTEXT_MACRO;NDEBUG</PreprocessorDefinitions> - <AdditionalIncludeDirectories>..\shared;C:\Program Files\C++\wxWidgets-x64\include;C:\Program Files\C++\wxWidgets-x64\lib\vc_lib\mswu;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..;../zenXml;C:\Program Files\C++\wxWidgets-x64\include;C:\Program Files\C++\wxWidgets-x64\lib\vc_lib\mswu;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <DisableSpecificWarnings>4512;4996;4100;4127</DisableSpecificWarnings> + <DisableSpecificWarnings>4100;4996;4267;4512</DisableSpecificWarnings> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <MultiProcessorCompilation>true</MultiProcessorCompilation> <DisableLanguageExtensions>false</DisableLanguageExtensions> <SuppressStartupBanner>true</SuppressStartupBanner> - <ForcedIncludeFiles>$(SolutionDir)shared/warn_static.h;</ForcedIncludeFiles> + <ForcedIncludeFiles>zen/warn_static.h</ForcedIncludeFiles> </ClCompile> <Link> <SubSystem>Windows</SubSystem> @@ -227,32 +227,28 @@ </ResourceCompile> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="..\library\process_xml.cpp" /> - <ClCompile Include="..\shared\custom_button.cpp" /> - <ClCompile Include="..\shared\dir_watcher.cpp" /> - <ClCompile Include="..\shared\dir_name.cpp" /> - <ClCompile Include="..\shared\dst_hack.cpp" /> - <ClCompile Include="..\shared\file_handling.cpp" /> - <ClCompile Include="..\shared\file_io.cpp" /> - <ClCompile Include="..\shared\file_traverser.cpp" /> - <ClCompile Include="..\shared\folder_history_box.cpp" /> - <ClCompile Include="..\shared\help_provider.cpp" /> - <ClCompile Include="..\shared\i18n.cpp" /> - <ClCompile Include="..\shared\localization.cpp" /> - <ClCompile Include="..\shared\mouse_move_dlg.cpp" /> - <ClCompile Include="..\shared\notify_removal.cpp" /> - <ClCompile Include="..\shared\privilege.cpp" /> - <ClCompile Include="..\shared\resolve_path.cpp" /> - <ClCompile Include="..\shared\standard_paths.cpp" /> - <ClCompile Include="..\shared\last_error.cpp" /> - <ClCompile Include="..\shared\util.cpp" /> - <ClCompile Include="..\shared\xml_base.cpp" /> - <ClCompile Include="..\shared\zstring.cpp" /> + <ClCompile Include="..\lib\dir_name.cpp" /> + <ClCompile Include="..\lib\folder_history_box.cpp" /> + <ClCompile Include="..\lib\localization.cpp" /> + <ClCompile Include="..\lib\process_xml.cpp" /> + <ClCompile Include="..\lib\resolve_path.cpp" /> + <ClCompile Include="..\lib\xml_base.cpp" /> <ClCompile Include="..\structures.cpp" /> + <ClCompile Include="..\wx+\button.cpp" /> + <ClCompile Include="..\wx+\format_unit.cpp" /> + <ClCompile Include="..\wx+\mouse_move_dlg.cpp" /> + <ClCompile Include="..\zen\dir_watcher.cpp" /> + <ClCompile Include="..\zen\dst_hack.cpp" /> + <ClCompile Include="..\zen\file_handling.cpp" /> + <ClCompile Include="..\zen\file_io.cpp" /> + <ClCompile Include="..\zen\file_traverser.cpp" /> + <ClCompile Include="..\zen\notify_removal.cpp" /> + <ClCompile Include="..\zen\privilege.cpp" /> + <ClCompile Include="..\zen\zstring.cpp" /> <ClCompile Include="application.cpp"> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> - <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)/../shared/pch.h</PrecompiledHeaderFile> + <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">wx+/pch.h</PrecompiledHeaderFile> </ClCompile> <ClCompile Include="gui_generated.cpp" /> <ClCompile Include="main_dlg.cpp" /> @@ -268,9 +264,6 @@ <ItemGroup> <None Include="WxWizDialog.fbp" /> </ItemGroup> - <ItemGroup> - <ClInclude Include="../shared/pch.h" /> - </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> diff --git a/RealtimeSync/application.cpp b/RealtimeSync/application.cpp index aa1a1385..55c2e9c3 100644 --- a/RealtimeSync/application.cpp +++ b/RealtimeSync/application.cpp @@ -9,17 +9,21 @@ #include <wx/event.h> #include "resources.h" #include <wx/msgdlg.h> -#include "../shared/localization.h" +#include "../lib/localization.h" #include "xml_ffs.h" -#include "../shared/standard_paths.h" +#include "../lib/ffs_paths.h" #include <wx/file.h> -#include "../shared/string_conv.h" +#include <wx+/string_conv.h> #include <wx/log.h> +#include <zen/file_handling.h> #ifdef FFS_LINUX #include <gtk/gtk.h> #endif +using namespace zen; + + IMPLEMENT_APP(Application); bool Application::OnInit() @@ -49,28 +53,32 @@ void Application::OnStartApplication(wxIdleEvent& event) zen::setLanguage(rts::getProgramLanguage()); //try to set config/batch-filename set by %1 parameter - wxString cfgFilename; - if (argc > 1) + std::vector<wxString> commandArgs; + for (int i = 1; i < argc; ++i) { - const wxString filename(argv[1]); - - if (wxFileExists(filename)) //load file specified by %1 parameter: - cfgFilename = filename; - else if (wxFileExists(filename + wxT(".ffs_real"))) - cfgFilename = filename + wxT(".ffs_real"); - else if (wxFileExists(filename + wxT(".ffs_batch"))) - cfgFilename = filename + wxT(".ffs_batch"); - else + Zstring filename = toZ(argv[i]); + + if (!fileExists(filename)) //be a little tolerant { - wxMessageBox(wxString(_("File does not exist:")) + wxT(" \"") + filename + wxT("\""), _("Error"), wxOK | wxICON_ERROR); - return; + if (fileExists(filename + Zstr(".ffs_real"))) + filename = filename + Zstr(".ffs_real"); + else if (fileExists(filename + Zstr(".ffs_batch"))) + filename = filename + Zstr(".ffs_batch"); + else + { + wxMessageBox(wxString(_("File does not exist:")) + wxT(" \"") + toWx(filename) + wxT("\""), _("Error"), wxOK | wxICON_ERROR); + return; + } } + commandArgs.push_back(toWx(filename)); } - GlobalResources::getInstance().load(); //loads bitmap resources on program startup + wxString cfgFilename; + if (!commandArgs.empty()) + cfgFilename = commandArgs[0]; MainDialog* frame = new MainDialog(NULL, cfgFilename); - frame->SetIcon(*GlobalResources::getInstance().programIcon); //set application icon + frame->SetIcon(GlobalResources::instance().programIcon); //set application icon frame->Show(); } diff --git a/RealtimeSync/gui_generated.cpp b/RealtimeSync/gui_generated.cpp index 2ec50c11..a8514907 100644 --- a/RealtimeSync/gui_generated.cpp +++ b/RealtimeSync/gui_generated.cpp @@ -1,12 +1,13 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Mar 22 2011) +// C++ code generated with wxFormBuilder (version Jun 30 2011) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#include "../shared/custom_button.h" -#include "../shared/dir_picker_i18n.h" +#include "../ui/wx_form_build_hide_warnings.h" +#include "../wx+/button.h" +#include "../wx+/dir_picker.h" #include "gui_generated.h" @@ -14,7 +15,7 @@ MainDlgGenerated::MainDlgGenerated( 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( 420, 440 ), wxDefaultSize ); + this->SetSizeHints( wxSize( 420,440 ), wxDefaultSize ); m_menubar1 = new wxMenuBar( 0 ); m_menuFile = new wxMenu(); @@ -66,7 +67,7 @@ MainDlgGenerated::MainDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr m_staticText2->Wrap( -1 ); m_staticText2->SetFont( wxFont( 10, 74, 90, 90, true, wxEmptyString ) ); - sbSizer41->Add( m_staticText2, 0, wxBOTTOM | wxRIGHT | wxLEFT, 5 ); + sbSizer41->Add( m_staticText2, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_staticText3 = new wxStaticText( m_panelMain, wxID_ANY, _("1. Select directories to monitor."), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText3->Wrap( -1 ); @@ -81,16 +82,16 @@ MainDlgGenerated::MainDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr sbSizer41->Add( m_staticText5, 0, wxLEFT, 10 ); m_staticline3 = new wxStaticLine( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - sbSizer41->Add( m_staticline3, 0, wxEXPAND | wxTOP | wxBOTTOM, 5 ); + sbSizer41->Add( m_staticline3, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); m_staticText21 = new wxStaticText( m_panelMain, wxID_ANY, _("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"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText21->Wrap( -1 ); - sbSizer41->Add( m_staticText21, 0, wxRIGHT | wxLEFT | wxEXPAND, 5 ); + sbSizer41->Add( m_staticText21, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 ); - bSizer1->Add( sbSizer41, 0, wxALIGN_CENTER_HORIZONTAL | wxRIGHT | wxLEFT | wxEXPAND, 40 ); + bSizer1->Add( sbSizer41, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT|wxEXPAND, 40 ); m_staticline2 = new wxStaticLine( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizer1->Add( m_staticline2, 0, wxTOP | wxBOTTOM | wxEXPAND, 10 ); + bSizer1->Add( m_staticline2, 0, wxTOP|wxBOTTOM|wxEXPAND, 10 ); wxBoxSizer* bSizer8; bSizer8 = new wxBoxSizer( wxVERTICAL ); @@ -104,22 +105,22 @@ MainDlgGenerated::MainDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr wxBoxSizer* bSizer781; bSizer781 = new wxBoxSizer( wxHORIZONTAL ); - m_bpButtonAddFolder = new wxBitmapButton( m_panelMainFolder, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19, 21 ), wxBU_AUTODRAW ); + m_bpButtonAddFolder = new wxBitmapButton( m_panelMainFolder, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); m_bpButtonAddFolder->SetToolTip( _("Add folder") ); - bSizer781->Add( m_bpButtonAddFolder, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5 ); + bSizer781->Add( m_bpButtonAddFolder, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - m_bpButtonRemoveTopFolder = new wxBitmapButton( m_panelMainFolder, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19, 21 ), wxBU_AUTODRAW ); + m_bpButtonRemoveTopFolder = new wxBitmapButton( m_panelMainFolder, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); m_bpButtonRemoveTopFolder->SetToolTip( _("Remove folder") ); - bSizer781->Add( m_bpButtonRemoveTopFolder, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5 ); + bSizer781->Add( m_bpButtonRemoveTopFolder, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); bSizer114->Add( bSizer781, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_txtCtrlDirectoryMain = new wxTextCtrl( m_panelMainFolder, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); bSizer114->Add( m_txtCtrlDirectoryMain, 1, wxALIGN_CENTER_VERTICAL, 5 ); - m_dirPickerMain = new FfsDirPickerCtrl( m_panelMainFolder, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); + m_dirPickerMain = new zen::DirPickerCtrl( m_panelMainFolder, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); m_dirPickerMain->SetToolTip( _("Select a folder") ); bSizer114->Add( m_dirPickerMain, 0, wxALIGN_CENTER_VERTICAL, 5 ); @@ -129,7 +130,7 @@ MainDlgGenerated::MainDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr bSizer114->Fit( m_panelMainFolder ); sbSizerDirToWatch->Add( m_panelMainFolder, 0, wxEXPAND, 5 ); - m_scrolledWinFolders = new wxScrolledWindow( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL | wxVSCROLL ); + m_scrolledWinFolders = new wxScrolledWindow( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); m_scrolledWinFolders->SetScrollRate( 5, 5 ); bSizerFolders = new wxBoxSizer( wxVERTICAL ); @@ -138,17 +139,17 @@ MainDlgGenerated::MainDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr bSizerFolders->Fit( m_scrolledWinFolders ); sbSizerDirToWatch->Add( m_scrolledWinFolders, 0, wxEXPAND, 5 ); - bSizer8->Add( sbSizerDirToWatch, 0, wxEXPAND | wxBOTTOM | wxRIGHT | wxLEFT, 5 ); + bSizer8->Add( sbSizerDirToWatch, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - bSizer1->Add( bSizer8, 1, wxEXPAND, 5 ); + bSizer1->Add( bSizer8, 0, wxEXPAND, 5 ); wxStaticBoxSizer* sbSizer3; sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( m_panelMain, wxID_ANY, _("Command line") ), wxVERTICAL ); m_textCtrlCommand = new wxTextCtrl( m_panelMain, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - sbSizer3->Add( m_textCtrlCommand, 0, wxEXPAND | wxBOTTOM, 5 ); + sbSizer3->Add( m_textCtrlCommand, 0, wxEXPAND|wxBOTTOM, 5 ); - bSizer1->Add( sbSizer3, 0, wxEXPAND | wxTOP | wxRIGHT | wxLEFT, 5 ); + bSizer1->Add( sbSizer3, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); wxStaticBoxSizer* sbSizer4; sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( m_panelMain, wxID_ANY, _("Minimum Idle Time [seconds]") ), wxVERTICAL ); @@ -156,20 +157,20 @@ MainDlgGenerated::MainDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr m_spinCtrlDelay = new wxSpinCtrl( m_panelMain, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 2000000000, 0 ); m_spinCtrlDelay->SetToolTip( _("Idle time between detection of last change and execution of command line in seconds") ); - sbSizer4->Add( m_spinCtrlDelay, 0, wxBOTTOM | wxRIGHT | wxLEFT | wxALIGN_CENTER_HORIZONTAL, 5 ); + sbSizer4->Add( m_spinCtrlDelay, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_HORIZONTAL, 5 ); - bSizer1->Add( sbSizer4, 0, wxEXPAND | wxRIGHT | wxLEFT, 5 ); + bSizer1->Add( sbSizer4, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); m_staticline1 = new wxStaticLine( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizer1->Add( m_staticline1, 0, wxEXPAND | wxTOP | wxBOTTOM, 10 ); + bSizer1->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxBOTTOM, 10 ); - m_buttonStart = new wxButtonWithImage( m_panelMain, wxID_ANY, _("Start"), wxDefaultPosition, wxSize( -1, 40 ), 0 ); + m_buttonStart = new zen::BitmapButton( m_panelMain, wxID_ANY, _("Start"), wxDefaultPosition, wxSize( -1,40 ), 0 ); m_buttonStart->SetDefault(); m_buttonStart->SetFont( wxFont( 14, 74, 90, 92, false, wxT("Arial Black") ) ); - bSizer1->Add( m_buttonStart, 0, wxALL | wxALIGN_CENTER_HORIZONTAL, 5 ); + bSizer1->Add( m_buttonStart, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - m_buttonCancel = new wxButton( m_panelMain, wxID_CANCEL, _("dummy"), wxDefaultPosition, wxSize( 0, 0 ), 0 ); + m_buttonCancel = new wxButton( m_panelMain, wxID_CANCEL, _("dummy"), wxDefaultPosition, wxSize( 0,0 ), 0 ); bSizer1->Add( m_buttonCancel, 0, 0, 5 ); m_panelMain->SetSizer( bSizer1 ); @@ -215,7 +216,7 @@ FolderGenerated::FolderGenerated( wxWindow* parent, wxWindowID id, const wxPoint wxBoxSizer* bSizer114; bSizer114 = new wxBoxSizer( wxHORIZONTAL ); - m_bpButtonRemoveFolder = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19, 21 ), wxBU_AUTODRAW ); + m_bpButtonRemoveFolder = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); m_bpButtonRemoveFolder->SetToolTip( _("Remove folder") ); bSizer114->Add( m_bpButtonRemoveFolder, 0, wxALIGN_CENTER_VERTICAL, 5 ); @@ -226,7 +227,7 @@ FolderGenerated::FolderGenerated( wxWindow* parent, wxWindowID id, const wxPoint m_txtCtrlDirectory = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); bSizer20->Add( m_txtCtrlDirectory, 1, wxALIGN_CENTER_VERTICAL, 5 ); - m_dirPicker = new FfsDirPickerCtrl( this, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); + m_dirPicker = new zen::DirPickerCtrl( this, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); m_dirPicker->SetToolTip( _("Select a folder") ); bSizer20->Add( m_dirPicker, 0, wxALIGN_CENTER_VERTICAL, 5 ); diff --git a/RealtimeSync/gui_generated.h b/RealtimeSync/gui_generated.h index fa31652f..cedd812f 100644 --- a/RealtimeSync/gui_generated.h +++ b/RealtimeSync/gui_generated.h @@ -1,17 +1,19 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Mar 22 2011) +// C++ code generated with wxFormBuilder (version Jun 30 2011) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#ifndef __gui_generated__ -#define __gui_generated__ +#ifndef __GUI_GENERATED_H__ +#define __GUI_GENERATED_H__ +#include <wx/artprov.h> +#include <wx/xrc/xmlres.h> #include <wx/intl.h> - -class FfsDirPickerCtrl; -class wxButtonWithImage; +class wxStaticText; +namespace zen { class BitmapButton; } +namespace zen { class DirPickerCtrl; } #include <wx/string.h> #include <wx/bitmap.h> @@ -35,7 +37,7 @@ class wxButtonWithImage; #include <wx/spinctrl.h> #include <wx/frame.h> -#include "../shared/i18n.h" +#include "../zen/i18n.h" /////////////////////////////////////////////////////////////////////////// @@ -53,7 +55,6 @@ protected: wxMenuItem* m_menuItemAbout; wxBoxSizer* bSizerMain; wxPanel* m_panelMain; - wxStaticText* m_staticText2; wxStaticText* m_staticText3; wxStaticText* m_staticText4; @@ -71,7 +72,7 @@ protected: wxTextCtrl* m_textCtrlCommand; wxSpinCtrl* m_spinCtrlDelay; wxStaticLine* m_staticline1; - wxButtonWithImage* m_buttonStart; + zen::BitmapButton* m_buttonStart; wxButton* m_buttonCancel; // Virtual event handlers, overide them in your derived class @@ -87,9 +88,9 @@ protected: public: - FfsDirPickerCtrl* m_dirPickerMain; + zen::DirPickerCtrl* m_dirPickerMain; - MainDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("RealtimeSync - Automated Synchronization"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1, -1 ), long style = wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL ); + MainDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("RealtimeSync - Automated Synchronization"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); ~MainDlgGenerated(); @@ -107,11 +108,11 @@ protected: public: wxBitmapButton* m_bpButtonRemoveFolder; wxTextCtrl* m_txtCtrlDirectory; - FfsDirPickerCtrl* m_dirPicker; + zen::DirPickerCtrl* m_dirPicker; - FolderGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1, -1 ), long style = wxTAB_TRAVERSAL ); + FolderGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); ~FolderGenerated(); }; -#endif //__gui_generated__ +#endif //__GUI_GENERATED_H__ diff --git a/RealtimeSync/main_dlg.cpp b/RealtimeSync/main_dlg.cpp index 539a8bbe..15623286 100644 --- a/RealtimeSync/main_dlg.cpp +++ b/RealtimeSync/main_dlg.cpp @@ -6,22 +6,22 @@ #include "main_dlg.h" #include "resources.h" -#include "../shared/custom_button.h" -#include "../shared/standard_paths.h" +#include <wx+/button.h> +#include "../lib/ffs_paths.h" #include <wx/msgdlg.h> #include <wx/wupdlock.h> #include "watcher.h" #include <wx/utils.h> #include "xml_proc.h" #include "tray_menu.h" -#include "../shared/file_handling.h" +#include <zen/file_handling.h> #include "xml_ffs.h" -#include "../shared/string_conv.h" -#include "../shared/assert_static.h" -#include "../shared/build_info.h" -#include "../shared/help_provider.h" -#include "../shared/util.h" -#include "../shared/mouse_move_dlg.h" +#include <wx+/string_conv.h> +#include <zen/assert_static.h> +#include <zen/build_info.h> +#include "../lib/help_provider.h" +#include "../lib/process_xml.h" +#include <wx+/mouse_move_dlg.h> using namespace zen; @@ -34,9 +34,9 @@ MainDialog::MainDialog(wxDialog* dlg, const wxString& cfgFileName) m_bpButtonRemoveTopFolder->Hide(); m_panelMainFolder->Layout(); - m_bpButtonAddFolder->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("addFolderPair"))); - m_bpButtonRemoveTopFolder->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("removeFolderPair"))); - m_buttonStart->setBitmapFront(GlobalResources::getInstance().getImageByName(wxT("startRed"))); + m_bpButtonAddFolder->SetBitmapLabel(GlobalResources::getImage(wxT("addFolderPair"))); + m_bpButtonRemoveTopFolder->SetBitmapLabel(GlobalResources::getImage(wxT("removeFolderPair"))); + m_buttonStart->setBitmapFront(GlobalResources::getImage(wxT("startRed"))); //register key event Connect(wxEVT_CHAR_HOOK, wxKeyEventHandler(MainDialog::OnKeyPressed), NULL, this); @@ -145,11 +145,11 @@ void MainDialog::OnMenuAbout(wxCommandEvent& event) #endif //wxUSE_UNICODE //compile time info about 32/64-bit build - if (util::is64BitBuild) + if (zen::is64BitBuild) build += wxT(" x64"); else build += wxT(" x86"); - assert_static(util::is32BitBuild || util::is64BitBuild); + assert_static(zen::is32BitBuild || zen::is64BitBuild); wxString buildFormatted = _("(Build: %x)"); buildFormatted.Replace(wxT("%x"), build); @@ -176,7 +176,7 @@ void MainDialog::OnStart(wxCommandEvent& event) Hide(); - switch (rts::startDirectoryMonitor(currentCfg, zen::extractJobName(currentConfigFileName))) + switch (rts::startDirectoryMonitor(currentCfg, xmlAccess::extractJobName(currentConfigFileName))) { case rts::QUIT: { @@ -378,7 +378,7 @@ void MainDialog::addFolder(const std::vector<wxString>& newFolders, bool addFron { //add new folder pair DirectoryPanel* newFolder = new DirectoryPanel(m_scrolledWinFolders); - newFolder->m_bpButtonRemoveFolder->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("removeFolderPair"))); + newFolder->m_bpButtonRemoveFolder->SetBitmapLabel(GlobalResources::getImage(wxT("removeFolderPair"))); //get size of scrolled window folderHeight = newFolder->GetSize().GetHeight(); diff --git a/RealtimeSync/main_dlg.h b/RealtimeSync/main_dlg.h index ca054b65..5c77fa8f 100644 --- a/RealtimeSync/main_dlg.h +++ b/RealtimeSync/main_dlg.h @@ -10,8 +10,8 @@ #include "gui_generated.h" #include <vector> #include <memory> -#include "../shared/dir_name.h" -#include "../shared/dir_picker_i18n.h" +#include "../lib/dir_name.h" +#include <wx+/dir_picker.h> namespace xmlAccess { diff --git a/RealtimeSync/makefile b/RealtimeSync/makefile index c0ac3aa5..4cef8c62 100644 --- a/RealtimeSync/makefile +++ b/RealtimeSync/makefile @@ -2,7 +2,7 @@ APPNAME = RealtimeSync prefix = /usr BINDIR = $(DESTDIR)$(prefix)/bin -COMMON_COMPILE_FLAGS = -Wall -pipe `pkg-config --cflags gtk+-2.0` -O3 -pthread -std=gnu++0x -DNDEBUG -DwxUSE_UNICODE -DFFS_LINUX -DZEN_PLATFORM_OTHER -DWXINTL_NO_GETTEXT_MACRO -I../shared +COMMON_COMPILE_FLAGS = -Wall -pipe `pkg-config --cflags gtk+-2.0` -O3 -pthread -std=gnu++0x -DNDEBUG -DwxUSE_UNICODE -DFFS_LINUX -DZEN_PLATFORM_OTHER -DWXINTL_NO_GETTEXT_MACRO -I.. -I../zenXml COMMON_LINK_FLAGS = -O3 -pthread #default build @@ -15,33 +15,29 @@ FFS_CPPFLAGS = $(COMMON_COMPILE_FLAGS) `wx-config --cxxflags --debug=no --unicod LINKFLAGS = $(COMMON_LINK_FLAGS) `wx-config --libs --debug=no --unicode=yes --static=yes` /usr/local/lib/libboost_thread.a endif -FILE_LIST= #internal list of all *.cpp files needed for compilation +FILE_LIST= #internal list of all *.cpp files needed for compilation FILE_LIST+=application.cpp FILE_LIST+=gui_generated.cpp FILE_LIST+=main_dlg.cpp FILE_LIST+=resources.cpp FILE_LIST+=tray_menu.cpp FILE_LIST+=watcher.cpp -FILE_LIST+=xml_proc.cpp FILE_LIST+=xml_ffs.cpp -FILE_LIST+=../library/process_xml.cpp +FILE_LIST+=xml_proc.cpp +FILE_LIST+=../lib/dir_name.cpp +FILE_LIST+=../lib/folder_history_box.cpp +FILE_LIST+=../lib/localization.cpp +FILE_LIST+=../lib/process_xml.cpp +FILE_LIST+=../lib/resolve_path.cpp +FILE_LIST+=../lib/xml_base.cpp FILE_LIST+=../structures.cpp -FILE_LIST+=../shared/folder_history_box.cpp -FILE_LIST+=../shared/util.cpp -FILE_LIST+=../shared/i18n.cpp -FILE_LIST+=../shared/localization.cpp -FILE_LIST+=../shared/dir_watcher.cpp -FILE_LIST+=../shared/last_error.cpp -FILE_LIST+=../shared/dir_name.cpp -FILE_LIST+=../shared/zstring.cpp -FILE_LIST+=../shared/xml_base.cpp -FILE_LIST+=../shared/custom_button.cpp -FILE_LIST+=../shared/file_handling.cpp -FILE_LIST+=../shared/resolve_path.cpp -FILE_LIST+=../shared/file_traverser.cpp -FILE_LIST+=../shared/standard_paths.cpp -FILE_LIST+=../shared/help_provider.cpp -FILE_LIST+=../shared/file_io.cpp +FILE_LIST+=../wx+/button.cpp +FILE_LIST+=../wx+/format_unit.cpp +FILE_LIST+=../zen/dir_watcher.cpp +FILE_LIST+=../zen/file_handling.cpp +FILE_LIST+=../zen/file_io.cpp +FILE_LIST+=../zen/file_traverser.cpp +FILE_LIST+=../zen/zstring.cpp #list of all *.o files OBJECT_LIST=$(foreach file, $(FILE_LIST), ../OBJ/RTS_Release_GCC_Make/$(subst .cpp,.o,$(notdir $(file)))) diff --git a/RealtimeSync/resources.cpp b/RealtimeSync/resources.cpp index 2a7e2818..2936b7dc 100644 --- a/RealtimeSync/resources.cpp +++ b/RealtimeSync/resources.cpp @@ -5,42 +5,24 @@ // ************************************************************************** #include "resources.h" +#include <memory> #include <wx/wfstream.h> #include <wx/zipstrm.h> #include <wx/image.h> -#include <wx/icon.h> -#include <memory> -#include "../shared/standard_paths.h" +#include "../lib/ffs_paths.h" using namespace zen; -const GlobalResources& GlobalResources::getInstance() +const GlobalResources& GlobalResources::instance() { - static GlobalResources instance; - return instance; + static GlobalResources inst; + return inst; } GlobalResources::GlobalResources() { - programIcon = new wxIcon(wxNullIcon); -} - - -GlobalResources::~GlobalResources() -{ - //free bitmap resources - for (std::map<wxString, wxBitmap*>::iterator i = bitmapResource.begin(); i != bitmapResource.end(); ++i) - delete i->second; - - //free other resources - delete programIcon; -} - - -void GlobalResources::load() const -{ wxFFileInputStream input(zen::getResourceDir() + wxT("Resources.zip")); if (input.IsOk()) //if not... we don't want to react too harsh here { @@ -51,7 +33,7 @@ void GlobalResources::load() const while (true) { - std::auto_ptr<wxZipEntry> entry(resourceFile.GetNextEntry()); + std::unique_ptr<wxZipEntry> entry(resourceFile.GetNextEntry()); if (entry.get() == NULL) break; @@ -59,32 +41,31 @@ void GlobalResources::load() const //generic image loading if (name.EndsWith(wxT(".png"))) - { - if (bitmapResource.find(name) == bitmapResource.end()) //avoid duplicate entry: prevent memory leak! - bitmapResource[name] = new wxBitmap(wxImage(resourceFile, wxBITMAP_TYPE_PNG)); - } + bitmaps.insert(std::make_pair(name, wxImage(resourceFile, wxBITMAP_TYPE_PNG))); } } #ifdef FFS_WIN //for compatibility it seems we need to stick with a "real" icon - *programIcon = wxIcon(wxT("A_PROGRAM_ICON")); + programIcon = wxIcon(wxT("A_PROGRAM_ICON")); #else //use big logo bitmap for better quality - programIcon->CopyFromBitmap(getImageByName(wxT("RealtimeSync.png"))); + programIcon.CopyFromBitmap(getImageInt(wxT("RealtimeSync.png"))); #endif + } -const wxBitmap& GlobalResources::getImageByName(const wxString& imageName) const +const wxBitmap& GlobalResources::getImageInt(const wxString& name) 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); - - if (bmp != bitmapResource.end()) - return *bmp->second; + auto iter = bitmaps.find(name.Find(L'.') == wxNOT_FOUND ? //assume .png ending if nothing else specified + name + wxT(".png") : + name); + if (iter != bitmaps.end()) + return iter->second; else + { + assert(false); return wxNullBitmap; + } } - diff --git a/RealtimeSync/resources.h b/RealtimeSync/resources.h index fec82358..4c41d47d 100644 --- a/RealtimeSync/resources.h +++ b/RealtimeSync/resources.h @@ -7,29 +7,29 @@ #ifndef RESOURCES_H_INCLUDED #define RESOURCES_H_INCLUDED -#include <wx/bitmap.h> -#include <wx/string.h> #include <map> +#include <wx/bitmap.h> +#include <wx/icon.h> class GlobalResources { public: - static const GlobalResources& getInstance(); + static const GlobalResources& instance(); - const wxBitmap& getImageByName(const wxString& imageName) const; + static const wxBitmap& getImage(const wxString& name) { return instance().getImageInt(name); } //image resource objects - wxIcon* programIcon; - - void load() const; //loads bitmap resources on program startup: logical const! + wxIcon programIcon; private: GlobalResources(); - ~GlobalResources(); + GlobalResources(const GlobalResources&); //=delete + GlobalResources& operator=(const GlobalResources&); //=delete + +const wxBitmap& getImageInt(const wxString& name) const; - //resource mapping - mutable std::map<wxString, wxBitmap*> bitmapResource; + std::map<wxString, wxBitmap> bitmaps; }; #endif // RESOURCES_H_INCLUDED diff --git a/RealtimeSync/tray_menu.cpp b/RealtimeSync/tray_menu.cpp index cbdf6070..8d43cabc 100644 --- a/RealtimeSync/tray_menu.cpp +++ b/RealtimeSync/tray_menu.cpp @@ -20,11 +20,10 @@ #include <wx/icon.h> //Linux needs this #include <wx/timer.h> #include "resources.h" -#include "../shared/string_conv.h" -#include "../shared/i18n.h" -#include "../shared/assert_static.h" -#include "../shared/build_info.h" -#include "../shared/shell_execute.h" +#include <wx+/string_conv.h> +#include <zen/assert_static.h> +#include <zen/build_info.h> +#include <wx+/shell_execute.h> using namespace rts; using namespace zen; @@ -148,9 +147,9 @@ void TrayIconHolder::showIconActive() { wxIcon realtimeIcon; #ifdef FFS_WIN - realtimeIcon.CopyFromBitmap(GlobalResources::getInstance().getImageByName(wxT("RTS_tray_win.png"))); //use a 16x16 bitmap + realtimeIcon.CopyFromBitmap(GlobalResources::getImage(wxT("RTS_tray_win.png"))); //use a 16x16 bitmap #elif defined FFS_LINUX - realtimeIcon.CopyFromBitmap(GlobalResources::getInstance().getImageByName(wxT("RTS_tray_linux.png"))); //use a 22x22 bitmap for perfect fit + realtimeIcon.CopyFromBitmap(GlobalResources::getImage(wxT("RTS_tray_linux.png"))); //use a 22x22 bitmap for perfect fit #endif const wxString postFix = jobName_.empty() ? wxString() : (wxT("\n\"") + jobName_ + wxT("\"")); trayMenu->SetIcon(realtimeIcon, _("Monitoring active...") + postFix); @@ -161,9 +160,9 @@ void TrayIconHolder::showIconWaiting() { wxIcon realtimeIcon; #ifdef FFS_WIN - realtimeIcon.CopyFromBitmap(GlobalResources::getInstance().getImageByName(wxT("RTS_tray_waiting_win.png"))); //use a 16x16 bitmap + realtimeIcon.CopyFromBitmap(GlobalResources::getImage(wxT("RTS_tray_waiting_win.png"))); //use a 16x16 bitmap #elif defined FFS_LINUX - realtimeIcon.CopyFromBitmap(GlobalResources::getInstance().getImageByName(wxT("RTS_tray_waiting_linux.png"))); //use a 22x22 bitmap for perfect fit + realtimeIcon.CopyFromBitmap(GlobalResources::getImage(wxT("RTS_tray_waiting_linux.png"))); //use a 22x22 bitmap for perfect fit #endif const wxString postFix = jobName_.empty() ? wxString() : (wxT("\n\"") + jobName_ + wxT("\"")); trayMenu->SetIcon(realtimeIcon, _("Waiting for missing directories...") + postFix); @@ -192,11 +191,11 @@ void TrayIconHolder::OnContextMenuSelection(wxCommandEvent& event) #endif //wxUSE_UNICODE //compile time info about 32/64-bit build - if (util::is64BitBuild) + if (zen::is64BitBuild) build += wxT(" x64"); else build += wxT(" x86"); - assert_static(util::is32BitBuild || util::is64BitBuild); + assert_static(zen::is32BitBuild || zen::is64BitBuild); wxString buildFormatted = _("(Build: %x)"); buildFormatted.Replace(wxT("%x"), build); @@ -312,6 +311,7 @@ rts::MonitorResponse rts::startDirectoryMonitor(const xmlAccess::XmlRealConfig& while (true) { ::wxSetEnv(L"changed_file", utf8CvrtTo<wxString>(lastFileChanged)); //some way to output what file changed to the user + lastFileChanged.clear(); //make sure old name is not shown again after a directory reappears //execute command zen::shellExecute(config.commandline, zen::EXEC_TYPE_SYNC); diff --git a/RealtimeSync/watcher.cpp b/RealtimeSync/watcher.cpp index 37664d35..97ad480a 100644 --- a/RealtimeSync/watcher.cpp +++ b/RealtimeSync/watcher.cpp @@ -5,14 +5,14 @@ // ************************************************************************** #include "watcher.h" -#include "../shared/file_handling.h" -#include "../shared/i18n.h" -#include "../shared/stl_tools.h" +#include <zen/file_handling.h> +#include <zen/stl_tools.h> #include <set> #include <wx/timer.h> -#include "../shared/resolve_path.h" -#include "../shared/dir_watcher.h" -#include "../shared/string_conv.h" +#include "../lib/resolve_path.h" +#include <zen/dir_watcher.h> +#include <wx+/string_conv.h> +#include <zen/thread.h> //#include "../library/db_file.h" //SYNC_DB_FILE_ENDING -> complete file too much of a dependency; file ending too little to decouple into single header //#include "../library/lock_holder.h" //LOCK_FILE_ENDING #include <wx/msgdlg.h> @@ -64,12 +64,15 @@ rts::WaitResult rts::waitForChanges(const std::vector<Zstring>& dirNamesNonFmt, const Zstring& dirnameFmt = *iter; try { - watches.push_back(std::make_pair(dirnameFmt, std::make_shared<DirWatcher>(dirnameFmt))); //throw FileError + watches.push_back(std::make_pair(dirnameFmt, std::make_shared<DirWatcher>(dirnameFmt))); //throw FileError, ErrorNotExisting } - catch (FileError&) + catch (ErrorNotExisting&) //nice atomic behavior: *no* second directory existence check!!! { - //Note: checking for directory existence is NOT transactional!!! - if (!dirExists(dirnameFmt)) //that's no good locking behavior, but better than nothing + return CHANGE_DIR_MISSING; + } + catch (FileError&) //play safe: remedy potential FileErrors that should have been ErrorNotExisting (e.g. Linux: errors during directory traversing) + { + if (!dirExists(dirnameFmt)) //not an atomic behavior!!! return CHANGE_DIR_MISSING; throw; } @@ -102,10 +105,10 @@ rts::WaitResult rts::waitForChanges(const std::vector<Zstring>& dirNamesNonFmt, try { - std::vector<Zstring> changedFiles = watcher.getChanges(); //throw FileError + std::vector<Zstring> changedFiles = watcher.getChanges(); //throw FileError, ErrorNotExisting //remove to be ignored changes - vector_remove_if(changedFiles, [](const Zstring & name) + vector_remove_if(changedFiles, [](const Zstring& name) { return endsWith(name, Zstr(".ffs_lock")) || //sync.ffs_lock, sync.Del.ffs_lock endsWith(name, Zstr(".ffs_db")); //sync.ffs_db, .sync.tmp.ffs_db @@ -122,10 +125,13 @@ rts::WaitResult rts::waitForChanges(const std::vector<Zstring>& dirNamesNonFmt, } } - catch (FileError&) + catch (ErrorNotExisting&) //nice atomic behavior: *no* second directory existence check!!! { - //Note: checking for directory existence is NOT transactional!!! - if (!dirExists(dirname)) //catch errors related to directory removal, e.g. ERROR_NETNAME_DELETED + return CHANGE_DIR_MISSING; + } + catch (FileError&) //play safe: remedy potential FileErrors that should have been ErrorNotExisting (e.g. Linux: errors during directory traversing) + { + if (!dirExists(dirname)) //not an atomic behavior!!! return CHANGE_DIR_MISSING; throw; } @@ -149,18 +155,36 @@ void rts::waitForMissingDirs(const std::vector<Zstring>& dirNamesNonFmt, WaitCal { lastCheck = current; - if (std::find_if(dirNamesNonFmt.begin(), dirNamesNonFmt.end(), - [&](const Zstring& dirnameNonFmt) -> bool - { - //support specifying volume by name => call getFormattedDirectoryName() repeatedly - const Zstring formattedDir = zen::getFormattedDirectoryName(dirnameNonFmt); - - if (formattedDir.empty()) - throw zen::FileError(_("A directory input field is empty.")); + auto ftDirMissing = async([=]() -> bool + { + return std::find_if(dirNamesNonFmt.begin(), dirNamesNonFmt.end(), + [](const Zstring& dirnameNonFmt) -> bool + { + //support specifying volume by name => call getFormattedDirectoryName() repeatedly + const Zstring dirnameFmt = zen::getFormattedDirectoryName(dirnameNonFmt); + + if (dirnameFmt.empty()) + throw zen::FileError(_("A directory input field is empty.")); +#ifdef FFS_WIN + //1. login to network share, if necessary + loginNetworkShare(dirnameFmt, false); //login networks shares, no PW prompt -> is this really RTS's task? +#endif + //2. check dir existence + return !zen::dirExists(dirnameFmt); + }) != dirNamesNonFmt.end(); + }); + while (!ftDirMissing.timed_wait(boost::posix_time::milliseconds(rts::UI_UPDATE_INTERVAL))) + statusHandler->requestUiRefresh(); //may throw! - return !dirExists(formattedDir); - }) == dirNamesNonFmt.end()) - return; + try + { + if (!ftDirMissing.get()) //throw X + return; + } + catch (...) //boost::future seems to map async exceptions to "some" boost exception type -> migrate this for C++11 + { + throw zen::FileError(_("A directory input field is empty.")); + } } wxMilliSleep(rts::UI_UPDATE_INTERVAL); diff --git a/RealtimeSync/watcher.h b/RealtimeSync/watcher.h index dd0dd88d..9d2448de 100644 --- a/RealtimeSync/watcher.h +++ b/RealtimeSync/watcher.h @@ -7,9 +7,9 @@ #ifndef WATCHER_H_INCLUDED #define WATCHER_H_INCLUDED -#include "../shared/zstring.h" +#include <zen/zstring.h> #include <vector> -#include "../shared/file_error.h" +#include <zen/file_error.h> namespace rts diff --git a/RealtimeSync/xml_ffs.cpp b/RealtimeSync/xml_ffs.cpp index 23ee1b38..32ef3b39 100644 --- a/RealtimeSync/xml_ffs.cpp +++ b/RealtimeSync/xml_ffs.cpp @@ -5,18 +5,17 @@ // ************************************************************************** #include "xml_ffs.h" -#include "../shared/standard_paths.h" -#include "../shared/zstring.h" -#include "../shared/xml_base.h" -#include "../shared/string_conv.h" +#include "../lib/ffs_paths.h" +#include <zen/zstring.h> +#include <wx+/string_conv.h> //include FreeFileSync xml headers -#include "../library/process_xml.h" +#include "../lib/process_xml.h" using namespace zen; -xmlAccess::XmlRealConfig convertBatchToReal(const xmlAccess::XmlBatchConfig& batchCfg, const wxString& filename) +xmlAccess::XmlRealConfig convertBatchToReal(const xmlAccess::XmlBatchConfig& batchCfg, const Zstring& filename) { xmlAccess::XmlRealConfig output; @@ -64,11 +63,11 @@ void rts::readRealOrBatchConfig(const wxString& filename, xmlAccess::XmlRealConf catch (const xmlAccess::FfsXmlError& e) { if (e.getSeverity() == xmlAccess::FfsXmlError::WARNING) - config = convertBatchToReal(batchCfg, filename); //do work despite parsing errors, then re-throw + config = convertBatchToReal(batchCfg, toZ(filename)); //do work despite parsing errors, then re-throw throw; // } - config = convertBatchToReal(batchCfg, filename); + config = convertBatchToReal(batchCfg, toZ(filename)); } diff --git a/RealtimeSync/xml_proc.cpp b/RealtimeSync/xml_proc.cpp index b9839f9c..8e978aed 100644 --- a/RealtimeSync/xml_proc.cpp +++ b/RealtimeSync/xml_proc.cpp @@ -6,10 +6,8 @@ #include "xml_proc.h" #include <wx/filefn.h> -#include "../shared/i18n.h" -#include <file_handling.h> -#include <string_conv.h> -#include <xml_base.h> +#include <zen/file_handling.h> +#include <wx+/string_conv.h> using namespace zen; using namespace xmlAccess; @@ -44,19 +42,19 @@ bool isXmlTypeRTS(const XmlDoc& doc) //throw() void xmlAccess::readRealConfig(const wxString& filename, XmlRealConfig& config) { if (!fileExists(toZ(filename))) - throw FfsXmlError(wxString(_("File does not exist:")) + wxT("\n\"") + filename + wxT("\"")); + throw FfsXmlError(_("File does not exist:") + "\n\"" + filename.c_str() + "\""); XmlDoc doc; - loadXmlDocument(filename, doc); //throw (FfsXmlError) + loadXmlDocument(toZ(filename), doc); //throw (FfsXmlError) if (!isXmlTypeRTS(doc)) - throw FfsXmlError(wxString(_("Error parsing configuration file:")) + wxT("\n\"") + filename + wxT("\"")); + throw FfsXmlError(_("Error parsing configuration file:") + "\n\"" + filename.c_str() + "\""); XmlIn in(doc); ::readConfig(in, config); if (in.errorsOccured()) - throw FfsXmlError(wxString(_("Error parsing configuration file:")) + wxT("\n\"") + filename + wxT("\"\n\n") + + throw FfsXmlError(_("Error parsing configuration file:") + "\n\"" + filename.c_str() + "\"\n\n" + getErrorMessageFormatted(in), FfsXmlError::WARNING); } @@ -80,5 +78,5 @@ void xmlAccess::writeRealConfig(const XmlRealConfig& config, const wxString& fil XmlOut out(doc); writeConfig(config, out); - saveXmlDocument(doc, filename); //throw (FfsXmlError) + saveXmlDocument(doc, toZ(filename)); //throw (FfsXmlError) } diff --git a/RealtimeSync/xml_proc.h b/RealtimeSync/xml_proc.h index 37d2e029..2fd54c37 100644 --- a/RealtimeSync/xml_proc.h +++ b/RealtimeSync/xml_proc.h @@ -9,7 +9,7 @@ #include <vector> #include <wx/string.h> -#include <xml_error.h> +#include "../lib/xml_base.h" namespace xmlAccess diff --git a/algorithm.cpp b/algorithm.cpp index 8f09f0ef..d2e40f44 100644 --- a/algorithm.cpp +++ b/algorithm.cpp @@ -7,21 +7,17 @@ #include "algorithm.h" #include <iterator> #include <stdexcept> -//#include <wx/log.h> -#include "library/resources.h" -#include "shared/file_handling.h" -#include "shared/recycler.h" +#include "lib/resources.h" +#include <zen/file_handling.h> +#include "lib/recycler.h" #include <wx/msgdlg.h> -#include "library/norm_filter.h" -#include "shared/string_conv.h" -#include "shared/global_func.h" -#include "shared/i18n.h" -#include "shared/loki/TypeManip.h" -#include "library/db_file.h" -#include "shared/loki/ScopeGuard.h" -#include "library/cmp_filetime.h" -#include "shared/stl_tools.h" -#include "library/norm_filter.h" +#include "lib/norm_filter.h" +#include <wx+/string_conv.h> +#include "lib/db_file.h" +#include <zen/scope_guard.h> +#include "lib/cmp_filetime.h" +#include <zen/stl_tools.h> +#include "lib/norm_filter.h" using namespace zen; using namespace std::rel_ops; @@ -52,13 +48,13 @@ public: switch (fileObj.getCategory()) { case FILE_LEFT_SIDE_ONLY: - if (fileObj.getFullName<LEFT_SIDE>().EndsWith(zen::TEMP_FILE_ENDING)) + if (endsWith(fileObj.getFullName<LEFT_SIDE>(), zen::TEMP_FILE_ENDING)) fileObj.setSyncDir(SYNC_DIR_LEFT); //schedule potentially existing temporary files for deletion else fileObj.setSyncDir(dirCfg.exLeftSideOnly); break; case FILE_RIGHT_SIDE_ONLY: - if (fileObj.getFullName<RIGHT_SIDE>().EndsWith(zen::TEMP_FILE_ENDING)) + if (endsWith(fileObj.getFullName<RIGHT_SIDE>(), zen::TEMP_FILE_ENDING)) fileObj.setSyncDir(SYNC_DIR_RIGHT); //schedule potentially existing temporary files for deletion else fileObj.setSyncDir(dirCfg.exRightSideOnly); @@ -202,12 +198,12 @@ public: fileSize = fileDescr.fileSize; } - DataSetFile(const FileMapping& fileObj, Loki::Int2Type<LEFT_SIDE>) + DataSetFile(const FileMapping& fileObj, Int2Type<LEFT_SIDE>) { init<LEFT_SIDE>(fileObj); } - DataSetFile(const FileMapping& fileObj, Loki::Int2Type<RIGHT_SIDE>) + DataSetFile(const FileMapping& fileObj, Int2Type<RIGHT_SIDE>) { init<RIGHT_SIDE>(fileObj); } @@ -269,12 +265,12 @@ public: #endif } - DataSetSymlink(const SymLinkMapping& linkObj, Loki::Int2Type<LEFT_SIDE>) + DataSetSymlink(const SymLinkMapping& linkObj, Int2Type<LEFT_SIDE>) { init<LEFT_SIDE>(linkObj); } - DataSetSymlink(const SymLinkMapping& linkObj, Loki::Int2Type<RIGHT_SIDE>) + DataSetSymlink(const SymLinkMapping& linkObj, Int2Type<RIGHT_SIDE>) { init<RIGHT_SIDE>(linkObj); } @@ -338,10 +334,10 @@ public: DataSetDir(const Zstring& name) : shortName(name) {} - DataSetDir(const DirMapping& dirObj, Loki::Int2Type<LEFT_SIDE>) : + DataSetDir(const DirMapping& dirObj, Int2Type<LEFT_SIDE>) : shortName(dirObj.getShortName<LEFT_SIDE>()) {} - DataSetDir(const DirMapping& dirObj, Loki::Int2Type<RIGHT_SIDE>) : + DataSetDir(const DirMapping& dirObj, Int2Type<RIGHT_SIDE>) : shortName(dirObj.getShortName<RIGHT_SIDE>()) {} inline friend @@ -389,7 +385,7 @@ std::pair<DataSetDir, const DirContainer*> retrieveDataSetDir(const Zstring& obj return std::make_pair(DataSetDir(iter->first), &iter->second); } - return std::make_pair(DataSetDir(), static_cast<const DirContainer*>(NULL)); //object not found + return std::make_pair(DataSetDir(), static_cast<DirContainer*>(NULL)); //object not found } //---------------------------------------------------------------------------------------------- @@ -505,12 +501,12 @@ private: //##################### schedule potentially existing temporary files for deletion #################### - if (cat == FILE_LEFT_SIDE_ONLY && fileObj.getFullName<LEFT_SIDE>().EndsWith(zen::TEMP_FILE_ENDING)) + if (cat == FILE_LEFT_SIDE_ONLY && endsWith(fileObj.getFullName<LEFT_SIDE>(), zen::TEMP_FILE_ENDING)) { fileObj.setSyncDir(SYNC_DIR_LEFT); return; } - else if (cat == FILE_RIGHT_SIDE_ONLY && fileObj.getFullName<RIGHT_SIDE>().EndsWith(zen::TEMP_FILE_ENDING)) + else if (cat == FILE_RIGHT_SIDE_ONLY && endsWith(fileObj.getFullName<RIGHT_SIDE>(), zen::TEMP_FILE_ENDING)) { fileObj.setSyncDir(SYNC_DIR_RIGHT); return; @@ -534,8 +530,8 @@ private: const DataSetFile dataDbLeft = retrieveDataSetFile(fileObj.getObjShortName(), dbDirectoryLeft); const DataSetFile dataDbRight = retrieveDataSetFile(fileObj.getObjShortName(), dbDirectoryRight); - const DataSetFile dataCurrentLeft( fileObj, Loki::Int2Type<LEFT_SIDE>()); - const DataSetFile dataCurrentRight(fileObj, Loki::Int2Type<RIGHT_SIDE>()); + const DataSetFile dataCurrentLeft( fileObj, Int2Type<LEFT_SIDE>()); + const DataSetFile dataCurrentRight(fileObj, Int2Type<RIGHT_SIDE>()); //evaluation const bool changeOnLeft = dataDbLeft != dataCurrentLeft; @@ -600,8 +596,8 @@ private: const DataSetSymlink dataDbLeft = retrieveDataSetSymlink(linkObj.getObjShortName(), dbDirectoryLeft); const DataSetSymlink dataDbRight = retrieveDataSetSymlink(linkObj.getObjShortName(), dbDirectoryRight); - const DataSetSymlink dataCurrentLeft( linkObj, Loki::Int2Type<LEFT_SIDE>()); - const DataSetSymlink dataCurrentRight(linkObj, Loki::Int2Type<RIGHT_SIDE>()); + const DataSetSymlink dataCurrentLeft( linkObj, Int2Type<LEFT_SIDE>()); + const DataSetSymlink dataCurrentRight(linkObj, Int2Type<RIGHT_SIDE>()); //evaluation const bool changeOnLeft = dataDbLeft != dataCurrentLeft; @@ -665,8 +661,8 @@ private: if (cat != DIR_EQUAL) { - const DataSetDir dataCurrentLeft( dirObj, Loki::Int2Type<LEFT_SIDE>()); - const DataSetDir dataCurrentRight(dirObj, Loki::Int2Type<RIGHT_SIDE>()); + const DataSetDir dataCurrentLeft( dirObj, Int2Type<LEFT_SIDE>()); + const DataSetDir dataCurrentRight(dirObj, Int2Type<RIGHT_SIDE>()); //evaluation const bool changeOnLeft = dataDbLeftStuff.first != dataCurrentLeft; @@ -1371,7 +1367,7 @@ void zen::deleteFromGridAndHD(std::vector<FileSystemObject*>& rowsToDeleteOnLeft baseDirCfgs[&** iter] = directCfgs[iter - folderCmp.begin()]; //ensure cleanup: redetermination of sync-directions and removal of invalid rows - LOKI_ON_BLOCK_EXIT2( std::for_each(begin(folderCmp), end(folderCmp), BaseDirMapping::removeEmpty); ); + ZEN_ON_BLOCK_EXIT( std::for_each(begin(folderCmp), end(folderCmp), BaseDirMapping::removeEmpty); ); std::set<FileSystemObject*> deleteLeft (rowsToDeleteOnLeft .begin(), rowsToDeleteOnLeft .end()); std::set<FileSystemObject*> deleteRight(rowsToDeleteOnRight.begin(), rowsToDeleteOnRight.end()); diff --git a/algorithm.h b/algorithm.h index f85d1639..6eb9f24d 100644 --- a/algorithm.h +++ b/algorithm.h @@ -8,7 +8,7 @@ #define ALGORITHM_H_INCLUDED #include "file_hierarchy.h" -#include "library/soft_filter.h" +#include "lib/soft_filter.h" namespace zen { diff --git a/comparison.cpp b/comparison.cpp index 33bc3548..62267473 100644 --- a/comparison.cpp +++ b/comparison.cpp @@ -5,20 +5,19 @@ // ************************************************************************** #include "comparison.h" -#include "library/parallel_scan.h" -#include "shared/resolve_path.h" -#include "shared/i18n.h" +#include "lib/parallel_scan.h" +#include "lib/resolve_path.h" #include <stdexcept> -#include "library/dir_exist_async.h" -#include "shared/string_conv.h" -#include "shared/loki/ScopeGuard.h" -#include "library/binary.h" +#include "lib/dir_exist_async.h" +#include <wx+/string_conv.h> +#include <zen/scope_guard.h> +#include "lib/binary.h" #include "algorithm.h" -#include "shared/util.h" -#include "library/cmp_filetime.h" +#include <wx+/format_unit.h> +#include "lib/cmp_filetime.h" #ifdef FFS_WIN -#include "shared/perf.h" +#include <zen/perf.h> #endif using namespace zen; @@ -37,8 +36,11 @@ std::vector<FolderPairCfg> zen::extractCompareCfg(const MainConfiguration& mainC std::transform(allPairs.begin(), allPairs.end(), std::back_inserter(output), [&](const FolderPairEnh& enhPair) -> FolderPairCfg { - return FolderPairCfg(getFormattedDirectoryName(enhPair.leftDirectory), //ensure they end with FILE_NAME_SEPARATOR and replace macros - getFormattedDirectoryName(enhPair.rightDirectory), + const Zstring leftDirFmt = getFormattedDirectoryName(enhPair.leftDirectory); //ensure they end with FILE_NAME_SEPARATOR and replace macros + const Zstring rightDirFmt = getFormattedDirectoryName(enhPair.rightDirectory); // + + return FolderPairCfg(leftDirFmt, + rightDirFmt, enhPair.altCmpConfig.get() ? enhPair.altCmpConfig->compareVar : mainCfg.cmpConfig.compareVar, enhPair.altCmpConfig.get() ? enhPair.altCmpConfig->handleSymlinks : mainCfg.cmpConfig.handleSymlinks, @@ -90,6 +92,7 @@ void checkForIncompleteInput(const std::vector<FolderPairCfg>& folderPairsForm, void checkDirectoryExistence(const std::set<Zstring, LessFilename>& dirnames, std::set<Zstring, LessFilename>& dirnamesExisting, + bool allowUserInteraction, ProcessCallback& procCallback) { std::for_each(dirnames.begin(), dirnames.end(), @@ -97,7 +100,7 @@ void checkDirectoryExistence(const std::set<Zstring, LessFilename>& dirnames, { if (!dirname.empty()) { - while (!dirExistsUpdating(dirname, procCallback)) + while (!dirExistsUpdating(dirname, allowUserInteraction, procCallback)) { const std::wstring additionalInfo = _("You can ignore this error to consider the directory as empty."); std::wstring errorMessage = _("Directory does not exist:") + "\n" + "\"" + dirname + "\""; @@ -185,7 +188,7 @@ bool filesHaveSameContentUpdating(const Zstring& filename1, const Zstring& filen UInt64 bytesReported; //amount of bytes that have been compared and communicated to status handler //in error situation: undo communication of processed amount of data - Loki::ScopeGuard guardStatistics = Loki::MakeGuard([&]() { pc.updateProcessedData(0, -1 * to<Int64>(bytesReported)); }); + zen::ScopeGuard guardStatistics = zen::makeGuard([&]() { pc.updateProcessedData(0, -1 * to<Int64>(bytesReported)); }); CmpCallbackImpl callback(pc, bytesReported); bool sameContent = filesHaveSameContent(filename1, filename2, callback); //throw FileError @@ -194,7 +197,7 @@ bool filesHaveSameContentUpdating(const Zstring& filename1, const Zstring& filen pc.updateProcessedData(0, to<Int64>(totalBytesToCmp) - to<Int64>(bytesReported)); bytesReported = totalBytesToCmp; - guardStatistics.Dismiss(); + guardStatistics.dismiss(); return sameContent; } } @@ -204,11 +207,13 @@ bool filesHaveSameContentUpdating(const Zstring& filename1, const Zstring& filen CompareProcess::CompareProcess(size_t fileTimeTol, xmlAccess::OptionalDialogs& warnings, + bool allowUserInteraction, ProcessCallback& handler) : fileTimeTolerance(fileTimeTol), m_warnings(warnings), + allowUserInteraction_(allowUserInteraction), procCallback(handler), - txtComparingContentOfFiles(toZ(_("Comparing content of files %x")).Replace(Zstr("%x"), Zstr("\n\"%x\""), false)) {} + txtComparingContentOfFiles(toZ(replaceCpy(_("Comparing content of files %x"), L"%x", L"\n\"%x\"", false))) {} void CompareProcess::startCompareProcess(const std::vector<FolderPairCfg>& cfgList, FolderComparison& output) @@ -238,7 +243,7 @@ void CompareProcess::startCompareProcess(const std::vector<FolderPairCfg>& cfgLi dirnames.insert(fpCfg.leftDirectoryFmt); dirnames.insert(fpCfg.rightDirectoryFmt); }); - checkDirectoryExistence(dirnames, dirnamesExisting, procCallback); + checkDirectoryExistence(dirnames, dirnamesExisting, allowUserInteraction_, procCallback); } auto dirAvailable = [&](const Zstring& dirnameFmt) { return dirnamesExisting.find(dirnameFmt) != dirnamesExisting.end(); }; @@ -310,7 +315,7 @@ void CompareProcess::startCompareProcess(const std::vector<FolderPairCfg>& cfgLi //------------------------------------------------------------------------------------------- //prevent shutdown while (binary) comparison is in progress - util::DisableStandby dummy2; + DisableStandby dummy2; (void)dummy2; //traverse/process folders @@ -389,7 +394,7 @@ std::wstring getConflictInvalidDate(const Zstring& fileNameFull, Int64 utcTime) { std::wstring msg = _("File %x has an invalid date!"); replace(msg, L"%x", std::wstring(L"\"") + fileNameFull + "\""); - msg += L"\n\n" + _("Date") + ": " + utcTimeToLocalString(utcTime); + msg += L"\n\n" + _("Date") + ": " + utcToLocalTimeString(utcTime); return _("Conflict detected:") + "\n" + msg; } @@ -403,7 +408,6 @@ void makeSameLength(wxString& first, wxString& second) first.Pad(maxPref - first.length(), wxT(' '), true); second.Pad(maxPref - second.length(), wxT(' '), true); } -} //check for changed files with same modification date @@ -412,12 +416,13 @@ std::wstring getConflictSameDateDiffSize(const FileMapping& fileObj) std::wstring msg = _("Files %x have the same date but a different size!"); replace(msg, wxT("%x"), wxString(wxT("\"")) + fileObj.getRelativeName<LEFT_SIDE>() + "\""); msg += L"\n\n"; - msg += L"<-- \t" + _("Date") + ": " + utcTimeToLocalString(fileObj.getLastWriteTime<LEFT_SIDE>()) + + msg += L"<-- \t" + _("Date") + ": " + utcToLocalTimeString(fileObj.getLastWriteTime<LEFT_SIDE>()) + " \t" + _("Size") + ": " + toStringSep(fileObj.getFileSize<LEFT_SIDE>()) + wxT("\n"); - msg += L"--> \t" + _("Date") + ": " + utcTimeToLocalString(fileObj.getLastWriteTime<RIGHT_SIDE>()) + + msg += L"--> \t" + _("Date") + ": " + utcToLocalTimeString(fileObj.getLastWriteTime<RIGHT_SIDE>()) + " \t" + _("Size") + ": " + toStringSep(fileObj.getFileSize<RIGHT_SIDE>()); return _("Conflict detected:") + "\n" + msg; } +} //----------------------------------------------------------------------------- @@ -621,8 +626,7 @@ void CompareProcess::compareByContent(std::vector<std::pair<FolderPairCfg, BaseD std::for_each(filesToCompareBytewise.begin(), filesToCompareBytewise.end(), [&](FileMapping* fileObj) { - Zstring statusText = txtComparingContentOfFiles; - statusText.Replace(Zstr("%x"), fileObj->getRelativeName<LEFT_SIDE>(), false); + const Zstring statusText = replaceCpy(txtComparingContentOfFiles, Zstr("%x"), fileObj->getRelativeName<LEFT_SIDE>(), false); procCallback.reportStatus(utf8CvrtTo<wxString>(statusText)); //check files that exist in left and right model but have different content diff --git a/comparison.h b/comparison.h index 225a82e8..e628e86d 100644 --- a/comparison.h +++ b/comparison.h @@ -8,12 +8,12 @@ #define COMPARISON_H_INCLUDED #include "file_hierarchy.h" -#include "library/process_xml.h" -#include "library/status_handler.h" +#include "lib/process_xml.h" +#include "lib/status_handler.h" #include "structures.h" -#include "shared/disable_standby.h" -#include "library/norm_filter.h" -#include "library/parallel_scan.h" +#include <zen/disable_standby.h> +#include "lib/norm_filter.h" +#include "lib/parallel_scan.h" namespace zen @@ -53,6 +53,7 @@ class CompareProcess public: CompareProcess(size_t fileTimeTol, xmlAccess::OptionalDialogs& warnings, + bool allowUserInteraction, ProcessCallback& handler); void startCompareProcess(const std::vector<FolderPairCfg>& cfgList, FolderComparison& output); @@ -79,6 +80,7 @@ private: xmlAccess::OptionalDialogs& m_warnings; + const bool allowUserInteraction_; ProcessCallback& procCallback; const Zstring txtComparingContentOfFiles; }; diff --git a/file_hierarchy.cpp b/file_hierarchy.cpp index b3264c31..cfe1b6a0 100644 --- a/file_hierarchy.cpp +++ b/file_hierarchy.cpp @@ -5,7 +5,6 @@ // ************************************************************************** #include "file_hierarchy.h" -#include "shared/build_info.h" using namespace zen; diff --git a/file_hierarchy.h b/file_hierarchy.h index 8424376c..6ea9d244 100644 --- a/file_hierarchy.h +++ b/file_hierarchy.h @@ -7,18 +7,16 @@ #ifndef FILEHIERARCHY_H_INCLUDED #define FILEHIERARCHY_H_INCLUDED -#include "shared/zstring.h" #include <map> #include <string> #include <unordered_set> #include <memory> -#include "shared/fixed_list.h" +#include <zen/zstring.h> +#include <zen/fixed_list.h> #include "structures.h" -#include "shared/guid.h" -#include "shared/file_id.h" -#include "shared/int64.h" +#include <zen/int64.h> #include "structures.h" -#include "library/hard_filter.h" +#include "lib/hard_filter.h" namespace zen @@ -782,7 +780,7 @@ void FileSystemObject::removeObject<LEFT_SIDE>() shortNameLeft_.clear(); removeObjectL(); - setSyncDir(SYNC_DIR_NONE); //calls notifySyncCfgChanged() + setSyncDir(SYNC_DIR_NONE); //calls notifySyncCfgChanged() } diff --git a/library/Batch.ico b/lib/Batch.ico Binary files differindex 7b33067a..7b33067a 100644 --- a/library/Batch.ico +++ b/lib/Batch.ico diff --git a/shared/FindFilePlus/FindFilePlus.vcxproj b/lib/FindFilePlus/FindFilePlus.vcxproj index a49e99ba..2c4256a6 100644 --- a/shared/FindFilePlus/FindFilePlus.vcxproj +++ b/lib/FindFilePlus/FindFilePlus.vcxproj @@ -101,7 +101,7 @@ <SuppressStartupBanner>true</SuppressStartupBanner> <DebugInformationFormat>EditAndContinue</DebugInformationFormat> <DisableSpecificWarnings>4100</DisableSpecificWarnings> - <AdditionalIncludeDirectories>C:\Program Files\C++\Projects\FreeFileSync\shared</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> @@ -134,7 +134,7 @@ <SuppressStartupBanner>true</SuppressStartupBanner> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4100</DisableSpecificWarnings> - <AdditionalIncludeDirectories>C:\Program Files\C++\Projects\FreeFileSync\shared</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> @@ -165,7 +165,7 @@ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4100</DisableSpecificWarnings> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <AdditionalIncludeDirectories>C:\Program Files\C++\Projects\FreeFileSync\shared</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> @@ -201,7 +201,7 @@ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4100</DisableSpecificWarnings> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <AdditionalIncludeDirectories>C:\Program Files\C++\Projects\FreeFileSync\shared</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> diff --git a/shared/Thumbnail/dll_main.cpp b/lib/FindFilePlus/dll_main.cpp index 3805c99d..aca474bc 100644 --- a/shared/Thumbnail/dll_main.cpp +++ b/lib/FindFilePlus/dll_main.cpp @@ -8,6 +8,9 @@ #define WIN32_LEAN_AND_MEAN #include <windows.h> +#include "init_dll_binding.h" + + //optional: add init/teardown logic here BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, @@ -16,10 +19,12 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, switch (fdwReason) { case DLL_PROCESS_ATTACH: + if (!findplus::initDllBinding()) + return false; case DLL_PROCESS_DETACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: break; } - return TRUE; + return true; } diff --git a/shared/FindFilePlus/find_file_plus.cpp b/lib/FindFilePlus/find_file_plus.cpp index 8b29efa2..becfe553 100644 --- a/shared/FindFilePlus/find_file_plus.cpp +++ b/lib/FindFilePlus/find_file_plus.cpp @@ -5,10 +5,10 @@ // ************************************************************************** #include "find_file_plus.h" +#include "init_dll_binding.h" //#include <windows.h> //these two don't play nice with each other - #include "load_dll.h" -#include <loki/ScopeGuard.h> +#include <zen/scope_guard.h> using namespace dll; using namespace findplus; @@ -16,6 +16,13 @@ using namespace findplus; namespace { +struct FileError +{ + FileError(ULONG errorCode) : win32Error(errorCode) {} + ULONG win32Error; +}; + + //-------------------------------------------------------------------------------------------------------------- typedef NTSTATUS (NTAPI* NtOpenFileFunc)(PHANDLE fileHandle, ACCESS_MASK desiredAccess, @@ -54,7 +61,7 @@ typedef BOOLEAN (NTAPI* RtlDosPathNameToNtPathName_UFunc)(PCWSTR, typedef BOOLEAN (NTAPI* RtlDosPathNameToRelativeNtPathName_UFunc)(PCWSTR, //__in dosFileName, PUNICODE_STRING, //__out ntFileName, - PWSTR*, //__out_optFilePart, + PCWSTR*, //__out_optFilePart, PRTL_RELATIVE_NAME_U); //__out_opt relativeName typedef VOID (NTAPI* RtlFreeUnicodeStringFunc)(PUNICODE_STRING); //__inout unicodeString @@ -63,33 +70,38 @@ typedef VOID (NTAPI* RtlFreeUnicodeStringFunc)(PUNICODE_STRING); //__inout unico //it seems we cannot use any of the ntoskrnl.lib files in WinDDK as they produce access violations //fortunately dynamic binding works fine: -NtOpenFileFunc ntOpenFile; -NtCloseFunc ntClose; -NtQueryDirectoryFileFunc ntQueryDirectoryFile; -RtlNtStatusToDosErrorFunc rtlNtStatusToDosError; -RtlFreeUnicodeStringFunc rtlFreeUnicodeString; -RtlDosPathNameToNtPathName_UFunc rtlDosPathNameToNtPathName_U; +const SysDllFun<NtOpenFileFunc> ntOpenFile (L"ntdll.dll", "NtOpenFile"); +const SysDllFun<NtCloseFunc> ntClose (L"ntdll.dll", "NtClose"); +const SysDllFun<NtQueryDirectoryFileFunc> ntQueryDirectoryFile (L"ntdll.dll", "NtQueryDirectoryFile"); +const SysDllFun<RtlNtStatusToDosErrorFunc> rtlNtStatusToDosError (L"ntdll.dll", "RtlNtStatusToDosError"); +const SysDllFun<RtlFreeUnicodeStringFunc> rtlFreeUnicodeString (L"ntdll.dll", "RtlFreeUnicodeString"); +const SysDllFun<RtlDosPathNameToNtPathName_UFunc> rtlDosPathNameToNtPathName_U(SysDllFun<RtlDosPathNameToRelativeNtPathName_UFunc>(L"ntdll.dll", "RtlDosPathNameToRelativeNtPathName_U") ? + SysDllFun<RtlDosPathNameToRelativeNtPathName_UFunc>(L"ntdll.dll", "RtlDosPathNameToRelativeNtPathName_U") : //use the newer version if available + SysDllFun<RtlDosPathNameToNtPathName_UFunc>(L"ntdll.dll", "RtlDosPathNameToNtPathName_U")); //fallback for XP +//global constants only -> preserve thread safety! +} -template <class FunType> inline -void initDllFun(FunType& fun, const char* functionName) //throw FileError +bool findplus::initDllBinding() //evaluate in ::DllMain() when attaching process { - if (!fun) - { - fun = getSystemDllFun<FunType>(L"ntdll.dll", functionName); - if (!fun) - throw FileError(182); //== ERROR_INVALID_ORDINAL, verified at compile time in "load_dll.cpp"; we better not use rtlNtStatusToDosError(STATUS_ORDINAL_NOT_FOUND) here ;) - } -} + //NT/ZwXxx Routines + //http://msdn.microsoft.com/en-us/library/ff567122(v=VS.85).aspx + //Run-Time Library (RTL) Routines + //http://msdn.microsoft.com/en-us/library/ff563638(v=VS.85).aspx -struct FileError -{ - FileError(ULONG errorCode) : win32Error(errorCode) {} - ULONG win32Error; -}; + //verify dynamic dll binding + return ntOpenFile && + ntClose && + ntQueryDirectoryFile && + rtlNtStatusToDosError && + rtlFreeUnicodeString && + rtlDosPathNameToNtPathName_U; + + //this may become handy some time: nt status code STATUS_ORDINAL_NOT_FOUND maps to win32 code ERROR_INVALID_ORDINAL } + class findplus::FileSearcher { public: @@ -116,31 +128,11 @@ FileSearcher::FileSearcher(const wchar_t* dirname) : hDir(NULL), nextEntryOffset(0) { - UNICODE_STRING cleanDummy = {}; - ntPathName = cleanDummy; - - Loki::ScopeGuard guardConstructor = Loki::MakeGuard([&]() { this->~FileSearcher(); }); - - //NT/ZwXxx Routines - //http://msdn.microsoft.com/en-us/library/ff567122(v=VS.85).aspx + ntPathName.Buffer = NULL; + ntPathName.Length = 0; + ntPathName.MaximumLength = 0; - //Run-Time Library (RTL) Routines - //http://msdn.microsoft.com/en-us/library/ff563638(v=VS.85).aspx - - //init static dll functions - initDllFun(ntOpenFile, "NtOpenFile"); //throw FileError - initDllFun(ntClose, "NtClose"); - initDllFun(ntQueryDirectoryFile, "NtQueryDirectoryFile"); - initDllFun(rtlNtStatusToDosError, "RtlNtStatusToDosError"); - initDllFun(rtlFreeUnicodeString, "RtlFreeUnicodeString"); - try - { - initDllFun(rtlDosPathNameToNtPathName_U, "RtlDosPathNameToRelativeNtPathName_U"); //use the newer version if available - } - catch (const FileError&) - { - initDllFun(rtlDosPathNameToNtPathName_U, "RtlDosPathNameToNtPathName_U"); //fallback for XP - } + zen::ScopeGuard guardConstructor = zen::makeGuard([&]() { this->~FileSearcher(); }); //-------------------------------------------------------------------------------------------------------------- //convert dosFileName, e.g. C:\Users or \\?\C:\Users to ntFileName \??\C:\Users @@ -174,10 +166,11 @@ FileSearcher::FileSearcher(const wchar_t* dirname) : throw FileError(rtlNtStatusToDosError(rv)); } - guardConstructor.Dismiss(); + guardConstructor.dismiss(); } +inline FileSearcher::~FileSearcher() { //cleanup in reverse order @@ -301,5 +294,5 @@ bool findplus::readDir(FindHandle hnd, FileInformation& output) void findplus::closeDir(FindHandle hnd) { if (hnd) //play a little "nice" - delete static_cast<FileSearcher*>(hnd); + delete hnd; } diff --git a/shared/FindFilePlus/find_file_plus.h b/lib/FindFilePlus/find_file_plus.h index 88cb13af..aacdf0ea 100644 --- a/shared/FindFilePlus/find_file_plus.h +++ b/lib/FindFilePlus/find_file_plus.h @@ -21,7 +21,7 @@ #undef min #undef max -#include "../build_info.h" +#include <zen/build_info.h> namespace findplus { @@ -38,14 +38,14 @@ struct FileInformation DWORD fileAttributes; DWORD shortNameLength; WCHAR shortName[MAX_PATH + 1]; //shortName is 0-terminated -}; +}; //no need for #pragma pack -> all members already starting at 4 byte boundary! class FileSearcher; typedef FileSearcher* FindHandle; DLL_FUNCTION_DECLARATION -FindHandle openDir(const wchar_t* dirname); //returns NULL on error, call ::GetLastError(); returns ERROR_INVALID_ORDINAL if ntdll-libraries could not be loaded -//note do NOT place an asterisk at end, e.g. C:\SomeDir\*, as one would do for ::FindFirstFile() +FindHandle openDir(const wchar_t* dirname); //returns NULL on error, call ::GetLastError() +//note: do NOT place an asterisk at end, e.g. C:\SomeDir\*, as one would do for ::FindFirstFile() DLL_FUNCTION_DECLARATION bool readDir(FindHandle hnd, FileInformation& output); //returns false on error or if there are no more files; ::GetLastError() returns ERROR_NO_MORE_FILES @@ -71,7 +71,7 @@ const char closeDirFuncName[] = "closeDir"; /*--------------- |library names| ---------------*/ -inline const wchar_t* getDllName() { return util::is64BitBuild ? L"FindFilePlus_x64.dll" : L"FindFilePlus_Win32.dll"; } +inline const wchar_t* getDllName() { return zen::is64BitBuild ? L"FindFilePlus_x64.dll" : L"FindFilePlus_Win32.dll"; } } diff --git a/shared/resolve_path.h b/lib/FindFilePlus/init_dll_binding.h index 3be1d78e..51b32c99 100644 --- a/shared/resolve_path.h +++ b/lib/FindFilePlus/init_dll_binding.h @@ -4,21 +4,13 @@ // * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** -#ifndef RESOLVE_PATH_H_INCLUDED -#define RESOLVE_PATH_H_INCLUDED +#ifndef INIT_DLL_BINDING_HEADER_018356031467832145 +#define INIT_DLL_BINDING_HEADER_018356031467832145 -#include "zstring.h" - - -namespace zen +namespace findplus { -Zstring getFormattedDirectoryName(const Zstring& dirname); - - -#ifdef FFS_WIN -std::vector<Zstring> getDirectoryAliases(Zstring dirname); -#endif +//load and check dll binding at startup +bool initDllBinding(); //evaluate in ::DllMain() when attaching process } - -#endif // RESOLVE_PATH_H_INCLUDED +#endif //INIT_DLL_BINDING_HEADER_018356031467832145 diff --git a/shared/FindFilePlus/load_dll.cpp b/lib/FindFilePlus/load_dll.cpp index 51ec1f0c..7166223b 100644 --- a/shared/FindFilePlus/load_dll.cpp +++ b/lib/FindFilePlus/load_dll.cpp @@ -4,9 +4,9 @@ // * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** +#include "load_dll.h" #define WIN32_LEAN_AND_MEAN -#include <windows.h> // yes, this sequence is mad, but ddk and api headers contain plenty of redefinitions -#include "load_dll.h" // +#include <windows.h> void* /*FARPROC*/ dll::loadSymbol(const wchar_t* libraryName, const char* functionName) { @@ -21,5 +21,3 @@ void dll::setWin32Error(unsigned long lastError) { ::SetLastError(lastError); } - -static_assert(ERROR_INVALID_ORDINAL == 182, "dang!");
\ No newline at end of file diff --git a/shared/FindFilePlus/load_dll.h b/lib/FindFilePlus/load_dll.h index f152dd74..149b6efe 100644 --- a/shared/FindFilePlus/load_dll.h +++ b/lib/FindFilePlus/load_dll.h @@ -9,13 +9,21 @@ namespace dll { -template <typename FunctionType> -FunctionType getSystemDllFun(const wchar_t* libraryName, const char* functionName); //NOTE: uses ::GetModuleHandle => call for system DLLs only! - void setWin32Error(unsigned long lastError); +//NOTE: uses ::GetModuleHandle => call for system DLLs only! +template <class Func> +class SysDllFun +{ +public: + SysDllFun(const wchar_t* systemLibrary, const char* functionName) : + fun(reinterpret_cast<Func>(loadSymbol(systemLibrary, functionName))) {} + operator Func() const { return fun; } +private: + Func fun; +}; @@ -26,13 +34,13 @@ void setWin32Error(unsigned long lastError); -void* /*FARPROC*/ loadSymbol(const wchar_t* libraryName, const char* functionName); -template <typename FunctionType> inline -FunctionType getSystemDllFun(const wchar_t* libraryName, const char* functionName) -{ - return reinterpret_cast<FunctionType>(loadSymbol(libraryName, functionName)); -} + + + + + +void* /*FARPROC*/ loadSymbol(const wchar_t* libraryName, const char* functionName); } #endif //LOAD_DLL_HEADER_0312463214872163832174 diff --git a/library/FreeFileSync.ico b/lib/FreeFileSync.ico Binary files differindex b87789a7..b87789a7 100644 --- a/library/FreeFileSync.ico +++ b/lib/FreeFileSync.ico diff --git a/shared/IFileOperation/FileOperation_Vista.vcxproj b/lib/IFileOperation/FileOperation_Vista.vcxproj index 5de402f4..3d454a0b 100644 --- a/shared/IFileOperation/FileOperation_Vista.vcxproj +++ b/lib/IFileOperation/FileOperation_Vista.vcxproj @@ -97,7 +97,8 @@ <WarningLevel>Level4</WarningLevel> <SuppressStartupBanner>true</SuppressStartupBanner> <DebugInformationFormat>EditAndContinue</DebugInformationFormat> - <DisableSpecificWarnings>4100</DisableSpecificWarnings> + <DisableSpecificWarnings>4100;4996</DisableSpecificWarnings> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> @@ -129,7 +130,8 @@ <WarningLevel>Level4</WarningLevel> <SuppressStartupBanner>true</SuppressStartupBanner> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - <DisableSpecificWarnings>4100</DisableSpecificWarnings> + <DisableSpecificWarnings>4100;4996</DisableSpecificWarnings> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> @@ -159,7 +161,8 @@ <SuppressStartupBanner>true</SuppressStartupBanner> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <DisableSpecificWarnings>4100</DisableSpecificWarnings> + <DisableSpecificWarnings>4100;4996</DisableSpecificWarnings> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> @@ -194,7 +197,8 @@ <SuppressStartupBanner>true</SuppressStartupBanner> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <DisableSpecificWarnings>4100</DisableSpecificWarnings> + <DisableSpecificWarnings>4100;4996</DisableSpecificWarnings> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> diff --git a/shared/FindFilePlus/dll_main.cpp b/lib/IFileOperation/dll_main.cpp index 3805c99d..3805c99d 100644 --- a/shared/FindFilePlus/dll_main.cpp +++ b/lib/IFileOperation/dll_main.cpp diff --git a/shared/IFileOperation/file_op.cpp b/lib/IFileOperation/file_op.cpp index 8b632972..10eac5de 100644 --- a/shared/IFileOperation/file_op.cpp +++ b/lib/IFileOperation/file_op.cpp @@ -5,33 +5,41 @@ // ************************************************************************** #include "file_op.h" -#include "../com_ptr.h" -#include "../com_error.h" -#include "../c_dll.h" +#define WIN32_LEAN_AND_MEAN +#include <zen/win.h> +#include <zen/com_ptr.h> +#include <zen/com_error.h> -#include <Shellapi.h> // Included for shell constants such as FO_* values -#include <shobjidl.h> // Required for necessary shell dependencies -#include <comdef.h> +#include <Shellapi.h> // Included for shell constants such as FO_* values +#include <shobjidl.h> // Required for necessary shell dependencies #include <algorithm> #include <string> -#include <cstdio> -#define WIN32_LEAN_AND_MEAN -#include "windows.h" -using namespace c_dll; +using namespace zen; namespace fileop { -std::wstring lastErrorMessage; +inline +void copyString(const std::wstring& input, wchar_t* buffer, size_t bufferSize) +{ + if (bufferSize > 0) + { + //size_t endPos = input.copy(buffer, bufferSize - 1); + //buffer[endPos] = 0; + const size_t maxSize = std::min(input.length(), bufferSize - 1); + std::copy(input.begin(), input.begin() + maxSize, buffer); + buffer[maxSize] = 0; + } +} + +std::wstring lastErrorMessage; //this should really be thread-local!!! } bool fileop::moveToRecycleBin(const wchar_t* fileNames[], size_t fileNo) //size of fileNames array { - using util::ComPtr; - using util::generateErrorMsg; HRESULT hr; // Create the IFileOperation interface @@ -126,9 +134,6 @@ bool fileop::moveToRecycleBin(const wchar_t* fileNames[], bool fileop::copyFile(const wchar_t* sourceFile, const wchar_t* targetFile) { - using util::ComPtr; - using util::generateErrorMsg; - HRESULT hr; // Create the IFileOperation interface @@ -231,5 +236,5 @@ bool fileop::copyFile(const wchar_t* sourceFile, //if any of the functions above returns 'false', this message returns last error void fileop::getLastError(wchar_t* errorMessage, size_t errorBufferLen) { - writeString(lastErrorMessage, errorMessage, errorBufferLen); + copyString(lastErrorMessage, errorMessage, errorBufferLen); } diff --git a/shared/IFileOperation/file_op.h b/lib/IFileOperation/file_op.h index dbe00196..c33993ad 100644 --- a/shared/IFileOperation/file_op.h +++ b/lib/IFileOperation/file_op.h @@ -13,7 +13,7 @@ #define FILE_OP_DLL_API extern "C" __declspec(dllimport) #endif -#include "../build_info.h" +#include <zen/build_info.h> namespace fileop @@ -54,7 +54,7 @@ const char getLastErrorFctName[] = "getLastError"; /*--------------- |library names| ---------------*/ -inline const wchar_t* getDllName() { return util::is64BitBuild ? L"FileOperation_x64.dll" : L"FileOperation_Win32.dll"; } +inline const wchar_t* getDllName() { return zen::is64BitBuild ? L"FileOperation_x64.dll" : L"FileOperation_Win32.dll"; } } diff --git a/shared/ShadowCopy/LockFile.cpp b/lib/ShadowCopy/LockFile.cpp index 7df3ec66..7df3ec66 100644 --- a/shared/ShadowCopy/LockFile.cpp +++ b/lib/ShadowCopy/LockFile.cpp diff --git a/shared/ShadowCopy/Shadow_2003.vcxproj b/lib/ShadowCopy/Shadow_2003.vcxproj index 710b65bf..a893a389 100644 --- a/shared/ShadowCopy/Shadow_2003.vcxproj +++ b/lib/ShadowCopy/Shadow_2003.vcxproj @@ -98,7 +98,8 @@ <WarningLevel>Level4</WarningLevel> <SuppressStartupBanner>true</SuppressStartupBanner> <DebugInformationFormat>EditAndContinue</DebugInformationFormat> - <DisableSpecificWarnings>4100</DisableSpecificWarnings> + <DisableSpecificWarnings>4100;4996</DisableSpecificWarnings> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> @@ -130,7 +131,8 @@ <WarningLevel>Level4</WarningLevel> <SuppressStartupBanner>true</SuppressStartupBanner> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - <DisableSpecificWarnings>4100</DisableSpecificWarnings> + <DisableSpecificWarnings>4100;4996</DisableSpecificWarnings> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> @@ -160,7 +162,8 @@ <SuppressStartupBanner>true</SuppressStartupBanner> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <DisableSpecificWarnings>4100</DisableSpecificWarnings> + <DisableSpecificWarnings>4100;4996</DisableSpecificWarnings> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> @@ -195,7 +198,8 @@ <SuppressStartupBanner>true</SuppressStartupBanner> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <DisableSpecificWarnings>4100</DisableSpecificWarnings> + <DisableSpecificWarnings>4100;4996</DisableSpecificWarnings> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> diff --git a/shared/ShadowCopy/Shadow_XP.vcxproj b/lib/ShadowCopy/Shadow_XP.vcxproj index 6211afd5..e49e8941 100644 --- a/shared/ShadowCopy/Shadow_XP.vcxproj +++ b/lib/ShadowCopy/Shadow_XP.vcxproj @@ -98,7 +98,8 @@ <SuppressStartupBanner>true</SuppressStartupBanner> <DebugInformationFormat>EditAndContinue</DebugInformationFormat> <FavorSizeOrSpeed>Neither</FavorSizeOrSpeed> - <DisableSpecificWarnings>4100</DisableSpecificWarnings> + <DisableSpecificWarnings>4100;4996</DisableSpecificWarnings> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> @@ -131,7 +132,8 @@ <SuppressStartupBanner>true</SuppressStartupBanner> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <FavorSizeOrSpeed>Neither</FavorSizeOrSpeed> - <DisableSpecificWarnings>4100</DisableSpecificWarnings> + <DisableSpecificWarnings>4100;4996</DisableSpecificWarnings> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> @@ -161,7 +163,8 @@ <SuppressStartupBanner>true</SuppressStartupBanner> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <DisableSpecificWarnings>4100</DisableSpecificWarnings> + <DisableSpecificWarnings>4100;4996</DisableSpecificWarnings> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> @@ -196,7 +199,8 @@ <SuppressStartupBanner>true</SuppressStartupBanner> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <DisableSpecificWarnings>4100</DisableSpecificWarnings> + <DisableSpecificWarnings>4100;4996</DisableSpecificWarnings> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> diff --git a/shared/IFileOperation/dll_main.cpp b/lib/ShadowCopy/dll_main.cpp index 3805c99d..3805c99d 100644 --- a/shared/IFileOperation/dll_main.cpp +++ b/lib/ShadowCopy/dll_main.cpp diff --git a/shared/ShadowCopy/shadow.cpp b/lib/ShadowCopy/shadow.cpp index 8b7b9971..12e9fa60 100644 --- a/shared/ShadowCopy/shadow.cpp +++ b/lib/ShadowCopy/shadow.cpp @@ -8,9 +8,8 @@ #include <algorithm> #include <string> #include <comdef.h> -#include "../com_ptr.h" -#include "../com_error.h" -#include "../c_dll.h" +#include <zen/com_ptr.h> +#include <zen/com_error.h> #define WIN32_LEAN_AND_MEAN #include "windows.h" @@ -28,16 +27,28 @@ adapt! #endif -using namespace c_dll; +using namespace zen; namespace { -typedef HandleProvider<shadow::ShadowHandle, util::ComPtr<IVssBackupComponents> > HandleShadowMap; +inline +void copyString(const std::wstring& input, wchar_t* buffer, size_t bufferSize) +{ + if (bufferSize > 0) + { + //size_t endPos = input.copy(buffer, bufferSize - 1); + //buffer[endPos] = 0; + const size_t maxSize = std::min(input.length(), bufferSize - 1); + std::copy(input.begin(), input.begin() + maxSize, buffer); + buffer[maxSize] = 0; + } +} -void writeErrorMsg(const wchar_t* input, HRESULT hr, wchar_t* output, unsigned int outputBufferLen) +inline +void writeErrorMsg(const wchar_t* input, HRESULT hr, wchar_t* output, unsigned int outputLen) { - writeString(util::generateErrorMsg(input, hr).c_str(), output, outputBufferLen); + copyString(generateErrorMsg(input, hr), output, outputLen); } } @@ -49,9 +60,6 @@ bool shadow::createShadowCopy(const wchar_t* volumeName, wchar_t* errorMessage, unsigned int errorBufferLen) { - using util::ComPtr; - using util::generateErrorMsg; - //MessageBox(0, L"backup err", L"", 0); */ *handle = 0; HRESULT hr = NULL; @@ -162,11 +170,11 @@ bool shadow::createShadowCopy(const wchar_t* volumeName, } //finally: write volume name of newly created shadow copy - writeString(props.m_pwszSnapshotDeviceObject, shadowVolName, shadowBufferLen); + copyString(props.m_pwszSnapshotDeviceObject, shadowVolName, shadowBufferLen); VssFreeSnapshotProperties(&props); - *handle = HandleShadowMap::instance().insert(backupComp); + *handle = backupComp.release(); return true; } @@ -174,5 +182,6 @@ bool shadow::createShadowCopy(const wchar_t* volumeName, void shadow::releaseShadowCopy(ShadowHandle handle) { - HandleShadowMap::instance().remove(handle); + if (handle) + handle->Release(); } diff --git a/shared/ShadowCopy/shadow.h b/lib/ShadowCopy/shadow.h index 8721b906..0dfd39a9 100644 --- a/shared/ShadowCopy/shadow.h +++ b/lib/ShadowCopy/shadow.h @@ -13,9 +13,12 @@ #define SHADOWDLL_API extern "C" __declspec(dllimport) #endif -#include "../build_info.h" +#include <zen/build_info.h> +#include <zen/win_ver.h> +class IVssBackupComponents; + namespace shadow { /*-------------- @@ -24,16 +27,16 @@ namespace shadow //COM needs to be initialized before calling any of these functions! CoInitializeEx/CoUninitialize -typedef size_t ShadowHandle; +typedef IVssBackupComponents* ShadowHandle; //volumeName must end with "\", while shadowVolName does not end with "\" SHADOWDLL_API -bool createShadowCopy(const wchar_t* volumeName, //[in] - wchar_t* shadowVolName, //[out] - unsigned int shadowBufferLen, //[in] - ShadowHandle* handle, //[out] - wchar_t* errorMessage, //[out] - unsigned int errorBufferLen); //[in] +bool createShadowCopy(const wchar_t* volumeName, // in + wchar_t* shadowVolName, // out + unsigned int shadowBufferLen, // in + ShadowHandle* handle, // out + wchar_t* errorMessage, // out + unsigned int errorBufferLen); // in //don't forget to release the backupHandle after shadow copy is not needed anymore! @@ -66,22 +69,6 @@ const char releaseShadowCopyFctName[] = "releaseShadowCopy"; /*--------------- |library names| ---------------*/ -namespace impl -{ -bool newerThanXP() -{ - OSVERSIONINFO osvi = {}; - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - - if (::GetVersionEx(&osvi)) - return osvi.dwMajorVersion > 5 || - (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion > 1) ; - //XP has majorVersion == 5, minorVersion == 1 - //Server 2003 has majorVersion == 5, minorVersion == 2 - //version overview: http://msdn.microsoft.com/en-us/library/ms724834(VS.85).aspx - return false; -} -} inline const wchar_t* getDllName() @@ -90,12 +77,12 @@ const wchar_t* getDllName() distinguish a bunch of VSS builds: we use XP and Server 2003 implementations... VSS version and compatibility overview: http://msdn.microsoft.com/en-us/library/aa384627(VS.85).aspx */ - return impl::newerThanXP() ? - (util::is64BitBuild ? + return zen::winServer2003orLater() ? + (zen::is64BitBuild ? L"Shadow_Server2003_x64.dll" : L"Shadow_Server2003_Win32.dll") : - (util::is64BitBuild ? + (zen::is64BitBuild ? L"Shadow_XP_x64.dll" : L"Shadow_XP_Win32.dll"); } diff --git a/library/SyncDB.ico b/lib/SyncDB.ico Binary files differindex eee91c14..eee91c14 100644 --- a/library/SyncDB.ico +++ b/lib/SyncDB.ico diff --git a/shared/Thumbnail/Thumbnail.vcxproj b/lib/Thumbnail/Thumbnail.vcxproj index 05196e0a..e3909ff8 100644 --- a/shared/Thumbnail/Thumbnail.vcxproj +++ b/lib/Thumbnail/Thumbnail.vcxproj @@ -97,6 +97,7 @@ <SuppressStartupBanner>true</SuppressStartupBanner> <DebugInformationFormat>EditAndContinue</DebugInformationFormat> <DisableSpecificWarnings>4100</DisableSpecificWarnings> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> @@ -129,6 +130,7 @@ <SuppressStartupBanner>true</SuppressStartupBanner> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4100</DisableSpecificWarnings> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> @@ -159,6 +161,7 @@ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4100</DisableSpecificWarnings> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> @@ -194,6 +197,7 @@ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4100</DisableSpecificWarnings> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> diff --git a/shared/ShadowCopy/dll_main.cpp b/lib/Thumbnail/dll_main.cpp index 3805c99d..3805c99d 100644 --- a/shared/ShadowCopy/dll_main.cpp +++ b/lib/Thumbnail/dll_main.cpp diff --git a/shared/Thumbnail/thumbnail.cpp b/lib/Thumbnail/thumbnail.cpp index 51635ff9..b8d00c38 100644 --- a/shared/Thumbnail/thumbnail.cpp +++ b/lib/Thumbnail/thumbnail.cpp @@ -14,10 +14,10 @@ #include <Shellapi.h> #include <CommonControls.h> -#include "../com_ptr.h" -#include "../string_tools.h" -#include "../loki/ScopeGuard.h" -//#include "../perf.h" +#include <zen/com_ptr.h> +#include <zen/string_tools.h> +#include <string> +#include <zen/scope_guard.h> using namespace zen; @@ -26,7 +26,7 @@ thumb::HICON thumb::getThumbnail(const wchar_t* filename, int requestedSize) //r { const std::wstring filenameStr(filename); - util::ComPtr<IShellFolder> shellFolder; + ComPtr<IShellFolder> shellFolder; { HRESULT hr = ::SHGetDesktopFolder(shellFolder.init()); if (FAILED(hr) || !shellFolder) @@ -35,7 +35,7 @@ thumb::HICON thumb::getThumbnail(const wchar_t* filename, int requestedSize) //r PIDLIST_RELATIVE pidlFolder = NULL; { - const std::wstring pathName = beforeLast(filenameStr, '\\'); + const std::wstring& pathName = beforeLast(filenameStr, '\\'); HRESULT hr = shellFolder->ParseDisplayName(NULL, // [in] HWND hwnd, NULL, // [in] IBindCtx *pbc, const_cast<LPWSTR>(pathName.c_str()), // [in] LPWSTR pszDisplayName, @@ -45,9 +45,9 @@ thumb::HICON thumb::getThumbnail(const wchar_t* filename, int requestedSize) //r if (FAILED(hr) || !pidlFolder) return NULL; } - LOKI_ON_BLOCK_EXIT2(::ILFree(pidlFolder)); //older version: ::CoTaskMemFree + ZEN_ON_BLOCK_EXIT(::ILFree(pidlFolder)); //older version: ::CoTaskMemFree - util::ComPtr<IShellFolder> imageFolder; + ComPtr<IShellFolder> imageFolder; { HRESULT hr = shellFolder->BindToObject(pidlFolder, // [in] PCUIDLIST_RELATIVE pidl, NULL, @@ -58,7 +58,7 @@ thumb::HICON thumb::getThumbnail(const wchar_t* filename, int requestedSize) //r PIDLIST_RELATIVE pidImage = NULL; { - const std::wstring shortName = afterLast(filenameStr, '\\'); + const std::wstring& shortName = afterLast(filenameStr, '\\'); HRESULT hr = imageFolder->ParseDisplayName(NULL, // [in] HWND hwnd, NULL, // [in] IBindCtx *pbc, const_cast<LPWSTR>(shortName.c_str()), // [in] LPWSTR pszDisplayName, @@ -68,9 +68,9 @@ thumb::HICON thumb::getThumbnail(const wchar_t* filename, int requestedSize) //r if (FAILED(hr) || !pidImage) return NULL; } - LOKI_ON_BLOCK_EXIT2(::ILFree(pidImage)); //older version: ::CoTaskMemFree + ZEN_ON_BLOCK_EXIT(::ILFree(pidImage)); //older version: ::CoTaskMemFree - util::ComPtr<IExtractImage> extractImage; + ComPtr<IExtractImage> extractImage; { PCUITEMID_CHILD_ARRAY pidlIn = reinterpret_cast<PCUITEMID_CHILD_ARRAY>(&pidImage); //this is where STRICT_TYPED_ITEMIDS gets us ;) @@ -108,7 +108,7 @@ thumb::HICON thumb::getThumbnail(const wchar_t* filename, int requestedSize) //r if (FAILED(hr) || !bitmap) return NULL; } - LOKI_ON_BLOCK_EXIT2(::DeleteObject(bitmap)); + ZEN_ON_BLOCK_EXIT(::DeleteObject(bitmap)); BITMAP bmpInfo = {}; @@ -120,7 +120,7 @@ thumb::HICON thumb::getThumbnail(const wchar_t* filename, int requestedSize) //r HBITMAP bitmapMask = ::CreateCompatibleBitmap(::GetDC(NULL), bmpInfo.bmWidth, bmpInfo.bmHeight); if (bitmapMask == 0) return NULL; - LOKI_ON_BLOCK_EXIT2(::DeleteObject(bitmapMask)); + ZEN_ON_BLOCK_EXIT(::DeleteObject(bitmapMask)); ICONINFO iconInfo = {}; iconInfo.fIcon = true; @@ -135,7 +135,7 @@ thumb::HICON thumb::getIconByIndex(int iconIndex, int shilIconType) //return 0 o { //Note: using IExtractIcon::Extract is *no* alternative, just as ::SHGetFileInfo(), it only supports small (16x16) and large (32x32) icons - util::ComPtr<IImageList> imageList; //perf: 0,12 s only to get the image list + ComPtr<IImageList> imageList; //perf: 0,12 s only to get the image list { HRESULT hr = ::SHGetImageList(shilIconType, //__in int iImageList, IID_PPV_ARGS(imageList.init())); diff --git a/shared/Thumbnail/thumbnail.h b/lib/Thumbnail/thumbnail.h index ae62cf5d..3feec275 100644 --- a/shared/Thumbnail/thumbnail.h +++ b/lib/Thumbnail/thumbnail.h @@ -13,7 +13,7 @@ #define DLL_FUNCTION_DECLARATION extern "C" __declspec(dllimport) #endif -#include "../build_info.h" +#include <zen/build_info.h> //#include <WinDef.h> namespace thumb @@ -42,7 +42,7 @@ HICON getIconByIndex(int iconIndex, int shilIconType); //return 0 on failure, ca "iconType" refers to parameter "iImageList" of ::SHGetImageList(); sample values: SHIL_SMALL - 16x16, but the size can be customized by the user. SHIL_EXTRALARGE - 48x48, but the size can be customized by the user. - SHIL_JUMBO - Vista and later; normally 256x256 pixels + SHIL_JUMBO - 256x256 pixels; Vista and later only "iconIndex" as returned by ::SHGetFileInfo() */ @@ -62,7 +62,7 @@ const char getIconByIndexFctName [] = "getIconByIndex"; /*--------------- |library names| ---------------*/ -inline const wchar_t* getDllName() { return util::is64BitBuild ? L"Thumbnail_x64.dll" : L"Thumbnail_Win32.dll"; } +inline const wchar_t* getDllName() { return zen::is64BitBuild ? L"Thumbnail_x64.dll" : L"Thumbnail_Win32.dll"; } } #endif //TASKBAR_SEVEN_DLL_H diff --git a/library/binary.cpp b/lib/binary.cpp index 1e043d33..4fdf8899 100644 --- a/library/binary.cpp +++ b/lib/binary.cpp @@ -5,10 +5,10 @@ // ************************************************************************** #include "binary.h" -#include "../shared/file_io.h" -#include <vector> #include <wx/stopwatch.h> -#include "../shared/int64.h" +#include <vector> +#include <zen/file_io.h> +#include <zen/int64.h> #include <boost/thread/tss.hpp> inline diff --git a/library/binary.h b/lib/binary.h index 4dbbcd45..111af249 100644 --- a/library/binary.h +++ b/lib/binary.h @@ -7,9 +7,9 @@ #ifndef BINARY_H_INCLUDED #define BINARY_H_INCLUDED -#include "../shared/zstring.h" -#include "../shared/file_error.h" -#include "../shared/int64.h" +#include <zen/zstring.h> +#include <zen/file_error.h> +#include <zen/int64.h> namespace zen { diff --git a/library/cmp_filetime.h b/lib/cmp_filetime.h index 24b331c6..e8cd6f50 100644 --- a/library/cmp_filetime.h +++ b/lib/cmp_filetime.h @@ -2,7 +2,7 @@ #define CMP_FILETIME_H_INCLUDED #include <wx/stopwatch.h> -#include "../shared/int64.h" +#include <zen/int64.h> namespace zen { @@ -17,6 +17,10 @@ bool sameFileTime(const Int64& a, const Int64& b, size_t tolerance) } //--------------------------------------------------------------------------------------------------------------- +//number of seconds since Jan 1st 1970 + 1 year (needn't be too precise) +static const long oneYearFromNow = wxGetUTCTime() + 365 * 24 * 3600; //init at program startup -> avoid MT issues + + class CmpFileTime { public: @@ -36,9 +40,6 @@ public: if (lhs == rhs) return TIME_EQUAL; - //number of seconds since Jan 1st 1970 + 1 year (needn't be too precise) - static const long oneYearFromNow = wxGetUTCTime() + 365 * 24 * 3600; //static in header: not a big deal in this case! - //check for erroneous dates (but only if dates are not (EXACTLY) the same) if (lhs < 0 || lhs > oneYearFromNow) //earlier than Jan 1st 1970 or more than one year in future return TIME_LEFT_INVALID; diff --git a/library/custom_grid.cpp b/lib/custom_grid.cpp index b4d7af41..6da8b275 100644 --- a/library/custom_grid.cpp +++ b/lib/custom_grid.cpp @@ -7,19 +7,16 @@ #include "custom_grid.h" #include "resources.h" #include <wx/dc.h> -#include "../shared/util.h" -#include "../shared/string_conv.h" +#include <wx+/format_unit.h> +#include <wx+/string_conv.h> #include "resources.h" #include <typeinfo> #include "../ui/grid_view.h" #include "../synchronization.h" -#include "../shared/custom_tooltip.h" -#include "../shared/i18n.h" #include <wx/dcclient.h> #include <wx/icon.h> #include <wx/tooltip.h> #include <wx/settings.h> -#include "../shared/i18n.h" #ifdef FFS_WIN #include <wx/timer.h> @@ -271,21 +268,21 @@ protected: const FileSystemObject* fsObj = getRawData(row); if (fsObj) { - struct GetValue : public FSObjectVisitor + struct GetTextValue : public FSObjectVisitor { - GetValue(xmlAccess::ColumnTypes colType, const FileSystemObject& fso) : colType_(colType), fsObj_(fso) {} + GetTextValue(xmlAccess::ColumnTypes colType, const FileSystemObject& fso) : colType_(colType), fsObj_(fso) {} virtual void visit(const FileMapping& fileObj) { switch (colType_) { case xmlAccess::FULL_PATH: - value = toWx(fileObj.getFullName<side>().BeforeLast(FILE_NAME_SEPARATOR)); + value = toWx(beforeLast(fileObj.getFullName<side>(), FILE_NAME_SEPARATOR)); break; case xmlAccess::FILENAME: //filename value = toWx(fileObj.getShortName<side>()); break; case xmlAccess::REL_PATH: //relative path - value = toWx(fileObj.getObjRelativeName().BeforeLast(FILE_NAME_SEPARATOR)); //returns empty string if ch not found + value = toWx(beforeLast(fileObj.getObjRelativeName(), FILE_NAME_SEPARATOR)); //returns empty string if ch not found break; case xmlAccess::DIRECTORY: value = toWx(fileObj.getBaseDirPf<side>()); @@ -296,7 +293,7 @@ protected: break; case xmlAccess::DATE: //date if (!fsObj_.isEmpty<side>()) - value = zen::utcTimeToLocalString(fileObj.getLastWriteTime<side>()); + value = zen::utcToLocalTimeString(fileObj.getLastWriteTime<side>()); break; case xmlAccess::EXTENSION: //file extension value = toWx(fileObj.getExtension<side>()); @@ -309,13 +306,13 @@ protected: switch (colType_) { case xmlAccess::FULL_PATH: - value = toWx(linkObj.getFullName<side>().BeforeLast(FILE_NAME_SEPARATOR)); + value = toWx(beforeLast(linkObj.getFullName<side>(), FILE_NAME_SEPARATOR)); break; case xmlAccess::FILENAME: //filename value = toWx(linkObj.getShortName<side>()); break; case xmlAccess::REL_PATH: //relative path - value = toWx(linkObj.getObjRelativeName().BeforeLast(FILE_NAME_SEPARATOR)); //returns empty string if ch not found + value = toWx(beforeLast(linkObj.getObjRelativeName(), FILE_NAME_SEPARATOR)); //returns empty string if ch not found break; case xmlAccess::DIRECTORY: value = toWx(linkObj.getBaseDirPf<side>()); @@ -326,7 +323,7 @@ protected: break; case xmlAccess::DATE: //date if (!fsObj_.isEmpty<side>()) - value = zen::utcTimeToLocalString(linkObj.getLastWriteTime<side>()); + value = zen::utcToLocalTimeString(linkObj.getLastWriteTime<side>()); break; case xmlAccess::EXTENSION: //file extension value = wxEmptyString; @@ -345,7 +342,7 @@ protected: value = toWx(dirObj.getShortName<side>()); break; case xmlAccess::REL_PATH: - value = toWx(dirObj.getObjRelativeName().BeforeLast(FILE_NAME_SEPARATOR)); //returns empty string if ch not found + value = toWx(beforeLast(dirObj.getObjRelativeName(), FILE_NAME_SEPARATOR)); //returns empty string if ch not found break; case xmlAccess::DIRECTORY: value = toWx(dirObj.getBaseDirPf<side>()); @@ -1379,14 +1376,14 @@ void CustomGridRim::setTooltip(const wxMouseEvent& event) virtual void visit(const FileMapping& fileObj) { tipMsg_ = toWx(fileObj.getRelativeName<side>()) + "\n" + - _("Size") + ": " + zen::formatFilesizeToShortString(fileObj.getFileSize<side>()) + "\n" + - _("Date") + ": " + zen::utcTimeToLocalString(fileObj.getLastWriteTime<side>()); + _("Size") + ": " + zen::filesizeToShortString(fileObj.getFileSize<side>()) + "\n" + + _("Date") + ": " + zen::utcToLocalTimeString(fileObj.getLastWriteTime<side>()); } virtual void visit(const SymLinkMapping& linkObj) { tipMsg_ = toWx(linkObj.getRelativeName<side>()) + "\n" + - _("Date") + ": " + zen::utcTimeToLocalString(linkObj.getLastWriteTime<side>()); + _("Date") + ": " + zen::utcToLocalTimeString(linkObj.getLastWriteTime<side>()); } virtual void visit(const DirMapping& dirObj) @@ -1701,7 +1698,7 @@ void CustomGridRim::getIconsToBeLoaded(std::vector<Zstring>& newLoad) //loads al const int totalCols = const_cast<CustomGridTableRim*>(gridDataTable)->GetNumberCols(); const int totalRows = const_cast<CustomGridTableRim*>(gridDataTable)->GetNumberRows(); - //determine column + //determine column const int colFilename = [&]() -> int { for (int k = 0; k < totalCols; ++k) @@ -1718,7 +1715,7 @@ void CustomGridRim::getIconsToBeLoaded(std::vector<Zstring>& newLoad) //loads al const int firstRow = static_cast<int>(rowsOnScreen.first); const int rowNo = std::min(static_cast<int>(rowsOnScreen.second), totalRows) - firstRow; - for (int i = 0; i < rowNo; ++i) + for (int i = 0; i < rowNo; ++i) { //alternate when adding rows: first, last, first + 1, last - 1 ... -> Icon buffer will then load reversely, i.e. from inside out const int currentRow = firstRow + (i % 2 == 0 ? @@ -1922,11 +1919,10 @@ CustomGridMiddle::CustomGridMiddle(wxWindow* parent, selectionRowBegin(-1), selectionPos(BLOCKPOS_CHECK_BOX), highlightedRow(-1), - highlightedPos(BLOCKPOS_CHECK_BOX), - toolTip(new CustomTooltip) + highlightedPos(BLOCKPOS_CHECK_BOX) { SetLayoutDirection(wxLayout_LeftToRight); // - GetGridWindow()->SetLayoutDirection(wxLayout_LeftToRight); //avoid mirroring this dialog in RTL languages like Hebrew or Arabic + GetGridWindow ()->SetLayoutDirection(wxLayout_LeftToRight); //avoid mirroring this dialog in RTL languages like Hebrew or Arabic GetGridColLabelWindow()->SetLayoutDirection(wxLayout_LeftToRight); // //connect events for dynamic selection of sync direction @@ -2024,7 +2020,7 @@ void CustomGridMiddle::OnLeaveWindow(wxMouseEvent& event) Refresh(); //handle tooltip - toolTip->hide(); + toolTip.hide(); } @@ -2036,7 +2032,7 @@ void CustomGridMiddle::showToolTip(int rowNumber, wxPoint pos) const FileSystemObject* const fsObj = getGridDataTableMiddle()->getRawData(rowNumber); if (fsObj == NULL) //if invalid row... { - toolTip->hide(); + toolTip.hide(); return; } @@ -2046,33 +2042,33 @@ void CustomGridMiddle::showToolTip(int rowNumber, wxPoint pos) switch (syncOp) { case SO_CREATE_NEW_LEFT: - toolTip->show(getDescription(syncOp), pos, &GlobalResources::getImage(wxT("createLeft"))); + toolTip.show(getDescription(syncOp), pos, &GlobalResources::getImage(wxT("createLeft"))); break; case SO_CREATE_NEW_RIGHT: - toolTip->show(getDescription(syncOp), pos, &GlobalResources::getImage(wxT("createRight"))); + toolTip.show(getDescription(syncOp), pos, &GlobalResources::getImage(wxT("createRight"))); break; case SO_DELETE_LEFT: - toolTip->show(getDescription(syncOp), pos, &GlobalResources::getImage(wxT("deleteLeft"))); + toolTip.show(getDescription(syncOp), pos, &GlobalResources::getImage(wxT("deleteLeft"))); break; case SO_DELETE_RIGHT: - toolTip->show(getDescription(syncOp), pos, &GlobalResources::getImage(wxT("deleteRight"))); + toolTip.show(getDescription(syncOp), pos, &GlobalResources::getImage(wxT("deleteRight"))); break; case SO_OVERWRITE_LEFT: case SO_COPY_METADATA_TO_LEFT: - toolTip->show(getDescription(syncOp), pos, &GlobalResources::getImage(wxT("updateLeft"))); + toolTip.show(getDescription(syncOp), pos, &GlobalResources::getImage(wxT("updateLeft"))); break; case SO_OVERWRITE_RIGHT: case SO_COPY_METADATA_TO_RIGHT: - toolTip->show(getDescription(syncOp), pos, &GlobalResources::getImage(wxT("updateRight"))); + toolTip.show(getDescription(syncOp), pos, &GlobalResources::getImage(wxT("updateRight"))); break; case SO_DO_NOTHING: - toolTip->show(getDescription(syncOp), pos, &GlobalResources::getImage(wxT("none"))); + toolTip.show(getDescription(syncOp), pos, &GlobalResources::getImage(wxT("none"))); break; case SO_EQUAL: - toolTip->show(getDescription(syncOp), pos, &GlobalResources::getImage(wxT("equal"))); + toolTip.show(getDescription(syncOp), pos, &GlobalResources::getImage(wxT("equal"))); break; case SO_UNRESOLVED_CONFLICT: - toolTip->show(fsObj->getSyncOpConflict(), pos, &GlobalResources::getImage(wxT("conflict"))); + toolTip.show(fsObj->getSyncOpConflict(), pos, &GlobalResources::getImage(wxT("conflict"))); break; }; } @@ -2082,28 +2078,28 @@ void CustomGridMiddle::showToolTip(int rowNumber, wxPoint pos) switch (cmpRes) { case FILE_LEFT_SIDE_ONLY: - toolTip->show(getDescription(cmpRes), pos, &GlobalResources::getImage(wxT("leftOnly"))); + toolTip.show(getDescription(cmpRes), pos, &GlobalResources::getImage(wxT("leftOnly"))); break; case FILE_RIGHT_SIDE_ONLY: - toolTip->show(getDescription(cmpRes), pos, &GlobalResources::getImage(wxT("rightOnly"))); + toolTip.show(getDescription(cmpRes), pos, &GlobalResources::getImage(wxT("rightOnly"))); break; case FILE_LEFT_NEWER: - toolTip->show(getDescription(cmpRes), pos, &GlobalResources::getImage(wxT("leftNewer"))); + toolTip.show(getDescription(cmpRes), pos, &GlobalResources::getImage(wxT("leftNewer"))); break; case FILE_RIGHT_NEWER: - toolTip->show(getDescription(cmpRes), pos, &GlobalResources::getImage(wxT("rightNewer"))); + toolTip.show(getDescription(cmpRes), pos, &GlobalResources::getImage(wxT("rightNewer"))); break; case FILE_DIFFERENT: - toolTip->show(getDescription(cmpRes), pos, &GlobalResources::getImage(wxT("different"))); + toolTip.show(getDescription(cmpRes), pos, &GlobalResources::getImage(wxT("different"))); break; case FILE_EQUAL: - toolTip->show(getDescription(cmpRes), pos, &GlobalResources::getImage(wxT("equal"))); + toolTip.show(getDescription(cmpRes), pos, &GlobalResources::getImage(wxT("equal"))); break; case FILE_DIFFERENT_METADATA: - toolTip->show(getDescription(cmpRes), pos, &GlobalResources::getImage(wxT("conflict"))); + toolTip.show(getDescription(cmpRes), pos, &GlobalResources::getImage(wxT("conflict"))); break; case FILE_CONFLICT: - toolTip->show(fsObj->getCatConflict(), pos, &GlobalResources::getImage(wxT("conflict"))); + toolTip.show(fsObj->getCatConflict(), pos, &GlobalResources::getImage(wxT("conflict"))); break; } } diff --git a/library/custom_grid.h b/lib/custom_grid.h index a1bce692..47aad3e6 100644 --- a/library/custom_grid.h +++ b/lib/custom_grid.h @@ -9,6 +9,7 @@ #include <vector> #include <wx/grid.h> +#include <wx+/tooltip.h> #include "process_xml.h" #include <memory> #include <set> @@ -23,7 +24,6 @@ class CustomGridTableRight; class CustomGridTableMiddle; class GridCellRendererMiddle; class wxTimer; -class CustomTooltip; class CustomGridRim; class CustomGridLeft; class CustomGridMiddle; @@ -305,7 +305,7 @@ private: int highlightedRow; BlockPosition highlightedPos; - std::unique_ptr<CustomTooltip> toolTip; + zen::Tooltip toolTip; }; //custom events for middle grid: diff --git a/library/db_file.cpp b/lib/db_file.cpp index 268e411e..757a95d7 100644 --- a/library/db_file.cpp +++ b/lib/db_file.cpp @@ -8,19 +8,18 @@ #include <wx/wfstream.h> #include <wx/zstream.h> #include <wx/mstream.h> -#include "../shared/global_func.h" -#include "../shared/file_error.h" -#include "../shared/string_conv.h" -#include "../shared/file_handling.h" -#include "../shared/serialize.h" -#include "../shared/file_io.h" -#include "../shared/loki/ScopeGuard.h" -#include "../shared/i18n.h" +#include <zen/file_error.h> +#include <wx+/string_conv.h> +#include <zen/file_handling.h> +#include <wx+/serialize.h> +#include <zen/file_io.h> +#include <zen/scope_guard.h> +#include <zen/guid.h> #include <boost/bind.hpp> #ifdef FFS_WIN -#include <wx/msw/wrapwin.h> //includes "windows.h" -#include "../shared/long_path_prefix.h" +#include <zen/win.h> //includes "windows.h" +#include <zen/long_path_prefix.h> #endif using namespace zen; @@ -122,8 +121,8 @@ private: //attention: order of function argument evaluation is undefined! So do it one after the other... const Zstring shortName = readStringC<Zstring>(); //file name - const boost::int64_t modTime = readNumberC<boost::int64_t>(); - const boost::uint64_t fileSize = readNumberC<boost::uint64_t>(); + const std::int64_t modTime = readNumberC<std::int64_t>(); + const std::uint64_t fileSize = readNumberC<std::uint64_t>(); //const util::FileID fileIdentifier(stream_); //check(); @@ -136,10 +135,10 @@ private: void readSubLink(DirContainer& dirCont) const { //attention: order of function argument evaluation is undefined! So do it one after the other... - const Zstring shortName = readStringC<Zstring>(); //file name - const boost::int64_t modTime = readNumberC<boost::int64_t>(); - const Zstring targetPath = readStringC<Zstring>(); //file name - const LinkDescriptor::LinkType linkType = static_cast<LinkDescriptor::LinkType>(readNumberC<boost::int32_t>()); + const Zstring shortName = readStringC<Zstring>(); //file name + const std::int64_t modTime = readNumberC<std::int64_t>(); + const Zstring targetPath = readStringC<Zstring>(); //file name + const LinkDescriptor::LinkType linkType = static_cast<LinkDescriptor::LinkType>(readNumberC<std::int32_t>()); dirCont.addSubLink(shortName, LinkDescriptor(modTime, targetPath, linkType)); @@ -170,7 +169,7 @@ public: //| ensure 32/64 bit portability: used fixed size data types only e.g. boost::uint32_t | //|------------------------------------------------------------------------------------- - boost::int32_t version = readNumberC<boost::int32_t>(); + std::int32_t version = readNumberC<std::int32_t>(); if (version != FILE_FORMAT_VER) //read file format version throw FileError(_("Incompatible synchronization database format:") + " \n" + "\"" + filename.c_str() + "\""); @@ -309,8 +308,8 @@ private: { writeNumberC<bool>(true); //mark beginning of entry writeStringC(fileMap.getShortName<side>()); //save respecting case! (Windows) - writeNumberC<boost::int64_t >(to<boost::int64_t>(fileMap.getLastWriteTime<side>())); //last modification time - writeNumberC<boost::uint64_t>(to<boost::uint64_t>(fileMap.getFileSize<side>())); //filesize + writeNumberC<std:: int64_t>(to<std:: int64_t>(fileMap.getLastWriteTime<side>())); //last modification time + writeNumberC<std::uint64_t>(to<std::uint64_t>(fileMap.getFileSize<side>())); //filesize } } else //not in sync: reuse last synchronous state @@ -322,8 +321,8 @@ private: { writeNumberC<bool>(true); //mark beginning of entry writeStringC(iter->first); //save respecting case! (Windows) - writeNumberC<boost::int64_t >(to<boost::int64_t>(iter->second.lastWriteTimeRaw)); //last modification time - writeNumberC<boost::uint64_t>(to<boost::uint64_t>(iter->second.fileSize)); //filesize + writeNumberC<std:: int64_t>(to<std:: int64_t>(iter->second.lastWriteTimeRaw)); //last modification time + writeNumberC<std::uint64_t>(to<std::uint64_t>(iter->second.fileSize)); //filesize } } } @@ -337,9 +336,9 @@ private: { writeNumberC<bool>(true); //mark beginning of entry writeStringC(linkObj.getShortName<side>()); //save respecting case! (Windows) - writeNumberC<boost::int64_t>(to<boost::int64_t>(linkObj.getLastWriteTime<side>())); //last modification time + writeNumberC<std::int64_t>(to<std::int64_t>(linkObj.getLastWriteTime<side>())); //last modification time writeStringC(linkObj.getTargetPath<side>()); - writeNumberC<boost::int32_t>(linkObj.getLinkType<side>()); + writeNumberC<std::int32_t>(linkObj.getLinkType<side>()); } } else //not in sync: reuse last synchronous state @@ -351,9 +350,9 @@ private: { writeNumberC<bool>(true); //mark beginning of entry writeStringC(iter->first); //save respecting case! (Windows) - writeNumberC<boost::int64_t>(to<boost::int64_t>(iter->second.lastWriteTimeRaw)); //last modification time + writeNumberC<std::int64_t>(to<std::int64_t>(iter->second.lastWriteTimeRaw)); //last modification time writeStringC(iter->second.targetPath); - writeNumberC<boost::int32_t>(iter->second.type); + writeNumberC<std::int32_t>(iter->second.type); } } } @@ -426,7 +425,7 @@ public: WriteFileStream(const StreamMapping& streamList, const wxString& filename, wxOutputStream& stream) : WriteOutputStream(filename, stream) { //save file format version - writeNumberC<boost::int32_t>(FILE_FORMAT_VER); + writeNumberC<std::int32_t>(FILE_FORMAT_VER); writeNumberC<boost::uint32_t>(static_cast<boost::uint32_t>(streamList.size())); //number of database records: one for each sync-pair @@ -567,7 +566,7 @@ void zen::saveToDisk(const BaseDirMapping& baseMapping) //throw FileError } //create/update DirInfo-streams - std::string sessionID = util::generateGUID(); + std::string sessionID = zen::generateGUID(); //erase old session data if (streamLeft != streamListLeft.end()) @@ -580,10 +579,10 @@ void zen::saveToDisk(const BaseDirMapping& baseMapping) //throw FileError streamListRight.insert(std::make_pair(sessionID, newStreamRight)); //write (temp-) files... - Loki::ScopeGuard guardTempFileLeft = Loki::MakeGuard(&zen::removeFile, dbNameLeftTmp); + zen::ScopeGuard guardTempFileLeft = zen::makeGuard([&]() {zen::removeFile(dbNameLeftTmp); }); saveFile(streamListLeft, dbNameLeftTmp); //throw FileError - Loki::ScopeGuard guardTempFileRight = Loki::MakeGuard(&zen::removeFile, dbNameRightTmp); + zen::ScopeGuard guardTempFileRight = zen::makeGuard([&]() {zen::removeFile(dbNameRightTmp); }); saveFile(streamListRight, dbNameRightTmp); //throw FileError //operation finished: rename temp files -> this should work transactionally: @@ -593,6 +592,6 @@ void zen::saveToDisk(const BaseDirMapping& baseMapping) //throw FileError renameFile(dbNameLeftTmp, dbNameLeft); //throw FileError; renameFile(dbNameRightTmp, dbNameRight); //throw FileError; - guardTempFileLeft. Dismiss(); //no need to delete temp file anymore - guardTempFileRight.Dismiss(); // + guardTempFileLeft. dismiss(); //no need to delete temp file anymore + guardTempFileRight.dismiss(); // } diff --git a/library/db_file.h b/lib/db_file.h index 188d7d92..d6d765cc 100644 --- a/library/db_file.h +++ b/lib/db_file.h @@ -7,7 +7,7 @@ #ifndef DBFILE_H_INCLUDED #define DBFILE_H_INCLUDED -#include "../shared/file_error.h" +#include <zen/file_error.h> #include "../file_hierarchy.h" namespace zen diff --git a/library/detect_renaming.cpp b/lib/detect_renaming.cpp index 39e7eb4b..39e7eb4b 100644 --- a/library/detect_renaming.cpp +++ b/lib/detect_renaming.cpp diff --git a/library/detect_renaming.h b/lib/detect_renaming.h index e94927c0..e94927c0 100644 --- a/library/detect_renaming.h +++ b/lib/detect_renaming.h diff --git a/library/dir_exist_async.h b/lib/dir_exist_async.h index cab82aa2..72741ee2 100644 --- a/library/dir_exist_async.h +++ b/lib/dir_exist_async.h @@ -7,25 +7,32 @@ #ifndef DIR_EXIST_HEADER_08173281673432158067342132467183267 #define DIR_EXIST_HEADER_08173281673432158067342132467183267 -#include "../shared/check_exist.h" +#include <zen/thread.h> +#include <zen/file_handling.h> #include "status_handler.h" -#include "../shared/file_error.h" -#include "../shared/i18n.h" +#include <zen/file_error.h> +#include "resolve_path.h" //dir existence checking may hang for non-existent network drives => run asynchronously and update UI! namespace { -using namespace zen; //restricted to unnamed namespace! - -bool dirExistsUpdating(const Zstring& dirname, ProcessCallback& procCallback) +bool dirExistsUpdating(const Zstring& dirname, bool allowUserInteraction, ProcessCallback& procCallback) { - using namespace util; + using namespace zen; std::wstring statusText = _("Searching for directory %x..."); replace(statusText, L"%x", std::wstring(L"\"") + dirname + L"\"", false); procCallback.reportStatus(statusText); - auto ft = dirExistsAsync(dirname); + auto ft = async([=]() -> bool + { +#ifdef FFS_WIN + //1. login to network share, if necessary + loginNetworkShare(dirname, allowUserInteraction); +#endif + //2. check dir existence + return zen::dirExists(dirname); + }); while (!ft.timed_wait(boost::posix_time::milliseconds(UI_UPDATE_INTERVAL))) procCallback.requestUiRefresh(); //may throw! return ft.get(); diff --git a/library/dir_lock.cpp b/lib/dir_lock.cpp index 7feb51ff..29c7ffc6 100644 --- a/library/dir_lock.cpp +++ b/lib/dir_lock.cpp @@ -6,23 +6,21 @@ #include <wx/msgdlg.h> #include <memory> #include <boost/weak_ptr.hpp> -#include "../shared/string_conv.h" -#include "../shared/i18n.h" -#include "../shared/last_error.h" -#include "../shared/boost_thread_wrap.h" //include <boost/thread.hpp> -#include "../shared/loki/ScopeGuard.h" -#include "../shared/guid.h" -#include "../shared/file_io.h" -#include "../shared/assert_static.h" -#include "../shared/serialize.h" -#include "../shared/build_info.h" -#include "../shared/int64.h" -#include "../shared/file_handling.h" +#include <wx+/string_conv.h> +#include <zen/last_error.h> +#include <zen/thread.h> //includes <boost/thread.hpp> +#include <zen/scope_guard.h> +#include <zen/guid.h> +#include <zen/file_io.h> +#include <zen/assert_static.h> +#include <wx+/serialize.h> +#include <zen/int64.h> +#include <zen/file_handling.h> #ifdef FFS_WIN #include <tlhelp32.h> -#include <wx/msw/wrapwin.h> //includes "windows.h" -#include "../shared/long_path_prefix.h" +#include <zen/win.h> //includes "windows.h" +#include <zen/long_path_prefix.h> #elif defined FFS_LINUX #include <sys/stat.h> @@ -86,7 +84,7 @@ public: NULL); if (fileHandle == INVALID_HANDLE_VALUE) return; - LOKI_ON_BLOCK_EXIT2(::CloseHandle(fileHandle)); + ZEN_ON_BLOCK_EXIT(::CloseHandle(fileHandle)); const LARGE_INTEGER moveDist = {}; if (!::SetFilePointerEx(fileHandle, //__in HANDLE hFile, @@ -106,7 +104,7 @@ public: const int fileHandle = ::open(lockfilename_.c_str(), O_WRONLY | O_APPEND); //O_EXCL contains a race condition on NFS file systems: http://linux.die.net/man/2/open if (fileHandle == -1) return; - LOKI_ON_BLOCK_EXIT2(::close(fileHandle)); + ZEN_ON_BLOCK_EXIT(::close(fileHandle)); const ssize_t bytesWritten = ::write(fileHandle, buffer, 1); (void)bytesWritten; @@ -132,7 +130,9 @@ UInt64 getLockFileSize(const Zstring& filename) //throw FileError, ErrorNotExist std::wstring errorMessage = _("Error reading file attributes:") + "\n\"" + filename + "\"" + "\n\n" + getLastErrorFormatted(lastError); if (lastError == ERROR_FILE_NOT_FOUND || - lastError == ERROR_PATH_NOT_FOUND) + lastError == ERROR_PATH_NOT_FOUND || + lastError == ERROR_BAD_NETPATH || + lastError == ERROR_NETNAME_DELETED) throw ErrorNotExisting(errorMessage); else throw FileError(errorMessage); @@ -143,7 +143,7 @@ UInt64 getLockFileSize(const Zstring& filename) //throw FileError, ErrorNotExist return zen::UInt64(fileInfo.nFileSizeLow, fileInfo.nFileSizeHigh); #elif defined FFS_LINUX - struct stat fileInfo = {}; + struct ::stat fileInfo = {}; if (::stat(filename.c_str(), &fileInfo) != 0) //follow symbolic links { const int lastError = errno; @@ -167,7 +167,7 @@ Zstring deleteAbandonedLockName(const Zstring& lockfilename) //make sure to NOT return pos == Zstring::npos ? Zstr("Del.") + lockfilename : Zstring(lockfilename.c_str(), pos + 1) + //include path separator Zstr("Del.") + - lockfilename.AfterLast(FILE_NAME_SEPARATOR); //returns the whole string if ch not found + afterLast(lockfilename, FILE_NAME_SEPARATOR); //returns the whole string if ch not found } @@ -177,7 +177,7 @@ namespace inline std::string readString(wxInputStream& stream) //throw std::exception { - const auto strLength = readPOD<boost::uint32_t>(stream); + const auto strLength = readPOD<std::uint32_t>(stream); std::string output; if (strLength > 0) { @@ -191,7 +191,7 @@ std::string readString(wxInputStream& stream) //throw std::exception inline void writeString(wxOutputStream& stream, const std::string& str) //write string to filestream { - writePOD(stream, static_cast<boost::uint32_t>(str.length())); + writePOD(stream, static_cast<std::uint32_t>(str.length())); stream.Write(str.c_str(), str.length()); } @@ -212,7 +212,7 @@ struct LockInformation { LockInformation() { - lockId = util::generateGUID(); + lockId = zen::generateGUID(); #ifdef FFS_WIN procDescr.processId = ::GetCurrentProcessId(); #elif defined FFS_LINUX @@ -231,19 +231,19 @@ struct LockInformation //some format checking here? lockId = readString(stream); - procDescr.processId = static_cast<ProcessId>(readPOD<boost::uint64_t>(stream)); //possible loss of precision (32/64 bit process) covered by buildId + procDescr.processId = static_cast<ProcessId>(readPOD<std::uint64_t>(stream)); //possible loss of precision (32/64 bit process) covered by buildId procDescr.computerId = readString(stream); } void toStream(wxOutputStream& stream) const //write { - assert_static(sizeof(ProcessId) <= sizeof(boost::uint64_t)); //ensure portability + assert_static(sizeof(ProcessId) <= sizeof(std::uint64_t)); //ensure portability stream.Write(LOCK_FORMAT_DESCR, sizeof(LOCK_FORMAT_DESCR)); writePOD<boost::int32_t>(stream, LOCK_FORMAT_VER); writeString(stream, lockId); - writePOD<boost::uint64_t>(stream, procDescr.processId); + writePOD<std::uint64_t>(stream, procDescr.processId); writeString(stream, procDescr.computerId); } @@ -287,7 +287,7 @@ ProcessStatus getProcessStatus(const LockInformation::ProcessDescription& procDe 0); //__in DWORD th32ProcessID if (snapshot == INVALID_HANDLE_VALUE) return PROC_STATUS_NO_IDEA; - LOKI_ON_BLOCK_EXIT2(::CloseHandle(snapshot)); + ZEN_ON_BLOCK_EXIT(::CloseHandle(snapshot)); PROCESSENTRY32 processEntry = {}; processEntry.dwSize = sizeof(processEntry); @@ -311,7 +311,7 @@ ProcessStatus getProcessStatus(const LockInformation::ProcessDescription& procDe if (procDescr.processId <= 0 || procDescr.processId >= 65536) return PROC_STATUS_NO_IDEA; //invalid process id - return zen::dirExists(Zstr("/proc/") + Zstring::fromNumber(procDescr.processId)) ? PROC_STATUS_RUNNING : PROC_STATUS_NOT_RUNNING; + return zen::dirExists(Zstr("/proc/") + zen::toString<Zstring>(procDescr.processId)) ? PROC_STATUS_RUNNING : PROC_STATUS_NOT_RUNNING; #endif } @@ -441,7 +441,7 @@ bool tryLock(const Zstring& lockfilename) //throw FileError #ifdef FFS_WIN const HANDLE fileHandle = ::CreateFile(applyLongPathPrefix(lockfilename).c_str(), GENERIC_READ | GENERIC_WRITE, //use both when writing over network, see comment in file_io.cpp - FILE_SHARE_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 0, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, @@ -473,12 +473,12 @@ bool tryLock(const Zstring& lockfilename) //throw FileError ::close(fileHandle); #endif - Loki::ScopeGuard guardLockFile = Loki::MakeGuard(zen::removeFile, lockfilename); + zen::ScopeGuard guardLockFile = zen::makeGuard([&]() { zen::removeFile(lockfilename); }); //write UUID at the beginning of the file: this ID is a universal identifier for this lock (no matter what the path is, considering symlinks, etc.) writeLockInfo(lockfilename); //throw FileError - guardLockFile.Dismiss(); //lockfile created successfully + guardLockFile.dismiss(); //lockfile created successfully return true; } } @@ -584,10 +584,11 @@ private: DirLock::DirLock(const Zstring& lockfilename, DirLockCallback* callback) //throw FileError { #ifdef FFS_WIN - std::vector<wchar_t> volName(std::max(lockfilename.size(), static_cast<size_t>(10000))); + const DWORD bufferSize = std::max(lockfilename.size(), static_cast<size_t>(10000)); + std::vector<wchar_t> volName(bufferSize); if (::GetVolumePathName(lockfilename.c_str(), //__in LPCTSTR lpszFileName, &volName[0], //__out LPTSTR lpszVolumePathName, - static_cast<DWORD>(volName.size()))) //__in DWORD cchBufferLength + bufferSize)) //__in DWORD cchBufferLength { DWORD dt = ::GetDriveType(&volName[0]); if (dt == DRIVE_CDROM) diff --git a/library/dir_lock.h b/lib/dir_lock.h index 8cec9d69..c9a16c62 100644 --- a/library/dir_lock.h +++ b/lib/dir_lock.h @@ -1,8 +1,8 @@ #ifndef DIR_LOCK_H_INCLUDED #define DIR_LOCK_H_INCLUDED -#include "../shared/file_error.h" #include <memory> +#include <zen/file_error.h> struct DirLockCallback //while waiting for the lock diff --git a/shared/dir_name.cpp b/lib/dir_name.cpp index a14367c9..010fb218 100644 --- a/shared/dir_name.cpp +++ b/lib/dir_name.cpp @@ -9,12 +9,10 @@ #include <wx/window.h> #include <wx/textctrl.h> #include <wx/statbox.h> -#include "file_handling.h" +#include <zen/thread.h> +#include <zen/file_handling.h> #include "resolve_path.h" -#include "string_conv.h" -#include "check_exist.h" -#include "util.h" -#include "i18n.h" +#include <wx+/string_conv.h> #include "folder_history_box.h" using namespace zen; @@ -26,7 +24,7 @@ void setDirectoryNameImpl(const wxString& dirname, wxDirPickerCtrl* dirPicker, w { const wxString dirFormatted = toWx(getFormattedDirectoryName(toZ(dirname))); - tooltipWnd.SetToolTip(dirFormatted); //wxComboBox bug: the edit control is not updated... hope this will be fixed: http://trac.wxwidgets.org/ticket/12659 + tooltipWnd.SetToolTip(dirFormatted); //wxComboBox bug: the edit control is not updated... http://trac.wxwidgets.org/ticket/12659 if (staticBox) { @@ -39,10 +37,12 @@ void setDirectoryNameImpl(const wxString& dirname, wxDirPickerCtrl* dirPicker, w staticBox->GetStaticBox()->SetLabel(dirNormalized == dirFormatted ? wxString(_("Drag && drop")) : dirFormatted); } - if (dirPicker) + if (dirPicker && !dirFormatted.empty()) { - if (!dirFormatted.empty() && - util::dirExists(toZ(dirFormatted), timeout) == util::EXISTING_TRUE) //potentially slow network access: wait 200ms at most + Zstring dir = toZ(dirFormatted); //convert to Zstring first: we don't want to pass wxString by value and risk MT issues! + auto ft = async([=]() { return zen::dirExists(dir); }); + + if (ft.timed_wait(boost::posix_time::milliseconds(timeout)) && ft.get()) //potentially slow network access: wait 200ms at most dirPicker->SetPath(dirFormatted); } } @@ -169,6 +169,6 @@ void DirectoryName<NameControl>::setName(const wxString& dirname) } -//explicit template instantiation +//explicit template instantiations template class DirectoryName<wxTextCtrl>; template class DirectoryName<FolderHistoryBox>; diff --git a/shared/dir_name.h b/lib/dir_name.h index 7c7b3bc4..43f2015d 100644 --- a/shared/dir_name.h +++ b/lib/dir_name.h @@ -11,7 +11,7 @@ #include <wx/event.h> #include <wx/sizer.h> #include <wx/filepicker.h> -#include "file_drop.h" +#include <wx+/file_drop.h> namespace zen { diff --git a/library/error_log.cpp b/lib/error_log.cpp index 28819f40..fe423479 100644 --- a/library/error_log.cpp +++ b/lib/error_log.cpp @@ -6,10 +6,10 @@ #include "error_log.h" #include <wx/datetime.h> -#include "../shared/i18n.h" +#include <zen/i18n.h> +#include <algorithm> - -using zen::ErrorLogging; +using namespace zen; void ErrorLogging::logMsg(const wxString& message, zen::MessageType type) @@ -25,30 +25,33 @@ void ErrorLogging::logMsg(const wxString& message, zen::MessageType type) } -int ErrorLogging::typeCount(int types) const +int ErrorLogging::typeCount(int typeFilter) const { int count = 0; - if (types & TYPE_INFO) + if (typeFilter & TYPE_INFO) count += statistics[TYPE_INFO]; - if (types & TYPE_WARNING) + if (typeFilter & TYPE_WARNING) count += statistics[TYPE_WARNING]; - if (types & TYPE_ERROR) + if (typeFilter & TYPE_ERROR) count += statistics[TYPE_ERROR]; - if (types & TYPE_FATAL_ERROR) + if (typeFilter & TYPE_FATAL_ERROR) count += statistics[TYPE_FATAL_ERROR]; return count; } -std::vector<wxString> ErrorLogging::getFormattedMessages(int types) const +std::vector<wxString> ErrorLogging::getFormattedMessages(int typeFilter) const { std::vector<wxString> output; - for (std::vector<Entry>::const_iterator i = messages.begin(); i != messages.end(); ++i) - if (i->type & types) - output.push_back(formatMessage(*i)); + std::for_each(messages.begin(), messages.end(), + [&](const Entry& entry) + { + if (entry.type & typeFilter) + output.push_back(formatMessage(entry)); + }); return output; } diff --git a/library/error_log.h b/lib/error_log.h index f8a0c909..a0b7ab90 100644 --- a/library/error_log.h +++ b/lib/error_log.h @@ -7,10 +7,9 @@ #ifndef ERRORLOGGING_H_INCLUDED #define ERRORLOGGING_H_INCLUDED -#include <wx/string.h> -#include <vector> #include <map> - +#include <vector> +#include <wx/string.h> namespace zen { @@ -27,16 +26,16 @@ class ErrorLogging public: void logMsg(const wxString& message, MessageType type); - int typeCount(int types = TYPE_INFO | TYPE_WARNING | TYPE_ERROR | TYPE_FATAL_ERROR) const; + int typeCount(int typeFilter = TYPE_INFO | TYPE_WARNING | TYPE_ERROR | TYPE_FATAL_ERROR) const; - std::vector<wxString> getFormattedMessages(int types = TYPE_INFO | TYPE_WARNING | TYPE_ERROR | TYPE_FATAL_ERROR) const; + std::vector<wxString> getFormattedMessages(int typeFilter = TYPE_INFO | TYPE_WARNING | TYPE_ERROR | TYPE_FATAL_ERROR) const; private: struct Entry { MessageType type; time_t time; - wxString message; + wxString message; }; static wxString formatMessage(const Entry& msg); diff --git a/shared/standard_paths.cpp b/lib/ffs_paths.h index c2d79516..faecd2e2 100644 --- a/shared/standard_paths.cpp +++ b/lib/ffs_paths.h @@ -4,22 +4,48 @@ // * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** -#include "standard_paths.h" +#ifndef STANDARDPATHS_H_INCLUDED +#define STANDARDPATHS_H_INCLUDED + #include <wx/stdpaths.h> -#include "string_conv.h" +#include <zen/zstring.h> +#include <wx+/string_conv.h> + +namespace zen +{ +//------------------------------------------------------------------------------ +//global program directories +//------------------------------------------------------------------------------ +wxString getResourceDir(); //resource directory WITH path separator at end +wxString getConfigDir(); //config directory WITH path separator at end +//------------------------------------------------------------------------------ + +wxString getLauncher(); //full path to application launcher C:\...\FreeFileSync.exe +bool isPortableVersion(); + + + + -using namespace zen; -namespace + + + + + +//---------------- implementation ---------------- +namespace impl { +inline const wxString& getBinaryDir() //directory containing executable WITH path separator at end { - static wxString instance = beforeLast(wxStandardPaths::Get().GetExecutablePath(), FILE_NAME_SEPARATOR) + toWx(Zstring(FILE_NAME_SEPARATOR)); + static wxString instance = beforeLast(wxStandardPaths::Get().GetExecutablePath(), FILE_NAME_SEPARATOR) + toWx(Zstring(FILE_NAME_SEPARATOR)); //extern linkage! return instance; } #ifdef FFS_WIN +inline wxString getInstallDir() //root install directory WITH path separator at end { return getBinaryDir().BeforeLast(FILE_NAME_SEPARATOR).BeforeLast(FILE_NAME_SEPARATOR) + FILE_NAME_SEPARATOR; @@ -28,24 +54,26 @@ wxString getInstallDir() //root install directory WITH path separator at end } -bool zen::isPortableVersion() +inline +bool isPortableVersion() { #ifdef FFS_WIN - static const bool isPortable = !wxFileExists(getInstallDir() + wxT("uninstall.exe")); //this check is a bit lame... + static const bool isPortable = !wxFileExists(impl::getInstallDir() + wxT("uninstall.exe")); //this check is a bit lame... #elif defined FFS_LINUX - static const bool isPortable = !::getBinaryDir().EndsWith(wxT("/bin/")); //this check is a bit lame... + static const bool isPortable = !impl::getBinaryDir().EndsWith(wxT("/bin/")); //this check is a bit lame... #endif return isPortable; } -wxString zen::getResourceDir() +inline +wxString getResourceDir() { #ifdef FFS_WIN - return getInstallDir(); + return impl::getInstallDir(); #elif defined FFS_LINUX if (isPortableVersion()) - return getBinaryDir(); + return impl::getBinaryDir(); else //use OS' standard paths { wxString resourceDir = wxStandardPathsBase::Get().GetResourcesDir(); @@ -59,15 +87,16 @@ wxString zen::getResourceDir() } -wxString zen::getConfigDir() +inline +wxString getConfigDir() { if (isPortableVersion()) #ifdef FFS_WIN - return getInstallDir(); + return impl::getInstallDir(); #elif defined FFS_LINUX //wxString(wxT(".")) + zToWx(FILE_NAME_SEPARATOR) -> don't use current working directory //avoid surprises with GlobalSettings.xml being newly created in each working directory - return getBinaryDir(); + return impl::getBinaryDir(); #endif else //use OS' standard paths { @@ -84,11 +113,15 @@ wxString zen::getConfigDir() } -wxString zen::getLauncher() +inline +wxString getLauncher() { #ifdef FFS_WIN - return getInstallDir() + wxT("FreeFileSync.exe"); + return impl::getInstallDir() + wxT("FreeFileSync.exe"); #elif defined FFS_LINUX - return getBinaryDir() + wxT("FreeFileSync"); + return impl::getBinaryDir() + wxT("FreeFileSync"); #endif } +} + +#endif // STANDARDPATHS_H_INCLUDED diff --git a/shared/folder_history_box.cpp b/lib/folder_history_box.cpp index f787e2cb..b395cbf4 100644 --- a/shared/folder_history_box.cpp +++ b/lib/folder_history_box.cpp @@ -5,11 +5,12 @@ // ************************************************************************** #include "folder_history_box.h" -#include "resolve_path.h" #include <list> +#include "resolve_path.h" using namespace zen; + FolderHistoryBox::FolderHistoryBox(wxWindow* parent, wxWindowID id, const wxString& value, @@ -60,8 +61,10 @@ void FolderHistoryBox::OnHideDropDown(wxCommandEvent& event) #endif -void FolderHistoryBox::update() +void FolderHistoryBox::update(const wxString& dirname) { + //it may be a little lame to update the list on each mouse-button click, but it should be working and we dont't have to manipulate wxComboBox internals + std::list<Zstring> dirList; //add some aliases to allow user changing to volume name and back, if possible @@ -83,16 +86,16 @@ void FolderHistoryBox::update() } //########################################################################################### - - //it may be a little lame to update the list on each mouse-button click, but it should be working and we dont't have to manipulate wxComboBox internals - const wxString oldVal = this->GetValue(); + //attention: if the target value is not part of the dropdown list, SetValue() will look for a string that *starts with* this value: + //e.g. if the dropdown list contains "222" SetValue("22") will erroneously set and select "222" instead, while "111" would be set correctly! + // -> by design on Windows! + if (std::find(dirList.begin(), dirList.end(), toZ(dirname)) == dirList.end()) + dirList.push_front(toZ(dirname)); Clear(); - std::for_each(dirList.begin(), dirList.end(), - [&](const Zstring& dir) { this->Append(toWx(dir)); }); - - this->SetSelection(wxNOT_FOUND); //don't select anything - this->SetValue(oldVal); //but preserve main text! + std::for_each(dirList.begin(), dirList.end(), [&](const Zstring& dir) { this->Append(toWx(dir)); }); + //this->SetSelection(wxNOT_FOUND); //don't select anything + this->SetValue(dirname); //preserve main text! } diff --git a/shared/folder_history_box.h b/lib/folder_history_box.h index 3b4fd57e..28b85c90 100644 --- a/shared/folder_history_box.h +++ b/lib/folder_history_box.h @@ -9,12 +9,11 @@ #include <wx/combobox.h> #include <memory> -#include "zstring.h" -#include "string_conv.h" -#include "stl_tools.h" +#include <zen/zstring.h> +#include <wx+/string_conv.h> +#include <zen/stl_tools.h> //combobox with history function + functionality to delete items (DEL) -using namespace zen; class FolderHistory @@ -54,7 +53,7 @@ public: dirnames_.resize(maxSize_); } - void delItem(const Zstring& dirname) { vector_remove_if(dirnames_, [&](const Zstring& entry) { return ::EqualFilename()(entry, dirname); }); } + void delItem(const Zstring& dirname) { zen::vector_remove_if(dirnames_, [&](const Zstring& entry) { return ::EqualFilename()(entry, dirname); }); } private: @@ -81,9 +80,7 @@ public: void setValue(const wxString& dirname) { - SetSelection(wxNOT_FOUND); - SetValue(dirname); - update(); //required for Linux to ensure the dropdown is shown as being populated + update(dirname); //required for setting value correctly + Linux to ensure the dropdown is shown as being populated } // GetValue @@ -91,9 +88,9 @@ public: private: void OnKeyEvent(wxKeyEvent& event); void OnSelection(wxCommandEvent& event); - void OnUpdateList(wxEvent& event) { update(); event.Skip(); } + void OnUpdateList(wxEvent& event) { update(GetValue()); event.Skip(); } - void update(); + void update(const wxString& dirname); #if wxCHECK_VERSION(2, 9, 1) void OnShowDropDown(wxCommandEvent& event); diff --git a/library/hard_filter.cpp b/lib/hard_filter.cpp index 56fb091b..ee744337 100644 --- a/library/hard_filter.cpp +++ b/lib/hard_filter.cpp @@ -5,24 +5,25 @@ // ************************************************************************** #include "hard_filter.h" -#include "../shared/zstring.h" +#include <zen/zstring.h> #include <wx/string.h> #include <set> #include <stdexcept> #include <vector> #include "../structures.h" -#include <boost/bind.hpp> -#include "../shared/loki/LokiTypeInfo.h" -#include "../shared/serialize.h" +#include <wx+/serialize.h> +#include <typeinfo> using namespace zen; +//inline bool operator<(const std::type_info& lhs, const std::type_info& rhs) { return lhs.before(rhs) != 0; } -> not working on GCC :( + //-------------------------------------------------------------------------------------------------- bool zen::operator<(const HardFilter& lhs, const HardFilter& rhs) { - if (Loki::TypeInfo(typeid(lhs)) != typeid(rhs)) - return Loki::TypeInfo(typeid(lhs)) < typeid(rhs); + if (typeid(lhs) != typeid(rhs)) + return typeid(lhs).before(typeid(rhs)) != 0; //note: in worst case, order is guaranteed to be stable only during each program run //this and other are same type: return lhs.cmpLessSameType(rhs); @@ -75,32 +76,32 @@ void addFilterEntry(const Zstring& filtername, std::set<Zstring>& fileFilter, st //-------------------------------------------------------------------------------------------------- //add some syntactic sugar: handle beginning of filtername - if (filterFormatted.StartsWith(FILE_NAME_SEPARATOR)) + if (startsWith(filterFormatted, FILE_NAME_SEPARATOR)) { //remove leading separators (keep BEFORE test for Zstring::empty()!) - filterFormatted = filterFormatted.AfterFirst(FILE_NAME_SEPARATOR); + filterFormatted = afterFirst(filterFormatted, FILE_NAME_SEPARATOR); } - else if (filterFormatted.StartsWith(asteriskSep) || // *\abc - filterFormatted.StartsWith(questionMarkSep)) // ?\abc + else if (startsWith(filterFormatted, asteriskSep) || // *\abc + startsWith(filterFormatted, questionMarkSep)) // ?\abc { addFilterEntry(Zstring(filterFormatted.c_str() + 1), fileFilter, directoryFilter); //prevent further recursion by prefix } //-------------------------------------------------------------------------------------------------- //even more syntactic sugar: handle end of filtername - if (filterFormatted.EndsWith(FILE_NAME_SEPARATOR)) + if (endsWith(filterFormatted, FILE_NAME_SEPARATOR)) { - const Zstring candidate = filterFormatted.BeforeLast(FILE_NAME_SEPARATOR); + const Zstring candidate = beforeLast(filterFormatted, FILE_NAME_SEPARATOR); if (!candidate.empty()) directoryFilter.insert(candidate); //only relevant for directory filtering } - else if (filterFormatted.EndsWith(sepAsterisk) || // abc\* - filterFormatted.EndsWith(sepQuestionMark)) // abc\? + else if (endsWith(filterFormatted, sepAsterisk) || // abc\* + endsWith(filterFormatted, sepQuestionMark)) // abc\? { fileFilter.insert( filterFormatted); directoryFilter.insert(filterFormatted); - const Zstring candidate = filterFormatted.BeforeLast(FILE_NAME_SEPARATOR); + const Zstring candidate = beforeLast(filterFormatted, FILE_NAME_SEPARATOR); if (!candidate.empty()) directoryFilter.insert(candidate); //only relevant for directory filtering } @@ -114,8 +115,7 @@ void addFilterEntry(const Zstring& filtername, std::set<Zstring>& fileFilter, st namespace { -template <class T> -inline +template <class T> inline const T* cStringFind(const T* str1, T ch) //strchr() { while (*str1 != ch) //ch is allowed to be 0 by contract! must return end of string in this case diff --git a/library/hard_filter.h b/lib/hard_filter.h index bb0b6d54..e128a9df 100644 --- a/library/hard_filter.h +++ b/lib/hard_filter.h @@ -7,10 +7,10 @@ #ifndef FFS_FILTER_H_INCLUDED #define FFS_FILTER_H_INCLUDED -#include "../shared/zstring.h" #include <set> #include <memory> #include <wx/stream.h> +#include <zen/zstring.h> namespace zen { diff --git a/lib/help_provider.h b/lib/help_provider.h new file mode 100644 index 00000000..9baf9303 --- /dev/null +++ b/lib/help_provider.h @@ -0,0 +1,59 @@ +// ************************************************************************** +// * This file is part of the FreeFileSync project. It is distributed under * +// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** + +#ifndef HELPPROVIDER_H_INCLUDED +#define HELPPROVIDER_H_INCLUDED + +#include <wx/help.h> +#include "ffs_paths.h" + +namespace zen +{ +void displayHelpEntry(const wxString& section = wxEmptyString); + + + + + + + + + + + + + +//######################## implementation ######################## +inline +wxHelpController& getHelpCtrl() +{ + static wxHelpController controller; //external linkage, despite inline definition! + static bool initialized = false; + if (!initialized) + { + initialized = true; + controller.Initialize(zen::getResourceDir() + +#ifdef FFS_WIN + L"FreeFileSync.chm"); +#elif defined FFS_LINUX + L"Help/FreeFileSync.hhp"); +#endif + } + return controller; +} + + +inline +void displayHelpEntry(const wxString& section) +{ + if (section.empty()) + getHelpCtrl().DisplayContents(); + else + getHelpCtrl().DisplaySection(section); +} +} + +#endif // HELPPROVIDER_H_INCLUDED diff --git a/library/icon_buffer.cpp b/lib/icon_buffer.cpp index b8ee66cd..bb75a538 100644 --- a/library/icon_buffer.cpp +++ b/lib/icon_buffer.cpp @@ -7,14 +7,15 @@ #include "icon_buffer.h" #include <queue> #include <set> -#include "../shared/boost_thread_wrap.h" //include <boost/thread.hpp> -#include "../shared/loki/ScopeGuard.h" +#include <zen/thread.h> //includes <boost/thread.hpp> +#include <zen/scope_guard.h> #include <boost/thread/once.hpp> #ifdef FFS_WIN -#include <wx/msw/wrapwin.h> //includes "windows.h" -#include "../shared/dll_loader.h" -#include "../shared/Thumbnail/thumbnail.h" +#include <zen/win.h> //includes "windows.h" +#include <zen/dll.h> +#include "Thumbnail/thumbnail.h" +#include <zen/win_ver.h> #elif defined FFS_LINUX #include <giomm/file.h> @@ -97,12 +98,13 @@ public: #ifdef FFS_WIN newIcon.SetHICON(clone.handle_); - { //this block costs ~0.04 ms + { + //this block costs ~0.04 ms ICONINFO icoInfo = {}; if (::GetIconInfo(clone.handle_, &icoInfo)) { ::DeleteObject(icoInfo.hbmMask); //nice potential for a GDI leak! - LOKI_ON_BLOCK_EXIT2(::DeleteObject(icoInfo.hbmColor)); // + ZEN_ON_BLOCK_EXIT(::DeleteObject(icoInfo.hbmColor)); // BITMAP bmpInfo = {}; if (::GetObject(icoInfo.hbmColor, //__in HGDIOBJ hgdiobj, @@ -147,7 +149,7 @@ Zstring getFileExtension(const Zstring& filename) const Zstring shortName = afterLast(filename, Zchar('\\')); //warning: using windows file name separator! return shortName.find(Zchar('.')) != Zstring::npos ? - filename.AfterLast(Zchar('.')) : + afterLast(filename, Zchar('.')) : Zstring(); } @@ -173,21 +175,6 @@ bool isCheapExtension(const Zstring& extension) } -bool vistaOrLater() -{ - OSVERSIONINFO osvi = {}; - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - - //IFileOperation is supported with Vista and later - if (::GetVersionEx(&osvi)) - return osvi.dwMajorVersion > 5; - //XP has majorVersion == 5, minorVersion == 1 - //Vista has majorVersion == 6, minorVersion == 0 - //version overview: http://msdn.microsoft.com/en-us/library/ms724834(VS.85).aspx - return false; -} - - bool wereVistaOrLater = false; boost::once_flag initVistaFlagOnce = BOOST_ONCE_INIT; @@ -213,7 +200,7 @@ int getShilIconType(IconBuffer::IconSize sz) } -util::DllFun<thumb::GetIconByIndexFct> getIconByIndex; +DllFun<thumb::GetIconByIndexFct> getIconByIndex; boost::once_flag initGetIconByIndexOnce = BOOST_ONCE_INIT; @@ -232,7 +219,7 @@ IconHolder getIconByAttribute(LPCWSTR pszPath, DWORD dwFileAttributes, IconBuffe boost::call_once(initGetIconByIndexOnce, []() //thread-safe init { - getIconByIndex = util::DllFun<thumb::GetIconByIndexFct>(thumb::getDllName(), thumb::getIconByIndexFctName); + getIconByIndex = DllFun<thumb::GetIconByIndexFct>(thumb::getDllName(), thumb::getIconByIndexFctName); }); return getIconByIndex ? static_cast<HICON>(getIconByIndex(fileInfo.iIcon, getShilIconType(sz))) : NULL; } @@ -245,7 +232,7 @@ IconHolder getAssociatedIconByExt(const Zstring& extension, IconBuffer::IconSize } -util::DllFun<thumb::GetThumbnailFct> getThumbnailIcon; +DllFun<thumb::GetThumbnailFct> getThumbnailIcon; boost::once_flag initThumbnailOnce = BOOST_ONCE_INIT; } #endif @@ -259,7 +246,7 @@ IconHolder getThumbnail(const Zstring& filename, int requestedSize) //return 0 o boost::call_once(initThumbnailOnce, []() //note: "getThumbnail" function itself is already thread-safe { - getThumbnailIcon = util::DllFun<GetThumbnailFct>(getDllName(), getThumbnailFctName); + getThumbnailIcon = DllFun<GetThumbnailFct>(getDllName(), getThumbnailFctName); }); return getThumbnailIcon ? static_cast< ::HICON>(getThumbnailIcon(filename.c_str(), requestedSize)) : NULL; @@ -322,7 +309,7 @@ IconHolder getAssociatedIcon(const Zstring& filename, IconBuffer::IconSize sz) boost::call_once(initGetIconByIndexOnce, []() //thread-safe init { - getIconByIndex = util::DllFun<thumb::GetIconByIndexFct>(thumb::getDllName(), thumb::getIconByIndexFctName); + getIconByIndex = DllFun<thumb::GetIconByIndexFct>(thumb::getDllName(), thumb::getIconByIndexFctName); }); return getIconByIndex ? static_cast<HICON>(getIconByIndex(fileInfo.iIcon, getShilIconType(sz))) : NULL; @@ -519,11 +506,11 @@ void WorkerThread::operator()() //thread entry //1. Initialize COM ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); - LOKI_ON_BLOCK_EXIT2(::CoUninitialize()); + ZEN_ON_BLOCK_EXIT(::CoUninitialize()); //2. Initialize system image list typedef BOOL (WINAPI *FileIconInitFun)(BOOL fRestoreCache); - const util::DllFun<FileIconInitFun> fileIconInit(L"Shell32.dll", reinterpret_cast<LPCSTR>(660)); + const SysDllFun<FileIconInitFun> fileIconInit(L"Shell32.dll", reinterpret_cast<LPCSTR>(660)); assert(fileIconInit); if (fileIconInit) fileIconInit(false); //TRUE to restore the system image cache from disk; FALSE otherwise. diff --git a/library/icon_buffer.h b/lib/icon_buffer.h index cbd582f2..be8a02d8 100644 --- a/library/icon_buffer.h +++ b/lib/icon_buffer.h @@ -7,9 +7,9 @@ #ifndef ICONBUFFER_H_INCLUDED #define ICONBUFFER_H_INCLUDED -#include "../shared/zstring.h" #include <memory> #include <wx/icon.h> +#include <zen/zstring.h> namespace zen diff --git a/shared/localization.cpp b/lib/localization.cpp index 73aa5b72..774ee9ec 100644 --- a/shared/localization.cpp +++ b/lib/localization.cpp @@ -14,13 +14,13 @@ #include <wx/msgdlg.h> #include "parse_plural.h" #include "parse_lng.h" -#include "util.h" -#include "string_tools.h" -#include "file_traverser.h" -#include "standard_paths.h" -#include "string_conv.h" -#include "zenXml/zenxml_io.h" -#include "i18n.h" +#include <wx+/format_unit.h> +#include <zen/string_tools.h> +#include <zen/file_traverser.h> +#include "ffs_paths.h" +#include <wx+/string_conv.h> +#include <zenxml/io.h> +#include <zen/i18n.h> using namespace zen; @@ -132,7 +132,7 @@ public: } 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>(); } + virtual ReturnValDir onDir(const Zchar* shortName, const Zstring& fullName) { return Int2Type<ReturnValDir::TRAVERSING_DIR_IGNORE>(); } virtual HandleError onError(const std::wstring& errorText) { return TRAV_ERROR_IGNORE; } //errors are not really critical in this context private: @@ -185,7 +185,6 @@ ExistingTranslations::ExistingTranslations() traverseCallback); for (auto i = lngFiles.begin(); i != lngFiles.end(); ++i) - { try { std::string stream = loadStream(*i);; //throw XmlFileError @@ -209,7 +208,6 @@ ExistingTranslations::ExistingTranslations() catch (lngfile::ParsingError&) {} } catch (...) {} - } std::sort(locMapping.begin(), locMapping.end(), LessTranslation()); } diff --git a/shared/localization.h b/lib/localization.h index 438ad445..438ad445 100644 --- a/shared/localization.h +++ b/lib/localization.h diff --git a/library/lock_holder.h b/lib/lock_holder.h index b72b12c1..a7cf3436 100644 --- a/library/lock_holder.h +++ b/lib/lock_holder.h @@ -2,7 +2,7 @@ #define LOCK_HOLDER_H_INCLUDED #include <map> -#include "../shared/zstring.h" +#include <zen/zstring.h> #include "dir_lock.h" #include "status_handler.h" #include "dir_exist_async.h" @@ -15,16 +15,18 @@ const Zstring LOCK_FILE_ENDING = Zstr(".ffs_lock"); //intermediate locks created class LockHolder { public: + LockHolder(bool allowUserInteraction) : allowUserInteraction_(allowUserInteraction) {} + void addDir(const Zstring& dirnameFmt, ProcessCallback& procCallback) //resolved dirname ending with path separator { if (dirnameFmt.empty()) return; - if (!dirExistsUpdating(dirnameFmt, procCallback)) + if (!dirExistsUpdating(dirnameFmt, allowUserInteraction_, procCallback)) return; if (lockHolder.find(dirnameFmt) != lockHolder.end()) return; - assert(dirnameFmt.EndsWith(FILE_NAME_SEPARATOR)); //this is really the contract, formatting does other things as well, e.g. macro substitution + assert(endsWith(dirnameFmt, FILE_NAME_SEPARATOR)); //this is really the contract, formatting does other things as well, e.g. macro substitution class WaitOnLockHandler : public DirLockCallback { @@ -50,6 +52,7 @@ public: private: typedef std::map<Zstring, DirLock, LessFilename> DirnameLockMap; DirnameLockMap lockHolder; + const bool allowUserInteraction_; }; } diff --git a/library/norm_filter.h b/lib/norm_filter.h index 609c81db..d95fbe35 100644 --- a/library/norm_filter.h +++ b/lib/norm_filter.h @@ -12,7 +12,6 @@ namespace zen { - struct NormalizedFilter //grade-a filter: global/local filter settings combined, units resolved, ready for use { NormalizedFilter(const HardFilter::FilterRef& hf, const SoftFilter& sf) : nameFilter(hf), timeSizeFilter(sf) {} @@ -22,8 +21,8 @@ struct NormalizedFilter //grade-a filter: global/local filter settings combined, //"soft" filter: relevant after comparison; equivalent to user selection SoftFilter timeSizeFilter; }; -namespace -{ + + //combine global and local filters via "logical and" NormalizedFilter normalizeFilters(const FilterConfig& global, const FilterConfig& local); @@ -63,19 +62,8 @@ bool isNullFilter(const FilterConfig& filterCfg) - - - - - - - - - - - - // ----------------------- implementation ----------------------- +inline NormalizedFilter normalizeFilters(const FilterConfig& global, const FilterConfig& local) { HardFilter::FilterRef globalName(new NameFilter(global.includeFilter, global.excludeFilter)); @@ -93,6 +81,5 @@ NormalizedFilter normalizeFilters(const FilterConfig& global, const FilterConfig combineFilters(globalTimeSize, localTimeSize)); } } -} #endif //NORM_FILTER_H_INCLUDED diff --git a/library/parallel_scan.cpp b/lib/parallel_scan.cpp index 2c24600f..29d87ee7 100644 --- a/library/parallel_scan.cpp +++ b/lib/parallel_scan.cpp @@ -8,22 +8,12 @@ #include <boost/detail/atomic_count.hpp> #include "db_file.h" #include "lock_holder.h" -#include "../shared/i18n.h" -#include "../shared/file_traverser.h" -#include "../shared/file_error.h" -#include "../shared/string_conv.h" -#include "../shared/boost_thread_wrap.h" //include <boost/thread.hpp> -#include "loki/ScopeGuard.h" -//#include "../shared/file_id.h" +#include <zen/file_traverser.h> +#include <zen/file_error.h> +#include <wx+/string_conv.h> +#include <zen/thread.h> //includes <boost/thread.hpp> +#include <zen/scope_guard.h> -/* -#ifdef FFS_WIN -#include <wx/msw/wrapwin.h> //includes "windows.h" -#include "WinIoCtl.h" - -#elif defined FFS_LINUX -#endif -*/ using namespace zen; @@ -101,7 +91,7 @@ DiskInfo retrieveDiskInfo(const Zstring& pathName) NULL); if (hVolume == INVALID_HANDLE_VALUE) return output; - LOKI_ON_BLOCK_EXIT2(::CloseHandle(hVolume)); + ZEN_ON_BLOCK_EXIT(::CloseHandle(hVolume)); std::vector<char> buffer(sizeof(VOLUME_DISK_EXTENTS) + sizeof(DISK_EXTENT)); //reserve buffer for at most one disk! call below will then fail if volume spans multiple disks! @@ -151,7 +141,7 @@ Windows 7: Windows XP: 1 Thread: 41s | 13s 1 Thread: 45s | 13s 2 Threads: 42s | 11s 2 Threads: 38s | 8s -=> Traversing does not take any advantage of file locality so that even multiple threads operating on the same disk impose no performance overhead. +=> Traversing does not take any advantage of file locality so that even multiple threads operating on the same disk impose no performance overhead! */ @@ -429,7 +419,7 @@ TraverseCallback::ReturnValDir DirCallback::onDir(const Zchar* shortName, const bool subObjMightMatch = true; const bool passFilter = cfg.filterInstance->passDirFilter(relName, &subObjMightMatch); if (!passFilter && !subObjMightMatch) - return Loki::Int2Type<ReturnValDir::TRAVERSING_DIR_IGNORE>(); //do NOT traverse subdirs + return Int2Type<ReturnValDir::TRAVERSING_DIR_IGNORE>(); //do NOT traverse subdirs //else: attention! ensure directory filtering is applied later to exclude actually filtered directories DirContainer& subDir = output_.addSubDir(shortName); @@ -438,7 +428,7 @@ TraverseCallback::ReturnValDir DirCallback::onDir(const Zchar* shortName, const TraverserShared::CallbackPointer subDirCallback = std::make_shared<DirCallback>(cfg, relName + FILE_NAME_SEPARATOR, subDir); cfg.callBackBox.push_back(subDirCallback); //handle lifetime - return ReturnValDir(Loki::Int2Type<ReturnValDir::TRAVERSING_DIR_CONTINUE>(), *subDirCallback); + return ReturnValDir(Int2Type<ReturnValDir::TRAVERSING_DIR_CONTINUE>(), *subDirCallback); } @@ -466,13 +456,12 @@ public: DstHackCallbackImpl(AsyncCallback& acb, int threadID) : acb_(acb), threadID_(threadID), - textApplyingDstHack(toZ(_("Encoding extended time information: %x")).Replace(Zstr("%x"), Zstr("\n\"%x\""))) {} + textApplyingDstHack(toZ(replaceCpy(_("Encoding extended time information: %x"), L"%x", L"\n\"%x\""))) {} private: virtual void requestUiRefresh(const Zstring& filename) //applying DST hack imposes significant one-time performance drawback => callback to inform user { - Zstring statusText = textApplyingDstHack; - replace(statusText, Zstr("%x"), filename); + const Zstring statusText = replaceCpy(textApplyingDstHack, Zstr("%x"), filename); acb_.reportCurrentStatus(utf8CvrtTo<std::wstring>(statusText), threadID_); } @@ -497,7 +486,7 @@ public: void operator()() //thread entry { acb_->incActiveWorker(); - LOKI_ON_BLOCK_EXIT2(acb_->decActiveWorker();); + ZEN_ON_BLOCK_EXIT(acb_->decActiveWorker();); std::for_each(workload_.begin(), workload_.end(), [&](std::pair<DirectoryKey, DirectoryValue*>& item) @@ -553,7 +542,7 @@ private: void zen::fillBuffer(const std::set<DirectoryKey>& keysToRead, //in std::map<DirectoryKey, DirectoryValue>& buf, //out FillBufferCallback& callback, - size_t statusInterval) + size_t updateInterval) { buf.clear(); @@ -562,7 +551,7 @@ void zen::fillBuffer(const std::set<DirectoryKey>& keysToRead, //in std::vector<boost::thread> worker; //note: GCC doesn't allow to construct an array of empty threads since they would be initialized by const boost::thread& worker.reserve(buckets.size()); - Loki::ScopeGuard guardWorker = Loki::MakeGuard([&]() + zen::ScopeGuard guardWorker = zen::makeGuard([&]() { std::for_each(worker.begin(), worker.end(), std::mem_fun_ref(&boost::thread::interrupt)); //interrupt all at once, then join std::for_each(worker.begin(), worker.end(), std::mem_fun_ref(&boost::thread::join)); @@ -604,8 +593,8 @@ void zen::fillBuffer(const std::set<DirectoryKey>& keysToRead, //in //process errors acb->processErrors(callback); } - while (!wt.timed_join(boost::posix_time::milliseconds(statusInterval))); + while (!wt.timed_join(boost::posix_time::milliseconds(updateInterval))); } - guardWorker.Dismiss(); + guardWorker.dismiss(); } diff --git a/library/parallel_scan.h b/lib/parallel_scan.h index 5c998969..99424b2a 100644 --- a/library/parallel_scan.h +++ b/lib/parallel_scan.h @@ -68,7 +68,7 @@ public: void fillBuffer(const std::set<DirectoryKey>& keysToRead, //in std::map<DirectoryKey, DirectoryValue>& buf, //out FillBufferCallback& callback, - size_t statusInterval); //unit: [ms] + size_t updateInterval); //unit: [ms] } #endif // PARALLEL_SCAN_H_INCLUDED diff --git a/shared/parse_lng.h b/lib/parse_lng.h index 034deb68..811a3181 100644 --- a/shared/parse_lng.h +++ b/lib/parse_lng.h @@ -7,33 +7,27 @@ #ifndef PARSE_LNG_HEADER_INCLUDED #define PARSE_LNG_HEADER_INCLUDED -#include <string> -#include <sstream> -#include <map> -#include <set> -#include <vector> #include <algorithm> -#include <functional> #include <cctype> +#include <functional> #include <list> +#include <map> +#include <set> +#include <sstream> #include <stdexcept> - +#include <string> +#include <vector> +#include <zen/utf8.h> namespace lngfile { //singular forms -typedef std::map <std::string, std::string> -TranslationMap; //orig |-> translation +typedef std::map <std::string, std::string> TranslationMap; //orig |-> translation //plural forms -typedef std::pair<std::string, std::string> -SingularPluralPair; //1 house| n houses - -typedef std::vector<std::string> -PluralForms; //1 dom | 2 domy | 5 domw - -typedef std::map <SingularPluralPair, PluralForms> -TranslationPluralMap; //(sing/plu) |-> pluralforms +typedef std::pair<std::string, std::string> SingularPluralPair; //1 house| n houses +typedef std::vector<std::string> PluralForms; //1 dom | 2 domy | 5 domw +typedef std::map <SingularPluralPair, PluralForms> TranslationPluralMap; //(sing/plu) |-> pluralforms struct TransHeader { @@ -41,8 +35,8 @@ struct TransHeader std::string translatorName; //"ZenJu" std::string localeName; //ISO 639 language code + ISO 3166 country code, e.g. "en_GB", or "en_US" std::string flagFile; //"england.png" - int pluralCount; - std::string pluralDefinition; //"nplurals=2; plural= n == 1 ? 0 : 1" + int pluralCount; //2 + std::string pluralDefinition; //"n == 1 ? 0 : 1" }; @@ -483,9 +477,7 @@ void parseLng(const std::string& fileStream, TransHeader& header, TranslationMap pluralOut.clear(); //skip UTF-8 Byte Ordering Mark - const bool hasBOM = fileStream.size() >= 3 && fileStream.substr(0, 3) == "\xef\xbb\xbf"; - - LngParser prs(hasBOM ? fileStream.substr(3) : fileStream); + LngParser prs(zen::startsWith(fileStream, zen::BYTE_ORDER_MARK_UTF8) ? fileStream.substr(3) : fileStream); prs.parse(out, pluralOut, header); } @@ -494,9 +486,7 @@ inline void parseHeader(const std::string& fileStream, TransHeader& header) //throw ParsingError { //skip UTF-8 Byte Ordering Mark - const bool hasBOM = fileStream.size() >= 3 && fileStream.substr(0, 3) == "\xef\xbb\xbf"; - - LngParser prs(hasBOM ? fileStream.substr(3) : fileStream); + LngParser prs(zen::startsWith(fileStream, zen::BYTE_ORDER_MARK_UTF8) ? fileStream.substr(3) : fileStream); prs.parseHeader(header); } diff --git a/shared/parse_plural.h b/lib/parse_plural.h index 1d2bcd95..847bec35 100644 --- a/shared/parse_plural.h +++ b/lib/parse_plural.h @@ -9,7 +9,7 @@ #include <list> #include <memory> -#include "zbase.h" +#include <zen/string_base.h> //http://www.gnu.org/software/hello/manual/gettext/Plural-forms.html @@ -201,7 +201,7 @@ private: if (digitCount != 0) { Token out(Token::TK_NUMBER); - out.number = Wstring(&*pos, digitCount).toNumber<int>(); + out.number = zen::toNumber<int>(Wstring(&*pos, digitCount)); pos += digitCount; return out; } diff --git a/library/process_xml.cpp b/lib/process_xml.cpp index 8362e073..777c3ed6 100644 --- a/library/process_xml.cpp +++ b/lib/process_xml.cpp @@ -5,14 +5,12 @@ // ************************************************************************** #include "process_xml.h" -#include <zenXml/zenxml.h> -#include "../shared/i18n.h" -#include "../shared/global_func.h" -#include "../shared/standard_paths.h" -#include "../shared/string_conv.h" -#include "../shared/file_handling.h" -#include "../shared/file_io.h" -#include "../shared/xml_base.h" +#include <zenxml/xml.h> +#include "ffs_paths.h" +#include <wx+/string_conv.h> +#include <zen/file_handling.h> +#include <zen/file_io.h> +#include "xml_base.h" using namespace zen; using namespace xmlAccess; //functionally needed for correct overload resolution!!! @@ -43,7 +41,7 @@ XmlType xmlAccess::getXmlType(const wxString& filename) //throw() try { //do NOT use zen::loadStream as it will superfluously load even huge files! - loadXmlDocument(filename, doc); //throw FfsXmlError, quick exit if file is not an FFS XML + loadXmlDocument(toZ(filename), doc); //throw FfsXmlError, quick exit if file is not an FFS XML } catch (const FfsXmlError&) { @@ -152,9 +150,9 @@ xmlAccess::MergeType xmlAccess::getMergeType(const std::vector<wxString>& filena bool guiCfgExists = false; bool batchCfgExists = false; - for (std::vector<wxString>::const_iterator i = filenames.begin(); i != filenames.end(); ++i) + for (auto iter = filenames.begin(); iter != filenames.end(); ++iter) { - switch (xmlAccess::getXmlType(*i)) //throw() + switch (xmlAccess::getXmlType(*iter)) //throw() { case XML_TYPE_GUI: guiCfgExists = true; @@ -205,8 +203,6 @@ XmlCfg loadCfgImpl(const wxString& filename, std::unique_ptr<xmlAccess::FfsXmlEr template <class XmlCfg> void mergeConfigFilesImpl(const std::vector<wxString>& filenames, XmlCfg& config) //throw xmlAccess::FfsXmlError { - using namespace xmlAccess; - assert(!filenames.empty()); if (filenames.empty()) return; @@ -214,23 +210,24 @@ void mergeConfigFilesImpl(const std::vector<wxString>& filenames, XmlCfg& config std::vector<zen::MainConfiguration> mainCfgs; std::unique_ptr<FfsXmlError> savedException; - for (std::vector<wxString>::const_iterator i = filenames.begin(); i != filenames.end(); ++i) + std::for_each(filenames.begin(), filenames.end(), + [&](const wxString& filename) { - switch (getXmlType(*i)) + switch (getXmlType(filename)) { case XML_TYPE_GUI: - mainCfgs.push_back(loadCfgImpl<XmlGuiConfig>(*i, savedException).mainCfg); //throw xmlAccess::FfsXmlError + mainCfgs.push_back(loadCfgImpl<XmlGuiConfig>(filename, savedException).mainCfg); //throw xmlAccess::FfsXmlError break; case XML_TYPE_BATCH: - mainCfgs.push_back(loadCfgImpl<XmlBatchConfig>(*i, savedException).mainCfg); //throw xmlAccess::FfsXmlError + mainCfgs.push_back(loadCfgImpl<XmlBatchConfig>(filename, savedException).mainCfg); //throw xmlAccess::FfsXmlError break; case XML_TYPE_GLOBAL: case XML_TYPE_OTHER: break; } - } + }); if (mainCfgs.empty()) throw FfsXmlError(_("Invalid FreeFileSync config file!")); @@ -711,7 +708,7 @@ void readConfig(const XmlIn& in, FolderPairEnh& enhPair) //########################################################### //alternate comp configuration (optional) - XmlIn inAltCmp = in["AlternateCompareConfig"]; + XmlIn inAltCmp = in["CompareConfig"]; if (inAltCmp) { CompConfig altCmpCfg; @@ -885,22 +882,19 @@ void readConfig(const XmlIn& in, XmlGlobalSettings& config) template <class ConfigType> -void readConfig(const wxString& filename, XmlType type, ConfigType& config) +void readConfig(const Zstring& filename, XmlType type, ConfigType& config) { - if (!fileExists(toZ(filename))) - throw FfsXmlError(wxString(_("File does not exist:")) + wxT("\n\"") + filename + wxT("\"")); - XmlDoc doc; - loadXmlDocument(filename, doc); //throw (FfsXmlError) + loadXmlDocument(filename, doc); //throw FfsXmlError if (getXmlType(doc) != type) //throw() - throw FfsXmlError(wxString(_("Error parsing configuration file:")) + wxT("\n\"") + filename + wxT("\"")); + throw FfsXmlError(_("Error parsing configuration file:") + "\n\"" + filename + "\""); XmlIn in(doc); ::readConfig(in, config); if (in.errorsOccured()) - throw FfsXmlError(wxString(_("Error parsing configuration file:")) + wxT("\n\"") + filename + wxT("\"\n\n") + + throw FfsXmlError(_("Error parsing configuration file:") + "\n\"" + filename + "\"\n\n" + getErrorMessageFormatted(in), FfsXmlError::WARNING); } } @@ -908,19 +902,19 @@ void readConfig(const wxString& filename, XmlType type, ConfigType& config) void xmlAccess::readConfig(const wxString& filename, xmlAccess::XmlGuiConfig& config) { - ::readConfig(filename, XML_TYPE_GUI, config); + ::readConfig(toZ(filename), XML_TYPE_GUI, config); } void xmlAccess::readConfig(const wxString& filename, xmlAccess::XmlBatchConfig& config) { - ::readConfig(filename, XML_TYPE_BATCH, config); + ::readConfig(toZ(filename), XML_TYPE_BATCH, config); } void xmlAccess::readConfig(xmlAccess::XmlGlobalSettings& config) { - ::readConfig(getGlobalConfigFile(), XML_TYPE_GLOBAL, config); + ::readConfig(toZ(getGlobalConfigFile()), XML_TYPE_GLOBAL, config); } @@ -985,7 +979,7 @@ void writeConfigFolderPair(const FolderPairEnh& enhPair, XmlOut& out) //alternate comp configuration (optional) if (enhPair.altCmpConfig.get()) { - XmlOut outAlt = outPair["AlternateCompareConfig"]; + XmlOut outAlt = outPair["CompareConfig"]; writeConfig(*enhPair.altCmpConfig, outAlt); } @@ -1150,23 +1144,31 @@ void writeConfig(const ConfigType& config, XmlType type, const wxString& filenam XmlOut out(doc); writeConfig(config, out); - saveXmlDocument(doc, filename); //throw (FfsXmlError) + saveXmlDocument(doc, toZ(filename)); //throw FfsXmlError } } void xmlAccess::writeConfig(const XmlGuiConfig& config, const wxString& filename) { - ::writeConfig(config, XML_TYPE_GUI, filename); //throw (FfsXmlError) + ::writeConfig(config, XML_TYPE_GUI, filename); //throw FfsXmlError } void xmlAccess::writeConfig(const XmlBatchConfig& config, const wxString& filename) { - ::writeConfig(config, XML_TYPE_BATCH, filename); //throw (FfsXmlError) + ::writeConfig(config, XML_TYPE_BATCH, filename); //throw FfsXmlError } void xmlAccess::writeConfig(const XmlGlobalSettings& config) { - ::writeConfig(config, XML_TYPE_GLOBAL, getGlobalConfigFile()); //throw (FfsXmlError) + ::writeConfig(config, XML_TYPE_GLOBAL, getGlobalConfigFile()); //throw FfsXmlError +} + + +wxString xmlAccess::extractJobName(const wxString& configFilename) +{ + const wxString shortName = configFilename.AfterLast(FILE_NAME_SEPARATOR); //returns the whole string if seperator not found + const wxString jobName = shortName.BeforeLast(wxChar('.')); //returns empty string if seperator not found + return jobName.IsEmpty() ? shortName : jobName; } diff --git a/library/process_xml.h b/lib/process_xml.h index 851b0d9c..5f1dfb93 100644 --- a/library/process_xml.h +++ b/lib/process_xml.h @@ -9,8 +9,8 @@ #include <wx/gdicmn.h> #include "../structures.h" -#include "../shared/xml_error.h" -#include "../shared/localization.h" +#include "xml_base.h" +#include "localization.h" namespace xmlAccess { @@ -277,6 +277,8 @@ MergeType getMergeType(const std::vector<wxString>& filenames); //throw () void convertConfig(const std::vector<wxString>& filenames, XmlGuiConfig& config); //throw xmlAccess::FfsXmlError void convertConfig(const std::vector<wxString>& filenames, XmlBatchConfig& config); //throw xmlAccess::FfsXmlError + +wxString extractJobName(const wxString& configFilename); } diff --git a/shared/recycler.cpp b/lib/recycler.cpp index 8c4a9da1..30083701 100644 --- a/shared/recycler.cpp +++ b/lib/recycler.cpp @@ -7,18 +7,18 @@ #include "recycler.h" #include <stdexcept> #include <iterator> -#include "i18n.h" -#include "file_handling.h" +#include <zen/file_handling.h> #ifdef FFS_WIN -#include <boost/thread/once.hpp> -#include "dll_loader.h" -#include <wx/msw/wrapwin.h> //includes "windows.h" -#include "assert_static.h" #include <algorithm> #include <functional> #include <vector> -#include "long_path_prefix.h" +#include <boost/thread/once.hpp> +#include <zen/dll.h> +#include <zen/win.h> //includes "windows.h" +#include <zen/assert_static.h> +#include <zen/win_ver.h> +#include <zen/long_path_prefix.h> #include "IFileOperation/file_op.h" #elif defined FFS_LINUX @@ -32,20 +32,6 @@ using namespace zen; namespace { #ifdef FFS_WIN -bool vistaOrLater() -{ - OSVERSIONINFO osvi = {}; - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - - //IFileOperation is supported with Vista and later - if (GetVersionEx(&osvi)) - return osvi.dwMajorVersion > 5; - //XP has majorVersion == 5, minorVersion == 1 - //Vista has majorVersion == 6, minorVersion == 0 - //version overview: http://msdn.microsoft.com/en-us/library/ms724834(VS.85).aspx - return false; -} - /* Performance test: delete 1000 files ------------------------------------ @@ -75,8 +61,8 @@ void moveToWindowsRecycler(const std::vector<Zstring>& filesToDelete) //throw F std::back_inserter(fileNames), std::mem_fun_ref(&Zstring::c_str)); using namespace fileop; - const util::DllFun<MoveToRecycleBinFct> moveToRecycler(getDllName(), moveToRecycleBinFctName); - const util::DllFun<GetLastErrorFct> getLastError (getDllName(), getLastErrorFctName); + const DllFun<MoveToRecycleBinFct> moveToRecycler(getDllName(), moveToRecycleBinFctName); + const DllFun<GetLastErrorFct> getLastError (getDllName(), getLastErrorFctName); if (!moveToRecycler || !getLastError) throw FileError(_("Error moving to Recycle Bin:") + "\n\"" + fileNames[0] + "\"" + //report first file only... better than nothing diff --git a/shared/recycler.h b/lib/recycler.h index 718b64cc..4607199c 100644 --- a/shared/recycler.h +++ b/lib/recycler.h @@ -7,8 +7,8 @@ #ifndef RECYCLER_H_INCLUDED #define RECYCLER_H_INCLUDED -#include "file_error.h" -#include "zstring.h" +#include <zen/file_error.h> +#include <zen/zstring.h> namespace zen { diff --git a/shared/resolve_path.cpp b/lib/resolve_path.cpp index f22b4505..14ad690e 100644 --- a/shared/resolve_path.cpp +++ b/lib/resolve_path.cpp @@ -1,23 +1,23 @@ #include "resolve_path.h" #include <wx/utils.h> #include <wx/datetime.h> -#include "string_conv.h" -#include "loki/ScopeGuard.h" +#include <wx+/string_conv.h> #include <map> +#include <set> +#include <zen/scope_guard.h> #ifdef FFS_WIN -#include "dll_loader.h" +#include <zen/dll.h> #include <Shlobj.h> -#include <wx/msw/wrapwin.h> //includes "windows.h" -#include "long_path_prefix.h" +#include <zen/win.h> //includes "windows.h" +#include <zen/long_path_prefix.h> #ifdef _MSC_VER #pragma comment(lib, "Mpr.lib") #endif #elif defined FFS_LINUX -#include <map> -#include "file_traverser.h" -#include "stdlib.h" +#include <zen/file_traverser.h> +#include <unistd.h> #endif using namespace zen; @@ -26,68 +26,50 @@ using namespace zen; namespace { #ifdef FFS_WIN -Zstring resolveBrokenNetworkMap(const Zstring& dirname) //circumvent issue with disconnected network maps that could be activated by a simple explorer double click -{ - /* - ATTENTION: it is not safe to call ::WNetGetConnection() for every network share: - - network type |::WNetGetConnection rv | lpRemoteName | existing UNC path - -----------------------------|-------------------------|---------------------------------|---------------- - inactive local network share | ERROR_CONNECTION_UNAVAIL| \\192.168.1.27\new2 | YES - WebDrive | NO_ERROR | \\Webdrive-ZenJu\GNU | NO - Box.net (WebDav) | NO_ERROR | \\www.box.net\DavWWWRoot\dav | YES - NetDrive | ERROR_NOT_CONNECTED | <empty> | NO - */ - - if (dirname.size() >= 2 && iswalpha(dirname[0]) && dirname[1] == L':') - { - Zstring driveLetter(dirname.c_str(), 2); //e.g.: "Q:" - - //if (::GetFileAttributes((driveLetter + L'\\').c_str()) == INVALID_FILE_ATTRIBUTES) <- this will seriously block if network is not reachable!!! - { - DWORD bufferSize = 10000; - std::vector<wchar_t> remoteNameBuffer(bufferSize); - DWORD rv = ::WNetGetConnection(driveLetter.c_str(), //__in LPCTSTR lpLocalName in the form "<driveletter>:" - &remoteNameBuffer[0], //__out LPTSTR lpRemoteName, - &bufferSize); //__inout LPDWORD lpnLength - if (rv == ERROR_CONNECTION_UNAVAIL) //remoteNameBuffer will be filled nevertheless! - { - Zstring networkShare = &remoteNameBuffer[0]; - if (!networkShare.empty()) - return networkShare + (dirname.c_str() + 2); //replace "Q:\subdir" by "\\server\share\subdir" - } - } - } - return dirname; -} - - -Zstring resolveRelativePath(Zstring relativeName) +Zstring resolveRelativePath(Zstring relativeName) //note: ::GetFullPathName() is documented not threadsafe! { - relativeName = resolveBrokenNetworkMap(relativeName); - - std::vector<Zchar> fullPath(10000); + const DWORD bufferSize = 10000; + std::vector<Zchar> fullPath(bufferSize); const DWORD rv = ::GetFullPathName(applyLongPathPrefix(relativeName).c_str(), //__in LPCTSTR lpFileName, - static_cast<DWORD>(fullPath.size()), //__in DWORD nBufferLength, - &fullPath[0], //__out LPTSTR lpBuffer, - NULL); //__out LPTSTR *lpFilePart - if (rv == 0 || rv >= fullPath.size()) //theoretically, rv can never be == fullPath.size() + bufferSize, //__in DWORD nBufferLength, + &fullPath[0], //__out LPTSTR lpBuffer, + NULL); //__out LPTSTR *lpFilePart + if (rv == 0 || rv >= bufferSize) //theoretically, rv can never be == bufferSize //ERROR! Don't do anything return relativeName; - return &fullPath[0]; + return Zstring(&fullPath[0], rv); } #elif defined FFS_LINUX -Zstring resolveRelativePath(const Zstring& relativeName) //additional: resolves symbolic links!!! +Zstring resolveRelativePath(const Zstring& relativeName) { - char absolutePath[PATH_MAX + 1]; - if (::realpath(relativeName.c_str(), absolutePath) == NULL) - //ERROR! Don't do anything - return relativeName; + //unfortunately ::realpath only resolves *existing* relative paths, so we have resolve to absolute by ourselves + + //http://linux.die.net/man/2/path_resolution + if (!startsWith(relativeName, FILE_NAME_SEPARATOR)) //absolute names are exactly those starting with a '/' + { + std::vector<char> buffer(10000); + if (::getcwd(&buffer[0], buffer.size()) != NULL) + { + Zstring workingDir = &buffer[0]; + if (!endsWith(workingDir, FILE_NAME_SEPARATOR)) + workingDir += FILE_NAME_SEPARATOR; + + return workingDir + relativeName; + } + } + return relativeName; + + /* + char* absPath = ::realpath(relativeName.c_str(), NULL); + if (!absPath) + return relativeName; //ERROR! Don't do anything + ZEN_ON_BLOCK_EXIT(::free(absPath)); - return Zstring(absolutePath); + return Zstring(absPath); + */ } #endif @@ -100,7 +82,7 @@ public: static const CsidlToDirMap& get() { - static CsidlConstants inst; + static CsidlConstants inst; //potential MT solved by intializing at startup, see below return inst.csidlToDir; } @@ -160,6 +142,12 @@ private: CsidlToDirMap csidlToDir; }; + +//caveat: function scope static initialization is not thread-safe in VS 2010! => make sure to call at app start! +namespace +{ +struct Dummy { Dummy() { CsidlConstants::get(); }} blah; +} #endif @@ -287,7 +275,7 @@ public: virtual ReturnValDir onDir(const Zchar* shortName, const Zstring& fullName) { devices_.insert(std::make_pair(shortName, fullName)); - return Loki::Int2Type<ReturnValDir::TRAVERSING_DIR_IGNORE>(); //DON'T traverse into subdirs + return Int2Type<ReturnValDir::TRAVERSING_DIR_IGNORE>(); //DON'T traverse into subdirs } virtual HandleError onError(const std::wstring& errorText) { return TRAV_ERROR_IGNORE; } @@ -305,7 +293,7 @@ Zstring volumenNameToPath(const Zstring& volumeName) //return empty string on er HANDLE hVol = ::FindFirstVolume(&volGuid[0], static_cast<DWORD>(volGuid.size())); if (hVol != INVALID_HANDLE_VALUE) { - LOKI_ON_BLOCK_EXIT2(::FindVolumeClose(hVol)); + ZEN_ON_BLOCK_EXIT(::FindVolumeClose(hVol)); do { @@ -328,7 +316,7 @@ Zstring volumenNameToPath(const Zstring& volumeName) //return empty string on er DWORD cchBufferLength, PDWORD lpcchReturnLength); - const util::DllFun<GetVolumePathNamesForVolumeNameWFunc> getVolumePathNamesForVolumeName(L"kernel32.dll", "GetVolumePathNamesForVolumeNameW"); + const SysDllFun<GetVolumePathNamesForVolumeNameWFunc> getVolumePathNamesForVolumeName(L"kernel32.dll", "GetVolumePathNamesForVolumeNameW"); if (getVolumePathNamesForVolumeName) { std::vector<wchar_t> volPath(10000); @@ -389,9 +377,7 @@ Zstring volumePathToName(const Zstring& volumePath) //return empty string on err void expandVolumeName(Zstring& text) // [volname]:\folder [volname]\folder [volname]folder -> C:\folder { - Zstring before; - Zstring volname; - Zstring after; + //this would be a nice job for a C++11 regex... size_t posStart = text.find(Zstr("[")); if (posStart != Zstring::npos) @@ -399,42 +385,53 @@ void expandVolumeName(Zstring& text) // [volname]:\folder [volname]\folde size_t posEnd = text.find(Zstr("]"), posStart); if (posEnd != Zstring::npos) { - before = Zstring(text.c_str(), posStart); - volname = Zstring(text.c_str() + posStart + 1, posEnd - posStart - 1); - after = Zstring(text.c_str() + posEnd + 1); + Zstring before = Zstring(text.c_str(), posStart); + Zstring volname = Zstring(text.c_str() + posStart + 1, posEnd - posStart - 1); + Zstring after = Zstring(text.c_str() + posEnd + 1); if (startsWith(after, ':')) after = afterFirst(after, ':'); if (startsWith(after, FILE_NAME_SEPARATOR)) after = afterFirst(after, FILE_NAME_SEPARATOR); - } - } - - if (volname.empty()) - return; - Zstring volPath = volumenNameToPath(volname); //return empty string on error - if (volPath.empty()) - return; - - if (!volPath.EndsWith(FILE_NAME_SEPARATOR)) - volPath += FILE_NAME_SEPARATOR; + //[.*] pattern was found... + if (!volname.empty()) + { + Zstring volPath = volumenNameToPath(volname); //return empty string on error + if (!volPath.empty()) + { + if (!endsWith(volPath, FILE_NAME_SEPARATOR)) + volPath += FILE_NAME_SEPARATOR; - text = before + volPath + after; + text = before + volPath + after; + //successfully replaced pattern + return; + } + } + //error: did not find corresponding volume name: + + /*make sure directory creation will fail later if attempted, instead of inconveniently interpreting this string as a relative name! + [FFS USB]\FreeFileSync will be resolved as + ?:\[FFS USB]\FreeFileSync\ - Windows + /.../[FFS USB]/FreeFileSync/ - Linux + instead of: + C:\Program Files\FreeFileSync\[FFS USB]\FreeFileSync\ + */ +#ifdef FFS_WIN + text = L"?:\\[" + volname + L"]\\" + after; +#elif defined FFS_LINUX + text = "/.../[" + volname + "]/" + after; +#endif + return; + } + } } } #ifdef FFS_WIN -std::vector<Zstring> zen::getDirectoryAliases(Zstring dirname) +void getDirectoryAliasesRecursive(const Zstring& dirname, std::set<Zstring, LessFilename>& output) { - trim(dirname, true, false); - - std::vector<Zstring> output; - - if (dirname.empty()) - return output; - //1. replace volume path by volume name: c:\dirname -> [SYSTEM]\dirname if (dirname.size() >= 3 && std::iswalpha(dirname[0]) && @@ -443,7 +440,7 @@ std::vector<Zstring> zen::getDirectoryAliases(Zstring dirname) { Zstring volname = volumePathToName(Zstring(dirname.c_str(), 3)); if (!volname.empty()) - output.push_back(L"[" + volname + L"]" + Zstring(dirname.c_str() + 2)); + output.insert(L"[" + volname + L"]" + Zstring(dirname.c_str() + 2)); } //2. replace volume name by volume path: [SYSTEM]\dirname -> c:\dirname @@ -451,7 +448,8 @@ std::vector<Zstring> zen::getDirectoryAliases(Zstring dirname) Zstring testVolname = dirname; expandVolumeName(testVolname); if (testVolname != dirname) - output.push_back(testVolname); + if (output.insert(testVolname).second) + getDirectoryAliasesRecursive(testVolname, output); //recurse! } //3. environment variables: C:\Users\username -> %USERPROFILE% @@ -488,29 +486,44 @@ std::vector<Zstring> zen::getDirectoryAliases(Zstring dirname) Zstring tmp2 = entry.second; //case-insensitive "startsWith()" ::makeUpper(tmp2); // if (startsWith(tmp, tmp2)) - output.push_back(L"%" + entry.first + L"%" + (dirname.c_str() + tmp2.size())); + output.insert(L"%" + entry.first + L"%" + (dirname.c_str() + tmp2.size())); }); } - //5. replace (all) macros: //%USERPROFILE% -> C:\Users\username + //4. replace (all) macros: %USERPROFILE% -> C:\Users\username { wxString testMacros = toWx(dirname); expandMacros(testMacros); if (toZ(testMacros) != dirname) - output.push_back(toZ(testMacros)); + if (output.insert(toZ(testMacros)).second) + getDirectoryAliasesRecursive(toZ(testMacros), output); //recurse! } +} - return output; + +std::vector<Zstring> zen::getDirectoryAliases(const Zstring& dirString) +{ + Zstring dirname = dirString; + trim(dirname, true, false); + if (dirname.empty()) + return std::vector<Zstring>(); + + std::set<Zstring, LessFilename> tmp; + getDirectoryAliasesRecursive(dirname, tmp); + + tmp.erase(dirname); + tmp.erase(Zstring()); + + return std::vector<Zstring>(tmp.begin(), tmp.end()); } #endif -Zstring zen::getFormattedDirectoryName(const Zstring& dirname) +Zstring zen::getFormattedDirectoryName(const Zstring& dirString) // throw() { //Formatting is needed since functions expect the directory to end with '\' to be able to split the relative names. - //note: don't combine directory formatting with wxFileName, as it doesn't respect //?/ - prefix! - wxString dirnameTmp = toWx(dirname); + wxString dirnameTmp = toWx(dirString); expandMacros(dirnameTmp); Zstring output = toZ(dirnameTmp); @@ -522,7 +535,7 @@ Zstring zen::getFormattedDirectoryName(const Zstring& dirname) while (endsWith(output, " ")) //don't remove all whitespace from right, e.g. 0xa0 may be used as part of dir name output.resize(output.size() - 1); - if (output.empty()) //an empty string will later be returned as "\"; this is not desired + if (output.empty()) //an empty string would later be resolved as "\"; this is not desired return Zstring(); /* @@ -530,15 +543,143 @@ Zstring zen::getFormattedDirectoryName(const Zstring& dirname) WINDOWS: - \\?\-prefix which needs absolute names - Volume Shadow Copy: volume name needs to be part of each filename - - file icon buffer (at least for extensions that are actually read from disk, e.g. "exe") + - file icon buffer (at least for extensions that are actually read from disk, like "exe") - ::SHFileOperation(): Using relative path names is not thread safe WINDOWS/LINUX: - detection of dependent directories, e.g. "\" and "C:\test" */ output = resolveRelativePath(output); - if (!output.EndsWith(FILE_NAME_SEPARATOR)) + if (!endsWith(output, FILE_NAME_SEPARATOR)) output += FILE_NAME_SEPARATOR; return output; } + + +#ifdef FFS_WIN +void zen::loginNetworkShare(const Zstring& dirnameOrig, bool allowUserInteraction) //throw() - user interaction: show OS password prompt +{ + /* + ATTENTION: it is not safe to retrieve UNC path via ::WNetGetConnection() for every type of network share: + + network type |::WNetGetConnection rv | lpRemoteName | existing UNC path + -----------------------------|-------------------------|---------------------------------|---------------- + inactive local network share | ERROR_CONNECTION_UNAVAIL| \\192.168.1.27\new2 | YES + WebDrive | NO_ERROR | \\Webdrive-ZenJu\GNU | NO + Box.net (WebDav) | NO_ERROR | \\www.box.net\DavWWWRoot\dav | YES + NetDrive | ERROR_NOT_CONNECTED | <empty> | NO + */ + + //if (::GetFileAttributes((driveLetter + L'\\').c_str()) == INVALID_FILE_ATTRIBUTES) <- this will seriously block if network is not reachable!!! + + const Zstring dirname = removeLongPathPrefix(dirnameOrig); + + //1. local path + if (dirname.size() >= 2 && iswalpha(dirname[0]) && dirname[1] == L':') + { + Zstring driveLetter(dirname.c_str(), 2); //e.g.: "Q:" + { + DWORD bufferSize = 10000; + std::vector<wchar_t> remoteNameBuffer(bufferSize); + + //map local -> remote + + //note: following function call does NOT block! + DWORD rv = ::WNetGetConnection(driveLetter.c_str(), //__in LPCTSTR lpLocalName in the form "<driveletter>:" + &remoteNameBuffer[0], //__out LPTSTR lpRemoteName, + &bufferSize); //__inout LPDWORD lpnLength + if (rv == ERROR_CONNECTION_UNAVAIL) //remoteNameBuffer will be filled nevertheless! + { + //ERROR_CONNECTION_UNAVAIL: network mapping is existing, but not connected + + Zstring networkShare = &remoteNameBuffer[0]; + if (!networkShare.empty()) + { + NETRESOURCE trgRes = {}; + trgRes.dwType = RESOURCETYPE_DISK; + trgRes.lpLocalName = const_cast<LPWSTR>(driveLetter.c_str()); //lpNetResource is marked "__in", seems WNetAddConnection2 is not const correct! + trgRes.lpRemoteName = const_cast<LPWSTR>(networkShare.c_str()); // + + //note: following function call may block heavily if network is not reachable!!! + DWORD rv2 = ::WNetAddConnection2(&trgRes, // __in LPNETRESOURCE lpNetResource, + NULL, // __in LPCTSTR lpPassword, + NULL, // __in LPCTSTR lpUsername, + allowUserInteraction ? CONNECT_INTERACTIVE : 0); //__in DWORD dwFlags + if (rv2 == NO_ERROR) + return; //mapping reestablished + + //restoring connection failed for some reason... + //we could use full UNC path instead: networkShare + (dirname.c_str() + 2); //replace "Q:\subdir" by "\\server\share\subdir" + } + } + } + } + //2. UNC path + else if (startsWith(dirname, L"\\\\")) + { + const Zstring networkShare = [&]() -> Zstring //extract prefix "\\server\share" + { + size_t pos = dirname.find('\\', 2); + if (pos == Zstring::npos) + return Zstring(); + pos = dirname.find('\\', pos + 1); + return pos == Zstring::npos ? dirname : Zstring(dirname.c_str(), pos); + }(); + + if (!networkShare.empty()) + { + //::WNetGetResourceInformation seems to fail with ERROR_BAD_NET_NAME even for existing unconnected network shares! + // => unconditionally try to connect to network share, seems we cannot reliably detect connection status otherwise + + NETRESOURCE trgRes = {}; + trgRes.dwType = RESOURCETYPE_DISK; + trgRes.lpRemoteName = const_cast<LPWSTR>(networkShare.c_str()); //trgRes is "__in" + + //note: following function call may block heavily if network is not reachable!!! + DWORD rv2 = ::WNetAddConnection2(&trgRes, // __in LPNETRESOURCE lpNetResource, + NULL, // __in LPCTSTR lpPassword, + NULL, // __in LPCTSTR lpUsername, + allowUserInteraction ? CONNECT_INTERACTIVE : 0); //__in DWORD dwFlags + if (rv2 == NO_ERROR) + return; //mapping reestablished + + /* + NETRESOURCE nr = {}; + nr.dwType = RESOURCETYPE_DISK; + nr.lpRemoteName = const_cast<LPWSTR>(networkShare.c_str()); //nr is "__in" + + DWORD bufferSize = sizeof(NETRESOURCE) + 20000; + std::vector<char> buffer(bufferSize); + + LPTSTR relPath = NULL; + + //note: following function call may block heavily if network is not reachable!!! + const DWORD rv = WNetGetResourceInformation(&nr, // __in LPNETRESOURCE lpNetResource, + &buffer[0], // __out LPVOID lpBuffer, + &bufferSize, // __inout LPDWORD lpcbBuffer, + &relPath); // __out LPTSTR *lplpSystem + if (rv == NO_ERROR) + { + //NO_ERROR: network share is existing, *either* connected or disconnected + + //we have no way to check if network is already connected, so let's try to connect anyway: + + NETRESOURCE& trgRes = reinterpret_cast<NETRESOURCE&>(buffer[0]); + + if (trgRes.dwUsage & RESOURCEUSAGE_CONNECTABLE) + { + //note: following function call may block heavily if network is not reachable!!! + DWORD rv2 = ::WNetAddConnection2(&trgRes, // __in LPNETRESOURCE lpNetResource, + NULL, // __in LPCTSTR lpPassword, + NULL, // __in LPCTSTR lpUsername, + allowUserInteraction ? CONNECT_INTERACTIVE : 0); //__in DWORD dwFlags + if (rv2 == NO_ERROR) + return; //mapping reestablished + } + } + */ + } + } +} +#endif diff --git a/lib/resolve_path.h b/lib/resolve_path.h new file mode 100644 index 00000000..7005d0ea --- /dev/null +++ b/lib/resolve_path.h @@ -0,0 +1,26 @@ +// ************************************************************************** +// * This file is part of the FreeFileSync project. It is distributed under * +// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** + +#ifndef RESOLVE_PATH_H_INCLUDED +#define RESOLVE_PATH_H_INCLUDED + +#include <zen/zstring.h> + + +namespace zen +{ +Zstring getFormattedDirectoryName(const Zstring& dirString); //throw() - non-blocking! no I/O! + +#ifdef FFS_WIN +std::vector<Zstring> getDirectoryAliases(const Zstring& dirString); + +//this call may block if network is not reachable or when showing login prompt! +void loginNetworkShare(const Zstring& dirname, bool allowUserInteraction); //throw() - user interaction: show OS password prompt +#endif +} + + +#endif // RESOLVE_PATH_H_INCLUDED diff --git a/library/resources.cpp b/lib/resources.cpp index d8dacc06..da407920 100644 --- a/library/resources.cpp +++ b/lib/resources.cpp @@ -5,14 +5,13 @@ // ************************************************************************** #include "resources.h" +#include <memory> #include <wx/wfstream.h> #include <wx/zipstrm.h> #include <wx/image.h> -#include <wx/icon.h> #include <wx/mstream.h> -#include "../shared/string_conv.h" -#include <memory> -#include "../shared/standard_paths.h" +#include <wx+/string_conv.h> +#include "ffs_paths.h" using namespace zen; @@ -26,7 +25,7 @@ const GlobalResources& GlobalResources::instance() namespace { -void loadAnimFromZip(wxZipInputStream& zipInput, wxAnimation* animation) +void loadAnimFromZip(wxZipInputStream& zipInput, wxAnimation& anim) { //Workaround for wxWidgets: //construct seekable input stream (zip-input stream is non-seekable) for wxAnimation::Load() @@ -40,18 +39,13 @@ void loadAnimFromZip(wxZipInputStream& zipInput, wxAnimation* animation) wxMemoryInputStream seekAbleStream(&data.front(), data.size()); //stream does not take ownership of data - animation->Load(seekAbleStream, wxANIMATION_TYPE_GIF); + anim.Load(seekAbleStream, wxANIMATION_TYPE_GIF); } } GlobalResources::GlobalResources() { - //init all the other resource files - animationMoney = new wxAnimation(wxNullAnimation); - animationSync = new wxAnimation(wxNullAnimation); - programIcon = new wxIcon(wxNullIcon); - wxFFileInputStream input(zen::getResourceDir() + wxT("Resources.zip")); if (input.IsOk()) //if not... we don't want to react too harsh here { @@ -62,7 +56,7 @@ GlobalResources::GlobalResources() while (true) { - std::unique_ptr<wxZipEntry> entry(resourceFile.GetNextEntry()); + std::unique_ptr<wxZipEntry> entry(resourceFile.GetNextEntry()); //take ownership! if (entry.get() == NULL) break; @@ -70,10 +64,7 @@ GlobalResources::GlobalResources() //generic image loading if (name.EndsWith(wxT(".png"))) - { - if (bitmapResource.find(name) == bitmapResource.end()) //avoid duplicate entry: prevent memory leak! - bitmapResource[name] = new wxBitmap(wxImage(resourceFile, wxBITMAP_TYPE_PNG)); - } + bitmaps.insert(std::make_pair(name, wxImage(resourceFile, wxBITMAP_TYPE_PNG))); else if (name == wxT("money.gif")) loadAnimFromZip(resourceFile, animationMoney); else if (name == wxT("working.gif")) @@ -83,37 +74,23 @@ GlobalResources::GlobalResources() #ifdef FFS_WIN //for compatibility it seems we need to stick with a "real" icon - *programIcon = wxIcon(wxT("A_PROGRAM_ICON")); + programIcon = wxIcon(wxT("A_PROGRAM_ICON")); #else //use big logo bitmap for better quality - programIcon->CopyFromBitmap(getImageInt(wxT("FreeFileSync.png"))); + programIcon.CopyFromBitmap(getImageInt(wxT("FreeFileSync.png"))); //attention: this is the reason we need a member getImage -> it must not implicitly create static object instance!!! //erroneously calling static object constructor twice will deadlock on Linux!! #endif } -GlobalResources::~GlobalResources() -{ - //free bitmap resources - for (std::map<wxString, wxBitmap*>::iterator i = bitmapResource.begin(); i != bitmapResource.end(); ++i) - delete i->second; - - //free other resources - delete animationMoney; - delete animationSync; - delete programIcon; -} - - const wxBitmap& GlobalResources::getImageInt(const wxString& imageName) const { - const std::map<wxString, wxBitmap*>::const_iterator bmp = bitmapResource.find( - imageName.Find(L'.') == wxNOT_FOUND ? //assume .png ending if nothing else specified - imageName + wxT(".png") : - imageName); - if (bmp != bitmapResource.end()) - return *bmp->second; + auto iter = bitmaps.find(imageName.Find(L'.') == wxNOT_FOUND ? //assume .png ending if nothing else specified + imageName + wxT(".png") : + imageName); + if (iter != bitmaps.end()) + return iter->second; else { assert(false); diff --git a/library/resources.h b/lib/resources.h index e985d9bf..d8b08b72 100644 --- a/library/resources.h +++ b/lib/resources.h @@ -7,39 +7,32 @@ #ifndef RESOURCES_H_INCLUDED #define RESOURCES_H_INCLUDED +#include <map> #include <wx/bitmap.h> #include <wx/animate.h> -#include <wx/string.h> -#include <map> +#include <wx/icon.h> class GlobalResources { public: - static const wxBitmap& getImage(const wxString& name) - { - const GlobalResources& inst = instance(); - return inst.getImageInt(name); - } - static const GlobalResources& instance(); + static const wxBitmap& getImage(const wxString& name) { return instance().getImageInt(name); } + //global image resource objects - wxAnimation* animationMoney; - wxAnimation* animationSync; - wxIcon* programIcon; + wxAnimation animationMoney; + wxAnimation animationSync; + wxIcon programIcon; private: GlobalResources(); - ~GlobalResources(); GlobalResources(const GlobalResources&); GlobalResources& operator=(const GlobalResources&); const wxBitmap& getImageInt(const wxString& name) const; - - //resource mapping - std::map<wxString, wxBitmap*> bitmapResource; + std::map<wxString, wxBitmap> bitmaps; }; #endif // RESOURCES_H_INCLUDED diff --git a/shared/shadow.cpp b/lib/shadow.cpp index 7f25076e..73a2e8f7 100644 --- a/shared/shadow.cpp +++ b/lib/shadow.cpp @@ -5,14 +5,12 @@ // ************************************************************************** #include "shadow.h" -#include <wx/msw/wrapwin.h> //includes "windows.h" -#include "i18n.h" -#include "dll_loader.h" #include <stdexcept> -#include "assert_static.h" -#include "build_info.h" -#include "ShadowCopy\shadow.h" -#include "Loki/ScopeGuard.h" +#include <zen/win.h> //includes "windows.h" +#include <zen/dll.h> +#include <zen/assert_static.h> +#include "ShadowCopy/shadow.h" +#include <zen/scope_guard.h> using namespace zen; using namespace shadow; @@ -25,7 +23,7 @@ bool runningWOW64() //test if process is running under WOW64 (reference http://m //dynamically load windows API function typedef BOOL (WINAPI *IsWow64ProcessFun)(HANDLE hProcess, PBOOL Wow64Process); - const util::DllFun<IsWow64ProcessFun> isWow64Process(L"kernel32.dll", "IsWow64Process"); + const SysDllFun<IsWow64ProcessFun> isWow64Process(L"kernel32.dll", "IsWow64Process"); if (isWow64Process) { BOOL isWow64 = FALSE; @@ -44,7 +42,7 @@ class ShadowCopy::ShadowVolume { public: ShadowVolume(const Zstring& volumeNameFormatted) : //throw(FileError) - createShadowCopy(getDllName(), createShadowCopyFctName), + createShadowCopy (getDllName(), createShadowCopyFctName), releaseShadowCopy(getDllName(), releaseShadowCopyFctName), backupHandle(0) { @@ -90,8 +88,8 @@ private: ShadowVolume(const ShadowVolume&); ShadowVolume& operator=(const ShadowVolume&); - const util::DllFun<CreateShadowCopyFct> createShadowCopy; - const util::DllFun<ReleaseShadowCopyFct> releaseShadowCopy; + const DllFun<CreateShadowCopyFct> createShadowCopy; + const DllFun<ReleaseShadowCopyFct> releaseShadowCopy; Zstring shadowVol; @@ -110,7 +108,7 @@ Zstring ShadowCopy::makeShadowCopy(const Zstring& inputFile) throw FileError(_("Could not determine volume name for file:") + "\n\"" + inputFile + "\""); Zstring volumeNameFormatted = volumeNameRaw; - if (!volumeNameFormatted.EndsWith(FILE_NAME_SEPARATOR)) + if (!endsWith(volumeNameFormatted, FILE_NAME_SEPARATOR)) volumeNameFormatted += FILE_NAME_SEPARATOR; //input file is always absolute! directory formatting takes care of this! Therefore volume name can always be found. diff --git a/shared/shadow.h b/lib/shadow.h index aff5b437..bfb1e84a 100644 --- a/shared/shadow.h +++ b/lib/shadow.h @@ -7,14 +7,10 @@ #ifndef SHADOW_H_INCLUDED #define SHADOW_H_INCLUDED -#ifndef FFS_WIN -use in windows build only! -#endif - -#include "zstring.h" -#include "file_error.h" #include <map> #include <memory> +#include <zen/zstring.h> +#include <zen/file_error.h> namespace shadow diff --git a/library/soft_filter.h b/lib/soft_filter.h index f3c1bd41..6763d6b7 100644 --- a/library/soft_filter.h +++ b/lib/soft_filter.h @@ -69,14 +69,6 @@ private: - - - - - - - - // ----------------------- implementation ----------------------- namespace zen { diff --git a/library/statistics.cpp b/lib/statistics.cpp index f6ec01ad..9924091c 100644 --- a/library/statistics.cpp +++ b/lib/statistics.cpp @@ -7,20 +7,17 @@ #include "statistics.h" #include <wx/ffile.h> -#include "../shared/global_func.h" +#include <zen/basic_math.h> #include "status_handler.h" -#include "../shared/util.h" -#include "../shared/i18n.h" +#include <wx+/format_unit.h> #include <limits> #include <wx/stopwatch.h> -#include "../shared/assert_static.h" +#include <zen/assert_static.h> +#include <zen/i18n.h> using namespace zen; -RetrieveStatistics::RetrieveStatistics() : - timer(new wxStopWatch) {} - RetrieveStatistics::~RetrieveStatistics() { @@ -29,114 +26,30 @@ RetrieveStatistics::~RetrieveStatistics() outputFile.Write(wxT("Time(ms);Objects;Data\n")); - for (std::vector<StatEntry>::const_iterator i = data.begin(); i != data.end(); ++i) + std::for_each(data.begin(), data.end(), + [&](const StatEntry& entry) { - outputFile.Write(toString<wxString>(i->time)); + outputFile.Write(toString<wxString>(entry.time)); outputFile.Write(wxT(";")); - outputFile.Write(toString<wxString>(i->objects)); + outputFile.Write(toString<wxString>(entry.objects)); outputFile.Write(wxT(";")); - outputFile.Write(toString<wxString>(i->value)); + outputFile.Write(toString<wxString>(entry.value)); outputFile.Write(wxT("\n")); - } + }); } -void RetrieveStatistics::writeEntry(const double value, const int objects) +void RetrieveStatistics::writeEntry(double value, int objects) { StatEntry newEntry; newEntry.value = value; newEntry.objects = objects; - newEntry.time = timer->Time(); + newEntry.time = timer.Time(); data.push_back(newEntry); } //######################################################################################## -namespace -{ -template <class T> -inline -bool isNull(T number) -{ - return common::abs(number) <= std::numeric_limits<T>::epsilon(); //epsilon == 0 for integer types, therefore less-equal(!) -} -} - - -enum UnitRemTime -{ - URT_SEC, - URT_MIN, - URT_HOUR, - URT_DAY -}; - - -inline -wxString Statistics::formatRemainingTime(double timeInMs) const -{ - double remainingTime = timeInMs / 1000; - - //determine preferred unit - UnitRemTime unit = URT_SEC; - if (remainingTime > 55) - { - unit = URT_MIN; - remainingTime /= 60; - if (remainingTime > 59) - { - unit = URT_HOUR; - remainingTime /= 60; - if (remainingTime > 23) - { - unit = URT_DAY; - remainingTime /= 24; - } - } - } - - int formattedTime = common::round(remainingTime); - - //reduce precision to 5 seconds - if (unit == URT_SEC && formattedTime % 5 != 0) - formattedTime += 5 - formattedTime % 5; //"ceiling" - - - //avoid "jumping back and forth" when fluctuating around .5 - if (remainingTimeLast < formattedTime) - { - if (unit == URT_SEC) - { - formattedTime = common::round(remainingTime); - formattedTime -= formattedTime % 5; //"floor" - } - else - formattedTime = static_cast<int>(remainingTime); //"floor" - } - remainingTimeLast = formattedTime; - - //generate output message - wxString output; - switch (unit) - { - case URT_SEC: - output = _P("1 sec", "%x sec", formattedTime); - break; - case URT_MIN: - output = _P("1 min", "%x min", formattedTime); - break; - case URT_HOUR: - output = _P("1 hour", "%x hours", formattedTime); - break; - case URT_DAY: - output = _P("1 day", "%x days", formattedTime); - break; - } - output.Replace(wxT("%x"), zen::toStringSep(formattedTime)); - return output; -} - - Statistics::Statistics(int totalObjectCount, double totalDataAmount, unsigned windowSizeRemainingTime, @@ -145,14 +58,8 @@ Statistics::Statistics(int totalObjectCount, dataTotal(totalDataAmount), windowSizeRemTime(windowSizeRemainingTime), windowSizeBPS(windowSizeBytesPerSecond), - windowMax(std::max(windowSizeRemainingTime, windowSizeBytesPerSecond)), - remainingTimeLast(std::numeric_limits<int>::max()), //something "big" - timer(new wxStopWatch) {} + windowMax(std::max(windowSizeRemainingTime, windowSizeBytesPerSecond)) {} -Statistics::~Statistics() -{ - delete timer; -} void Statistics::addMeasurement(int objectsCurrent, double dataCurrent) { @@ -160,21 +67,12 @@ void Statistics::addMeasurement(int objectsCurrent, double dataCurrent) newRecord.objects = objectsCurrent; newRecord.data = dataCurrent; - const long currentTime = timer->Time(); - - const TimeRecordMap::value_type newEntry(currentTime, newRecord); + const long now = timer.Time(); - //insert new record - if (!measurements.empty()) - { - //assert(dataCurrent >= (--measurements.end())->second.data); - measurements.insert(--measurements.end(), newEntry); //use fact that time is monotonously ascending - } - else - measurements.insert(newEntry); + measurements.insert(measurements.end(), std::make_pair(now, newRecord)); //use fact that time is monotonously ascending - //remove all records earlier than "currentTime - windowSize" - const long newBegin = currentTime - windowMax; + //remove all records earlier than "now - windowMax" + const long newBegin = now - windowMax; TimeRecordMap::iterator windowBegin = measurements.upper_bound(newBegin); if (windowBegin != measurements.begin()) measurements.erase(measurements.begin(), --windowBegin); //retain one point before newBegin in order to handle "measurement holes" @@ -199,8 +97,11 @@ wxString Statistics::getRemainingTime() const const double dataRemaining = dataTotal - backRecord.second.data; - if (!isNull(dataDelta)) - return formatRemainingTime(dataRemaining * timeDelta / dataDelta); + if (!numeric::isNull(dataDelta)) + { + int remTimeSec = dataRemaining * timeDelta / (1000.0 * dataDelta); + return zen::remainingTimeToShortString(remTimeSec); + } } return wxT("-"); //fallback @@ -223,9 +124,9 @@ wxString Statistics::getBytesPerSecond() const const double timeDelta = backRecord.first - frontRecord.first; const double dataDelta = backRecord.second.data - frontRecord.second.data; - if (!isNull(timeDelta)) + if (!numeric::isNull(timeDelta)) if (dataDelta > 0) //may be negative if user cancels copying - return zen::formatFilesizeToShortString(zen::UInt64(dataDelta * 1000 / timeDelta)) + _("/sec"); + return zen::filesizeToShortString(zen::UInt64(dataDelta * 1000 / timeDelta)) + _("/sec"); } return wxT("-"); //fallback @@ -234,13 +135,13 @@ wxString Statistics::getBytesPerSecond() const void Statistics::pauseTimer() { - timer->Pause(); + timer.Pause(); } void Statistics::resumeTimer() { - timer->Resume(); + timer.Resume(); } /* diff --git a/library/statistics.h b/lib/statistics.h index cfa3e07c..8f974aae 100644 --- a/library/statistics.h +++ b/lib/statistics.h @@ -11,20 +11,14 @@ #include <map> #include <memory> #include <wx/defs.h> - - #include <wx/string.h> - -class wxStopWatch; - +#include <wx/stopwatch.h> class RetrieveStatistics { public: - wxDEPRECATED( RetrieveStatistics() ); //generate compiler warnings as a reminder to remove code after measurements - ~RetrieveStatistics(); - - void writeEntry(const double value, const int objects); + wxDEPRECATED(~RetrieveStatistics()); //generate compiler warnings as a reminder to remove code after measurements + void writeEntry(double value, int objects); private: struct StatEntry @@ -33,9 +27,8 @@ private: int objects; double value; }; - std::vector<StatEntry> data; - std::unique_ptr<wxStopWatch> timer; + wxStopWatch timer; }; @@ -47,8 +40,6 @@ public: unsigned windowSizeRemainingTime, //time in ms unsigned windowSizeBytesPerSecond); //time in ms - ~Statistics(); - void addMeasurement(int objectsCurrent, double dataCurrent); wxString getRemainingTime() const; //returns the remaining time in milliseconds wxString getBytesPerSecond() const; @@ -57,8 +48,6 @@ public: void resumeTimer(); private: - wxString formatRemainingTime(double timeInMs) const; - const int objectsTotal; const double dataTotal; @@ -66,8 +55,6 @@ private: const unsigned windowSizeBPS; // const unsigned windowMax; - mutable int remainingTimeLast; //used for "smoothening" remaining time - struct Record { int objects; //object count @@ -77,7 +64,7 @@ private: typedef std::multimap<long, Record> TimeRecordMap; //time, unit: milliseconds TimeRecordMap measurements; // - wxStopWatch* timer; + wxStopWatch timer; }; #endif // STATISTICS_H_INCLUDED diff --git a/library/status_handler.cpp b/lib/status_handler.cpp index 55f82c64..55f82c64 100644 --- a/library/status_handler.cpp +++ b/lib/status_handler.cpp diff --git a/library/status_handler.h b/lib/status_handler.h index 1282f9f1..390b4f0a 100644 --- a/library/status_handler.h +++ b/lib/status_handler.h @@ -9,13 +9,19 @@ #include <wx/string.h> #include <string> -#include "../shared/int64.h" +#include <zen/int64.h> const int UI_UPDATE_INTERVAL = 100; //unit: [ms]; perform ui updates not more often than necessary, 100 seems to be a good value with only a minimal performance loss bool updateUiIsAllowed(); //test if a specific amount of time is over void updateUiNow(); //do the updating +/* +Updating GUI is fast! + time per single call to ProcessCallback::forceUiRefresh() + - Comparison 25 µs + - Synchronization 0.6 ms (despite complex graph!) +*/ //interfaces for status updates (can be implemented by GUI or Batch mode) diff --git a/shared/xml_base.cpp b/lib/xml_base.cpp index e0b497f9..b4887dc0 100644 --- a/shared/xml_base.cpp +++ b/lib/xml_base.cpp @@ -5,10 +5,8 @@ // ************************************************************************** #include "xml_base.h" -#include <file_handling.h> -#include <string_conv.h> -#include <file_io.h> -#include <i18n.h> +#include <zen/file_handling.h> +#include <zen/file_io.h> using namespace zen; @@ -16,7 +14,7 @@ using namespace zen; //loadXmlDocument vs loadStream: //1. better error reporting //2. quick exit if (potentially large) input file is not an XML -void xmlAccess::loadXmlDocument(const wxString& filename, XmlDoc& doc) //throw FfsXmlError +void xmlAccess::loadXmlDocument(const Zstring& filename, XmlDoc& doc) //throw FfsXmlError { std::string stream; try @@ -26,29 +24,29 @@ void xmlAccess::loadXmlDocument(const wxString& filename, XmlDoc& doc) //throw F const std::string xmlBegin = "<?xml version="; std::vector<char> buffer(xmlBegin.size() + sizeof(zen::BYTE_ORDER_MARK_UTF8)); - FileInput inputFile(toZ(filename)); //throw FileError; + FileInput inputFile(filename); //throw FileError; const size_t bytesRead = inputFile.read(&buffer[0], buffer.size()); //throw FileError const std::string fileBegin(&buffer[0], bytesRead); if (!startsWith(fileBegin, xmlBegin) && !startsWith(fileBegin, zen::BYTE_ORDER_MARK_UTF8 + xmlBegin)) //respect BOM! - throw FfsXmlError(wxString(_("Error parsing configuration file:")) + wxT("\n\"") + filename + wxT("\"")); + throw FfsXmlError(_("Error parsing configuration file:") + "\n\"" + filename + "\""); } - const zen::UInt64 fs = zen::getFilesize(toZ(filename)); //throw FileError + const zen::UInt64 fs = zen::getFilesize(filename); //throw FileError stream.resize(to<size_t>(fs)); - FileInput inputFile(toZ(filename)); //throw FileError + FileInput inputFile(filename); //throw FileError const size_t bytesRead = inputFile.read(&stream[0], stream.size()); //throw FileError if (bytesRead < to<size_t>(fs)) - { - wxString errorMessage = wxString(_("Error reading file:")) + wxT("\n\"") + filename + wxT("\""); - throw FfsXmlError(errorMessage + wxT("\n\n")); - } + throw FfsXmlError(_("Error reading file:") + "\n\"" + filename + "\""); } - catch (const FileError& error) //more detailed error messages than with wxWidgets + catch (const FileError& error) { + if (!fileExists(filename)) + throw FfsXmlError(_("File does not exist:") + "\n\"" + filename+ "\""); + throw FfsXmlError(error.msg()); } @@ -58,31 +56,31 @@ void xmlAccess::loadXmlDocument(const wxString& filename, XmlDoc& doc) //throw F } catch (const XmlParsingError&) { - throw FfsXmlError(wxString(_("Error parsing configuration file:")) + wxT("\n\"") + filename + wxT("\"")); + throw FfsXmlError(_("Error parsing configuration file:") + "\n\"" + filename + "\""); } } -const wxString xmlAccess::getErrorMessageFormatted(const XmlIn& in) +const std::wstring xmlAccess::getErrorMessageFormatted(const XmlIn& in) { - wxString errorMessage = wxString(_("Could not read values for the following XML nodes:")) + wxT("\n"); + std::wstring errorMessage = _("Could not read values for the following XML nodes:") + "\n"; - std::vector<wxString> failedNodes = in.getErrorsAs<wxString>(); + std::vector<std::wstring> failedNodes = in.getErrorsAs<std::wstring>(); std::for_each(failedNodes.begin(), failedNodes.end(), - [&](const wxString& str) { errorMessage += str + wxT('\n'); }); + [&](const std::wstring& str) { errorMessage += str + L'\n'; }); return errorMessage; } -void xmlAccess::saveXmlDocument(const zen::XmlDoc& doc, const wxString& filename) //throw (FfsXmlError) +void xmlAccess::saveXmlDocument(const zen::XmlDoc& doc, const Zstring& filename) //throw (FfsXmlError) { std::string stream = serialize(doc); //throw () bool saveNecessary = true; try { - if (zen::getFilesize(toZ(filename)) == stream.size()) //throw FileError + if (zen::getFilesize(filename) == stream.size()) //throw FileError try { if (zen::loadStream(filename) == stream) //throw XmlFileError @@ -95,7 +93,7 @@ void xmlAccess::saveXmlDocument(const zen::XmlDoc& doc, const wxString& filename if (saveNecessary) try { - FileOutput outputFile(toZ(filename), FileOutput::ACC_OVERWRITE); //throw FileError + FileOutput outputFile(filename, FileOutput::ACC_OVERWRITE); //throw FileError outputFile.write(stream.c_str(), stream.length()); // } catch (const FileError& error) //more detailed error messages than with wxWidgets diff --git a/lib/xml_base.h b/lib/xml_base.h new file mode 100644 index 00000000..4614615e --- /dev/null +++ b/lib/xml_base.h @@ -0,0 +1,42 @@ +// ************************************************************************** +// * This file is part of the FreeFileSync project. It is distributed under * +// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** + +#ifndef XMLBASE_H_INCLUDED +#define XMLBASE_H_INCLUDED + +#include <zenxml/xml.h> +#include <zen/zstring.h> +#include <zen/file_error.h> + +//bind zenxml and zen file handling together + +namespace xmlAccess +{ +class FfsXmlError //Exception class +{ +public: + enum Severity + { + WARNING = 77, + FATAL + }; + + FfsXmlError(const std::wstring& message, Severity sev = FATAL) : errorMessage(message), m_severity(sev) {} + + const std::wstring& msg() const { return errorMessage; } + Severity getSeverity() const { return m_severity; } +private: + const std::wstring errorMessage; + const Severity m_severity; +}; + +void saveXmlDocument(const zen::XmlDoc& doc, const Zstring& filename); //throw FfsXmlError +void loadXmlDocument(const Zstring& filename, zen::XmlDoc& doc); //throw FfsXmlError + +const std::wstring getErrorMessageFormatted(const zen::XmlIn& in); +} + +#endif // XMLBASE_H_INCLUDED diff --git a/resource.rc b/resource.rc index 54ba6078..1fbcc7f6 100644 --- a/resource.rc +++ b/resource.rc @@ -5,9 +5,9 @@ #include "version/version.rc" -A_PROGRAM_ICON ICON DISCARDABLE "library/FreeFileSync.ico" -B_BATCH_ICON ICON DISCARDABLE "library/Batch.ico" -C_SYNC_DB_ICON ICON DISCARDABLE "library/SyncDB.ico" +A_PROGRAM_ICON ICON DISCARDABLE "lib/FreeFileSync.ico" +B_BATCH_ICON ICON DISCARDABLE "lib/Batch.ico" +C_SYNC_DB_ICON ICON DISCARDABLE "lib/SyncDB.ico" IDR_VERSION1 VERSIONINFO FILEVERSION VER_FREEFILESYNC diff --git a/shared/app_main.cpp b/shared/app_main.cpp deleted file mode 100644 index 28ce1e09..00000000 --- a/shared/app_main.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// ************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * -// ************************************************************************** - -#include "app_main.h" -#include <wx/window.h> -#include <wx/app.h> - -using namespace zen; - - -bool AppMainWindow::mainWndActive = false; - - -void zen::AppMainWindow::setMainWindow(wxWindow* window) -{ - wxTheApp->SetTopWindow(window); - wxTheApp->SetExitOnFrameDelete(true); - - mainWndActive = true; -} - - -bool AppMainWindow::mainWindowWasSet() -{ - return mainWndActive; -} diff --git a/shared/c_dll.h b/shared/c_dll.h deleted file mode 100644 index 15597a9c..00000000 --- a/shared/c_dll.h +++ /dev/null @@ -1,131 +0,0 @@ -// ************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * -// ************************************************************************** - -#ifndef C_DLL_HEADER -#define C_DLL_HEADER - -#include <string> -#include <map> -#include <algorithm> - - -namespace c_dll -{ -void writeString(const std::wstring& input, wchar_t* output, size_t outputLen); - - -//Convert handles to objects and vice versa -template <class S, class T> //T: prefer managed object to ensure cleanup if remove() is not called -class HandleProvider -{ -public: - static HandleProvider& instance(); - S insert(T object); - void remove(S handle); - T& retrieve(S handle); //return default-constructed object if not found - -private: - HandleProvider() {} - HandleProvider(const HandleProvider&); - HandleProvider& operator=(const HandleProvider&); - S generate(); - - std::map<S, T> handleMap; -}; -/* -Example: - typedef HandleProvider<TBHandle, ComPtr<ITaskbarList3> > HandleTaskbarMap; - HandleTaskbarMap::instance().insert(xyz); -*/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -//########################## inline implementation ############################# -inline -void writeString(const std::wstring& input, wchar_t* output, size_t outputLen) -{ - if (outputLen > 0) - { - const size_t maxSize = std::min(input.length(), outputLen - 1); - std::copy(input.begin(), input.begin() + maxSize, output); - output[maxSize] = 0; - } -} - - -template <class S, class T> -inline -HandleProvider<S, T>& HandleProvider<S, T>::instance() -{ - static HandleProvider inst; //external linkage!!! :) - return inst; -} - - -//convert handles to objects and vice versa -template <class S, class T> -inline -S HandleProvider<S, T>::insert(T object) -{ - S newHandle = generate(); - handleMap.insert(std::make_pair(newHandle, object)); - return newHandle; -} - - -template <class S, class T> -inline -void HandleProvider<S, T>::remove(S handle) -{ - handleMap.erase(handle); -} - - -template <class S, class T> -inline -T& HandleProvider<S, T>::retrieve(S handle) //return default-constructed object if not found -{ - return handleMap[handle]; -} - - -template <class S, class T> -inline -S HandleProvider<S, T>::generate() -{ - static S handle = 0; - return ++handle; //don't return 0! 0 is reserved for indicating failure -} - - -} - -#endif //C_DLL_HEADER
\ No newline at end of file diff --git a/shared/check_exist.h b/shared/check_exist.h deleted file mode 100644 index 8078d388..00000000 --- a/shared/check_exist.h +++ /dev/null @@ -1,88 +0,0 @@ -// ************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * -// ************************************************************************** - -#ifndef CHECKEXIST_H_INCLUDED -#define CHECKEXIST_H_INCLUDED - -#include "zstring.h" -#include "boost_thread_wrap.h" //include <boost/thread.hpp> -#include "file_handling.h" - - -namespace util -{ -//check for file or folder existence asynchronously -boost::unique_future<bool> somethingExistsAsync(const Zstring& somename); -boost::unique_future<bool> fileExistsAsync(const Zstring& filename); -boost::unique_future<bool> dirExistsAsync(const Zstring& dirname); - -//some syntactic sugar: -enum ResultExist -{ - EXISTING_TRUE, - EXISTING_FALSE, - EXISTING_NOT_READY -}; - -ResultExist somethingExists(const Zstring& somename, size_t timeout); -ResultExist fileExists(const Zstring& filename, size_t timeout); -ResultExist dirExists(const Zstring& dirname, size_t timeout); - - - - - - - - - - - - -//################## implementation ########################## -template <bool (*fun)(const Zstring&)> -boost::unique_future<bool> objExistsAsync(const Zstring& objname) -{ - //thread safety: make it a pure value type for use in the thread! - const Zstring objnameVal = objname; //atomic ref-count => binary value-type semantics! - boost::packaged_task<bool> pt([ = ] { return (*fun)(objnameVal); }); - auto fut = pt.get_future(); - boost::thread(std::move(pt)); - return std::move(fut); -} - - -inline -boost::unique_future<bool> somethingExistsAsync(const Zstring& somename) { return objExistsAsync<&zen::somethingExists>(somename); } - -inline -boost::unique_future<bool> fileExistsAsync(const Zstring& filename) { return objExistsAsync<&zen::fileExists>(filename); } - -inline -boost::unique_future<bool> dirExistsAsync(const Zstring& dirname) { return objExistsAsync<&zen::dirExists>(dirname); } - - -template <bool (*fun)(const Zstring&)> inline -ResultExist objExists(const Zstring& objname, size_t timeout) -{ - auto ft = objExistsAsync<fun>(objname); - if (!ft.timed_wait(boost::posix_time::milliseconds(timeout))) - return EXISTING_NOT_READY; - return ft.get() ? EXISTING_TRUE : EXISTING_FALSE; -} - - -inline -ResultExist somethingExists(const Zstring& somename, size_t timeout) { return objExists<&zen::somethingExists>(somename, timeout); } - -inline -ResultExist fileExists(const Zstring& filename, size_t timeout) { return objExists<&zen::fileExists>(filename, timeout); } - -inline -ResultExist dirExists(const Zstring& dirname, size_t timeout) { return objExists<&zen::dirExists>(dirname, timeout); } -} - -#endif // CHECKEXIST_H_INCLUDED diff --git a/shared/dir_picker_i18n.h b/shared/dir_picker_i18n.h deleted file mode 100644 index 89b54bf4..00000000 --- a/shared/dir_picker_i18n.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef DIR_PICKER_I18N_H_INCLUDED -#define DIR_PICKER_I18N_H_INCLUDED - -#include <wx/filepicker.h> -#include "i18n.h" - - -class FfsDirPickerCtrl : public wxDirPickerCtrl -{ -public: - FfsDirPickerCtrl(wxWindow* parent, wxWindowID id, - const wxString& path = wxEmptyString, - const wxString& message = wxDirSelectorPromptStr, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDIRP_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxDirPickerCtrlNameStr) : - wxDirPickerCtrl(parent, id, path, message, pos, size, style, validator, name) - { -#ifdef FFS_WIN - //fix wxWidgets localization gap: - wxButton* button = dynamic_cast<wxButton*>(m_pickerIface); - if (button) button->SetLabel(_("Browse")); -#endif - } -}; - - -#endif // DIR_PICKER_I18N_H_INCLUDED diff --git a/shared/global_func.h b/shared/global_func.h deleted file mode 100644 index b3c13a24..00000000 --- a/shared/global_func.h +++ /dev/null @@ -1,27 +0,0 @@ -// ************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * -// ************************************************************************** - -#ifndef GLOBALFUNCTIONS_H_INCLUDED -#define GLOBALFUNCTIONS_H_INCLUDED - -#include <cmath> - - -namespace common -{ -//little rounding function -inline -int round(double d) { return static_cast<int>(d < 0 ? d - 0.5 : d + 0.5); } - -//absolute value -template <class T> inline -T abs(const T& d) { return d < 0 ? -d : d; } - -inline -size_t getDigitCount(size_t number) { return number == 0 ? 1 : static_cast<size_t>(std::log10(static_cast<double>(number))) + 1; } //count number of digits -} - -#endif //GLOBALFUNCTIONS_H_INCLUDED diff --git a/shared/guid.h b/shared/guid.h deleted file mode 100644 index 1986b101..00000000 --- a/shared/guid.h +++ /dev/null @@ -1,19 +0,0 @@ -// ************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * -// ************************************************************************** - -#ifndef GUID_H_INCLUDED -#define GUID_H_INCLUDED - -#include <string> - - -namespace util -{ -std::string generateGUID(); //creates a 16 byte GUID -} - - -#endif // GUID_H_INCLUDED diff --git a/shared/help_provider.cpp b/shared/help_provider.cpp deleted file mode 100644 index 666482eb..00000000 --- a/shared/help_provider.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// ************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * -// ************************************************************************** - -#include "help_provider.h" -#include <wx/help.h> -#include "standard_paths.h" -#include <wx/image.h> - -namespace -{ -class HelpProvider -{ -public: - HelpProvider() - { - controller.Initialize(zen::getResourceDir() + -#ifdef FFS_WIN - L"FreeFileSync.chm"); -#elif defined FFS_LINUX - L"Help/FreeFileSync.hhp"); -#endif - } - - void showHelp(const wxString& section) - { - if (section.empty()) - controller.DisplayContents(); - else - controller.DisplaySection(section); - } - -private: - wxHelpController controller; -}; -} - -void zen::displayHelpEntry(const wxString& section) -{ - static HelpProvider provider; - provider.showHelp(section); -} diff --git a/shared/i18n.cpp b/shared/i18n.cpp deleted file mode 100644 index a5fb32dd..00000000 --- a/shared/i18n.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "i18n.h" -#include <memory> - -using namespace zen; - - -namespace -{ -std::unique_ptr<TranslationHandler> globalHandler; -} - -void zen::setTranslator(TranslationHandler* newHandler) -{ - globalHandler.reset(newHandler); -} - - -TranslationHandler* zen::getTranslator() -{ - return globalHandler.get(); -} diff --git a/shared/last_error.h b/shared/last_error.h deleted file mode 100644 index 3e90a1a0..00000000 --- a/shared/last_error.h +++ /dev/null @@ -1,24 +0,0 @@ -// ************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * -// ************************************************************************** - -#ifndef SYSTEMFUNCTIONS_H_INCLUDED -#define SYSTEMFUNCTIONS_H_INCLUDED - -#include <string> - - -namespace zen -{ -//evaluate GetLastError()/errno and assemble specific error message -#ifdef FFS_WIN -std::wstring getLastErrorFormatted(unsigned long lastError = 0); -#elif defined FFS_LINUX -std::wstring getLastErrorFormatted(int lastError = 0); -#endif -} - - -#endif // SYSTEMFUNCTIONS_H_INCLUDED diff --git a/shared/loki/AbstractFactory.h b/shared/loki/AbstractFactory.h deleted file mode 100644 index 615652bd..00000000 --- a/shared/loki/AbstractFactory.h +++ /dev/null @@ -1,185 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2001 by Andrei Alexandrescu -// This code accompanies the book: -// 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 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_ABSTRACTFACTORY_INC_ -#define LOKI_ABSTRACTFACTORY_INC_ - -// $Id: AbstractFactory.h 771 2006-10-27 18:05:03Z clitte_bbt $ - - -#include "Typelist.h" -#include "Sequence.h" -#include "TypeManip.h" -#include "HierarchyGenerators.h" - -#include <cassert> - -/** - * \defgroup FactoriesGroup Factories - * \defgroup AbstractFactoryGroup Abstract Factory - * \ingroup FactoriesGroup - * \brief Implements an abstract object factory. - */ - -/** - * \class AbstractFactory - * \ingroup AbstractFactoryGroup - * \brief Implements an abstract object factory. - */ - -namespace Loki -{ - -//////////////////////////////////////////////////////////////////////////////// -// class template AbstractFactoryUnit -// The building block of an Abstract Factory -//////////////////////////////////////////////////////////////////////////////// - -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> -{ -public: - typedef TList ProductList; - - template <class T> T* Create() - { - 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 -{ - typedef typename Base::ProductList BaseProductList; - -protected: - typedef typename BaseProductList::Tail ProductList; - -public: - typedef typename BaseProductList::Head AbstractProduct; - ConcreteProduct* DoCreate(Type2Type<AbstractProduct>) - { - 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 -// 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 -{ - 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; } - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -} // namespace Loki - - -#endif // end file guardian - diff --git a/shared/loki/Allocator.h b/shared/loki/Allocator.h deleted file mode 100644 index 39b63912..00000000 --- a/shared/loki/Allocator.h +++ /dev/null @@ -1,153 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// 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 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 warranty. -//////////////////////////////////////////////////////////////////////////////// - -#ifndef LOKI_ALLOCATOR_HPP_INCLUDED -#define LOKI_ALLOCATOR_HPP_INCLUDED - -// $Id: Allocator.h 896 2008-08-08 22:20:05Z syntheticpp $ - -// Requires project to be compiled with loki/src/SmallObj.cpp and loki/src/Singleton.cpp - -#include <loki/SmallObj.h> - - -namespace Loki -{ - - -//----------------------------------------------------------------------------- - -/** @class LokiAllocator - Adapts Loki's Small-Object Allocator for STL container classes. - This class provides all the functionality required for STL allocators, but - uses Loki's Small-Object Allocator to perform actual memory operations. - Implementation comes from a post in Loki forums (by Rasmus Ekman?). - */ -template -< -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 value_type; - - /// Default constructor does nothing. - inline LokiAllocator( void ) throw() { } - - /// Copy constructor does nothing. - inline LokiAllocator( const LokiAllocator& ) throw() { } - - /// Type converting allocator constructor does nothing. - template < typename Type1 > - inline LokiAllocator( const LokiAllocator< Type1 > & ) throw() { } - - /// Destructor does nothing. - inline ~LokiAllocator() throw() { } - - /// Convert an allocator<Type> to an allocator <Type1>. - template < typename Type1 > - struct rebind - { - typedef LokiAllocator< Type1 > other; - }; - - /// Return address of reference to mutable element. - pointer address( reference elem ) const { return &elem; } - - /// Return address of reference to const element. - const_pointer address( const_reference elem ) const { return &elem; } - - /** Allocate an array of count elements. Warning! The true parameter in - the call to Allocate means this function can throw exceptions. This is - better than not throwing, and returning a null pointer in case the caller - assumes the return value is not null. - @param count # of elements in array. - @param hint Place where caller thinks allocation should occur. - @return Pointer to block of memory. - */ - pointer allocate( size_type count, const void* hint = 0 ) - { - (void)hint; // Ignore the hint. - void* p = AllocT::Instance().Allocate( count * sizeof( Type ), true ); - return reinterpret_cast< pointer >( p ); - } - - /// Ask allocator to release memory at pointer with size bytes. - void deallocate( pointer p, size_type size ) - { - AllocT::Instance().Deallocate( p, size * sizeof( Type ) ); - } - - /// Calculate max # of elements allocator can handle. - size_type max_size( void ) const throw() - { - // A good optimizer will see these calculations always produce the same - // value and optimize this function away completely. - const size_type max_bytes = size_type( -1 ); - const size_type bytes = max_bytes / sizeof( Type ); - return bytes; - } - - /// Construct an element at the pointer. - void construct( pointer p, const Type& value ) - { - // A call to global placement new forces a call to copy constructor. - ::new( p ) Type( value ); - } - - /// Destruct the object at pointer. - void destroy( pointer p ) - { - // If the Type has no destructor, then some compilers complain about - // an unreferenced parameter, so use the void cast trick to prevent - // spurious warnings. - (void)p; - p->~Type(); - } - -}; - -//----------------------------------------------------------------------------- - -/** All equality operators return true since LokiAllocator is basically a - monostate design pattern, so all instances of it are identical. - */ -template < typename Type > -inline bool operator == ( const LokiAllocator< Type > &, const LokiAllocator< Type > & ) -{ - return true; -} - -/** All inequality operators return false since LokiAllocator is basically a - monostate design pattern, so all instances of it are identical. - */ -template < typename Type > -inline bool operator != ( const LokiAllocator< Type > & , const LokiAllocator< Type > & ) -{ - return false; -} - -//----------------------------------------------------------------------------- - -} // namespace Loki - -#endif // LOKI_ALLOCATOR_INCLUDED diff --git a/shared/loki/AssocVector.h b/shared/loki/AssocVector.h deleted file mode 100644 index 7f259281..00000000 --- a/shared/loki/AssocVector.h +++ /dev/null @@ -1,358 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2001 by Andrei Alexandrescu -// This code accompanies the book: -// 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 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_ASSOCVECTOR_INC_ -#define LOKI_ASSOCVECTOR_INC_ - -// $Id: AssocVector.h 765 2006-10-18 13:55:32Z syntheticpp $ - - -#include <algorithm> -#include <functional> -#include <vector> -#include <utility> - -namespace Loki -{ -//////////////////////////////////////////////////////////////////////////////// -// class template AssocVectorCompare -// 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); } -}; -} - -//////////////////////////////////////////////////////////////////////////////// -// class template AssocVector -// An associative vector built as a syntactic drop-in replacement for std::map -// BEWARE: AssocVector doesn't respect all map's guarantees, the most important -// being: -// * iterators are invalidated by insert and erase operations -// * the complexity of insert/erase is O(N) not O(log N) -// * value_type is std::pair<K, V> not std::pair<const K, V> -// * iterators are random -//////////////////////////////////////////////////////////////////////////////// - - -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 - { - 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()) - : Base(alloc), MyCompare(comp) - {} - - 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; - } - - // 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) - { - if ( (pos == begin() || this->operator()(*(pos - 1), val)) && - (pos == end() || this->operator()(val, *pos)) ) - { - return Base::insert(pos, val); - } - return insert(val).first; - } - - 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) - { - iterator i(find(k)); - if (i == end()) return 0; - erase(i); - return 1; - } - - void erase(iterator first, iterator last) - { Base::erase(first, last); } - - void swap(AssocVector& other) - { - Base::swap(other); - MyCompare& me = *this; - MyCompare& rhs = other; - std::swap(me, rhs); - } - - void clear() - { Base::clear(); } - - // observers: - key_compare key_comp() const - { return *this; } - - value_compare value_comp() const - { - const key_compare& comp = *this; - return value_compare(comp); - } - - // 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; - } - - 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; - } - - size_type count(const key_type& k) const - { return find(k) != end(); } - - 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); - } - - iterator upper_bound(const key_type& k) - { - MyCompare& me = *this; - return std::upper_bound(begin(), end(), k, me); - } - - const_iterator upper_bound(const key_type& k) const - { - const MyCompare& me = *this; - return std::upper_bound(begin(), end(), k, me); - } - - std::pair<iterator, iterator> equal_range(const key_type& k) - { - MyCompare& me = *this; - return std::equal_range(begin(), end(), k, me); - } - - 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); - - bool operator<(const AssocVector& rhs) const - { - const Base& me = *this; - const Base& yo = rhs; - return me < yo; - } - - 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 !(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); } - - -// 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/CHANGES b/shared/loki/CHANGES deleted file mode 100644 index 67f6505e..00000000 --- a/shared/loki/CHANGES +++ /dev/null @@ -1,446 +0,0 @@ -_____________________________________ - -Version 0.1.7 -January 2009 -_____________________________________ - -General: - - Fixed makefiles for GNU/kFreeBSD, GNU/hurd. (lf) - - Fixed build errors with gcc 4.3 pre-release. (lf) - - Fixed compiler error that occurs when using 64 bit pointers. (rs) - - Added support for Code::Blocks and MSVC 9. (rs, pk) - - Added more unit tests (rs) - - Several other bug fixes (rs, pk) - -Checker: - - Added for this release. (rs) - - Added test project. (rs) - -CheckReturn: - - Added for this release. (rs, pk) - - Added test project. (rs + pk) - -flex_string: - - Fixed bugs in several functions and storage policies. (aa, rs, jfg) - -LevelMutex: - - Added for this release. (rs) - - Added unit tests for LevelMutex. (rs) - -SafeBits: - - Added for this release. (rs, fp) - - Added unit tests for SafeBits. (rs, fp) - -SmartPtr: - - Fixed double-delete race condition. (rs) - -StrongPtr: - - Fixed destructor so cleanup is only done once. (rs) - - Fixed test by using class level locking. (lf) - -Threads: - - Add possibility to enable recursive mutex support for pthread (pk) - - Added more atomic functions. (rs) - -Type Traits: - - Added 64 bit support. (cg) - -CVS commits by: - Andrei Alexandrescu (aa) - Guillaume Chatelet (cg) - Lukas Fittl (lf) - Peter Kmmel (pk) - Rich Sposato (rs) - -Contributions by: - Andrei Alexandrescu (aa) - Jean-Francois Bastien (jfb) - Guillaume Chatelet (cg) - Lukas Fittl (lf) - Fedor Pikus (fp) - Peter Kmmel (pk) - Rich Sposato (rs) - -_____________________________________ - -Version 0.1.6 -February 25, 2007 -_____________________________________ - -General: - - CacheFactory added by Guillaume Chatelet - - Factory documentation improved by Guillaume Chatelet - - migrated to subversion (pk) - - Mac linker errors fixed (lf) - - Makefiles can now be called from sub directories (lf) - - Makefiles know includes and recompile if they are changed (linux, macosx) (lf) - - Build all tests except SingletonDll with the static library (linux, macosx) (lf) - - use standard conforming naming, SUN's compiler needs it (pk) - - add Loki:: to LOKI_ macros - - several bug fixes. - -AbstractFactory: - - remove injected friends. (thanks to Sigoure Benoit, pk) - -AssocVector: - - remove injected friends. (thanks to Sigoure Benoit, pk) - -LockingPtr: - - constructor added which gets a std::pair of pointers - to the object and the mutex (pk) - -Pimpl: - - ImplT/PimplT/RimplT renamed to a more readable version: ImplOf (pk) - -Register: - - also produce a informative LOKI_CHECK_CLASS_IN_LIST error message with GCC (pk) - -SafeFormat: - - add writing to ostream, by Tom Browder (pk) - - add unsigned long version for Windows, (Thanks to ShenLei, pk) - -Sequence: - - Also compiles with Aix - - switched to recursive implementation - -Singleton - - example: move instantiation to the source file - fixes linker error with gcc 4.0.1 on the mac, - (Thanks to Idar Tollefsen and Sam Miller, pk) - - 64 bit linker error fixed (lf) - -SmallObj: - - compiler errors on SUN fixed (pk) - - more documentation (rs) - - more tests (rs) - - AIX fixed, (thanks to Dieter Rosch, pk) - -StrongPtr: - - Added typedef so LockableTwoRefCounts uses thread-safe allocator. (rs) - - AIX fixed, (thanks to Dieter Rosch, pk) - - linker error when using threads fixed (pk) - -Threads: - - reentrance support added to the pthread mutex (Thanks to Shen Lei, pk) - - -CVS commits by Guillaume Chatelet (gc), Lukas Fittl (lf), Peter Kmmel (pk), Rich Sposato (rs) - - -_____________________________________ - -Version 0.1.5 -June 19, 2006 -_____________________________________ - -General: - - operator== added to Functor, initiated by Eric Beyeler (pk) - - new Strong/Weak smart pointer added. (rs) - - loki.spec (Thanks to Regis Desgroppes and Andreas Scherer, pk) - - build shared lib also on mac osx (Thanks to Sam Miller, lf) - - added MinGW .dev files for the library (rs) - - some makefile improvements (Thanks to Sam Miller, lf) - - adding an XCode build project (kx) - - -flex_string: - - compare bug fixed in flex_string_shell.h (Thanks to David A. Capello, pk) - -Function: - - test is doesn't need boost any more (pk) - - wrong default parameter fixed (pk) - -OrderedStatic: - - undef all min/max macros (Thanks to Shen Lei, pk) - -Singleton: - - Singleton<> moved into correct namespace (Thanks to Sam Miller, pk) - -SmartPtr: - - patch for RedHat 9: undefined uintptr_t (Thanks to Regis Desgroppes, pk) - - more tests (rs) - - bugs 1452805 and 1451835 fixed (rs) - - addded HeapStorage policy as mentioned in Feature Request 1441024 (rs) - - added MinGW test project for SmartPtr (rs) - - -CVS commits by Rich Sposato (rs), Lukas Fittl (lf), -Christopher Knox (kx), and Peter Kmmel (pk) - - - -_____________________________________ - -Version 0.1.4 -March 8, 2006 -_____________________________________ - -General: - - helper templates for Pimpl/Rimpl implementations added (pk) - - improved Makefiles (lf) - - improved make.msvc.bat files (pk) - - cvs LOG keywords added (rs) - - removed old c style casts (lf) - - more warning enabled on gcc (lf) - - new header added: ConstPolicy.h (rs,pk) - - new header added: RefToValue.h (rs,pk) - - standard RPM specification file for integrated installation - on OpenSUSE Linux added (Thanks to Andreas Scherer, pk) - - using Loki as shared library is now possible (pk,lf) - - Register.h added (pk) - - -Function: - - guard including (pk) - - test stsic functions (pk) - - test LOKI_FUNCTOR_IS_NOT_A_SMALLOBJECT (pk) - -Functor: - - Added explicit call to base copy-constructor (rs) - - Changed base class from SmallObject to SmallValueObject. (Thanks to Sam Miller, rs) - - add possibility to disable inheritance from SmallValueObject: LOKI_FUNCTOR_IS_NOT_A_SMALLOBJECT (pk) - -ScopeGuard: - - naming conflict with SmartPtr removed (rs,pk) - - ByRef moved to RefByVale (rs,pk) - -Singleton: - - support of allocators with a standard interface added (Thanks to Miguel A. Figueroa-Villanueva, pk) - - convenience template Singleton added for shared libraries (Thanks to Marcus Lindblom, pk) - - example added which shows how to use Singletons with shared libraries added (Thanks to Marcus Lindblom, pk) - -SmartPtr: - - supports propagating constness by additional policy (rs,pk) - - ArrayStorage policy added (Thanks to Sam Miller, pk) - - fix in RefCounted for Mac OSX gcc 4.0.0 (Thanks to Sam Miller, pk) - - RefCounted ported to 64 bit (pk) - - add mutex policy (pk) - - new test code (rs) - - RecjectNullStrict const member function added (Thanks to Sam Miller, pk) - - Moved a monolithic RefLinkedBase class from header file to new source file. (rs) - - ByRef moved to RefToVale (rs,pk) - - Fixed bug 1425890. Last SmartPtr in linked chain NULLs its prev & next - pointers to prevent infinite recursion. Added asserts. (rs) - - Bug fix: infinite recursion in SmartPtr destructor (rs) - -LockingPtr: - - wrong return types fixed (rs) - - add mutex policy (rs,pk) - - supports now propagating constness (pk,rs) - - macro switch LOKI_DEFAULT_CONSTNESS added for propagating constness (pk) - - multi threaded example added - -SafeFormat: - - definition moved to src/SafeFormat.cpp, it's now part of the library - -Singleton: - - add mutex policy (pk) - -SmallObj: - - add mutex policy (pk) - - Added check for memory leak inside destructor. (Thanks to Kwak Jae Hyuk, rs) - -Threads: - - Mutex added (rs,pk) - - use Loki::Mutex instead of win32/posix mutexes in threading classes (rs,pk) - - -CVS commits by Rich Sposato (rs), Lukas Fittl (lf) -and Peter Kmmel (pk) - - - -_____________________________________ - -Version 0.1.3 -January 9, 2006 -_____________________________________ - -General: - - LockPtr added (rs) - - ScopeGuard added (pk,rs) - - improved Makefiles (lf,pk) - - several gcc fixes and removed warnings by Lukas Fittl (lf) - - tested on 64-bit Linux (pk) - - MS Visual C++ 2005 project files added (pk) - - now also the ms toolkit 2003 generates a library (pk) - -OrderedStatic: - - point operator added (pk) - -SafeFormat: - - moved into namespace Loki (pk) - - 64 bit problems fixed (Thanks to Zak Kipling) - - ported to 64-bit Windows, not tested (pk) - - Printf/SPrintfing of std::strings added (pk) - - all warnings removed gcc and msvc (pk) - - use snprintf for "%p" - - test program: speed comparison added (pk) - -SmallObject: - - added functions to check for memory corruption (rs) - - more fine tuning (rs) - - warnings removed (pk) - -TypeTraits: - - bug 1388477 fixed (pk) - -flex_string: - - fixed compare bug by updating (Thanks to Justin Matthews, pk) - - fixed seg faults on Linux and Windows (pk) - - improved error reporting of the test program (pk) - -SmartPtr: - - make object level locking possible (Thanks to Ryan Smith, pk) - -BindFirst: - - store Functor arguments by value (bug 1383566) (pk) - -Visitor: - - add support for visiting constant member functions (pk) - - example added (pk) - -ScopeGuard: - - example added (pk) - - -CVS commits by Rich Sposato (rs), Lukas Fittl (lf) -and Peter Kmmel (pk) - - -_____________________________________ - -Version 0.1.2 -November 16, 2005 -_____________________________________ - -General: - - changes to compile under Linux (Thanks to David Lawrence, pk) - - more doxygen documentation, modules added (rs, pk) - -SmartPtr: - - three year old bugs 626407 and 541846 fixed: - Assertion with SmartPtr<T, LinkedRef> (pk) - SmartPtr and COMRefCounted (Thanks to James Mclaren, pk) - -Typelists: - - it's now possible to completely disable the - LOKI_TYPELIST_ macros (pk) - - marco definitions moved to a separate file (pk) - -Factory: - - Factory now protects its private data (pk) - - new method to get the keys: - std::vector<IdType> RegisteredIds() (pk) - -Functor: - - TR1 methods added: empty() and clear() (pk) - -Function: - - boost/TR1 like Function template with - improved member function pointer usage (pk) - - tested with boost's function_test.cpp - -Sequence: - - small change in usage: use e.g. Functor<void,Seq<bool &> > - instead of Functor<void,Seq<bool &>::Type > - -SmallObjects: - - comparison of new/malloc/std::allocator/boost::object_pool (rs, pk) - - #undef LOKI_SMALL_OBJECT_USE_NEW_ARRAY when using a ms compiler (pk) - - new lifetimes in namespace LongevityLifetime to manage dependencies: - DieAsSmallObjectParent and DieAsSmallObjectClient (pk) - - no memory leaks when using SmallObjects (pk) - - new default lifetime is DieAsSmallObjectParent (pk) - -Threads: - - threads on POSIX systems (Thanks to Ilya Volvovski ,pk) - - small regression test program (pk) - -Singleton: - - new lifetime: FollowIntoDeath (pk) - - new namespace LongevityLifetime with lifetimes DieLast, DieFirst, - DieDirectlyBeforeLast, and function SingletonFixedLongevity (pk) - - new implementation for SetLongevity (pk) - - example programs (pk) - - -CVS commits by Rich Sposato (rs) and Peter Kmmel (pk) - - - -_____________________________________ - -Version 0.1.1 -October 17, 2005 -_____________________________________ - -Singleton: - - wrong ordered longevity fixed (Thanks to Kwak Jae Hyuk, pk) - - less warnings with msvc (Thanks to John Bates, pk) - - new policy, DeletableSingleton, from Curtis Krauskopf, - see also CUJ article 'Creating Dynamic Singletons & the Loki Library',(pk) - -AssocVector: - - hinted insert does now preserve ordering (Thanks to Christopher Twigg, pk) - - additional 'hinted insert' test for Regression test by Christopher Twigg (pk) - - fix name look up (Thanks to Markus Werle, pk) - -SmallObj: - - several improvements (rs) - - more documentation (rs) - - improved SmallBench (rs, pk) - -Longevity: - - example added (pk) - - additional example similar to that of the book, by Curtis Krauskopf (pk) - -OrderedStatic: - - a proposal to solve the 'static initialization ordered fiasco' problem (pk) - -Sequence: - - a proposal to replace the LOKI_TYPELIST_XX macros with a template implementation (pk) - - e.g.: LOKI_TYPELIST_1(int) becomes Seq<int>::Type - inspired by the functional language OPAL (pk) - - -CVS commits by Rich Sposato (rs) and Peter Kmmel (pk) - - - -_____________________________________ - -Version 0.1.0 -September 29, 2005 -_____________________________________ - -General: - - version numbering started - - new directory structure - - Andrei's yasli, flex_string, and SafePrint added (pk) - - all macros now in the LOKI "namespace", e.g.: - TYPLELIST_1 -> LOKI_TYPELIST_1 (rs, pk) - - Makefiles added: tested with gcc 3.4 (mingw, cygwin), - msvc 8.0, and the toolkit (pk) - - added some documentation (rs) - - several bug fixes (pk) - - added a cvs-list to sourceforge where you can see all changes (pk) - -SmallObjects: - - new implementation (rs) - -Factory: - - works now with parameters (pk) - - regression test added (Thanks to Kalle Rutanen, pk) - -TypeTraits: - - isMemberPointer, isFunction added (Thanks to Kalle Rutanen, pk) - - regression test added (Thanks to Kalle Rutanen, pk) - -Threading: - - new macros for better thread support (win32): - LOKI_CLASS_LEVEL_THREADING and LOKI_OBJECT_LEVEL_THREADING (pk) - - -CVS commits by Rich Sposato (rs) and Peter Kmmel (pk) - diff --git a/shared/loki/CachedFactory.h b/shared/loki/CachedFactory.h deleted file mode 100644 index dc5a76ae..00000000 --- a/shared/loki/CachedFactory.h +++ /dev/null @@ -1,1179 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2006 by Guillaume Chatelet -// -// 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 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 -// Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_CACHEDFACTORY_INC_ -#define LOKI_CACHEDFACTORY_INC_ - -// $Id: CachedFactory.h 950 2009-01-26 19:45:54Z syntheticpp $ - -#include <functional> -#include <algorithm> -#include <iostream> -#include <vector> -#include <iterator> -#include <map> -#include <cassert> -#include <loki/Key.h> - -#ifdef DO_EXTRA_LOKI_TESTS -#define D( x ) x -#else -#define D( x ) ; -#endif - -#if defined(_MSC_VER) || defined(__CYGWIN__) -#include <time.h> -#endif - -/** - * \defgroup FactoriesGroup Factories - * \defgroup CachedFactoryGroup Cached Factory - * \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 - * CachedFactory will surely speedup the execution. - */ -namespace Loki -{ -/** - * \defgroup EncapsulationPolicyCachedFactoryGroup Encapsulation policies - * \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";} -}; - -/** - * \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; - } - - 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; - } - - 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; ) - } -}; - -/** - * \defgroup EvictionPolicyCachedFactoryGroup Eviction policies - * \ingroup CachedFactoryGroup - * \brief Gathers informations about the stored objects and choose a - * candidate for eviction. - */ - -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() - { - 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 > -{ -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]); - } - - 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: - 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 -{ -private: - unsigned allocated, created, hit, out, fetched; -protected: - SimpleStatisticPolicy() : allocated(0), created(0), hit(0), out(0), fetched(0) - { - } - - 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) - { - cout << "## Overall efficiency " << 100 * double(hit) / fetched << "%" << endl; - cout << "############################" << endl; - } - 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 - { - // 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) - { - 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; } - }; - - // 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) - { - 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 - { - 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 - } - -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 >() - ); - } - } - - /////////////////////////////////// - // Acts as the proxy pattern and // - // forwards factory methods // - /////////////////////////////////// - - 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); - } - - /// 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)) - { - 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); - } - - ProductReturn CreateObject(const IdentifierType& id, - Parm1 p1, Parm2 p2) - { - 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); - } - - 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)) - { - 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) - { - 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); - } - - 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)) - { - 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) - { - 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); - } - - 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)) - { - 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); - } - - 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)) - { - 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) - { - 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); - } - - 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)) - { - 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) - { - 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); - } - - 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)) - { - 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) - { - 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); - } - - 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)) - { - 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); - } - - 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)) - { - 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 deleted file mode 100644 index c0a65aa5..00000000 --- a/shared/loki/CheckReturn.h +++ /dev/null @@ -1,165 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2007 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 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 warranty. -//////////////////////////////////////////////////////////////////////////////// - -#ifndef LOKI_CHECK_RETURN_INC_ -#define LOKI_CHECK_RETURN_INC_ - -// $Id$ - - -#include <assert.h> -#include <stdio.h> -#include <stdexcept> - - -namespace Loki -{ - -// ---------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// \class CheckReturn -/// -/// \par Purpose -/// C++ provides no mechanism within the language itself to force code to -/// check the return value from a function call. This simple class provides -/// a mechanism by which programmers can force calling functions to check the -/// return value. Or at least make them consciously choose to disregard the -/// return value. If the calling function fails to use or store the return -/// value, the destructor calls the OnError policy. -/// -/// \par Template Parameters -/// CheckReturn has two template parameters, Value and OnError. -/// - Value is the return type from the function. CheckReturn stores a copy of -/// it rather than a reference or pointer since return value could be local to -/// a function. CheckReturn works best when the return type is a built-in -/// primitive (bool, int, etc...) a pointer, or an enum (such as an error -/// condition enum). It can work with other types that have cheap copy -/// operations. -/// - OnError is a policy class indicating how to handle the situation when a -/// caller does not check or copy the returned value. Loki provides some -/// policy classs and you may also write your own. For example, you can write -/// a policy to create a message box when the function ignores the return value. -/// That would quickly tell you places where code ignores the function call. -/// If your write your own, you only need a templated class or struct with a -/// public function named "run" that accepts a reference to a const value. -/// -/// @par Provided Policy Classes -/// - IgnoreReturnValue Deliberately ignores when the caller ignores the return value. -/// - TriggerAssert Asserts in debug builds if the caller ignores the return value. -/// - FprintfStderr Prints out an error message if the caller ignores the return value. -/// - ThrowTheValue Throws the ignored value as an exception. -/// - ThrowLogicError Throws a logic_error exception to indicate a programming error. -//////////////////////////////////////////////////////////////////////////////// - - -template<class T> -struct IgnoreReturnValue -{ - static void run(const T&) - { - /// Do nothing at all. - } -}; - -template<class T> -struct ThrowTheValue -{ - 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" ); - } -}; - -template<class T> -struct TriggerAssert -{ - 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"); - } -}; - - - -template < class Value , template<class> class OnError = TriggerAssert > -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; - } - -private: - /// Default constructor not implemented. - CheckReturn( void ); - - /// Copy-assignment operator not implemented. - CheckReturn& operator = ( const CheckReturn& that ); - - /// Copy of returned value. - Value m_value; - - /// Flag for whether calling function checked return value yet. - mutable bool m_checked; -}; - -// ---------------------------------------------------------------------------- - -} // namespace Loki - -#endif // end file guardian - -// $Log$ - diff --git a/shared/loki/Checker.h b/shared/loki/Checker.h deleted file mode 100644 index 64579d2f..00000000 --- a/shared/loki/Checker.h +++ /dev/null @@ -1,516 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// The Loki Library -// Copyright (c) 2008 Rich 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 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 warranty. -// -//////////////////////////////////////////////////////////////////////////////// - -// $Id$ - -/// @file Checker.h This file provides Loki's Checker facility. - - -// ---------------------------------------------------------------------------- - -#ifndef LOKI_CHECKER_H_INCLUDED -#define LOKI_CHECKER_H_INCLUDED - -#include <exception> // needed for calls to uncaught_exception. -#include <assert.h> - - -namespace Loki -{ - -/** @par ContractChecker and StaticChecker Overview - The ContractChecker and StaticChecker classes have two purposes: - - provide a mechanism by which programmers can determine which functions - violate class/data invariants, - - and determine which exception safety a function provides. - - @par Class & Data Invariants - The ContractChecker and StaticChecker define invariants as "expressions that - are true for particular data". They uses a function which returns true if all - data are valid, and returns false if any datum is invalid. This is called the - validator function, and the host class or function provides a pointer to it. - The validator could also assert for any invariant which fails rather than - return false. If the validator is a static member function, you can use it - with checkers in any function, but especially standalone functions and class - static functions. If the validator is a non-static member function, you can - use it only within non-static member functions. - - @par Exception Safety Levels - Years ago, David Abrahams formalized a framework for assessing the exception - safety level a function provides. His framework describes three levels of - guarantees. Any function which does not provide any of these levels is - considered unsafe. ContractChecker and StaticChecker determine a function's - safety level through the use of policy classes. Checker's policy classes can - show if a function provides any of these three guarantees. Since there is no - universal way to detect leaks, this facility provides no mechanism for finding - leaks, but users may create their own validators which do. StaticChecker's - policy classes only provide direct checking for the no-throw and invariant - guarantees. With some finesse, a programmer can write a validator for - StaticChecker that checks for the Strong guarantee. - - - No-throw guarantee: A function will not throw any exceptions. - - Strong guarantee: A function will not change data if an exception occurs. - (Which I call the no-change guarantee.) - - Basic guarantee: A function will not leak resources and data will remain - in a valid state if an exception occurs. (Which I call either the no-leak - or no-break guarantee depending on context.) - */ - -// ---------------------------------------------------------------------------- - -/** @class CheckForNoThrow - - @par Exception Safety Level: - This exception-checking policy class for ContractChecker asserts if an - exception exists. Host classes can use this to show that a member function - provides the no-throw exception safety guarantees. - - @par Requirements For Host Class: - This policy imposes no requirements on a host class. - */ -template < class Host > -class CheckForNoThrow -{ -public: - - inline explicit CheckForNoThrow( const Host* ) {} - - inline bool Check( const Host* ) const - { - const bool okay = ( !::std::uncaught_exception() ); - assert( okay ); - return okay; - } -}; - -// ---------------------------------------------------------------------------- - -/** @class CheckForNoChange - - @par Exception Safety Level: - This exception-checking policy class for ContractChecker asserts only if a - copy of the host differs from the host object when an exception occurs. Host - classes can use this policy to show which member functions provide the strong - exception guarantee. - - @par Requirements: - This policy requires hosts to provide both the copy-constructor and the - equality operator, and is intended for classes with value semantics. - equality operator. - */ - -template < class Host > -class CheckForNoChange -{ -public: - - inline explicit CheckForNoChange( const Host* host ) : - m_compare( *host ) {} - - inline bool Check( const Host* host ) const - { - const bool okay = ( !::std::uncaught_exception() ) - || ( m_compare == *host ); - assert( okay ); - return okay; - } - -private: - Host m_compare; -}; - -// ---------------------------------------------------------------------------- - -/** @class CheckForNoChangeOrThrow - - @par Exception Safety Level: - This exception-checking policy class for ContractChecker asserts either if a - copy of the host differs from the original host object, or if an exception - occurs. Host classes can use this policy to show which member functions provide - the no-throw exception guarantee, and would never change data anyway. - - @par Requirements For Host Class: - This policy requires hosts to provide both the copy-constructor and the - equality operator, and is intended for classes with value semantics. - */ - -template < class Host > -class CheckForNoChangeOrThrow -{ -public: - - inline explicit CheckForNoChangeOrThrow( const Host* host ) : - m_compare( *host ) {} - - inline bool Check( const Host* host ) const - { - bool okay = ( !::std::uncaught_exception() ); - assert( okay ); - okay = ( m_compare == *host ); - assert( okay ); - return okay; - } - -private: - Host m_compare; -}; - -// ---------------------------------------------------------------------------- - -/** @class CheckForEquality - - @par Exception Safety Level: - This exception-checking policy class for ContractChecker asserts if a copy of the host differs from the host object regardless of whether an exception occurs. - Host classes can use this policy to show which member functions never change - data members, and thereby provide the strong exception safety level by default. - - @par Requirements For Host Class: - This policy requires hosts to provide both the copy-constructor and the - equality operator, and is intended for classes with value semantics. - */ - -template < class Host > -class CheckForEquality -{ -public: - - inline explicit CheckForEquality( const Host* host ) : - m_compare( *host ) {} - - inline bool Check( const Host* host ) const - { - const bool okay = ( m_compare == *host ); - assert( okay ); - return okay; - } - -private: - Host m_compare; -}; - -// ---------------------------------------------------------------------------- - -/** @class CheckForNothing - - @par Exception Safety Level: - This exception-checking policy class for ContractChecker does nothing when - called. Host classes can use this to show which member functions provide - neither the strong nor no-throw exception guarantees. The best guarantee such - functions can provide is that nothing gets leaked. - - @par Requirements For Host Class: - This policy imposes no requirements on a host class. - */ - -template < class Host > -class CheckForNothing -{ -public: - inline explicit CheckForNothing( const Host* ) {} - inline bool Check( const Host* ) const { return true; } -}; - -// ---------------------------------------------------------------------------- - -/** @class ContractChecker - This class determines if a function violated any class invariant, but it also - determines if a function fulfills its contract with client code. In the - "Design by Contract" paradigm, each function has certain pre-conditions and - post-conditions which may differ from the class invariants. This asserts if a - check for an invariant fails as well as if any pre- or post-condition fails. - It also demonstrate which exception safety level a function provides. - - @par Usage - -# Implement a function that checks each class invariant. The function must - have the signature similar to the Validator type. Something like: - "bool Host::IsValid( void ) const;" - - The function should return true if everything is okay, but false if - something is wrong. - - Or it could assert if anything is wrong. - - Ideally, it should be private. - -# Implement similar functions to check for pre-conditions and post-conditions. - Functions which verify pre-conditions and post-conditions do not need to - check all class invariants, just conditions specific to certain public - functions in the host class. - -# Declare some typedef's inside the class declaration like these. Make one - typedef for each exception policy you use. I typedef'ed the CheckForNothing - policy as CheckInvariants because even if a function can't provide either the - no-throw nor the no-change policies, it should still make sure the object - remains in a valid state. - - typedef ::Loki::ContractChecker< Host, ::Loki::CheckForNoThrow > CheckForNoThrow; - - typedef ::Loki::ContractChecker< Host, ::Loki::CheckForNoChange > CheckForNoChange; - - typedef ::Loki::ContractChecker< Host, ::Loki::CheckForEquality > CheckForEquality; - - typedef ::Loki::ContractChecker< Host, ::Loki::CheckForNothing > CheckInvariants; - -# Construct a checker near the top of each member function - except in the - validator member function. Pass the this pointer and the address of your - validator function into the checker's constructor. You may also pass in pointers - to function which check pre- and post-conditions. - - If the function never throws, then use the CheckForNoThrow policy. - - If the function never changes any data members, then use CheckForEquality - policy. - - If the function's normal execution flow changes data, but must make sure - data remains unchanged when any exceptions occur, then use the - CheckForNoChange policy. - - Otherwise use the CheckInvariants policy. - -# Recompile a debug version of your program, run the program and all the unit - tests, and look for which assertions failed. - */ - -template -< -class Host, - template < class > class ExceptionPolicy - > -class ContractChecker : public ExceptionPolicy< Host > -{ - /// Shorthand for the ExceptionPolicy class. - typedef ExceptionPolicy< Host > Ep; - -public: - - /// Signature for the validation function. - typedef bool ( Host:: * Validator )( void ) const; - - /** The constructor makes sure the host is valid at the time the checker - was created, thus insuring the host object was not corrupt from the start. - @par host Pointer to host object. - @par validator Pointer to function that checks class invariants. - @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 ) : - Ep( host ), - m_host( host ), - m_validator( validator ), - m_pre( pre ), - m_post( post ) - { - assert( Check() ); - if ( 0 != m_pre ) - assert( ( m_host->*( m_pre ) )() ); - } - - /** The destructor checks if any Host invariants failed, and then calls the - ExceptionPolicy's Check function to determine what to do in case of an - exception. - */ - inline ~ContractChecker( void ) - { - assert( Check() ); - if ( 0 != m_post ) - assert( ( m_host->*( m_post ) )() ); - assert( Ep::Check( m_host ) ); - } - - /** This first checks the invariants for ContractChecker, and then calls the - validator function for the host to make sure no class invariants were - broken by the host within the Host's member function body. The host - member function can call Check directly to verify the object remains valid - at any time. This does not care if the pre- and post-condition validator - pointers are null since a host class may pass in NULL pointers for either - to indicate the pre-conditions or post-conditions are the same as the - overall class invariants. - */ - inline bool Check( void ) const - { - assert( 0 != this ); - assert( 0 != m_host ); - assert( 0 != m_validator ); - // Now that this confirms the pointers to the host and validation - // functions are not null, go ahead and validate the host object. - const bool okay = ( m_host->*( m_validator ) )(); - assert( okay ); - return okay; - } - -private: - - /// Default constructor is not implemented. - ContractChecker( void ); - /// Copy constructor is not implemented. - ContractChecker( const ContractChecker& ); - /// Copy-assignment operator is not implemented. - ContractChecker& operator = ( const ContractChecker& ); - - /// Pointer to the host object. - const Host* m_host; - - /// Pointer to member function that checks Host object's invariants. - Validator m_validator; - - /// Pointer to member function that checks Host object's pre-conditions. - Validator m_pre; - - /// Pointer to member function that checks Host object's post-conditions. - Validator m_post; - -}; - -// ---------------------------------------------------------------------------- - -/** @class CheckStaticForNoThrow - - @par Exception Safety Level: - This exception-checking policy class for StaticChecker asserts if an exception - exists. Functions can use this to show they provide the no-throw exception - safety guarantee. - */ -class CheckStaticForNoThrow -{ -public: - inline bool Check( void ) - { - const bool okay = !::std::uncaught_exception(); - assert( okay ); - return okay; - } -}; - -// ---------------------------------------------------------------------------- - -/** @class CheckStaticForNothing - - @par Exception Safety Level: - This exception-checking policy class for StaticChecker does nothing when called. - Functions can use this to show they might provide the weak exception guarantee. - The best guarantee such functions can provide is that nothing gets leaked. - */ -class CheckStaticForNothing -{ -public: - inline bool Check( void ) { return true; } -}; - -// ---------------------------------------------------------------------------- - -/** @class StaticChecker - This class checks if a function provides the no-throw exception safety level - and if the function violated any invariants. Invariants for stand-alone and - static functions act as pre-conditions and post-conditions. - - @par Usage - -# Implement a function that checks the invariants associated with a function, - or with the static data for a class. The function must - have the signature similar to the Validator type. Something like: - "static bool Host::StaticIsValid( void );" or "bool IsOkay( void );" - - The function should return true if everything is okay, but false if - something is wrong. - - Or it could assert if anything is wrong. - -# If the checker is for static functions within a class, declare typedef's - inside the class declaration like these. Make one typedef for each policy - you use. I typedef'ed the CheckForNothing policy as CheckInvariants because - even if a function can't provide the no-throw guarantee, it should still - make sure that static data remains in a valid state. - - typedef ::Loki::StaticChecker< ::Loki::CheckForNoThrow > CheckStaticForNoThrow; - - typedef ::Loki::StaticChecker< ::Loki::CheckForNothing > CheckStaticInvariants; - -# Construct a checker near the top of each member function - except in the - validator member function. Pass the address of your validator function into - the checker's constructor. - - If the function never throws, then use the CheckForNoThrow policy. - - Otherwise use the CheckInvariants policy. - -# Recompile a debug version of your program, run it, and see if an assertion - fails. - */ - -template -< -class ExceptionPolicy -> -class StaticChecker : public ExceptionPolicy -{ - /// Shorthand for the ExceptionPolicy class. - typedef ExceptionPolicy Ep; - -public: - - /// Signature for the validation function. - typedef bool ( * Validator )( void ); - - /** The constructor makes sure the host is valid at the time the checker - was created, thus insuring the host object was not corrupt from the start. - @par validator Pointer to function that checks class invariants. - @par pre Optional pointer to function that checks pre-conditions. - @par post Optional pointer to function that checks post-conditions. - */ - inline explicit StaticChecker( Validator validator, - Validator pre = 0, Validator post = 0 ) : - Ep(), - m_validator( validator ), - m_pre( pre ), - m_post( post ) - { - assert( Check() ); - if ( 0 != m_pre ) - assert( m_pre() ); - } - - /** The destructor checks if any Host invariants failed, and then calls the - ExceptionPolicy's Check function to determine what to do in case of an - exception. - */ - inline ~StaticChecker( void ) - { - assert( Check() ); - if ( 0 != m_post ) - assert( m_post() ); - assert( Ep::Check() ); - } - - /** This first checks its own invariants, and then calls the validator - function to make sure no invariants were broken by the function which - created this checker. That function can call Check directly to verify the - data remains valid at any time. This does not care if the pre- and post- - condition validator pointers are null since a host class may pass in NULL - pointers for either to indicate the pre-conditions or post-conditions are - the same as the overall class invariants. - */ - inline bool Check( void ) const - { - assert( 0 != this ); - assert( 0 != m_validator ); - // Now that this confirms the pointers to the host and validation - // functions are not null, go ahead and validate the host object. - const bool okay = m_validator(); - assert( okay ); - return okay; - } - -private: - - /// Default constructor is not implemented. - StaticChecker( void ); - /// Copy constructor is not implemented. - StaticChecker( const StaticChecker& ); - /// Copy-assignment operator is not implemented. - StaticChecker& operator = ( const StaticChecker& ); - - /// Pointer to member function that checks Host object's invariants. - Validator m_validator; - - /// Pointer to member function that checks Host object's pre-conditions. - Validator m_pre; - - /// Pointer to member function that checks Host object's post-conditions. - Validator m_post; - -}; - -// ---------------------------------------------------------------------------- - -}; // end namespace Loki - -#endif diff --git a/shared/loki/ConstPolicy.h b/shared/loki/ConstPolicy.h deleted file mode 100644 index 1adb227a..00000000 --- a/shared/loki/ConstPolicy.h +++ /dev/null @@ -1,61 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2006 Richard Sposato -// Copyright (c) 2006 Peter Kmmel -// 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. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_CONST_POLICY_INC_ -#define LOKI_CONST_POLICY_INC_ - -// $Id: ConstPolicy.h 769 2006-10-26 10:58:19Z syntheticpp $ - - -namespace Loki -{ - -//////////////////////////////////////////////////////////////////////////////// -/// @note These policy classes are used in LockingPtr and SmartPtr to define -/// how const is propagated from the pointee. -//////////////////////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////////////////////// -/// \class DontPropagateConst -/// -/// \ingroup ConstGroup -/// Don't propagate constness of pointed or referred object. -//////////////////////////////////////////////////////////////////////////////// - -template< class T > -struct DontPropagateConst -{ - typedef T Type; -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \class PropagateConst -/// -/// \ingroup ConstGroup -/// Propagate constness of pointed or referred object. -//////////////////////////////////////////////////////////////////////////////// - -template< class T > -struct PropagateConst -{ - typedef const T Type; -}; - -// default will not break existing code -#ifndef LOKI_DEFAULT_CONSTNESS -#define LOKI_DEFAULT_CONSTNESS ::Loki::DontPropagateConst -#endif - -} // end namespace Loki - -#endif // end file guardian diff --git a/shared/loki/DataGenerators.h b/shared/loki/DataGenerators.h deleted file mode 100644 index 7ac697af..00000000 --- a/shared/loki/DataGenerators.h +++ /dev/null @@ -1,113 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Data Generator by Shannon Barber -// This code DOES NOT accompany the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design -// Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// -// Code covered by the MIT License -// 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_DATAGENERATORS_INC_ -#define LOKI_DATAGENERATORS_INC_ - -// $Id: DataGenerators.h 751 2006-10-17 19:50:37Z syntheticpp $ - - -#include "Typelist.h" - -//Reference version - -/************************************************************************************ -// class template GenData -// Iteratates a Typelist, and invokes the functor GenFunc<T> -// for each type in the list, passing a functor along the way. -// The functor is designed to be an insertion iterator which GenFunc<T> -// can use to output information about the types in the list. -// - -Example Use - -template<typename T> -struct ExtractDataType - { - some_type operator()() - { - return create_value_from_type<T>; - } - }; - -Loki::IterateTypes<parameter_tl, ExtractDataType> gendata; -std::vector<some_type> stuff; -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> -{ - 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 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<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 -}//ns Loki - -#endif // end file guardian - diff --git a/shared/loki/EmptyType.h b/shared/loki/EmptyType.h deleted file mode 100644 index 0f60c894..00000000 --- a/shared/loki/EmptyType.h +++ /dev/null @@ -1,49 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2001 by Andrei Alexandrescu -// This code accompanies the book: -// 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 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_EMPTYTYPE_INC_ -#define LOKI_EMPTYTYPE_INC_ - -// $Id: EmptyType.h 751 2006-10-17 19:50:37Z syntheticpp $ - - -namespace Loki -{ -//////////////////////////////////////////////////////////////////////////////// -// class EmptyType -// Used as a class type that doesn't hold anything -// 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; -} -} - -#endif // end file guardian - diff --git a/shared/loki/Factory.h b/shared/loki/Factory.h deleted file mode 100644 index bf31afc5..00000000 --- a/shared/loki/Factory.h +++ /dev/null @@ -1,1084 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2001 by Andrei Alexandrescu -// Copyright (c) 2005 by Peter Kuemmel -// This code DOES NOT accompany the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design -// Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// -// Code covered by the MIT License -// 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_FACTORYPARM_INC_ -#define LOKI_FACTORYPARM_INC_ - -// $Id: Factory.h 788 2006-11-24 22:30:54Z clitte_bbt $ - - -#include "LokiTypeInfo.h" -#include "Functor.h" -#include "AssocVector.h" -#include "SmallObj.h" -#include "Sequence.h" - -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable: 4702) -//unreachable code if OnUnknownType throws an exception -#endif - -/** - * \defgroup FactoriesGroup Factories - * \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. - * Factory Method, one of the patterns from the Design Patterns book, handles - * this problem by defining a separate method for creating the objects, which - * subclasses can then override to specify the derived type of product that will - * be created. - * <br> - * More generally, the term Factory Method is often used to refer to any method - * 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> - * 2. aFactory.Register( 1, createProductNull );<br> - * 3. aFactory.CreateObject( 1 ); <br> - * </code><br> - * <br> - * - 1. The declaration<br> - * You want a Factory that produces AbstractProduct.<br> - * The client will refer to a creation method through an int.<br> - * - 2.The registration<br> - * The code that will contribute to the Factory will now need to declare its - * 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> - * {<br> - * return new Product<br> - * }<br> - * </code><br> - * - 3. The use<br> - * Now the client can create object by calling the Factory's CreateObject method - * with the right identifier. If the ProductCreator were to have arguments - * (<i>ie :Product* createProductParm( int a, int b )</i>) - */ - -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 - * - */ - -template <typename IdentifierType, class AbstractProduct> -struct DefaultFactoryError -{ - struct Exception : public std::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 - - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; -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; -}; - -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; -}; - -#ifndef LOKI_DISABLE_TYPELIST_MACROS - -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; -}; - -#endif //LOKI_DISABLE_TYPELIST_MACROS - - -//////////////////////////////////////////////////////////////////////////////// -/// \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_() - { - } - - ~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> -{ -public: - bool Register(const IdentifierType& id, ProductCreator creator) - { - return associations_.insert( - typename IdToProductMap::value_type(id, creator)).second != 0; - } - - bool Unregister(const IdentifierType& id) - { - return associations_.erase(id) != 0; - } - - 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_; -}; - -#endif //#define ENABLE_NEW_FACTORY_CODE - -/** - * \defgroup CloneFactoryGroup Clone Factory - * \ingroup FactoriesGroup - * \brief Creates a copy from a polymorphic object. - * - * \class CloneFactory - * \ingroup CloneFactoryGroup - * \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> -{ -public: - bool Register(const TypeInfo& ti, ProductCreator creator) - { - return associations_.insert( - typename IdToProductMap::value_type(ti, creator)).second != 0; - } - - bool Unregister(const TypeInfo& id) - { - return associations_.erase(id) != 0; - } - - AbstractProduct* CreateObject(const AbstractProduct* model) - { - 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)); - } - -private: - typedef AssocVector<TypeInfo, ProductCreator> IdToProductMap; - IdToProductMap associations_; -}; - -} // namespace Loki - - -#ifdef _MSC_VER -#pragma warning( pop ) -#endif - -#endif // end file guardian - diff --git a/shared/loki/Function.h b/shared/loki/Function.h deleted file mode 100644 index 5f388d3c..00000000 --- a/shared/loki/Function.h +++ /dev/null @@ -1,373 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2005 Peter Kmmel -// 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_FUNCTION_INC_ -#define LOKI_FUNCTION_INC_ - -// $Id: Function.h 841 2008-03-24 23:58:28Z rich_sposato $ - - -#define LOKI_ENABLE_FUNCTION - -#include <stdexcept> - -#include <loki/Functor.h> -#include <loki/Sequence.h> - -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) {} - -template<class Host, class Func> -Function(const Host& host, const Func& func) : FBase(host, func) {} - -}; - - -//////////////////////////////////////////////////////////////////////////////// -// macros for the repetitions -//////////////////////////////////////////////////////////////////////////////// - -#define LOKI_FUNCTION_BODY \ - \ - Function() : FBase() {} \ - \ - Function(const Function& func) : FBase() \ - { \ - if( !func.empty()) \ - FBase::operator=(func); \ - } \ - \ - 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) {} - - -#define LOKI_FUNCTION_R2_CTOR_BODY \ - \ - : FBase() \ - { \ - if(!func.empty()) \ - FBase::operator=(func); \ - } - - -//////////////////////////////////////////////////////////////////////////////// -// repetitions -//////////////////////////////////////////////////////////////////////////////// - -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 -}; - -}// namespace Loki - -#endif // end file guardian - diff --git a/shared/loki/Functor.h b/shared/loki/Functor.h deleted file mode 100644 index 664af077..00000000 --- a/shared/loki/Functor.h +++ /dev/null @@ -1,1790 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2001 by Andrei Alexandrescu -// This code accompanies the book: -// 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 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_FUNCTOR_INC_ -#define LOKI_FUNCTOR_INC_ - -// $Id: Functor.h 750 2006-10-17 19:50:02Z syntheticpp $ - - -#include "Typelist.h" -#include "Sequence.h" -#include "EmptyType.h" -#include "SmallObj.h" -#include "TypeTraits.h" -#include <typeinfo> -#include <memory> - -/// \defgroup FunctorGroup Function objects - -#ifndef LOKI_FUNCTOR_IS_NOT_A_SMALLOBJECT -//#define LOKI_FUNCTOR_IS_NOT_A_SMALLOBJECT -#endif - -#ifndef LOKI_FUNCTORS_ARE_COMPARABLE -//#define LOKI_FUNCTORS_ARE_COMPARABLE -#endif - - -/// \namespace Loki -/// All classes of Loki are in the Loki namespace -namespace Loki -{ -//////////////////////////////////////////////////////////////////////////////// -// class template FunctorImpl (internal) -//////////////////////////////////////////////////////////////////////////////// - -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>() {} -#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; - } - - -#ifdef LOKI_FUNCTORS_ARE_COMPARABLE - - virtual bool operator==(const FunctorImplBase&) const = 0; - -#endif - -}; -} - -//////////////////////////////////////////////////////////////////////////////// -// macro LOKI_DEFINE_CLONE_FUNCTORIMPL -// Implements the DoClone function for a functor implementation -//////////////////////////////////////////////////////////////////////////////// - -#define LOKI_DEFINE_CLONE_FUNCTORIMPL(Cls) \ - virtual Cls* DoClone() const { return new Cls(*this); } - -//////////////////////////////////////////////////////////////////////////////// -// class template FunctorImpl -// The base class for a hierarchy of functors. The FunctorImpl class is not used -// directly; rather, the Functor class manages and forwards to a pointer to -// FunctorImpl -// You may want to derive your own functors from FunctorImpl. -// 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; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -#ifndef LOKI_DISABLE_TYPELIST_MACROS - -//////////////////////////////////////////////////////////////////////////////// -// class template FunctorImpl -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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; -}; - -#endif //LOKI_DISABLE_TYPELIST_MACROS - -//////////////////////////////////////////////////////////////////////////////// -// class template FunctorHandler -// 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) - - -#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_; - } -#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_; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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) - : pObj_(pObj), pMemFn_(pMemFn) - {} - - 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_; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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") - {} -}; - -#define LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL if(empty()) throw bad_function_call(); - -#else - -#define LOKI_FUNCTION_THROW_BAD_FUNCTION_CALL - -#endif - -//////////////////////////////////////////////////////////////////////////////// -/// \class Functor -/// -/// \ingroup FunctorGroup -/// A generalized functor implementation with value semantics -/// -/// \par Macro: LOKI_FUNCTOR_IS_NOT_A_SMALLOBJECT -/// Define -/// \code LOKI_FUNCTOR_IS_NOT_A_SMALLOBJECT \endcode -/// 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 -/// static Functor objects. -/// -/// \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 -/// 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) - : spImpl_(new FunctorHandler<Functor, Fun>(fun)) - {} - - 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; - - 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; - } - -#ifdef LOKI_ENABLE_FUNCTION - - bool empty() const - { - return spImpl_.get() == 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); - } -#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 -// -//////////////////////////////////////////////////////////////////////////////// - -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; - - typedef typename TL::Erase<TList, typename TL::TypeAt<TList, 0>::Result> - ::Result - ParmList; - - typedef typename TL::TypeAt<TList, 0>::Result OriginalParm1; - - typedef Functor<R, ParmList, ThreadingModel> BoundFunctorType; - - typedef typename BoundFunctorType::Impl Impl; - -}; - - -template<class T> -struct BinderFirstBoundTypeStorage; - -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; -}; - - -} // 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) - : f_(fun), b_(bound) - {} - - 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_); - } -#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_; -}; - -//////////////////////////////////////////////////////////////////////////////// -/// 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))); -} - -//////////////////////////////////////////////////////////////////////////////// -/// \class Chainer -/// -/// \ingroup FunctorGroup -/// 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) - -#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_); - } -#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, - 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_; -}; - -//////////////////////////////////////////////////////////////////////////////// -/// 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))); -} - -} // namespace Loki - - -#endif // end file guardian - diff --git a/shared/loki/HierarchyGenerators.h b/shared/loki/HierarchyGenerators.h deleted file mode 100644 index 126e0f3e..00000000 --- a/shared/loki/HierarchyGenerators.h +++ /dev/null @@ -1,291 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2001 by Andrei Alexandrescu -// This code accompanies the book: -// 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 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_HIERARCHYGENERATORS_INC_ -#define LOKI_HIERARCHYGENERATORS_INC_ - -// $Id: HierarchyGenerators.h 751 2006-10-17 19:50:37Z syntheticpp $ - - -#include "Typelist.h" -#include "TypeTraits.h" -#include "EmptyType.h" - -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( disable : 4584 ) -#endif // _MSC_VER - -//////////////////////////////////////////////////////////////////////////////// -// class template GenScatterHierarchy -// 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 -//////////////////////////////////////////////////////////////////////////////// - -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 AtomicType, template <class> class Unit> -class GenScatterHierarchy : public Unit<AtomicType> -{ - typedef Unit<AtomicType> LeftBase; - template <typename T> struct Rebind - { - typedef Unit<T> Result; - }; -}; - -template <template <class> class Unit> -class GenScatterHierarchy<NullType, Unit> -{ - template <typename T> struct Rebind - { - 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 -//////////////////////////////////////////////////////////////////////////////// - -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 -//////////////////////////////////////////////////////////////////////////////// - -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) -//////////////////////////////////////////////////////////////////////////////// - -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> -{ - 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, - typename H::LeftBase >::Result LeftBase; - - 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; - } -}; - -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; - - enum - { - 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, - 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); - } -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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, -// 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 -//////////////////////////////////////////////////////////////////////////////// - -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 -// Invocation (TList is a typelist, Unit is a template of two args): -// 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 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 ) -#endif -} // namespace Loki - -#endif // end file guardian - diff --git a/shared/loki/Key.h b/shared/loki/Key.h deleted file mode 100644 index a416d6a9..00000000 --- a/shared/loki/Key.h +++ /dev/null @@ -1,766 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2006 by Guillaume Chatelet -// -// 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 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 -// Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_KEY_INC_ -#define LOKI_KEY_INC_ - -// $Id: Key.h 771 2006-10-27 18:05:03Z clitte_bbt $ - - -#include <loki/Factory.h> - -namespace Loki -{ - -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); - - -/** - * 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); -}; - - -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) - { - 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) -{ - 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; - } -} - - - -} // namespace Loki - -#endif // end file guardian - diff --git a/shared/loki/LevelMutex.h b/shared/loki/LevelMutex.h deleted file mode 100644 index eb01f44a..00000000 --- a/shared/loki/LevelMutex.h +++ /dev/null @@ -1,1211 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// LevelMutex facility for the Loki Library -// 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 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 warranty. -// -//////////////////////////////////////////////////////////////////////////////// - -// $Id$ - -/// @file LevelMutex.h Defines classes and functions for LevelMutex facility. - -#ifndef LOKI_LEVEL_MUTEX_H_INCLUDED -#define LOKI_LEVEL_MUTEX_H_INCLUDED - - -// ---------------------------------------------------------------------------- - -#include <vector> -#include <assert.h> -#include <time.h> - -#if defined( _MSC_VER ) -#include <Windows.h> -#else -#include <pthread.h> -#endif - -#if !defined(_WIN32) && !defined(_WIN64) -#include <unistd.h> // declares sleep under Linux -#endif - -/** @par thread_local Keyword - The mutexes require compilers to provide thread local storage - meaning each - thread gets its own copy of the data. The next version of C++ will have a - new keyword, thread_local for that purpose. Some existing compilers already - provide thread local storage using different syntax, so these lines use - thread_local to mimic that syntax. If your compiler provides thread local - storage but using different syntax besides "thread_local", you may want to - modify these lines. If your compiler does not support thread local storage, - 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 -#endif - -#if defined( DEBUG ) || defined( _DEBUG ) -#define LOKI_MUTEX_DEBUG_CODE( x ) x -#else -#define LOKI_MUTEX_DEBUG_CODE( x ) -#endif - - -namespace Loki -{ - - -// ---------------------------------------------------------------------------- - -class MutexErrors -{ -public: - - /// @enum Type Possible error conditions detected by LevelMutex functions. - enum Type - { - Success = 0, ///< Operation occurred correctly. - NoProblem, ///< Pre-lock and pre-unlock checks passed. - WrongLevel, ///< All mutexes in container must have same level. - LevelTooLow, ///< Trying to unlock a mutex lower than current level. - LevelTooHigh, ///< Trying to lock a mutex higher than current level. - TryFailed, ///< TryLock call failed to lock mutex. - NullMutexPointer, ///< Container has a NULL pointer in it. - DuplicateMutex, ///< Container must have unique pointers - no duplicates. - EmptyContainer, ///< Container must have at least 1 pointer in it. - AlreadyLocked, ///< TryLock call failed because mutex already locked. - WasntLocked, ///< Unlock failed because mutex was not even locked. - NotRecentLock, ///< Mutex in container was not recently locked by this thread. - NotLockedByThread, ///< Can't unlock a mutex not locked by this thread. - MultiUnlockFailed, ///< MultiUnlock can't unlock at least 1 mutex in container. - TimedOut, ///< Wait time elapsed without locking mutex. - TooMuchRecursion, ///< Tried to relock a PThread mutex which is not re-entrant. - NotInitialized, ///< Tried to lock a PThread mutex which did not get setup. - AlreadyInitialized, ///< PThread mutex initialized before ctor called. - InvalidAttribute, ///< PThread mutex improperly initialized. - InvalidAddress, ///< Bad pointer used to initialize a PThread mutex. - ExceptionThrown, ///< Exception caught in mutex operation. - MayDeadlock, ///< Locking this mutex may cause a deadlock. - OtherError ///< Unknown error occurred. - }; -}; - -// ---------------------------------------------------------------------------- - -/** @class LevelMutexInfo - This monolithic base class stores common info for a template class used to - control mutexes. The template class, LevelMutex, is policy-based class. - - @par Implementation - Each thread has a list of mutexes it locked. When a mutex first gets locked, it - gets added to the head of the list. If locked again, LevelMutex merely increments - a count. When unlocked, the count gets decremented until it reaches zero, and - then it gets removed from the list. Each mutex has a pointer to the mutex most - recently locked by the current thread. The current level of a thread is always - the level of the most recently locked mutex, or UnlockedLevel if the thread does - not have any mutexes locked now. A mutex is considered "recently" locked if it is at - the head of the list, or the same level as the current mutex and also locked by the - current thread. - - @par Class Invariants - This class maintains invariants for each LevelMutexInfo so that no function - calls corrupt a mutex. Each function makes a call to IsValid at the start so - that LevelMutex knows it acts on valid internal data. Many functions call - IsValid again when they return to insure the function did not leave any data in - an invalid state. The exit call to IsValid occurs through a tiny helper class - called Checker to insure all data remain valid even when exceptions occur. - Another helper class, MutexUndoer, unlocks mutexes in a container if an - exception occurs during calls to MultiLock. - - @par Error Results - Many functions return an enum value to indicate an error status. Many enum values - indicate errors detected within LevelMutex, but some indicate errors found in policy - classes, SpinLevelMutex and SleepLevelMutex. - */ - -class LevelMutexInfo -{ -public: - - /** Level for thread that has not locked any mutex. Maximum possible level - for a mutex is UnlockedLevel-1; No mutex may have a level of UnlockedLevel. - */ - static const unsigned int UnlockedLevel = 0xFFFFFFFF; - - /// Container for locking multiple mutexes at once. - typedef ::std::vector< volatile LevelMutexInfo* > MutexContainer; - typedef MutexContainer::iterator LevelMutexContainerIter; - typedef MutexContainer::const_iterator LevelMutexContainerCIter; - typedef MutexContainer::reverse_iterator LevelMutexContainerRIter; - typedef MutexContainer::const_reverse_iterator LevelMutexContainerCRIter; - - /** Locks several mutexes at once. Requires O(m + n*n) actions where m is the - number of mutexes currently locked by the thread and n is the number of mutexes - in the container. This provides strong exception safety. If an exception occurs, - any mutexes that were locked during this call will get unlocked. - @param mutexes Container of pointers to mutexes. Container must have at - least 1 mutex, all mutexes must have the same level, no NULL pointers, and all - mutexes must not exceed the thread's current level. This sorts the container - by address order. - @return Enum value indicating success or error. - */ - 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 - in the container, and t is the wait time for each mutex. This provides strong - exception safety. If an exception occurs, any mutexes that were locked during - this call will ge unlocked. - @param mutexes Container of pointers to mutexes. Container must have at - least 1 mutex, all mutexes must have the same level, no NULL pointers, and all - mutexes must not exceed the thread's current level. This sorts the container - by address order. - @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 ); - - /** 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 - occurs when unlocking one mutex, other mutexes in the container get unlocked anyway. - @param mutexes Container of pointers to mutexes. Container must have at least 1 - mutex, all mutexes must have the same level, no NULL pointers, and all mutexes must - 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 ); - - /** 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 ); - - /// Returns the level of this mutex. - inline unsigned int GetLevel( void ) const volatile { return m_level; } - - /// Returns true if this mutex was locked at least once. - inline bool IsLocked( void ) const volatile { return ( 0 < m_count ); } - - /// Returns count of how many times this mutex got locked. - 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 - { - return m_previous; - } - - /** Tries to lock mutex, and returns immediately if mutex already locked by - another thread. It will return immediately with a value of AlreadyLocked - if the mutex was locked by a different thread. It may throw an exception - or assert when errors occur if the ErrorPolicy class implements that behavior. - @return An error condition if any occurred, else Success. - */ - virtual MutexErrors::Type TryLock( void ) volatile = 0; - - /** Blocking call will attempt to lock mutex and wait until it can lock. - This may throw an exception if the lock failed or an error occurred - if - that is what the error policy specifies. - @return An error condition if any occurred, else Success. - */ - virtual MutexErrors::Type Lock( void ) volatile = 0; - - /** Attempts to lock mutex, but only waits for a limited amount of time - before it gives up. Will return quickly if an error occurs before any - attempt to lock. This may throw an exception if the lock failed or an - error occurred - if that is what the error policy specifies. - @param milliSeconds How long to wait. - @return An error condition if any occurred, else Success. - */ - virtual MutexErrors::Type Lock( unsigned int milliSeconds ) volatile = 0; - - /** Unlocks the mutex, or returns an error condition. This may throw an - exception if the lock failed or an error occurred - if that is what the - error policy specifies. - @return An error condition if any occurred, else Success. - */ - virtual MutexErrors::Type Unlock( void ) volatile = 0; - - /** Returns true if this mutex was locked by current thread, and level is the same - as the current thread's level. Which means this was the most recently locked - mutex, or it was locked along with several others of the same level recently. - */ - bool IsRecentLock( void ) const volatile; - - /** Returns true if this mutex was locked within the last count mutexes. - @param count How many recent mutexes to look through to find this mutex. - */ - bool IsRecentLock( unsigned int count ) const volatile; - - /// Returns true if this was locked by current thread. - bool IsLockedByCurrentThread( void ) const volatile; - - /// Returns true if this was locked by another thread. - bool IsLockedByAnotherThread( void ) const volatile; - -protected: - - /** @class Checker Performs validity check on mutex to insure no class invariants - were violated inside any member function. This class only gets used in debug - builds, and any instance of it gets optimized away in release builds. A checker - is created inside many of member functions so that it's destructor gets called - when the function exits. It determines if any class invariants were violated - during the function call. - */ - class Checker - { - public: - 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; - }; - - /** @class MutexUndoer - Undoes actions by MultiLock if an exception occurs. It keeps track of - which mutexes in a container got locked, and if an exception occurs, then - the destructor unlocks them. If MultiLock succeeds, then it cancels the - undoer so nothing gets unlocked inadvertently. - */ - class MutexUndoer - { - public: - - explicit MutexUndoer( MutexContainer& mutexes ); - ~MutexUndoer( void ); - void SetPlace( LevelMutexContainerIter& here ); - void Cancel( void ); - - private: - - MutexUndoer( void ); - MutexUndoer( const MutexUndoer& ); - MutexUndoer& operator = ( const MutexUndoer& ); - - MutexContainer& m_mutexes; - LevelMutexContainerIter m_here; - }; - - /** Returns true if linked-list of locked mutexes in this thread is valid. - Which means the list has no loops, and each previous mutex on the list has a - higher or same level as the current mutex. Called by IsValid. - */ - static bool IsValidList( void ); - - /** This is the only available constructor, and it forces any derived class to set - a level for each mutex. - */ - explicit LevelMutexInfo( unsigned int level ); - - /// The destructor only gets called by the derived class. - virtual ~LevelMutexInfo( void ); - - MutexErrors::Type PreLockCheck( bool forTryLock ) volatile; - - MutexErrors::Type PreUnlockCheck( void ) volatile; - - /** This gets called after each call to DoLock and DoTryLock to make sure the data - members in this object get set correctly. - */ - void PostLock( void ) volatile; - - /// Gets called just before an attempt to unlock a mutex. - void PreUnlock( void ) volatile; - - /// Called to relock a mutex already locked by the current thread. - void IncrementCount( void ) volatile; - - /// Called to unlock a mutex locked multiple times by the current thread. - void DecrementCount( void ) volatile; - - /** Returns true if no class invariant broken, otherwise asserts. This function - only gets called in debug builds. - */ - bool IsValid( void ) const volatile; - -private: - - /// Copy constructor is not implemented. - LevelMutexInfo( const LevelMutexInfo& ); - /// Copy-assignment operator is not implemented. - LevelMutexInfo& operator = ( const LevelMutexInfo& ); - - /** Called only by MultiLock & MultiUnlock to pass a result through an - error checking policy. - @param result What error condition to check. - @return Result or assertion or an exception - depending on error policy. - */ - virtual MutexErrors::Type DoErrorCheck( MutexErrors::Type result ) const volatile = 0; - - /// Called only by MultiLock to Lock each particular mutex within a container. - virtual MutexErrors::Type LockThis( void ) volatile = 0; - - /** Called only by MultiLock to lock each particular mutex within a container. - @param milliSeconds How much time to wait before giving up on locking a mutex. - */ - virtual MutexErrors::Type LockThis( unsigned int milliSeconds ) volatile = 0; - - /// 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; - - /// Level of this mutex. - const unsigned int m_level; - - /// How many times this mutex got locked. - unsigned int m_count; - - /// Pointer to mutex locked before this one. - volatile LevelMutexInfo* m_previous; - -}; - -// ---------------------------------------------------------------------------- - -/** @class ThrowOnAnyMutexError - Implements the ErrorPolicy for LevelMutex and throws an exception for any - error condition. Only allows MutexErrors::Success and MutexErrors::NoProblem - to get through. Useful for release builds. - */ -class ThrowOnAnyMutexError -{ -public: - static MutexErrors::Type CheckError( MutexErrors::Type error, - unsigned int level ); -}; - -// ---------------------------------------------------------------------------- - -/** @class ThrowOnBadDesignMutexError - Implements the ErrorPolicy for LevelMutex and throws an exception if the error - indicates the programmer did not levelize the calls to mutexes. Otherwise - returns the error result. Useful for release builds. - */ -class ThrowOnBadDesignMutexError -{ -public: - static MutexErrors::Type CheckError( MutexErrors::Type error, - unsigned int level ); -}; - -// ---------------------------------------------------------------------------- - -/** @class AssertAnyMutexError - Implements the ErrorPolicy for LevelMutex and asserts for any error condition. - Only allows MutexErrors::Success and MutexErrors::NoProblem to get through. - Useful for testing mutexes in debug builds. - */ -class AssertAnyMutexError -{ -public: - static inline MutexErrors::Type CheckError( MutexErrors::Type error, - unsigned int level ) - { - (void)level; - assert( ( error == MutexErrors::Success ) - || ( error == MutexErrors::NoProblem ) ); - return error; - } -}; - -// ---------------------------------------------------------------------------- - -/** @class AssertBadDesignMutexError - Implements the ErrorPolicy for LevelMutex and asserts if the error - indicates the programmer did not levelize the calls to mutexes. Otherwise - returns the error result. Useful for testing mutexes in debug builds. - */ -class AssertBadDesignMutexError -{ -public: - static inline MutexErrors::Type CheckError( MutexErrors::Type error, - unsigned int level ) - { - (void)level; - assert( ( error != MutexErrors::LevelTooHigh ) - && ( error != MutexErrors::LevelTooLow ) ); - return error; - } -}; - -// ---------------------------------------------------------------------------- - -/** @class JustReturnMutexError - Implements the ErrorPolicy for LevelMutex and does nothing no matter how bad - the error condition. Only recommended use is for automated unit-testing of - mutex policies. - */ -class JustReturnMutexError -{ -public: - static inline MutexErrors::Type CheckError( MutexErrors::Type error, - unsigned int level ) - { - (void)level; - return error; - } -}; - -// ---------------------------------------------------------------------------- - -/** @class NoMutexWait - Implements the WaitPolicy for LevelMutex. Does nothing at all so it turns - all wait loops into spin loops. Useful for low-level mutexes. - */ -class NoMutexWait -{ -public: - static inline void Wait( void ) {} -}; - -// ---------------------------------------------------------------------------- - -/** @class MutexSleepWaits - Implements the WaitPolicy for LevelMutex. Sleeps for a moment so thread won't - consume idle CPU cycles. Useful for high-level mutexes. - */ -class MutexSleepWaits -{ -public: - static void Wait( void ); - static unsigned int sleepTime; -}; - -// ---------------------------------------------------------------------------- - -/** @class SpinLevelMutex - Implements a spin-loop to wait for the mutex to unlock. Since this class makes - the thread wait in a tight spin-loop, it can cause the thread to remain busy - while waiting and thus consume CPU cycles. For that reason, this mutex is best - used only for very low-level resources - especially resources which do not - require much CPU time to exercise. Rule of thumb: Use this only if all actions - on the resource consume a very small number of CPU cycles. Otherwise, use the - SleepLevelMutex instead. - */ -class SpinLevelMutex -{ -public: - - /// Constructs a spin-level mutex. - explicit SpinLevelMutex( unsigned int level ); - - /// Destructs the mutex. - virtual ~SpinLevelMutex( void ); - - virtual MutexErrors::Type Lock( void ) volatile; - - virtual MutexErrors::Type TryLock( void ) volatile; - - virtual MutexErrors::Type Unlock( void ) volatile; - - inline unsigned int GetLevel( void ) const volatile { return m_level; } - -private: - - /// Copy constructor is not implemented. - SpinLevelMutex( const SpinLevelMutex& ); - /// Copy-assignment operator is not implemented. - 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 - -#elif ( __GNUC__ ) - /// The actual mutex. - pthread_mutex_t m_mutex; - -#else -#error "Check if any mutex libraries are compatible with your compiler." -#endif - - /// Keep a copy of the mutex level around for error reporting. - const unsigned int m_level; - -}; // end class SpinLevelMutex - -// ---------------------------------------------------------------------------- - -/** @class SleepLevelMutex - 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 - 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 - SleepLevelMutex's should have higher levels than all your SpinLevelMutex's. - - @par Dependence on SpinLevelMutex - This utilizes SpinLevelMutex so it does not have to re-implement the DoTryLock - and DoUnlock functions the same way. All it really needs is a DoLock function - and the amount of time it should sleep if an attempt to lock a function fails. - */ -class SleepLevelMutex : public SpinLevelMutex -{ -public: - - /** Constructs a levelized mutex that puts threads to sleep while they wait - for another thread to unlock the mutex. - @param level Level of this mutex. - */ - explicit SleepLevelMutex( unsigned int level ); - - SleepLevelMutex( unsigned int level, unsigned int sleepTime ); - - /// Destructs the mutex. - virtual ~SleepLevelMutex( void ); - - inline unsigned int GetSleepTime( void ) const volatile { return m_sleepTime; } - - inline void SetSleepTime( unsigned int sleepTime ) volatile - { - if ( 0 != sleepTime ) - m_sleepTime = sleepTime; - } - -#if defined( _MSC_VER ) - inline bool GetWakable( void ) const volatile { return m_wakable; } - inline void SetWakable( bool wakable ) volatile { m_wakable = wakable; } -#endif - - /** Attempts to lock a mutex, and if it fails, then sleeps for a while - before attempting again. - */ - virtual MutexErrors::Type Lock( void ) volatile; - -private: - - /// Default constructor is not implemented. - SleepLevelMutex( void ); - /// Copy constructor is not implemented. - SleepLevelMutex( const SleepLevelMutex& ); - /// Copy-assignment operator is not implemented. - 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 -#endif - - /// How many milli-seconds to sleep before trying to lock mutex again. - unsigned int m_sleepTime; - -}; // end class SleepLevelMutex - -// ---------------------------------------------------------------------------- - -/** @class LevelMutex - Levelized mutex class prevents deadlocks by requiring programs to lock mutexes in - the same order, and unlock them in reverse order. This is accomplished by forcing - each mutex to have a level and forcing code to lock mutexes with higher levels - before locking mutexes at lower levels. If you want to lock several mutexes, they - must be locked in decreasing order by level, or if they are all of the same level, - then locked by LevelMutex::MultiLock. - - @par Features - - Immune: Very unlikely to deadlock since all mutexes are locked in the same - order and unlocked in reverse order. - - Scalable: Can handle any number of mutexes. - - Efficient: Many operations occur in constant time, and most operations require - no more than O(m) steps. - - Exception safe: All operations provide strong safety or don't throw. - - Extendable: Can work with existing mutexes through policy-based design. - - Easily Extended: Derived classes only need to implement 5 functions and a mutex - to get all the features of this class. - - Re-Entrant: Allows for re-entrancy even if mutexes in policy classes don't. - - Cost-Free: No resource allocations occur in LevelMutex - although user-defined - policy classes may allocate resources. - - Compact: Each LevelMutex object is small. - - Portable: As long as your compiler and libraries can meet the requirements. - - Robust: Maintains data integrity even if exceptions occur in policy classes. - - Affording: Several functions provide information about a mutex which allows - client code to easily choose correct actions. - - @par Requirements - - Your compiler must allow for thread-specific data. - - You must have a threading or mutex library. - - @par Policy-Based Design - This class hosts 3 policies and a default level. The policy-based design allows - users to write their own policies to extend the behaviors of LevelMutex. The - paragraphs below say how to design a class for each policy. - - MutexPolicy The mutex policy class. - - defaultLevel A level for existing client code that calls a default constructor. - - ErrorPolicy How the mutex should handle error conditions. - - WaitPolicy Whether a thread should wait, and how long in some internal loops. - - @par MutexPolicy - A policy class that wraps a low-level mutex. Loki provides two policy classes - for the actual mutex (SpinLevelMutex and SleepLevelMutex), both of which wrap - either pthreads or the Windows CRITICAL_SECTION. If you want to use a mutex - mechanism besides one of those, then all you have to do is provide a class - which wraps the mutex and implements these functions. - explicit SpinLevelMutex( unsigned int level ); - virtual ~SpinLevelMutex( void ); - virtual MutexErrors::Type Lock( void ) volatile; - virtual MutexErrors::Type TryLock( void ) volatile; - virtual MutexErrors::Type Unlock( void ) volatile; - Indeed, since the base class does most of the work, and provides all the interace - and functionality to client classes, a derived class has very few requirements. - It only needs to implement a single constructor, the destructor, some virtual - functions, and whatever data members it requires. You don't actually need to - declare those functions as virtual if the policy class is not a base or child - class. In the parlance of design patterns, LevelMutex is a Template, and the - MutexPolicy is a Strategy. - - @par DefaultLevel - The template class requires a default level to use inside the default constructor. - Some existing code calls instantiates mutexes with a default constructor, so the - mutex must know what level to use there. Please do not use zero or UnlockedLevel - as the default level. - - @par ErrorPolicy - This policy specifies how to handle error conditions. The mutexes can return - errors, assert, or throw exceptions. I recommend that debug code use asserts, - release code use exceptions, and unit-testing code just return errors. The - error policy class only needs to implement one function: - static MutexErrors::Type CheckError( MutexErrors::Type error, unsigned int level ); - - @par WaitPolicy - This states whether the mutex should wait within some tight internal loops, - how the waiting is done, and for how long. A wait policy class could sleep, - do nothing, check if other objects need attention, or check if the program - received events or notices from the operating system. It only needs to - implement one function: - static void Wait( void ); - - @par Per-Function Usage - If you implement a function with a static local mutex, then you have to insure - the function is not called from a lower level via call-backs, virtual functions in - interface classes. If the function does get called from a lower level, you are - setting up a potential deadlock. LevelMutex will detect that by checking the - current level and the local mutex's level, so it will refuse to lock the local mutex. - - @par Per-Object Usage - If you use a mutex as a data member of an object to protect that object, then I - recommend specifying which functions are volatile and which are not, and then only - use the mutex within the volatile functions. You may also want to provide accessor - functions so that client code can lock and unlock the mutex either to allow for - calling multiple operations without having to lock and unlock before and after each - operation, or so they can lock it along with several other objects at the same - level. - - @par Per-Class Usage - If you make a static data member within a class, you can use that to lock any - resources shared by those objects, or to require threads to act on only one object - at a time. You may also want to provide static accessor functions so that client - code can lock several other resources at the same level. - */ - -template -< -class MutexPolicy, - unsigned int DefaultLevel, - class ErrorPolicy = ::Loki::ThrowOnBadDesignMutexError, - class WaitPolicy = ::Loki::NoMutexWait - > -class LevelMutex : public LevelMutexInfo -{ -public: - - typedef ErrorPolicy EP; - typedef WaitPolicy WP; - typedef MutexPolicy MP; - - /** This constructor allows callers to replace the default level with another - value. It also acts as the default constructor for existing code which uses - default construction for mutexes. This is the only time the DefaultLevel - template parameter gets used. - */ - explicit LevelMutex( unsigned int level = DefaultLevel ) : - LevelMutexInfo( level ), - m_mutex( level ) - { - assert( IsValid() ); - } - - /// The destructor. - ~LevelMutex( void ) - { - assert( IsValid() ); - } - - /** These functions allow callers to access the mutex in case they need to - modify specific values in the MutexPolicy (e.g. - sleep time, functors to - call as tasks, etc...) There is one function for every combination of - 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; } - - virtual MutexErrors::Type TryLock( void ) volatile - { - assert( IsValid() ); - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) - - MutexErrors::Type result = LevelMutexInfo::PreLockCheck( true ); - if ( MutexErrors::Success == result ) - return MutexErrors::Success; - else if ( MutexErrors::AlreadyLocked == result ) - return result; - else if ( MutexErrors::NoProblem != result ) - return EP::CheckError( result, GetLevel() ); - - assert( 0 == LevelMutexInfo::GetLockCount() ); - result = m_mutex.TryLock(); - if ( MutexErrors::Success != result ) - return EP::CheckError( result, GetLevel() ); - LevelMutexInfo::PostLock(); - - return MutexErrors::Success; - } - - virtual MutexErrors::Type Lock( void ) volatile - { - assert( IsValid() ); - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) - - MutexErrors::Type result = LevelMutexInfo::PreLockCheck( false ); - if ( MutexErrors::Success == result ) - return MutexErrors::Success; - else if ( MutexErrors::NoProblem != result ) - return EP::CheckError( result, GetLevel() ); - - assert( !LevelMutexInfo::IsLockedByCurrentThread() ); - result = m_mutex.Lock(); - if ( MutexErrors::Success != result ) - return EP::CheckError( result, GetLevel() ); - PostLock(); - - return MutexErrors::Success; - } - - virtual MutexErrors::Type Lock( unsigned int milliSeconds ) volatile - { - assert( IsValid() ); - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) - - MutexErrors::Type result = LevelMutexInfo::PreLockCheck( false ); - if ( MutexErrors::Success == result ) - return MutexErrors::Success; - else if ( MutexErrors::NoProblem != result ) - return EP::CheckError( result, GetLevel() ); - - assert( !LevelMutexInfo::IsLockedByCurrentThread() ); - clock_t timeOut = clock() + milliSeconds; - while ( clock() < timeOut ) - { - WP::Wait(); - result = m_mutex.TryLock(); - switch ( result ) - { - case MutexErrors::Success: - { - PostLock(); - return MutexErrors::Success; - } - case MutexErrors::AlreadyLocked: - return MutexErrors::AlreadyLocked; - case MutexErrors::TryFailed: - break; - default: - return EP::CheckError( result, GetLevel() ); - } - } - - return MutexErrors::TimedOut; - } - - virtual MutexErrors::Type Unlock( void ) volatile - { - assert( IsValid() ); - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) - - MutexErrors::Type result = LevelMutexInfo::PreUnlockCheck(); - if ( MutexErrors::Success == result ) - return MutexErrors::Success; - else if ( MutexErrors::NoProblem != result ) - return EP::CheckError( result, GetLevel() ); - - LevelMutexInfo::PreUnlock(); - result = MutexErrors::OtherError; - try - { - result = m_mutex.Unlock(); - if ( MutexErrors::Success != result ) - PostLock(); - } - catch ( ... ) - { - PostLock(); - result = MutexErrors::ExceptionThrown; - } - - return result; - } - -private: - - /// Copy constructor is not implemented since mutexes don't get copied. - LevelMutex( const LevelMutex& ); - /// Copy-assignment operator is not implemented since mutexes don't get copied. - LevelMutex& operator = ( const LevelMutex& ); - - virtual MutexErrors::Type DoErrorCheck( MutexErrors::Type result ) const volatile - { - return EP::CheckError( result, GetLevel() ); - } - - /** Called only by MultiLock to lock each particular mutex within a container. - This does not do pre-lock error checking since MultiLock does that. Since - this skips the error checking, that means that callers of LevelMutex should - not call this function directly, and so this will not be publicly available. - @return Error status indicating success or reason for failure. - */ - virtual MutexErrors::Type LockThis( void ) volatile - { - assert( IsValid() ); - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) - assert( this != LevelMutexInfo::GetCurrentMutex() ); - - const MutexErrors::Type result = m_mutex.Lock(); - if ( MutexErrors::Success != result ) - return result; - PostLock(); - - return MutexErrors::Success; - } - - /** Called only by MultiLock to lock each particular mutex within a container. - This does not do pre-lock error checking since MultiLock does that. Since - this skips the error checking, callers of LevelMutex should not call this - function directly, and so this will not be publicly available. - @param milliSeconds How much time to wait before giving up on locking a mutex. - @return Error status indicating success or reason for failure. - */ - virtual MutexErrors::Type LockThis( unsigned int milliSeconds ) volatile - { - assert( IsValid() ); - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) - - clock_t timeOut = clock() + milliSeconds; - while ( clock() < timeOut ) - { - WP::Wait(); - const bool locked = ( MutexErrors::Success == m_mutex.TryLock() ); - if ( locked ) - { - PostLock(); - return MutexErrors::Success; - } - } - - return MutexErrors::TimedOut; - } - - /** Called only by MultiUnlock to unlock each mutex within a container. - This does not do pre-unlock error checking since MultiLock does that. Since - this skips the error checking, callers of LevelMutex should not call this - function directly, and so this will not be publicly available. - @return Error status indicating success or reason for failure. - */ - virtual MutexErrors::Type UnlockThis( void ) volatile - { - assert( IsValid() ); - assert( NULL != LevelMutexInfo::GetCurrentMutex() ); - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) - - if ( 1 < LevelMutexInfo::GetLockCount() ) - { - LevelMutexInfo::DecrementCount(); - return MutexErrors::Success; - } - - LevelMutexInfo::PreUnlock(); - MutexErrors::Type result = m_mutex.Unlock(); - - return result; - } - - /// An instance of an unleveled mutex wrapped to match LevelMutex's needs. - MutexPolicy m_mutex; - -}; // end class LevelMutex - -// ---------------------------------------------------------------------------- - -/** Returns level of most recently locked mutex by this thread, or UnlockedLevel - if no mutexes are locked. Runs in constant time, and never throws exceptions. - */ -unsigned int GetCurrentThreadsLevel( void ); - -/** Returns count of how mutexes the current thread locked. Requires O(m) - actions where m is the number of mutexes in the thread. Never throws exceptions. - */ -unsigned int CountMutexesInCurrentThread( void ); - -/** Returns count of how mutexes the current thread locked. The lock count - exceeds the number of mutexes locked by current thread if any mutex got locked - more than once. Requires O(m) actions where m is the number of mutexes in the - thread. Never throws exceptions. - */ -unsigned int CountLocksInCurrentThread( void ); - -/** Returns count of mutexes locked by current thread which have the same level - as GetCurrentThreadsLevel. Requires O(m) actions where m is the number of - mutexes in the thread at current level. Never throws exceptions. - */ -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 ); - -// ---------------------------------------------------------------------------- - -/** @class MutexException - Exception class used to throw error statuses about LevelMutex's up to code that - can respond to mutex problems. This class exists because it conveys more info - about the error condition than just ::std::exception. - */ -class MutexException : public ::std::exception -{ -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 ); - - /// Copy constructor performs a member-by-member copy of an exception. - MutexException( const MutexException& that ) throw (); - - /// Copy-assignment operator performs a member-by-member copy of an exception. - 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(); - - /// Returns level of mutex(es) used when problem occurred. - unsigned int GetLevel( void ) const { return m_level; } - - /// Returns an error status for why operation failed. - MutexErrors::Type GetReason( void ) const { return m_reason; } - -private: - - /// Default constructor is not implemented. - MutexException( void ) throw (); - - /// Simple message about operation that failed. - const char* m_message; - /// Level of mutex(es) used when problem occurred. - unsigned int m_level; - /// Error status for why operation failed. - MutexErrors::Type m_reason; - -}; // end class MutexException - -// ---------------------------------------------------------------------------- - -/** @class MutexLocker - You can place an instance of this as a local variable inside a function to lock - a single mutex. It will lock the mutex if no error occurs, or throw if one - does happen. When the function ends, the destructor will determine if it needs - to unlock the mutex. This RAII technique insures the mutex gets unlocked even - when exceptions occur. - */ -class MutexLocker -{ -public: - - /** Creates an object to lock an unlock a mutex for a function. This - will throw if an attempt to lock the mutex fails. - @param mutex Reference to the mutex. - @param lock True if function wants to lock the mutex as this gets - constructed. - */ - 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 - locked. This will throw if an attempt to lock the mutex fails. - @param mutex Reference to the mutex. - @param milliSeconds Amount of time to wait for another thread to unlock - the mutex. - @param lock True if function wants to lock the mutex as this gets - constructed. - */ - MutexLocker( volatile LevelMutexInfo& mutex, unsigned int milliSeconds, - bool lock = true ); - - /// Destructs the locker, and determines if it needs to unlock the mutex. - ~MutexLocker( void ); - - /** You can call this to lock (or relock) a mutex. In theory, you can lock - and unlock a mutex several times within a function in order to give other - threads access to a resource while this function does not need it. - @return True if mutex is locked by this, else false if not locked. - */ - bool Lock( void ); - - /** You can call this to unlock a mutex before the destructor does it. - By unlocking the mutexes before returning, the function can do other - operations without making other threads wait too long. - @return True if unlocked by this, else false if not unlocked by this. - (Which is not the same as whether the mutex itself is locked or not by - another thread.) - */ - bool Unlock( void ); - - /// 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; } - -private: - - /// Default constructor is not implemented. - MutexLocker( void ); - /// Copy constructor is not implemented. - MutexLocker( const MutexLocker& ); - /// Copy-assignment operator is not implemented. - MutexLocker& operator = ( const MutexLocker& ); - - /// True if mutex got locked. - bool m_locked; - - /// Reference to mutex. - volatile LevelMutexInfo& m_mutex; -}; - -// ---------------------------------------------------------------------------- - -/** @class MultiMutexLocker - You can place an instance of this as a local variable inside a function to lock - a collection of mutexes. It locks them if no error occurs, or throws an - exception if one does happen. When the function ends, the destructor determines - if it needs to unlock the mutexes. This RAII technique insures the mutexes get - unlocked even when exceptions occur. You will also have to construct a - MutexContainer as a local object within the same function. - */ -class MultiMutexLocker -{ -public: - - /** Creates an object to lock and unlock a collection of mutexes for a function. - This will throw if an attempt to lock any mutex fails. If an exception occurs, - it unlocks mutexes it previously locked. - @param mutex Reference to a collection of mutexes. - @param lock True if function wants to lock the mutex as this gets - constructed. - */ - 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 - that is locked. This will throw if an attempt to lock any mutex fails. If an - exception occurs, it unlocks mutexes it previously locked. - @param mutexes Reference to a collection of mutexes. - @param milliSeconds Amount of time to wait for another thread to unlock - the mutex. - @param lock True if function wants to lock the mutexes as this gets - constructed. - */ - MultiMutexLocker( LevelMutexInfo::MutexContainer& mutexes, - unsigned int milliSeconds, bool lock = true ); - - /// Destructs the locker, and determines if it needs to unlock the mutexes. - ~MultiMutexLocker( void ); - - /** You can call this to lock (or relock) the mutexes. In theory, you can lock - and unlock mutexes several times within a function in order to give other - threads access to resources while this function does not need them. - @return True if mutex is locked by this, else false if not locked. - */ - bool Lock( void ); - - /** You can call this to unlock the mutexes before the destructor does it. - By unlocking the mutexes before returning, the function can do other - operations without making other threads wait too long. - @return True if unlocked by this, else false if not unlocked by this. - (Which is not the same as whether the mutex itself is locked or not by - another thread.) - */ - bool Unlock( void ); - - /// 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; } - -private: - - /// Default constructor is not implemented. - MultiMutexLocker( void ); - /// Copy constructor is not implemented. - MultiMutexLocker( const MultiMutexLocker& ); - /// Copy-assignment operator is not implemented. - MultiMutexLocker& operator = ( const MultiMutexLocker& ); - - /// True if mutexes got locked. - bool m_locked; - - /// Reference to external container of mutexes; - LevelMutexInfo::MutexContainer& m_mutexes; -}; - -// ---------------------------------------------------------------------------- - -} // end namespace Loki - -#endif // end file guardian diff --git a/shared/loki/LockingPtr.h b/shared/loki/LockingPtr.h deleted file mode 100644 index 5482f075..00000000 --- a/shared/loki/LockingPtr.h +++ /dev/null @@ -1,110 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2001 by Andrei Alexandrescu -// This code is from the article: -// "Generic<Programming>: volatile Multithreaded Programmers Best Friend -// Volatile-Correctness or How to Have Your Compiler Detect Race Conditions -// 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 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 warranty. -// Prepared for Loki library by Richard Sposato -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_LOCKING_PTR_INC_ -#define LOKI_LOCKING_PTR_INC_ - -// $Id: LockingPtr.h 840 2008-03-19 19:44:38Z rich_sposato $ - - -#include <loki/ConstPolicy.h> -#include <loki/Threads.h> - - -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. - */ -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 - */ - 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 - -} // namespace Loki - -#endif // end file guardian - diff --git a/shared/loki/LokiExport.h b/shared/loki/LokiExport.h deleted file mode 100644 index eb02516b..00000000 --- a/shared/loki/LokiExport.h +++ /dev/null @@ -1,69 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2006 by Peter Kmmel -// 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_LOKIEXPORT_INC_ -#define LOKI_LOKIEXPORT_INC_ - -// $Id: LokiExport.h 748 2006-10-17 19:49:08Z syntheticpp $ - - -#ifdef __GNUC__ - -#ifdef _HAVE_GCC_VISIBILITY -#define LOKI_EXPORT_SPEC __attribute__ ((visibility("default"))) -#define LOKI_IMPORT_SPEC -#else -#define LOKI_EXPORT_SPEC -#define LOKI_IMPORT_SPEC -#endif - -#else - -#ifdef _WIN32 -#define LOKI_EXPORT_SPEC __declspec(dllexport) -#define LOKI_IMPORT_SPEC __declspec(dllimport) -#else -#define LOKI_EXPORT_SPEC -#define LOKI_IMPORT_SPEC -#endif - -#endif - - -#if (defined(LOKI_MAKE_DLL) && defined(LOKI_DLL)) || \ - (defined(LOKI_MAKE_DLL) && defined(LOKI_STATIC)) || \ - (defined(LOKI_DLL) && defined(LOKI_STATIC)) -#error export macro error: you could not build AND use the library -#endif - -#ifdef LOKI_MAKE_DLL -#define LOKI_EXPORT LOKI_EXPORT_SPEC -#endif - -#ifdef LOKI_DLL -#define LOKI_EXPORT LOKI_IMPORT_SPEC -#endif - -#ifdef LOKI_STATIC -#define LOKI_EXPORT -#endif - -#if !defined(LOKI_EXPORT) && !defined(EXPLICIT_EXPORT) -#define LOKI_EXPORT -#endif - -#ifndef LOKI_EXPORT -#error export macro error: LOKI_EXPORT was not defined, disable EXPLICIT_EXPORT or define a export specification -#endif - - -#endif // end file guardian - diff --git a/shared/loki/LokiTypeInfo.h b/shared/loki/LokiTypeInfo.h deleted file mode 100644 index ecb657d4..00000000 --- a/shared/loki/LokiTypeInfo.h +++ /dev/null @@ -1,103 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2001 by Andrei Alexandrescu -// This code accompanies the book: -// 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 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_LOKITYPEINFO_INC_ -#define LOKI_LOKITYPEINFO_INC_ - -// $Id: LokiTypeInfo.h 748 2006-10-17 19:49:08Z syntheticpp $ - - -#include <typeinfo> -#include <cassert> -#include "Typelist.h" - -namespace Loki -{ -//////////////////////////////////////////////////////////////////////////////// -// class TypeInfo -// 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_; -}; - -// Implementation - -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(); -} - -// 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); } -} - -#endif // end file guardian diff --git a/shared/loki/MultiMethods.h b/shared/loki/MultiMethods.h deleted file mode 100644 index ec5b7788..00000000 --- a/shared/loki/MultiMethods.h +++ /dev/null @@ -1,415 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2001 by Andrei Alexandrescu -// This code accompanies the book: -// 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 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_MULTIMETHODS_INC_ -#define LOKI_MULTIMETHODS_INC_ - -// $Id: MultiMethods.h 751 2006-10-17 19:50:37Z syntheticpp $ - - -#include "Typelist.h" -#include "LokiTypeInfo.h" -#include "Functor.h" -#include "AssocVector.h" - -//////////////////////////////////////////////////////////////////////////////// -// IMPORTANT NOTE: -// The double dispatchers implemented below differ from the excerpts shown in -// the book - they are simpler while respecting the same interface. -//////////////////////////////////////////////////////////////////////////////// - -namespace Loki -{ -//////////////////////////////////////////////////////////////////////////////// -// class template InvocationTraits (helper) -// Helps implementing optional symmetry -//////////////////////////////////////////////////////////////////////////////// - -namespace Private -{ -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); - } -}; -} - -//////////////////////////////////////////////////////////////////////////////// -// 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 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()); - } - - 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()); } -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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) -{ - 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()) - { - 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 -{ - static To& Cast(From& obj) - { - return static_cast<To&>(obj); - } -}; - -//////////////////////////////////////////////////////////////////////////////// -// class template DynamicCaster -// Implementation of the CastingPolicy used by FunctorDispatcher -//////////////////////////////////////////////////////////////////////////////// - -template <class To, class From> -struct DynamicCaster -{ - static To& Cast(From& obj) - { - return dynamic_cast<To&>(obj); - } -}; - -//////////////////////////////////////////////////////////////////////////////// -// class template Private::FnDispatcherHelper -// Implements trampolines and argument swapping used by FnDispatcher -//////////////////////////////////////////////////////////////////////////////// - -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) - { - return Callback(CastLhs::Cast(lhs), CastRhs::Cast(rhs)); - } - static ResultType TrampolineR(BaseRhs& rhs, BaseLhs& lhs) - { - return Trampoline(lhs, rhs); - } -}; -} - -//////////////////////////////////////////////////////////////////////////////// -// class template FnDispatcher -// Implements an automatic logarithmic double dispatcher for functions -// 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 -{ - 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 - { - 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() - { - 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 -{ -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>()); - } -}; -} - -//////////////////////////////////////////////////////////////////////////////// -// class template FunctorDispatcher -// Implements a logarithmic double dispatcher for functors -// 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; - - 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))); - } - 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>(); - } - - ResultType Go(BaseLhs& lhs, BaseRhs& rhs) - { - return backEnd_.Go(lhs, rhs); - } -}; -} // namespace Loki - - - -#endif // end file guardian - diff --git a/shared/loki/NullType.h b/shared/loki/NullType.h deleted file mode 100644 index 8a4bb008..00000000 --- a/shared/loki/NullType.h +++ /dev/null @@ -1,34 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2001 by Andrei Alexandrescu -// This code accompanies the book: -// 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 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_NULLTYPE_INC_ -#define LOKI_NULLTYPE_INC_ - -// $Id: NullType.h 751 2006-10-17 19:50:37Z syntheticpp $ - - -namespace Loki -{ -//////////////////////////////////////////////////////////////////////////////// -// class NullType -// Used as a placeholder for "no type here" -// Useful as an end marker in typelists -//////////////////////////////////////////////////////////////////////////////// - -class NullType {}; - -} // namespace Loki - - -#endif // end file guardian diff --git a/shared/loki/OrderedStatic.h b/shared/loki/OrderedStatic.h deleted file mode 100644 index f0ff73c3..00000000 --- a/shared/loki/OrderedStatic.h +++ /dev/null @@ -1,225 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2005 Peter Kmmel -// 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_ORDEREDSTATIC_INC_ -#define LOKI_ORDEREDSTATIC_INC_ - -// $Id: OrderedStatic.h 751 2006-10-17 19:50:37Z syntheticpp $ - - -#include <vector> -#include <iostream> - -#include "LokiExport.h" -#include "Singleton.h" -#include "Typelist.h" -#include "Sequence.h" - -// usage: see test/OrderedStatic - -namespace Loki -{ -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*() - { - 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> -{ -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 - - -#endif // end file guardian - diff --git a/shared/loki/Pimpl.h b/shared/loki/Pimpl.h deleted file mode 100644 index 8254e3e2..00000000 --- a/shared/loki/Pimpl.h +++ /dev/null @@ -1,198 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2006 Peter Kmmel -// 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_PIMPL_INC_ -#define LOKI_PIMPL_INC_ - -// $Id: Pimpl.h 751 2006-10-17 19:50:37Z syntheticpp $ - - -/// \defgroup PimplGroup Pimpl - -#ifndef LOKI_INHERITED_PIMPL_NAME -#define LOKI_INHERITED_PIMPL_NAME d -#endif - -#ifndef LOKI_INHERITED_RIMPL_NAME -#define LOKI_INHERITED_RIMPL_NAME d -#endif - -namespace Loki -{ - -////////////////////////////////////////// -/// \class ConstPropPtr -/// -/// \ingroup PimplGroup -/// Simple const propagating smart pointer -/// Is the default smart pointer of Pimpl. -////////////////////////////////////////// - -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() - { - // 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_; -}; - - -template<class T, typename Pointer = ConstPropPtr<T> > -struct PimplOwner -{ - Pimpl<T, Pointer> LOKI_INHERITED_PIMPL_NAME; -}; - - -////////////////////////////////////////// -/// \class ImplOf -/// -/// \ingroup PimplGroup -/// Convenience template for the -/// implementations which Pimpl points to. -////////////////////////////////////////// - -template<class T> -struct ImplOf; - - -////////////////////////////////////////// -/// \class PImplOf -/// -/// \ingroup PimplGroup -/// Convenience template which uses ImplOf -/// as implementation structure -////////////////////////////////////////// - - -template<class T, template<class> class Ptr = ConstPropPtr> -struct PimplOf -{ - typedef T Impl; - - // declare pimpl - typedef Pimpl<ImplOf<T>, Ptr<ImplOf<T> > > Type; - - // inherit pimpl - typedef PimplOwner<ImplOf<T>, Ptr<ImplOf<T> > > Owner; -}; - - -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 deleted file mode 100644 index 3f7ecfef..00000000 --- a/shared/loki/RefToValue.h +++ /dev/null @@ -1,70 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2006 Richard Sposato -// Copyright (c) 2006 Peter Kmmel -// 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. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_REFTOVALUE_INC_ -#define LOKI_REFTOVALUE_INC_ - -// $Id: RefToValue.h 751 2006-10-17 19:50:37Z syntheticpp $ - - -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) -{ - return RefToValue<T>(t); -} - -} - - -#endif // end file guardian - diff --git a/shared/loki/Register.h b/shared/loki/Register.h deleted file mode 100644 index 2b549381..00000000 --- a/shared/loki/Register.h +++ /dev/null @@ -1,134 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2006 Peter Kmmel -// 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_REGISTER_INC_ -#define LOKI_REGISTER_INC_ - -// $Id: Register.h 776 2006-11-09 13:12:57Z syntheticpp $ - - -#include "TypeManip.h" -#include "HierarchyGenerators.h" - -/// \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 - : 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 - : 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 -//////////////////////////////////////////////////////////////////////////////// - - -#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 ) \ - \ - struct LOKI_CONCAT(check_,CLASS,_isInList_,LIST) \ - { \ - typedef int LOKI_CONCAT(ERROR_class_,CLASS,_isNotInList_,LIST); \ - }; \ - typedef Loki::Select<Loki::TL::IndexOf<LIST, CLASS>::value == -1, \ - CLASS, \ - LOKI_CONCAT(check_,CLASS,_isInList_,LIST)> \ - ::Result LOKI_CONCAT(CLASS,isInList,LIST,result); \ - typedef LOKI_CONCAT(CLASS,isInList,LIST,result):: \ - LOKI_CONCAT(ERROR_class_,CLASS,_isNotInList_,LIST) \ - LOKI_CONCAT(ERROR_class_,CLASS,_isNotInList__,LIST); - - -} // namespace Loki - - -#endif // end file guardian - diff --git a/shared/loki/SPCachedFactory.h b/shared/loki/SPCachedFactory.h deleted file mode 100644 index e1b8ec8c..00000000 --- a/shared/loki/SPCachedFactory.h +++ /dev/null @@ -1,204 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2006 by Guillaume Chatelet -// -// 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 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 -// Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// -//////////////////////////////////////////////////////////////////////////////// - -// $Id: SPCachedFactory.h 896 2008-08-08 22:20:05Z syntheticpp $ - -#ifndef SPCACHEDFACTORY_H_ -#define SPCACHEDFACTORY_H_ - -/** - * This file is intented to be used if you want a CachedFactory with - * a SmartPointer encapsulation policy. - * 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. - * - * This file defines FunctionStorage a new SmartPointer storage policy and - * SmartPointer a new CachedFactory encapsulation policy. - */ - -#include <loki/Functor.h> -#include <loki/SmartPtr.h> -#include <loki/CachedFactory.h> - -namespace Loki -{ - -//////////////////////////////////////////////////////////////////////////////// -/// \class FunctionStorage -/// -/// \ingroup SmartPointerStorageGroup -/// \brief Implementation of the StoragePolicy used by SmartPtr. -/// -/// This storage policy is used by SmartPointer CachedFactory's encapsulation -/// policy. It's purpose is to call a Functor instead of deleting the -/// underlying pointee object. You have to set the callback functor by calling -/// SetCallBackFunction(const FunctorType &functor). -/// -/// Unfortunately, the functor argument is not a reference to the SmartPtr but -/// a void *. Making functor argument a reference to the pointer would require -/// the FunctionStorage template to know the full definition of the SmartPtr. -//////////////////////////////////////////////////////////////////////////////// - -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) - { - CallBackSP& SP(*reinterpret_cast<CallBackSP*>(pSP)); - ReleaseObject(SP); - } - virtual void ReleaseObject(ProductReturn& object) = 0; - const typename CallBackSP::FunctorType fun; -}; - -} // namespace Loki - -#endif /*SPCACHEDFACTORY_H_*/ diff --git a/shared/loki/SafeBits.h b/shared/loki/SafeBits.h deleted file mode 100644 index 9e160c50..00000000 --- a/shared/loki/SafeBits.h +++ /dev/null @@ -1,514 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2009 by Fedor Pikus & Rich 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 notice appear in supporting documentation. -// -// The author makes no claims about the suitability of this software for any -// purpose. It is provided "as is" without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// - -// $Id$ - - -#ifndef LOKI_INCLUDED_SAFE_BIT_FIELDS_H -#define LOKI_INCLUDED_SAFE_BIT_FIELDS_H - -#include <cstdlib> -#include <assert.h> -#include <loki/static_check.h> - - -namespace Loki -{ - -/* - ========================================================================================================================================== - SafeBitField - type-safe class for bit fields. - SafeBitConst - type-safe class for bit constants. - SafeBitField is designed to be a [almost] drop-in replacement for integer flags and bit fields where individual bits are set and checked - using symbolic names for flags: - - typedef unsigned long Labels_t; - Labels_t labels; - const Labels_t Label_A = 0x00000001; - const Labels_t Label_B = 0x00000002; - ... - labels |= Label_B; - if ( labels & Label_A ) { ... } - - Such code offers no protection against mismatching bit constants and bit fields: - - typedef unsigned long Kinds_t; - Kinds_t kinds; - const Kinds_t Kind_A = 0x00000004; - ... - if ( kinds & Label_A ) { ... } // Error but compiles - - SafeBitField is a drop-in replacement which generates a unique type for each bit field. Bit fields of different types cannot be applied - to each other: - - LOKI_BIT_FIELD( unsigned long ) Labels_t; - Labels_t labels; - LOKI_BIT_CONST( Labels_t, Label_A, 1 ); // 0x0001 - 1st bit is set - LOKI_BIT_CONST( Labels_t, Label_B, 2 ); // 0x0002 - 1st bit is set - ... - LOKI_BIT_FIELD( unsigned long ) Kinds_t; - Kinds_t kinds; - LOKI_BIT_CONST( Kinds_t, Kind_A, 3 ); // 0x0004 - 1st bit is set - ... - if ( kinds & Label_A ) { ... } // Does not compile - - Several other kinds of bit field misuse are caught by safe bit fields: - - if ( kinds & Kind_A == 0 ) { ... } - if ( kinds && Kind_A ) { ... } - - There are few cases where drop-in replacement does not work: - - 1. Operations involving bit fields and unnamed integers. Usually the integer in question is 0: - - Labels_t labels = 0; // No longer compiles - if ( ( labels & Label_A ) == 0 ) { ... } // Also does not compile - - The solution is to use named bit constants, including the one for 0: - - LOKI_BIT_CONST( Labels_t, Label_None, 0 ); // 0x0000 - No bit is set - Labels_t labels = Label_None; // Or just Labels_t labels; - constructor initializes to 0 - if ( ( labels & Label_A ) == Label_None ) { ... } // // Or just if ( labels & Label_A ) { ... } - - 2. I/O and other operations which require integer variables and cannot be modified: - - void write_to_db( unsigned int word ); - Labels_t labels; - write_to_db( labels ); // No longer compiles - - This problem is solved by reinterpreting the bit fields as an integer, the user is responsible for using the right - type of integer: - - write_to_db( *((Labels_t::bit_word_t*)(&labels)) ); - - ========================================================================================================================================== -*/ - -/// @par Non-Templated Initialization. -/// Not all compilers support template member functions where the template -/// arguments are not deduced but explicitly specified. For these broken -/// compilers, a non-template make_bit_const() function is provided instead of -/// 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 -#endif - -/// @par Forbidding Conversions. -/// This incomplete type prevents compilers from instantiating templates for -/// type conversions which should not happen. This incomplete type must be a -/// template: if the type is incomplete at the point of template definition, -/// the template is illegal (although the standard allows compilers to accept -/// or reject such code, §14.6/, so some compilers will not issue diagnostics -/// unless template is instantiated). The standard-compliant way is to defer -/// binding to the point of instantiation by making the incomplete type itself -/// a template. -template < typename > struct Forbidden_conversion; // This struct must not be defined! - -/// Forward declaration of the field type. -template < -unsigned int unique_index, - typename word_t = unsigned long - > class SafeBitField; - -//////////////////////////////////////////////////////////////////////////////// -/// \class SafeBitConst Bit constants. -/// This class defines a bit-field constant - a collection of unchanging bits -/// used to compare to bit-fields. Instances of this class are intended to act -/// as labels for bit-fields. -/// -/// \par Safety -/// - This class provides operations used for comparisons and conversions, but -/// no operations which may modify the value. -/// - As a templated class, it provides type-safety so bit values and constants -/// used for different reasons may not be unknowingly compared to each other. -/// - The unique_index template parameter insures the unique type of each bit -/// bit-field. It shares the unique_index with a similar SafeBitField. -/// - Its operations only allow comparisons to other bit-constants and -/// bit-fields of the same type. -//////////////////////////////////////////////////////////////////////////////// - -template -< -unsigned int unique_index, - typename word_t = unsigned long - > -class SafeBitConst -{ -public: - - /// Type of the bit field is available if needed. - typedef word_t bit_word_t; - /// Corresponding field type. - typedef SafeBitField< unique_index, word_t > field_t; - /// Typedef is not allowed in friendship declaration. - friend class SafeBitField< unique_index, word_t >; - - // Static factory constructor, creates a bit constant with one bit set. The position of the bit is given by the template parameter, - // bit 1 is the junior bit, i.e. make_bit_const<1>() returns 1. Bit index 0 is a special case and returns 0. - // This function should be used only to initialize the static bit constant objects. - // This function will not compile if the bit index is outside the vaild range. - // There is also a compile-time assert to make sure the size of the class is the same as the size of the underlaying integer type. - // This assert could go into the constructor, but aCC does not seem to understand sizeof(SafeBitConst) in the constructor. - // -#ifndef LOKI_BIT_FIELD_NONTEMPLATE_INIT - template < unsigned int i > static SafeBitConst make_bit_const() - { - LOKI_STATIC_CHECK( i <= ( 8 * sizeof(word_t) ), Index_is_beyond_size_of_data ); - LOKI_STATIC_CHECK( sizeof(SafeBitConst) == sizeof(word_t), Object_size_does_not_match_data_size ); - // Why check for ( i > 0 ) again inside the shift if the shift - // can never be evaluated for i == 0? Some compilers see shift by ( i - 1 ) - // and complain that for i == 0 the number is invalid, without - // checking that shift needs evaluating. - return SafeBitConst( ( i > 0 ) ? ( word_t(1) << ( ( i > 0 ) ? ( i - 1 ) : 0 ) ) : 0 ); - } -#else - static SafeBitConst make_bit_const( unsigned int i ) - { - LOKI_STATIC_CHECK( sizeof(SafeBitConst) == sizeof(word_t), Object_size_does_not_match_data_size ); - assert( i <= ( 8 * sizeof(word_t) ) ); // Index is beyond size of data. - // Why check for ( i > 0 ) again inside the shift if the shift - // can never be evaluated for i == 0? Some compilers see shift by ( i - 1 ) - // and complain that for i == 0 the number is invalid, without - // checking that shift needs evaluating. - return SafeBitConst( ( i > 0 ) ? ( word_t(1) << ( ( i > 0 ) ? ( i - 1 ) : 0 ) ) : 0 ); - } -#endif - - /// Default constructor allows client code to construct bit fields on the stack. - SafeBitConst() : word( 0 ) {} - - /// Copy constructor. - 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; } - - /// 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; } - - /// 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 ~ ( 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 ); } - - /// The shift operators move bits inside the bit field. These are useful in - /// loops which act over bit fields and increment them. - const SafeBitConst operator << ( unsigned int s ) const { return SafeBitConst( word << s ); } - const SafeBitConst operator >> ( unsigned int s ) const { return SafeBitConst( word >> s ); } - - /// Word size is also the maximum number of different bit fields for a given word type. - static size_t size() { return ( 8 * sizeof( word_t ) ); } - -private: - - /// Copy-assignment operator is not implemented since it does not make sense - /// for a constant object. - SafeBitConst operator = ( const SafeBitConst& rhs ); - - // Private constructor from an integer type. - explicit SafeBitConst( word_t init ) : word( init ) {} - - /// This data stores a single bit value. It is declared const to enforce - // constness for all functions of this class. - const word_t word; - - // Here comes the interesting stuff: all the operators designed to - // trap unintended conversions and make them not compile. - // Operators below handle code like this: - // SafeBitField<1> label1; - // SafeBitField<2> label2; - // if ( label1 & label2 ) { ... } - - // These operators are private, and will not instantiate in any - // event because of the incomplete Forbidden_conversion struct. - template < typename T > SafeBitConst operator|( T ) const { Forbidden_conversion< T > wrong; return *this; } - template < typename T > SafeBitConst operator&( T ) const { Forbidden_conversion< T > wrong; return *this; } - template < typename T > SafeBitConst operator^( T ) const { Forbidden_conversion< T > wrong; return *this; } - template < typename T > SafeBitConst operator|=( T ) const { Forbidden_conversion< T > wrong; return *this; } - template < typename T > SafeBitConst operator&=( T ) const { Forbidden_conversion< T > wrong; return *this; } - template < typename T > SafeBitConst operator^=( T ) const { Forbidden_conversion< T > wrong; return *this; } - - // And the same thing for comparisons: private and unusable. - // if ( label1 == label2 ) { ... } - template < typename T > bool operator==( const T ) const { Forbidden_conversion< T > wrong; return true; } - template < typename T > bool operator!=( const T ) const { Forbidden_conversion< T > wrong; return true; } - template < typename T > bool operator<( const T ) const { Forbidden_conversion< T > wrong; return true; } - template < typename T > bool operator>( const T ) const { Forbidden_conversion< T > wrong; return true; } - template < typename T > bool operator<=( const T ) const { Forbidden_conversion< T > wrong; return true; } - template < typename T > bool operator>=( const T ) const { Forbidden_conversion< T > wrong; return true; } -}; - - -//////////////////////////////////////////////////////////////////////////////// -/// \class SafeBitConst Bit constants. -/// This class defines a bit-field constant - a collection of unchanging bits -/// used to compare to bit-fields. Instances of this class are intended to -/// store bit values. -/// -/// \par Safety -/// - This class provides operations used for comparisons and conversions, and -/// also operations which may safely modify the value. -/// - As a templated class, it provides type-safety so bit values and constants -/// used for different reasons may not be unknowingly compared to each other. -/// - The unique_index template parameter insures the unique type of each bit -/// bit-field. It shares the unique_index with a similar SafeBitConst. -/// - Its operations only allow comparisons to other bit-constants and -/// bit-fields of the same type. -//////////////////////////////////////////////////////////////////////////////// - -template -< -unsigned int unique_index, - typename word_t - > -class SafeBitField -{ -public: - - /// Type of the bit field is available if needed. - typedef word_t bit_word_t; - /// Corresponding field type. - typedef SafeBitConst< unique_index, word_t > const_t; - /// Typedef is not allowed in friendship declaration. - friend class SafeBitConst<unique_index, word_t>; - - /// Default constructor allows client code to construct bit fields on the stack. - 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; } - - /// 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; } - - /// 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; } - - /// 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; } - - /// 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 ~ ( 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 ); } - - /// Bitwise operators that use bit-constants. - SafeBitField operator | ( const_t rhs ) const { return SafeBitField( word | rhs.word ); } - SafeBitField operator & ( const_t rhs ) const { return SafeBitField( word & rhs.word ); } - SafeBitField operator ^ ( const_t rhs ) const { return SafeBitField( word ^ rhs.word ); } - SafeBitField operator |= ( const_t rhs ) { word |= rhs.word; return SafeBitField( *this ); } - SafeBitField operator &= ( const_t rhs ) { word &= rhs.word; return SafeBitField( *this ); } - SafeBitField operator ^= ( const_t rhs ) { word ^= rhs.word; return SafeBitField( *this ); } - - // Conversion to bool. - // This is a major source of headaches, but it's required to support code like this: - // const static SafeBitConst<1> Label_value = SafeBitConst<1>::make_bit_const<1>(); - // SafeBitField<1> label; - // if ( label & Label_value ) { ... } // Nice... - // - // The downside is that this allows all sorts of nasty conversions. Without additional precautions, bit fields of different types - // can be converted to bool and then compared or operated on: - // SafeBitField<1> label1; - // SafeBitField<2> label2; - // if ( label1 == label2 ) { ... } // Yuck! - // if ( label1 & label2 ) { ... } // Blech! - // - // It is somewhat safer to convert to a pointer, at least pointers to different types cannot be readilly compared, and there are no - // bitwise operations on pointers, but the conversion from word_t to a pointer can have run-time cost if they are of different size. - // - operator const bool() const { return ( 0 != word ); } - - // Shift operators shift bits inside the bit field. Does not make - // sense, most of the time, except perhaps to loop over labels and - // increment them. - SafeBitField operator << ( unsigned int s ) { return SafeBitField( word << s ); } - SafeBitField operator >> ( unsigned int s ) { return SafeBitField( word >> s ); } - SafeBitField operator <<= ( unsigned int s ) { word <<= s; return *this; } - SafeBitField operator >>= ( unsigned int s ) { word >>= s; return *this; } - - // Word size is also the maximum number of different bit fields for - // a given word type. - static size_t size( void ) { return ( 8 * sizeof( word_t ) ); } - -private: - - /// Private constructor from an integer type. Don't put too much stock into - /// explicit declaration, it's better than nothing but does not solve all - /// problems with undesired conversions because SafeBitField coverts to bool. - explicit SafeBitField( word_t init ) : word( init ) {} - - /// This stores the bits. - word_t word; - - // Here comes the interesting stuff: all the operators designed to - // trap unintended conversions and make them not compile. - // Operators below handle code like this: - // SafeBitField<1> label1; - // SafeBitField<2> label2; - // if ( label1 & label2 ) { ... } - - // These operators are private, and will not instantiate in any - // event because of the incomplete Forbidden_conversion struct. - template < typename T > SafeBitField operator | ( T ) const { Forbidden_conversion< T > wrong; return *this; } - template < typename T > SafeBitField operator & ( T ) const { Forbidden_conversion< T > wrong; return *this; } - template < typename T > SafeBitField operator ^ ( T ) const { Forbidden_conversion< T > wrong; return *this; } - template < typename T > SafeBitField operator |= ( T ) const { Forbidden_conversion< T > wrong; return *this; } - template < typename T > SafeBitField operator &= ( T ) const { Forbidden_conversion< T > wrong; return *this; } - template < typename T > SafeBitField operator ^= ( T ) const { Forbidden_conversion< T > wrong; return *this; } - - // And the same thing for comparisons: - // if ( label1 == label2 ) { ... } - template < typename T > bool operator == ( const T ) const { Forbidden_conversion< T > wrong; return true; } - template < typename T > bool operator != ( const T ) const { Forbidden_conversion< T > wrong; return true; } - template < typename T > bool operator < ( const T ) const { Forbidden_conversion< T > wrong; return true; } - template < typename T > bool operator > ( const T ) const { Forbidden_conversion< T > wrong; return true; } - template < typename T > bool operator <= ( const T ) const { Forbidden_conversion< T > wrong; return true; } - template < typename T > bool operator >= ( const T ) const { Forbidden_conversion< T > wrong; return true; } -}; - -// The above template member operators catch errors when the first -// argument to a binary operator is a label, but they don't work when -// the first argument is an integer and the second one is a label: the -// label converts to bool and the operator is performed on two integers. -// These operators catch errors like this: -// SafeBitField<1> label1; -// SafeBitField<2> label2; -// if ( !label1 & label2 ) { ... } -// where the first label is converted to bool (these errors cannot be -// caught by member operators of SafeBitField class because the first -// argument is not SafeBitField but bool. -// -// If used, these operators will not instantiate because of the -// incomplete Forbidden_conversion struct. - -template < unsigned int unique_index, typename word_t > -inline SafeBitField< unique_index, word_t > operator & ( bool, SafeBitField< unique_index, word_t > rhs ) -{ - Forbidden_conversion<word_t> wrong; - return rhs; -} - -template < unsigned int unique_index, typename word_t > -inline SafeBitField< unique_index, word_t > operator | ( bool, SafeBitField< unique_index, word_t > rhs ) -{ - Forbidden_conversion< word_t > wrong; - return rhs; -} - -template < unsigned int unique_index, typename word_t > -inline SafeBitField< unique_index, word_t > operator ^ ( bool, SafeBitField< unique_index, word_t > rhs ) -{ - Forbidden_conversion< word_t > wrong; - return rhs; -} - -template < unsigned int unique_index, typename word_t > -inline SafeBitField< unique_index, word_t > operator == ( bool, SafeBitField< unique_index, word_t > rhs ) -{ - Forbidden_conversion< word_t > wrong; - return rhs; -} - -template < unsigned int unique_index, typename word_t > -inline SafeBitField< unique_index, word_t > operator != ( bool, SafeBitField< unique_index, word_t > rhs ) -{ - Forbidden_conversion< word_t > wrong; - return rhs; -} - -// Finally, few macros. All macros are conditionally defined to use the SafeBitField classes if LOKI_SAFE_BIT_FIELD is defined. Otherwise, -// the macros fall back on the use of typedefs and integer constants. This provides no addititonal safety but allows the code to support the -// mixture of compilers which are broken to different degrees. -#define LOKI_SAFE_BIT_FIELD - -// The first macro helps to declare new bit field types: -// LOKI_BIT_FIELD( ulong ) field_t; -// 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> -#else -#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 ) \ - 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 ) \ - static const field_t::const_t label = field_t::const_t::make_bit_const( bit_index ) -#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 ) -#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 -#else -#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() -#else -#define LOKI_BIT_FIELD_COUNT( field_t ) ( 8 * sizeof(field_t) ) -#endif // LOKI_SAFE_BIT_FIELD - -} // namespace Loki - -#endif // LOKI_INCLUDED_SAFE_BIT_FIELDS_H diff --git a/shared/loki/SafeFormat.h b/shared/loki/SafeFormat.h deleted file mode 100644 index bd2837f9..00000000 --- a/shared/loki/SafeFormat.h +++ /dev/null @@ -1,682 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// Copyright (c) 2005 by Andrei Alexandrescu -// Copyright (c) 2006 Peter Kmmel -// 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" without express or implied -// warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_SAFEFORMAT_INC_ -#define LOKI_SAFEFORMAT_INC_ - -// $Id: SafeFormat.h 911 2008-12-15 20:55:24Z syntheticpp $ - - -//////////////////////////////////////////////////////////////////////////////// -// 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 -//////////////////////////////////////////////////////////////////////////////// - -#include <cstdio> -#include <climits> -#include <string> -#include <cstring> -#include <stdexcept> -#include <utility> -#include <cassert> -#include <locale> -#include <iostream> - -#include <loki/LokiExport.h> - - -// long is 32 bit on 64-bit Windows! -// intptr_t used to get 64 bit on Win64 -#if defined(_WIN32) || defined(_WIN64) -# define LOKI_SAFEFORMAT_SIGNED_LONG intptr_t -# define LOKI_SAFEFORMAT_UNSIGNED_LONG uintptr_t -#else -# define LOKI_SAFEFORMAT_SIGNED_LONG signed long -# define LOKI_SAFEFORMAT_UNSIGNED_LONG unsigned long -#endif - -// Windows headers could have min/max defined -#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; -} - -//////////////////////////////////////////////////////////////////////////////// -// 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() - { - } - -#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) -#if (defined(_WIN32) || defined(_WIN64)) - LOKI_PRINTF_STATE_FORWARD(unsigned long) -#else - // 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_; - 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)); - } - } - 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()(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; - } - 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); - } - else - { - Fill(' ', width_ - len); - Write(s, s + len); - } - } - else - { - Write(s, s + len); - } - 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; - } - 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; - } - } - 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(); - } - - 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; - } - - 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 -#else - _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 - } - - void Fill(const Char c, size_t n) - { - for (; n > 0; --n) - { - Write(&c, &c + 1); - } - } - - 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; - } - - 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; - } - - 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; - } - // It's a "%%" - Write(begin, ++format_); - begin = ++format_; - continue; - } - if (*format_ == 0) - { - Write(begin, format_); - break; - } - ++format_; - } - } - - 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 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 ReadLeaders() - { - ReadFlags(); - ReadWidth(); - if (*format_ == '.') ReadPrecision(); - ReadModifiers(); - } - - 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; - } - - // 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> Printf(const char* format); - -LOKI_EXPORT -PrintfState<std::FILE*, char> Printf(const std::string& format); - -LOKI_EXPORT -PrintfState<std::FILE*, char> FPrintf(std::FILE* f, const char* format); - -LOKI_EXPORT -PrintfState<std::FILE*, char> FPrintf(std::FILE* f, const std::string& format); - -LOKI_EXPORT -PrintfState<std::ostream&, char> FPrintf(std::ostream& f, const char* format); - -LOKI_EXPORT -PrintfState<std::ostream&, char> FPrintf(std::ostream& f, const std::string& format); - -LOKI_EXPORT -PrintfState<std::string&, char> SPrintf(std::string& s, const char* format); - -LOKI_EXPORT -PrintfState<std::string&, char> SPrintf(std::string& s, const std::string& 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 - - -#endif // end file guardian - diff --git a/shared/loki/ScopeGuard.h b/shared/loki/ScopeGuard.h deleted file mode 100644 index 99ce569d..00000000 --- a/shared/loki/ScopeGuard.h +++ /dev/null @@ -1,669 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2000 Andrei Alexandrescu -// 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 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 warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_SCOPEGUARD_INC_ -#define LOKI_SCOPEGUARD_INC_ - -// $Id: ScopeGuard.h 799 2006-12-20 00:37:13Z rich_sposato $ - - -#include "RefToValue.h" - -/// \defgroup ExceptionGroup Exception-safe code - -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 (...) - {} - } - - 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); - } - - ~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 -#define LOKI_CONCATENATE(s1, s2) LOKI_CONCATENATE_DIRECT(s1, s2) -#define LOKI_ANONYMOUS_VARIABLE(str) LOKI_CONCATENATE(str, __LINE__) - -#define LOKI_ON_BLOCK_EXIT ::Loki::ScopeGuard LOKI_ANONYMOUS_VARIABLE(scopeGuard) = ::Loki::MakeGuard -#define LOKI_ON_BLOCK_EXIT_OBJ ::Loki::ScopeGuard LOKI_ANONYMOUS_VARIABLE(scopeGuard) = ::Loki::MakeObjGuard - -//by ZenJu -#define LOKI_ON_BLOCK_EXIT2(X) ::Loki::ScopeGuard LOKI_ANONYMOUS_VARIABLE(scopeGuard) = ::Loki::MakeGuard([&](){X;}); (void)LOKI_ANONYMOUS_VARIABLE(scopeGuard); - -#endif // end file guardian - diff --git a/shared/loki/Sequence.h b/shared/loki/Sequence.h deleted file mode 100644 index 04a64174..00000000 --- a/shared/loki/Sequence.h +++ /dev/null @@ -1,49 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2005 by Peter Kmmel -// 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_SEQUENCE_INC_ -#define LOKI_SEQUENCE_INC_ - -// $Id: Sequence.h 768 2006-10-25 20:40:40Z syntheticpp $ - - -#include "Typelist.h" - -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; -}; - -} // namespace Loki - -#endif // end file guardian - diff --git a/shared/loki/Singleton.h b/shared/loki/Singleton.h deleted file mode 100644 index 1e479032..00000000 --- a/shared/loki/Singleton.h +++ /dev/null @@ -1,889 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2001 by Andrei Alexandrescu -// This code accompanies the book: -// 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 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_SINGLETON_INC_ -#define LOKI_SINGLETON_INC_ - -// $Id: Singleton.h 834 2007-08-02 19:36:10Z syntheticpp $ - - -#include "LokiExport.h" -#include "Threads.h" -#include <algorithm> -#include <stdexcept> -#include <cassert> -#include <cstdlib> -#include <new> -#include <vector> -#include <list> -#include <memory> - -#ifdef _MSC_VER -#define LOKI_C_CALLING_CONVENTION_QUALIFIER __cdecl -#else -#define LOKI_C_CALLING_CONVENTION_QUALIFIER -#endif - -/// \defgroup SingletonGroup Singleton -/// \defgroup CreationGroup Creation policies -/// \ingroup SingletonGroup -/// \defgroup LifetimeGroup Lifetime policies -/// \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 -/// 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 -/// Be aware of this when you use Loki::Factory, Loki::Functor, or Loki::Function. - - - -namespace Loki -{ -typedef void (LOKI_C_CALLING_CONVENTION_QUALIFIER* atexit_pfn_t)(); - -namespace Private -{ - -#ifndef LOKI_MAKE_DLL -void LOKI_C_CALLING_CONVENTION_QUALIFIER AtExitFn(); // declaration needed below -#else -void LOKI_EXPORT AtExitFn(); -#endif - -class LifetimeTracker; - -#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; -#else -// Helper data -typedef LifetimeTracker** TrackerArray; -extern TrackerArray pTrackerArray; -extern unsigned int elements; -#endif - -//////////////////////////////////////////////////////////////////////////////// -// 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() {} - -// 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); -} - -#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); -} - -#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); -} - -//////////////////////////////////////////////////////////////////////////////// -/// \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; - - static T* Create() - { - return new (allocator.allocate(1)) T; - } - - 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 -{ - 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( disable : 4121 ) - // 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); - }; - -#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 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) - { -#ifndef ATEXIT_FIXED - if (!destroyedOnce_) -#endif - std::atexit(pFun); - } - - static void OnDeadReference() - { -#ifndef ATEXIT_FIXED - destroyedOnce_ = true; -#endif - } - -private: -#ifndef ATEXIT_FIXED - static bool destroyedOnce_; -#endif -}; - -#ifndef ATEXIT_FIXED -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: - - 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() - { - 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; -#else - 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; - -//////////////////////////////////////////////////////////////////////////////// -// class template Adapter -// Helper for SingletonWithLongevity below -//////////////////////////////////////////////////////////////////////////////// - -namespace Private -{ -template <class T> -struct Adapter -{ - void operator()(T*) { return pFun_(); } - atexit_pfn_t pFun_; -}; -} - -//////////////////////////////////////////////////////////////////////////////// -/// \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) - { - Private::Adapter<T> adapter = { pFun }; - SetLongevity(pObj, GetLongevity(pObj), adapter); - } - - 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 Init() - { - static bool done = false; - if (!done) - { - followers_ = new Container; - done = true; - } - } - - static void AddFollower(atexit_pfn_t ae) - { - Init(); - followers_->push_back(ae); - } - - static void DestroyFollowers() - { - Init(); - for (iterator it = followers_->begin(); it != followers_->end(); ++it) - (*it)(); - delete followers_; - } - }; - -public: - - /// \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: - - /// 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_) - { - MakeInstance(); - } - return *pInstance_; -} - -//////////////////////////////////////////////////////////////////////////////// -// 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() -{ - typename ThreadingModel<SingletonHolder, MutexPolicy>::Lock guard; - (void)guard; - - if (!pInstance_) - { - if (destroyed_) - { - 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; -} - - -//////////////////////////////////////////////////////////////////////////////// -/// \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(); -}; - -} // namespace Loki - - -/// \def LOKI_SINGLETON_INSTANCE_DEFINITION(SHOLDER) -/// Convenience macro for the definition of the static Instance member function -/// Put this macro called with a SingletonHolder typedef into your cpp file. - -#define LOKI_SINGLETON_INSTANCE_DEFINITION(SHOLDER) \ - namespace Loki \ - { \ - template<> \ - SHOLDER::ObjectType& Singleton<SHOLDER::ObjectType>::Instance() \ - { \ - return SHOLDER::Instance(); \ - } \ - } - - -#endif // end file guardian - diff --git a/shared/loki/SmallObj.cpp b/shared/loki/SmallObj.cpp deleted file mode 100644 index 1c42374f..00000000 --- a/shared/loki/SmallObj.cpp +++ /dev/null @@ -1,1226 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2001 by Andrei Alexandrescu -// This code accompanies the book: -// 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 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// - -// $Id: SmallObj.cpp 823 2007-05-08 10:48:40Z lfittl $ - - -#include "SmallObj.h" - -#include <cassert> -#include <climits> -#include <vector> -#include <bitset> - -//#define DO_EXTRA_LOKI_TESTS -//#define USE_NEW_TO_ALLOCATE -//#define LOKI_CHECK_FOR_CORRUPTION - -#ifdef DO_EXTRA_LOKI_TESTS -#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. - */ -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. - */ - 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 ); - - /** 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 ); - } - - 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: - - /** 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 ); - - /** 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 ); - - /// 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 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; - - /** 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 ) ); - } - -}; - -unsigned char FixedAllocator::MinObjectsPerChunk_ = 8; -unsigned char FixedAllocator::MaxObjectsPerChunk_ = UCHAR_MAX; - -// Chunk::Init ---------------------------------------------------------------- - -bool Chunk::Init( std::size_t blockSize, unsigned char blocks ) -{ - assert(blockSize > 0); - assert(blocks > 0); - // Overflow check - const std::size_t allocSize = blockSize * blocks; - assert( allocSize / blockSize == 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 ) ); -#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 ) ); - if ( NULL == pData_ ) return false; -#endif - - Reset( blockSize, blocks ); - return true; -} - -// Chunk::Reset --------------------------------------------------------------- - -void Chunk::Reset(std::size_t blockSize, unsigned char blocks) -{ - assert(blockSize > 0); - assert(blocks > 0); - // Overflow check - assert((blockSize * blocks) / blockSize == blocks); - - firstAvailableBlock_ = 0; - blocksAvailable_ = blocks; - - unsigned char i = 0; - for ( unsigned char* p = pData_; i != blocks; p += blockSize ) - { - *p = ++i; - } -} - -// Chunk::Release ------------------------------------------------------------- - -void Chunk::Release() -{ - assert( NULL != pData_ ); -#ifdef USE_NEW_TO_ALLOCATE - ::operator delete ( pData_ ); -#else - ::std::free( static_cast< void* >( pData_ ) ); -#endif -} - -// Chunk::Allocate ------------------------------------------------------------ - -void* Chunk::Allocate(std::size_t blockSize) -{ - if ( IsFilled() ) return NULL; - - assert((firstAvailableBlock_ * blockSize) / blockSize == - firstAvailableBlock_); - unsigned char* pResult = pData_ + (firstAvailableBlock_ * blockSize); - firstAvailableBlock_ = *pResult; - --blocksAvailable_; - - return pResult; -} - -// Chunk::Deallocate ---------------------------------------------------------- - -void Chunk::Deallocate(void* p, std::size_t blockSize) -{ - assert(p >= pData_); - - unsigned char* toRelease = static_cast<unsigned char*>(p); - // Alignment check - assert((toRelease - pData_) % blockSize == 0); - unsigned char index = static_cast< unsigned char >( - ( toRelease - pData_ ) / blockSize); - -#if defined(DEBUG) || defined(_DEBUG) - // Check if block was already deleted. Attempting to delete the same - // block more than once causes Chunk's linked-list of stealth indexes to - // become corrupt. And causes count of blocksAvailable_ to be wrong. - if ( 0 < blocksAvailable_ ) - assert( firstAvailableBlock_ != index ); -#endif - - *toRelease = firstAvailableBlock_; - firstAvailableBlock_ = index; - // Truncation check - assert(firstAvailableBlock_ == (toRelease - pData_) / blockSize); - - ++blocksAvailable_; -} - -// Chunk::IsCorrupt ----------------------------------------------------------- - -bool Chunk::IsCorrupt( unsigned char numBlocks, std::size_t blockSize, - bool checkIndexes ) const -{ - - if ( numBlocks < blocksAvailable_ ) - { - // Contents at this Chunk corrupted. This might mean something has - // overwritten memory owned by the Chunks container. - assert( false ); - return true; - } - if ( IsFilled() ) - // Useless to do further corruption checks if all blocks allocated. - return false; - unsigned char index = firstAvailableBlock_; - if ( numBlocks <= index ) - { - // Contents at this Chunk corrupted. This might mean something has - // overwritten memory owned by the Chunks container. - assert( false ); - return true; - } - if ( !checkIndexes ) - // Caller chose to skip more complex corruption tests. - return false; - - /* If the bit at index was set in foundBlocks, then the stealth index was - found on the linked-list. - */ - std::bitset< UCHAR_MAX > foundBlocks; - 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 - index was not already found while traversing the linked-list. The linked- - list should have exactly blocksAvailable_ nodes, so the for loop will not - check more than blocksAvailable_. This loop can't check inside allocated - blocks for corruption since such blocks are not within the linked-list. - Contents of allocated blocks are not changed by Chunk. - - Here are the types of corrupted link-lists which can be verified. The - corrupt index is shown with asterisks in each example. - - Type 1: Index is too big. - numBlocks == 64 - blocksAvailable_ == 7 - firstAvailableBlock_ -> 17 -> 29 -> *101* - There should be no indexes which are equal to or larger than the total - number of blocks. Such an index would refer to a block beyond the - Chunk's allocated domain. - - Type 2: Index is repeated. - numBlocks == 64 - blocksAvailable_ == 5 - firstAvailableBlock_ -> 17 -> 29 -> 53 -> *17* -> 29 -> 53 ... - No index should be repeated within the linked-list since that would - indicate the presence of a loop in the linked-list. - */ - for ( unsigned char cc = 0; ; ) - { - nextBlock = pData_ + ( index * blockSize ); - foundBlocks.set( index, true ); - ++cc; - if ( cc >= blocksAvailable_ ) - // Successfully counted off number of nodes in linked-list. - break; - index = *nextBlock; - if ( numBlocks <= index ) - { - /* This catches Type 1 corruptions as shown in above comments. - This implies that a block was corrupted due to a stray pointer - or an operation on a nearby block overran the size of the block. - */ - assert( false ); - return true; - } - if ( foundBlocks.test( index ) ) - { - /* This catches Type 2 corruptions as shown in above comments. - This implies that a block was corrupted due to a stray pointer - or an operation on a nearby block overran the size of the block. - Or perhaps the program tried to delete a block more than once. - */ - assert( false ); - return true; - } - } - if ( foundBlocks.count() != blocksAvailable_ ) - { - /* This implies that the singly-linked-list of stealth indexes was - corrupted. Ideally, this should have been detected within the loop. - */ - assert( false ); - return true; - } - - return false; -} - -// Chunk::IsBlockAvailable ---------------------------------------------------- - -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 ); - // Alignment check - assert( ( place - pData_ ) % blockSize == 0 ); - unsigned char blockIndex = static_cast< unsigned char >( - ( place - pData_ ) / blockSize ); - - unsigned char index = firstAvailableBlock_; - assert( numBlocks > index ); - if ( index == blockIndex ) - return true; - - /* If the bit at index was set in foundBlocks, then the stealth index was - found on the linked-list. - */ - std::bitset< UCHAR_MAX > foundBlocks; - unsigned char* nextBlock = NULL; - for ( unsigned char cc = 0; ; ) - { - nextBlock = pData_ + ( index * blockSize ); - foundBlocks.set( index, true ); - ++cc; - if ( cc >= blocksAvailable_ ) - // Successfully counted off number of nodes in linked-list. - break; - index = *nextBlock; - if ( index == blockIndex ) - return true; - assert( numBlocks > index ); - assert( !foundBlocks.test( index ) ); - } - - return false; -} - -// FixedAllocator::FixedAllocator --------------------------------------------- - -FixedAllocator::FixedAllocator() - : blockSize_( 0 ) - , numBlocks_( 0 ) - , chunks_( 0 ) - , allocChunk_( NULL ) - , deallocChunk_( NULL ) - , emptyChunk_( NULL ) -{ -} - -// FixedAllocator::~FixedAllocator -------------------------------------------- - -FixedAllocator::~FixedAllocator() -{ -#ifdef DO_EXTRA_LOKI_TESTS - TrimEmptyChunk(); - assert( chunks_.empty() && "Memory leak detected!" ); -#endif - for ( ChunkIter i( chunks_.begin() ); i != chunks_.end(); ++i ) - i->Release(); -} - -// FixedAllocator::Initialize ------------------------------------------------- - -void FixedAllocator::Initialize( std::size_t blockSize, std::size_t pageSize ) -{ - assert( blockSize > 0 ); - assert( pageSize >= blockSize ); - blockSize_ = blockSize; - - std::size_t numBlocks = pageSize / blockSize; - if ( numBlocks > MaxObjectsPerChunk_ ) numBlocks = MaxObjectsPerChunk_; - else if ( numBlocks < MinObjectsPerChunk_ ) numBlocks = MinObjectsPerChunk_; - - numBlocks_ = static_cast<unsigned char>(numBlocks); - assert(numBlocks_ == numBlocks); -} - -// FixedAllocator::CountEmptyChunks ------------------------------------------- - -std::size_t FixedAllocator::CountEmptyChunks( void ) const -{ -#ifdef DO_EXTRA_LOKI_TESTS - // This code is only used for specialized tests of the allocator. - // It is #ifdef-ed so that its O(C) complexity does not overwhelm the - // functions which call it. - std::size_t count = 0; - for ( ChunkCIter it( chunks_.begin() ); it != chunks_.end(); ++it ) - { - const Chunk& chunk = *it; - if ( chunk.HasAvailable( numBlocks_ ) ) - ++count; - } - return count; -#else - return ( NULL == emptyChunk_ ) ? 0 : 1; -#endif -} - -// FixedAllocator::IsCorrupt -------------------------------------------------- - -bool FixedAllocator::IsCorrupt( void ) const -{ - const bool isEmpty = chunks_.empty(); - ChunkCIter start( chunks_.begin() ); - ChunkCIter last( chunks_.end() ); - const size_t emptyChunkCount = CountEmptyChunks(); - - if ( isEmpty ) - { - if ( start != last ) - { - assert( false ); - return true; - } - if ( 0 < emptyChunkCount ) - { - assert( false ); - return true; - } - if ( NULL != deallocChunk_ ) - { - assert( false ); - return true; - } - if ( NULL != allocChunk_ ) - { - assert( false ); - return true; - } - if ( NULL != emptyChunk_ ) - { - assert( false ); - return true; - } - } - - else - { - const Chunk* front = &chunks_.front(); - const Chunk* back = &chunks_.back(); - if ( start >= last ) - { - assert( false ); - return true; - } - if ( back < deallocChunk_ ) - { - assert( false ); - return true; - } - if ( back < allocChunk_ ) - { - assert( false ); - return true; - } - if ( front > deallocChunk_ ) - { - assert( false ); - return true; - } - if ( front > allocChunk_ ) - { - assert( false ); - return true; - } - - switch ( emptyChunkCount ) - { - case 0: - if ( emptyChunk_ != NULL ) - { - assert( false ); - return true; - } - break; - case 1: - if ( emptyChunk_ == NULL ) - { - assert( false ); - return true; - } - if ( back < emptyChunk_ ) - { - assert( false ); - return true; - } - if ( front > emptyChunk_ ) - { - assert( false ); - return true; - } - if ( !emptyChunk_->HasAvailable( numBlocks_ ) ) - { - // This may imply somebody tried to delete a block twice. - assert( false ); - return true; - } - break; - default: - assert( false ); - return true; - } - for ( ChunkCIter it( start ); it != last; ++it ) - { - const Chunk& chunk = *it; - if ( chunk.IsCorrupt( numBlocks_, blockSize_, true ) ) - return true; - } - } - - return false; -} - -// FixedAllocator::HasBlock --------------------------------------------------- - -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; - if ( chunk.HasBlock( p, chunkLength ) ) - return &chunk; - } - return NULL; -} - -// FixedAllocator::TrimEmptyChunk --------------------------------------------- - -bool FixedAllocator::TrimEmptyChunk( void ) -{ - // prove either emptyChunk_ points nowhere, or points to a truly empty Chunk. - assert( ( NULL == emptyChunk_ ) || ( emptyChunk_->HasAvailable( numBlocks_ ) ) ); - if ( NULL == emptyChunk_ ) return false; - - // If emptyChunk_ points to valid Chunk, then chunk list is not empty. - assert( !chunks_.empty() ); - // And there should be exactly 1 empty Chunk. - assert( 1 == CountEmptyChunks() ); - - Chunk* lastChunk = &chunks_.back(); - if ( lastChunk != emptyChunk_ ) - std::swap( *emptyChunk_, *lastChunk ); - assert( lastChunk->HasAvailable( numBlocks_ ) ); - lastChunk->Release(); - chunks_.pop_back(); - - if ( chunks_.empty() ) - { - allocChunk_ = NULL; - deallocChunk_ = NULL; - } - else - { - if ( deallocChunk_ == emptyChunk_ ) - { - deallocChunk_ = &chunks_.front(); - assert( deallocChunk_->blocksAvailable_ < numBlocks_ ); - } - if ( allocChunk_ == emptyChunk_ ) - { - allocChunk_ = &chunks_.back(); - assert( allocChunk_->blocksAvailable_ < numBlocks_ ); - } - } - - emptyChunk_ = NULL; - assert( 0 == CountEmptyChunks() ); - - return true; -} - -// FixedAllocator::TrimChunkList ---------------------------------------------- - -bool FixedAllocator::TrimChunkList( void ) -{ - if ( chunks_.empty() ) - { - assert( NULL == allocChunk_ ); - assert( NULL == deallocChunk_ ); - } - - if ( chunks_.size() == chunks_.capacity() ) - return false; - // Use the "make-a-temp-and-swap" trick to remove excess capacity. - Chunks( chunks_ ).swap( chunks_ ); - - return true; -} - -// FixedAllocator::MakeNewChunk ----------------------------------------------- - -bool FixedAllocator::MakeNewChunk( void ) -{ - bool allocated = false; - try - { - std::size_t size = chunks_.size(); - // Calling chunks_.reserve *before* creating and initializing the new - // Chunk means that nothing is leaked by this function in case an - // exception is thrown from reserve. - if ( chunks_.capacity() == size ) - { - if ( 0 == size ) size = 4; - chunks_.reserve( size * 2 ); - } - Chunk newChunk; - allocated = newChunk.Init( blockSize_, numBlocks_ ); - if ( allocated ) - chunks_.push_back( newChunk ); - } - catch ( ... ) - { - allocated = false; - } - if ( !allocated ) return false; - - allocChunk_ = &chunks_.back(); - deallocChunk_ = &chunks_.front(); - return true; -} - -// FixedAllocator::Allocate --------------------------------------------------- - -void* FixedAllocator::Allocate( void ) -{ - // prove either emptyChunk_ points nowhere, or points to a truly empty Chunk. - assert( ( NULL == emptyChunk_ ) || ( emptyChunk_->HasAvailable( numBlocks_ ) ) ); - assert( CountEmptyChunks() < 2 ); - - if ( ( NULL == allocChunk_ ) || allocChunk_->IsFilled() ) - { - if ( NULL != emptyChunk_ ) - { - allocChunk_ = emptyChunk_; - emptyChunk_ = NULL; - } - else - { - for ( ChunkIter i( chunks_.begin() ); ; ++i ) - { - if ( chunks_.end() == i ) - { - if ( !MakeNewChunk() ) - return NULL; - break; - } - if ( !i->IsFilled() ) - { - allocChunk_ = &*i; - break; - } - } - } - } - else if ( allocChunk_ == emptyChunk_) - // detach emptyChunk_ from allocChunk_, because after - // calling allocChunk_->Allocate(blockSize_); the chunk - // is no longer empty. - emptyChunk_ = NULL; - - assert( allocChunk_ != NULL ); - assert( !allocChunk_->IsFilled() ); - void* place = allocChunk_->Allocate( blockSize_ ); - - // prove either emptyChunk_ points nowhere, or points to a truly empty Chunk. - assert( ( NULL == emptyChunk_ ) || ( emptyChunk_->HasAvailable( numBlocks_ ) ) ); - assert( CountEmptyChunks() < 2 ); -#ifdef LOKI_CHECK_FOR_CORRUPTION - if ( allocChunk_->IsCorrupt( numBlocks_, blockSize_, true ) ) - { - assert( false ); - return NULL; - } -#endif - - return place; -} - -// FixedAllocator::Deallocate ------------------------------------------------- - -bool FixedAllocator::Deallocate( void* p, Chunk* hint ) -{ - assert(!chunks_.empty()); - assert(&chunks_.front() <= deallocChunk_); - assert(&chunks_.back() >= deallocChunk_); - assert( &chunks_.front() <= allocChunk_ ); - assert( &chunks_.back() >= allocChunk_ ); - assert( CountEmptyChunks() < 2 ); - - Chunk* foundChunk = ( NULL == hint ) ? VicinityFind( p ) : hint; - if ( NULL == foundChunk ) - return false; - - assert( foundChunk->HasBlock( p, numBlocks_ * blockSize_ ) ); -#ifdef LOKI_CHECK_FOR_CORRUPTION - if ( foundChunk->IsCorrupt( numBlocks_, blockSize_, true ) ) - { - assert( false ); - return false; - } - if ( foundChunk->IsBlockAvailable( p, numBlocks_, blockSize_ ) ) - { - assert( false ); - return false; - } -#endif - deallocChunk_ = foundChunk; - DoDeallocate(p); - assert( CountEmptyChunks() < 2 ); - - return true; -} - -// FixedAllocator::VicinityFind ----------------------------------------------- - -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; - - // Special case: deallocChunk_ is the last in the array - if (hi == hiBound) hi = NULL; - - for (;;) - { - if (lo) - { - if ( lo->HasBlock( p, chunkLength ) ) return lo; - if ( lo == loBound ) - { - lo = NULL; - if ( NULL == hi ) break; - } - else --lo; - } - - if (hi) - { - if ( hi->HasBlock( p, chunkLength ) ) return hi; - if ( ++hi == hiBound ) - { - hi = NULL; - if ( NULL == lo ) break; - } - } - } - - return NULL; -} - -// FixedAllocator::DoDeallocate ----------------------------------------------- - -void FixedAllocator::DoDeallocate(void* p) -{ - // Show that deallocChunk_ really owns the block at address p. - assert( deallocChunk_->HasBlock( p, numBlocks_ * blockSize_ ) ); - // Either of the next two assertions may fail if somebody tries to - // delete the same block twice. - assert( emptyChunk_ != deallocChunk_ ); - assert( !deallocChunk_->HasAvailable( numBlocks_ ) ); - // prove either emptyChunk_ points nowhere, or points to a truly empty Chunk. - assert( ( NULL == emptyChunk_ ) || ( emptyChunk_->HasAvailable( numBlocks_ ) ) ); - - // call into the chunk, will adjust the inner list but won't release memory - deallocChunk_->Deallocate(p, blockSize_); - - if ( deallocChunk_->HasAvailable( numBlocks_ ) ) - { - assert( emptyChunk_ != deallocChunk_ ); - // deallocChunk_ is empty, but a Chunk is only released if there are 2 - // empty chunks. Since emptyChunk_ may only point to a previously - // cleared Chunk, if it points to something else besides deallocChunk_, - // then FixedAllocator currently has 2 empty Chunks. - if ( NULL != emptyChunk_ ) - { - // 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(); - if ( lastChunk == deallocChunk_ ) - deallocChunk_ = emptyChunk_; - else if ( lastChunk != emptyChunk_ ) - std::swap( *emptyChunk_, *lastChunk ); - assert( lastChunk->HasAvailable( numBlocks_ ) ); - lastChunk->Release(); - chunks_.pop_back(); - if ( ( allocChunk_ == lastChunk ) || allocChunk_->IsFilled() ) - allocChunk_ = deallocChunk_; - } - emptyChunk_ = deallocChunk_; - } - - // prove either emptyChunk_ points nowhere, or points to a truly empty Chunk. - assert( ( NULL == emptyChunk_ ) || ( emptyChunk_->HasAvailable( numBlocks_ ) ) ); -} - -// GetOffset ------------------------------------------------------------------ -/// @ingroup SmallObjectGroupInternal -/// Calculates index into array where a FixedAllocator of numBytes is located. -inline std::size_t GetOffset( std::size_t numBytes, std::size_t alignment ) -{ - const std::size_t alignExtra = alignment - 1; - return ( numBytes + alignExtra ) / alignment; -} - -// DefaultAllocator ----------------------------------------------------------- -/** @ingroup SmallObjectGroupInternal - Calls the default allocator when SmallObjAllocator decides not to handle a - request. SmallObjAllocator calls this if the number of bytes is bigger than - the size which can be handled by any FixedAllocator. - @param numBytes number of bytes - @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 ) -{ -#ifdef USE_NEW_TO_ALLOCATE - return doThrow ? ::operator new( numBytes ) : - ::operator new( numBytes, std::nothrow_t() ); -#else - void* p = ::std::malloc( numBytes ); - if ( doThrow && ( NULL == p ) ) - throw std::bad_alloc(); - return p; -#endif -} - -// DefaultDeallocator --------------------------------------------------------- -/** @ingroup SmallObjectGroupInternal - Calls default deallocator when SmallObjAllocator decides not to handle a - request. The default deallocator could be the global delete operator or the - free function. The free function is the preferred default deallocator since - 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 ) -{ -#ifdef USE_NEW_TO_ALLOCATE - ::operator delete( p ); -#else - ::std::free( p ); -#endif -} - -// SmallObjAllocator::SmallObjAllocator --------------------------------------- - -SmallObjAllocator::SmallObjAllocator( std::size_t pageSize, - std::size_t maxObjectSize, std::size_t objectAlignSize ) : - pool_( NULL ), - maxSmallObjectSize_( maxObjectSize ), - objectAlignSize_( objectAlignSize ) -{ -#ifdef DO_EXTRA_LOKI_TESTS - std::cout << "SmallObjAllocator " << this << std::endl; -#endif - assert( 0 != objectAlignSize ); - const std::size_t allocCount = GetOffset( maxObjectSize, objectAlignSize ); - pool_ = new FixedAllocator[ allocCount ]; - for ( std::size_t i = 0; i < allocCount; ++i ) - pool_[ i ].Initialize( ( i + 1 ) * objectAlignSize, pageSize ); -} - -// SmallObjAllocator::~SmallObjAllocator -------------------------------------- - -SmallObjAllocator::~SmallObjAllocator( void ) -{ -#ifdef DO_EXTRA_LOKI_TESTS - std::cout << "~SmallObjAllocator " << this << std::endl; -#endif - delete [] pool_; -} - -// SmallObjAllocator::TrimExcessMemory ---------------------------------------- - -bool SmallObjAllocator::TrimExcessMemory( void ) -{ - bool found = false; - const std::size_t allocCount = GetOffset( GetMaxObjectSize(), GetAlignment() ); - std::size_t i = 0; - for ( ; i < allocCount; ++i ) - { - if ( pool_[ i ].TrimEmptyChunk() ) - found = true; - } - for ( i = 0; i < allocCount; ++i ) - { - if ( pool_[ i ].TrimChunkList() ) - found = true; - } - - return found; -} - -// SmallObjAllocator::Allocate ------------------------------------------------ - -void* SmallObjAllocator::Allocate( std::size_t numBytes, bool doThrow ) -{ - if ( numBytes > GetMaxObjectSize() ) - return DefaultAllocator( numBytes, doThrow ); - - assert( NULL != pool_ ); - if ( 0 == numBytes ) numBytes = 1; - const std::size_t index = GetOffset( numBytes, GetAlignment() ) - 1; - const std::size_t allocCount = GetOffset( GetMaxObjectSize(), GetAlignment() ); - (void) allocCount; - assert( index < allocCount ); - - FixedAllocator& allocator = pool_[ index ]; - assert( allocator.BlockSize() >= numBytes ); - assert( allocator.BlockSize() < numBytes + GetAlignment() ); - void* place = allocator.Allocate(); - - if ( ( NULL == place ) && TrimExcessMemory() ) - place = allocator.Allocate(); - - if ( ( NULL == place ) && doThrow ) - { -#ifdef _MSC_VER - throw std::bad_alloc( "could not allocate small object" ); -#else - // GCC did not like a literal string passed to std::bad_alloc. - // so just throw the default-constructed exception. - throw std::bad_alloc(); -#endif - } - return place; -} - -// SmallObjAllocator::Deallocate ---------------------------------------------- - -void SmallObjAllocator::Deallocate( void* p, std::size_t numBytes ) -{ - if ( NULL == p ) return; - if ( numBytes > GetMaxObjectSize() ) - { - DefaultDeallocator( p ); - return; - } - assert( NULL != pool_ ); - if ( 0 == numBytes ) numBytes = 1; - const std::size_t index = GetOffset( numBytes, GetAlignment() ) - 1; - const std::size_t allocCount = GetOffset( GetMaxObjectSize(), GetAlignment() ); - (void) allocCount; - assert( index < allocCount ); - FixedAllocator& allocator = pool_[ index ]; - assert( allocator.BlockSize() >= numBytes ); - assert( allocator.BlockSize() < numBytes + GetAlignment() ); - const bool found = allocator.Deallocate( p, NULL ); - (void) found; - assert( found ); -} - -// SmallObjAllocator::Deallocate ---------------------------------------------- - -void SmallObjAllocator::Deallocate( void* p ) -{ - if ( NULL == p ) return; - assert( NULL != pool_ ); - FixedAllocator* pAllocator = NULL; - const std::size_t allocCount = GetOffset( GetMaxObjectSize(), GetAlignment() ); - Chunk* chunk = NULL; - - for ( std::size_t ii = 0; ii < allocCount; ++ii ) - { - chunk = pool_[ ii ].HasBlock( p ); - if ( NULL != chunk ) - { - pAllocator = &pool_[ ii ]; - break; - } - } - if ( NULL == pAllocator ) - { - DefaultDeallocator( p ); - return; - } - - assert( NULL != chunk ); - const bool found = pAllocator->Deallocate( p, chunk ); - (void) found; - assert( found ); -} - -// SmallObjAllocator::IsCorrupt ----------------------------------------------- - -bool SmallObjAllocator::IsCorrupt( void ) const -{ - if ( NULL == pool_ ) - { - assert( false ); - return true; - } - if ( 0 == GetAlignment() ) - { - assert( false ); - return true; - } - if ( 0 == GetMaxObjectSize() ) - { - assert( false ); - return true; - } - const std::size_t allocCount = GetOffset( GetMaxObjectSize(), GetAlignment() ); - for ( std::size_t ii = 0; ii < allocCount; ++ii ) - { - if ( pool_[ ii ].IsCorrupt() ) - return true; - } - return false; -} - -} // end namespace Loki - diff --git a/shared/loki/SmallObj.h b/shared/loki/SmallObj.h deleted file mode 100644 index 10624cc2..00000000 --- a/shared/loki/SmallObj.h +++ /dev/null @@ -1,644 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2001 by Andrei Alexandrescu -// This code accompanies the book: -// 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 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_SMALLOBJ_INC_ -#define LOKI_SMALLOBJ_INC_ - -// $Id: SmallObj.h 806 2007-02-03 00:01:52Z rich_sposato $ - - -#include "LokiExport.h" -#include "Threads.h" -#include "Singleton.h" -#include <cstddef> -#include <new> // needed for std::nothrow_t parameter. - -#ifndef LOKI_DEFAULT_CHUNK_SIZE -#define LOKI_DEFAULT_CHUNK_SIZE 4096 -#endif - -#ifndef LOKI_MAX_SMALL_OBJECT_SIZE -#define LOKI_MAX_SMALL_OBJECT_SIZE 256 -#endif - -#ifndef LOKI_DEFAULT_OBJECT_ALIGNMENT -#define LOKI_DEFAULT_OBJECT_ALIGNMENT 4 -#endif - -#ifndef LOKI_DEFAULT_SMALLOBJ_LIFETIME -#define LOKI_DEFAULT_SMALLOBJ_LIFETIME ::Loki::LongevityLifetime::DieAsSmallObjectParent -#endif - -#if defined(LOKI_SMALL_OBJECT_USE_NEW_ARRAY) && defined(_MSC_VER) -#pragma message("Don't define LOKI_SMALL_OBJECT_USE_NEW_ARRAY when using a Microsoft compiler to prevent memory leaks.") -#pragma message("now calling '#undef LOKI_SMALL_OBJECT_USE_NEW_ARRAY'") -#undef LOKI_SMALL_OBJECT_USE_NEW_ARRAY -#endif - -/// \defgroup SmallObjectGroup Small objects -/// -/// \defgroup SmallObjectGroupInternal Internals -/// \ingroup SmallObjectGroup - -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. - */ -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: - - /// 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 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 ) -{ - 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 - 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 ); - } - -#ifdef LOKI_SMALL_OBJECT_USE_NEW_ARRAY - - /// 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. - -#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 - -#endif // end file guardian - diff --git a/shared/loki/SmartPtr.h b/shared/loki/SmartPtr.h deleted file mode 100644 index 6f6f9996..00000000 --- a/shared/loki/SmartPtr.h +++ /dev/null @@ -1,1778 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2001 by Andrei Alexandrescu -// This code accompanies the book: -// 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 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_SMARTPTR_INC_ -#define LOKI_SMARTPTR_INC_ - -// $Id: SmartPtr.h 903 2008-11-10 05:55:12Z rich_sposato $ - - -/// \defgroup SmartPointerGroup Smart pointers -/// Policy based implementation of a smart pointer -/// \defgroup SmartPointerOwnershipGroup Ownership policies -/// \ingroup SmartPointerGroup -/// \defgroup SmartPointerStorageGroup Storage policies -/// \ingroup SmartPointerGroup -/// \defgroup SmartPointerConversionGroup Conversion policies -/// \ingroup SmartPointerGroup -/// \defgroup SmartPointerCheckingGroup Checking policies -/// \ingroup SmartPointerGroup - -#include "LokiExport.h" -#include "SmallObj.h" -#include "TypeManip.h" -#include "static_check.h" -#include "RefToValue.h" -#include "ConstPolicy.h" - -#include <functional> -#include <stdexcept> -#include <cassert> -#include <string> - -#if !defined(_MSC_VER) -# if defined(__sparc__) -# include <inttypes.h> -# else -# include <stdint.h> -# endif -#endif - -#if defined(_MSC_VER) || defined(__GNUC__) -// GCC>=4.1 must use -ffriend-injection due to a bug in GCC -#define LOKI_ENABLE_FRIEND_TEMPLATE_TEMPLATE_PARAMETER_WORKAROUND -#endif - - -namespace Loki -{ - -//////////////////////////////////////////////////////////////////////////////// -/// \class HeapStorage -/// -/// \ingroup SmartPointerStorageGroup -/// Implementation of the StoragePolicy used by SmartPtr. Uses explicit call -/// to T's destructor followed by call to free. -//////////////////////////////////////////////////////////////////////////////// - - -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()) - {} - - // 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) - {} - - HeapStorage(const StoredType& p) : pointee_(p) {} - - PointerType operator->() const { return pointee_; } - - ReferenceType operator*() const { return *pointee_; } - - void Swap(HeapStorage& rhs) - { std::swap(pointee_, rhs.pointee_); } - - // 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 typename HeapStorage<F>::StoredType& GetImplRef(HeapStorage<F>& sp); - -protected: - // Destroys the data stored - // (Destruction might be taken over by the OwnershipPolicy) - void Destroy() - { - if ( 0 != pointee_ ) - { - pointee_->~T(); - ::free( pointee_ ); - } - } - - // Default value to initialize the pointer - static StoredType Default() - { return 0; } - -private: - // Data - StoredType 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 typename HeapStorage<T>::StoredType& GetImplRef(HeapStorage<T>& sp) -{ return sp.pointee_; } - - -//////////////////////////////////////////////////////////////////////////////// -/// \class DefaultSPStorage -/// -/// \ingroup SmartPointerStorageGroup -/// Implementation of the StoragePolicy used by SmartPtr -//////////////////////////////////////////////////////////////////////////////// - - -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()) - {} - - // 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) - {} - - DefaultSPStorage(const StoredType& p) : pointee_(p) {} - - PointerType operator->() const { return pointee_; } - - ReferenceType operator*() const { return *pointee_; } - - void Swap(DefaultSPStorage& rhs) - { std::swap(pointee_, rhs.pointee_); } - - // 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 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_; - } - - // Default value to initialize the pointer - static StoredType Default() - { return 0; } - -private: - // Data - StoredType 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 typename DefaultSPStorage<T>::StoredType& GetImplRef(DefaultSPStorage<T>& sp) -{ return sp.pointee_; } - - -//////////////////////////////////////////////////////////////////////////////// -/// \class LockedStorage -/// -/// \ingroup SmartPointerStorageGroup -/// Implementation of the StoragePolicy used by SmartPtr. -/// -/// Each call to operator-> locks the object for the duration of a call to a -/// member function of T. -/// -/// \par How It Works -/// LockedStorage has a helper class called Locker, which acts as a smart -/// pointer with limited abilities. LockedStorage::operator-> returns an -/// unnamed temporary of type Locker<T> that exists for the duration of the -/// call to a member function of T. The unnamed temporary locks the object -/// when it is constructed by operator-> and unlocks the object when it is -/// destructed. -/// -/// \note This storage policy requires class T to have member functions Lock -/// and Unlock. If your class does not have Lock or Unlock functions, you may -/// either make a child class which does, or make a policy class similar to -/// LockedStorage which calls other functions to lock the object. -//////////////////////////////////////////////////////////////////////////////// - -template <class T> -class Locker -{ -public: - Locker( const T* p ) : pointee_( const_cast< T* >( p ) ) - { - if ( pointee_ != 0 ) - pointee_->Lock(); - } - - ~Locker( void ) - { - if ( pointee_ != 0 ) - pointee_->Unlock(); - } - - operator T* () - { - return pointee_; - } - - T* operator->() - { - return pointee_; - } - -private: - Locker( void ); - Locker& operator = ( const Locker& ); - T* pointee_; -}; - -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* - - LockedStorage() : pointee_( Default() ) {} - - ~LockedStorage( void ) {} - - LockedStorage( const LockedStorage&) : pointee_( 0 ) {} - - LockedStorage( const StoredType& p ) : pointee_( p ) {} - - PointerType operator->() - { - return Locker< T >( pointee_ ); - } - - void Swap(LockedStorage& rhs) - { - std::swap( pointee_, rhs.pointee_ ); - } - - // 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 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_; - } - - // Default value to initialize the pointer - static StoredType Default() - { return 0; } - -private: - /// Dereference operator is not implemented. - ReferenceType operator*(); - - // Data - StoredType 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 typename LockedStorage<T>::StoredType& GetImplRef(LockedStorage<T>& sp) -{ return sp.pointee_; } - - -//////////////////////////////////////////////////////////////////////////////// -/// \class ArrayStorage -/// -/// \ingroup SmartPointerStorageGroup -/// Implementation of the ArrayStorage used by SmartPtr -//////////////////////////////////////////////////////////////////////////////// - - -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()) - {} - - // 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) - {} - - ArrayStorage(const StoredType& p) : pointee_(p) {} - - PointerType operator->() const { return pointee_; } - - ReferenceType operator*() const { return *pointee_; } - - void Swap(ArrayStorage& rhs) - { std::swap(pointee_, rhs.pointee_); } - - // 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 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_; } - - // Default value to initialize the pointer - static StoredType Default() - { return 0; } - -private: - // Data - StoredType 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 typename ArrayStorage<T>::StoredType& GetImplRef(ArrayStorage<T>& sp) -{ return sp.pointee_; } - - -//////////////////////////////////////////////////////////////////////////////// -/// \class RefCounted -/// -/// \ingroup SmartPointerOwnershipGroup -/// Implementation of the OwnershipPolicy used by SmartPtr -/// Provides a classic external reference counting implementation -//////////////////////////////////////////////////////////////////////////////// - -template <class P> -class RefCounted -{ -public: - RefCounted() - : pCount_(static_cast<uintptr_t*>( - SmallObject<>::operator new(sizeof(uintptr_t)))) - { - assert(pCount_ != 0); - *pCount_ = 1; - } - - RefCounted(const RefCounted& rhs) - : pCount_(rhs.pCount_) - {} - - // 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; - } - - bool Release(const P&) - { - if (!--*pCount_) - { - SmallObject<>::operator delete(pCount_, sizeof(uintptr_t)); - pCount_ = NULL; - return true; - } - return false; - } - - void Swap(RefCounted& rhs) - { std::swap(pCount_, rhs.pCount_); } - - enum { destructiveCopy = false }; - -private: - // Data - uintptr_t* pCount_; -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \struct RefCountedMT -/// -/// \ingroup SmartPointerOwnershipGroup -/// Implementation of the OwnershipPolicy used by SmartPtr -/// Implements external reference counting for multithreaded programs -/// Policy Usage: RefCountedMTAdj<ThreadingModel>::RefCountedMT -/// -/// \par Warning -/// There could be a race condition, see bug "Race condition in RefCountedMTAdj::Release" -/// http://sourceforge.net/tracker/index.php?func=detail&aid=1408845&group_id=29557&atid=396644 -/// As stated in bug 1408845, the Release function is not thread safe if a -/// SmartPtr copy-constructor tries to copy the last pointer to an object in -/// one thread, while the destructor is acting on the last pointer in another -/// thread. The existence of a race between a copy-constructor and destructor -/// implies a design flaw at a higher level. That race condition must be -/// 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 <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; - - 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) - : pCount_(rhs.pCount_) - {} - - //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; - } - - bool Release(const P&) - { - 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; - } - - void Swap(RefCountedMT& rhs) - { std::swap(pCount_, rhs.pCount_); } - - enum { destructiveCopy = false }; - - private: - // Data - CountPtrType pCount_; - }; -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \class COMRefCounted -/// -/// \ingroup SmartPointerOwnershipGroup -/// Implementation of the OwnershipPolicy used by SmartPtr -/// Adapts COM intrusive reference counting to OwnershipPolicy-specific syntax -//////////////////////////////////////////////////////////////////////////////// - -template <class P> -class COMRefCounted -{ -public: - COMRefCounted() - {} - - template <class U> - COMRefCounted(const COMRefCounted<U>&) - {} - - 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; - } - - enum { destructiveCopy = false }; - - static void Swap(COMRefCounted&) - {} -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \struct DeepCopy -/// -/// \ingroup SmartPointerOwnershipGroup -/// Implementation of the OwnershipPolicy used by SmartPtr -/// Implements deep copy semantics, assumes existence of a Clone() member -/// function of the pointee type -//////////////////////////////////////////////////////////////////////////////// - -template <class P> -struct DeepCopy -{ - DeepCopy() - {} - - template <class P1> - DeepCopy(const DeepCopy<P1>&) - {} - - static P Clone(const P& val) - { return val->Clone(); } - - static bool Release(const P&) - { return true; } - - static void Swap(DeepCopy&) - {} - - enum { destructiveCopy = false }; -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \class RefLinked -/// -/// \ingroup SmartPointerOwnershipGroup -/// Implementation of the OwnershipPolicy used by SmartPtr -/// Implements reference linking -//////////////////////////////////////////////////////////////////////////////// - -namespace Private -{ -class LOKI_EXPORT RefLinkedBase -{ -public: - RefLinkedBase() - { prev_ = next_ = this; } - - RefLinkedBase(const RefLinkedBase& rhs); - - bool Release(); - - void Swap(RefLinkedBase& rhs); - - bool Merge( RefLinkedBase& rhs ); - - 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; - - mutable const RefLinkedBase* prev_; - mutable const RefLinkedBase* next_; -}; -} - -template <class P> -class RefLinked : public Private::RefLinkedBase -{ -public: - RefLinked() - {} - - template <class P1> - RefLinked(const RefLinked<P1>& rhs) - : Private::RefLinkedBase(rhs) - {} - - static P Clone(const P& val) - { return val; } - - bool Release(const P&) - { return Private::RefLinkedBase::Release(); } - - template < class P1 > - bool Merge( RefLinked< P1 > & rhs ) - { - return Private::RefLinkedBase::Merge( rhs ); - } -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \class DestructiveCopy -/// -/// \ingroup SmartPointerOwnershipGroup -/// Implementation of the OwnershipPolicy used by SmartPtr -/// Implements destructive copy semantics (a la std::auto_ptr) -//////////////////////////////////////////////////////////////////////////////// - -template <class P> -class DestructiveCopy -{ -public: - DestructiveCopy() - {} - - template <class P1> - DestructiveCopy(const DestructiveCopy<P1>&) - {} - - template <class P1> - static P Clone(P1& val) - { - P result(val); - val = P1(); - return result; - } - - static bool Release(const P&) - { return true; } - - static void Swap(DestructiveCopy&) - {} - - enum { destructiveCopy = true }; -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \class NoCopy -/// -/// \ingroup SmartPointerOwnershipGroup -/// Implementation of the OwnershipPolicy used by SmartPtr -/// Implements a policy that doesn't allow copying objects -//////////////////////////////////////////////////////////////////////////////// - -template <class P> -class NoCopy -{ -public: - NoCopy() - {} - - 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; - - LOKI_STATIC_CHECK(DependedFalse, This_Policy_Disallows_Value_Copying); - } - - static bool Release(const P&) - { return true; } - - static void Swap(NoCopy&) - {} - - enum { destructiveCopy = false }; -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \struct AllowConversion -/// -/// \ingroup SmartPointerConversionGroup -/// Implementation of the ConversionPolicy used by SmartPtr -/// Allows implicit conversion from SmartPtr to the pointee type -//////////////////////////////////////////////////////////////////////////////// - -struct AllowConversion -{ - enum { allow = true }; - - void Swap(AllowConversion&) - {} -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \struct DisallowConversion -/// -/// \ingroup SmartPointerConversionGroup -/// Implementation of the ConversionPolicy used by SmartPtr -/// Does not allow implicit conversion from SmartPtr to the pointee type -/// You can initialize a DisallowConversion with an AllowConversion -//////////////////////////////////////////////////////////////////////////////// - -struct DisallowConversion -{ - DisallowConversion() - {} - - DisallowConversion(const AllowConversion&) - {} - - enum { allow = false }; - - void Swap(DisallowConversion&) - {} -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \struct NoCheck -/// -/// \ingroup SmartPointerCheckingGroup -/// Implementation of the CheckingPolicy used by SmartPtr -/// Well, it's clear what it does :o) -//////////////////////////////////////////////////////////////////////////////// - -template <class P> -struct NoCheck -{ - NoCheck() - {} - - template <class P1> - NoCheck(const NoCheck<P1>&) - {} - - static void OnDefault(const P&) - {} - - static void OnInit(const P&) - {} - - static void OnDereference(const P&) - {} - - static void Swap(NoCheck&) - {} -}; - - -//////////////////////////////////////////////////////////////////////////////// -/// \struct AssertCheck -/// -/// \ingroup SmartPointerCheckingGroup -/// Implementation of the CheckingPolicy used by SmartPtr -/// Checks the pointer before dereference -//////////////////////////////////////////////////////////////////////////////// - -template <class P> -struct AssertCheck -{ - AssertCheck() - {} - - template <class P1> - AssertCheck(const AssertCheck<P1>&) - {} - - template <class P1> - AssertCheck(const NoCheck<P1>&) - {} - - static void OnDefault(const P&) - {} - - static void OnInit(const P&) - {} - - static void OnDereference(P val) - { assert(val); (void)val; } - - static void Swap(AssertCheck&) - {} -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \struct AssertCheckStrict -/// -/// \ingroup SmartPointerCheckingGroup -/// Implementation of the CheckingPolicy used by SmartPtr -/// Checks the pointer against zero upon initialization and before dereference -/// You can initialize an AssertCheckStrict with an AssertCheck -//////////////////////////////////////////////////////////////////////////////// - -template <class P> -struct AssertCheckStrict -{ - AssertCheckStrict() - {} - - template <class U> - AssertCheckStrict(const AssertCheckStrict<U>&) - {} - - template <class U> - AssertCheckStrict(const AssertCheck<U>&) - {} - - template <class P1> - AssertCheckStrict(const NoCheck<P1>&) - {} - - static void OnDefault(P val) - { assert(val); } - - static void OnInit(P val) - { assert(val); } - - static void OnDereference(P val) - { assert(val); } - - static void Swap(AssertCheckStrict&) - {} -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \struct NullPointerException -/// -/// \ingroup SmartPointerGroup -/// 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 RejectNullStatic -/// -/// \ingroup SmartPointerCheckingGroup -/// Implementation of the CheckingPolicy used by SmartPtr -/// Checks the pointer upon initialization and before dereference -//////////////////////////////////////////////////////////////////////////////// - -template <class P> -struct RejectNullStatic -{ - RejectNullStatic() - {} - - template <class P1> - RejectNullStatic(const RejectNullStatic<P1>&) - {} - - template <class P1> - RejectNullStatic(const NoCheck<P1>&) - {} - - template <class P1> - RejectNullStatic(const AssertCheck<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; - - LOKI_STATIC_CHECK(DependedFalse, ERROR_This_Policy_Does_Not_Allow_Default_Initialization); - } - - static void OnInit(const P& val) - { if (!val) throw NullPointerException(); } - - static void OnDereference(const P& val) - { if (!val) throw NullPointerException(); } - - static void Swap(RejectNullStatic&) - {} -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \struct RejectNull -/// -/// \ingroup SmartPointerCheckingGroup -/// Implementation of the CheckingPolicy used by SmartPtr -/// Checks the pointer before dereference -//////////////////////////////////////////////////////////////////////////////// - -template <class P> -struct RejectNull -{ - RejectNull() - {} - - template <class P1> - RejectNull(const RejectNull<P1>&) - {} - - static void OnInit(P) - {} - - static void OnDefault(P) - {} - - void OnDereference(P val) - { if (!val) throw NullPointerException(); } - - void OnDereference(P val) const - { if (!val) throw NullPointerException(); } - - void Swap(RejectNull&) - {} -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \struct RejectNullStrict -/// -/// \ingroup SmartPointerCheckingGroup -/// Implementation of the CheckingPolicy used by SmartPtr -/// Checks the pointer upon initialization and before dereference -//////////////////////////////////////////////////////////////////////////////// - -template <class P> -struct RejectNullStrict -{ - RejectNullStrict() - {} - - template <class P1> - RejectNullStrict(const RejectNullStrict<P1>&) - {} - - template <class P1> - RejectNullStrict(const RejectNull<P1>&) - {} - - static void OnInit(P val) - { if (!val) throw NullPointerException(); } - - void OnDereference(P val) - { OnInit(val); } - - void OnDereference(P val) const - { OnInit(val); } - - void Swap(RejectNullStrict&) - {} -}; - - -//////////////////////////////////////////////////////////////////////////////// -// class template SmartPtr (declaration) -// 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; - -//////////////////////////////////////////////////////////////////////////////// -// class template SmartPtrDef (definition) -// this class added to unify the usage of SmartPtr -// instead of writing SmartPtr<T,OP,CP,KP,SP> write SmartPtrDef<T,OP,CP,KP,SP>::type -//////////////////////////////////////////////////////////////////////////////// - -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 - < - T, - OwnershipPolicy, - ConversionPolicy, - CheckingPolicy, - StoragePolicy, - ConstnessPolicy - > - type; -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \class SmartPtr -/// -/// \ingroup SmartPointerGroup -/// -/// \param OwnershipPolicy default = RefCounted, -/// \param ConversionPolicy default = DisallowConversion, -/// \param CheckingPolicy default = AssertCheck, -/// \param StoragePolicy default = DefaultSPStorage -/// \param ConstnessPolicy default = LOKI_DEFAULT_CONSTNESS -/// -/// \par IMPORTANT NOTE -/// Due to threading issues, the OwnershipPolicy has been changed as follows: -/// -/// - Release() returns a boolean saying if that was the last release -/// so the pointer can be deleted by the StoragePolicy -/// - 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; - -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 Select<OP::destructiveCopy, SmartPtr, const SmartPtr>::Result - CopyArg; - -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; -#else - typedef const StoredType& ImplicitArg; - typedef typename Select<false, const StoredType&, NeverMatched>::Result ExplicitArg; -#endif - -public: - - SmartPtr() - { - KP::OnDefault(GetImpl(*this)); - } - - explicit - SmartPtr(ExplicitArg 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)); - } - - 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) - : SP(rhs), OP(rhs), KP(rhs), CP(rhs) - { - GetImplRef(*this) = OP::Clone(GetImplRef(rhs)); - } - - SmartPtr(RefToValue<SmartPtr> rhs) - : SP(rhs), OP(rhs), KP(rhs), CP(rhs) - {} - - operator RefToValue<SmartPtr>() - { return RefToValue<SmartPtr>(*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=(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); - } - - ~SmartPtr() - { - if (OP::Release(GetImpl(*static_cast<SP*>(this)))) - { - 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(); - } - - 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); -#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 ) - { - if ( GetImpl( *this ) != GetImpl( rhs ) ) - { - return false; - } - return OP::template Merge( rhs ); - } - - PointerType operator->() - { - 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*(); - } - - 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 ) ); - } - - // 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 ) ); - } - - // 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 ) ); - } - -private: - // Helper for enabling 'if (sp)' - struct Tester - { - Tester(int) {} - void dummy() {} - }; - - typedef void (Tester::*unspecified_boolean_type_)(); - - typedef typename Select<CP::allow, Tester, unspecified_boolean_type_>::Result - unspecified_boolean_type; - -public: - // enable 'if (sp)' - operator unspecified_boolean_type() const - { - return !*this ? 0 : &Tester::dummy; - } - -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 -//////////////////////////////////////////////////////////////////////////////// - -#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 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 - -//////////////////////////////////////////////////////////////////////////////// -// free comparison operators for class template SmartPtr -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// 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 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; } - -//////////////////////////////////////////////////////////////////////////////// -/// 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); } - -//////////////////////////////////////////////////////////////////////////////// -/// 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; } - -//////////////////////////////////////////////////////////////////////////////// -/// 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 ); -} - -//////////////////////////////////////////////////////////////////////////////// -/// 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 ); -} - -//////////////////////////////////////////////////////////////////////////////// -// 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; } - -//////////////////////////////////////////////////////////////////////////////// -/// 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; } - -//////////////////////////////////////////////////////////////////////////////// -/// 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); } - -//////////////////////////////////////////////////////////////////////////////// -/// 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); } - -//////////////////////////////////////////////////////////////////////////////// -/// 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); } - -//////////////////////////////////////////////////////////////////////////////// -/// 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); } - -} // namespace Loki - -//////////////////////////////////////////////////////////////////////////////// -/// specialization of std::less for SmartPtr -/// \ingroup SmartPointerGroup -//////////////////////////////////////////////////////////////////////////////// - -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 > > - : 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)); } -}; -} - -#endif // end file guardian - diff --git a/shared/loki/StrongPtr.h b/shared/loki/StrongPtr.h deleted file mode 100644 index 868eb48f..00000000 --- a/shared/loki/StrongPtr.h +++ /dev/null @@ -1,1697 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2006 Rich 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 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 warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_STRONG_PTR_INC_ -#define LOKI_STRONG_PTR_INC_ - -// $Id: StrongPtr.h 914 2008-12-19 00:39:29Z rich_sposato $ - - -#include <loki/SmartPtr.h> -#if defined (LOKI_OBJECT_LEVEL_THREADING) || defined (LOKI_CLASS_LEVEL_THREADING) -#include <loki/Threads.h> -#endif - - -//////////////////////////////////////////////////////////////////////////////// -/// -/// \par Terminology -/// These terms are used within this file's comments. -/// -# StrongPtr : Class used to implement both strong and weak pointers. The -/// second template parameter determines if a StrongPtr is weak or strong. -/// -# Strong pointer : A pointer that claims ownership of a shared object. -/// When the last strong copointer dies, the object is destroyed even if -/// there are weak copointers. -/// -# Weak pointer : A pointer that does not own the shared object it points -/// to. It only destroys the shared object if there no strong copointers -/// exist when it dies. -/// -# Copointers : All the pointers that refer to the same shared object. -/// The copointers must have the same ownership policy, but the other -/// policies may be different. -/// -# Pointee : The shared object. -/// -/// \par OwnershipPolicy -/// The ownership policy has the pointer to the actual object, and it also -/// keeps track of the strong and weak copointers so that it can know if any -/// strong copointers remain. The plain pointer it maintains is stored as a -/// void pointer, which allows the ownership policy classes to be monolithic -/// classes instead of template classes. As monolithic classes, they reduce -/// amount of code-bloat. -/// -/// \par Writing Your Own OwnershipPolicy -/// If you write your own policy, you must implement these 12 functions: -/// -# explicit YourPolicy( bool strong ) -/// -# YourPolicy( void * p, bool strong ) -/// -# YourPolicy( const YourPolicy & rhs, bool strong ) -/// -# bool Release( bool strong ) -/// -# void Increment( bool strong ) -/// -# bool Decrement( bool strong ) -/// -# bool HasStrongPointer( void ) const -/// -# void Swap( YourPolicy & rhs ) -/// -# void SetPointer( void * p ) -/// -# void ZapPointer( void ) -/// -# void * GetPointer( void ) const -/// -# void * & GetPointerRef( void ) const -/// It is strongly recommended that all 12 of these functions be protected -/// instead of public. These two functions are optional for single-threaded -/// policies, but required for multi-threaded policies: -/// -# void Lock( void ) const -/// -# void Unlock( void ) const -/// This function is entirely optional: -/// -# bool Merge( TwoRefLinks & rhs ) -/// -/// \par DeletePolicy -/// The delete policy provides a mechanism to destroy an object and a default -/// value for an uninitialized pointer. You can override this policy with -/// your own when using the Singleton, NullObject, or Prototype design -/// patterns. -/// -/// \par Writing Your Own DeletePolicy -/// If you write your own policy, you must implement these 3 functions: -/// -# void static Delete( const P * p ) -/// -# static P * Default( void ) -/// -# void Swap( YourResetPolicy & ) -/// -/// \par ResetPolicy -/// A reset policy tells the ReleaseAll and ResetAll functions whether they -/// should release or reset the StrongPtr copointers. These functions do -/// not affect just one StrongPtr, but all copointers. That is unlike -/// SmartPtr where the Release and Reset functions only affect 1 SmartPtr, -/// and leave all copointers untouched. A useful trick you can do with the -/// ResetPolicy is to not allow reset when a strong pointer exists, and then -/// use the NoCheck policy for all strong pointers. The reset policy -/// guarantees the strong pointers always have a valid pointee, so checking -/// is not required; but weak pointers may still require checking. -/// -/// \par Writing Your Own ResetPolicy -/// If you write your own policy, you must implement these 2 functions: -/// -# bool OnReleaseAll( bool ) const -/// -# bool OnResetAll( bool ) const -/// The bool parameter means that this was called with a strong pointer or -/// one of its copointers is strong. The return value means the pointer -/// can be reset or released. -/// -/// \defgroup StrongPointerOwnershipGroup StrongPtr Ownership policies -/// \ingroup SmartPointerGroup -/// \defgroup StrongPointerDeleteGroup Delete policies -/// \ingroup SmartPointerGroup -/// \defgroup StrongPointerResetGroup Reset policies -/// \ingroup SmartPointerGroup -//////////////////////////////////////////////////////////////////////////////// - - -namespace Loki -{ - - -//////////////////////////////////////////////////////////////////////////////// -/// \class DeleteUsingFree -/// -/// \ingroup StrongPointerDeleteGroup -/// Implementation of the DeletePolicy used by StrongPtr. Uses explicit call -/// to T's destructor followed by call to free. This policy is useful for -/// managing the lifetime of pointers to structs returned by C functions. -//////////////////////////////////////////////////////////////////////////////// - -template < class P > -class DeleteUsingFree -{ -public: - inline void static Delete( const P* p ) - { - if ( 0 != p ) - { - p->~P(); - ::free( p ); - } - } - - /// Provides default value to initialize the pointer - inline static P* Default( void ) - { - return 0; - } - - inline void Swap( DeleteUsingFree& ) {} -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \class DeleteNothing -/// -/// \ingroup StrongPointerDeleteGroup -/// Implementation of the DeletePolicy used by StrongPtr. This will never -/// delete anything. You can use this policy with pointers to an undefined -/// type or a pure interface class with a protected destructor. -//////////////////////////////////////////////////////////////////////////////// - -template < class P > -class DeleteNothing -{ -public: - inline static void Delete( const P* ) - { - // Do nothing at all! - } - - inline static P* Default( void ) - { - return 0; - } - - inline void Swap( DeleteNothing& ) {} -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \class DeleteSingle -/// -/// \ingroup StrongPointerDeleteGroup -/// Implementation of the DeletePolicy used by StrongPtr. This deletes just -/// one shared object. This is the default class for the DeletePolicy. -//////////////////////////////////////////////////////////////////////////////// - -template < class P > -class DeleteSingle -{ -public: - 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. - Please don't use this policy with incomplete types; you may want to - use DeleteNothing instead. - */ - typedef char Type_Must_Be_Defined[ sizeof(P) ? 1 : -1 ]; - delete p; - } - - inline static P* Default( void ) - { - return 0; - } - - inline void Swap( DeleteSingle& ) {} -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \class DeleteArray -/// -/// \ingroup StrongPointerDeleteGroup -/// Implementation of the DeletePolicy used by StrongPtr. This deletes an -/// array of shared objects. -//////////////////////////////////////////////////////////////////////////////// - -template < class P > -class DeleteArray -{ -public: - 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. - Please don't use this policy with incomplete types; you may want to - use DeleteNothing instead. - */ - typedef char Type_Must_Be_Defined[ sizeof(P) ? 1 : -1 ]; - delete [] p; - } - - inline static P* Default( void ) - { - return 0; - } - - inline void Swap( DeleteArray& ) {} -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \class CantResetWithStrong -/// -/// \ingroup StrongPointerResetGroup -/// Implementation of the ResetPolicy used by StrongPtr. This is the default -/// ResetPolicy for StrongPtr. It forbids reset and release only if a strong -/// copointer exists. -//////////////////////////////////////////////////////////////////////////////// - -template < class P > -struct CantResetWithStrong -{ - inline bool OnReleaseAll( bool hasStrongPtr ) const - { - return ! hasStrongPtr; - } - - inline bool OnResetAll( bool hasStrongPtr ) const - { - return ! hasStrongPtr; - } -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \class AllowReset -/// -/// \ingroup StrongPointerResetGroup -/// Implementation of the ResetPolicy used by StrongPtr. It allows reset and -/// release under any circumstance. -//////////////////////////////////////////////////////////////////////////////// - -template < class P > -struct AllowReset -{ - inline bool OnReleaseAll( bool ) const - { - return true; - } - inline bool OnResetAll( bool ) const - { - return true; - } -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \class NeverReset -/// -/// \ingroup StrongPointerResetGroup -/// Implementation of the ResetPolicy used by StrongPtr. It forbids reset and -/// release under any circumstance. -//////////////////////////////////////////////////////////////////////////////// - -template < class P > -struct NeverReset -{ - inline bool OnReleaseAll( bool ) const - { - return false; - } - inline bool OnResetAll( bool ) const - { - return false; - } -}; - -// ---------------------------------------------------------------------------- - -namespace Private -{ - -//////////////////////////////////////////////////////////////////////////////// -/// \class TwoRefCountInfo -/// -/// \ingroup StrongPointerOwnershipGroup -/// Implementation detail for reference counting strong and weak pointers. -/// It maintains a void pointer and 2 reference counts. Since it is just a -/// class for managing implementation details, it is not intended to be used -/// directly - which is why it is in a private namespace. Each instance is a -/// shared resource for all copointers, and there should be only one of these -/// for each set of copointers. This class is small, trivial, and inline. -//////////////////////////////////////////////////////////////////////////////// - -class LOKI_EXPORT TwoRefCountInfo -{ -public: - - inline explicit TwoRefCountInfo( bool strong ) - : m_pointer( 0 ) - , m_strongCount( strong ? 1 : 0 ) - , m_weakCount( strong ? 0 : 1 ) - { - } - - inline TwoRefCountInfo( void* p, bool strong ) - : m_pointer( p ) - , m_strongCount( strong ? 1 : 0 ) - , m_weakCount( strong ? 0 : 1 ) - { - } - - inline ~TwoRefCountInfo( void ) - { - assert( 0 == m_strongCount ); - assert( 0 == m_weakCount ); - } - - inline bool HasStrongPointer( void ) const - { - return ( 0 < m_strongCount ); - } - - inline bool HasWeakPointer( void ) const - { - return ( 0 < m_weakCount ); - } - - inline void IncStrongCount( void ) - { - ++m_strongCount; - } - - inline void IncWeakCount( void ) - { - ++m_weakCount; - } - - inline bool DecStrongCount( void ) - { - assert( 0 < m_strongCount ); - --m_strongCount; - const bool isZero = ( 0 == m_strongCount ); - return isZero; - } - - inline void DecWeakCount( void ) - { - assert( 0 < m_weakCount ); - --m_weakCount; - } - - inline void ZapPointer( void ) - { - m_pointer = 0; - } - - void SetPointer( void* p ) - { - m_pointer = p; - } - - inline void* GetPointer( void ) const - { - return m_pointer; - } - - inline void*& GetPointerRef( void ) const - { - return const_cast< void *& >( m_pointer ); - } - -private: - /// Copy-constructor not implemented. - TwoRefCountInfo( const TwoRefCountInfo& ); - /// Copy-assignment operator not implemented. - TwoRefCountInfo& operator = ( const TwoRefCountInfo& ); - - void* m_pointer; - unsigned int m_strongCount; - unsigned int m_weakCount; -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \class LockableTwoRefCountInfo -/// -/// \ingroup StrongPointerOwnershipGroup -/// Implementation detail for thread-safe reference counting for strong and -/// weak pointers. It uses TwoRefCountInfo to manage the pointer and counts. -/// All this does is provide a thread safety mechanism. Since it is just a -/// class for managing implementation details, it is not intended to be used -/// directly - which is why it is in a private namespace. Each instance is a -/// shared resource for all copointers, and there should be only one of these -/// for each set of copointers. This class is small, trivial, and inline. -/// -/// \note This class is not designed for use with a single-threaded model. -/// Tests using a single-threaded model will not run properly, but tests in a -/// multi-threaded model with either class-level-locking or object-level-locking -/// do run properly. -//////////////////////////////////////////////////////////////////////////////// - -#if defined (LOKI_OBJECT_LEVEL_THREADING) || defined (LOKI_CLASS_LEVEL_THREADING) - -class LOKI_EXPORT LockableTwoRefCountInfo - : private Loki::Private::TwoRefCountInfo -{ -public: - - inline explicit LockableTwoRefCountInfo( bool strong ) - : TwoRefCountInfo( strong ) - , m_Mutex() - { - } - - LockableTwoRefCountInfo( void* p, bool strong ) - : TwoRefCountInfo( p, strong ) - , m_Mutex() - { - } - - inline ~LockableTwoRefCountInfo( void ) - { - } - - inline void Lock( void ) const - { - m_Mutex.Lock(); - } - - inline void Unlock( void ) const - { - m_Mutex.Unlock(); - } - - inline bool HasStrongPointer( void ) const - { - m_Mutex.Lock(); - const bool has = TwoRefCountInfo::HasStrongPointer(); - m_Mutex.Unlock(); - return has; - } - - inline bool HasWeakPointer( void ) const - { - m_Mutex.Lock(); - const bool has = TwoRefCountInfo::HasWeakPointer(); - m_Mutex.Unlock(); - return has; - } - - inline void IncStrongCount( void ) - { - m_Mutex.Lock(); - TwoRefCountInfo::IncStrongCount(); - m_Mutex.Unlock(); - } - - inline void IncWeakCount( void ) - { - m_Mutex.Lock(); - TwoRefCountInfo::IncWeakCount(); - m_Mutex.Unlock(); - } - - inline bool DecStrongCount( void ) - { - m_Mutex.Lock(); - const bool isZero = TwoRefCountInfo::DecStrongCount(); - m_Mutex.Unlock(); - return isZero; - } - - inline void DecWeakCount( void ) - { - m_Mutex.Lock(); - TwoRefCountInfo::DecWeakCount(); - m_Mutex.Unlock(); - } - - inline void ZapPointer( void ) - { - m_Mutex.Lock(); - TwoRefCountInfo::ZapPointer(); - m_Mutex.Unlock(); - } - - void SetPointer( void* p ) - { - m_Mutex.Lock(); - TwoRefCountInfo::SetPointer( p ); - m_Mutex.Unlock(); - } - - inline void* GetPointer( void ) const - { - return TwoRefCountInfo::GetPointer(); - } - - inline void*& GetPointerRef( void ) const - { - return TwoRefCountInfo::GetPointerRef(); - } - -private: - /// Default constructor is not available. - LockableTwoRefCountInfo( void ); - /// Copy constructor is not available. - LockableTwoRefCountInfo( const LockableTwoRefCountInfo& ); - /// Copy-assignment operator is not available. - LockableTwoRefCountInfo& operator = ( const LockableTwoRefCountInfo& ); - - mutable LOKI_DEFAULT_MUTEX m_Mutex; -}; - -#endif // if object-level-locking or class-level-locking - -} // end namespace Private - -//////////////////////////////////////////////////////////////////////////////// -/// \class TwoRefCounts -/// -/// \ingroup StrongPointerOwnershipGroup -/// This implementation of StrongPtr's OwnershipPolicy uses a pointer to a -/// shared instance of TwoRefCountInfo. This is the default policy for -/// OwnershipPolicy. Some functions are trivial enough to be inline, while -/// others are implemented elsewhere. It is not thread safe, and is intended -/// for single-threaded environments. -//////////////////////////////////////////////////////////////////////////////// - -class LOKI_EXPORT TwoRefCounts -{ -protected: - - explicit TwoRefCounts( bool strong ); - - TwoRefCounts( const void* p, bool strong ); - - TwoRefCounts( const TwoRefCounts& rhs, bool strong ) : - m_counts( rhs.m_counts ) - { - Increment( strong ); - } - - /** The destructor does not need to do anything since the call to - ZapPointer inside StrongPtr::~StrongPtr will do the cleanup which - this dtor would have done. - */ - inline ~TwoRefCounts( void ) {} - - inline bool Release( bool strong ) - { - return Decrement( strong ); - } - - bool HasStrongPointer( void ) const - { - return m_counts->HasStrongPointer(); - } - - void Swap( TwoRefCounts& rhs ); - - void SetPointer( void* p ) - { - m_counts->SetPointer( p ); - } - - void ZapPointer( void ); - - inline void*& GetPointerRef( void ) const - { - return m_counts->GetPointerRef(); - } - - inline void* GetPointer( void ) const - { - return m_counts->GetPointer(); - } - -private: - TwoRefCounts( void ); - TwoRefCounts& operator = ( const TwoRefCounts& ); - - void Increment( bool strong ); - - bool Decrement( bool strong ); - - /// Pointer to all shared data. - Loki::Private::TwoRefCountInfo* m_counts; -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \class LockableTwoRefCounts -/// -/// \ingroup StrongPointerOwnershipGroup -/// This implementation of StrongPtr's OwnershipPolicy uses a pointer to a -/// shared instance of LockableTwoRefCountInfo. It behaves very similarly to -/// TwoRefCounts, except that it provides thread-safety. Some functions are -/// trivial enough to be inline, while others are implemented elsewhere. -/// -/// \note This class is not designed for use with a single-threaded model. -/// Tests using a single-threaded model will not run properly, but tests in a -/// multi-threaded model with either class-level-locking or object-level-locking -/// do run properly. -//////////////////////////////////////////////////////////////////////////////// - -#if defined (LOKI_OBJECT_LEVEL_THREADING) || defined (LOKI_CLASS_LEVEL_THREADING) - -class LOKI_EXPORT LockableTwoRefCounts -{ - typedef SmallValueObject< ::Loki::ClassLevelLockable > ThreadSafePointerAllocator; - -protected: - - explicit LockableTwoRefCounts( bool strong ) - : m_counts( NULL ) - { - 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 ) - : m_counts( NULL ) - { - void* temp = ThreadSafePointerAllocator::operator new( - sizeof(Loki::Private::LockableTwoRefCountInfo) ); -#ifdef DO_EXTRA_LOKI_TESTS - assert( temp != 0 ); -#endif - void* p2 = const_cast< void* >( p ); - m_counts = new ( temp ) - Loki::Private::LockableTwoRefCountInfo( p2, strong ); - } - - LockableTwoRefCounts( const LockableTwoRefCounts& rhs, bool strong ) : - m_counts( rhs.m_counts ) - { - Increment( strong ); - } - - /** The destructor does not need to do anything since the call to - ZapPointer inside StrongPtr::~StrongPtr will do the cleanup which - this dtor would have done. - */ - inline ~LockableTwoRefCounts( void ) {} - - inline void Lock( void ) const - { - m_counts->Lock(); - } - - inline void Unlock( void ) const - { - m_counts->Unlock(); - } - - inline bool Release( bool strong ) - { - return Decrement( strong ); - } - - void Increment( bool strong ) - { - if ( strong ) - { - m_counts->IncStrongCount(); - } - else - { - m_counts->IncWeakCount(); - } - } - - bool Decrement( bool strong ) - { - bool noStrongPointers = false; - if ( strong ) - { - noStrongPointers = m_counts->DecStrongCount(); - } - else - { - m_counts->DecWeakCount(); - noStrongPointers = !m_counts->HasStrongPointer(); - } - return noStrongPointers; - } - - bool HasStrongPointer( void ) const - { - return m_counts->HasStrongPointer(); - } - - void Swap( LockableTwoRefCounts& rhs ) - { - std::swap( m_counts, rhs.m_counts ); - } - - void SetPointer( void* p ) - { - m_counts->SetPointer( p ); - } - - void ZapPointer( void ) - { -#ifdef DO_EXTRA_LOKI_TESTS - assert( !m_counts->HasStrongPointer() ); -#endif - if ( m_counts->HasWeakPointer() ) - { - m_counts->ZapPointer(); - } - else - { - ThreadSafePointerAllocator::operator delete ( m_counts, - sizeof(Loki::Private::LockableTwoRefCountInfo) ); - m_counts = NULL; - } - } - - inline void* GetPointer( void ) const - { - return m_counts->GetPointer(); - } - - inline void*& GetPointerRef( void ) const - { - return m_counts->GetPointerRef(); - } - -private: - LockableTwoRefCounts( void ); - LockableTwoRefCounts& operator = ( const LockableTwoRefCounts& ); - - /// Pointer to all shared data. - Loki::Private::LockableTwoRefCountInfo* m_counts; -}; - -#endif // if object-level-locking or class-level-locking - -//////////////////////////////////////////////////////////////////////////////// -/// \class TwoRefLinks -/// -/// \ingroup StrongPointerOwnershipGroup -/// This implementation of StrongPtr's OwnershipPolicy uses a doubly-linked -/// cycle of copointers to a shared object. Some functions are trivial enough -/// to be inline, while others are implemented in elsewhere. It is not thread -/// safe, and is intended for single-threaded environments. -//////////////////////////////////////////////////////////////////////////////// - -class LOKI_EXPORT TwoRefLinks -{ -protected: - - inline explicit TwoRefLinks( bool strong ) - : m_pointer( 0 ) - , m_strong( strong ) - { - m_prev = m_next = this; - } - - TwoRefLinks( const void* p, bool strong ); - - TwoRefLinks( const TwoRefLinks& rhs, bool strong ); - - bool Release( bool strong ); - - void Swap( TwoRefLinks& rhs ); - - bool Merge( TwoRefLinks& rhs ); - - bool HasStrongPointer( void ) const; - - inline void ZapPointer( void ) - { - ZapAllNodes(); - } - - void SetPointer( void* p ); - - inline void* GetPointer( void ) const - { - return m_pointer; - } - - inline void*& GetPointerRef( void ) const - { - return const_cast< void *& >( m_pointer ); - } - -private: - static unsigned int CountPrevCycle( const TwoRefLinks* pThis ); - static unsigned int CountNextCycle( const TwoRefLinks* pThis ); - - /// Not implemented. - TwoRefLinks( void ); - /// Not implemented. - TwoRefLinks& operator = ( const TwoRefLinks& ); - - 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; - const bool m_strong; -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \class StrongPtr -/// -/// \ingroup SmartPointerGroup -/// -/// \param Strong default = true, -/// \param OwnershipPolicy default = TwoRefCounts, -/// \param ConversionPolicy default = DisallowConversion, -/// \param CheckingPolicy default = AssertCheck, -/// \param ResetPolicy default = CantResetWithStrong, -/// \param DeletePolicy default = DeleteSingle -/// \param ConstnessPolicy default = LOKI_DEFAULT_CONSTNESS -//////////////////////////////////////////////////////////////////////////////// - -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 - > -class StrongPtr - : public OwnershipPolicy - , public ConversionPolicy - , public CheckingPolicy< T* > - , public ResetPolicy< T > - , public DeletePolicy< T > -{ - typedef ConversionPolicy CP; - typedef CheckingPolicy< T* > KP; - typedef ResetPolicy< T > RP; - typedef DeletePolicy< T > DP; - -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 typename ConstnessPolicy< T >::Type* ConstPointerType; - typedef typename ConstnessPolicy< T >::Type& ConstReferenceType; - -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; -#else - typedef const StoredType& ImplicitArg; - typedef typename Select<false, const StoredType&, NeverMatched>::Result ExplicitArg; -#endif - -public: - - StrongPtr( void ) : OP( Strong ) - { - KP::OnDefault( GetPointer() ); - } - - explicit StrongPtr( ExplicitArg p ) : OP( p, Strong ) - { - KP::OnInit( GetPointer() ); - } - - StrongPtr( ImplicitArg p ) : OP( p, Strong ) - { - KP::OnInit( GetPointer() ); - } - - 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 - > - StrongPtr( - const StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & rhs ) - : OP( rhs, Strong ) - { - } - - 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( - StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & rhs ) - : OP( rhs, Strong ) - { - } - - StrongPtr( RefToValue< StrongPtr > rhs ) - : OP( rhs, Strong ), KP( rhs ), CP( rhs ), DP( rhs ) - { - } - - operator RefToValue< StrongPtr >( void ) - { - return RefToValue< StrongPtr >( *this ); - } - - StrongPtr& operator = ( const StrongPtr& rhs ) - { - if ( GetPointer() != rhs.GetPointer() ) - { - StrongPtr temp( rhs ); - temp.Swap( *this ); - } - return *this; - } - - StrongPtr& operator = ( T* p ) - { - if ( GetPointer() != p ) - { - StrongPtr temp( p ); - Swap( temp ); - } - return *this; - } - - 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 = ( - const StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & rhs ) - { - if ( !rhs.Equals( GetPointer() ) ) - { - StrongPtr temp( rhs ); - temp.Swap( *this ); - } - return *this; - } - - bool IsStrong( void ) const - { - return Strong; - } - - void Swap( StrongPtr& rhs ) - { - OP::Swap( rhs ); - CP::Swap( rhs ); - KP::Swap( rhs ); - DP::Swap( rhs ); - } - - ~StrongPtr() - { - if ( OP::Release( Strong ) ) - { - // Must zap the pointer before deleteing the object. Otherwise a - // cycle of weak pointers will lead to recursion, which leads to - // 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(); - OP::ZapPointer(); - if ( p != 0 ) - { - DP::Delete( p ); - } - } - } - -#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 ) - { - if ( !sp.RP::OnReleaseAll( sp.IsStrong() || sp.OP::HasStrongPointer() ) ) - { - return false; - } - p = sp.GetPointer(); - sp.OP::SetPointer( sp.DP::Default() ); - return true; - } - - friend bool ResetAll( StrongPtr& sp, - typename StrongPtr::StoredType p ) - { - if ( sp.OP::GetPointer() == p ) - { - return true; - } - if ( !sp.RP::OnResetAll( sp.IsStrong() || sp.OP::HasStrongPointer() ) ) - { - return false; - } - sp.DP::Delete( sp.GetPointer() ); - sp.OP::SetPointer( p ); - return true; - } - -#else - - 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 - > - 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 ); - - - 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 - > - 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 ); - -#endif - - - /** Merges ownership of two StrongPtr's that point to same shared object - but are not copointers. Requires Merge function in OwnershipPolicy. - \return True for success, false if not pointer to same object. - */ - 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 - > - bool Merge( StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & rhs ) - { - if ( OP::GetPointer() != rhs.OP::GetPointer() ) - { - return false; - } - return OP::Merge( rhs ); - } - - /** Locks StrongPtr so other threads can't affect pointer. Requires the - OwnershipPolicy to have Lock function. - */ - void Lock( void ) - { - OP::Lock(); - } - - /** Unlocks StrongPtr so other threads can affect pointer. Requires the - OwnershipPolicy to have Unlock function. - */ - void Unlock( void ) - { - OP::Unlock(); - } - - PointerType operator -> () - { - KP::OnDereference( GetPointer() ); - return GetPointer(); - } - - ConstPointerType operator -> () const - { - KP::OnDereference( GetPointer() ); - return GetPointer(); - } - - ReferenceType operator * () - { - KP::OnDereference( GetPointer() ); - return * GetPointer(); - } - - ConstReferenceType operator * () const - { - KP::OnDereference( GetPointer() ); - return * GetPointer(); - } - - /// Helper function which can be called to avoid exposing GetPointer function. - template < class T1 > - 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 - { - return ( GetPointer() < p ); - } - - /// Helper function which can be called to avoid exposing GetPointer function. - template < class T1 > - bool GreaterThan( const T1* p ) const - { - return ( GetPointer() > p ); - } - - /// 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 - > - bool operator == ( - const StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & rhs ) const - { - return ( rhs.Equals( GetPointer() ) ); - } - - /// 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 - > - bool operator != ( - const StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & rhs ) const - { - return !( rhs.Equals( GetPointer() ) ); - } - - /// 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 - > - bool operator < ( - const StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & rhs ) const - { - return ( rhs.GreaterThan( GetPointer() ) ); - } - - /// 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 - > - inline bool operator > ( - const StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & rhs ) const - { - return ( rhs.LessThan( GetPointer() ) ); - } - - /// 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 - > - inline bool operator <= ( - const StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & rhs ) const - { - return !( rhs.LessThan( GetPointer() ) ); - } - - /// 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 - > - inline bool operator >= ( - const StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & rhs ) const - { - return !( rhs.GreaterThan( GetPointer() ) ); - } - - inline bool operator ! () const // Enables "if ( !sp ) ..." - { - return ( 0 == OP::GetPointer() ); - } - -protected: - - inline PointerType GetPointer( void ) - { - return reinterpret_cast< PointerType >( OP::GetPointer() ); - } - - inline ConstPointerType GetPointer( void ) const - { - return reinterpret_cast< ConstPointerType >( OP::GetPointer() ); - } - -private: - - inline ReferenceType GetPointerRef( void ) - { - return reinterpret_cast< ReferenceType >( OP::GetPointerRef() ); - } - - inline ConstReferenceType GetPointerRef( void ) const - { - return reinterpret_cast< ConstReferenceType >( OP::GetPointerRef() ); - } - - // Helper for enabling 'if (sp)' - struct Tester - { - Tester(int) {} - void dummy() {} - }; - - typedef void (Tester::*unspecified_boolean_type_)(); - - typedef typename Select< CP::allow, Tester, unspecified_boolean_type_ >::Result - unspecified_boolean_type; - -public: - // enable 'if (sp)' - operator unspecified_boolean_type() const - { - return !*this ? 0 : &Tester::dummy; - } - -private: - // Helper for disallowing automatic conversion - struct Insipid - { - Insipid(PointerType) {} - }; - - typedef typename Select< CP::allow, PointerType, Insipid >::Result - AutomaticConversionResult; - -public: - operator AutomaticConversionResult() const - { - return GetPointer(); - } - -}; - -// ---------------------------------------------------------------------------- - -// friend functions - -#ifndef LOKI_ENABLE_FRIEND_TEMPLATE_TEMPLATE_PARAMETER_WORKAROUND - -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 - > -bool ReleaseAll( StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & sp, - 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; -} - -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 - > -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 ) - { - 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 - - -// free comparison operators for class template StrongPtr - -/// operator== for lhs = StrongPtr, rhs = raw pointer -/// \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 == ( - const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & lhs, U* rhs ) -{ - return ( lhs.Equals( rhs ) ); -} - -/// operator== for lhs = raw pointer, rhs = StrongPtr -/// \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 ) -{ - return ( rhs.Equals( lhs ) ); -} - -/// operator!= for lhs = StrongPtr, rhs = raw pointer -/// \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 != ( - const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & lhs, U* rhs ) -{ - return !( lhs.Equals( rhs ) ); -} - -/// operator!= for lhs = raw pointer, rhs = StrongPtr -/// \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 ) -{ - return !( rhs.Equals( lhs ) ); -} - -/// operator< for lhs = StrongPtr, rhs = raw pointer -/// \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 < ( - const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & lhs, U* rhs ) -{ - return ( lhs.LessThan( rhs ) ); -} - -/// operator< for lhs = raw pointer, rhs = StrongPtr -/// \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 ) -{ - return ( rhs.GreaterThan( lhs ) ); -} - -// operator> for lhs = StrongPtr, rhs = raw pointer -/// \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 > ( - const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & lhs, U* rhs ) -{ - return ( lhs.GreaterThan( rhs ) ); -} - -/// operator> for lhs = raw pointer, rhs = StrongPtr -/// \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 ) -{ - return ( rhs.LessThan( lhs ) ); -} - -/// operator<= for lhs = StrongPtr, rhs = raw pointer -/// \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 <= ( - const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & lhs, U* rhs ) -{ - return !( lhs.GreaterThan( rhs ) ); -} - -/// operator<= for lhs = raw pointer, rhs = StrongPtr -/// \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 ) -{ - return !( rhs.LessThan( lhs ) ); -} - -/// operator>= for lhs = StrongPtr, rhs = raw pointer -/// \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 >= ( - const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & lhs, U* rhs ) -{ - return !( lhs.LessThan( rhs ) ); -} - -/// operator>= for lhs = raw pointer, rhs = StrongPtr -/// \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 ) -{ - return !( rhs.GreaterThan( lhs ) ); -} - -} // namespace Loki - -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 > > - : public binary_function < - 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 - { - return ( lhs < rhs ); - } -}; -} - -//////////////////////////////////////////////////////////////////////////////// - -#endif // end file guardian - diff --git a/shared/loki/Threads.h b/shared/loki/Threads.h deleted file mode 100644 index 690ca50f..00000000 --- a/shared/loki/Threads.h +++ /dev/null @@ -1,609 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2001 by Andrei Alexandrescu -// This code accompanies the book: -// 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 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_THREADS_INC_ -#define LOKI_THREADS_INC_ - -// $Id: Threads.h 902 2008-11-10 05:47:06Z rich_sposato $ - - -/// @defgroup ThreadingGroup Threading -/// Policies to for the threading model: -/// -/// - SingleThreaded -/// - ObjectLevelLockable -/// - ClassLevelLockable -/// -/// All classes in Loki have configurable threading model. -/// -/// The macro LOKI_DEFAULT_THREADING selects the default -/// threading model for certain components of Loki -/// (it affects only default template arguments) -/// -/// \par Usage: -/// -/// To use a specific threading model define -/// -/// - nothing, single-theading is default -/// - LOKI_OBJECT_LEVEL_THREADING for object-level-threading -/// - LOKI_CLASS_LEVEL_THREADING for class-level-threading -/// -/// \par Supported platfroms: -/// -/// - Windows (windows.h) -/// - POSIX (pthread.h): -/// No recursive mutex support with pthread. -/// This means: calling Lock() on a Loki::Mutex twice from the -/// same thread before unlocking the mutex deadlocks the system. -/// To avoid this redesign your synchronization. See also: -/// http://sourceforge.net/tracker/index.php?func=detail&aid=1516182&group_id=29557&atid=396647 - - -#include <cassert> - -#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 - -#else - -#define LOKI_DEFAULT_THREADING ::Loki::SingleThreaded -#define LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL ::Loki::SingleThreaded - -#endif - -#ifndef LOKI_DEFAULT_MUTEX -#define LOKI_DEFAULT_MUTEX ::Loki::Mutex -#endif - -#ifdef LOKI_WINDOWS_H - -#define LOKI_THREADS_MUTEX(x) CRITICAL_SECTION (x); -#define LOKI_THREADS_MUTEX_INIT(x) ::InitializeCriticalSection (x) -#define LOKI_THREADS_MUTEX_DELETE(x) ::DeleteCriticalSection (x) -#define LOKI_THREADS_MUTEX_LOCK(x) ::EnterCriticalSection (x) -#define LOKI_THREADS_MUTEX_UNLOCK(x) ::LeaveCriticalSection (x) -#define LOKI_THREADS_LONG LONG -#define LOKI_THREADS_MUTEX_CTOR(x) - -#define LOKI_THREADS_ATOMIC_FUNCTIONS \ - static IntType AtomicMultiply(volatile IntType& lval, const IntType val) \ - { \ - ::EnterCriticalSection( &atomic_mutex_ ); \ - lval *= val; \ - ::LeaveCriticalSection( &atomic_mutex_ ); \ - return lval; \ - } \ - \ - static IntType AtomicDivide(volatile IntType& lval, const IntType val) \ - { \ - ::EnterCriticalSection( &atomic_mutex_ ); \ - lval /= val; \ - ::LeaveCriticalSection( &atomic_mutex_ ); \ - return lval; \ - } \ - \ - static IntType AtomicIncrement(volatile IntType& lval) \ - { \ - ::EnterCriticalSection( &atomic_mutex_ ); \ - ++lval; \ - ::LeaveCriticalSection( &atomic_mutex_ ); \ - return lval; \ - } \ - \ - static IntType AtomicDecrement(volatile IntType& lval) \ - { \ - ::EnterCriticalSection( &atomic_mutex_ ); \ - --lval; \ - ::LeaveCriticalSection( &atomic_mutex_ ); \ - return lval; \ - } \ - \ - static void AtomicAssign(volatile IntType& lval, const IntType val) \ - { InterlockedExchange(&const_cast<IntType&>(lval), val); } \ - \ - static void AtomicAssign(IntType& lval, volatile const IntType& val) \ - { InterlockedExchange(&lval, val); } \ - \ - static IntType AtomicIncrement(volatile IntType& lval, const IntType compare, bool & matches ) \ - { \ - ::EnterCriticalSection( &atomic_mutex_ ); \ - ++lval; \ - matches = ( lval == compare ); \ - ::LeaveCriticalSection( &atomic_mutex_ ); \ - return lval; \ - } \ - \ - static IntType AtomicDecrement(volatile IntType& lval, const IntType compare, bool & matches ) \ - { \ - ::EnterCriticalSection( &atomic_mutex_ ); \ - --lval; \ - matches = ( lval == compare ); \ - ::LeaveCriticalSection( &atomic_mutex_ ); \ - return lval; \ - } \ - \ - static IntType AtomicAdd(volatile IntType& lval, const IntType val, const IntType compare, bool & matches ) \ - { \ - ::EnterCriticalSection( &atomic_mutex_ ); \ - lval += val; \ - matches = ( lval == compare ); \ - ::LeaveCriticalSection( &atomic_mutex_ ); \ - return lval; \ - } \ - \ - static IntType AtomicSubtract(volatile IntType& lval, const IntType val, const IntType compare, bool & matches ) \ - { \ - ::EnterCriticalSection( &atomic_mutex_ ); \ - lval -= val; \ - matches = ( lval == compare ); \ - ::LeaveCriticalSection( &atomic_mutex_ ); \ - return lval; \ - } \ - \ - static IntType AtomicMultiply(volatile IntType& lval, const IntType val, const IntType compare, bool & matches ) \ - { \ - ::EnterCriticalSection( &atomic_mutex_ ); \ - lval *= val; \ - matches = ( lval == compare ); \ - ::LeaveCriticalSection( &atomic_mutex_ ); \ - return lval; \ - } \ - \ - static IntType AtomicDivide(volatile IntType& lval, const IntType val, const IntType compare, bool & matches ) \ - { \ - ::EnterCriticalSection( &atomic_mutex_ ); \ - lval /= val; \ - matches = ( lval == compare ); \ - ::LeaveCriticalSection( &atomic_mutex_ ); \ - return lval; \ - } - -#elif defined(LOKI_PTHREAD_H) - - -#define LOKI_THREADS_MUTEX(x) pthread_mutex_t (x); - -#define LOKI_THREADS_MUTEX_INIT(x) ::pthread_mutex_init(x, 0) - -// define to 1 to enable recursive mutex support -#if 0 -// experimental recursive mutex support -#define LOKI_THREADS_MUTEX_CTOR(x) : x(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) -#else -// no recursive mutex support -#define LOKI_THREADS_MUTEX_CTOR(x) -#endif - -#define LOKI_THREADS_MUTEX_DELETE(x) ::pthread_mutex_destroy (x) -#define LOKI_THREADS_MUTEX_LOCK(x) ::pthread_mutex_lock (x) -#define LOKI_THREADS_MUTEX_UNLOCK(x) ::pthread_mutex_unlock (x) -#define LOKI_THREADS_LONG long - -#define LOKI_THREADS_ATOMIC(x) \ - pthread_mutex_lock(&atomic_mutex_); \ - x; \ - pthread_mutex_unlock(&atomic_mutex_) - -#define LOKI_THREADS_ATOMIC_FUNCTIONS \ - private: \ - static pthread_mutex_t atomic_mutex_; \ - public: \ - static IntType AtomicMultiply(volatile IntType& lval, const IntType val) \ - { \ - ::pthread_mutex_lock( &atomic_mutex_ ); \ - lval *= val; \ - ::pthread_mutex_unlock( &atomic_mutex_ ); \ - return lval; \ - } \ - \ - static IntType AtomicDivide(volatile IntType& lval, const IntType val) \ - { \ - ::pthread_mutex_lock( &atomic_mutex_ ); \ - lval /= val; \ - ::pthread_mutex_unlock( &atomic_mutex_ ); \ - return lval; \ - } \ - \ - static IntType AtomicIncrement(volatile IntType& lval) \ - { \ - ::pthread_mutex_lock( &atomic_mutex_ ); \ - ++lval; \ - ::pthread_mutex_unlock( &atomic_mutex_ ); \ - return lval; \ - } \ - \ - static IntType AtomicDecrement(volatile IntType& lval) \ - { \ - ::pthread_mutex_lock( &atomic_mutex_ ); \ - --lval; \ - ::pthread_mutex_unlock( &atomic_mutex_ ); \ - return lval; \ - } \ - \ - static void AtomicAssign(volatile IntType& lval, const IntType val) \ - { \ - ::pthread_mutex_lock( &atomic_mutex_ ); \ - lval = val; \ - ::pthread_mutex_unlock( &atomic_mutex_ ); \ - return lval; \ - } \ - \ - static void AtomicAssign(IntType& lval, volatile const IntType& val) \ - { \ - ::pthread_mutex_lock( &atomic_mutex_ ); \ - lval = val; \ - ::pthread_mutex_unlock( &atomic_mutex_ ); \ - return lval; \ - } \ - \ - static IntType AtomicIncrement(volatile IntType& lval, const IntType compare, bool & matches ) \ - { \ - ::pthread_mutex_lock( &atomic_mutex_ ); \ - ++lval; \ - matches = ( compare == lval ); \ - ::pthread_mutex_unlock( &atomic_mutex_ ); \ - return lval; \ - } \ - \ - static IntType AtomicDecrement(volatile IntType& lval, const IntType compare, bool & matches ) \ - { \ - ::pthread_mutex_lock( &atomic_mutex_ ); \ - --lval; \ - matches = ( compare == lval ); \ - ::pthread_mutex_unlock( &atomic_mutex_ ); \ - return lval; \ - } \ - static IntType AtomicMultiply(volatile IntType& lval, const IntType val, const IntType compare, bool & matches ) \ - { \ - ::pthread_mutex_lock( &atomic_mutex_ ); \ - lval *= val; \ - matches = ( lval == compare ); \ - ::pthread_mutex_unlock( &atomic_mutex_ ); \ - return lval; \ - } \ - \ - static IntType AtomicDivide(volatile IntType& lval, const IntType val, const IntType compare, bool & matches ) \ - { \ - ::pthread_mutex_lock( &atomic_mutex_ ); \ - lval /= val; \ - matches = ( lval == compare ); \ - ::pthread_mutex_unlock( &atomic_mutex_ ); \ - return lval; \ - } - -#else // single threaded - -#define LOKI_THREADS_MUTEX(x) -#define LOKI_THREADS_MUTEX_INIT(x) -#define LOKI_THREADS_MUTEX_DELETE(x) -#define LOKI_THREADS_MUTEX_LOCK(x) -#define LOKI_THREADS_MUTEX_UNLOCK(x) -#define LOKI_THREADS_LONG -#define LOKI_THREADS_MUTEX_CTOR(x) - -#endif - - - -namespace Loki -{ - -//////////////////////////////////////////////////////////////////////////////// -/// \class Mutex -// -/// \ingroup ThreadingGroup -/// A simple and portable Mutex. A default policy class for locking objects. -//////////////////////////////////////////////////////////////////////////////// - -class Mutex -{ -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_) -}; - - -//////////////////////////////////////////////////////////////////////////////// -/// \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 - { - Lock() {} - explicit Lock(const SingleThreaded&) {} - explicit Lock(const SingleThreaded*) {} - }; - - typedef Host VolatileType; - - typedef int IntType; - - 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 AtomicMultiply(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 AtomicDecrement(volatile IntType& lval) - { return --lval; } - - static void AtomicAssign(volatile IntType& lval, const 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 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 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 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_; - -public: - ObjectLevelLockable() : mtx_() {} - - ObjectLevelLockable(const ObjectLevelLockable&) : mtx_() {} - - ~ObjectLevelLockable() {} - - class Lock; - friend class Lock; - - /// \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(); - } - - /// 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_; - }; - - 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 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 -{ - struct Initializer - { - bool init_; - MutexPolicy mtx_; - - Initializer() : init_(false), mtx_() - { - init_ = true; - } - - ~Initializer() - { - assert(init_); - } - }; - - static Initializer initializer_; - -public: - - class Lock; - friend class Lock; - - /// \struct Lock - /// Lock class to lock on class level - class Lock - { - 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 - -}; - -#ifdef LOKI_PTHREAD_H -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_; - -#endif // #if defined(LOKI_WINDOWS_H) || defined(LOKI_PTHREAD_H) - -} // namespace Loki - - -#endif // end file guardian - diff --git a/shared/loki/Tuple.h b/shared/loki/Tuple.h deleted file mode 100644 index ec5ae213..00000000 --- a/shared/loki/Tuple.h +++ /dev/null @@ -1,22 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2001 by Andrei Alexandrescu -// This code accompanies the book: -// 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 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// - -// Last update: June 20, 2001 - -//////////////////////////////////////////////////////////////////////////////// -// This file is intentionally left empty -// Due to compiler limitations, its contents has been moved to -// HierarchyGenerators.h -//////////////////////////////////////////////////////////////////////////////// diff --git a/shared/loki/TypeManip.h b/shared/loki/TypeManip.h deleted file mode 100644 index 7933e340..00000000 --- a/shared/loki/TypeManip.h +++ /dev/null @@ -1,290 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2001 by Andrei Alexandrescu -// This code accompanies the book: -// 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 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_TYPEMANIP_INC_ -#define LOKI_TYPEMANIP_INC_ - -// $Id: TypeManip.h 749 2006-10-17 19:49:26Z syntheticpp $ - - -namespace Loki -{ -//////////////////////////////////////////////////////////////////////////////// -// class template Int2Type -// Converts each integral constant into a unique type -// Invocation: Int2Type<v> where v is a compile-time constant integral -// Defines 'value', an enum that evaluates to v -//////////////////////////////////////////////////////////////////////////////// - -template <int v> -struct Int2Type -{ - enum { value = v }; -}; - -//////////////////////////////////////////////////////////////////////////////// -// class template Type2Type -// Converts each type into a unique, insipid type -// Invocation Type2Type<T> where T is a type -// Defines the type OriginalType which maps back to T -//////////////////////////////////////////////////////////////////////////////// - -template <typename T> -struct Type2Type -{ - typedef T OriginalType; -}; - -//////////////////////////////////////////////////////////////////////////////// -// class template Select -// Selects one of two types based upon a boolean constant -// Invocation: Select<flag, T, U>::Result -// where: -// flag is a compile-time boolean constant -// T and U are types -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// class template IsSameType -// Return true iff two given types are the same -// Invocation: SameType<T, U>::value -// where: -// T and U are types -// 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 }; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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(); -}; -} - -//////////////////////////////////////////////////////////////////////////////// -// class template Conversion -// Figures out the conversion relationships between two types -// Invocations (T and U are types): -// a) Conversion<T, U>::exists -// returns (at compile time) true if there is an implicit conversion from T -// to U (example: Derived to Base) -// b) Conversion<T, U>::exists2Way -// returns (at compile time) true if there are both conversions from T -// to U and from U to T (example: int to char and back) -// c) Conversion<T, U>::sameType -// returns (at compile time) true if T and U represent the same type -// -// 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; -#ifndef __MWERKS__ - enum { exists = sizeof(typename H::Small) == sizeof((H::Test(H::MakeT()))) }; -#else - 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 }; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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 -// same type. -// -// Caveat: might not work if T and U are in a private inheritance hierarchy. -//////////////////////////////////////////////////////////////////////////////// - -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) - }; - - // Dummy enum to make sure that both classes are fully defined. - enum { dontUseWithIncompleteTypes = ( sizeof (T) == sizeof (U) ) }; -}; - -template <> -struct SuperSubclass<void, void> -{ - enum { value = false }; -}; - -template <class 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) - }; - - // Dummy enum to make sure that both classes are fully defined. - enum { dontUseWithIncompleteTypes = ( 0 == sizeof (U) ) }; -}; - -template <class T> -struct SuperSubclass<T, void> -{ - enum { value = (::Loki::Conversion<const volatile void*, const volatile T*>::exists && - !::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 ) }; -}; - -//////////////////////////////////////////////////////////////////////////////// -// class template SuperSubclassStrict -// 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. -//////////////////////////////////////////////////////////////////////////////// - -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) - }; - - // Dummy enum to make sure that both classes are fully defined. - enum { dontUseWithIncompleteTypes = ( sizeof (T) == sizeof (U) ) }; -}; - -template<> -struct SuperSubclassStrict<void, void> -{ - enum { value = false }; -}; - -template<class 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) - }; - - // Dummy enum to make sure that both classes are fully defined. - enum { dontUseWithIncompleteTypes = ( 0 == sizeof (U) ) }; -}; - -template<class T> -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) - }; - - // Dummy enum to make sure that both classes are fully defined. - enum { dontUseWithIncompleteTypes = ( sizeof (T) == 0 ) }; -}; - - -} // namespace Loki - -//////////////////////////////////////////////////////////////////////////////// -// 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 -// same type. -// -// Caveat: might not work if T and U are in a private inheritance hierarchy. -// Deprecated: Use SuperSubclass class template instead. -//////////////////////////////////////////////////////////////////////////////// - -#define LOKI_SUPERSUBCLASS(T, U) \ - ::Loki::SuperSubclass<T,U>::value - -//////////////////////////////////////////////////////////////////////////////// -// macro SUPERSUBCLASS_STRICT -// 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. -// Deprecated: Use SuperSubclassStrict class template instead. -//////////////////////////////////////////////////////////////////////////////// - -#define LOKI_SUPERSUBCLASS_STRICT(T, U) \ - ::Loki::SuperSubclassStrict<T,U>::value - - -#endif // end file guardian - diff --git a/shared/loki/TypeTraits.h b/shared/loki/TypeTraits.h deleted file mode 100644 index 28d0f0c1..00000000 --- a/shared/loki/TypeTraits.h +++ /dev/null @@ -1,2236 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2001 by Andrei Alexandrescu -// This code accompanies the book: -// 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 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_TYPETRAITS_INC_ -#define LOKI_TYPETRAITS_INC_ - -// $Id: TypeTraits.h 835 2007-08-02 19:39:02Z syntheticpp $ - - -#include "Typelist.h" -#include "Sequence.h" - -#if (defined _MSC_VER) && (_MSC_VER < 1400) -#include <string> -#endif - - -#ifdef _MSC_VER -#pragma warning( push ) -#pragma warning( disable : 4180 ) //qualifier applied to function type has no meaning; ignored -#endif - -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 -// 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 -// integral type -// Specialize this class template for nonstandard unsigned integral types -// and define value = 1 in those specializations -//////////////////////////////////////////////////////////////////////////////// - -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 -// 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 -// integral type -// Specialize this class template for nonstandard unsigned integral types -// and define value = 1 in those specializations -//////////////////////////////////////////////////////////////////////////////// - -template <typename T> -struct IsCustomSignedInt -{ - enum { value = 0 }; -}; - -//////////////////////////////////////////////////////////////////////////////// -// class template IsCustomFloat -// Offers a means to integrate nonstandard floating point types with the -// TypeTraits class template defined below. -// Invocation: IsCustomFloat<T> where T is any type -// Defines 'value', an enum that is 1 iff T is a custom built-in -// floating point type -// Specialize this class template for nonstandard unsigned integral types -// and define value = 1 in those specializations -//////////////////////////////////////////////////////////////////////////////// - -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; -#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 - -//////////////////////////////////////////////////////////////////////////////// -// class template TypeTraits -// -// Figures out at compile time various properties of any given type -// 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 -// 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 -// 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 -// - isStdSignedInt : returns true if T is a standard signed integral type -// - isStdIntegral : returns true if T is a standard integral type -// - isStdFloat : returns true if T is a standard floating-point type -// - isStdArith : returns true if T is a standard arithmetic type -// - isStdFundamental: returns true if T is a standard fundamental type -// - isUnsignedInt : returns true if T is a unsigned integral type -// - isSignedInt : returns true if T is a signed integral type -// - isIntegral : returns true if T is a integral type -// - 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 -// 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 -// T, if any -// - ParameterType : returns the optimal type to be used as a parameter -// for functions that take 'const T's -// -//////////////////////////////////////////////////////////////////////////////// - -template <typename T> -class TypeTraits -{ -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; -}; -} - -#ifdef _MSC_VER -#pragma warning( pop ) -#endif // _MSC_VER - - -#endif // end file guardian - diff --git a/shared/loki/Typelist.h b/shared/loki/Typelist.h deleted file mode 100644 index e512ac83..00000000 --- a/shared/loki/Typelist.h +++ /dev/null @@ -1,459 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2001 by Andrei Alexandrescu -// This code accompanies the book: -// 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 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_TYPELIST_INC_ -#define LOKI_TYPELIST_INC_ - -// $Id: Typelist.h 749 2006-10-17 19:49:26Z syntheticpp $ - - -#include "NullType.h" -#include "TypeManip.h" -#include "TypelistMacros.h" - - -namespace Loki -{ -//////////////////////////////////////////////////////////////////////////////// -// class template Typelist -// The building block of typelists of any length -// Use it through the LOKI_TYPELIST_NN macros -// Defines nested types: -// Head (first element, a non-typelist type by convention) -// Tail (second element, can be another typelist) -//////////////////////////////////////////////////////////////////////////////// - -template <class T, class U> -struct Typelist -{ - typedef T Head; - typedef U Tail; -}; - -// Typelist utility algorithms - -namespace TL -{ - -//////////////////////////////////////////////////////////////////////////////// -// class template MakeTypelist -// Takes a number of arguments equal to its numeric suffix -// The arguments are type names. -// MakeTypelist<T1, T2, ...>::Result -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// class template Length -// Computes the length of a typelist -// Invocation (TList is a typelist): -// Length<TList>::value -// returns a compile-time constant containing the length of TList, not counting -// 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 }; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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 -// 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 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 -// constant): -// a) TypeAt<TList, index>::Result -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// class template IndexOf -// Finds the index of a type in a typelist -// Invocation (TList is a typelist and T is a type): -// IndexOf<TList, T>::value -// 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) }; -}; - -//////////////////////////////////////////////////////////////////////////////// -// class template Append -// Appends a type or a typelist to another -// Invocation (TList is a typelist and T is either a type or a typelist): -// Append<TList, T>::Result -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// class template Erase -// Erases the first occurence, if any, of a type in a typelist -// Invocation (TList is a typelist and T is a type): -// Erase<TList, T>::Result -// 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 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// class template EraseAll -// Erases all first occurences, if any, of a type in a typelist -// Invocation (TList is a typelist and T is a type): -// EraseAll<TList, T>::Result -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// class template NoDuplicates -// Removes all duplicate types in a typelist -// Invocation (TList is a typelist): -// NoDuplicates<TList, T>::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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// class template Replace -// Replaces the first occurence of a type in a typelist, with another type -// Invocation (TList is a typelist, T, U are types): -// Replace<TList, T, U>::Result -// 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 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// class template ReplaceAll -// Replaces all occurences of a type in a typelist, with another type -// Invocation (TList is a typelist, T, U are types): -// Replace<TList, T, U>::Result -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// class template Reverse -// Reverses a typelist -// Invocation (TList is a typelist): -// Reverse<TList>::Result -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// class template MostDerived -// Finds the type in a typelist that is the most derived from a given type -// Invocation (TList is a typelist, T is a type): -// MostDerived<TList, T>::Result -// 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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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 -} // namespace Loki - - -#endif // end file guardian - diff --git a/shared/loki/TypelistMacros.h b/shared/loki/TypelistMacros.h deleted file mode 100644 index 4bd34cb7..00000000 --- a/shared/loki/TypelistMacros.h +++ /dev/null @@ -1,353 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2001 by Andrei Alexandrescu -// This code accompanies the book: -// 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 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_TYPELISTMACROS_INC_ -#define LOKI_TYPELISTMACROS_INC_ - -// $Id: TypelistMacros.h 749 2006-10-17 19:49:26Z syntheticpp $ - - -//#define LOKI_DISABLE_TYPELIST_MACROS -#ifndef LOKI_DISABLE_TYPELIST_MACROS - -//////////////////////////////////////////////////////////////////////////////// -// 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 -// all types passed as arguments, in that order. -// Example: LOKI_TYPELIST_2(char, int) generates a type containing char and int. -//////////////////////////////////////////////////////////////////////////////// - -#define LOKI_TYPELIST_1(T1) ::Loki::Typelist<T1, ::Loki::NullType> - -#define LOKI_TYPELIST_2(T1, T2) ::Loki::Typelist<T1, LOKI_TYPELIST_1(T2) > - -#define LOKI_TYPELIST_3(T1, T2, T3) ::Loki::Typelist<T1, LOKI_TYPELIST_2(T2, T3) > - -#define LOKI_TYPELIST_4(T1, T2, T3, T4) \ - ::Loki::Typelist<T1, LOKI_TYPELIST_3(T2, T3, T4) > - -#define LOKI_TYPELIST_5(T1, T2, T3, T4, T5) \ - ::Loki::Typelist<T1, LOKI_TYPELIST_4(T2, T3, T4, T5) > - -#define LOKI_TYPELIST_6(T1, T2, T3, T4, T5, T6) \ - ::Loki::Typelist<T1, LOKI_TYPELIST_5(T2, T3, T4, T5, T6) > - -#define LOKI_TYPELIST_7(T1, T2, T3, T4, T5, T6, T7) \ - ::Loki::Typelist<T1, LOKI_TYPELIST_6(T2, T3, T4, T5, T6, T7) > - -#define LOKI_TYPELIST_8(T1, T2, T3, T4, T5, T6, T7, T8) \ - ::Loki::Typelist<T1, LOKI_TYPELIST_7(T2, T3, T4, T5, T6, T7, T8) > - -#define LOKI_TYPELIST_9(T1, T2, T3, T4, T5, T6, T7, T8, T9) \ - ::Loki::Typelist<T1, LOKI_TYPELIST_8(T2, T3, T4, T5, T6, T7, T8, T9) > - -#define LOKI_TYPELIST_10(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) \ - ::Loki::Typelist<T1, LOKI_TYPELIST_9(T2, T3, T4, T5, T6, T7, T8, T9, T10) > - -#define LOKI_TYPELIST_11(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) \ - ::Loki::Typelist<T1, LOKI_TYPELIST_10(T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) > - -#define LOKI_TYPELIST_12(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12) \ - ::Loki::Typelist<T1, LOKI_TYPELIST_11(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12) > - -#define LOKI_TYPELIST_13(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13) \ - ::Loki::Typelist<T1, LOKI_TYPELIST_12(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13) > - -#define LOKI_TYPELIST_14(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14) \ -::Loki::Typelist<T1, LOKI_TYPELIST_13(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14) > - -#define LOKI_TYPELIST_15(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15) \ -::Loki::Typelist<T1, LOKI_TYPELIST_14(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15) > - -#define LOKI_TYPELIST_16(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16) \ -::Loki::Typelist<T1, LOKI_TYPELIST_15(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16) > - -#define LOKI_TYPELIST_17(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17) \ -::Loki::Typelist<T1, LOKI_TYPELIST_16(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17) > - -#define LOKI_TYPELIST_18(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18) \ -::Loki::Typelist<T1, LOKI_TYPELIST_17(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18) > - -#define LOKI_TYPELIST_19(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19) \ -::Loki::Typelist<T1, LOKI_TYPELIST_18(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19) > - -#define LOKI_TYPELIST_20(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20) \ -::Loki::Typelist<T1, LOKI_TYPELIST_19(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20) > - -#define LOKI_TYPELIST_21(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21) \ -::Loki::Typelist<T1, LOKI_TYPELIST_20(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21) > - -#define LOKI_TYPELIST_22(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22) \ -::Loki::Typelist<T1, LOKI_TYPELIST_21(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22) > - -#define LOKI_TYPELIST_23(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23) \ -::Loki::Typelist<T1, LOKI_TYPELIST_22(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23) > - -#define LOKI_TYPELIST_24(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24) \ -::Loki::Typelist<T1, LOKI_TYPELIST_23(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24) > - -#define LOKI_TYPELIST_25(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25) \ -::Loki::Typelist<T1, LOKI_TYPELIST_24(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25) > - -#define LOKI_TYPELIST_26(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26) \ -::Loki::Typelist<T1, LOKI_TYPELIST_25(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26) > - -#define LOKI_TYPELIST_27(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27) \ -::Loki::Typelist<T1, LOKI_TYPELIST_26(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27) > - -#define LOKI_TYPELIST_28(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28) \ -::Loki::Typelist<T1, LOKI_TYPELIST_27(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28) > - -#define LOKI_TYPELIST_29(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29) \ -::Loki::Typelist<T1, LOKI_TYPELIST_28(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29) > - -#define LOKI_TYPELIST_30(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30) \ -::Loki::Typelist<T1, LOKI_TYPELIST_29(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30) > - -#define LOKI_TYPELIST_31(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31) \ -::Loki::Typelist<T1, LOKI_TYPELIST_30(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31) > - -#define LOKI_TYPELIST_32(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32) \ -::Loki::Typelist<T1, LOKI_TYPELIST_31(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32) > - -#define LOKI_TYPELIST_33(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33) \ -::Loki::Typelist<T1, LOKI_TYPELIST_32(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33) > - -#define LOKI_TYPELIST_34(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34) \ -::Loki::Typelist<T1, LOKI_TYPELIST_33(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34) > - -#define LOKI_TYPELIST_35(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35) \ -::Loki::Typelist<T1, LOKI_TYPELIST_34(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35) > - -#define LOKI_TYPELIST_36(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36) \ -::Loki::Typelist<T1, LOKI_TYPELIST_35(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36) > - -#define LOKI_TYPELIST_37(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37) \ -::Loki::Typelist<T1, LOKI_TYPELIST_36(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37) > - -#define LOKI_TYPELIST_38(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38) \ -::Loki::Typelist<T1, LOKI_TYPELIST_37(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38) > - -#define LOKI_TYPELIST_39(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38, T39) \ -::Loki::Typelist<T1, LOKI_TYPELIST_38(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38, T39) > - -#define LOKI_TYPELIST_40(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40) \ -::Loki::Typelist<T1, LOKI_TYPELIST_39(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40) > - -#define LOKI_TYPELIST_41(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41) \ -::Loki::Typelist<T1, LOKI_TYPELIST_40(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41) > - -#define LOKI_TYPELIST_42(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42) \ -::Loki::Typelist<T1, LOKI_TYPELIST_41(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42) > - -#define LOKI_TYPELIST_43(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43) \ -::Loki::Typelist<T1, LOKI_TYPELIST_42(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43) > - -#define LOKI_TYPELIST_44(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44) \ -::Loki::Typelist<T1, LOKI_TYPELIST_43(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44) > - -#define LOKI_TYPELIST_45(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, \ - T41, T42, T43, T44, T45) \ -::Loki::Typelist<T1, LOKI_TYPELIST_44(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, \ - T41, T42, T43, T44, T45) > - -#define LOKI_TYPELIST_46(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, \ - T41, T42, T43, T44, T45, T46) \ -::Loki::Typelist<T1, LOKI_TYPELIST_45(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, \ - T41, T42, T43, T44, T45, T46) > - -#define LOKI_TYPELIST_47(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, \ - T41, T42, T43, T44, T45, T46, T47) \ -::Loki::Typelist<T1, LOKI_TYPELIST_46(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, \ - T41, T42, T43, T44, T45, T46, T47) > - -#define LOKI_TYPELIST_48(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, \ - T41, T42, T43, T44, T45, T46, T47, T48) \ -::Loki::Typelist<T1, LOKI_TYPELIST_47(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, \ - T41, T42, T43, T44, T45, T46, T47, T48) > - -#define LOKI_TYPELIST_49(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, \ - T41, T42, T43, T44, T45, T46, T47, T48, T49) \ -::Loki::Typelist<T1, LOKI_TYPELIST_48(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, \ - T41, T42, T43, T44, T45, T46, T47, T48, T49) > - -#define LOKI_TYPELIST_50(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, \ - T41, T42, T43, T44, T45, T46, T47, T48, T49, T50) \ -::Loki::Typelist<T1, LOKI_TYPELIST_49(T2, T3, T4, T5, T6, T7, T8, T9, T10, \ - T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ - T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, \ - T41, T42, T43, T44, T45, T46, T47, T48, T49, T50) > - -#endif //LOKI_DISABLE_TYPELIST_MACROS - -#endif // end file guardian - diff --git a/shared/loki/Visitor.h b/shared/loki/Visitor.h deleted file mode 100644 index 85b8acd2..00000000 --- a/shared/loki/Visitor.h +++ /dev/null @@ -1,355 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2001 by Andrei Alexandrescu -// This code accompanies the book: -// 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 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_VISITOR_INC_ -#define LOKI_VISITOR_INC_ - -// $Id: Visitor.h 751 2006-10-17 19:50:37Z syntheticpp $ - - -/// \defgroup VisitorGroup Visitor - -#include "Typelist.h" -#include "HierarchyGenerators.h" - -namespace Loki -{ - -//////////////////////////////////////////////////////////////////////////////// -/// \class BaseVisitor -/// -/// \ingroup VisitorGroup -/// The base class of any Acyclic Visitor -//////////////////////////////////////////////////////////////////////////////// - -class BaseVisitor -{ -public: - virtual ~BaseVisitor() {} -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \class Visitor -/// -/// \ingroup VisitorGroup -/// The building block of Acyclic Visitor -/// -/// \par Usage -/// -/// Defining the visitable class: -/// -/// \code -/// class RasterBitmap : public BaseVisitable<> -/// { -/// public: -/// LOKI_DEFINE_VISITABLE() -/// }; -/// \endcode -/// -/// Way 1 to define a visitor: -/// \code -/// class SomeVisitor : -/// public BaseVisitor // required -/// public Visitor<RasterBitmap>, -/// public Visitor<Paragraph> -/// { -/// public: -/// void Visit(RasterBitmap&); // visit a RasterBitmap -/// void Visit(Paragraph &); // visit a Paragraph -/// }; -/// \endcode -/// -/// Way 2 to define the visitor: -/// \code -/// class SomeVisitor : -/// public BaseVisitor // required -/// public Visitor<LOKI_TYPELIST_2(RasterBitmap, Paragraph)> -/// { -/// public: -/// void Visit(RasterBitmap&); // visit a RasterBitmap -/// void Visit(Paragraph &); // visit a Paragraph -/// }; -/// \endcode -/// -/// Way 3 to define the visitor: -/// \code -/// class SomeVisitor : -/// public BaseVisitor // required -/// public Visitor<Seq<RasterBitmap, Paragraph>::Type> -/// { -/// public: -/// void Visit(RasterBitmap&); // visit a RasterBitmap -/// void Visit(Paragraph &); // visit a Paragraph -/// }; -/// \endcode -/// -/// \par Using const visit functions: -/// -/// Defining the visitable class (true for const): -/// -/// \code -/// class RasterBitmap : public BaseVisitable<void, DefaultCatchAll, true> -/// { -/// public: -/// LOKI_DEFINE_CONST_VISITABLE() -/// }; -/// \endcode -/// -/// Defining the visitor which only calls const member functions: -/// \code -/// class SomeVisitor : -/// public BaseVisitor // required -/// public Visitor<RasterBitmap, void, true>, -/// { -/// public: -/// void Visit(const RasterBitmap&); // visit a RasterBitmap by a const member function -/// }; -/// \endcode -/// -/// \par Example: -/// -/// test/Visitor/main.cpp -//////////////////////////////////////////////////////////////////////////////// - -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; -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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 : -// public BaseVisitor // required -// public Visitor<LOKI_TYPELIST_2(RasterBitmap, Paragraph)> -// { -// public: -// void Visit(RasterBitmap&); // visit a RasterBitmap -// void Visit(Paragraph &); // visit a Paragraph -// }; -//////////////////////////////////////////////////////////////////////////////// - -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; -}; - - -//////////////////////////////////////////////////////////////////////////////// -// class template BaseVisitorImpl -// Implements non-strict visitation (you can implement only part of the Visit -// functions) -//////////////////////////////////////////////////////////////////////////////// - -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(); } -}; - -//////////////////////////////////////////////////////////////////////////////// -// class template BaseVisitable -//////////////////////////////////////////////////////////////////////////////// - -template <typename R, typename Visited> -struct DefaultCatchAll -{ - static R OnUnknownVisitor(Visited&, BaseVisitor&) - { return R(); } -}; - -//////////////////////////////////////////////////////////////////////////////// -// class template 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> -{ -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)) - { - return p->Visit(visited); - } - return CatchAll<R, T>::OnUnknownVisitor(visited, guest); - } -}; - -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) - { - // 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); - } -}; - - -//////////////////////////////////////////////////////////////////////////////// -/// \def LOKI_DEFINE_VISITABLE() -/// \ingroup VisitorGroup -/// Put it in every class that you want to make visitable -/// (in addition to deriving it from BaseVisitable<R>) -//////////////////////////////////////////////////////////////////////////////// - -#define LOKI_DEFINE_VISITABLE() \ - virtual ReturnType Accept(::Loki::BaseVisitor& guest) \ - { return AcceptImpl(*this, guest); } - -//////////////////////////////////////////////////////////////////////////////// -/// \def LOKI_DEFINE_CONST_VISITABLE() -/// \ingroup VisitorGroup -/// Put it in every class that you want to make visitable by const member -/// functions (in addition to deriving it from BaseVisitable<R>) -//////////////////////////////////////////////////////////////////////////////// - -#define LOKI_DEFINE_CONST_VISITABLE() \ - virtual ReturnType Accept(::Loki::BaseVisitor& guest) const \ - { return AcceptImpl(*this, guest); } - -//////////////////////////////////////////////////////////////////////////////// -/// \class CyclicVisitor -/// -/// \ingroup VisitorGroup -/// 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> -{ -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); - } -}; - -//////////////////////////////////////////////////////////////////////////////// -/// \def LOKI_DEFINE_CYCLIC_VISITABLE(SomeVisitor) -/// \ingroup VisitorGroup -/// Put it in every class that you want to make visitable by a cyclic visitor -//////////////////////////////////////////////////////////////////////////////// - -#define LOKI_DEFINE_CYCLIC_VISITABLE(SomeVisitor) \ - virtual SomeVisitor::ReturnType Accept(SomeVisitor& guest) \ - { return guest.GenericVisit(*this); } - -} // namespace Loki - - - -#endif // end file guardian - diff --git a/shared/loki/readme.txt b/shared/loki/readme.txt deleted file mode 100644 index a35cf387..00000000 --- a/shared/loki/readme.txt +++ /dev/null @@ -1,12 +0,0 @@ -// $Id: readme.txt 753 2006-10-17 19:54:22Z syntheticpp $ - -The Golden Code -KEEPEN DER DAMDDEN FUGGERMUTTENS OTTEN DIS CODDEN FIL - -A compliant C++ compiler will compile all of this code as is. -See the respective vendor directories for code that actually compiles & runs. - -Note: Right now, this code contains CodeWarrior & gcc modifications, -which may be removed at a future point in time -(by moving them to a vendor specific implementation). -MKH
\ No newline at end of file diff --git a/shared/loki/static_check.h b/shared/loki/static_check.h deleted file mode 100644 index b4c455c9..00000000 --- a/shared/loki/static_check.h +++ /dev/null @@ -1,45 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2001 by Andrei Alexandrescu -// This code accompanies the book: -// 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 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" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// -#ifndef LOKI_STATIC_CHECK_INC_ -#define LOKI_STATIC_CHECK_INC_ - -// $Id: static_check.h 752 2006-10-17 19:52:18Z syntheticpp $ - - -namespace Loki -{ -//////////////////////////////////////////////////////////////////////////////// -// Helper structure for the STATIC_CHECK macro -//////////////////////////////////////////////////////////////////////////////// - -template<int> struct CompileTimeError; -template<> struct CompileTimeError<true> {}; -} - -//////////////////////////////////////////////////////////////////////////////// -// macro STATIC_CHECK -// Invocation: STATIC_CHECK(expr, id) -// where: -// expr is a compile-time integral or pointer expression -// id is a C++ identifier that does not need to be defined -// If expr is zero, id will appear in a compile-time error message. -//////////////////////////////////////////////////////////////////////////////// - -#define LOKI_STATIC_CHECK(expr, msg) \ - { Loki::CompileTimeError<((expr) != 0)> ERROR_##msg; (void)ERROR_##msg; } - - -#endif // end file guardian - diff --git a/shared/serialize.cpp b/shared/serialize.cpp deleted file mode 100644 index 06d409df..00000000 --- a/shared/serialize.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// ************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * -// ************************************************************************** - -#include "serialize.h" -#include "i18n.h" - -using namespace zen; - - -void ReadInputStream::throwReadError() const //throw FileError -{ - throw zen::FileError(_("Error reading from synchronization database:") + " \n" + "\"" + errorObjName_.c_str() + "\""); -} - - -ReadInputStream::CharArray ReadInputStream::readArrayC() const -{ - const boost::uint32_t byteCount = readNumberC<boost::uint32_t>(); - CharArray buffer(new std::vector<char>(byteCount)); - if (byteCount > 0) - { - stream_.Read(&(*buffer)[0], byteCount); - check(); - if (stream_.LastRead() != byteCount) //some additional check - throwReadError(); - } - return buffer; -} - - -//-------------------------------------------------------------------------------------------------------- -void WriteOutputStream::throwWriteError() const //throw FileError -{ - throw zen::FileError(_("Error writing to synchronization database:") + " \n" + "\"" + errorObjName_.c_str() + "\""); -} - - -void WriteOutputStream::writeArrayC(const std::vector<char>& buffer) const -{ - writeNumberC<boost::uint32_t>(static_cast<boost::uint32_t>(buffer.size())); - if (buffer.size() > 0) - { - stream_.Write(&buffer[0], buffer.size()); - check(); - if (stream_.LastWrite() != buffer.size()) //some additional check - throwWriteError(); - } -} diff --git a/shared/standard_paths.h b/shared/standard_paths.h deleted file mode 100644 index 708a377d..00000000 --- a/shared/standard_paths.h +++ /dev/null @@ -1,26 +0,0 @@ -// ************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * -// ************************************************************************** - -#ifndef STANDARDPATHS_H_INCLUDED -#define STANDARDPATHS_H_INCLUDED - -#include <wx/string.h> - - -namespace zen -{ -//------------------------------------------------------------------------------ -//global program directories -//------------------------------------------------------------------------------ -wxString getResourceDir(); //resource directory WITH path separator at end -wxString getConfigDir(); //config directory WITH path separator at end -//------------------------------------------------------------------------------ - -wxString getLauncher(); //full path to application launcher C:\...\FreeFileSync.exe -bool isPortableVersion(); -} - -#endif // STANDARDPATHS_H_INCLUDED diff --git a/shared/toggle_button.cpp b/shared/toggle_button.cpp deleted file mode 100644 index 24f74bc7..00000000 --- a/shared/toggle_button.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// ************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * -// ************************************************************************** - -#include "toggle_button.h" - -void ToggleButton::init(const wxBitmap& activeBmp, - const wxString& activeTooltip, - const wxBitmap& inactiveBmp, - const wxString& inactiveTooltip) -{ - m_activeBmp = activeBmp; - m_activeTooltip = activeTooltip; - m_inactiveBmp = inactiveBmp; - m_inactiveTooltip = inactiveTooltip; - - //load resources - setActive(active); -} - - -bool ToggleButton::isActive() const -{ - return active; -} - - -void ToggleButton::toggle() -{ - setActive(!active); -} - - -void ToggleButton::setActive(bool value) -{ - active = value; - - if (active) - { - SetBitmapLabel(m_activeBmp); - SetToolTip(m_activeTooltip); - } - else - { - SetBitmapLabel(m_inactiveBmp); - SetToolTip(m_inactiveTooltip); - } -} diff --git a/shared/util.cpp b/shared/util.cpp deleted file mode 100644 index 292d87c1..00000000 --- a/shared/util.cpp +++ /dev/null @@ -1,189 +0,0 @@ -// ************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * -// ************************************************************************** - -#include "util.h" -#include "zstring.h" -#include "i18n.h" -#include "last_error.h" -#include "global_func.h" - -#ifdef FFS_WIN -#include <wx/msw/wrapwin.h> //includes "windows.h" -#endif - - -wxString zen::extractJobName(const wxString& configFilename) -{ - const wxString shortName = configFilename.AfterLast(FILE_NAME_SEPARATOR); //returns the whole string if seperator not found - const wxString jobName = shortName.BeforeLast(wxChar('.')); //returns empty string if seperator not found - return jobName.IsEmpty() ? shortName : jobName; -} - - -wxString zen::formatFilesizeToShortString(UInt64 size) -{ - if (to<Int64>(size) < 0) return _("Error"); - - if (size <= 999U) - { - wxString output = _P("1 Byte", "%x Bytes", to<int>(size)); - output.Replace(wxT("%x"), toStringSep(size)); //no decimal places in case of bytes - return output; - } - else - { - double filesize = to<double>(size); - - filesize /= 1024; - wxString output = _("%x KB"); - if (filesize > 999) - { - filesize /= 1024; - output = _("%x MB"); - if (filesize > 999) - { - filesize /= 1024; - output = _("%x GB"); - if (filesize > 999) - { - filesize /= 1024; - output = _("%x TB"); - if (filesize > 999) - { - filesize /= 1024; - output = _("%x PB"); - } - } - } - } - //print just three significant digits: 0,01 | 0,11 | 1,11 | 11,1 | 111 - const size_t leadDigitCount = common::getDigitCount(static_cast<size_t>(filesize)); //number of digits before decimal point - if (leadDigitCount == 0 || leadDigitCount > 3) - return _("Error"); - - output.Replace(wxT("%x"), wxString::Format(wxT("%.*f"), static_cast<int>(3 - leadDigitCount), filesize)); - return output; - } -} - - -wxString zen::formatPercentage(double fraction) -{ - wxString output = _("%x%"); - output.Replace(wxT("%x"), wxString::Format(wxT("%3.2f"), fraction * 100.0), false); - return output; -} - - -wxString ffs_Impl::includeNumberSeparator(const wxString& number) -{ - wxString output(number); - for (size_t i = output.size(); i > 3; i -= 3) - output.insert(i - 3, zen::getThousandsSeparator()); - - return output; -} - - -void zen::scrollToBottom(wxScrolledWindow* scrWindow) -{ - int height = 0; - scrWindow->GetClientSize(NULL, &height); - - int pixelPerLine = 0; - scrWindow->GetScrollPixelsPerUnit(NULL, &pixelPerLine); - - if (height > 0 && pixelPerLine > 0) - { - const int scrollLinesTotal = scrWindow->GetScrollLines(wxVERTICAL); - const int scrollLinesOnScreen = height / pixelPerLine; - const int scrollPosBottom = scrollLinesTotal - scrollLinesOnScreen; - - if (0 <= scrollPosBottom) - scrWindow->Scroll(0, scrollPosBottom); - } -} - - -namespace -{ -#ifdef FFS_WIN -bool isVistaOrLater() -{ - OSVERSIONINFO osvi = {}; - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - - //symbolic links are supported starting with Vista - if (::GetVersionEx(&osvi)) - return osvi.dwMajorVersion > 5; //XP has majorVersion == 5, minorVersion == 1; Vista majorVersion == 6, dwMinorVersion == 0 - //overview: http://msdn.microsoft.com/en-us/library/ms724834(VS.85).aspx - return false; -} -#endif -} - - -wxString zen::utcTimeToLocalString(zen::Int64 utcTime) -{ -#ifdef FFS_WIN - FILETIME lastWriteTimeUtc = tofiletime(utcTime); //convert ansi C time to FILETIME - - SYSTEMTIME systemTimeLocal = {}; - - static const bool useNewLocalTimeCalculation = isVistaOrLater(); - if (useNewLocalTimeCalculation) //use DST setting from source date (like in Windows 7, see http://msdn.microsoft.com/en-us/library/ms724277(VS.85).aspx) - { - SYSTEMTIME systemTimeUtc = {}; - if (!::FileTimeToSystemTime( - &lastWriteTimeUtc, //__in const FILETIME *lpFileTime, - &systemTimeUtc)) //__out LPSYSTEMTIME lpSystemTime - return _("Error"); - - if (!::SystemTimeToTzSpecificLocalTime( - NULL, //__in_opt LPTIME_ZONE_INFORMATION lpTimeZone, - &systemTimeUtc, //__in LPSYSTEMTIME lpUniversalTime, - &systemTimeLocal)) //__out LPSYSTEMTIME lpLocalTime - return _("Error"); - } - else //use DST setting (like in Windows 2000 and XP) - { - FILETIME fileTimeLocal = {}; - if (!::FileTimeToLocalFileTime( //convert to local time - &lastWriteTimeUtc, //pointer to UTC file time to convert - &fileTimeLocal)) //pointer to converted file time - return _("Error"); - - if (!::FileTimeToSystemTime(&fileTimeLocal, //pointer to file time to convert - &systemTimeLocal)) //pointer to structure to receive system time - return _("Error"); - } - - const wxDateTime localTime(systemTimeLocal.wDay, - wxDateTime::Month(systemTimeLocal.wMonth - 1), - systemTimeLocal.wYear, - systemTimeLocal.wHour, - systemTimeLocal.wMinute, - systemTimeLocal.wSecond); - -#elif defined FFS_LINUX - const time_t fileTime = to<time_t>(utcTime); - const tm* timeinfo = ::localtime(&fileTime); //convert to local time - - /* - char buffer[50]; - ::strftime(buffer, 50, "%Y-%m-%d %H:%M:%S", timeinfo); - return zToWx(buffer); - */ - const wxDateTime localTime(timeinfo->tm_mday, - wxDateTime::Month(timeinfo->tm_mon), - 1900 + timeinfo->tm_year, - timeinfo->tm_hour, - timeinfo->tm_min, - timeinfo->tm_sec); -#endif - - return localTime.FormatDate() + wxT(" ") + localTime.FormatTime(); -} diff --git a/shared/util.h b/shared/util.h deleted file mode 100644 index e45262ab..00000000 --- a/shared/util.h +++ /dev/null @@ -1,74 +0,0 @@ -// ************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * -// ************************************************************************** - -#ifndef UTIL_H_INCLUDED -#define UTIL_H_INCLUDED - -#include <wx/string.h> -#include <wx/scrolwin.h> -#include "string_tools.h" -#include "int64.h" - -namespace zen -{ -wxString extractJobName(const wxString& configFilename); - -wxString formatFilesizeToShortString(UInt64 filesize); -wxString formatPercentage(double fraction); //between [0, 1] - -template <class NumberType> -wxString toStringSep(NumberType number); //convert number to wxString including thousands separator - -void scrollToBottom(wxScrolledWindow* scrWindow); - -wxString utcTimeToLocalString(Int64 utcTime); //throw std::runtime_error -} - - - - - - - - - - - - - - - - - - - - - - - - - - -//--------------- inline impelementation ------------------------------------------- - -//helper function! not to be used directly -namespace ffs_Impl -{ -wxString includeNumberSeparator(const wxString& number); -} - - -namespace zen -{ -template <class NumberType> inline -wxString toStringSep(NumberType number) -{ - return ffs_Impl::includeNumberSeparator(zen::toString<wxString>(number)); -} -} - - -#endif // UTIL_H_INCLUDED diff --git a/shared/xml_base.h b/shared/xml_base.h deleted file mode 100644 index 37d79863..00000000 --- a/shared/xml_base.h +++ /dev/null @@ -1,21 +0,0 @@ -// ************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * -// ************************************************************************** - -#ifndef XMLBASE_H_INCLUDED -#define XMLBASE_H_INCLUDED - -#include <xml_error.h> -#include <zenXml/zenxml.h> - -namespace xmlAccess -{ -void saveXmlDocument(const zen::XmlDoc& doc, const wxString& filename); //throw (FfsXmlError) -void loadXmlDocument(const wxString& filename, zen::XmlDoc& doc); //throw FfsXmlError() - -const wxString getErrorMessageFormatted(const zen::XmlIn& in); -} - -#endif // XMLBASE_H_INCLUDED diff --git a/shared/xml_error.h b/shared/xml_error.h deleted file mode 100644 index 6e17670a..00000000 --- a/shared/xml_error.h +++ /dev/null @@ -1,35 +0,0 @@ -// ************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * -// ************************************************************************** - -#ifndef XMLERROR_H_INCLUDED -#define XMLERROR_H_INCLUDED - -#include <wx/string.h> - - -namespace xmlAccess -{ - -class FfsXmlError //Exception class -{ -public: - enum Severity - { - WARNING = 77, - FATAL - }; - - FfsXmlError(const wxString& message, Severity sev = FATAL) : errorMessage(message), m_severity(sev) {} - - const wxString& msg() const { return errorMessage; } - Severity getSeverity() const { return m_severity; } -private: - const wxString errorMessage; - const Severity m_severity; -}; -} - -#endif // XMLERROR_H_INCLUDED diff --git a/structures.cpp b/structures.cpp index 98255700..1612445c 100644 --- a/structures.cpp +++ b/structures.cpp @@ -5,10 +5,10 @@ // ************************************************************************** #include "structures.h" -#include "shared/i18n.h" #include <iterator> #include <stdexcept> #include <ctime> +#include <zen/i18n.h> using namespace zen; @@ -387,9 +387,9 @@ FilterConfig mergeFilterConfig(const FilterConfig& global, const FilterConfig& l if (out.includeFilter == FilterConfig().includeFilter) out.includeFilter = global.includeFilter; - out.excludeFilter.Trim(true, false); + trim(out.excludeFilter, true, false); out.excludeFilter = global.excludeFilter + Zstr("\n") + out.excludeFilter; - out.excludeFilter.Trim(true, false); + trim(out.excludeFilter, true, false); //soft filter Int64 loctimeFrom; diff --git a/structures.h b/structures.h index 6b13cbf4..9b55f20a 100644 --- a/structures.h +++ b/structures.h @@ -9,10 +9,10 @@ #include <wx/string.h> #include <vector> -#include "shared/zstring.h" -#include "shared/assert_static.h" +#include <zen/zstring.h> +#include <zen/assert_static.h> #include <memory> -#include "shared/int64.h" +#include <zen/int64.h> diff --git a/synchronization.cpp b/synchronization.cpp index bf96c2cb..647da757 100644 --- a/synchronization.cpp +++ b/synchronization.cpp @@ -12,26 +12,24 @@ #include <wx/log.h> #include <wx/file.h> #include <boost/bind.hpp> -#include "shared/string_conv.h" -#include "shared/util.h" -#include "shared/loki/ScopeGuard.h" -#include "library/status_handler.h" -#include "shared/file_handling.h" -#include "shared/resolve_path.h" -#include "shared/recycler.h" -#include "shared/i18n.h" -#include "shared/global_func.h" -#include "shared/disable_standby.h" -#include "library/db_file.h" -#include "library/dir_exist_async.h" -#include "library/cmp_filetime.h" -#include "shared/file_io.h" +#include <wx+/string_conv.h> +#include <wx+/format_unit.h> +#include <zen/scope_guard.h> +#include "lib/status_handler.h" +#include <zen/file_handling.h> +#include "lib/resolve_path.h" +#include "lib/recycler.h" +#include <zen/disable_standby.h> +#include "lib/db_file.h" +#include "lib/dir_exist_async.h" +#include "lib/cmp_filetime.h" +#include <zen/file_io.h> #ifdef FFS_WIN -#include "shared/long_path_prefix.h" +#include <zen/long_path_prefix.h> #include <boost/scoped_ptr.hpp> -#include "shared/perf.h" -#include "shared/shadow.h" +#include <zen/perf.h> +#include "lib/shadow.h" #endif using namespace zen; @@ -325,18 +323,6 @@ bool tryReportingError(ProcessCallback& handler, Function cmd) //return "true" o } -namespace -{ -template <class S, class T, class U> inline -S replaceCpy(const S& str, const T& old, const U& replacement, bool replaceAll = true) -{ - S tmp = str; - zen::replace(tmp, old, replacement, replaceAll); - return tmp; -} -} - - /* add some postfix to alternate deletion directory: deletionDirectory\<prefix>2010-06-30 12-59-12\ */ @@ -346,7 +332,7 @@ Zstring getSessionDeletionDir(const Zstring& deletionDirectory, const Zstring& p if (formattedDir.empty()) return Zstring(); //no valid directory for deletion specified (checked later) - if (!formattedDir.EndsWith(FILE_NAME_SEPARATOR)) + if (!endsWith(formattedDir, FILE_NAME_SEPARATOR)) formattedDir += FILE_NAME_SEPARATOR; const wxString timeNow = replaceCpy(wxDateTime::Now().FormatISOTime(), L":", L""); @@ -360,7 +346,7 @@ Zstring getSessionDeletionDir(const Zstring& deletionDirectory, const Zstring& p //ensure uniqueness for (int i = 1; zen::somethingExists(output); ++i) - output = formattedDir + Zchar('_') + Zstring::fromNumber(i); + output = formattedDir + Zchar('_') + toString<Zstring>(i); output += FILE_NAME_SEPARATOR; return output; @@ -481,7 +467,7 @@ void DeletionHandling::tryCleanup() //throw FileError if (!cleanedUp) { if (deletionType == MOVE_TO_RECYCLE_BIN) //clean-up temporary directory (recycle bin) - zen::moveToRecycleBin(sessionDelDir.BeforeLast(FILE_NAME_SEPARATOR)); //throw FileError + zen::moveToRecycleBin(beforeLast(sessionDelDir, FILE_NAME_SEPARATOR)); //throw FileError cleanedUp = true; } @@ -539,7 +525,7 @@ void DeletionHandling::removeFile(const Zstring& relativeName) const if (fileExists(fullName)) { const Zstring targetFile = sessionDelDir + relativeName; //altDeletionDir ends with path separator - const Zstring targetDir = targetFile.BeforeLast(FILE_NAME_SEPARATOR); + const Zstring targetDir = beforeLast(targetFile, FILE_NAME_SEPARATOR); try //rename file: no copying!!! { @@ -561,7 +547,7 @@ void DeletionHandling::removeFile(const Zstring& relativeName) const if (fileExists(fullName)) { const Zstring targetFile = sessionDelDir + relativeName; //altDeletionDir ends with path separator - const Zstring targetDir = targetFile.BeforeLast(FILE_NAME_SEPARATOR); + const Zstring targetDir = beforeLast(targetFile, FILE_NAME_SEPARATOR); if (!dirExists(targetDir)) createDirectory(targetDir); //throw FileError @@ -591,7 +577,7 @@ void DeletionHandling::removeFolder(const Zstring& relativeName) const if (dirExists(fullName)) { const Zstring targetDir = sessionDelDir + relativeName; - const Zstring targetSuperDir = targetDir.BeforeLast(FILE_NAME_SEPARATOR); + const Zstring targetSuperDir = beforeLast(targetDir, FILE_NAME_SEPARATOR); try //rename directory: no copying!!! { @@ -613,7 +599,7 @@ void DeletionHandling::removeFolder(const Zstring& relativeName) const if (dirExists(fullName)) { const Zstring targetDir = sessionDelDir + relativeName; - const Zstring targetSuperDir = targetDir.BeforeLast(FILE_NAME_SEPARATOR); + const Zstring targetSuperDir = beforeLast(targetDir, FILE_NAME_SEPARATOR); if (!dirExists(targetSuperDir)) createDirectory(targetSuperDir); //throw FileError @@ -886,8 +872,8 @@ void SynchronizeFolderPair::execute(HierarchyObject& hierObj) std::for_each(hierObj.refSubDirs().begin(), hierObj.refSubDirs().end(), [&](DirMapping& dirObj) { - const bool letsDoThis = (pass == FIRST_PASS) == diskSpaceIsReduced(dirObj); //to be deleted files on first pass, rest on second! - if (letsDoThis) //running folder creation on first pass only, works, but looks strange for initial mirror sync when all folders are created at once + const bool letsDoThis = (pass == FIRST_PASS) == diskSpaceIsReduced(dirObj); //to be deleted dirs on first pass, rest on second! + if (letsDoThis) //if we created all folders on first pass it would look strange for initial mirror sync when all folders are created at once tryReportingError(procCallback_, [&]() { synchronizeFolder(dirObj); }); //recursion! @@ -1025,7 +1011,7 @@ void SynchronizeFolderPair::synchronizeFile(FileMapping& fileObj) const if (fileObj.getShortName<LEFT_SIDE>() != fileObj.getShortName<RIGHT_SIDE>()) //adapt difference in case (windows only) renameFile(fileObj.getFullName<LEFT_SIDE>(), - fileObj.getFullName<LEFT_SIDE>().BeforeLast(FILE_NAME_SEPARATOR) + FILE_NAME_SEPARATOR + fileObj.getShortName<RIGHT_SIDE>()); //throw FileError; + beforeLast(fileObj.getFullName<LEFT_SIDE>(), FILE_NAME_SEPARATOR) + FILE_NAME_SEPARATOR + fileObj.getShortName<RIGHT_SIDE>()); //throw FileError; if (!sameFileTime(fileObj.getLastWriteTime<LEFT_SIDE>(), fileObj.getLastWriteTime<RIGHT_SIDE>(), 2)) //respect 2 second FAT/FAT32 precision setFileTime(fileObj.getFullName<LEFT_SIDE>(), fileObj.getLastWriteTime<RIGHT_SIDE>(), SYMLINK_FOLLOW); //throw FileError @@ -1040,7 +1026,7 @@ void SynchronizeFolderPair::synchronizeFile(FileMapping& fileObj) const if (fileObj.getShortName<LEFT_SIDE>() != fileObj.getShortName<RIGHT_SIDE>()) //adapt difference in case (windows only) renameFile(fileObj.getFullName<RIGHT_SIDE>(), - fileObj.getFullName<RIGHT_SIDE>().BeforeLast(FILE_NAME_SEPARATOR) + FILE_NAME_SEPARATOR + fileObj.getShortName<LEFT_SIDE>()); //throw FileError; + beforeLast(fileObj.getFullName<RIGHT_SIDE>(), FILE_NAME_SEPARATOR) + 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 setFileTime(fileObj.getFullName<RIGHT_SIDE>(), fileObj.getLastWriteTime<LEFT_SIDE>(), SYMLINK_FOLLOW); //throw FileError @@ -1170,7 +1156,7 @@ void SynchronizeFolderPair::synchronizeLink(SymLinkMapping& linkObj) const if (linkObj.getShortName<LEFT_SIDE>() != linkObj.getShortName<RIGHT_SIDE>()) //adapt difference in case (windows only) renameFile(linkObj.getFullName<LEFT_SIDE>(), - linkObj.getFullName<LEFT_SIDE>().BeforeLast(FILE_NAME_SEPARATOR) + FILE_NAME_SEPARATOR + linkObj.getShortName<RIGHT_SIDE>()); //throw FileError; + beforeLast(linkObj.getFullName<LEFT_SIDE>(), FILE_NAME_SEPARATOR) + 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 setFileTime(linkObj.getFullName<LEFT_SIDE>(), linkObj.getLastWriteTime<RIGHT_SIDE>(), SYMLINK_DIRECT); //throw FileError @@ -1184,7 +1170,7 @@ void SynchronizeFolderPair::synchronizeLink(SymLinkMapping& linkObj) const if (linkObj.getShortName<LEFT_SIDE>() != linkObj.getShortName<RIGHT_SIDE>()) //adapt difference in case (windows only) renameFile(linkObj.getFullName<RIGHT_SIDE>(), - linkObj.getFullName<RIGHT_SIDE>().BeforeLast(FILE_NAME_SEPARATOR) + FILE_NAME_SEPARATOR + linkObj.getShortName<LEFT_SIDE>()); //throw FileError; + beforeLast(linkObj.getFullName<RIGHT_SIDE>(), FILE_NAME_SEPARATOR) + 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 setFileTime(linkObj.getFullName<RIGHT_SIDE>(), linkObj.getLastWriteTime<LEFT_SIDE>(), SYMLINK_DIRECT); //throw FileError @@ -1269,7 +1255,7 @@ void SynchronizeFolderPair::synchronizeFolder(DirMapping& dirObj) const if (dirObj.getShortName<LEFT_SIDE>() != dirObj.getShortName<RIGHT_SIDE>()) //adapt difference in case (windows only) renameFile(dirObj.getFullName<LEFT_SIDE>(), - dirObj.getFullName<LEFT_SIDE>().BeforeLast(FILE_NAME_SEPARATOR) + FILE_NAME_SEPARATOR + dirObj.getShortName<RIGHT_SIDE>()); //throw FileError; + beforeLast(dirObj.getFullName<LEFT_SIDE>(), FILE_NAME_SEPARATOR) + 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 dirObj.copyTo<LEFT_SIDE>(); //-> both sides *should* be completely equal now... @@ -1281,7 +1267,7 @@ void SynchronizeFolderPair::synchronizeFolder(DirMapping& dirObj) const if (dirObj.getShortName<LEFT_SIDE>() != dirObj.getShortName<RIGHT_SIDE>()) //adapt difference in case (windows only) renameFile(dirObj.getFullName<RIGHT_SIDE>(), - dirObj.getFullName<RIGHT_SIDE>().BeforeLast(FILE_NAME_SEPARATOR) + FILE_NAME_SEPARATOR + dirObj.getShortName<LEFT_SIDE>()); //throw FileError; + beforeLast(dirObj.getFullName<RIGHT_SIDE>(), FILE_NAME_SEPARATOR) + 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 dirObj.copyTo<RIGHT_SIDE>(); //-> both sides *should* be completely equal now... @@ -1648,8 +1634,8 @@ void SyncProcess::startSynchronizationProcess(const std::vector<FolderPairSyncCf for (auto i = diskSpaceMissing.begin(); i != diskSpaceMissing.end(); ++i) warningMessage += wxString(wxT("\n\n")) + "\"" + i->first + "\"\n" + - _("Free disk space required:") + wxT(" ") + formatFilesizeToShortString(to<UInt64>(i->second.first)) + wxT("\n") + - _("Free disk space available:") + wxT(" ") + formatFilesizeToShortString(to<UInt64>(i->second.second)); + _("Free disk space required:") + wxT(" ") + filesizeToShortString(to<UInt64>(i->second.first)) + wxT("\n") + + _("Free disk space available:") + wxT(" ") + filesizeToShortString(to<UInt64>(i->second.second)); procCallback.reportWarning(warningMessage, m_warnings.warningNotEnoughDiskSpace); } @@ -1695,7 +1681,7 @@ void SyncProcess::startSynchronizationProcess(const std::vector<FolderPairSyncCf try { //prevent shutdown while synchronization is in progress - util::DisableStandby dummy; + DisableStandby dummy; (void)dummy; //loop through all directory pairs @@ -1727,14 +1713,14 @@ void SyncProcess::startSynchronizationProcess(const std::vector<FolderPairSyncCf //------------------------------------------------------------------------------------------ //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->getBaseDirPf<LEFT_SIDE>().BeforeLast(FILE_NAME_SEPARATOR); - if (!dirnameLeft.empty() && !dirExistsUpdating(dirnameLeft, procCallback)) + const Zstring dirnameLeft = beforeLast(j->getBaseDirPf<LEFT_SIDE>(), FILE_NAME_SEPARATOR); + if (!dirnameLeft.empty() && !dirExistsUpdating(dirnameLeft, false, procCallback)) { if (!tryReportingError(procCallback, [&]() { createDirectory(dirnameLeft); })) //may throw in error-callback! continue; //skip this folder pair } - const Zstring dirnameRight = j->getBaseDirPf<RIGHT_SIDE>().BeforeLast(FILE_NAME_SEPARATOR); - if (!dirnameRight.empty() && !dirExistsUpdating(dirnameRight, procCallback)) + const Zstring dirnameRight = beforeLast(j->getBaseDirPf<RIGHT_SIDE>(), FILE_NAME_SEPARATOR); + if (!dirnameRight.empty() && !dirExistsUpdating(dirnameRight, false, procCallback)) { if (!tryReportingError(procCallback, [&]() { createDirectory(dirnameRight); })) //may throw in error-callback! continue; //skip this folder pair @@ -1748,7 +1734,7 @@ void SyncProcess::startSynchronizationProcess(const std::vector<FolderPairSyncCf guardUpdateDb.reset(new EnforceUpdateDatabase(*j)); //guarantee removal of invalid entries (where element on both sides is empty) - LOKI_ON_BLOCK_EXIT2(BaseDirMapping::removeEmpty(*j);); + ZEN_ON_BLOCK_EXIT(BaseDirMapping::removeEmpty(*j);); SynchronizeFolderPair syncFP(*this, #ifdef FFS_WIN @@ -1826,7 +1812,7 @@ void SynchronizeFolderPair::copyFileUpdatingTo(const FileMapping& fileObj, const //start of (possibly) long-running copy process: ensure status updates are performed regularly UInt64 bytesReported; //in error situation: undo communication of processed amount of data - Loki::ScopeGuard guardStatistics = Loki::MakeGuard([&]() { procCallback_.updateProcessedData(0, -1 * to<Int64>(bytesReported)); }); + zen::ScopeGuard guardStatistics = zen::makeGuard([&]() { procCallback_.updateProcessedData(0, -1 * to<Int64>(bytesReported)); }); WhileCopying<DelTargetCommand> callback(bytesReported, procCallback_, cmd); FileAttrib fileAttr; @@ -1844,7 +1830,7 @@ void SynchronizeFolderPair::copyFileUpdatingTo(const FileMapping& fileObj, const procCallback_.updateProcessedData(0, to<Int64>(totalBytesToCpy) - to<Int64>(bytesReported)); bytesReported = totalBytesToCpy; - guardStatistics.Dismiss(); + guardStatistics.dismiss(); }; #ifdef FFS_WIN @@ -1879,13 +1865,13 @@ void SynchronizeFolderPair::copyFileUpdatingTo(const FileMapping& fileObj, const //#################### Verification ############################# if (verifyCopiedFiles) { - Loki::ScopeGuard guardTarget = Loki::MakeGuard(&removeFile, target); //delete target if verification fails - Loki::ScopeGuard guardStatistics = Loki::MakeGuard([&]() { procCallback_.updateProcessedData(0, -1 * to<Int64>(totalBytesToCpy)); }); + zen::ScopeGuard guardTarget = zen::makeGuard([&]() { removeFile(target); }); //delete target if verification fails + zen::ScopeGuard guardStatistics = zen::makeGuard([&]() { procCallback_.updateProcessedData(0, -1 * to<Int64>(totalBytesToCpy)); }); verifyFileCopy(source, target); //throw FileError - guardTarget.Dismiss(); - guardStatistics.Dismiss(); + guardTarget.dismiss(); + guardStatistics.dismiss(); } } diff --git a/synchronization.h b/synchronization.h index 7cf93b45..025b7ab0 100644 --- a/synchronization.h +++ b/synchronization.h @@ -8,8 +8,8 @@ #define SYNCHRONIZATION_H_INCLUDED #include "file_hierarchy.h" -#include "library/process_xml.h" -#include "library/status_handler.h" +#include "lib/process_xml.h" +#include "lib/status_handler.h" namespace zen diff --git a/shared/Taskbar_Seven/Taskbar_Seven.vcxproj b/ui/Taskbar_Seven/Taskbar_Seven.vcxproj index 8437bc09..37786768 100644 --- a/shared/Taskbar_Seven/Taskbar_Seven.vcxproj +++ b/ui/Taskbar_Seven/Taskbar_Seven.vcxproj @@ -28,6 +28,7 @@ <ConfigurationType>DynamicLibrary</ConfigurationType> <CharacterSet>Unicode</CharacterSet> <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>Windows7.1SDK</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> @@ -96,6 +97,7 @@ <SuppressStartupBanner>true</SuppressStartupBanner> <DebugInformationFormat>EditAndContinue</DebugInformationFormat> <DisableSpecificWarnings>4100</DisableSpecificWarnings> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> @@ -128,6 +130,7 @@ <SuppressStartupBanner>true</SuppressStartupBanner> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4100</DisableSpecificWarnings> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> @@ -158,6 +161,7 @@ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4100</DisableSpecificWarnings> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> @@ -193,6 +197,7 @@ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4100</DisableSpecificWarnings> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> diff --git a/shared/Taskbar_Seven/dll_main.cpp b/ui/Taskbar_Seven/dll_main.cpp index 3805c99d..3805c99d 100644 --- a/shared/Taskbar_Seven/dll_main.cpp +++ b/ui/Taskbar_Seven/dll_main.cpp diff --git a/shared/Taskbar_Seven/taskbar.cpp b/ui/Taskbar_Seven/taskbar.cpp index 2a739e6c..368152f4 100644 --- a/shared/Taskbar_Seven/taskbar.cpp +++ b/ui/Taskbar_Seven/taskbar.cpp @@ -13,12 +13,11 @@ #include <map> #include <string> #include <comdef.h> -#include "../com_error.h" -#include "../com_ptr.h" -#include "../c_dll.h" +#include <zen/com_error.h> +#include <zen/com_ptr.h> + +using namespace zen; -using namespace util; -using namespace c_dll; namespace { @@ -27,20 +26,17 @@ std::wstring lastErrorMessage; ComPtr<ITaskbarList3> getInstance() { - static ComPtr<ITaskbarList3> taskbarlist; - if (!taskbarlist) - { - HRESULT hr = ::CoCreateInstance(CLSID_TaskbarList, - NULL, - CLSCTX_ALL, - IID_PPV_ARGS(taskbarlist.init())); - if (FAILED(hr)) - lastErrorMessage = generateErrorMsg(L"Error calling \"CoCreateInstance\".", hr); - } + ComPtr<ITaskbarList3> taskbarlist; + + HRESULT hr = ::CoCreateInstance(CLSID_TaskbarList, + NULL, + CLSCTX_ALL, + IID_PPV_ARGS(taskbarlist.init())); + if (FAILED(hr)) + lastErrorMessage = generateErrorMsg(L"Error calling \"CoCreateInstance\".", hr); return taskbarlist; } - } //################################################################################################## @@ -106,7 +102,11 @@ bool tbseven::setProgress(void* hwnd, //HWND: window assciated to the taskbar ic } -void tbseven::getLastError(wchar_t* errorMessage, size_t errorBufferLen) +void tbseven::getLastError(wchar_t* buffer, size_t bufferSize) { - writeString(lastErrorMessage, errorMessage, errorBufferLen); + if (bufferSize > 0) + { + size_t endPos = lastErrorMessage.copy(buffer, bufferSize - 1); + buffer[endPos] = 0; + } } diff --git a/shared/Taskbar_Seven/taskbar.h b/ui/Taskbar_Seven/taskbar.h index 507920c7..082f463f 100644 --- a/shared/Taskbar_Seven/taskbar.h +++ b/ui/Taskbar_Seven/taskbar.h @@ -13,7 +13,7 @@ #define DLL_FUNCTION_DECLARATION extern "C" __declspec(dllimport) #endif -#include "../build_info.h" +#include <zen/build_info.h> namespace tbseven @@ -46,27 +46,27 @@ bool setProgress(void* hwnd, //HWND: window assciated to the taskbar icon //if any of the functions above returns 'false', this message returns last error DLL_FUNCTION_DECLARATION -void getLastError(wchar_t* errorMessage, size_t errorBufferLen); +void getLastError(wchar_t* buffer, size_t bufferSize); /*---------- |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); +typedef bool (*SetStatusFct )(void* hwnd, TaskBarStatus status); +typedef bool (*SetProgressFct )(void* hwnd, size_t current, size_t total); +typedef void (*GetLastErrorFct)(wchar_t* buffer, size_t bufferSize); /*-------------- |symbol names| --------------*/ //(use const pointers to ensure internal linkage) -const char setStatusFctName[] = "setStatus"; -const char setProgressFctName[] = "setProgress"; +const char setStatusFctName [] = "setStatus"; +const char setProgressFctName [] = "setProgress"; const char getLastErrorFctName[] = "getLastError"; /*--------------- |library names| ---------------*/ -inline const wchar_t* getDllName() { return util::is64BitBuild ? L"Taskbar7_x64.dll" : L"Taskbar7_Win32.dll"; } +inline const wchar_t* getDllName() { return zen::is64BitBuild ? L"Taskbar7_x64.dll" : L"Taskbar7_Win32.dll"; } } #endif //TASKBAR_SEVEN_DLL_H diff --git a/ui/batch_config.cpp b/ui/batch_config.cpp index 6e784179..0ef87903 100644 --- a/ui/batch_config.cpp +++ b/ui/batch_config.cpp @@ -5,19 +5,19 @@ // ************************************************************************** #include "batch_config.h" -#include "../shared/dir_picker_i18n.h" +#include <wx+/dir_picker.h> #include "folder_pair.h" #include <iterator> #include <wx/wupdlock.h> -#include "../shared/help_provider.h" -#include "../shared/file_handling.h" +#include "../lib/help_provider.h" +#include <zen/file_handling.h> #include "msg_popup.h" #include "gui_generated.h" #include <wx/dnd.h> #include <wx/msgdlg.h> -#include "../shared/custom_button.h" -#include "../shared/wx_choice_enum.h" -#include "../shared/mouse_move_dlg.h" +#include <wx+/button.h> +#include <wx+/choice_enum.h> +#include <wx+/mouse_move_dlg.h> using namespace zen; @@ -66,8 +66,6 @@ private: void updateGui(); //re-evaluate gui after config changes - void showNotebookpage(wxWindow* page, const wxString& pageName, bool show); - //error handling //xmlAccess::OnError getSelectionHandleError() const; -> obsolete, use getEnumVal() void setSelectionHandleError(xmlAccess::OnError value); @@ -80,7 +78,7 @@ private: void setConfig(const xmlAccess::XmlBatchConfig& batchCfg); xmlAccess::XmlBatchConfig getConfig() const; - std::shared_ptr<DirectoryPairBatchFirst> firstFolderPair; //always bound!!! + std::unique_ptr<DirectoryPairBatchFirst> firstFolderPair; //always bound!!! std::vector<DirectoryPairBatch*> additionalFolderPairs; //used when saving batch file @@ -90,7 +88,7 @@ private: std::unique_ptr<wxMenu> contextMenu; - std::unique_ptr<DirectoryName<wxTextCtrl>> logfileDir; + std::unique_ptr<DirectoryName<FolderHistoryBox>> logfileDir; zen::EnumDescrList<xmlAccess::OnError> enumDescrMap; @@ -268,7 +266,7 @@ BatchDialog::BatchDialog(wxWindow* window, setupFileDrop(*this); Connect(FFS_DROP_FILE_EVENT, FFSFileDropEventHandler(BatchDialog::OnFilesDropped), NULL, this); - logfileDir.reset(new DirectoryName<wxTextCtrl>(*m_panelBatchSettings, *m_dirPickerLogfileDir, *m_textCtrlLogfileDir)); + logfileDir.reset(new DirectoryName<FolderHistoryBox>(*m_panelBatchSettings, *m_dirPickerLogfileDir, *m_comboBoxLogfileDir)); //set icons for this dialog m_bpButtonAddPair->SetBitmapLabel(GlobalResources::getImage(wxT("addFolderPair"))); @@ -439,7 +437,7 @@ void BatchDialog::OnHelp(wxCommandEvent& event) #endif } - +/* void BatchDialog::showNotebookpage(wxWindow* page, const wxString& pageName, bool show) { int windowPosition = -1; @@ -467,7 +465,7 @@ void BatchDialog::showNotebookpage(wxWindow* page, const wxString& pageName, boo } } } - +*/ void BatchDialog::OnClose(wxCloseEvent& event) { @@ -857,23 +855,10 @@ void BatchDialog::clearAddFolderPairs() /* #ifdef FFS_WIN -#include <wx/msw/wrapwin.h> //includes "windows.h" +#include <zen/win.h> //includes "windows.h" #include <shlobj.h> #endif // FFS_WIN -template <typename T> -struct CleanUp -{ - CleanUp(T* element) : m_element(element) {} - - ~CleanUp() - { - m_element->Release(); - } - - T* m_element; -}; - bool BatchDialog::createBatchFile(const wxString& filename) { diff --git a/ui/batch_config.h b/ui/batch_config.h index 02f9b5f8..642cea00 100644 --- a/ui/batch_config.h +++ b/ui/batch_config.h @@ -7,8 +7,8 @@ #ifndef BATCHCONFIG_H_INCLUDED #define BATCHCONFIG_H_INCLUDED -#include "../library/process_xml.h" -#include "../shared/folder_history_box.h" +#include "../lib/process_xml.h" +#include "../lib/folder_history_box.h" namespace zen { diff --git a/ui/batch_status_handler.cpp b/ui/batch_status_handler.cpp index 84168014..a8c7b2c5 100644 --- a/ui/batch_status_handler.cpp +++ b/ui/batch_status_handler.cpp @@ -8,14 +8,12 @@ #include "msg_popup.h" #include <wx/ffile.h> #include <wx/msgdlg.h> -#include "../shared/standard_paths.h" -#include "../shared/file_handling.h" -#include "../shared/resolve_path.h" -#include "../shared/string_conv.h" -#include "../shared/global_func.h" -#include "../shared/app_main.h" -#include "../shared/util.h" -#include "../shared/file_traverser.h" +#include "../lib/ffs_paths.h" +#include <zen/file_handling.h> +#include "../lib/resolve_path.h" +#include <wx+/string_conv.h> +#include <wx+/app_main.h> +#include <zen/file_traverser.h> using namespace zen; @@ -30,7 +28,7 @@ public: virtual void onFile(const Zchar* shortName, const Zstring& fullName, const FileInfo& details) { const Zstring fileName(shortName); - if (fileName.StartsWith(prefix_) && fileName.EndsWith(Zstr(".log"))) + if (startsWith(fileName, prefix_) && endsWith(fileName, Zstr(".log"))) logfiles_.push_back(fullName); } @@ -38,7 +36,7 @@ public: virtual ReturnValDir onDir(const Zchar* shortName, const Zstring& fullName) { - return Loki::Int2Type<ReturnValDir::TRAVERSING_DIR_IGNORE>(); //DON'T traverse into subdirs + return Int2Type<ReturnValDir::TRAVERSING_DIR_IGNORE>(); //DON'T traverse into subdirs } virtual HandleError onError(const std::wstring& errorText) { return TRAV_ERROR_IGNORE; } //errors are not really critical in this context @@ -127,8 +125,6 @@ public: private: static wxString findUniqueLogname(const wxString& logfileDirectory, const wxString& jobName) { - using namespace common; - //create logfile directory Zstring logfileDir = logfileDirectory.empty() ? toZ(zen::getConfigDir() + wxT("Logs")) : @@ -138,7 +134,7 @@ private: zen::createDirectory(logfileDir); //create recursively if necessary: may throw (FileError&) //assemble logfile name - if (!logfileDir.EndsWith(FILE_NAME_SEPARATOR)) + if (!endsWith(logfileDir, FILE_NAME_SEPARATOR)) logfileDir += FILE_NAME_SEPARATOR; wxString logfileName = toWx(logfileDir); @@ -232,13 +228,17 @@ BatchStatusHandler::~BatchStatusHandler() //decide whether to stay on status screen or exit immediately... if (switchToGuiRequested) //-> avoid recursive yield() calls, thous switch not before ending batch mode { - switchBatchToGui_.execute(); //open FreeFileSync GUI + try + { + switchBatchToGui_.execute(); //open FreeFileSync GUI + } + catch (...) {} syncStatusFrame.closeWindowDirectly(); //syncStatusFrame is main window => program will quit directly } else if (!exitWhenFinished || syncStatusFrame.getAsWindow()->IsShown()) //warning: wxWindow::Show() is called within processHasFinished()! { //notify about (logical) application main window => program won't quit, but stay on this dialog - zen::AppMainWindow::setMainWindow(syncStatusFrame.getAsWindow()); + zen::setMainWindow(syncStatusFrame.getAsWindow()); //notify to syncStatusFrame that current process has ended if (abortIsRequested()) diff --git a/ui/batch_status_handler.h b/ui/batch_status_handler.h index 43fa5549..548447f6 100644 --- a/ui/batch_status_handler.h +++ b/ui/batch_status_handler.h @@ -7,9 +7,9 @@ #ifndef BATCHSTATUSHANDLER_H_INCLUDED #define BATCHSTATUSHANDLER_H_INCLUDED -#include "../library/status_handler.h" -#include "../library/process_xml.h" -#include "../library/error_log.h" +#include "../lib/status_handler.h" +#include "../lib/process_xml.h" +#include "../lib/error_log.h" #include "progress_indicator.h" #include "switch_to_gui.h" diff --git a/ui/check_version.cpp b/ui/check_version.cpp index 16eb7719..99870352 100644 --- a/ui/check_version.cpp +++ b/ui/check_version.cpp @@ -12,12 +12,13 @@ #include "../version/version.h" #include <wx/utils.h> #include <wx/timer.h> -#include <string_tools.h> +#include <zen/string_tools.h> #include "msg_popup.h" -#include "../shared/standard_paths.h" -#include "loki/ScopeGuard.h" +#include "../lib/ffs_paths.h" +#include <zen/scope_guard.h> #include <wx/tokenzr.h> -#include "../shared/i18n.h" +#include <zen/i18n.h> + bool getOnlineVersion(wxString& version) { diff --git a/ui/folder_pair.h b/ui/folder_pair.h index 6c535664..5d26d724 100644 --- a/ui/folder_pair.h +++ b/ui/folder_pair.h @@ -8,16 +8,15 @@ #define FOLDERPAIR_H_INCLUDED #include "../structures.h" -#include "../shared/dir_name.h" -#include "../library/resources.h" +#include "../lib/dir_name.h" +#include "../lib/resources.h" #include "small_dlgs.h" #include "sync_cfg.h" #include <wx/event.h> #include <wx/menu.h> -#include "../shared/util.h" -#include "../shared/string_conv.h" -#include "../library/norm_filter.h" -#include "../shared/custom_button.h" +#include <wx+/string_conv.h> +#include "../lib/norm_filter.h" +#include <wx+/button.h> namespace zen { diff --git a/ui/grid_view.cpp b/ui/grid_view.cpp index 17fb3ff4..22c158fd 100644 --- a/ui/grid_view.cpp +++ b/ui/grid_view.cpp @@ -8,7 +8,7 @@ #include "sorting.h" #include "../synchronization.h" #include <boost/bind.hpp> -#include "../shared/stl_tools.h" +#include <zen/stl_tools.h> using namespace zen; diff --git a/ui/gui_generated.cpp b/ui/gui_generated.cpp index b0fb1b6d..5ecb0948 100644 --- a/ui/gui_generated.cpp +++ b/ui/gui_generated.cpp @@ -5,11 +5,13 @@ // PLEASE DO "NOT" EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#include "../library/custom_grid.h" -#include "../shared/custom_button.h" -#include "../shared/dir_picker_i18n.h" -#include "../shared/folder_history_box.h" -#include "../shared/toggle_button.h" +#include "../lib/custom_grid.h" +#include "../lib/folder_history_box.h" +#include "../wx+/button.h" +#include "../wx+/dir_picker.h" +#include "../wx+/graph.h" +#include "../wx+/toggle_button.h" +#include "wx_form_build_hide_warnings.h" #include "gui_generated.h" @@ -17,858 +19,847 @@ 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("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-O"), 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 ); - - wxBoxSizer* bSizer155; - bSizer155 = new wxBoxSizer( wxHORIZONTAL ); - - - bSizer155->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, wxEmptyString ) ); - 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, wxEmptyString ) ); - 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") ); - - fgSizer121->Add( m_bpButtonCmpConfig, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 ); - - bSizer155->Add( fgSizer121, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 ); - - bSizerTopButtons->Add( bSizer155, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizerTopButtons->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - wxBoxSizer* bSizer1551; - bSizer1551 = new wxBoxSizer( wxHORIZONTAL ); - - 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") ); - - fgSizer12->Add( m_bpButtonSyncConfig, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 ); - - m_buttonStartSync = new wxButtonWithImage( m_panelTopButtons, wxID_ANY, _("Synchronize..."), wxDefaultPosition, wxSize( 180,42 ), 0 ); - m_buttonStartSync->SetFont( wxFont( 14, 74, 90, 92, false, wxEmptyString ) ); - m_buttonStartSync->SetToolTip( _("Start synchronization") ); - - fgSizer12->Add( m_buttonStartSync, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer1551->Add( fgSizer12, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 ); - - - bSizer1551->Add( 15, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizerTopButtons->Add( bSizer1551, 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_bpButtonAddPair = new wxBitmapButton( m_panelTopLeft, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); - m_bpButtonAddPair->SetToolTip( _("Add folder pair") ); - - sbSizerDirLeft->Add( m_bpButtonAddPair, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 3 ); - - m_bpButtonRemovePair = new wxBitmapButton( m_panelTopLeft, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); - m_bpButtonRemovePair->SetToolTip( _("Remove folder pair") ); - - sbSizerDirLeft->Add( m_bpButtonRemovePair, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_directoryLeft = new FolderHistoryBox( m_panelTopLeft, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - sbSizerDirLeft->Add( m_directoryLeft, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_dirPickerLeft = new FfsDirPickerCtrl( 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") ); - - 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_bpButtonAltCompCfg = new wxBitmapButton( m_panelTopMiddle, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); - bSizer160->Add( m_bpButtonAltCompCfg, 0, 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|wxRIGHT|wxLEFT, 3 ); - - 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_directoryRight = new FolderHistoryBox( m_panelTopRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - sbSizerDirRight->Add( m_directoryRight, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_dirPickerRight = new FfsDirPickerCtrl( 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, 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|wxRIGHT|wxLEFT, 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, 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") ); - - 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") ); - - 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_EXTENDED|wxLB_NEEDED_SB|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|wxTE_RIGHT ); - 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|wxTE_RIGHT ); - 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|wxTE_RIGHT ); - 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|wxTE_RIGHT ); - 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_bpButtonAddPair->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnAddFolderPair ), NULL, this ); - m_bpButtonRemovePair->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRemoveTopFolderPair ), 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_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-O"), 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 ); + + wxBoxSizer* bSizer155; + bSizer155 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer155->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 zen::BitmapButton( m_panelTopButtons, wxID_OK, _("Compare"), wxDefaultPosition, wxSize( 180,42 ), 0 ); + m_buttonCompare->SetDefault(); + m_buttonCompare->SetFont( wxFont( 14, 74, 90, 92, false, wxEmptyString ) ); + 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, wxEmptyString ) ); + 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") ); + + fgSizer121->Add( m_bpButtonCmpConfig, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 ); + + bSizer155->Add( fgSizer121, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 ); + + bSizerTopButtons->Add( bSizer155, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizerTopButtons->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + wxBoxSizer* bSizer1551; + bSizer1551 = new wxBoxSizer( wxHORIZONTAL ); + + 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") ); + + fgSizer12->Add( m_bpButtonSyncConfig, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 ); + + m_buttonStartSync = new zen::BitmapButton( m_panelTopButtons, wxID_ANY, _("Synchronize..."), wxDefaultPosition, wxSize( 180,42 ), 0 ); + m_buttonStartSync->SetFont( wxFont( 14, 74, 90, 92, false, wxEmptyString ) ); + m_buttonStartSync->SetToolTip( _("Start synchronization") ); + + fgSizer12->Add( m_buttonStartSync, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer1551->Add( fgSizer12, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 ); + + + bSizer1551->Add( 15, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizerTopButtons->Add( bSizer1551, 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_bpButtonAddPair = new wxBitmapButton( m_panelTopLeft, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); + m_bpButtonAddPair->SetToolTip( _("Add folder pair") ); + + sbSizerDirLeft->Add( m_bpButtonAddPair, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 3 ); + + m_bpButtonRemovePair = new wxBitmapButton( m_panelTopLeft, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); + m_bpButtonRemovePair->SetToolTip( _("Remove folder pair") ); + + sbSizerDirLeft->Add( m_bpButtonRemovePair, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_directoryLeft = new FolderHistoryBox( m_panelTopLeft, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + sbSizerDirLeft->Add( m_directoryLeft, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_dirPickerLeft = new zen::DirPickerCtrl( 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") ); + + 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_bpButtonAltCompCfg = new wxBitmapButton( m_panelTopMiddle, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); + bSizer160->Add( m_bpButtonAltCompCfg, 0, 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|wxRIGHT|wxLEFT, 3 ); + + 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_directoryRight = new FolderHistoryBox( m_panelTopRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + sbSizerDirRight->Add( m_directoryRight, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_dirPickerRight = new zen::DirPickerCtrl( 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, 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|wxRIGHT|wxLEFT, 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, 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 ); + + 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") ); + + 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") ); + + 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_EXTENDED|wxLB_NEEDED_SB|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* bSizer171; + bSizer171 = new wxBoxSizer( wxHORIZONTAL ); + + m_bpButtonFilter = new wxBitmapButton( m_panelFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW|wxFULL_REPAINT_ON_RESIZE ); + bSizer171->Add( m_bpButtonFilter, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_checkBoxHideFilt = new wxCheckBox( m_panelFilter, wxID_ANY, _("Hide excluded items"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxHideFilt->SetToolTip( _("Hide filtered or temporarily excluded files") ); + + bSizer171->Add( m_checkBoxHideFilt, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_panelFilter->SetSizer( bSizer171 ); + m_panelFilter->Layout(); + bSizer171->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|wxTE_RIGHT ); + 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|wxTE_RIGHT ); + 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|wxTE_RIGHT ); + 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|wxTE_RIGHT ); + 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_bpButtonAddPair->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnAddFolderPair ), NULL, this ); + m_bpButtonRemovePair->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRemoveTopFolderPair ), 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_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_bpButtonAddPair->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnAddFolderPair ), NULL, this ); - m_bpButtonRemovePair->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRemoveTopFolderPair ), 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_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_bpButtonAddPair->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnAddFolderPair ), NULL, this ); + m_bpButtonRemovePair->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRemoveTopFolderPair ), 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_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_bpButtonRemovePair = new wxBitmapButton( m_panelLeft, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); - m_bpButtonRemovePair->SetToolTip( _("Remove folder pair") ); - - bSizer134->Add( m_bpButtonRemovePair, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - m_directoryLeft = new FolderHistoryBox( m_panelLeft, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - bSizer134->Add( m_directoryLeft, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_dirPickerLeft = new FfsDirPickerCtrl( 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_bpButtonAltCompCfg = new wxBitmapButton( m_panel20, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); - bSizer95->Add( m_bpButtonAltCompCfg, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bpButtonLocalFilter = new wxBitmapButton( m_panel20, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); - bSizer95->Add( m_bpButtonLocalFilter, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 3 ); - - 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_directoryRight = new FolderHistoryBox( m_panelRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - bSizer135->Add( m_directoryRight, 1, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - m_dirPickerRight = new FfsDirPickerCtrl( 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_bpButtonRemovePair = new wxBitmapButton( m_panelLeft, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); + m_bpButtonRemovePair->SetToolTip( _("Remove folder pair") ); + + bSizer134->Add( m_bpButtonRemovePair, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + m_directoryLeft = new FolderHistoryBox( m_panelLeft, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + bSizer134->Add( m_directoryLeft, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_dirPickerLeft = new zen::DirPickerCtrl( 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_bpButtonAltCompCfg = new wxBitmapButton( m_panel20, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); + bSizer95->Add( m_bpButtonAltCompCfg, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bpButtonLocalFilter = new wxBitmapButton( m_panel20, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); + bSizer95->Add( m_bpButtonLocalFilter, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 3 ); + + 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_directoryRight = new FolderHistoryBox( m_panelRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + bSizer135->Add( m_directoryRight, 1, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + m_dirPickerRight = new zen::DirPickerCtrl( 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() @@ -877,518 +868,520 @@ FolderPairGenerated::~FolderPairGenerated() 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( 560,320 ), 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( 5, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - wxBoxSizer* bSizer70; - bSizer70 = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText44 = new wxStaticText( this, wxID_ANY, _("Create a batch file for automated synchronization. To start in batch mode simply double-click the file or execute via command line: FreeFileSync.exe <ffs_batch file>. This can also be scheduled in your operating system's task planner."), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText44->Wrap( 460 ); - 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") ); - - bSizer70->Add( m_bpButtonHelp, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - bSizer87->Add( bSizer70, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - bSizer69->Add( bSizer87, 0, 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") ); - - 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") ); - - sbSizer252->Add( m_bpButtonSyncConfig, 0, wxALIGN_CENTER_VERTICAL, 3 ); - - bSizer175->Add( sbSizer252, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer175->Add( 15, 0, 0, 0, 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 ); - - bSizer175->Add( sbSizer25, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 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") ); - - 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") ); - - 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 FolderHistoryBox( m_panelLeft, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - bSizer1141->Add( m_directoryLeft, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_dirPickerLeft = new FfsDirPickerCtrl( 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_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 FolderHistoryBox( m_panelRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - bSizer115->Add( m_directoryRight, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_dirPickerRight = new FfsDirPickerCtrl( 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_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 ); - - wxBoxSizer* bSizer177; - bSizer177 = new wxBoxSizer( wxHORIZONTAL ); - - m_bpButtonAltCompCfg = new wxBitmapButton( m_scrolledWindow6, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); - bSizer177->Add( m_bpButtonAltCompCfg, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bpButtonLocalFilter = new wxBitmapButton( m_scrolledWindow6, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); - bSizer177->Add( m_bpButtonLocalFilter, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 3 ); - - m_bpButtonAltSyncCfg = new wxBitmapButton( m_scrolledWindow6, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); - bSizer177->Add( m_bpButtonAltSyncCfg, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - sbSizerMainPair->Add( bSizer177, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 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 ); - - 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_panelBatchSettings = new wxPanel( m_notebookSettings, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer117; - bSizer117 = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizer172; - bSizer172 = new wxBoxSizer( wxVERTICAL ); - - wxStaticBoxSizer* sbSizer24; - sbSizer24 = new wxStaticBoxSizer( new wxStaticBox( m_panelBatchSettings, wxID_ANY, _("Status feedback") ), wxVERTICAL ); - - m_checkBoxSilent = new wxCheckBox( m_panelBatchSettings, wxID_ANY, _("Run minimized"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizer24->Add( m_checkBoxSilent, 0, wxALL|wxEXPAND, 5 ); - - bSizer172->Add( sbSizer24, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - - bSizer172->Add( 0, 5, 0, 0, 5 ); - - sbSizerLogfileDir = new wxStaticBoxSizer( new wxStaticBox( m_panelBatchSettings, wxID_ANY, _("Logging") ), wxVERTICAL ); - - wxBoxSizer* bSizer152; - bSizer152 = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText96 = new wxStaticText( m_panelBatchSettings, wxID_ANY, _("Maximum number of logfiles:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText96->Wrap( -1 ); - bSizer152->Add( m_staticText96, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - - bSizer152->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_spinCtrlLogCountMax = new wxSpinCtrl( m_panelBatchSettings, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 2000000000, 0 ); - bSizer152->Add( m_spinCtrlLogCountMax, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - sbSizerLogfileDir->Add( bSizer152, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_panelLogfile = new wxPanel( m_panelBatchSettings, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer1721; - bSizer1721 = new wxBoxSizer( wxVERTICAL ); - - m_staticText94 = new wxStaticText( m_panelLogfile, wxID_ANY, _("Select logfile directory:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText94->Wrap( -1 ); - bSizer1721->Add( m_staticText94, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); - - wxBoxSizer* bSizer170; - bSizer170 = new wxBoxSizer( wxHORIZONTAL ); - - m_textCtrlLogfileDir = new wxTextCtrl( m_panelLogfile, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizer170->Add( m_textCtrlLogfileDir, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_dirPickerLogfileDir = new FfsDirPickerCtrl( m_panelLogfile, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); - m_dirPickerLogfileDir->SetToolTip( _("Select a folder") ); - - bSizer170->Add( m_dirPickerLogfileDir, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer1721->Add( bSizer170, 0, wxEXPAND, 5 ); - - m_panelLogfile->SetSizer( bSizer1721 ); - m_panelLogfile->Layout(); - bSizer1721->Fit( m_panelLogfile ); - sbSizerLogfileDir->Add( m_panelLogfile, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - bSizer172->Add( sbSizerLogfileDir, 0, wxEXPAND, 5 ); - - bSizer117->Add( bSizer172, 1, wxEXPAND|wxALL, 10 ); - - m_panelBatchSettings->SetSizer( bSizer117 ); - m_panelBatchSettings->Layout(); - bSizer117->Fit( m_panelBatchSettings ); - m_notebookSettings->AddPage( m_panelBatchSettings, _("Batch settings"), 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, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 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_choiceHandleError->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BatchDlgGenerated::OnChangeErrorHandling ), 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_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 ); + this->SetSizeHints( wxSize( 560,320 ), wxDefaultSize ); + + wxBoxSizer* bSizer54; + bSizer54 = 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( 5, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + wxBoxSizer* bSizer70; + bSizer70 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText44 = new wxStaticText( this, wxID_ANY, _("Create a batch file for automated synchronization. To start in batch mode simply double-click the file or execute via command line: FreeFileSync.exe <ffs_batch file>. This can also be scheduled in your operating system's task planner."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText44->Wrap( 460 ); + 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") ); + + bSizer70->Add( m_bpButtonHelp, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + bSizer87->Add( bSizer70, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizer54->Add( bSizer87, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 5 ); + + m_listbook1 = new wxListbook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLB_DEFAULT ); + m_panelOverview = new wxPanel( m_listbook1, 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") ); + + 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") ); + + sbSizer252->Add( m_bpButtonSyncConfig, 0, wxALIGN_CENTER_VERTICAL, 3 ); + + bSizer175->Add( sbSizer252, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer175->Add( 15, 0, 0, 0, 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 ); + + bSizer175->Add( sbSizer25, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 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") ); + + 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") ); + + 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 FolderHistoryBox( m_panelLeft, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + bSizer1141->Add( m_directoryLeft, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_dirPickerLeft = new zen::DirPickerCtrl( 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_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 FolderHistoryBox( m_panelRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + bSizer115->Add( m_directoryRight, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_dirPickerRight = new zen::DirPickerCtrl( 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_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 ); + + wxBoxSizer* bSizer177; + bSizer177 = new wxBoxSizer( wxHORIZONTAL ); + + m_bpButtonAltCompCfg = new wxBitmapButton( m_scrolledWindow6, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); + bSizer177->Add( m_bpButtonAltCompCfg, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bpButtonLocalFilter = new wxBitmapButton( m_scrolledWindow6, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); + bSizer177->Add( m_bpButtonLocalFilter, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 3 ); + + m_bpButtonAltSyncCfg = new wxBitmapButton( m_scrolledWindow6, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); + bSizer177->Add( m_bpButtonAltSyncCfg, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + sbSizerMainPair->Add( bSizer177, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 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 ); + + bSizer67->Add( bSizer120, 1, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 10 ); + + m_panelOverview->SetSizer( bSizer67 ); + m_panelOverview->Layout(); + bSizer67->Fit( m_panelOverview ); + m_listbook1->AddPage( m_panelOverview, _("Overview"), true ); + m_panelBatchSettings = new wxPanel( m_listbook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer117; + bSizer117 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer172; + bSizer172 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer24; + sbSizer24 = new wxStaticBoxSizer( new wxStaticBox( m_panelBatchSettings, wxID_ANY, _("Status feedback") ), wxVERTICAL ); + + m_checkBoxSilent = new wxCheckBox( m_panelBatchSettings, wxID_ANY, _("Run minimized"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizer24->Add( m_checkBoxSilent, 0, wxALL|wxEXPAND, 5 ); + + bSizer172->Add( sbSizer24, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + + bSizer172->Add( 0, 5, 0, 0, 5 ); + + sbSizerLogfileDir = new wxStaticBoxSizer( new wxStaticBox( m_panelBatchSettings, wxID_ANY, _("Logging") ), wxVERTICAL ); + + wxBoxSizer* bSizer152; + bSizer152 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText96 = new wxStaticText( m_panelBatchSettings, wxID_ANY, _("Maximum number of logfiles:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText96->Wrap( -1 ); + bSizer152->Add( m_staticText96, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + + bSizer152->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_spinCtrlLogCountMax = new wxSpinCtrl( m_panelBatchSettings, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 2000000000, 0 ); + bSizer152->Add( m_spinCtrlLogCountMax, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + sbSizerLogfileDir->Add( bSizer152, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_panelLogfile = new wxPanel( m_panelBatchSettings, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer1721; + bSizer1721 = new wxBoxSizer( wxVERTICAL ); + + m_staticText94 = new wxStaticText( m_panelLogfile, wxID_ANY, _("Select logfile directory:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText94->Wrap( -1 ); + bSizer1721->Add( m_staticText94, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); + + wxBoxSizer* bSizer170; + bSizer170 = new wxBoxSizer( wxHORIZONTAL ); + + m_comboBoxLogfileDir = new FolderHistoryBox( m_panelLogfile, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + bSizer170->Add( m_comboBoxLogfileDir, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_dirPickerLogfileDir = new zen::DirPickerCtrl( m_panelLogfile, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); + m_dirPickerLogfileDir->SetToolTip( _("Select a folder") ); + + bSizer170->Add( m_dirPickerLogfileDir, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer1721->Add( bSizer170, 0, wxEXPAND, 5 ); + + m_panelLogfile->SetSizer( bSizer1721 ); + m_panelLogfile->Layout(); + bSizer1721->Fit( m_panelLogfile ); + sbSizerLogfileDir->Add( m_panelLogfile, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + bSizer172->Add( sbSizerLogfileDir, 0, wxEXPAND, 5 ); + + bSizer117->Add( bSizer172, 1, wxEXPAND|wxALL, 10 ); + + m_panelBatchSettings->SetSizer( bSizer117 ); + m_panelBatchSettings->Layout(); + bSizer117->Fit( m_panelBatchSettings ); + m_listbook1->AddPage( m_panelBatchSettings, _("Batch settings"), false ); + #ifndef __WXGTK__ // Small icon style not supported in GTK + wxListView* m_listbook1ListView = m_listbook1->GetListView(); + long m_listbook1Flags = m_listbook1ListView->GetWindowStyleFlag(); + m_listbook1Flags = ( m_listbook1Flags & ~wxLC_ICON ) | wxLC_SMALL_ICON; + m_listbook1ListView->SetWindowStyleFlag( m_listbook1Flags ); + #endif + + bSizer54->Add( m_listbook1, 1, wxEXPAND|wxRIGHT|wxLEFT, 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, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 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 ); + + bSizer54->Add( bSizer68, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 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_choiceHandleError->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BatchDlgGenerated::OnChangeErrorHandling ), 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_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_choiceHandleError->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BatchDlgGenerated::OnChangeErrorHandling ), 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_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 ); - + // 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_choiceHandleError->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BatchDlgGenerated::OnChangeErrorHandling ), 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_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 ); + } 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") ); - - 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 FolderHistoryBox( m_panelLeft, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - bSizer114->Add( m_directoryLeft, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_dirPickerLeft = new FfsDirPickerCtrl( 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_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 FolderHistoryBox( m_panelRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - bSizer115->Add( m_directoryRight, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_dirPickerRight = new FfsDirPickerCtrl( 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_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 ); - - wxBoxSizer* bSizer176; - bSizer176 = new wxBoxSizer( wxHORIZONTAL ); - - m_bpButtonAltCompCfg = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); - bSizer176->Add( m_bpButtonAltCompCfg, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bpButtonLocalFilter = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); - bSizer176->Add( m_bpButtonLocalFilter, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 3 ); - - m_bpButtonAltSyncCfg = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); - bSizer176->Add( m_bpButtonAltSyncCfg, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer140->Add( bSizer176, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 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") ); + + 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 FolderHistoryBox( m_panelLeft, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + bSizer114->Add( m_directoryLeft, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_dirPickerLeft = new zen::DirPickerCtrl( 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_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 FolderHistoryBox( m_panelRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + bSizer115->Add( m_directoryRight, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_dirPickerRight = new zen::DirPickerCtrl( 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_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 ); + + wxBoxSizer* bSizer176; + bSizer176 = new wxBoxSizer( wxHORIZONTAL ); + + m_bpButtonAltCompCfg = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); + bSizer176->Add( m_bpButtonAltCompCfg, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bpButtonLocalFilter = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); + bSizer176->Add( m_bpButtonLocalFilter, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 3 ); + + m_bpButtonAltSyncCfg = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 20,20 ), wxBU_AUTODRAW ); + bSizer176->Add( m_bpButtonAltSyncCfg, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer140->Add( bSizer176, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + bSizer142->Add( bSizer140, 0, wxEXPAND, 5 ); + + + bSizer142->Add( 0, 5, 0, 0, 5 ); + + this->SetSizer( bSizer142 ); + this->Layout(); + bSizer142->Fit( this ); } BatchFolderPairGenerated::~BatchFolderPairGenerated() @@ -1397,159 +1390,159 @@ BatchFolderPairGenerated::~BatchFolderPairGenerated() 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 ); + + 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, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|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 ); + + bSizer42 = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizer157; + bSizer157 = new wxBoxSizer( wxVERTICAL ); + + bSizerFilesFound = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText321 = new wxStaticText( this, wxID_ANY, _("Items 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, _("Items 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_staticTextRemTime = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextRemTime->Wrap( -1 ); + m_staticTextRemTime->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); + + sSizerTimeRemaining->Add( m_staticTextRemTime, 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|wxTOP|wxRIGHT|wxLEFT, 5 ); + + + bSizer40->Add( 0, 0, 1, wxEXPAND, 5 ); + + this->SetSizer( bSizer40 ); + this->Layout(); + bSizer40->Fit( this ); } CompareStatusGenerated::~CompareStatusGenerated() @@ -1558,2138 +1551,2178 @@ 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( 400 ); - 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( 400 ); - 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( 400 ); - 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 ) ); - - fgSizer1->Add( m_radioBtnCustom, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_buttonUpdate1 = new wxButton( this, wxID_ANY, _("Custom"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); - m_buttonUpdate1->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - - fgSizer1->Add( m_buttonUpdate1, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - m_staticText9 = new wxStaticText( this, wxID_ANY, _("Configure your own synchronization rules."), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText9->Wrap( 400 ); - 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 ); - - sbSizerCustDelDir = 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 ); - sbSizerCustDelDir->Add( m_choiceHandleDeletion, 0, wxBOTTOM, 5 ); - - m_panelCustomDeletionDir = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer1151; - bSizer1151 = new wxBoxSizer( wxHORIZONTAL ); - - m_customDelFolder = new FolderHistoryBox( m_panelCustomDeletionDir, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - bSizer1151->Add( m_customDelFolder, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_dirPickerCustomDelFolder = new FfsDirPickerCtrl( 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 ); - sbSizerCustDelDir->Add( m_panelCustomDeletionDir, 0, wxEXPAND, 5 ); - - bSizer201->Add( sbSizerCustDelDir, 1, wxEXPAND, 5 ); - - bSizer29->Add( bSizer201, 0, wxTOP|wxBOTTOM|wxEXPAND, 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|wxTOP|wxBOTTOM|wxLEFT, 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 ); - - wxStaticBoxSizer* sbSizer2453245; - sbSizer2453245 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Configuration") ), wxVERTICAL ); - - - sbSizer2453245->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_bitmapDatabase = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 70,70 ), 0 ); - sbSizer2453245->Add( m_bitmapDatabase, 1, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 10 ); - - sbSizerSyncDirections = new wxBoxSizer( 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 ); - - bSizerLeftOnly = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapLeftOnly = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); - m_bitmapLeftOnly->SetToolTip( _("File/folder exists on left side only") ); - - bSizerLeftOnly->Add( m_bitmapLeftOnly, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizerLeftOnly->Add( 5, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bpButtonLeftOnly = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizerLeftOnly->Add( m_bpButtonLeftOnly, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer121->Add( bSizerLeftOnly, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - bSizerRightOnly = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapRightOnly = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); - m_bitmapRightOnly->SetToolTip( _("File/folder exists on right side only") ); - - bSizerRightOnly->Add( m_bitmapRightOnly, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizerRightOnly->Add( 5, 0, 0, 0, 5 ); - - m_bpButtonRightOnly = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizerRightOnly->Add( m_bpButtonRightOnly, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer121->Add( bSizerRightOnly, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - bSizerLeftNewer = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapLeftNewer = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); - m_bitmapLeftNewer->SetToolTip( _("Left file is newer") ); - - bSizerLeftNewer->Add( m_bitmapLeftNewer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizerLeftNewer->Add( 5, 0, 0, 0, 5 ); - - m_bpButtonLeftNewer = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizerLeftNewer->Add( m_bpButtonLeftNewer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer121->Add( bSizerLeftNewer, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - bSizerRightNewer = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapRightNewer = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); - m_bitmapRightNewer->SetToolTip( _("Right file is newer") ); - - bSizerRightNewer->Add( m_bitmapRightNewer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizerRightNewer->Add( 5, 0, 0, 0, 5 ); - - m_bpButtonRightNewer = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizerRightNewer->Add( m_bpButtonRightNewer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer121->Add( bSizerRightNewer, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - bSizerDifferent = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapDifferent = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); - m_bitmapDifferent->SetToolTip( _("Files have different content") ); - - bSizerDifferent->Add( m_bitmapDifferent, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizerDifferent->Add( 5, 0, 0, 0, 5 ); - - m_bpButtonDifferent = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizerDifferent->Add( m_bpButtonDifferent, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer121->Add( bSizerDifferent, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - bSizerConflict = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapConflict = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); - m_bitmapConflict->SetToolTip( _("Conflict/file cannot be categorized") ); - - bSizerConflict->Add( m_bitmapConflict, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizerConflict->Add( 5, 0, 0, 0, 5 ); - - m_bpButtonConflict = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizerConflict->Add( m_bpButtonConflict, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer121->Add( bSizerConflict, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - sbSizerSyncDirections->Add( bSizer121, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - sbSizer2453245->Add( sbSizerSyncDirections, 0, wxEXPAND, 5 ); - - - sbSizer2453245->Add( 0, 0, 1, wxEXPAND, 5 ); - - bSizer181->Add( sbSizer2453245, 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_buttonAutomatic->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncAutomaticDouble ), NULL, this ); - m_radioBtnMirror->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncMirror ), NULL, this ); - m_buttonOneWay->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncMirror ), NULL, this ); - m_buttonOneWay->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncMirrorDouble ), 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_buttonUpdate->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncUpdateDouble ), NULL, this ); - m_radioBtnCustom->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncCustom ), NULL, this ); - m_buttonUpdate1->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncCustom ), NULL, this ); - m_buttonUpdate1->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncCustomDouble ), 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( 400 ); + 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( 400 ); + 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( 400 ); + 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 ) ); + + fgSizer1->Add( m_radioBtnCustom, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_buttonUpdate1 = new wxButton( this, wxID_ANY, _("Custom"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); + m_buttonUpdate1->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); + + fgSizer1->Add( m_buttonUpdate1, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + m_staticText9 = new wxStaticText( this, wxID_ANY, _("Configure your own synchronization rules."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText9->Wrap( 400 ); + 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 ); + + sbSizerCustDelDir = 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 ); + sbSizerCustDelDir->Add( m_choiceHandleDeletion, 0, wxBOTTOM, 5 ); + + m_panelCustomDeletionDir = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer1151; + bSizer1151 = new wxBoxSizer( wxHORIZONTAL ); + + m_customDelFolder = new FolderHistoryBox( m_panelCustomDeletionDir, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + bSizer1151->Add( m_customDelFolder, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_dirPickerCustomDelFolder = new zen::DirPickerCtrl( 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 ); + sbSizerCustDelDir->Add( m_panelCustomDeletionDir, 0, wxEXPAND, 5 ); + + bSizer201->Add( sbSizerCustDelDir, 1, wxEXPAND, 5 ); + + bSizer29->Add( bSizer201, 0, wxTOP|wxBOTTOM|wxEXPAND, 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|wxTOP|wxBOTTOM|wxLEFT, 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 ); + + wxStaticBoxSizer* sbSizer2453245; + sbSizer2453245 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Configuration") ), wxVERTICAL ); + + + sbSizer2453245->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_bitmapDatabase = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 70,70 ), 0 ); + sbSizer2453245->Add( m_bitmapDatabase, 1, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 10 ); + + sbSizerSyncDirections = new wxBoxSizer( 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 ); + + bSizerLeftOnly = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmapLeftOnly = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); + m_bitmapLeftOnly->SetToolTip( _("File/folder exists on left side only") ); + + bSizerLeftOnly->Add( m_bitmapLeftOnly, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizerLeftOnly->Add( 5, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bpButtonLeftOnly = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizerLeftOnly->Add( m_bpButtonLeftOnly, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer121->Add( bSizerLeftOnly, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizerRightOnly = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmapRightOnly = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); + m_bitmapRightOnly->SetToolTip( _("File/folder exists on right side only") ); + + bSizerRightOnly->Add( m_bitmapRightOnly, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizerRightOnly->Add( 5, 0, 0, 0, 5 ); + + m_bpButtonRightOnly = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizerRightOnly->Add( m_bpButtonRightOnly, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer121->Add( bSizerRightOnly, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizerLeftNewer = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmapLeftNewer = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); + m_bitmapLeftNewer->SetToolTip( _("Left file is newer") ); + + bSizerLeftNewer->Add( m_bitmapLeftNewer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizerLeftNewer->Add( 5, 0, 0, 0, 5 ); + + m_bpButtonLeftNewer = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizerLeftNewer->Add( m_bpButtonLeftNewer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer121->Add( bSizerLeftNewer, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizerRightNewer = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmapRightNewer = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); + m_bitmapRightNewer->SetToolTip( _("Right file is newer") ); + + bSizerRightNewer->Add( m_bitmapRightNewer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizerRightNewer->Add( 5, 0, 0, 0, 5 ); + + m_bpButtonRightNewer = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizerRightNewer->Add( m_bpButtonRightNewer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer121->Add( bSizerRightNewer, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizerDifferent = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmapDifferent = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); + m_bitmapDifferent->SetToolTip( _("Files have different content") ); + + bSizerDifferent->Add( m_bitmapDifferent, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizerDifferent->Add( 5, 0, 0, 0, 5 ); + + m_bpButtonDifferent = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizerDifferent->Add( m_bpButtonDifferent, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer121->Add( bSizerDifferent, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizerConflict = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmapConflict = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); + m_bitmapConflict->SetToolTip( _("Conflict/file cannot be categorized") ); + + bSizerConflict->Add( m_bitmapConflict, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizerConflict->Add( 5, 0, 0, 0, 5 ); + + m_bpButtonConflict = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); + bSizerConflict->Add( m_bpButtonConflict, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer121->Add( bSizerConflict, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + sbSizerSyncDirections->Add( bSizer121, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + sbSizer2453245->Add( sbSizerSyncDirections, 0, wxEXPAND, 5 ); + + + sbSizer2453245->Add( 0, 0, 1, wxEXPAND, 5 ); + + bSizer181->Add( sbSizer2453245, 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_buttonAutomatic->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncAutomaticDouble ), NULL, this ); + m_radioBtnMirror->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncMirror ), NULL, this ); + m_buttonOneWay->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncMirror ), NULL, this ); + m_buttonOneWay->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncMirrorDouble ), 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_buttonUpdate->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncUpdateDouble ), NULL, this ); + m_radioBtnCustom->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncCustom ), NULL, this ); + m_buttonUpdate1->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncCustom ), NULL, this ); + m_buttonUpdate1->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncCustomDouble ), 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_buttonAutomatic->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncAutomaticDouble ), NULL, this ); - m_radioBtnMirror->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncMirror ), NULL, this ); - m_buttonOneWay->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncMirror ), NULL, this ); - m_buttonOneWay->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncMirrorDouble ), 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_buttonUpdate->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncUpdateDouble ), NULL, this ); - m_radioBtnCustom->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncCustom ), NULL, this ); - m_buttonUpdate1->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncCustom ), NULL, this ); - m_buttonUpdate1->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncCustomDouble ), 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_buttonAutomatic->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncAutomaticDouble ), NULL, this ); + m_radioBtnMirror->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncMirror ), NULL, this ); + m_buttonOneWay->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncMirror ), NULL, this ); + m_buttonOneWay->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncMirrorDouble ), 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_buttonUpdate->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncUpdateDouble ), NULL, this ); + m_radioBtnCustom->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncCustom ), NULL, this ); + m_buttonUpdate1->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncCustom ), NULL, this ); + m_buttonUpdate1->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncCustomDouble ), 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 - last write time and date\n - file size\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 - last write time and date\n - file size\nare the same") ); - - fgSizer16->Add( m_bitmapByTime, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_buttonTimeSize = new wxButton( this, wxID_ANY, _("File time and size"), wxDefaultPosition, wxSize( -1,42 ), 0 ); - m_buttonTimeSize->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); - m_buttonTimeSize->SetToolTip( _("Files are found equal if\n - last write time and date\n - file size\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 ); - - bSizer55->Add( sbSizer6, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 2 ); - - - bSizer55->Add( 0, 4, 0, 0, 5 ); - - wxBoxSizer* bSizer177; - bSizer177 = new wxBoxSizer( wxHORIZONTAL ); - - 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( -1 ); - sbSizer25->Add( m_choiceHandleSymlinks, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - bSizer177->Add( sbSizer25, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bpButtonHelp = new wxBitmapButton( this, wxID_HELP, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - m_bpButtonHelp->SetToolTip( _("Help") ); - - bSizer177->Add( m_bpButtonHelp, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - bSizer55->Add( bSizer177, 0, wxEXPAND, 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, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 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_buttonTimeSize->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( CmpCfgDlgGenerated::OnTimeSizeDouble ), 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_buttonContent->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( CmpCfgDlgGenerated::OnContentDouble ), NULL, this ); - m_choiceHandleSymlinks->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnChangeErrorHandling ), NULL, this ); - m_bpButtonHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnShowHelp ), 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 - last write time and date\n - file size\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 - last write time and date\n - file size\nare the same") ); + + fgSizer16->Add( m_bitmapByTime, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_buttonTimeSize = new wxButton( this, wxID_ANY, _("File time and size"), wxDefaultPosition, wxSize( -1,42 ), 0 ); + m_buttonTimeSize->SetFont( wxFont( 11, 70, 90, 92, false, wxEmptyString ) ); + m_buttonTimeSize->SetToolTip( _("Files are found equal if\n - last write time and date\n - file size\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 ); + + bSizer55->Add( sbSizer6, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 2 ); + + + bSizer55->Add( 0, 4, 0, 0, 5 ); + + wxBoxSizer* bSizer177; + bSizer177 = new wxBoxSizer( wxHORIZONTAL ); + + 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( -1 ); + sbSizer25->Add( m_choiceHandleSymlinks, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizer177->Add( sbSizer25, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bpButtonHelp = new wxBitmapButton( this, wxID_HELP, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + m_bpButtonHelp->SetToolTip( _("Help") ); + + bSizer177->Add( m_bpButtonHelp, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + bSizer55->Add( bSizer177, 0, wxEXPAND, 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, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 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_buttonTimeSize->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( CmpCfgDlgGenerated::OnTimeSizeDouble ), 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_buttonContent->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( CmpCfgDlgGenerated::OnContentDouble ), NULL, this ); + m_choiceHandleSymlinks->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnChangeErrorHandling ), NULL, this ); + m_bpButtonHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnShowHelp ), 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_buttonTimeSize->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( CmpCfgDlgGenerated::OnTimeSizeDouble ), 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_buttonContent->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( CmpCfgDlgGenerated::OnContentDouble ), NULL, this ); - m_choiceHandleSymlinks->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnChangeErrorHandling ), NULL, this ); - m_bpButtonHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnShowHelp ), 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_buttonTimeSize->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( CmpCfgDlgGenerated::OnTimeSizeDouble ), 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_buttonContent->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( CmpCfgDlgGenerated::OnContentDouble ), NULL, this ); + m_choiceHandleSymlinks->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnChangeErrorHandling ), NULL, this ); + m_bpButtonHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnShowHelp ), 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 ); - - 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,14 ), 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,200 ), wxDefaultSize ); + this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) ); + + bSizer27 = new wxBoxSizer( wxVERTICAL ); + + 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, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 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|wxALL, 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, 5 ); + + bSizerCurrentOperation = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText2511 = new wxStaticText( this, wxID_ANY, _("Operation:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText2511->Wrap( -1 ); + m_staticText2511->SetFont( wxFont( 10, 74, 90, 92, false, wxT("Tahoma") ) ); + + bSizerCurrentOperation->Add( m_staticText2511, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 ); + + m_textCtrlInfo = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); + m_textCtrlInfo->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + + bSizerCurrentOperation->Add( m_textCtrlInfo, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer27->Add( bSizerCurrentOperation, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + bSizerHoldStretch = new wxBoxSizer( wxVERTICAL ); + + bSizer27->Add( bSizerHoldStretch, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + bSizerProgressMain = new wxBoxSizer( wxHORIZONTAL ); + + bSizerProgressStat = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxHORIZONTAL ); + + wxFlexGridSizer* fgSizer10; + fgSizer10 = new wxFlexGridSizer( 0, 2, 0, 10 ); + fgSizer10->SetFlexibleDirection( wxBOTH ); + fgSizer10->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticTextItemsRem = new wxStaticText( this, wxID_ANY, _("Items remaining:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextItemsRem->Wrap( -1 ); + m_staticTextItemsRem->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + fgSizer10->Add( m_staticTextItemsRem, 0, wxALIGN_BOTTOM, 5 ); + + bSizerItemsRem = new wxBoxSizer( wxHORIZONTAL ); + + 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") ) ); + + bSizerItemsRem->Add( m_staticTextRemainingObj, 0, 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") ) ); + + bSizerItemsRem->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") ) ); + + bSizerItemsRem->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") ) ); + + bSizerItemsRem->Add( m_staticText97, 0, wxALIGN_BOTTOM, 5 ); + + fgSizer10->Add( bSizerItemsRem, 0, wxALIGN_BOTTOM, 5 ); + + m_staticTextSpeedDescr = new wxStaticText( this, wxID_ANY, _("Speed:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextSpeedDescr->Wrap( -1 ); + m_staticTextSpeedDescr->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + fgSizer10->Add( m_staticTextSpeedDescr, 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") ) ); + + fgSizer10->Add( m_staticTextSpeed, 0, wxALIGN_BOTTOM, 5 ); + + 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 ) ); + + fgSizer10->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") ) ); + + fgSizer10->Add( m_staticTextTimeElapsed, 0, wxALIGN_BOTTOM, 5 ); + + m_staticTextRemTimeDescr = new wxStaticText( this, wxID_ANY, _("Time remaining:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextRemTimeDescr->Wrap( -1 ); + m_staticTextRemTimeDescr->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + fgSizer10->Add( m_staticTextRemTimeDescr, 0, wxALIGN_BOTTOM, 5 ); + + m_staticTextRemTime = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextRemTime->Wrap( -1 ); + m_staticTextRemTime->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); + + fgSizer10->Add( m_staticTextRemTime, 0, wxALIGN_BOTTOM, 5 ); + + bSizerProgressStat->Add( fgSizer10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + bSizerProgressMain->Add( bSizerProgressStat, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5 ); + + + bSizerProgressMain->Add( 10, 0, 0, 0, 5 ); + + m_panelGraph = new zen::Graph2D( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_panelGraph->SetBackgroundColour( wxColour( 255, 255, 255 ) ); + + bSizerProgressMain->Add( m_panelGraph, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP, 5 ); + + bSizer27->Add( bSizerProgressMain, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + bSizerFinalStat = new wxBoxSizer( wxVERTICAL ); + + m_listbookResult = new wxListbook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLB_TOP ); + #ifndef __WXGTK__ // Small icon style not supported in GTK + wxListView* m_listbookResultListView = m_listbookResult->GetListView(); + long m_listbookResultFlags = m_listbookResultListView->GetWindowStyleFlag(); + m_listbookResultFlags = ( m_listbookResultFlags & ~wxLC_ICON ) | wxLC_SMALL_ICON; + m_listbookResultListView->SetWindowStyleFlag( m_listbookResultFlags ); + #endif + + bSizerFinalStat->Add( m_listbookResult, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizer182; + bSizer182 = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizer180; + bSizer180 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticTextItemsProc = new wxStaticText( this, wxID_ANY, _("Items processed:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextItemsProc->Wrap( -1 ); + m_staticTextItemsProc->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer180->Add( m_staticTextItemsProc, 0, wxALIGN_BOTTOM, 5 ); + + + bSizer180->Add( 10, 0, 0, 0, 5 ); + + bSizerItemsProc = new wxBoxSizer( wxHORIZONTAL ); + + 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") ) ); + + bSizerItemsProc->Add( m_staticTextProcessedObj, 0, 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") ) ); + + bSizerItemsProc->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") ) ); + + bSizerItemsProc->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") ) ); + + bSizerItemsProc->Add( m_staticText99, 0, wxALIGN_BOTTOM, 5 ); + + bSizer180->Add( bSizerItemsProc, 0, wxALIGN_BOTTOM, 5 ); + + bSizer182->Add( bSizer180, 0, wxALIGN_BOTTOM, 5 ); + + + bSizer182->Add( 0, 0, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizer181; + bSizer181 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText551 = new wxStaticText( this, wxID_ANY, _("Time elapsed:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText551->Wrap( -1 ); + m_staticText551->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + bSizer181->Add( m_staticText551, 0, wxALIGN_BOTTOM, 5 ); + + + bSizer181->Add( 10, 0, 0, 0, 5 ); + + m_staticTextTimeTotal = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextTimeTotal->Wrap( -1 ); + m_staticTextTimeTotal->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); + + bSizer181->Add( m_staticTextTimeTotal, 0, wxALIGN_BOTTOM, 5 ); + + bSizer182->Add( bSizer181, 0, wxALIGN_BOTTOM, 5 ); + + bSizerFinalStat->Add( bSizer182, 0, wxEXPAND, 5 ); + + bSizer27->Add( bSizerFinalStat, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + m_gauge1 = new wxGauge( this, wxID_ANY, 100, wxDefaultPosition, wxSize( -1,14 ), wxGA_HORIZONTAL ); + bSizer27->Add( m_gauge1, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + bSizer28 = new wxBoxSizer( wxHORIZONTAL ); + + + 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|wxALL, 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, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 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, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer28->Add( 0, 0, 1, wxEXPAND, 5 ); + + bSizer27->Add( bSizer28, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 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 ); + 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|wxRIGHT, 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, 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 ); - + // 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 ); + } 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_panel33 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDOUBLE_BORDER|wxTAB_TRAVERSAL ); - m_panel33->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - - bSizerCodeInfo = new wxBoxSizer( wxVERTICAL ); - - m_staticText72 = new wxStaticText( m_panel33, wxID_ANY, _("Source code written 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, 5 ); - - wxBoxSizer* bSizer167; - bSizer167 = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizer171; - bSizer171 = new wxBoxSizer( wxHORIZONTAL ); - - m_hyperlink9 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("MinGW"), wxT("http://www.mingw.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink9->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - - bSizer171->Add( m_hyperlink9, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_hyperlink11 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("MS Visual C++"), wxT("http://msdn.microsoft.com/library/60k1461a.aspx"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink11->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - - bSizer171->Add( m_hyperlink11, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_hyperlink10 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Code::Blocks"), wxT("http://www.codeblocks.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink10->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - - bSizer171->Add( m_hyperlink10, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_hyperlink13 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Boost"), wxT("http://www.boost.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink13->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - - bSizer171->Add( m_hyperlink13, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_hyperlink7 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("wxWidgets"), wxT("http://www.wxwidgets.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink7->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - - bSizer171->Add( m_hyperlink7, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_hyperlink16 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Artistic Style"), wxT("http://astyle.sourceforge.net"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink16->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - - bSizer171->Add( m_hyperlink16, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - bSizer167->Add( bSizer171, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM, 5 ); - - wxBoxSizer* bSizer172; - bSizer172 = new wxBoxSizer( wxHORIZONTAL ); - - m_hyperlink8 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Loki"), wxT("http://sourceforge.net/projects/loki-lib"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink8->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - - bSizer172->Add( m_hyperlink8, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_hyperlink15 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("zenXML"), wxT("http://sourceforge.net/projects/zenxml/"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink15->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - - bSizer172->Add( m_hyperlink15, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_hyperlink12 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Google Test"), wxT("http://code.google.com/p/googletest"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink12->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - - bSizer172->Add( m_hyperlink12, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_hyperlink18 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Unicode NSIS"), wxT("http://www.scratchpaper.com"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink18->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - - bSizer172->Add( m_hyperlink18, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_hyperlink14 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("wxFormBuilder"), wxT("http://wxformbuilder.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink14->SetBackgroundColour( wxColour( 208, 208, 208 ) ); - - bSizer172->Add( m_hyperlink14, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - bSizer167->Add( bSizer172, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - bSizerCodeInfo->Add( bSizer167, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_hyperlink21 = new wxHyperlinkCtrl( m_panel33, 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_panel33->SetSizer( bSizerCodeInfo ); - m_panel33->Layout(); - bSizerCodeInfo->Fit( m_panel33 ); - bSizer53->Add( m_panel33, 0, wxBOTTOM|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - 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,180 ) ); - - 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@gmx.de&lc=US¤cy_code=EUR"), 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@gmx.de&lc=US¤cy_code=EUR") ); - - 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 ); + 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_panel33 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDOUBLE_BORDER|wxTAB_TRAVERSAL ); + m_panel33->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + + bSizerCodeInfo = new wxBoxSizer( wxVERTICAL ); + + m_staticText72 = new wxStaticText( m_panel33, wxID_ANY, _("Source code written 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, 5 ); + + wxBoxSizer* bSizer167; + bSizer167 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer171; + bSizer171 = new wxBoxSizer( wxHORIZONTAL ); + + m_hyperlink9 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("MinGW"), wxT("http://www.mingw.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink9->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + + bSizer171->Add( m_hyperlink9, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_hyperlink11 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("MS Visual C++"), wxT("http://msdn.microsoft.com/library/60k1461a.aspx"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink11->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + + bSizer171->Add( m_hyperlink11, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_hyperlink10 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Code::Blocks"), wxT("http://www.codeblocks.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink10->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + + bSizer171->Add( m_hyperlink10, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_hyperlink13 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Boost"), wxT("http://www.boost.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink13->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + + bSizer171->Add( m_hyperlink13, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_hyperlink7 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("wxWidgets"), wxT("http://www.wxwidgets.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink7->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + + bSizer171->Add( m_hyperlink7, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_hyperlink16 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Artistic Style"), wxT("http://astyle.sourceforge.net"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink16->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + + bSizer171->Add( m_hyperlink16, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + bSizer167->Add( bSizer171, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM, 5 ); + + wxBoxSizer* bSizer172; + bSizer172 = new wxBoxSizer( wxHORIZONTAL ); + + m_hyperlink8 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Loki"), wxT("http://sourceforge.net/projects/loki-lib"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink8->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + + bSizer172->Add( m_hyperlink8, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_hyperlink15 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("zenXML"), wxT("http://sourceforge.net/projects/zenxml/"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink15->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + + bSizer172->Add( m_hyperlink15, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_hyperlink12 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Google Test"), wxT("http://code.google.com/p/googletest"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink12->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + + bSizer172->Add( m_hyperlink12, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_hyperlink18 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("Unicode NSIS"), wxT("http://www.scratchpaper.com"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink18->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + + bSizer172->Add( m_hyperlink18, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_hyperlink14 = new wxHyperlinkCtrl( m_panel33, wxID_ANY, _("wxFormBuilder"), wxT("http://wxformbuilder.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink14->SetBackgroundColour( wxColour( 208, 208, 208 ) ); + + bSizer172->Add( m_hyperlink14, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + bSizer167->Add( bSizer172, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizerCodeInfo->Add( bSizer167, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_hyperlink21 = new wxHyperlinkCtrl( m_panel33, 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_panel33->SetSizer( bSizerCodeInfo ); + m_panel33->Layout(); + bSizerCodeInfo->Fit( m_panel33 ); + bSizer53->Add( m_panel33, 0, wxBOTTOM|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + 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,180 ) ); + + 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@gmx.de&lc=US¤cy_code=EUR"), 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@gmx.de&lc=US¤cy_code=EUR") ); + + 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_checkBoxDontAskAgain->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( QuestionDlgGenerated::OnCheckBoxDontShowAgain ), NULL, this ); - 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_checkBoxDontAskAgain->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( QuestionDlgGenerated::OnCheckBoxDontShowAgain ), NULL, this ); + 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_checkBoxDontAskAgain->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( QuestionDlgGenerated::OnCheckBoxDontShowAgain ), NULL, this ); - 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_checkBoxDontAskAgain->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( QuestionDlgGenerated::OnCheckBoxDontShowAgain ), NULL, this ); + 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_DONTWRAP|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_DONTWRAP|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( wxSize( 370,380 ), 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 match all filter settings will be selected for synchronization.\nNote: The name filter must be specified relative(!) to main synchronization directories."), wxDefaultPosition, wxSize( 550,-1 ), wxALIGN_CENTRE ); - m_staticText44->Wrap( 550 ); - 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") ); - - 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 ); - - - bSizer21->Add( 0, 0, 0, 0, 5 ); - - wxBoxSizer* bSizer159; - bSizer159 = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* bSizer166; - bSizer166 = new wxBoxSizer( wxVERTICAL ); - - wxStaticBoxSizer* sbSizer8; - sbSizer8 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Include") ), wxHORIZONTAL ); - - m_bitmapInclude = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), 0 ); - sbSizer8->Add( m_bitmapInclude, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxRIGHT, 5 ); - - m_textCtrlInclude = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE ); - sbSizer8->Add( m_textCtrlInclude, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - bSizer166->Add( sbSizer8, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - wxStaticBoxSizer* sbSizer26; - sbSizer26 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Exclude") ), wxHORIZONTAL ); - - m_bitmapExclude = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), 0 ); - sbSizer26->Add( m_bitmapExclude, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_textCtrlExclude = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE ); - sbSizer26->Add( m_textCtrlExclude, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 ); - - bSizer166->Add( sbSizer26, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - bSizer159->Add( bSizer166, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - - bSizer159->Add( 5, 0, 0, 0, 5 ); - - wxBoxSizer* bSizer160; - bSizer160 = new wxBoxSizer( wxVERTICAL ); - - wxStaticBoxSizer* sbSizer25; - sbSizer25 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Date") ), wxHORIZONTAL ); - - wxBoxSizer* bSizer169; - bSizer169 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapFilterDate = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 34,34 ), 0 ); - bSizer169->Add( m_bitmapFilterDate, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - wxBoxSizer* bSizer165; - bSizer165 = new wxBoxSizer( wxVERTICAL ); - - m_staticText103 = new wxStaticText( this, wxID_ANY, _("Select time span"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText103->Wrap( -1 ); - bSizer165->Add( m_staticText103, 0, 0, 5 ); - - wxBoxSizer* bSizer164; - bSizer164 = new wxBoxSizer( wxVERTICAL ); - - wxArrayString m_choiceUnitTimespanChoices; - m_choiceUnitTimespan = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceUnitTimespanChoices, 0 ); - m_choiceUnitTimespan->SetSelection( 0 ); - bSizer164->Add( m_choiceUnitTimespan, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_spinCtrlTimespan = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 2000000000, 0 ); - m_spinCtrlTimespan->Hide(); - - bSizer164->Add( m_spinCtrlTimespan, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer165->Add( bSizer164, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer169->Add( bSizer165, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - sbSizer25->Add( bSizer169, 0, 0, 5 ); - - bSizer160->Add( sbSizer25, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - wxStaticBoxSizer* sbSizer81; - sbSizer81 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Size") ), wxHORIZONTAL ); - - wxBoxSizer* bSizer170; - bSizer170 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapFilterSize = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 32,32 ), 0 ); - bSizer170->Add( m_bitmapFilterSize, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxRIGHT, 5 ); - - wxBoxSizer* bSizer158; - bSizer158 = new wxBoxSizer( wxVERTICAL ); - - m_staticText101 = new wxStaticText( this, wxID_ANY, _("Minimum file size"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText101->Wrap( -1 ); - bSizer158->Add( m_staticText101, 0, 0, 5 ); - - wxBoxSizer* bSizer162; - bSizer162 = new wxBoxSizer( wxVERTICAL ); - - m_spinCtrlMinSize = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 2000000000, 0 ); - bSizer162->Add( m_spinCtrlMinSize, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - wxArrayString m_choiceUnitMinSizeChoices; - m_choiceUnitMinSize = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceUnitMinSizeChoices, 0 ); - m_choiceUnitMinSize->SetSelection( 0 ); - bSizer162->Add( m_choiceUnitMinSize, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer158->Add( bSizer162, 0, wxBOTTOM, 5 ); - - m_staticText102 = new wxStaticText( this, wxID_ANY, _("Maximum file size"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText102->Wrap( -1 ); - bSizer158->Add( m_staticText102, 0, 0, 5 ); - - wxBoxSizer* bSizer163; - bSizer163 = new wxBoxSizer( wxVERTICAL ); - - m_spinCtrlMaxSize = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 2000000000, 0 ); - bSizer163->Add( m_spinCtrlMaxSize, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - wxArrayString m_choiceUnitMaxSizeChoices; - m_choiceUnitMaxSize = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceUnitMaxSizeChoices, 0 ); - m_choiceUnitMaxSize->SetSelection( 0 ); - bSizer163->Add( m_choiceUnitMaxSize, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer158->Add( bSizer163, 0, wxTOP, 5 ); - - bSizer170->Add( bSizer158, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - sbSizer81->Add( bSizer170, 0, 0, 5 ); - - bSizer160->Add( sbSizer81, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - bSizer159->Add( bSizer160, 0, wxEXPAND, 5 ); - - bSizer21->Add( bSizer159, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxRIGHT|wxLEFT, 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, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 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_textCtrlInclude->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateNameFilter ), NULL, this ); - m_textCtrlExclude->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateNameFilter ), NULL, this ); - m_choiceUnitTimespan->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateChoice ), NULL, this ); - m_choiceUnitMinSize->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateChoice ), NULL, this ); - m_choiceUnitMaxSize->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateChoice ), 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( wxSize( 370,380 ), 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 match all filter settings will be selected for synchronization.\nNote: The name filter must be specified relative(!) to main synchronization directories."), wxDefaultPosition, wxSize( 550,-1 ), wxALIGN_CENTRE ); + m_staticText44->Wrap( 550 ); + 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") ); + + 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 ); + + + bSizer21->Add( 0, 0, 0, 0, 5 ); + + wxBoxSizer* bSizer159; + bSizer159 = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizer166; + bSizer166 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer8; + sbSizer8 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Include") ), wxHORIZONTAL ); + + m_bitmapInclude = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), 0 ); + sbSizer8->Add( m_bitmapInclude, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxRIGHT, 5 ); + + m_textCtrlInclude = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE ); + sbSizer8->Add( m_textCtrlInclude, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + bSizer166->Add( sbSizer8, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer26; + sbSizer26 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Exclude") ), wxHORIZONTAL ); + + m_bitmapExclude = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), 0 ); + sbSizer26->Add( m_bitmapExclude, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_textCtrlExclude = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE ); + sbSizer26->Add( m_textCtrlExclude, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizer166->Add( sbSizer26, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + bSizer159->Add( bSizer166, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + + bSizer159->Add( 5, 0, 0, 0, 5 ); + + wxBoxSizer* bSizer160; + bSizer160 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer25; + sbSizer25 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Date") ), wxHORIZONTAL ); + + wxBoxSizer* bSizer169; + bSizer169 = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmapFilterDate = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 34,34 ), 0 ); + bSizer169->Add( m_bitmapFilterDate, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + wxBoxSizer* bSizer165; + bSizer165 = new wxBoxSizer( wxVERTICAL ); + + m_staticText103 = new wxStaticText( this, wxID_ANY, _("Select time span"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText103->Wrap( -1 ); + bSizer165->Add( m_staticText103, 0, 0, 5 ); + + wxBoxSizer* bSizer164; + bSizer164 = new wxBoxSizer( wxVERTICAL ); + + wxArrayString m_choiceUnitTimespanChoices; + m_choiceUnitTimespan = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceUnitTimespanChoices, 0 ); + m_choiceUnitTimespan->SetSelection( 0 ); + bSizer164->Add( m_choiceUnitTimespan, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_spinCtrlTimespan = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 2000000000, 0 ); + m_spinCtrlTimespan->Hide(); + + bSizer164->Add( m_spinCtrlTimespan, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer165->Add( bSizer164, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer169->Add( bSizer165, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + sbSizer25->Add( bSizer169, 0, 0, 5 ); + + bSizer160->Add( sbSizer25, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer81; + sbSizer81 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Size") ), wxHORIZONTAL ); + + wxBoxSizer* bSizer170; + bSizer170 = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmapFilterSize = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 32,32 ), 0 ); + bSizer170->Add( m_bitmapFilterSize, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxRIGHT, 5 ); + + wxBoxSizer* bSizer158; + bSizer158 = new wxBoxSizer( wxVERTICAL ); + + m_staticText101 = new wxStaticText( this, wxID_ANY, _("Minimum file size"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText101->Wrap( -1 ); + bSizer158->Add( m_staticText101, 0, 0, 5 ); + + wxBoxSizer* bSizer162; + bSizer162 = new wxBoxSizer( wxVERTICAL ); + + m_spinCtrlMinSize = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 2000000000, 0 ); + bSizer162->Add( m_spinCtrlMinSize, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + wxArrayString m_choiceUnitMinSizeChoices; + m_choiceUnitMinSize = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceUnitMinSizeChoices, 0 ); + m_choiceUnitMinSize->SetSelection( 0 ); + bSizer162->Add( m_choiceUnitMinSize, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer158->Add( bSizer162, 0, wxBOTTOM, 5 ); + + m_staticText102 = new wxStaticText( this, wxID_ANY, _("Maximum file size"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText102->Wrap( -1 ); + bSizer158->Add( m_staticText102, 0, 0, 5 ); + + wxBoxSizer* bSizer163; + bSizer163 = new wxBoxSizer( wxVERTICAL ); + + m_spinCtrlMaxSize = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 2000000000, 0 ); + bSizer163->Add( m_spinCtrlMaxSize, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + wxArrayString m_choiceUnitMaxSizeChoices; + m_choiceUnitMaxSize = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceUnitMaxSizeChoices, 0 ); + m_choiceUnitMaxSize->SetSelection( 0 ); + bSizer163->Add( m_choiceUnitMaxSize, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer158->Add( bSizer163, 0, wxTOP, 5 ); + + bSizer170->Add( bSizer158, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + sbSizer81->Add( bSizer170, 0, 0, 5 ); + + bSizer160->Add( sbSizer81, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + bSizer159->Add( bSizer160, 0, wxEXPAND, 5 ); + + bSizer21->Add( bSizer159, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxRIGHT|wxLEFT, 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, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 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_textCtrlInclude->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateNameFilter ), NULL, this ); + m_textCtrlExclude->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateNameFilter ), NULL, this ); + m_choiceUnitTimespan->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateChoice ), NULL, this ); + m_choiceUnitMinSize->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateChoice ), NULL, this ); + m_choiceUnitMaxSize->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateChoice ), 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_textCtrlInclude->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateNameFilter ), NULL, this ); - m_textCtrlExclude->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateNameFilter ), NULL, this ); - m_choiceUnitTimespan->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateChoice ), NULL, this ); - m_choiceUnitMinSize->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateChoice ), NULL, this ); - m_choiceUnitMaxSize->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateChoice ), 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_textCtrlInclude->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateNameFilter ), NULL, this ); + m_textCtrlExclude->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateNameFilter ), NULL, this ); + m_choiceUnitTimespan->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateChoice ), NULL, this ); + m_choiceUnitMinSize->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateChoice ), NULL, this ); + m_choiceUnitMaxSize->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( FilterDlgGenerated::OnUpdateChoice ), 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") ); - - 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") ); - - 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, wxTOP|wxBOTTOM|wxLEFT, 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") ); + + 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") ); + + 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, wxTOP|wxBOTTOM|wxLEFT, 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_checkBoxTransCopy = new wxCheckBox( this, wxID_ANY, _("Transactional file copy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkBoxTransCopy->SetToolTip( _("Write files to a temporary (*.ffs_tmp) first and rename them. This guarantees a consistent state even in situations of fatal error.") ); - - sbSizer23->Add( m_checkBoxTransCopy, 0, wxALL|wxEXPAND, 5 ); - - 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 file access 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, wxTOP|wxBOTTOM|wxLEFT, 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_checkBoxTransCopy = new wxCheckBox( this, wxID_ANY, _("Transactional file copy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxTransCopy->SetToolTip( _("Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error.") ); + + sbSizer23->Add( m_checkBoxTransCopy, 0, wxALL|wxEXPAND, 5 ); + + 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 file access 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 zen::BitmapButton( 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, wxTOP|wxBOTTOM|wxLEFT, 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|wxTE_RIGHT ); - 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|wxTE_RIGHT ); - 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|wxTE_RIGHT ); - 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|wxTE_RIGHT ); - 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|wxTE_RIGHT ); - 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|wxTE_RIGHT ); - 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_CENTRE|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 zen::BitmapButton( 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|wxTE_RIGHT ); + 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|wxTE_RIGHT ); + 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|wxTE_RIGHT ); + 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|wxTE_RIGHT ); + 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|wxTE_RIGHT ); + 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|wxTE_RIGHT ); + 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_CENTRE|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 ); - - 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 ); + + 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() @@ -3698,130 +3731,130 @@ 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, 5, 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|wxEXPAND, 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, wxEXPAND|wxTOP|wxRIGHT, 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, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 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, 5, 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|wxEXPAND, 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, wxEXPAND|wxTOP|wxRIGHT, 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, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 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 ); + } SelectTimespanDlgGenerated::SelectTimespanDlgGenerated( 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* bSizer98; - bSizer98 = new wxBoxSizer( wxHORIZONTAL ); - - m_calendarFrom = new wxCalendarCtrl( this, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxCAL_SHOW_HOLIDAYS ); - bSizer98->Add( m_calendarFrom, 0, wxALL, 5 ); - - m_calendarTo = new wxCalendarCtrl( this, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxCAL_SHOW_HOLIDAYS ); - bSizer98->Add( m_calendarTo, 0, wxALL, 5 ); - - bSizer96->Add( bSizer98, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - wxBoxSizer* bSizer97; - bSizer97 = new wxBoxSizer( wxHORIZONTAL ); - - - bSizer97->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_buttonOkay = new wxButton( this, wxID_ANY, _("&OK"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonOkay->SetDefault(); - m_buttonOkay->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); - - bSizer97->Add( m_buttonOkay, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 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, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - - bSizer97->Add( 0, 0, 1, wxEXPAND, 5 ); - - bSizer96->Add( bSizer97, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - this->SetSizer( bSizer96 ); - this->Layout(); - bSizer96->Fit( this ); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SelectTimespanDlgGenerated::OnClose ) ); - m_calendarFrom->Connect( wxEVT_CALENDAR_SEL_CHANGED, wxCalendarEventHandler( SelectTimespanDlgGenerated::OnChangeSelectionFrom ), NULL, this ); - m_calendarTo->Connect( wxEVT_CALENDAR_SEL_CHANGED, wxCalendarEventHandler( SelectTimespanDlgGenerated::OnChangeSelectionTo ), NULL, this ); - m_buttonOkay->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SelectTimespanDlgGenerated::OnOkay ), NULL, this ); - m_button29->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SelectTimespanDlgGenerated::OnCancel ), NULL, this ); + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer96; + bSizer96 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer98; + bSizer98 = new wxBoxSizer( wxHORIZONTAL ); + + m_calendarFrom = new wxCalendarCtrl( this, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxCAL_SHOW_HOLIDAYS ); + bSizer98->Add( m_calendarFrom, 0, wxALL, 5 ); + + m_calendarTo = new wxCalendarCtrl( this, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxCAL_SHOW_HOLIDAYS ); + bSizer98->Add( m_calendarTo, 0, wxALL, 5 ); + + bSizer96->Add( bSizer98, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + wxBoxSizer* bSizer97; + bSizer97 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer97->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_buttonOkay = new wxButton( this, wxID_ANY, _("&OK"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonOkay->SetDefault(); + m_buttonOkay->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); + + bSizer97->Add( m_buttonOkay, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 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, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + bSizer97->Add( 0, 0, 1, wxEXPAND, 5 ); + + bSizer96->Add( bSizer97, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + this->SetSizer( bSizer96 ); + this->Layout(); + bSizer96->Fit( this ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SelectTimespanDlgGenerated::OnClose ) ); + m_calendarFrom->Connect( wxEVT_CALENDAR_SEL_CHANGED, wxCalendarEventHandler( SelectTimespanDlgGenerated::OnChangeSelectionFrom ), NULL, this ); + m_calendarTo->Connect( wxEVT_CALENDAR_SEL_CHANGED, wxCalendarEventHandler( SelectTimespanDlgGenerated::OnChangeSelectionTo ), NULL, this ); + m_buttonOkay->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SelectTimespanDlgGenerated::OnOkay ), NULL, this ); + m_button29->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SelectTimespanDlgGenerated::OnCancel ), NULL, this ); } SelectTimespanDlgGenerated::~SelectTimespanDlgGenerated() { - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SelectTimespanDlgGenerated::OnClose ) ); - m_calendarFrom->Disconnect( wxEVT_CALENDAR_SEL_CHANGED, wxCalendarEventHandler( SelectTimespanDlgGenerated::OnChangeSelectionFrom ), NULL, this ); - m_calendarTo->Disconnect( wxEVT_CALENDAR_SEL_CHANGED, wxCalendarEventHandler( SelectTimespanDlgGenerated::OnChangeSelectionTo ), NULL, this ); - m_buttonOkay->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SelectTimespanDlgGenerated::OnOkay ), NULL, this ); - m_button29->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SelectTimespanDlgGenerated::OnCancel ), NULL, this ); - + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SelectTimespanDlgGenerated::OnClose ) ); + m_calendarFrom->Disconnect( wxEVT_CALENDAR_SEL_CHANGED, wxCalendarEventHandler( SelectTimespanDlgGenerated::OnChangeSelectionFrom ), NULL, this ); + m_calendarTo->Disconnect( wxEVT_CALENDAR_SEL_CHANGED, wxCalendarEventHandler( SelectTimespanDlgGenerated::OnChangeSelectionTo ), NULL, this ); + m_buttonOkay->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SelectTimespanDlgGenerated::OnOkay ), NULL, this ); + m_button29->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SelectTimespanDlgGenerated::OnCancel ), NULL, this ); + } diff --git a/ui/gui_generated.h b/ui/gui_generated.h index 6a755d59..3d0d3daa 100644 --- a/ui/gui_generated.h +++ b/ui/gui_generated.h @@ -14,10 +14,12 @@ class CustomGridLeft; class CustomGridMiddle; class CustomGridRight; -class FfsDirPickerCtrl; class FolderHistoryBox; class ToggleButton; -class wxButtonWithImage; +class wxStaticText; +namespace zen{ class BitmapButton; } +namespace zen{ class DirPickerCtrl; } +namespace zen{ class Graph2D; } #include <wx/string.h> #include <wx/bitmap.h> @@ -46,7 +48,8 @@ class wxButtonWithImage; #include <wx/frame.h> #include <wx/choice.h> #include <wx/spinctrl.h> -#include <wx/notebook.h> +#include <wx/listbook.h> +#include <wx/listctrl.h> #include <wx/dialog.h> #include <wx/gauge.h> #include <wx/radiobut.h> @@ -55,7 +58,7 @@ class wxButtonWithImage; #include <wx/checklst.h> #include <wx/calctrl.h> -#include "../shared/i18n.h" +#include "../zen/i18n.h" /////////////////////////////////////////////////////////////////////////// @@ -63,955 +66,961 @@ 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; - wxBitmapButton* m_bpButtonAddPair; - wxPanel* m_panelTopMiddle; - wxBitmapButton* m_bpButtonSwapSides; - wxStaticBoxSizer* sbSizerDirRight; - 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 OnAddFolderPair( wxCommandEvent& event ) { event.Skip(); } - virtual void OnRemoveTopFolderPair( wxCommandEvent& event ) { event.Skip(); } - virtual void OnDirSelected( wxFileDirPickerEvent& event ) { event.Skip(); } - virtual void OnSwapSides( 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; - wxBitmapButton* m_bpButtonRemovePair; - FolderHistoryBox* m_directoryLeft; - FfsDirPickerCtrl* m_dirPickerLeft; - wxBitmapButton* m_bpButtonAltCompCfg; - wxBitmapButton* m_bpButtonLocalFilter; - wxBitmapButton* m_bpButtonAltSyncCfg; - wxPanel* m_panelTopRight; - FolderHistoryBox* m_directoryRight; - FfsDirPickerCtrl* 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; + zen::BitmapButton* m_buttonCompare; + wxButton* m_buttonAbort; + wxBitmapButton* m_bpButtonCmpConfig; + wxStaticText* m_staticTextSyncVariant; + wxBitmapButton* m_bpButtonSyncConfig; + zen::BitmapButton* m_buttonStartSync; + wxPanel* m_panelDirectoryPairs; + wxStaticBoxSizer* sbSizerDirLeft; + wxBitmapButton* m_bpButtonAddPair; + wxPanel* m_panelTopMiddle; + wxBitmapButton* m_bpButtonSwapSides; + wxStaticBoxSizer* sbSizerDirRight; + 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 OnAddFolderPair( wxCommandEvent& event ) { event.Skip(); } + virtual void OnRemoveTopFolderPair( wxCommandEvent& event ) { event.Skip(); } + virtual void OnDirSelected( wxFileDirPickerEvent& event ) { event.Skip(); } + virtual void OnSwapSides( 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; + wxBitmapButton* m_bpButtonRemovePair; + FolderHistoryBox* m_directoryLeft; + zen::DirPickerCtrl* m_dirPickerLeft; + wxBitmapButton* m_bpButtonAltCompCfg; + wxBitmapButton* m_bpButtonLocalFilter; + wxBitmapButton* m_bpButtonAltSyncCfg; + wxPanel* m_panelTopRight; + FolderHistoryBox* m_directoryRight; + zen::DirPickerCtrl* 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; - wxBitmapButton* m_bpButtonRemovePair; - FolderHistoryBox* m_directoryLeft; - FfsDirPickerCtrl* m_dirPickerLeft; - wxPanel* m_panel20; - wxBitmapButton* m_bpButtonAltCompCfg; - wxBitmapButton* m_bpButtonLocalFilter; - wxBitmapButton* m_bpButtonAltSyncCfg; - wxPanel* m_panelRight; - FolderHistoryBox* m_directoryRight; - FfsDirPickerCtrl* 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; + wxBitmapButton* m_bpButtonRemovePair; + FolderHistoryBox* m_directoryLeft; + zen::DirPickerCtrl* m_dirPickerLeft; + wxPanel* m_panel20; + wxBitmapButton* m_bpButtonAltCompCfg; + wxBitmapButton* m_bpButtonLocalFilter; + wxBitmapButton* m_bpButtonAltSyncCfg; + wxPanel* m_panelRight; + FolderHistoryBox* m_directoryRight; + zen::DirPickerCtrl* 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 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; - wxNotebook* m_notebookSettings; - wxPanel* m_panelOverview; - wxBitmapButton* m_bpButtonCmpConfig; - wxStaticText* m_staticTextCmpVariant; - wxBitmapButton* m_bpButtonFilter; - wxStaticText* m_staticTextSyncVariant; - wxBitmapButton* m_bpButtonSyncConfig; - wxChoice* m_choiceHandleError; - wxBoxSizer* sbSizerMainPair; - wxPanel* m_panelMainPair; - wxStaticText* m_staticText532; - wxStaticText* m_staticText5411; - wxBoxSizer* bSizerAddFolderPairs; - wxPanel* m_panelBatchSettings; - wxCheckBox* m_checkBoxSilent; - wxStaticBoxSizer* sbSizerLogfileDir; - wxStaticText* m_staticText96; - wxSpinCtrl* m_spinCtrlLogCountMax; - wxPanel* m_panelLogfile; - wxStaticText* m_staticText94; - wxTextCtrl* m_textCtrlLogfileDir; - FfsDirPickerCtrl* 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 OnChangeErrorHandling( wxCommandEvent& event ) { event.Skip(); } - virtual void OnAddFolderPair( wxCommandEvent& event ) { event.Skip(); } - virtual void OnRemoveTopFolderPair( 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; - FolderHistoryBox* m_directoryLeft; - FfsDirPickerCtrl* m_dirPickerLeft; - wxPanel* m_panelRight; - FolderHistoryBox* m_directoryRight; - FfsDirPickerCtrl* m_dirPickerRight; - wxBitmapButton* m_bpButtonAltCompCfg; - wxBitmapButton* m_bpButtonLocalFilter; - 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: + wxStaticBitmap* m_bitmap27; + wxPanel* m_panel8; + wxStaticText* m_staticText56; + wxStaticText* m_staticText44; + wxBitmapButton* m_bpButtonHelp; + wxListbook* m_listbook1; + wxPanel* m_panelOverview; + wxBitmapButton* m_bpButtonCmpConfig; + wxStaticText* m_staticTextCmpVariant; + wxBitmapButton* m_bpButtonFilter; + wxStaticText* m_staticTextSyncVariant; + wxBitmapButton* m_bpButtonSyncConfig; + wxChoice* m_choiceHandleError; + wxBoxSizer* sbSizerMainPair; + wxPanel* m_panelMainPair; + wxStaticText* m_staticText532; + wxStaticText* m_staticText5411; + wxBoxSizer* bSizerAddFolderPairs; + wxPanel* m_panelBatchSettings; + wxCheckBox* m_checkBoxSilent; + wxStaticBoxSizer* sbSizerLogfileDir; + wxStaticText* m_staticText96; + wxSpinCtrl* m_spinCtrlLogCountMax; + wxPanel* m_panelLogfile; + wxStaticText* m_staticText94; + zen::DirPickerCtrl* 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 OnChangeErrorHandling( wxCommandEvent& event ) { event.Skip(); } + virtual void OnAddFolderPair( wxCommandEvent& event ) { event.Skip(); } + virtual void OnRemoveTopFolderPair( 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; + FolderHistoryBox* m_directoryLeft; + zen::DirPickerCtrl* m_dirPickerLeft; + wxPanel* m_panelRight; + FolderHistoryBox* m_directoryRight; + zen::DirPickerCtrl* m_dirPickerRight; + wxBitmapButton* m_bpButtonAltCompCfg; + wxBitmapButton* m_bpButtonLocalFilter; + wxBitmapButton* m_bpButtonAltSyncCfg; + FolderHistoryBox* m_comboBoxLogfileDir; + + 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 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; - FolderHistoryBox* m_directoryLeft; - FfsDirPickerCtrl* m_dirPickerLeft; - FolderHistoryBox* m_directoryRight; - FfsDirPickerCtrl* m_dirPickerRight; - wxBitmapButton* m_bpButtonAltCompCfg; - wxBitmapButton* m_bpButtonLocalFilter; - 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; + FolderHistoryBox* m_directoryLeft; + zen::DirPickerCtrl* m_dirPickerLeft; + FolderHistoryBox* m_directoryRight; + zen::DirPickerCtrl* m_dirPickerRight; + wxBitmapButton* m_bpButtonAltCompCfg; + wxBitmapButton* m_bpButtonLocalFilter; + 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 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: + wxStaticText* m_staticText30; + wxTextCtrl* m_textCtrlStatus; + wxGauge* m_gauge2; + 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_staticTextRemTime; + wxBoxSizer* sSizerTimeElapsed; + wxStaticText* m_staticTextTimeElapsed; + + 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; - wxButton* m_buttonUpdate1; - wxStaticText* m_staticText9; - wxBoxSizer* bSizer201; - wxStaticBoxSizer* sbSizerErrorHandling; - wxChoice* m_choiceHandleError; - wxStaticBoxSizer* sbSizerCustDelDir; - wxChoice* m_choiceHandleDeletion; - wxPanel* m_panelCustomDeletionDir; - FolderHistoryBox* m_customDelFolder; - FfsDirPickerCtrl* m_dirPickerCustomDelFolder; - wxButton* m_buttonOK; - wxButton* m_button16; - wxStaticBitmap* m_bitmapDatabase; - wxBoxSizer* sbSizerSyncDirections; - wxStaticText* m_staticText21; - wxStaticText* m_staticText31; - wxStaticLine* m_staticline3; - wxBoxSizer* bSizerLeftOnly; - wxStaticBitmap* m_bitmapLeftOnly; - wxBitmapButton* m_bpButtonLeftOnly; - wxBoxSizer* bSizerRightOnly; - wxStaticBitmap* m_bitmapRightOnly; - wxBitmapButton* m_bpButtonRightOnly; - wxBoxSizer* bSizerLeftNewer; - wxStaticBitmap* m_bitmapLeftNewer; - wxBitmapButton* m_bpButtonLeftNewer; - wxBoxSizer* bSizerRightNewer; - wxStaticBitmap* m_bitmapRightNewer; - wxBitmapButton* m_bpButtonRightNewer; - wxBoxSizer* bSizerDifferent; - wxStaticBitmap* m_bitmapDifferent; - wxBitmapButton* m_bpButtonDifferent; - wxBoxSizer* bSizerConflict; - 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 OnSyncAutomaticDouble( wxMouseEvent& event ) { event.Skip(); } - virtual void OnSyncMirror( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSyncMirrorDouble( wxMouseEvent& event ) { event.Skip(); } - virtual void OnSyncUpdate( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSyncUpdateDouble( wxMouseEvent& event ) { event.Skip(); } - virtual void OnSyncCustom( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSyncCustomDouble( wxMouseEvent& 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; + wxButton* m_buttonUpdate1; + wxStaticText* m_staticText9; + wxBoxSizer* bSizer201; + wxStaticBoxSizer* sbSizerErrorHandling; + wxChoice* m_choiceHandleError; + wxStaticBoxSizer* sbSizerCustDelDir; + wxChoice* m_choiceHandleDeletion; + wxPanel* m_panelCustomDeletionDir; + FolderHistoryBox* m_customDelFolder; + zen::DirPickerCtrl* m_dirPickerCustomDelFolder; + wxButton* m_buttonOK; + wxButton* m_button16; + wxStaticBitmap* m_bitmapDatabase; + wxBoxSizer* sbSizerSyncDirections; + wxStaticText* m_staticText21; + wxStaticText* m_staticText31; + wxStaticLine* m_staticline3; + wxBoxSizer* bSizerLeftOnly; + wxStaticBitmap* m_bitmapLeftOnly; + wxBitmapButton* m_bpButtonLeftOnly; + wxBoxSizer* bSizerRightOnly; + wxStaticBitmap* m_bitmapRightOnly; + wxBitmapButton* m_bpButtonRightOnly; + wxBoxSizer* bSizerLeftNewer; + wxStaticBitmap* m_bitmapLeftNewer; + wxBitmapButton* m_bpButtonLeftNewer; + wxBoxSizer* bSizerRightNewer; + wxStaticBitmap* m_bitmapRightNewer; + wxBitmapButton* m_bpButtonRightNewer; + wxBoxSizer* bSizerDifferent; + wxStaticBitmap* m_bitmapDifferent; + wxBitmapButton* m_bpButtonDifferent; + wxBoxSizer* bSizerConflict; + 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 OnSyncAutomaticDouble( wxMouseEvent& event ) { event.Skip(); } + virtual void OnSyncMirror( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSyncMirrorDouble( wxMouseEvent& event ) { event.Skip(); } + virtual void OnSyncUpdate( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSyncUpdateDouble( wxMouseEvent& event ) { event.Skip(); } + virtual void OnSyncCustom( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSyncCustomDouble( wxMouseEvent& 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; - wxChoice* m_choiceHandleSymlinks; - wxBitmapButton* m_bpButtonHelp; - 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 OnTimeSizeDouble( wxMouseEvent& event ) { event.Skip(); } - virtual void OnContent( wxCommandEvent& event ) { event.Skip(); } - virtual void OnContentDouble( wxMouseEvent& event ) { event.Skip(); } - virtual void OnChangeErrorHandling( wxCommandEvent& event ) { event.Skip(); } - virtual void OnShowHelp( 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; + wxChoice* m_choiceHandleSymlinks; + wxBitmapButton* m_bpButtonHelp; + 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 OnTimeSizeDouble( wxMouseEvent& event ) { event.Skip(); } + virtual void OnContent( wxCommandEvent& event ) { event.Skip(); } + virtual void OnContentDouble( wxMouseEvent& event ) { event.Skip(); } + virtual void OnChangeErrorHandling( wxCommandEvent& event ) { event.Skip(); } + virtual void OnShowHelp( 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; - 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(); - + private: + + protected: + wxBoxSizer* bSizer27; + wxStaticBitmap* m_bitmapStatus; + wxStaticText* m_staticTextStatus; + wxAnimationCtrl* m_animationControl1; + wxBoxSizer* bSizerCurrentOperation; + wxStaticText* m_staticText2511; + wxTextCtrl* m_textCtrlInfo; + wxBoxSizer* bSizerHoldStretch; + wxBoxSizer* bSizerProgressMain; + wxStaticBoxSizer* bSizerProgressStat; + wxStaticText* m_staticTextItemsRem; + wxBoxSizer* bSizerItemsRem; + wxStaticText* m_staticTextRemainingObj; + wxStaticText* m_staticText96; + wxStaticText* m_staticTextDataRemaining; + wxStaticText* m_staticText97; + wxStaticText* m_staticTextSpeedDescr; + wxStaticText* m_staticTextSpeed; + wxStaticText* m_staticText55; + wxStaticText* m_staticTextTimeElapsed; + wxStaticText* m_staticTextRemTimeDescr; + wxStaticText* m_staticTextRemTime; + zen::Graph2D* m_panelGraph; + wxBoxSizer* bSizerFinalStat; + wxListbook* m_listbookResult; + wxStaticText* m_staticTextItemsProc; + wxBoxSizer* bSizerItemsProc; + wxStaticText* m_staticTextProcessedObj; + wxStaticText* m_staticText98; + wxStaticText* m_staticTextDataProcessed; + wxStaticText* m_staticText99; + wxStaticText* m_staticText551; + wxStaticText* m_staticTextTimeTotal; + wxBoxSizer* bSizer28; + wxButton* m_buttonOK; + wxButton* m_buttonPause; + wxButton* m_buttonAbort; + + // 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( 620,330 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); + + ~SyncStatusDlgGenerated(); + }; /////////////////////////////////////////////////////////////////////////////// /// Class LogControlGenerated /////////////////////////////////////////////////////////////////////////////// -class LogControlGenerated : public wxPanel +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(); - + 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 AboutDlgGenerated /////////////////////////////////////////////////////////////////////////////// -class AboutDlgGenerated : public wxDialog +class AboutDlgGenerated : public wxDialog { -private: - -protected: - wxPanel* m_panel5; - wxStaticBitmap* m_bitmap11; - wxStaticText* m_build; - wxPanel* m_panel33; - wxBoxSizer* bSizerCodeInfo; - wxStaticText* m_staticText72; - wxHyperlinkCtrl* m_hyperlink9; - wxHyperlinkCtrl* m_hyperlink11; - wxHyperlinkCtrl* m_hyperlink10; - wxHyperlinkCtrl* m_hyperlink13; - wxHyperlinkCtrl* m_hyperlink7; - wxHyperlinkCtrl* m_hyperlink16; - wxHyperlinkCtrl* m_hyperlink8; - wxHyperlinkCtrl* m_hyperlink15; - wxHyperlinkCtrl* m_hyperlink12; - wxHyperlinkCtrl* m_hyperlink18; - wxHyperlinkCtrl* m_hyperlink14; - 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(); - + private: + + protected: + wxPanel* m_panel5; + wxStaticBitmap* m_bitmap11; + wxStaticText* m_build; + wxPanel* m_panel33; + wxBoxSizer* bSizerCodeInfo; + wxStaticText* m_staticText72; + wxHyperlinkCtrl* m_hyperlink9; + wxHyperlinkCtrl* m_hyperlink11; + wxHyperlinkCtrl* m_hyperlink10; + wxHyperlinkCtrl* m_hyperlink13; + wxHyperlinkCtrl* m_hyperlink7; + wxHyperlinkCtrl* m_hyperlink16; + wxHyperlinkCtrl* m_hyperlink8; + wxHyperlinkCtrl* m_hyperlink15; + wxHyperlinkCtrl* m_hyperlink12; + wxHyperlinkCtrl* m_hyperlink18; + wxHyperlinkCtrl* m_hyperlink14; + 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 OnCheckBoxDontShowAgain( wxCommandEvent& 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 OnCheckBoxDontShowAgain( wxCommandEvent& 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; - wxStaticBitmap* m_bitmapInclude; - wxTextCtrl* m_textCtrlInclude; - wxStaticBitmap* m_bitmapExclude; - wxTextCtrl* m_textCtrlExclude; - wxStaticBitmap* m_bitmapFilterDate; - wxStaticText* m_staticText103; - wxChoice* m_choiceUnitTimespan; - wxSpinCtrl* m_spinCtrlTimespan; - wxStaticBitmap* m_bitmapFilterSize; - wxStaticText* m_staticText101; - wxSpinCtrl* m_spinCtrlMinSize; - wxChoice* m_choiceUnitMinSize; - wxStaticText* m_staticText102; - wxSpinCtrl* m_spinCtrlMaxSize; - wxChoice* m_choiceUnitMaxSize; - 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 OnUpdateNameFilter( wxCommandEvent& event ) { event.Skip(); } - virtual void OnUpdateChoice( 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; + wxStaticBitmap* m_bitmapInclude; + wxTextCtrl* m_textCtrlInclude; + wxStaticBitmap* m_bitmapExclude; + wxTextCtrl* m_textCtrlExclude; + wxStaticBitmap* m_bitmapFilterDate; + wxStaticText* m_staticText103; + wxChoice* m_choiceUnitTimespan; + wxSpinCtrl* m_spinCtrlTimespan; + wxStaticBitmap* m_bitmapFilterSize; + wxStaticText* m_staticText101; + wxSpinCtrl* m_spinCtrlMinSize; + wxChoice* m_choiceUnitMinSize; + wxStaticText* m_staticText102; + wxSpinCtrl* m_spinCtrlMaxSize; + wxChoice* m_choiceUnitMaxSize; + 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 OnUpdateNameFilter( wxCommandEvent& event ) { event.Skip(); } + virtual void OnUpdateChoice( 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_checkBoxTransCopy; - 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_checkBoxTransCopy; + wxCheckBox* m_checkBoxCopyLocked; + wxCheckBox* m_checkBoxCopyPermissions; + wxStaticLine* m_staticline10; + wxStaticText* m_staticText100; + zen::BitmapButton* 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: + zen::BitmapButton* 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(); + }; /////////////////////////////////////////////////////////////////////////////// /// Class SelectTimespanDlgGenerated /////////////////////////////////////////////////////////////////////////////// -class SelectTimespanDlgGenerated : public wxDialog +class SelectTimespanDlgGenerated : public wxDialog { -private: - -protected: - wxCalendarCtrl* m_calendarFrom; - wxCalendarCtrl* m_calendarTo; - wxButton* m_buttonOkay; - wxButton* m_button29; - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnChangeSelectionFrom( wxCalendarEvent& event ) { event.Skip(); } - virtual void OnChangeSelectionTo( wxCalendarEvent& event ) { event.Skip(); } - virtual void OnOkay( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } - - -public: - - SelectTimespanDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Select time span"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); - ~SelectTimespanDlgGenerated(); - + private: + + protected: + wxCalendarCtrl* m_calendarFrom; + wxCalendarCtrl* m_calendarTo; + wxButton* m_buttonOkay; + wxButton* m_button29; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } + virtual void OnChangeSelectionFrom( wxCalendarEvent& event ) { event.Skip(); } + virtual void OnChangeSelectionTo( wxCalendarEvent& event ) { event.Skip(); } + virtual void OnOkay( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } + + + public: + + SelectTimespanDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Select time span"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + ~SelectTimespanDlgGenerated(); + }; #endif //__GUI_GENERATED_H__ diff --git a/ui/gui_status_handler.cpp b/ui/gui_status_handler.cpp index 252fc80c..824c8084 100644 --- a/ui/gui_status_handler.cpp +++ b/ui/gui_status_handler.cpp @@ -9,9 +9,7 @@ #include "msg_popup.h" #include "main_dlg.h" #include <wx/wupdlock.h> -#include "../shared/global_func.h" -#include "../shared/string_conv.h" -#include "../shared/util.h" +#include <wx+/string_conv.h> using namespace zen; using namespace xmlAccess; diff --git a/ui/gui_status_handler.h b/ui/gui_status_handler.h index 1e86c0cc..28429d68 100644 --- a/ui/gui_status_handler.h +++ b/ui/gui_status_handler.h @@ -7,11 +7,11 @@ #ifndef GUISTATUSHANDLER_H_INCLUDED #define GUISTATUSHANDLER_H_INCLUDED -#include "../library/status_handler.h" +#include "../lib/status_handler.h" #include <wx/event.h> -#include "../library/error_log.h" +#include "../lib/error_log.h" #include "progress_indicator.h" -#include "../library/process_xml.h" +#include "../lib/process_xml.h" #include "main_dlg.h" class SyncStatus; diff --git a/ui/main_dlg.cpp b/ui/main_dlg.cpp index f03fd1f7..30d1a3b4 100644 --- a/ui/main_dlg.cpp +++ b/ui/main_dlg.cpp @@ -18,43 +18,42 @@ #include <wx/app.h> #include <wx/dcmemory.h> #include <boost/bind.hpp> -#include "../shared/folder_history_box.h" -#include "../library/custom_grid.h" -#include "../shared/custom_button.h" -#include "../shared/dir_picker_i18n.h" +#include "../lib/folder_history_box.h" +#include "../lib/custom_grid.h" +#include <wx+/button.h> +#include <wx+/dir_picker.h> #include "../comparison.h" #include "../synchronization.h" #include "../algorithm.h" -#include "../shared/app_main.h" -#include "../shared/util.h" +#include <wx+/app_main.h> +#include <wx+/format_unit.h> #include "check_version.h" #include "gui_status_handler.h" #include "sync_cfg.h" -#include "../shared/i18n.h" -#include "../shared/string_conv.h" +#include <wx+/string_conv.h> #include "small_dlgs.h" -#include "../shared/mouse_move_dlg.h" +#include <wx+/mouse_move_dlg.h> #include "progress_indicator.h" #include "msg_popup.h" -#include "../shared/dir_name.h" +#include "../lib/dir_name.h" #include "../structures.h" #include "grid_view.h" -#include "../library/resources.h" -#include "../shared/file_handling.h" -#include "../shared/resolve_path.h" -#include "../shared/recycler.h" -#include "../shared/standard_paths.h" -#include "../shared/toggle_button.h" +#include "../lib/resources.h" +#include <zen/file_handling.h> +#include <zen/file_id.h> +#include "../lib/resolve_path.h" +#include "../lib/recycler.h" +#include "../lib/ffs_paths.h" +#include <wx+/toggle_button.h> #include "folder_pair.h" -#include "../shared/global_func.h" #include "search.h" -#include "../shared/help_provider.h" +#include "../lib/help_provider.h" #include "batch_config.h" -#include "../shared/check_exist.h" -#include "../library/lock_holder.h" -#include "../shared/shell_execute.h" -#include "../shared/localization.h" -#include "../shared/image_tools.h" +#include <zen/thread.h> +#include "../lib/lock_holder.h" +#include <wx+/shell_execute.h> +#include "../lib/localization.h" +#include <wx+/image_tools.h> using namespace zen; using namespace std::rel_ops; @@ -300,20 +299,6 @@ private: }; -struct DirNotFound -{ - bool operator()(const FolderPairEnh& fp) const - { - const Zstring dirFmtLeft = zen::getFormattedDirectoryName(fp.leftDirectory); - const Zstring dirFmtRight = zen::getFormattedDirectoryName(fp.rightDirectory); - - if (dirFmtLeft.empty() && dirFmtRight.empty()) - return false; - - return !dirExists(dirFmtLeft) || !dirExists(dirFmtRight); - } -}; - #ifdef FFS_WIN class PanelMoveWindow : public MouseMoveWindow @@ -342,22 +327,36 @@ private: //################################################################################################################################## -MainDialog::MainDialog(const wxString& cfgFileName, xmlAccess::XmlGlobalSettings& settings) : +MainDialog::MainDialog(const std::vector<wxString>& cfgFileNames, xmlAccess::XmlGlobalSettings& settings) : MainDialogGenerated(NULL) { xmlAccess::XmlGuiConfig guiCfg; //structure to receive gui settings, already defaulted!! std::vector<wxString> filenames; - if (!cfgFileName.empty()) //1. this one has priority - filenames.push_back(cfgFileName); + if (!cfgFileNames.empty()) //1. this one has priority + filenames = cfgFileNames; else //next: use last used selection { filenames = settings.gui.lastUsedConfigFiles; //2. now try last used files + //------------------------------------------------------------------------------------------ + //check existence of all directories in parallel! + std::list<boost::unique_future<bool>> fileEx; + + std::for_each(filenames.begin(), filenames.end(), + [&fileEx](const wxString& filename) + { + const Zstring filenameFmt = toZ(filename); //convert to Zstring first: we don't want to pass wxString by value and risk MT issues! + fileEx.push_back(zen::async2<bool>([=]() { return !filenameFmt.empty() && zen::fileExists(filenameFmt); })); + }); + //potentially slow network access: give all checks 500ms to finish + wait_for_all_timed(fileEx.begin(), fileEx.end(), boost::posix_time::milliseconds(500)); + //------------------------------------------------------------------------------------------ + //check if one of the files is not existing (this shall not be an error!) - if (std::find_if(filenames.begin(), filenames.end(), - [](const wxString& filename) { return !fileExists(toZ(filename)); }) != filenames.end()) - filenames.clear(); + const bool allFilesExist = std::find_if(fileEx.begin(), fileEx.end(), [](boost::unique_future<bool>& ft) { return !ft.is_ready() || !ft.get(); }) == fileEx.end(); + if (!allFilesExist) + filenames.clear(); if (filenames.empty()) { @@ -382,7 +381,7 @@ MainDialog::MainDialog(const wxString& cfgFileName, xmlAccess::XmlGlobalSettings else wxMessageBox(error.msg(), _("Error"), wxOK | wxICON_ERROR); } - const bool startComparisonImmediately = loadCfgSuccess && !cfgFileName.empty(); + const bool startComparisonImmediately = !cfgFileNames.empty() && loadCfgSuccess; init(guiCfg, settings, @@ -392,7 +391,8 @@ MainDialog::MainDialog(const wxString& cfgFileName, xmlAccess::XmlGlobalSettings } -MainDialog::MainDialog(const xmlAccess::XmlGuiConfig& guiCfg, +MainDialog::MainDialog(const std::vector<wxString>& referenceFiles, + const xmlAccess::XmlGuiConfig& guiCfg, xmlAccess::XmlGlobalSettings& settings, bool startComparison) : MainDialogGenerated(NULL) @@ -401,7 +401,7 @@ MainDialog::MainDialog(const xmlAccess::XmlGuiConfig& guiCfg, settings, startComparison); - setLastUsedConfig(std::vector<wxString>(), guiCfg); + setLastUsedConfig(referenceFiles, guiCfg); } @@ -464,7 +464,7 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig guiCfg, wxAuiPaneInfo().Name(wxT("Panel4")).Bottom().Row(1).Position(0).Caption(_("Configuration")).MinSize(m_listBoxHistory->GetSize().GetWidth(), m_panelConfig->GetSize().GetHeight())); auiMgr.AddPane(m_panelFilter, - wxAuiPaneInfo().Name(wxT("Panel5")).Bottom().Row(1).Position(1).Caption(_("Filter files")).MinSize(-1, m_panelFilter->GetSize().GetHeight())); + wxAuiPaneInfo().Name(wxT("Panel5")).Bottom().Row(1).Position(1).Caption(_("Filter files")).MinSize(m_bpButtonFilter->GetSize().GetWidth(), m_panelFilter->GetSize().GetHeight())); auiMgr.AddPane(m_panelViewFilter, wxAuiPaneInfo().Name(wxT("Panel6")).Bottom().Row(1).Position(2).Caption(_("Select view")).MinSize(m_bpButtonSyncDirNone->GetSize().GetWidth(), m_panelViewFilter->GetSize().GetHeight())); @@ -510,10 +510,10 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig guiCfg, syncPreview.reset(new SyncPreview(this)); - SetIcon(*GlobalResources::instance().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 - zen::AppMainWindow::setMainWindow(this); + zen::setMainWindow(this); //init handling of first folder pair firstFolderPair.reset(new DirectoryPairFirst(*this)); @@ -596,13 +596,11 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig guiCfg, m_panelTopLeft->Connect(wxEVT_SIZE, wxEventHandler(MainDialog::OnResizeFolderPairs), NULL, this); //dynamically change sizer direction depending on size - //m_panelTopButtons->Connect(wxEVT_SIZE, wxEventHandler(MainDialog::OnResizeTopButtons), NULL, this); m_panelConfig ->Connect(wxEVT_SIZE, wxEventHandler(MainDialog::OnResizeConfigPanel), NULL, this); m_panelViewFilter->Connect(wxEVT_SIZE, wxEventHandler(MainDialog::OnResizeViewPanel), NULL, this); m_panelStatistics->Connect(wxEVT_SIZE, wxEventHandler(MainDialog::OnResizeStatisticsPanel), NULL, this); wxSizeEvent dummy3; - //OnResizeTopButtons (dummy3); //call once on window creation - OnResizeConfigPanel (dummy3); // + OnResizeConfigPanel (dummy3); //call once on window creation OnResizeViewPanel (dummy3); // OnResizeStatisticsPanel(dummy3); // @@ -630,17 +628,41 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig guiCfg, OnResizeFolderPairs(evtDummy); // //---------------------------------------------------------------------------------------------------------------------------------------------------------------- - //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 + //some convenience: if FFS is started with a *.ffs_gui file as commandline parameter AND all directories contained exist, comparison shall be started right away if (startComparison) { const zen::MainConfiguration currMainCfg = getConfig().mainCfg; - const bool allFoldersExist = !DirNotFound()(currMainCfg.firstPair) && - std::find_if(currMainCfg.additionalPairs.begin(), currMainCfg.additionalPairs.end(), - DirNotFound()) == currMainCfg.additionalPairs.end(); - if (allFoldersExist) + + //------------------------------------------------------------------------------------------ + //check existence of all directories in parallel! + std::list<boost::unique_future<bool>> dirEx; + + auto addDirCheck = [&dirEx](const FolderPairEnh& fp) { - wxCommandEvent dummy2(wxEVT_COMMAND_BUTTON_CLICKED); - m_buttonCompare->GetEventHandler()->AddPendingEvent(dummy2); //simulate button click on "compare" + const Zstring dirFmtLeft = zen::getFormattedDirectoryName(fp.leftDirectory); + const Zstring dirFmtRight = zen::getFormattedDirectoryName(fp.rightDirectory); + + if (dirFmtLeft.empty() && dirFmtRight.empty()) //only skip check if both sides are empty! + return; + + dirEx.push_back(zen::async2<bool>([=]() { return !dirFmtLeft .empty() && zen::dirExists(dirFmtLeft); })); + dirEx.push_back(zen::async2<bool>([=]() { return !dirFmtRight.empty() && zen::dirExists(dirFmtRight); })); + }; + addDirCheck(currMainCfg.firstPair); + std::for_each(currMainCfg.additionalPairs.begin(), currMainCfg.additionalPairs.end(), addDirCheck); + if (!dirEx.empty()) + { + //potentially slow network access: give all checks 500ms to finish + wait_for_all_timed(dirEx.begin(), dirEx.end(), boost::posix_time::milliseconds(500)); + //------------------------------------------------------------------------------------------ + + const bool allFoldersExist = std::find_if(dirEx.begin(), dirEx.end(), [](boost::unique_future<bool>& ft) { return !ft.is_ready() || !ft.get(); }) == dirEx.end(); + + if (allFoldersExist) + { + wxCommandEvent dummy2(wxEVT_COMMAND_BUTTON_CLICKED); + m_buttonCompare->GetEventHandler()->AddPendingEvent(dummy2); //simulate button click on "compare" + } } } //---------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -964,8 +986,8 @@ public: if (updateUiIsAllowed()) //test if specific time span between ui updates is over { - wxString statusMessage = _P("Object deleted successfully!", "%x objects deleted successfully!", deletionCount); - statusMessage.Replace(wxT("%x"), zen::toStringSep(deletionCount), false); + wxString statusMessage = replaceCpy(_P("Object deleted successfully!", "%x objects deleted successfully!", deletionCount), + L"%x", zen::toStringSep(deletionCount), false); if (mainDlg->m_staticTextStatusMiddle->GetLabel() != statusMessage) { @@ -1288,12 +1310,6 @@ void updateSizerOrientation(wxBoxSizer& sizer, wxWindow& window) } -/*void MainDialog::OnResizeTopButtons(wxEvent& event) -{ - updateSizerOrientation(*bSizerTopButtons, *m_panelTopButtons); - event.Skip(); -}*/ - void MainDialog::OnResizeConfigPanel(wxEvent& event) { updateSizerOrientation(*bSizerConfig, *m_panelConfig); @@ -1816,10 +1832,10 @@ void MainDialog::OnContextRim(wxGridEvent& event) //CONTEXT_EXCLUDE_EXT if (exFilterCandidateObj.size() > 0 && !exFilterCandidateObj.begin()->second) //non empty && no directory { - const Zstring filename = exFilterCandidateObj.begin()->first.AfterLast(FILE_NAME_SEPARATOR); + const Zstring filename = afterLast(exFilterCandidateObj.begin()->first, 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('.')); + const Zstring extension = afterLast(filename, Zchar('.')); //add context menu item wxMenuItem* menuItemExclExt = new wxMenuItem(contextMenu.get(), wxID_ANY, wxString(_("Exclude via filter:")) + " " + "*." + extension); @@ -1839,7 +1855,7 @@ void MainDialog::OnContextRim(wxGridEvent& event) //CONTEXT_EXCLUDE_OBJ wxMenuItem* menuItemExclObj = NULL; if (exFilterCandidateObj.size() == 1) - menuItemExclObj = new wxMenuItem(contextMenu.get(), wxID_ANY, wxString(_("Exclude via filter:")) + " " + exFilterCandidateObj.begin()->first.AfterLast(FILE_NAME_SEPARATOR)); + menuItemExclObj = new wxMenuItem(contextMenu.get(), wxID_ANY, wxString(_("Exclude via filter:")) + " " + afterLast(exFilterCandidateObj.begin()->first, FILE_NAME_SEPARATOR)); else if (exFilterCandidateObj.size() > 1) menuItemExclObj = new wxMenuItem(contextMenu.get(), wxID_ANY, wxString(_("Exclude via filter:")) + " " + _("<multiple selection>")); @@ -1871,7 +1887,7 @@ void MainDialog::OnContextRim(wxGridEvent& event) { //some trick to translate default external apps on the fly: 1. "open in explorer" 2. "start directly" //wxString description = wxGetTranslation(i->first); - wxString description = zen::translate(i->first.c_str()); + wxString description = zen::implementation::translate(i->first.c_str()); if (description.empty()) description = wxT(" "); //wxWidgets doesn't like empty items @@ -1920,7 +1936,7 @@ void MainDialog::OnContextExcludeExtension(wxCommandEvent& event) //add to filter config Zstring& excludeFilter = currentCfg.mainCfg.globalFilter.excludeFilter; - if (!excludeFilter.empty() && !excludeFilter.EndsWith(Zstr(";"))) + if (!excludeFilter.empty() && !endsWith(excludeFilter, Zstr(";"))) excludeFilter += Zstr("\n"); excludeFilter += newExclude + Zstr(";"); //';' is appended to 'mark' that next exclude extension entry won't write to new line @@ -1963,7 +1979,7 @@ void MainDialog::OnContextExcludeObject(wxCommandEvent& event) //add to filter config Zstring& excludeFilter = currentCfg.mainCfg.globalFilter.excludeFilter; - if (!excludeFilter.empty() && !excludeFilter.EndsWith(Zstr("\n"))) + if (!excludeFilter.empty() && !endsWith(excludeFilter, Zstr("\n"))) excludeFilter += Zstr("\n"); excludeFilter += newExclude; @@ -2488,14 +2504,31 @@ wxString getFormattedHistoryElement(const wxString& filename) void MainDialog::addFileToCfgHistory(const std::vector<wxString>& filenames) { + //check existence of all config files in parallel! + std::list<boost::unique_future<bool>> fileEx; + std::for_each(filenames.begin(), filenames.end(), + [&](const wxString& filename) + { + const Zstring file = toZ(filename); //convert to Zstring first: we don't want to pass wxString by value and risk MT issues! + fileEx.push_back(zen::async2<bool>([=]() { return zen::fileExists(file); })); + }); + + //potentially slow network access: give all checks 500ms to finish + wait_for_all_timed(fileEx.begin(), fileEx.end(), boost::posix_time::milliseconds(500)); + //------------------------------------------------------------------------------------------ + + std::deque<bool> selections(m_listBoxHistory->GetCount()); - std::for_each(filenames.begin(), filenames.end(), - [&](wxString filename) + auto futIter = fileEx.begin(); + for (auto iter = filenames.begin(); iter != filenames.end(); ++iter, ++futIter) { //only (still) existing files should be included in the list - if (util::fileExists(toZ(filename), 200) == util::EXISTING_FALSE) //potentially slow network access: wait 200ms - return; + if (futIter->is_ready() && !futIter->get()) + continue; + + const wxString& filename = *iter; + const Zstring file = toZ(filename); int posFound = -1; @@ -2507,7 +2540,7 @@ void MainDialog::addFileToCfgHistory(const std::vector<wxString>& filenames) const wxString& filenameTmp = cData->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(toZ(filename), toZ(filenameTmp))) + if (zen::samePhysicalFile(toZ(filename), toZ(filenameTmp))) { posFound = i; break; @@ -2521,14 +2554,14 @@ void MainDialog::addFileToCfgHistory(const std::vector<wxString>& filenames) { int newPos = -1; //the default config file should receive a different name on GUI - if (util::sameFileSpecified(toZ(lastRunConfigName()), toZ(filename))) + if (zen::samePhysicalFile(toZ(lastRunConfigName()), toZ(filename))) newPos = m_listBoxHistory->Append(_("<Last session>"), new wxClientDataString(filename)); else newPos = m_listBoxHistory->Append(getFormattedHistoryElement(filename), new wxClientDataString(filename)); selections.insert(selections.begin() + newPos, true); } - }); + } assert(selections.size() == m_listBoxHistory->GetCount()); @@ -2835,7 +2868,8 @@ void MainDialog::setLastUsedConfig(const wxString& filename, const xmlAccess::Xm } -void MainDialog::setLastUsedConfig(const std::vector<wxString>& filenames, const xmlAccess::XmlGuiConfig& guiConfig) +void MainDialog::setLastUsedConfig(const std::vector<wxString>& filenames, + const xmlAccess::XmlGuiConfig& guiConfig) { activeConfigFiles = filenames; lastConfigurationSaved = guiConfig; @@ -2875,8 +2909,8 @@ void MainDialog::setConfig(const xmlAccess::XmlGuiConfig& newGuiCfg) currentCfg.mainCfg.firstPair.altSyncConfig, currentCfg.mainCfg.firstPair.localFilter); - folderHistoryLeft->addItem(currentCfg.mainCfg.firstPair.leftDirectory); - folderHistoryRight->addItem(currentCfg.mainCfg.firstPair.rightDirectory); + //folderHistoryLeft->addItem(currentCfg.mainCfg.firstPair.leftDirectory); + //folderHistoryRight->addItem(currentCfg.mainCfg.firstPair.rightDirectory); //clear existing additional folder pairs clearAddFolderPairs(); @@ -3275,7 +3309,7 @@ void MainDialog::OnCompare(wxCommandEvent& event) const std::vector<zen::FolderPairCfg> cmpConfig = zen::extractCompareCfg(getConfig().mainCfg); //GUI mode: place directory locks on directories isolated(!) during both comparison and synchronization - LockHolder dummy2; + LockHolder dummy2(true); //allow pw prompt for (std::vector<FolderPairCfg>::const_iterator i = cmpConfig.begin(); i != cmpConfig.end(); ++i) { dummy2.addDir(i->leftDirectoryFmt, statusHandler); @@ -3285,6 +3319,7 @@ void MainDialog::OnCompare(wxCommandEvent& event) //begin comparison zen::CompareProcess compProc(globalSettings->fileTimeTolerance, globalSettings->optDialogs, + true, //allow pw prompt statusHandler); //technical representation of comparison data @@ -3373,7 +3408,7 @@ void MainDialog::updateStatistics() const wxString toCreate = zen::toStringSep(st.getCreate()); const wxString toUpdate = zen::toStringSep(st.getOverwrite()); const wxString toDelete = zen::toStringSep(st.getDelete()); - const wxString data = zen::formatFilesizeToShortString(st.getDataToProcess()); + const wxString data = zen::filesizeToShortString(st.getDataToProcess()); m_textCtrlCreate->SetValue(toCreate); m_textCtrlUpdate->SetValue(toUpdate); @@ -3487,12 +3522,12 @@ void MainDialog::OnStartSync(wxCommandEvent& event) wxString activeFileName = activeConfigFiles.size() == 1 && activeConfigFiles[0] != lastRunConfigName() ? activeConfigFiles[0] : wxString(); //class handling status updates and error messages - SyncStatusHandler statusHandler(this, currentCfg.handleError, zen::extractJobName(activeFileName)); + SyncStatusHandler statusHandler(this, currentCfg.handleError, xmlAccess::extractJobName(activeFileName)); FolderComparison& dataToSync = gridDataView->getDataTentative(); //GUI mode: place directory locks on directories isolated(!) during both comparison and synchronization - LockHolder dummy2; + LockHolder dummy2(true); //allow pw prompt for (auto i = begin(dataToSync); i != end(dataToSync); ++i) { @@ -3879,9 +3914,7 @@ void MainDialog::updateGridViewData() //show status information on "root" level. if (foldersOnLeftView) { - wxString tmp = _P("1 directory", "%x directories", foldersOnLeftView); - tmp.Replace(wxT("%x"), zen::toStringSep(foldersOnLeftView), false); - statusLeftNew += tmp; + statusLeftNew += replaceCpy(_P("1 directory", "%x directories", foldersOnLeftView), L"%x", zen::toStringSep(foldersOnLeftView), false); if (filesOnLeftView) statusLeftNew += wxT(" - "); @@ -3889,26 +3922,21 @@ void MainDialog::updateGridViewData() if (filesOnLeftView) { - wxString tmp = _P("1 file", "%x files", filesOnLeftView); - tmp.Replace(wxT("%x"), zen::toStringSep(filesOnLeftView), false); - statusLeftNew += tmp; - + statusLeftNew += replaceCpy(_P("1 file", "%x files", filesOnLeftView), L"%x", zen::toStringSep(filesOnLeftView), false); statusLeftNew += wxT(" - "); - statusLeftNew += zen::formatFilesizeToShortString(filesizeLeftView); + statusLeftNew += zen::filesizeToShortString(filesizeLeftView); } { wxString tmp = _P("%x of 1 row in view", "%x of %y rows in view", gridDataView->rowsTotal()); - tmp.Replace(wxT("%x"), toStringSep(gridDataView->rowsOnView()), false); - tmp.Replace(wxT("%y"), toStringSep(gridDataView->rowsTotal()), false); + replace(tmp, L"%x", toStringSep(gridDataView->rowsOnView()), false); + replace(tmp, L"%y", toStringSep(gridDataView->rowsTotal()), false); statusMiddleNew = tmp; } if (foldersOnRightView) { - wxString tmp = _P("1 directory", "%x directories", foldersOnRightView); - tmp.Replace(wxT("%x"), zen::toStringSep(foldersOnRightView), false); - statusRightNew += tmp; + statusRightNew += replaceCpy(_P("1 directory", "%x directories", foldersOnRightView), L"%x", zen::toStringSep(foldersOnRightView), false); if (filesOnRightView) statusRightNew += wxT(" - "); @@ -3916,12 +3944,9 @@ void MainDialog::updateGridViewData() if (filesOnRightView) { - wxString tmp = _P("1 file", "%x files", filesOnRightView); - tmp.Replace(wxT("%x"), zen::toStringSep(filesOnRightView), false); - statusRightNew += tmp; - + statusRightNew += replaceCpy(_P("1 file", "%x files", filesOnRightView), L"%x", zen::toStringSep(filesOnRightView), false); statusRightNew += wxT(" - "); - statusRightNew += zen::formatFilesizeToShortString(filesizeRightView); + statusRightNew += zen::filesizeToShortString(filesizeRightView); } @@ -4104,52 +4129,42 @@ void MainDialog::addFolderPair(const std::vector<FolderPairEnh>& newPairs, bool wxWindowUpdateLocker dummy(m_panelDirectoryPairs); //avoid display distortion wxWindowUpdateLocker dummy2(m_panelGrids); // - if (!newPairs.empty()) + std::for_each(newPairs.begin(), newPairs.end(), + [&](const FolderPairEnh& enhPair) { - for (std::vector<FolderPairEnh>::const_iterator i = newPairs.begin(); i != newPairs.end(); ++i) - { - //add new folder pair - DirectoryPair* newPair = new DirectoryPair(m_scrolledWindowFolderPairs, *this); - - //init dropdown history - newPair->m_directoryLeft ->init(folderHistoryLeft); - newPair->m_directoryRight->init(folderHistoryRight); - - //set width of left folder panel - const int width = m_panelTopLeft->GetSize().GetWidth(); - newPair->m_panelLeft->SetMinSize(wxSize(width, -1)); + //add new folder pair + DirectoryPair* newPair = new DirectoryPair(m_scrolledWindowFolderPairs, *this); + //init dropdown history + newPair->m_directoryLeft ->init(folderHistoryLeft); + newPair->m_directoryRight->init(folderHistoryRight); - if (addFront) - { - bSizerAddFolderPairs->Insert(0, newPair, 0, wxEXPAND, 5); - additionalFolderPairs.insert(additionalFolderPairs.begin(), newPair); - } - else - { - bSizerAddFolderPairs->Add(newPair, 0, wxEXPAND, 5); - additionalFolderPairs.push_back(newPair); - } + //set width of left folder panel + const int width = m_panelTopLeft->GetSize().GetWidth(); + newPair->m_panelLeft->SetMinSize(wxSize(width, -1)); - //register events - newPair->m_bpButtonRemovePair->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MainDialog::OnRemoveFolderPair), NULL, this); - //set alternate configuration - newPair->setValues(toWx(i->leftDirectory), - toWx(i->rightDirectory), - i->altCmpConfig, - i->altSyncConfig, - i->localFilter); + if (addFront) + { + bSizerAddFolderPairs->Insert(0, newPair, 0, wxEXPAND, 5); + additionalFolderPairs.insert(additionalFolderPairs.begin(), newPair); + } + else + { + bSizerAddFolderPairs->Add(newPair, 0, wxEXPAND, 5); + additionalFolderPairs.push_back(newPair); } - //set size of scrolled window - //m_scrolledWindowFolderPairs->SetMinSize(wxSize( -1, pairHeight * static_cast<int>(visiblePairs))); + //register events + newPair->m_bpButtonRemovePair->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MainDialog::OnRemoveFolderPair), NULL, this); - //update controls - // m_scrolledWindowFolderPairs->Fit(); //adjust scrolled window size - // m_scrolledWindowFolderPairs->Layout(); //adjust stuff inside scrolled window - //bSizer1->Layout(); - } + //set alternate configuration + newPair->setValues(toWx(enhPair.leftDirectory), + toWx(enhPair.rightDirectory), + enhPair.altCmpConfig, + enhPair.altSyncConfig, + enhPair.localFilter); + }); updateGuiForFolderPair(); @@ -4422,11 +4437,12 @@ void MainDialog::switchProgramLanguage(const int langID) zen::setLanguage(langID); //language is a global attribute const xmlAccess::XmlGuiConfig currentGuiCfg = getConfig(); + auto activeFiles = activeConfigFiles; cleanUp(false); //destructor's code: includes updating global settings //create new main window and delete old one - MainDialog* frame = new MainDialog(currentGuiCfg, *globalSettings, false); + MainDialog* frame = new MainDialog(activeFiles, currentGuiCfg, *globalSettings, false); frame->Show(); Destroy(); diff --git a/ui/main_dlg.h b/ui/main_dlg.h index 2179cdf5..94edbcce 100644 --- a/ui/main_dlg.h +++ b/ui/main_dlg.h @@ -7,14 +7,14 @@ #ifndef MAINDIALOG_H #define MAINDIALOG_H -#include "gui_generated.h" -#include <stack> -#include "../library/process_xml.h" #include <memory> #include <map> #include <set> #include <wx/aui/aui.h> -#include "../shared/int64.h" +#include <zen/int64.h> +#include <stack> +#include "gui_generated.h" +#include "../lib/process_xml.h" class FolderHistory; class CustomGrid; @@ -38,10 +38,11 @@ class GridView; class MainDialog : public MainDialogGenerated { public: - MainDialog(const wxString& cfgFileName, + MainDialog(const std::vector<wxString>& cfgFileNames, //default behavior, application start xmlAccess::XmlGlobalSettings& settings); - MainDialog(const xmlAccess::XmlGuiConfig& guiCfg, + MainDialog(const std::vector<wxString>& referenceFiles, + const xmlAccess::XmlGuiConfig& guiCfg, xmlAccess::XmlGlobalSettings& settings, bool startComparison); @@ -204,7 +205,6 @@ private: void refreshGridAfterFilterChange(int delay); void OnResize( wxSizeEvent& event); - //void OnResizeTopButtons( wxEvent& event); void OnResizeFolderPairs( wxEvent& event); void OnResizeConfigPanel( wxEvent& event); void OnResizeViewPanel( wxEvent& event); diff --git a/ui/msg_popup.cpp b/ui/msg_popup.cpp index 9e0e0111..a59c77ef 100644 --- a/ui/msg_popup.cpp +++ b/ui/msg_popup.cpp @@ -5,8 +5,8 @@ // ************************************************************************** #include "msg_popup.h" -#include "../library/resources.h" -#include "../shared/mouse_move_dlg.h" +#include "../lib/resources.h" +#include <wx+/mouse_move_dlg.h> #include "gui_generated.h" @@ -265,7 +265,6 @@ void QuestionDlg::OnCheckBoxDontShowAgain(wxCommandEvent& event) } - ReturnQuestionDlg::ButtonPressed zen::showQuestionDlg(int activeButtons, const wxString& messageText, bool* dontShowAgain) { QuestionDlg qtnDlg(NULL, activeButtons, messageText, dontShowAgain); diff --git a/ui/msg_popup.h b/ui/msg_popup.h index b6e1a1a7..f6e36f36 100644 --- a/ui/msg_popup.h +++ b/ui/msg_popup.h @@ -9,7 +9,6 @@ #include <wx/string.h> - namespace zen { struct ReturnErrorDlg diff --git a/ui/progress_indicator.cpp b/ui/progress_indicator.cpp index 7da143a1..4102db9d 100644 --- a/ui/progress_indicator.cpp +++ b/ui/progress_indicator.cpp @@ -8,19 +8,20 @@ #include <memory> #include "gui_generated.h" #include <wx/stopwatch.h> -#include "../library/resources.h" -#include "../shared/string_conv.h" -#include "../shared/util.h" -#include "../library/statistics.h" +#include "../lib/resources.h" +#include <wx+/string_conv.h> +#include <wx+/format_unit.h> +#include "../lib/statistics.h" #include <wx/wupdlock.h> -#include "../shared/global_func.h" +#include <zen/basic_math.h> #include "tray_icon.h" #include <memory> -#include "../shared/mouse_move_dlg.h" -#include "../library/error_log.h" -#include "../shared/toggle_button.h" -#include "../shared/taskbar.h" -#include "../shared/image_tools.h" +#include <wx+/mouse_move_dlg.h> +#include "../lib/error_log.h" +#include <wx+/toggle_button.h> +#include "taskbar.h" +#include <wx+/image_tools.h> +#include <wx+/graph.h> using namespace zen; @@ -94,10 +95,11 @@ private: CurrentStatus status; - std::unique_ptr<util::Taskbar> taskbar_; + std::unique_ptr<Taskbar> taskbar_; //remaining time std::unique_ptr<Statistics> statistics; + long lastStatCallSpeed; //used for calculating intervals between statistics update long lastStatCallRemTime; // }; @@ -175,9 +177,9 @@ void CompareStatus::CompareStatusImpl::init() try //try to get access to Windows 7/Ubuntu taskbar { - taskbar_.reset(new util::Taskbar(parentWindow_)); + taskbar_.reset(new Taskbar(parentWindow_)); } - catch (const util::TaskbarNotAvailable&) {} + catch (const TaskbarNotAvailable&) {} status = SCANNING; @@ -271,7 +273,6 @@ void CompareStatus::CompareStatusImpl::showProgressExternally(const wxString& pr parentWindow_.SetTitle(progressText); //show progress on Windows 7 taskbar - using namespace util; if (taskbar_.get()) switch (status) @@ -304,32 +305,32 @@ void CompareStatus::CompareStatusImpl::updateStatusPanelNow() showProgressExternally(toStringSep(scannedObjects) + wxT(" - ") + _("Scanning...")); break; case COMPARING_CONTENT: - showProgressExternally(formatPercentage(fraction) + wxT(" - ") + _("Comparing content..."), fraction); + showProgressExternally(percentageToShortString(fraction) + wxT(" - ") + _("Comparing content..."), fraction); break; } bool updateLayout = false; //avoid screen flicker by calling layout() only if necessary //remove linebreaks from currentStatusText - wxString formattedStatusText = currentStatusText; - replace(formattedStatusText, L'\n', L' '); + wxString statusTextFmt = currentStatusText; + replace(statusTextFmt, L'\n', L' '); //status texts - if (m_textCtrlStatus->GetValue() != formattedStatusText) //no layout update for status texts! - m_textCtrlStatus->ChangeValue(formattedStatusText); + if (m_textCtrlStatus->GetValue() != statusTextFmt) //no layout update for status texts! + m_textCtrlStatus->ChangeValue(statusTextFmt); //nr of scanned objects setNewText(toStringSep(scannedObjects), *m_staticTextScanned, updateLayout); //progress indicator for "compare file content" - m_gauge2->SetValue(common::round(fraction * GAUGE_FULL_RANGE)); + m_gauge2->SetValue(numeric::round(fraction * GAUGE_FULL_RANGE)); //remaining files left for file comparison const wxString filesToCompareTmp = toStringSep(totalObjects - currentObjects); setNewText(filesToCompareTmp, *m_staticTextFilesRemaining, updateLayout); //remaining bytes left for file comparison - const wxString remainingBytesTmp = zen::formatFilesizeToShortString(to<zen::UInt64>(totalData - currentData)); + const wxString remainingBytesTmp = zen::filesizeToShortString(to<zen::UInt64>(totalData - currentData)); setNewText(remainingBytesTmp, *m_staticTextDataRemaining, updateLayout); if (statistics.get()) @@ -348,7 +349,7 @@ void CompareStatus::CompareStatusImpl::updateStatusPanelNow() lastStatCallRemTime = timeElapsed.Time(); //remaining time - setNewText(statistics->getRemainingTime(), *m_staticTextTimeRemaining, updateLayout); + setNewText(statistics->getRemainingTime(), *m_staticTextRemTime, updateLayout); } } } @@ -479,6 +480,110 @@ private: //######################################################################################## +namespace +{ +class GraphDataBytes : public GraphData +{ +public: + void addCurrentValue(double dataCurrent) + { + data.insert(data.end(), std::make_pair(timer.Time(), dataCurrent)); + //documentation differs about whether "hint" should be before or after the to be inserted element! + //however "std::map<>::end()" is interpreted correctly by GCC and VS2010 + + if (data.size() > MAX_BUFFER_SIZE) //guard against too large a buffer + data.erase(data.begin()); + } + + void pauseTimer () { timer.Pause(); } + void resumeTimer() { timer.Resume(); } + +private: + static const size_t MAX_BUFFER_SIZE = 2500000; //sizeof(single node) worst case ~ 3 * 8 byte ptr + 16 byte key/value = 40 byte + + virtual double getValue(double x) const //x: seconds since begin + { + auto iter = data.lower_bound(x * 1000); + if (iter == data.end()) + return data.empty() ? 0 : (--data.end())->second; + return iter->second; + } + virtual double getXBegin() const { return 0; } //{ return data.empty() ? 0 : data.begin()->first / 1000.0; } + virtual double getXEnd () const { return data.empty() ? 0 : (--data.end())->first / 1000.0; } + //example: two-element range is accessible within [0, 2) + + wxStopWatch timer; + std::map<long, double> data; +}; + + +struct LabelFormatterBytes : public LabelFormatter +{ + virtual double getOptimalBlockSize(double bytesProposed) const + { + //round to next number which is a convenient to read block size + if (bytesProposed <= 0) + return 0; + + const double k = std::floor(std::log(bytesProposed) / std::log(2.0)); + const double e = std::pow(2.0, k); + const double a = bytesProposed / e; //bytesProposed = a * 2^k with a in (1, 2) + return (a < 1.5 ? 1 : 2) * e; + } + + virtual wxString formatText(double value, double optimalBlockSize) const { return filesizeToShortString(UInt64(value)); }; +}; + + +inline +double bestFit(double val, double low, double high) { return val < (high + low) / 2 ? low : high; } + + +struct LabelFormatterTimeElapsed : public LabelFormatter +{ + virtual double getOptimalBlockSize(double secProposed) const + { + if (secProposed <= 5) + return 5; //minimum block size + + //for seconds and minutes: nice numbers are 1, 5, 10, 15, 20, 30 + auto calcBlock = [](double val) -> double + { + if (val <= 5) + return bestFit(val, 1, 5); // + if (val <= 10) + return bestFit(val, 5, 10); // a good candidate for a variadic template! + if (val <= 15) + return bestFit(val, 10, 15); // + if (val <= 20) + return bestFit(val, 15, 20); + if (val <= 30) + return bestFit(val, 20, 30); + return bestFit(val, 30, 60); + }; + + if (secProposed <= 60) + return calcBlock(secProposed); + else if (secProposed <= 3600) + return calcBlock(secProposed / 60) * 60; + else if (secProposed <= 3600 * 24) + return nextNiceNumber(secProposed / 3600) * 3600; + else + return nextNiceNumber(secProposed / (24 * 3600)) * 24 * 3600; //round up to full days + } + + virtual wxString formatText(double timeElapsed, double optimalBlockSize) const + { + return timeElapsed < 60 ? + remainingTimeToShortString(timeElapsed) : + timeElapsed < 3600 ? + wxTimeSpan::Seconds(timeElapsed).Format( L"%M:%S") : + wxTimeSpan::Seconds(timeElapsed).Format(L"%H:%M:%S"); + } +}; +} + + class SyncStatus::SyncStatusImpl : public SyncStatusDlgGenerated { public: @@ -529,13 +634,15 @@ private: bool processPaused; SyncStatus::SyncStatusID currentStatus; - std::unique_ptr<util::Taskbar> taskbar_; + std::unique_ptr<Taskbar> taskbar_; //remaining time std::unique_ptr<Statistics> statistics; long lastStatCallSpeed; //used for calculating intervals between statistics update long lastStatCallRemTime; // + std::shared_ptr<GraphDataBytes> graphDataBytes; + wxString titelTextBackup; std::unique_ptr<FfsTrayIcon> trayIcon; //optional: if filled all other windows should be hidden and conversely @@ -610,6 +717,19 @@ void SyncStatus::processHasFinished(SyncStatusID id, const ErrorLogging& log) } //######################################################################################## +namespace +{ +void fitHeight(wxTopLevelWindow& wnd) +{ + if (wnd.IsMaximized()) + return; + //Fit() height only: + int width = wnd.GetSize().GetWidth(); + wnd.Fit(); + int height = wnd.GetSize().GetHeight(); + wnd.SetSize(wxSize(width, height)); +} +} SyncStatus::SyncStatusImpl::SyncStatusImpl(AbortCallback& abortCb, MainDialog* parentWindow, @@ -618,7 +738,7 @@ SyncStatus::SyncStatusImpl::SyncStatusImpl(AbortCallback& abortCb, SyncStatusDlgGenerated(parentWindow, wxID_ANY, parentWindow ? wxString(wxEmptyString) : (wxString(wxT("FreeFileSync - ")) + _("Folder Comparison and Synchronization")), - wxDefaultPosition, wxSize(638, 350), + wxDefaultPosition, wxSize(620, 330), parentWindow ? wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL | wxFRAME_NO_TASKBAR | wxFRAME_FLOAT_ON_PARENT : //wxTAB_TRAVERSAL is needed for standard button handling: wxID_OK/wxID_CANCEL wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL), @@ -642,11 +762,11 @@ SyncStatus::SyncStatusImpl::SyncStatusImpl(AbortCallback& abortCb, if (mainDialog) //save old title (will be used as progress indicator) titelTextBackup = mainDialog->GetTitle(); - m_animationControl1->SetAnimation(*GlobalResources::instance().animationSync); + m_animationControl1->SetAnimation(GlobalResources::instance().animationSync); m_animationControl1->Play(); m_staticTextSpeed->SetLabel(wxT("-")); - m_staticTextTimeRemaining->SetLabel(wxT("-")); + m_staticTextRemTime->SetLabel(wxT("-")); //initialize gauge m_gauge1->SetRange(GAUGE_FULL_RANGE); @@ -665,20 +785,29 @@ SyncStatus::SyncStatusImpl::SyncStatusImpl(AbortCallback& abortCb, try //try to get access to Windows 7/Ubuntu taskbar { - taskbar_.reset(new util::Taskbar(mainDialog != NULL ? *static_cast<wxTopLevelWindow*>(mainDialog) : *this)); + taskbar_.reset(new Taskbar(mainDialog != NULL ? *static_cast<wxTopLevelWindow*>(mainDialog) : *this)); } - catch (const util::TaskbarNotAvailable&) {} + catch (const TaskbarNotAvailable&) {} //hide "processed" statistics until end of process - bSizerObjectsProcessed->Show(false); - //bSizerDataProcessed->Show(false); + bSizerFinalStat->Show(false); - SetIcon(*GlobalResources::instance().programIcon); //set application icon + SetIcon(GlobalResources::instance().programIcon); //set application icon //register key event Connect(wxEVT_CHAR_HOOK, wxKeyEventHandler(SyncStatusImpl::OnKeyPressed), NULL, this); setCurrentStatus(startStatus); //first state: will be shown while waiting for dir locks (if at all) + + //init graph + graphDataBytes = std::make_shared<GraphDataBytes>(); + m_panelGraph->setAttributes(Graph2D::GraphAttributes(). + setLabelX(Graph2D::X_LABEL_BOTTOM, 20, std::make_shared<LabelFormatterTimeElapsed>()). + setLabelY(Graph2D::Y_LABEL_RIGHT, 60, std::make_shared<LabelFormatterBytes>())); + m_panelGraph->setData(graphDataBytes, Graph2D::LineAttributes().setLineWidth(2).setColor(wxColor(0, 192, 0))); //medium green + + //Fit() height only: + //fitHeight(*this); } @@ -747,6 +876,9 @@ void SyncStatus::SyncStatusImpl::incProgressIndicator_NoUpdate(int objectsProces currentData += dataProcessed; currentObjects += objectsProcessed; + + //update graph data + graphDataBytes->addCurrentValue(to<double>(currentData)); } @@ -782,7 +914,6 @@ void SyncStatus::SyncStatusImpl::showProgressExternally(const wxString& progress this->SetTitle(progressTextFmt); } - using namespace util; //show progress on Windows 7 taskbar if (taskbar_.get()) @@ -811,6 +942,7 @@ void SyncStatus::SyncStatusImpl::showProgressExternally(const wxString& progress } } + #ifdef FFS_WIN namespace { @@ -818,7 +950,7 @@ enum Zorder { ZORDER_CORRECT, ZORDER_WRONG, - ZORDER_INDEFIINTE, + ZORDER_INDEFINITE, }; Zorder validateZorder(const wxWindow& top, const wxWindow& bottom) @@ -835,11 +967,12 @@ Zorder validateZorder(const wxWindow& top, const wxWindow& bottom) if (hAbove == hBottom) return ZORDER_WRONG; - return ZORDER_INDEFIINTE; + return ZORDER_INDEFINITE; } } #endif + void SyncStatus::SyncStatusImpl::updateStatusDialogNow(bool allowYield) { //static RetrieveStatistics statistic; @@ -857,13 +990,13 @@ void SyncStatus::SyncStatusImpl::updateStatusDialogNow(bool allowYield) showProgressExternally(toStringSep(scannedObjects) + wxT(" - ") + _("Scanning...") + postFix); break; case SyncStatus::COMPARING_CONTENT: - showProgressExternally(formatPercentage(fraction) + wxT(" - ") + _("Comparing content...") + postFix, fraction); + showProgressExternally(percentageToShortString(fraction) + wxT(" - ") + _("Comparing content...") + postFix, fraction); break; case SyncStatus::SYNCHRONIZING: - showProgressExternally(formatPercentage(fraction) + wxT(" - ") + _("Synchronizing...") + postFix, fraction); + showProgressExternally(percentageToShortString(fraction) + wxT(" - ") + _("Synchronizing...") + postFix, fraction); break; case SyncStatus::PAUSE: - showProgressExternally(formatPercentage(fraction) + wxT(" - ") + _("Paused") + postFix, fraction); + showProgressExternally(percentageToShortString(fraction) + wxT(" - ") + _("Paused") + postFix, fraction); break; case SyncStatus::ABORTED: showProgressExternally(_("Aborted") + postFix, fraction); @@ -891,24 +1024,29 @@ void SyncStatus::SyncStatusImpl::updateStatusDialogNow(bool allowYield) case SyncStatus::FINISHED_WITH_SUCCESS: case SyncStatus::FINISHED_WITH_ERROR: case SyncStatus::ABORTED: - m_gauge1->SetValue(common::round(fraction * GAUGE_FULL_RANGE)); + m_gauge1->SetValue(numeric::round(fraction * GAUGE_FULL_RANGE)); break; case SyncStatus::PAUSE: //no change to gauge: don't switch between indeterminate/determinate modus break; } + + wxString statusTextFmt = currentStatusText; //remove linebreaks + replace(statusTextFmt, L'\n', L' '); // + //status text - if (m_textCtrlInfo->GetValue() != currentStatusText) //no layout update for status texts! - m_textCtrlInfo->ChangeValue(currentStatusText); + if (m_textCtrlInfo->GetValue() != statusTextFmt) //no layout update for status texts! + m_textCtrlInfo->ChangeValue(statusTextFmt); //remaining objects const wxString remainingObjTmp = toStringSep(totalObjects - currentObjects); setNewText(remainingObjTmp, *m_staticTextRemainingObj, updateLayout); //remaining bytes left for copy - const wxString remainingBytesTmp = zen::formatFilesizeToShortString(to<zen::UInt64>(totalData - currentData)); + const wxString remainingBytesTmp = zen::filesizeToShortString(to<zen::UInt64>(totalData - currentData)); setNewText(remainingBytesTmp, *m_staticTextDataRemaining, updateLayout); + //statistics if (statistics.get()) { if (timeElapsed.Time() - lastStatCallSpeed >= 500) //call method every 500 ms @@ -925,19 +1063,24 @@ void SyncStatus::SyncStatusImpl::updateStatusDialogNow(bool allowYield) lastStatCallRemTime = timeElapsed.Time(); //remaining time - setNewText(statistics->getRemainingTime(), *m_staticTextTimeRemaining, updateLayout); + setNewText(statistics->getRemainingTime(), *m_staticTextRemTime, updateLayout); } } } + m_panelGraph->Refresh(); + //time elapsed - setNewText(wxTimeSpan::Milliseconds(timeElapsed.Time()).Format(), *m_staticTextTimeElapsed, updateLayout); + const int timeElapSec = timeElapsed.Time() / 1000; + setNewText(timeElapSec < 3600 ? + wxTimeSpan::Seconds(timeElapSec).Format( L"%M:%S") : + wxTimeSpan::Seconds(timeElapSec).Format(L"%H:%M:%S"), *m_staticTextTimeElapsed, updateLayout); //do the ui update if (updateLayout) { - bSizer28->Layout(); - bSizer31->Layout(); + bSizerProgressStat->Layout(); + bSizerProgressMain->Layout(); } } @@ -962,6 +1105,7 @@ void SyncStatus::SyncStatusImpl::updateStatusDialogNow(bool allowYield) if (processPaused) { if (statistics.get()) statistics->pauseTimer(); + graphDataBytes->pauseTimer(); while (processPaused && currentProcessIsRunning()) { @@ -970,6 +1114,7 @@ void SyncStatus::SyncStatusImpl::updateStatusDialogNow(bool allowYield) } if (statistics.get()) statistics->resumeTimer(); + graphDataBytes->resumeTimer(); } /* @@ -1059,30 +1204,38 @@ void SyncStatus::SyncStatusImpl::processHasFinished(SyncStatus::SyncStatusID id, m_animationControl1->Stop(); m_animationControl1->Hide(); - //hide speed and remaining time - bSizerSpeed ->Show(false); - bSizerRemTime->Show(false); + //hide current operation status + bSizerCurrentOperation->Show(false); - //if everything was processed successfully, hide remaining statistics (is 0 anyway) - if (totalObjects == currentObjects && - totalData == currentData) - { - bSizerObjectsRemaining->Show(false); + //hide progress statistics + bSizerProgressMain->Show(false); - bSizerObjectsProcessed->Show(true); + //show and prepare final statistics + bSizerFinalStat->Show(true); + m_staticTextProcessedObj->SetLabel(toStringSep(currentObjects)); + m_staticTextDataProcessed->SetLabel(zen::filesizeToShortString(to<zen::UInt64>(currentData))); - m_staticTextProcessedObj->SetLabel(toStringSep(currentObjects)); - m_staticTextDataProcessed->SetLabel(zen::formatFilesizeToShortString(to<zen::UInt64>(currentData))); - } + m_staticTextTimeTotal->SetLabel(m_staticTextTimeElapsed->GetLabel()); + + // if (totalObjects == currentObjects && ->if everything was processed successfully + // totalData == currentData) + // ; updateStatusDialogNow(false); //keep this sequence to avoid display distortion, if e.g. only 1 item is sync'ed - //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); + //fill result listbox: + //1. log file + LogControl* logControl = new LogControl(m_listbookResult, log); + m_listbookResult->AddPage(logControl, _("Logging"), true); + //bSizerHoldStretch->Insert(0, logControl, 1, wxEXPAND); + + //2. re-arrange graph into results listbook + bSizerProgressMain->Detach(m_panelGraph); + m_panelGraph->Reparent(m_listbookResult); + m_listbookResult->AddPage(m_panelGraph, _("Statistics"), false); - Layout(); // + //fitHeight(*this); + Layout(); //Raise(); -> don't! user may be watching a movie in the meantime ;) } diff --git a/ui/progress_indicator.h b/ui/progress_indicator.h index 71a975f6..a9e5f64b 100644 --- a/ui/progress_indicator.h +++ b/ui/progress_indicator.h @@ -7,9 +7,9 @@ #ifndef PROGRESSINDICATOR_H_INCLUDED #define PROGRESSINDICATOR_H_INCLUDED -#include "../shared/zstring.h" +#include <zen/zstring.h> #include <wx/toplevel.h> -#include "../library/status_handler.h" +#include "../lib/status_handler.h" #include "main_dlg.h" namespace zen diff --git a/ui/search.cpp b/ui/search.cpp index d0b24299..2b33bc64 100644 --- a/ui/search.cpp +++ b/ui/search.cpp @@ -9,7 +9,7 @@ #include <wx/msgdlg.h> #include <wx/utils.h> #include <utility> -#include "../shared/mouse_move_dlg.h" +#include <wx+/mouse_move_dlg.h> class SearchDlg : public SearchDialogGenerated diff --git a/ui/small_dlgs.cpp b/ui/small_dlgs.cpp index f57f8324..ac949132 100644 --- a/ui/small_dlgs.cpp +++ b/ui/small_dlgs.cpp @@ -7,23 +7,21 @@ #include "gui_generated.h" #include "small_dlgs.h" #include "msg_popup.h" -#include "../library/resources.h" +#include "../lib/resources.h" #include "../algorithm.h" -#include "../shared/string_conv.h" -#include "../shared/util.h" -#include "../shared/wx_choice_enum.h" +#include <wx+/string_conv.h> +#include <wx+/format_unit.h> +#include <wx+/choice_enum.h> #include "../synchronization.h" -#include "../library/custom_grid.h" -#include "../shared/custom_button.h" -#include "../shared/i18n.h" -#include "../shared/global_func.h" -#include "../shared/build_info.h" +#include "../lib/custom_grid.h" +#include <wx+/button.h> +#include <zen/build_info.h> #include <wx/wupdlock.h> #include <wx/msgdlg.h> -#include "../shared/mouse_move_dlg.h" -#include "../shared/help_provider.h" -#include "../shared/image_tools.h" -#include "../shared/stl_tools.h" +#include <wx+/mouse_move_dlg.h> +#include "../lib/help_provider.h" +#include <wx+/image_tools.h> +#include <zen/stl_tools.h> using namespace zen; @@ -77,18 +75,18 @@ AboutDlg::AboutDlg(wxWindow* parent) : AboutDlgGenerated(parent) #endif //wxUSE_UNICODE //compile time info about 32/64-bit build - if (util::is64BitBuild) + if (zen::is64BitBuild) build += wxT(" x64"); else build += wxT(" x86"); - assert_static(util::is32BitBuild || util::is64BitBuild); + assert_static(zen::is32BitBuild || zen::is64BitBuild); wxString buildFormatted = _("(Build: %x)"); buildFormatted.Replace(wxT("%x"), build); m_build->SetLabel(buildFormatted); - m_animationControl1->SetAnimation(*GlobalResources::instance().animationMoney); + m_animationControl1->SetAnimation(GlobalResources::instance().animationMoney); m_animationControl1->Play(); m_buttonOkay->SetFocus(); @@ -384,7 +382,7 @@ void DeleteDialog::updateGui() "Do you really want to delete the following %x objects?", delInfo.second); m_bitmap12->SetBitmap(GlobalResources::getImage(wxT("deleteFile"))); } - header.Replace(wxT("%x"), toStringSep(delInfo.second)); + replace(header, L"%x", toStringSep(delInfo.second)); m_staticTextHeader->SetLabel(header); const wxString& filesToDelete = delInfo.first; @@ -607,7 +605,7 @@ SyncPreviewDlg::SyncPreviewDlg(wxWindow* parent, m_bitmapData->SetBitmap(GlobalResources::getImage(wxT("data"))); m_staticTextVariant->SetLabel(variantName); - m_textCtrlData->SetValue(zen::formatFilesizeToShortString(statistics.getDataToProcess())); + m_textCtrlData->SetValue(zen::filesizeToShortString(statistics.getDataToProcess())); m_textCtrlCreateL->SetValue(toStringSep(statistics.getCreate <LEFT_SIDE>())); m_textCtrlUpdateL->SetValue(toStringSep(statistics.getOverwrite<LEFT_SIDE>())); diff --git a/ui/small_dlgs.h b/ui/small_dlgs.h index ca497bfb..9abcba6c 100644 --- a/ui/small_dlgs.h +++ b/ui/small_dlgs.h @@ -8,7 +8,7 @@ #define SMALLDIALOGS_H_INCLUDED #include "../file_hierarchy.h" -#include "../library/process_xml.h" +#include "../lib/process_xml.h" #include "../synchronization.h" namespace zen diff --git a/ui/sorting.h b/ui/sorting.h index 719934d8..596dfd53 100644 --- a/ui/sorting.h +++ b/ui/sorting.h @@ -9,7 +9,7 @@ #include "../file_hierarchy.h" #include "../synchronization.h" -#include "../shared/assert_static.h" +#include <zen/assert_static.h> namespace zen @@ -87,12 +87,12 @@ bool lessRelativeName(const FileSystemObject& a, const FileSystemObject& b) const bool isDirectoryA = isDirectoryMapping(a); const Zstring& relDirNameA = isDirectoryA ? a.getObjRelativeName() : //directory - a.getObjRelativeName().BeforeLast(FILE_NAME_SEPARATOR); //returns empty string if ch not found + beforeLast(a.getObjRelativeName(), FILE_NAME_SEPARATOR); //returns empty string if ch not found const bool isDirectoryB = isDirectoryMapping(b); const Zstring& relDirNameB = isDirectoryB ? b.getObjRelativeName() : //directory - b.getObjRelativeName().BeforeLast(FILE_NAME_SEPARATOR); //returns empty string if ch not found + beforeLast(b.getObjRelativeName(), FILE_NAME_SEPARATOR); //returns empty string if ch not found //compare relative names without filenames first const int rv = cmpFileName(relDirNameA, relDirNameB); diff --git a/ui/switch_to_gui.cpp b/ui/switch_to_gui.cpp deleted file mode 100644 index 76e5b282..00000000 --- a/ui/switch_to_gui.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// ************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * -// ************************************************************************** - -#include "switch_to_gui.h" -#include "main_dlg.h" - -using zen::SwitchToGui; - - -SwitchToGui::SwitchToGui(const xmlAccess::XmlBatchConfig& batchCfg, - xmlAccess::XmlGlobalSettings& globalSettings) : //prepare - globalSettings_(globalSettings), - guiCfg(xmlAccess::convertBatchToGui(batchCfg)) {} - - -void SwitchToGui::execute() const //throw() -{ - try - { - MainDialog* frame = new MainDialog(guiCfg, globalSettings_, true); //toplevel window - frame->Show(); - } - catch (...) {} -} diff --git a/ui/switch_to_gui.h b/ui/switch_to_gui.h index cbbff20c..70ef90d3 100644 --- a/ui/switch_to_gui.h +++ b/ui/switch_to_gui.h @@ -7,22 +7,35 @@ #ifndef SWITCHTOGUI_H_INCLUDED #define SWITCHTOGUI_H_INCLUDED -#include "../library/process_xml.h" - +#include "../lib/process_xml.h" +#include "main_dlg.h" //in "application.cpp" we have this dependency anyway! namespace zen { - //switch from FreeFileSync Batch to GUI modus: opens a new FreeFileSync GUI session asynchronously class SwitchToGui { public: - SwitchToGui(const xmlAccess::XmlBatchConfig& batchCfg, xmlAccess::XmlGlobalSettings& globalSettings); //prepare - void execute() const; //throw() + SwitchToGui(const wxString& referenceFile, + const xmlAccess::XmlBatchConfig& batchCfg, + xmlAccess::XmlGlobalSettings& globalSettings) : + guiCfg(xmlAccess::convertBatchToGui(batchCfg)), + globalSettings_(globalSettings) + { + referenceFiles.push_back(referenceFile); + } + + void execute() const + { + + MainDialog* frame = new MainDialog(referenceFiles, guiCfg, globalSettings_, true); //toplevel window + frame->Show(); + } private: - xmlAccess::XmlGlobalSettings& globalSettings_; + std::vector<wxString> referenceFiles; const xmlAccess::XmlGuiConfig guiCfg; + xmlAccess::XmlGlobalSettings& globalSettings_; }; } diff --git a/ui/sync_cfg.cpp b/ui/sync_cfg.cpp index d85e2bcf..d19520be 100644 --- a/ui/sync_cfg.cpp +++ b/ui/sync_cfg.cpp @@ -5,17 +5,17 @@ // ************************************************************************** #include "sync_cfg.h" -#include "../library/resources.h" -#include "../shared/dir_name.h" +#include "../lib/resources.h" +#include "../lib/dir_name.h" #include <wx/wupdlock.h> -#include "../shared/mouse_move_dlg.h" -#include "../shared/string_conv.h" -#include "../shared/dir_picker_i18n.h" +#include <wx+/mouse_move_dlg.h> +#include <wx+/string_conv.h> +#include <wx+/dir_picker.h> #include "gui_generated.h" #include <memory> -#include "../shared/wx_choice_enum.h" -#include "../shared/dir_name.h" -#include "../shared/image_tools.h" +#include <wx+/choice_enum.h> +#include "../lib/dir_name.h" +#include <wx+/image_tools.h> using namespace zen; using namespace xmlAccess; diff --git a/ui/sync_cfg.h b/ui/sync_cfg.h index 1b95f53b..5e93c64d 100644 --- a/ui/sync_cfg.h +++ b/ui/sync_cfg.h @@ -7,7 +7,7 @@ #ifndef SYNCCONFIG_H_INCLUDED #define SYNCCONFIG_H_INCLUDED -#include "../library/process_xml.h" +#include "../lib/process_xml.h" namespace zen { diff --git a/shared/taskbar.cpp b/ui/taskbar.cpp index 9edc7288..caab300c 100644 --- a/shared/taskbar.cpp +++ b/ui/taskbar.cpp @@ -7,41 +7,22 @@ #include "taskbar.h" #ifdef FFS_WIN +#include <zen/win.h> //includes "windows.h" +#include <zen/dll.h> +#include <zen/assert_static.h> +#include <zen/win_ver.h> #include "Taskbar_Seven/taskbar.h" -#include "dll_loader.h" -#include "build_info.h" -#include "assert_static.h" -#include <wx/msw/wrapwin.h> //includes "windows.h" #elif defined HAVE_UBUNTU_UNITY #include <unity/unity/unity.h> #endif -using namespace util; +using namespace zen; #ifdef FFS_WIN using namespace tbseven; -namespace -{ -bool windows7TaskbarAvailable() -{ - OSVERSIONINFO osvi = {}; - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - - if (::GetVersionEx(&osvi)) - return osvi.dwMajorVersion > 6 || - (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion >= 1); //task bar progress available with Windows 7 - //XP has majorVersion == 5, minorVersion == 1 - //Server 2003 has majorVersion == 5, minorVersion == 2 - //Seven has majorVersion == 6, minorVersion == 1 - //version overview: http://msdn.microsoft.com/en-us/library/ms724834(VS.85).aspx - return false; -} -} -//######################################################################################################## - class Taskbar::Pimpl //throw (TaskbarNotAvailable) { @@ -54,7 +35,7 @@ public: if (!assocWindow || !setProgress_ || !setStatus_) throw TaskbarNotAvailable(); - if (!windows7TaskbarAvailable()) + if (!zen::win7OrLater()) throw TaskbarNotAvailable(); } @@ -91,9 +72,9 @@ public: } private: - void* assocWindow; //HWND - const util::DllFun<SetStatusFct> setStatus_; - const util::DllFun<SetProgressFct> setProgress_; + void* assocWindow; //HWND + const DllFun<SetStatusFct> setStatus_; + const DllFun<SetProgressFct> setProgress_; }; #elif defined HAVE_UBUNTU_UNITY //Ubuntu unity @@ -156,7 +137,7 @@ class Taskbar::Pimpl public: Pimpl(const wxTopLevelWindow& window) { throw TaskbarNotAvailable(); } void setStatus(Status status) {} - void setProgress(size_t current, size_t total) {} + void setProgress(double fraction) {} }; #endif diff --git a/shared/taskbar.h b/ui/taskbar.h index b78b4494..d34dae30 100644 --- a/shared/taskbar.h +++ b/ui/taskbar.h @@ -7,8 +7,8 @@ #ifndef TASKBARPROGRESS_H_INCLUDED #define TASKBARPROGRESS_H_INCLUDED -#include <wx/toplevel.h> #include <memory> +#include <wx/toplevel.h> /* Windows 7; show progress in windows superbar via ITaskbarList3 Interface (http://msdn.microsoft.com/en-us/library/dd391692(VS.85).aspx) @@ -20,7 +20,7 @@ Define HAVE_UBUNTU_UNITY and set: Linker flag: `pkg-config --libs unity` */ -namespace util +namespace zen { class TaskbarNotAvailable {}; diff --git a/ui/tray_icon.cpp b/ui/tray_icon.cpp index 96ae47e6..5e3fa5cb 100644 --- a/ui/tray_icon.cpp +++ b/ui/tray_icon.cpp @@ -5,15 +5,14 @@ // ************************************************************************** #include "tray_icon.h" -#include "../library/resources.h" +#include "../lib/resources.h" #include "small_dlgs.h" -#include "../shared/i18n.h" #include <wx/taskbar.h> #include <cmath> #include <wx/image.h> #include <wx/menu.h> #include <wx/icon.h> //req. by Linux -#include "../shared/image_tools.h" +#include <wx+/image_tools.h> const wxEventType FFS_REQUEST_RESUME_TRAY_EVENT = wxNewEventType(); diff --git a/shared/help_provider.h b/ui/wx_form_build_hide_warnings.h index dbe3ce26..277fa0e7 100644 --- a/shared/help_provider.h +++ b/ui/wx_form_build_hide_warnings.h @@ -4,14 +4,13 @@ // * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** -#ifndef HELPPROVIDER_H_INCLUDED -#define HELPPROVIDER_H_INCLUDED +#ifndef WX_FORM_BUILD_230948324234234 +#define WX_FORM_BUILD_230948324234234 -#include <wx/string.h> +//hide compiler warnings in generated code -namespace zen -{ -void displayHelpEntry(const wxString& section = wxEmptyString); -} +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#endif -#endif // HELPPROVIDER_H_INCLUDED +#endif //WX_FORM_BUILD_230948324234234 diff --git a/version/version.h b/version/version.h index 9496b80a..7f320af2 100644 --- a/version/version.h +++ b/version/version.h @@ -2,5 +2,5 @@ namespace zen { -const wxString currentVersion = wxT("4.0"); //internal linkage! + const wxString currentVersion = wxT("4.2"); //internal linkage! } diff --git a/version/version.rc b/version/version.rc index 1f431185..b902445b 100644 --- a/version/version.rc +++ b/version/version.rc @@ -1,2 +1,2 @@ -#define VER_FREEFILESYNC 4,0,0,0 -#define VER_FREEFILESYNC_STR "4.0\0" +#define VER_FREEFILESYNC 4,2,0,0 +#define VER_FREEFILESYNC_STR "4.2\0" diff --git a/shared/app_main.h b/wx+/app_main.h index fa538771..6b375592 100644 --- a/shared/app_main.h +++ b/wx+/app_main.h @@ -7,21 +7,43 @@ #ifndef APPMAIN_H_INCLUDED #define APPMAIN_H_INCLUDED -class wxWindow; +#include <wx/window.h> +#include <wx/app.h> namespace zen { //just some wrapper around a global variable representing the (logical) main application window -class AppMainWindow +void setMainWindow(wxWindow* window); //set main window and enable "exit on frame delete" +bool mainWindowWasSet(); + + + + + + + + +//######################## implementation ######################## +inline +bool& getMainWndStatus() { -public: - static void setMainWindow(wxWindow* window); //set main window and enable "exit on frame delete" - static bool mainWindowWasSet(); + static bool status = false; //external linkage! + return status; +} -private: - static bool mainWndActive; -}; + +inline +void setMainWindow(wxWindow* window) +{ + wxTheApp->SetTopWindow(window); + wxTheApp->SetExitOnFrameDelete(true); + + getMainWndStatus() = true; } +inline +bool mainWindowWasSet() { return getMainWndStatus(); } +} + #endif // APPMAIN_H_INCLUDED diff --git a/shared/custom_button.cpp b/wx+/button.cpp index 606db4f2..7edfdea8 100644 --- a/shared/custom_button.cpp +++ b/wx+/button.cpp @@ -4,32 +4,32 @@ // * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** -#include "custom_button.h" -#include <wx/dcmemory.h> -#include <wx/image.h> +#include "button.h" #include <algorithm> #include <limits> #include <cmath> +#include <wx/dcmemory.h> +#include <wx/image.h> #include "image_tools.h" using namespace zen; -void setBitmapLabel(wxBitmapButton& button, const wxBitmap& bmp) +void zen::setBitmapLabel(wxBitmapButton& button, const wxBitmap& bmp) { if (!isEqual(button.GetBitmapLabel(), bmp)) button.SetBitmapLabel(bmp); } -wxButtonWithImage::wxButtonWithImage(wxWindow* parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name) : +BitmapButton::BitmapButton(wxWindow* parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) : wxBitmapButton(parent, id, wxNullBitmap, pos, size, style | wxBU_AUTODRAW, validator, name), m_spaceAfter(0), m_spaceBefore(0) @@ -38,7 +38,7 @@ wxButtonWithImage::wxButtonWithImage(wxWindow* parent, } -void wxButtonWithImage::setBitmapFront(const wxBitmap& bitmap, unsigned spaceAfter) +void BitmapButton::setBitmapFront(const wxBitmap& bitmap, unsigned spaceAfter) { if (!isEqual(bitmap, bitmapFront) || spaceAfter != m_spaceAfter) //avoid flicker { @@ -49,7 +49,7 @@ void wxButtonWithImage::setBitmapFront(const wxBitmap& bitmap, unsigned spaceAft } -void wxButtonWithImage::setTextLabel(const wxString& text) +void BitmapButton::setTextLabel(const wxString& text) { if (text != textLabel) //avoid flicker { @@ -60,7 +60,7 @@ void wxButtonWithImage::setTextLabel(const wxString& text) } -void wxButtonWithImage::setBitmapBack(const wxBitmap& bitmap, unsigned spaceBefore) +void BitmapButton::setBitmapBack(const wxBitmap& bitmap, unsigned spaceBefore) { if (!isEqual(bitmap, bitmapBack) || spaceBefore != m_spaceBefore) //avoid flicker { @@ -110,57 +110,8 @@ wxSize getSizeNeeded(const wxString& text, wxFont& font) return wxSize(width, height); } -/* -inline -void linearInterpolationHelper(const int shift, wxImage& img) -{ - unsigned char* const data = img.GetData(); - const int width = img.GetWidth(); - if (width < 2) - return; - - const float intensity = 0.25; - - for (int y = 1; y < img.GetHeight() - 1; ++y) - { - float back = 0; - float middle = 0; - float front = 0; - - unsigned char* location = data + 3 * (y * width) + shift; - const unsigned char* const endPos = location + 3 * width; - - middle = (*location + *(location - 3 * width) + *(location + 3 * width)) / 3;; - front = (*(location + 3) + *(location + 3 * (1 - width)) + *(location + 3 * (1 + width))) / 3; - *location += ((middle + front) / 2 - *location) * intensity; - location += 3; - - while (location < endPos - 3) - { - back = middle; - middle = front; - front = (*(location + 3) + *(location + 3 * (1 - width)) + *(location + 3 * (1 + width))) / 3; - *location += ((back + middle + front) / 3 - *location) * intensity; - location += 3; - } - - back = middle; - middle = front; - *location += ((back + middle) / 2 - *location) * intensity; - } -} - - -void linearInterpolation(wxImage& img) -{ - linearInterpolationHelper(0, img); //red channel - linearInterpolationHelper(1, img); //green channel - linearInterpolationHelper(2, img); //blue channel -} -*/ - -wxBitmap wxButtonWithImage::createBitmapFromText(const wxString& text) +wxBitmap BitmapButton::createBitmapFromText(const wxString& text) { //wxDC::DrawLabel() doesn't respect alpha channel at all => apply workaround to calculate alpha values manually: @@ -322,7 +273,7 @@ wxSize getSize(const wxBitmap& bmp) } -void wxButtonWithImage::refreshButtonLabel() +void BitmapButton::refreshButtonLabel() { wxBitmap bitmapText = createBitmapFromText(textLabel); diff --git a/shared/custom_button.h b/wx+/button.h index 8500e59b..e5d63a19 100644 --- a/shared/custom_button.h +++ b/wx+/button.h @@ -9,19 +9,20 @@ #include <wx/bmpbuttn.h> - -//wxButtonWithImage behaves like wxButton but optionally adds bitmap labels -class wxButtonWithImage : public wxBitmapButton +namespace zen +{ +//zen::BitmapButton behaves like wxButton but optionally adds bitmap labels +class BitmapButton : public wxBitmapButton { public: - wxButtonWithImage(wxWindow* parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr); + BitmapButton(wxWindow* parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr); void setBitmapFront(const wxBitmap& bitmap, unsigned spaceAfter = 0); void setTextLabel( const wxString& text); @@ -40,6 +41,7 @@ private: //set bitmap label flicker free! void setBitmapLabel(wxBitmapButton& button, const wxBitmap& bmp); +} #endif // CUSTOMBUTTON_H_INCLUDED diff --git a/shared/wx_choice_enum.h b/wx+/choice_enum.h index b8833725..4565bf81 100644 --- a/shared/wx_choice_enum.h +++ b/wx+/choice_enum.h @@ -7,11 +7,10 @@ #ifndef WX_CHOICE_ENUM_H_INCLUDED #define WX_CHOICE_ENUM_H_INCLUDED -#include <wx/choice.h> #include <vector> +#include <wx/choice.h> //handle mapping of enum values to wxChoice controls - /* Example: @@ -70,14 +69,6 @@ template <class Enum> void updateTooltipEnumVal(const EnumDescrList<Enum>& mappi - - - - - - - - //--------------- inline impelementation ------------------------------------------- template <class Enum> void setEnumVal(const EnumDescrList<Enum>& mapping, wxChoice& ctrl, Enum value) diff --git a/wx+/dir_picker.h b/wx+/dir_picker.h new file mode 100644 index 00000000..5f18b6fb --- /dev/null +++ b/wx+/dir_picker.h @@ -0,0 +1,31 @@ +#ifndef DIR_PICKER_I18N_H_INCLUDED +#define DIR_PICKER_I18N_H_INCLUDED + +#include <wx/filepicker.h> +#include <zen/i18n.h> + +namespace zen +{ +class DirPickerCtrl : public wxDirPickerCtrl +{ +public: + DirPickerCtrl(wxWindow* parent, wxWindowID id, + const wxString& path = wxEmptyString, + const wxString& message = wxDirSelectorPromptStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDIRP_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxDirPickerCtrlNameStr) : + wxDirPickerCtrl(parent, id, path, message, pos, size, style, validator, name) + { +#ifdef FFS_WIN + //fix wxWidgets localization gap: + wxButton* button = dynamic_cast<wxButton*>(m_pickerIface); + if (button) button->SetLabel(_("Browse")); +#endif + } +}; +} + +#endif // DIR_PICKER_I18N_H_INCLUDED diff --git a/shared/file_drop.h b/wx+/file_drop.h index 8b11ccfb..1eaeede0 100644 --- a/shared/file_drop.h +++ b/wx+/file_drop.h @@ -14,7 +14,7 @@ namespace zen { //register simple file drop event (without issue of freezing dialogs and without wxFileDropTarget overdesign) -//1. have a window emit FFS_DROP_FILE_EVENT +//1. setup a window to emit FFS_DROP_FILE_EVENT void setupFileDrop(wxWindow& wnd); //2. register events: diff --git a/wx+/format_unit.cpp b/wx+/format_unit.cpp new file mode 100644 index 00000000..771778aa --- /dev/null +++ b/wx+/format_unit.cpp @@ -0,0 +1,232 @@ +// ************************************************************************** +// * This file is part of the FreeFileSync project. It is distributed under * +// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** + +#include "format_unit.h" +#include <zen/basic_math.h> +#include <zen/i18n.h> +#include <cwchar> //swprintf +#include <ctime> +#include <cstdio> + +#ifdef FFS_WIN +#include <zen/win.h> //includes "windows.h" +#include <zen/win_ver.h> +#endif + + +namespace +{ +inline +size_t getDigitCount(size_t number) +{ + return number == 0 ? 1 : static_cast<size_t>(std::log10(static_cast<double>(number))) + 1; +} //count number of digits +} + + +std::wstring zen::filesizeToShortString(UInt64 size) +{ + if (to<Int64>(size) < 0) return _("Error"); + + if (size <= 999U) + return replaceCpy(_P("1 Byte", "%x Bytes", to<int>(size)), + L"%x", + toString<std::wstring>(size)); + else + { + double filesize = to<double>(size); + + filesize /= 1024; + std::wstring output = _("%x KB"); + if (filesize > 999) + { + filesize /= 1024; + output = _("%x MB"); + if (filesize > 999) + { + filesize /= 1024; + output = _("%x GB"); + if (filesize > 999) + { + filesize /= 1024; + output = _("%x TB"); + if (filesize > 999) + { + filesize /= 1024; + output = _("%x PB"); + } + } + } + } + //print just three significant digits: 0,01 | 0,11 | 1,11 | 11,1 | 111 + const size_t leadDigitCount = getDigitCount(static_cast<size_t>(filesize)); //number of digits before decimal point + if (leadDigitCount == 0 || leadDigitCount > 3) + return _("Error"); + + wchar_t buffer[50]; +#ifdef __MINGW32__ + int charsWritten = ::snwprintf(buffer, 50, L"%.*f", static_cast<int>(3 - leadDigitCount), filesize); //MinGW does not comply to the C standard here +#else + int charsWritten = std::swprintf(buffer, 50, L"%.*f", static_cast<int>(3 - leadDigitCount), filesize); +#endif + return charsWritten > 0 ? replaceCpy(output, L"%x", std::wstring(buffer, charsWritten)) : _("Error"); + } +} + + +enum UnitRemTime +{ + URT_SEC, + URT_MIN, + URT_HOUR, + URT_DAY +}; + +std::wstring zen::remainingTimeToShortString(double timeInSec) +{ + double remainingTime = timeInSec; + + //determine preferred unit + UnitRemTime unit = URT_SEC; + if (remainingTime > 59) + { + unit = URT_MIN; + remainingTime /= 60; + if (remainingTime > 59) + { + unit = URT_HOUR; + remainingTime /= 60; + if (remainingTime > 23) + { + unit = URT_DAY; + remainingTime /= 24; + } + } + } + + int formattedTime = numeric::round(remainingTime); + + //reduce precision to 5 seconds + if (unit == URT_SEC) + formattedTime = static_cast<int>(std::ceil(formattedTime / 5.0) * 5); + + //generate output message + std::wstring output; + switch (unit) + { + case URT_SEC: + output = _P("1 sec", "%x sec", formattedTime); + break; + case URT_MIN: + output = _P("1 min", "%x min", formattedTime); + break; + case URT_HOUR: + output = _P("1 hour", "%x hours", formattedTime); + break; + case URT_DAY: + output = _P("1 day", "%x days", formattedTime); + break; + } + return replaceCpy(output, L"%x", zen::toString<std::wstring>(formattedTime)); +} + + +std::wstring zen::percentageToShortString(double fraction) +{ + return replaceCpy(_("%x%"), L"%x", printNumber<std::wstring>(L"%3.2f", fraction * 100.0), false); +} + + +std::wstring zen::ffs_Impl::includeNumberSeparator(const std::wstring& number) +{ + std::wstring output(number); + for (size_t i = output.size(); i > 3; i -= 3) + output.insert(i - 3, zen::getThousandsSeparator()); + + return output; +} + +/* +#include <wx/scrolwin.h> + +void zen::scrollToBottom(wxScrolledWindow* scrWindow) +{ + int height = 0; + scrWindow->GetClientSize(NULL, &height); + + int pixelPerLine = 0; + scrWindow->GetScrollPixelsPerUnit(NULL, &pixelPerLine); + + if (height > 0 && pixelPerLine > 0) + { + const int scrollLinesTotal = scrWindow->GetScrollLines(wxVERTICAL); + const int scrollLinesOnScreen = height / pixelPerLine; + const int scrollPosBottom = scrollLinesTotal - scrollLinesOnScreen; + + if (0 <= scrollPosBottom) + scrWindow->Scroll(0, scrollPosBottom); + } +} +*/ + +#ifdef FFS_WIN +namespace +{ +const bool useNewLocalTimeCalculation = zen::vistaOrLater(); +} +#endif + + +std::wstring zen::utcToLocalTimeString(Int64 utcTime) +{ +#ifdef FFS_WIN + FILETIME lastWriteTimeUtc = tofiletime(utcTime); //convert ansi C time to FILETIME + + SYSTEMTIME systemTimeLocal = {}; + + if (useNewLocalTimeCalculation) //use DST setting from source date (like in Windows 7, see http://msdn.microsoft.com/en-us/library/ms724277(VS.85).aspx) + { + SYSTEMTIME systemTimeUtc = {}; + if (!::FileTimeToSystemTime(&lastWriteTimeUtc, //__in const FILETIME *lpFileTime, + &systemTimeUtc)) //__out LPSYSTEMTIME lpSystemTime + return _("Error"); + + if (!::SystemTimeToTzSpecificLocalTime(NULL, //__in_opt LPTIME_ZONE_INFORMATION lpTimeZone, + &systemTimeUtc, //__in LPSYSTEMTIME lpUniversalTime, + &systemTimeLocal)) //__out LPSYSTEMTIME lpLocalTime + return _("Error"); + } + else //use DST setting (like in Windows 2000 and XP) + { + FILETIME fileTimeLocal = {}; + if (!::FileTimeToLocalFileTime(&lastWriteTimeUtc, //pointer to UTC file time to convert + &fileTimeLocal)) //pointer to converted file time + return _("Error"); + + if (!::FileTimeToSystemTime(&fileTimeLocal, //pointer to file time to convert + &systemTimeLocal)) //pointer to structure to receive system time + return _("Error"); + } + + struct tm loc = {}; + loc.tm_year = systemTimeLocal.wYear - 1900; + loc.tm_mon = systemTimeLocal.wMonth - 1; + loc.tm_mday = systemTimeLocal.wDay; + loc.tm_hour = systemTimeLocal.wHour; + loc.tm_min = systemTimeLocal.wMinute; + loc.tm_sec = systemTimeLocal.wSecond; + const struct tm* timePtr = &loc; + +#elif defined FFS_LINUX + const time_t fileTime = to<time_t>(utcTime); + const struct tm* timePtr = ::localtime(&fileTime); //convert to local time +#endif + + wchar_t buffer[1000]; + size_t charsWritten = std::wcsftime(buffer, 1000, L"%x %X", timePtr); + + return std::wstring(buffer, charsWritten); +} diff --git a/wx+/format_unit.h b/wx+/format_unit.h new file mode 100644 index 00000000..4adf74f8 --- /dev/null +++ b/wx+/format_unit.h @@ -0,0 +1,64 @@ +// ************************************************************************** +// * This file is part of the FreeFileSync project. It is distributed under * +// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** + +#ifndef UTIL_H_INCLUDED +#define UTIL_H_INCLUDED + +#include <string> +#include <zen/string_tools.h> +#include <zen/int64.h> + +namespace zen +{ +std::wstring filesizeToShortString(UInt64 filesize); +std::wstring remainingTimeToShortString(double timeInSec); +std::wstring percentageToShortString(double fraction); //within [0, 1] + +template <class NumberType> +std::wstring toStringSep(NumberType number); //convert number to std::wstring including thousands separator + +std::wstring utcToLocalTimeString(Int64 utcTime); //throw std::runtime_error + + + + + + + + + + + + + + + + + + + + + + + + + + + +//--------------- inline impelementation ------------------------------------------- +namespace ffs_Impl +{ +std::wstring includeNumberSeparator(const std::wstring& number); +} + +template <class NumberType> inline +std::wstring toStringSep(NumberType number) +{ + return ffs_Impl::includeNumberSeparator(zen::toString<std::wstring>(number)); +} +} + +#endif // UTIL_H_INCLUDED diff --git a/wx+/graph.cpp b/wx+/graph.cpp new file mode 100644 index 00000000..584ef0ea --- /dev/null +++ b/wx+/graph.cpp @@ -0,0 +1,540 @@ +// ************************************************************************** +// * This file is part of the zenXML project. It is distributed under the * +// * Boost Software License, Version 1.0. See accompanying file * +// * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt. * +// * Copyright (C) 2011 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** + +#include "graph.h" +#include <cassert> +#include <algorithm> +#include <numeric> +#include <zen/basic_math.h> +#include <wx/settings.h> + +using namespace zen; +using namespace numeric; + + +//todo: support zoom via mouse wheel + + +const wxEventType zen::wxEVT_GRAPH_SELECTION = wxNewEventType(); + +namespace +{ +inline +double bestFit(double val, double low, double high) { return val < (high + low) / 2 ? low : high; } +} + + +double zen::nextNiceNumber(double blockSize) //round to next number which is a convenient to read block size +{ + if (blockSize <= 0) + return 0; + + const double k = std::floor(std::log10(blockSize)); + const double e = std::pow(10, k); + const double a = blockSize / e; //blockSize = a * 10^k with a in (1, 10) + + //have a look at leading two digits: "nice" numbers start with 1, 2, 2.5 and 5 + if (a <= 2) + return bestFit(a, 1, 2) * e; + else if (a <= 2.5) + return bestFit(a, 2, 2.5) * e; + else if (a <= 5) + return bestFit(a, 2.5, 5) * e; + else if (a < 10) + return bestFit(a, 5, 10) * e; + else + { + assert(false); + return 10 * e; + } +} + + +namespace +{ +wxColor getDefaultColor(size_t pos) +{ + pos %= 10; + switch (pos) + { + case 0: + return wxColor(0, 69, 134); //blue + case 1: + return wxColor(255, 66, 14); //red + case 2: + return wxColor(255, 211, 32); //yellow + case 3: + return wxColor(87, 157, 28); //green + case 4: + return wxColor(126, 0, 33); //royal + case 5: + return wxColor(131, 202, 255); //light blue + case 6: + return wxColor(49, 64, 4); //dark green + case 7: + return wxColor(174, 207, 0); //light green + case 8: + return wxColor(75, 31, 111); //purple + case 9: + return wxColor(255, 149, 14); //orange + default: + return *wxBLACK; + } +} + + +void drawYLabel(wxDC& dc, double& yMin, double& yMax, const wxRect& clientArea, int labelWidth, bool drawLeft, const LabelFormatter& labelFmt) //clientArea := y-label + data window +{ + //note: DON'T use wxDC::GetSize()! DC may be larger than visible area! + if (clientArea.GetHeight() <= 0 || clientArea.GetWidth() <= 0) return; + + int optimalBlockHeight = 3 * dc.GetMultiLineTextExtent(wxT("1")).GetHeight();; + + double valRangePerBlock = (yMax - yMin) * optimalBlockHeight / clientArea.GetHeight(); + valRangePerBlock = labelFmt.getOptimalBlockSize(valRangePerBlock); + if (numeric::isNull(valRangePerBlock)) return; + + double yMinNew = std::floor(yMin / valRangePerBlock) * valRangePerBlock; + double yMaxNew = std::ceil (yMax / valRangePerBlock) * valRangePerBlock; + int blockCount = numeric::round((yMaxNew - yMinNew) / valRangePerBlock); + if (blockCount == 0) return; + + yMin = yMinNew; //inform about adjusted y value range + yMax = yMaxNew; + + //draw labels + { + wxDCPenChanger dummy(dc, wxPen(wxColor(192, 192, 192))); //light grey + dc.SetFont(wxFont(wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("Arial") )); + + const int posLabel = drawLeft ? 0 : clientArea.GetWidth() - labelWidth; + const int posDataArea = drawLeft ? labelWidth : 0; + const int widthDataArea = clientArea.GetWidth() - labelWidth; + + const wxPoint origin = clientArea.GetTopLeft(); + + for (int i = 1; i < blockCount; ++i) + { + //draw grey horizontal lines + const int y = i * static_cast<double>(clientArea.GetHeight()) / blockCount; + if (widthDataArea > 0) + dc.DrawLine(wxPoint(posDataArea, y) + origin, wxPoint(posDataArea + widthDataArea - 1, y) + origin); + + //draw y axis labels + const wxString label = labelFmt.formatText(yMaxNew - i * valRangePerBlock ,valRangePerBlock); + wxSize labelExtent = dc.GetMultiLineTextExtent(label); + + labelExtent.x = std::max(labelExtent.x, labelWidth); //enlarge if possible to center horizontally + + dc.DrawLabel(label, wxRect(wxPoint(posLabel, y - labelExtent.GetHeight() / 2) + origin, labelExtent), wxALIGN_CENTRE); + } + } +} + + +void drawXLabel(wxDC& dc, double& xMin, double& xMax, const wxRect& clientArea, int labelHeight, bool drawBottom, const LabelFormatter& labelFmt) //clientArea := x-label + data window +{ + //note: DON'T use wxDC::GetSize()! DC may be larger than visible area! + if (clientArea.GetHeight() <= 0 || clientArea.GetWidth() <= 0) return; + + int optimalBlockWidth = dc.GetMultiLineTextExtent(wxT("100000000000000")).GetWidth(); + + double valRangePerBlock = (xMax - xMin) * optimalBlockWidth / clientArea.GetWidth(); + valRangePerBlock = labelFmt.getOptimalBlockSize(valRangePerBlock); + if (numeric::isNull(valRangePerBlock)) return; + + double xMinNew = std::floor(xMin / valRangePerBlock) * valRangePerBlock; + double xMaxNew = std::ceil (xMax / valRangePerBlock) * valRangePerBlock; + int blockCount = numeric::round((xMaxNew - xMinNew) / valRangePerBlock); + if (blockCount == 0) return; + + xMin = xMinNew; //inform about adjusted x value range + xMax = xMaxNew; + + //draw labels + { + wxDCPenChanger dummy(dc, wxPen(wxColor(192, 192, 192))); //light grey + dc.SetFont(wxFont(wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("Arial") )); + + const int posLabel = drawBottom ? clientArea.GetHeight() - labelHeight : 0; + const int posDataArea = drawBottom ? 0 : labelHeight; + const int heightDataArea = clientArea.GetHeight() - labelHeight; + + const wxPoint origin = clientArea.GetTopLeft(); + + for (int i = 1; i < blockCount; ++i) + { + //draw grey vertical lines + const int x = i * static_cast<double>(clientArea.GetWidth()) / blockCount; + if (heightDataArea > 0) + dc.DrawLine(wxPoint(x, posDataArea) + origin, wxPoint(x, posDataArea + heightDataArea - 1) + origin); + + //draw x axis labels + const wxString label = labelFmt.formatText(xMin + i * valRangePerBlock ,valRangePerBlock); + wxSize labelExtent = dc.GetMultiLineTextExtent(label); + + labelExtent.y = std::max(labelExtent.y, labelHeight); //enlarge if possible to center vertically + + dc.DrawLabel(label, wxRect(wxPoint(x - labelExtent.GetWidth() / 2, posLabel) + origin, labelExtent), wxALIGN_CENTRE); + } + } +} + + +class ConvertCoord //convert between screen and actual coordinates +{ +public: + ConvertCoord(double valMin, double valMax, size_t screenSize) : + min_(valMin), + scaleToReal(screenSize == 0 ? 0 : (valMax - valMin) / screenSize), + scaleToScr(numeric::isNull(valMax - valMin) ? 0 : screenSize / (valMax - valMin)) {} + + double screenToReal(double screenPos) const //input value: [0, screenSize - 1] + { + return screenPos * scaleToReal + min_; //come close to valMax, but NEVER reach it! + } + double realToScreen(double realPos) const //return screen position in pixel (but with double precision!) + { + return (realPos - min_) * scaleToScr; + } + +private: + const double min_; + const double scaleToReal; + const double scaleToScr; +}; + + +template <class StdCont> +void subsample(StdCont& cont, size_t factor) +{ + if (factor <= 1) return; + + typedef typename StdCont::iterator IterType; + + IterType posWrite = cont.begin(); + for (IterType posRead = cont.begin(); cont.end() - posRead >= static_cast<int>(factor); posRead += factor) //don't even let iterator point out of range! + *posWrite++ = std::accumulate(posRead, posRead + factor, 0.0) / static_cast<double>(factor); + + cont.erase(posWrite, cont.end()); +} +} + + +Graph2D::Graph2D(wxWindow* parent, + wxWindowID winid, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) : + wxPanel(parent, winid, pos, size, style, name) +{ + Connect(wxEVT_PAINT, wxPaintEventHandler(Graph2D::onPaintEvent), NULL, this); + Connect(wxEVT_SIZE, wxEventHandler(Graph2D::onRefreshRequired), NULL, this); + //http://wiki.wxwidgets.org/Flicker-Free_Drawing + Connect(wxEVT_ERASE_BACKGROUND, wxEraseEventHandler(Graph2D::onEraseBackGround), NULL, this); + +#if wxCHECK_VERSION(2, 9, 1) + SetBackgroundStyle(wxBG_STYLE_PAINT); +#else + SetBackgroundStyle(wxBG_STYLE_CUSTOM); +#endif + + Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(Graph2D::OnMouseLeftDown), NULL, this); + Connect(wxEVT_MOTION, wxMouseEventHandler(Graph2D::OnMouseMovement), NULL, this); + Connect(wxEVT_LEFT_UP, wxMouseEventHandler(Graph2D::OnMouseLeftUp), NULL, this); + Connect(wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEventHandler(Graph2D::OnMouseCaptureLost), NULL, this); +} + + +void Graph2D::OnMouseLeftDown(wxMouseEvent& event) +{ + activeSel.reset(new MouseSelection(*this, event.GetPosition())); + + if (!event.ControlDown()) + oldSel.clear(); + + Refresh(); +} + + +void Graph2D::OnMouseMovement(wxMouseEvent& event) +{ + if (activeSel.get()) + { + activeSel->refCurrentPos() = event.GetPosition(); + Refresh(); + } +} + + +void Graph2D::OnMouseLeftUp(wxMouseEvent& event) +{ + if (activeSel.get()) + { + if (activeSel->getStartPos() != activeSel->refCurrentPos()) //if it's just a single mouse click: discard selection + { + //fire off GraphSelectEvent + GraphSelectEvent evt(activeSel->refSelection()); + GetEventHandler()->AddPendingEvent(evt); + + oldSel.push_back(activeSel->refSelection()); + } + + activeSel.reset(); + Refresh(); + } +} + + +void Graph2D::OnMouseCaptureLost(wxMouseCaptureLostEvent& event) +{ + activeSel.reset(); + Refresh(); +} + + +void Graph2D::setData(const std::shared_ptr<GraphData>& data, const LineAttributes& la) +{ + curves_.clear(); + addData(data, la); +} + + +void Graph2D::addData(const std::shared_ptr<GraphData>& data, const LineAttributes& la) +{ + LineAttributes newAttr = la; + if (newAttr.autoColor) + newAttr.setColor(getDefaultColor(curves_.size())); + curves_.push_back(std::make_pair(data, newAttr)); + Refresh(); +} + + +namespace +{ +class DcBackgroundChanger +{ +public: + DcBackgroundChanger(wxDC& dc, const wxBrush& brush) : dc_(dc), old(dc.GetBackground()) { dc.SetBackground(brush); } + ~DcBackgroundChanger() { if (old.Ok()) dc_.SetBackground(old); } +private: + wxDC& dc_; + const wxBrush old; +}; +} + + +void Graph2D::render(wxDC& dc) const +{ + { + //have everything including label background in natural window color by default (overwriting current background color) + DcBackgroundChanger dummy(dc, wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)); //sigh, who *invents* this stuff??? -> workaround for issue with wxBufferedPaintDC + //wxDCBrushChanger dummy(dc, *wxTRANSPARENT_BRUSH); + dc.Clear(); + } + + //note: DON'T use wxDC::GetSize()! DC may be larger than visible area! + /* + ----------------------- + |y-label |data window | + |---------------------- + | | x-label | + ----------------------- + */ + wxRect dataArea = GetClientSize(); //data window only + wxRect yLabelArea = GetClientSize(); //y-label + data window + wxRect xLabelArea = GetClientSize(); //x-label + data window + + switch (attr.labelposX) + { + case X_LABEL_TOP: + dataArea.y += attr.labelHeightX; + dataArea.height -= attr.labelHeightX; + yLabelArea = dataArea; + break; + case X_LABEL_BOTTOM: + dataArea.height -= attr.labelHeightX; + yLabelArea = dataArea; + break; + case X_LABEL_NONE: + break; + } + + switch (attr.labelposY) + { + case Y_LABEL_LEFT: + dataArea .x += attr.labelWidthY; + xLabelArea.x += attr.labelWidthY; + dataArea .width -= attr.labelWidthY; + xLabelArea.width -= attr.labelWidthY; + break; + case Y_LABEL_RIGHT: + dataArea .width -= attr.labelWidthY; + xLabelArea.width -= attr.labelWidthY; + break; + case Y_LABEL_NONE: + break; + } + + { + //paint actual graph background (without labels) using window background color + DcBackgroundChanger dummy(dc, GetBackgroundColour()); + wxDCPenChanger dummy2(dc, wxColour(130, 135, 144)); //medium grey, the same Win7 uses for other frame borders + //dc.DrawRectangle(static_cast<const wxRect&>(dataArea).Inflate(1, 1)); //correct wxWidgets design mistakes + dc.DrawRectangle(dataArea); + dataArea.Deflate(1, 1); //do not draw on border + } + + //detect x value range + double minWndX = attr.minXauto ? HUGE_VAL : attr.minX; //automatic: ensure values are initialized by first curve + double maxWndX = attr.maxXauto ? -HUGE_VAL : attr.maxX; // + if (!curves_.empty()) + { + for (GraphList::const_iterator j = curves_.begin(); j != curves_.end(); ++j) + { + if (!j->first.get()) continue; + const GraphData& graph = *j->first; + assert(graph.getXBegin() <= graph.getXEnd()); + + if (attr.minXauto) + minWndX = std::min(minWndX, graph.getXBegin()); + if (attr.maxXauto) + maxWndX = std::max(maxWndX, graph.getXEnd()); + } + if (attr.labelposX != X_LABEL_NONE && //minWndX, maxWndX are just a suggestion, drawXLabel may enlarge them! + attr.labelFmtX.get()) + drawXLabel(dc, minWndX, maxWndX, xLabelArea, attr.labelHeightX, attr.labelposX == X_LABEL_BOTTOM, *attr.labelFmtX); + } + if (minWndX < maxWndX) //valid x-range + { + //detect y value range + std::vector<std::pair<std::vector<double>, int>> yValuesList(curves_.size()); + double minWndY = attr.minYauto ? HUGE_VAL : attr.minY; //automatic: ensure values are initialized by first curve + double maxWndY = attr.maxYauto ? -HUGE_VAL : attr.maxY; // + if (!curves_.empty()) + { + const int avgFactor = 2; //some averaging of edgy input data to smoothen behavior on window resize + const ConvertCoord cvrtX(minWndX, maxWndX, dataArea.width * avgFactor); + + for (GraphList::const_iterator j = curves_.begin(); j != curves_.end(); ++j) + { + if (!j->first.get()) continue; + const GraphData& graph = *j->first; + + std::vector<double>& yValues = yValuesList[j - curves_.begin()].first; //actual y-values + int& offset = yValuesList[j - curves_.begin()].second; //x-value offset in pixel + { + const int posFirst = std::max<int>(std::ceil(cvrtX.realToScreen(graph.getXBegin())), 0); //evaluate visible area only and make sure to not step one pixel before xbegin()! + const int postLast = std::min<int>(std::floor(cvrtX.realToScreen(graph.getXEnd())), dataArea.width * avgFactor); // + + for (int i = posFirst; i < postLast; ++i) + yValues.push_back(graph.getValue(cvrtX.screenToReal(i))); + + subsample(yValues, avgFactor); + offset = posFirst / avgFactor; + } + + if (!yValues.empty()) + { + if (attr.minYauto) + minWndY = std::min(minWndY, *std::min_element(yValues.begin(), yValues.end())); + if (attr.maxYauto) + maxWndY = std::max(maxWndY, *std::max_element(yValues.begin(), yValues.end())); + } + } + } + if (minWndY < maxWndY) //valid y-range + { + if (attr.labelposY != Y_LABEL_NONE && //minWnd, maxWndY are just a suggestion, drawYLabel may enlarge them! + attr.labelFmtY.get()) + drawYLabel(dc, minWndY, maxWndY, yLabelArea, attr.labelWidthY, attr.labelposY == Y_LABEL_LEFT, *attr.labelFmtY); + + const ConvertCoord cvrtY(minWndY, maxWndY, dataArea.height <= 0 ? 0 : dataArea.height - 1); //both minY/maxY values will be actually evaluated in contrast to maxX => - 1 + const ConvertCoord cvrtX(minWndX, maxWndX, dataArea.width); + + const wxPoint dataOrigin = dataArea.GetTopLeft(); + + //update active mouse selection + if (activeSel.get() && + dataArea.width > 0 && + dataArea.height > 0) + { + wxPoint startPos = activeSel->getStartPos() - dataOrigin; //pos relative to dataArea + wxPoint currentPos = activeSel->refCurrentPos() - dataOrigin; + + //normalize positions + confine(startPos .x, 0, dataArea.width); //allow for one past the end(!) to enable "full range selections" + confine(currentPos.x, 0, dataArea.width); // + + confine(startPos .y, 0, dataArea.height); // + confine(currentPos.y, 0, dataArea.height); // + + //save current selection as double coordinates + activeSel->refSelection().from = SelectionBlock::Point(cvrtX.screenToReal(startPos.x + 0.5), //+0.5 start selection in the middle of a pixel + cvrtY.screenToReal(startPos.y + 0.5)); + activeSel->refSelection().to = SelectionBlock::Point(cvrtX.screenToReal(currentPos.x + 0.5), + cvrtY.screenToReal(currentPos.y + 0.5)); + } + //draw all currently set mouse selections (including active selection) + std::vector<SelectionBlock> allSelections = oldSel; + if (activeSel) + allSelections.push_back(activeSel->refSelection()); + { + wxColor colSelect(168, 202, 236); //light blue + //wxDCBrushChanger dummy(dc, *wxTRANSPARENT_BRUSH); + wxDCBrushChanger dummy(dc, colSelect); //alpha channel (not yet) supported on wxMSW, so draw selection before graphs + + wxPen selPen(colSelect); + //wxPen selPen(*wxBLACK); + //selPen.SetStyle(wxSHORT_DASH); + wxDCPenChanger dummy2(dc, selPen); + + for (auto i = allSelections.begin(); i != allSelections.end(); ++i) + { + const wxPoint pixelFrom = wxPoint(cvrtX.realToScreen(i->from.x), + cvrtY.realToScreen(i->from.y)) + dataOrigin; + const wxPoint pixelTo = wxPoint(cvrtX.realToScreen(i->to.x), + cvrtY.realToScreen(i->to.y)) + dataOrigin; + + switch (attr.mouseSelMode) + { + case SELECT_NONE: + break; + case SELECT_RECTANGLE: + dc.DrawRectangle(wxRect(pixelFrom, pixelTo)); + break; + case SELECT_X_AXIS: + dc.DrawRectangle(wxRect(wxPoint(pixelFrom.x, dataArea.y), wxPoint(pixelTo.x, dataArea.y + dataArea.height - 1))); + break; + case SELECT_Y_AXIS: + dc.DrawRectangle(wxRect(wxPoint(dataArea.x, pixelFrom.y), wxPoint(dataArea.x + dataArea.width - 1, pixelTo.y))); + break; + } + } + } + + //finally draw curves + for (GraphList::const_iterator j = curves_.begin(); j != curves_.end(); ++j) + { + std::vector<double>& yValues = yValuesList[j - curves_.begin()].first; //actual y-values + int offset = yValuesList[j - curves_.begin()].second; //x-value offset in pixel + + std::vector<wxPoint> curve; + for (std::vector<double>::const_iterator i = yValues.begin(); i != yValues.end(); ++i) + curve.push_back(wxPoint(i - yValues.begin() + offset, + dataArea.height - 1 - cvrtY.realToScreen(*i)) + dataOrigin); //screen y axis starts upper left + + if (!curve.empty()) + { + dc.SetPen(wxPen(j->second.color, j->second.lineWidth)); + dc.DrawLines(curve.size(), &curve[0]); + } + } + } + } +} diff --git a/wx+/graph.h b/wx+/graph.h new file mode 100644 index 00000000..61a90ca1 --- /dev/null +++ b/wx+/graph.h @@ -0,0 +1,325 @@ +// ************************************************************************** +// * This file is part of the zenXML project. It is distributed under the * +// * Boost Software License, Version 1.0. See accompanying file * +// * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt. * +// * Copyright (C) 2011 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** + +#ifndef WX_PLOT_HEADER_2344252459 +#define WX_PLOT_HEADER_2344252459 + +#include <vector> +#include <memory> +#include <wx/panel.h> +#include <wx/dcbuffer.h> +#include <zen/string_tools.h> + +//simple 2D graph as wxPanel specialization + +namespace zen +{ +/* +Example: + //init graph (optional) + m_panelGraph->setAttributes(Graph2D::GraphAttributes(). + setLabelX(Graph2D::POSLX_BOTTOM, 20, std::make_shared<LabelFormatterTimeElapsed>()). + setLabelY(Graph2D::POSLY_RIGHT, 60, std::make_shared<LabelFormatterBytes>())); + //set graph data + std::shared_ptr<GraphData>() graphDataBytes = ... + m_panelGraph->setData(graphDataBytes, Graph2D::LineAttributes().setLineWidth(2).setColor(wxColor(0, 192, 0))); +*/ + +//------------------------------------------------------------------------------------------------------------ +struct GraphData +{ + virtual ~GraphData() {} + virtual double getValue(double x) const = 0; + virtual double getXBegin() const = 0; + virtual double getXEnd() const = 0; //upper bound for x, getValue() is NOT evaluated at this position! Similar to std::vector::end() +}; + + +//reference data implementation + +class RangeData : public GraphData +{ +public: + std::vector<double>& refData() { return data; } + +private: + virtual double getValue(double x) const + { + const size_t pos = static_cast<size_t>(x); + return pos < data.size() ? data[pos] : 0; + } + virtual double getXBegin() const { return 0; } + virtual double getXEnd() const { return data.size(); } //example: two-element range is accessible within [0, 2) + + std::vector<double> data; +}; + + +//reference data implementation +class VectorData : public GraphData +{ +public: + operator std::vector<double>& () { return data; } + +private: + virtual double getValue(double x) const + { + const size_t pos = static_cast<size_t>(x); + return pos < data.size() ? data[pos] : 0; + } + virtual double getXBegin() const { return 0; } + virtual double getXEnd() const { return data.size(); } //example: two-element range is accessible within [0, 2) + + std::vector<double> data; +}; + +//------------------------------------------------------------------------------------------------------------ +struct LabelFormatter +{ + virtual ~LabelFormatter() {} + + //determine convenient graph label block size in unit of data: usually some small deviation on "sizeProposed" + virtual double getOptimalBlockSize(double sizeProposed) const = 0; + + //create human-readable text for x or y-axis position + virtual wxString formatText(double value, double optimalBlockSize) const = 0; +}; + +double nextNiceNumber(double blockSize); //round to next number which is convenient to read, e.g. 2.13 -> 2; 2.7 -> 2.5; 7 -> 5 + +struct DecimalNumberFormatter : public LabelFormatter +{ + virtual double getOptimalBlockSize(double sizeProposed) const { return nextNiceNumber(sizeProposed); } + virtual wxString formatText(double value, double optimalBlockSize) const { return zen::toString<wxString>(value); } +}; + +//------------------------------------------------------------------------------------------------------------ +//emit data selection event +//usage: wnd.Connect(wxEVT_GRAPH_SELECTION, GraphSelectEventHandler(MyDlg::OnGraphSelection), NULL, this); +// void MyDlg::OnGraphSelection(GraphSelectEvent& event); + + +extern const wxEventType wxEVT_GRAPH_SELECTION; + +struct SelectionBlock +{ + struct Point + { + Point() : x(0), y(0) {} + Point(double xVal, double yVal) : x(xVal), y(yVal) {} + double x; + double y; + }; + + Point from; + Point to; +}; + +class GraphSelectEvent : public wxCommandEvent +{ +public: + GraphSelectEvent(const SelectionBlock& selBlock) : wxCommandEvent(wxEVT_GRAPH_SELECTION), selBlock_(selBlock_) {} + + virtual wxEvent* Clone() const { return new GraphSelectEvent(selBlock_); } + + SelectionBlock getSelection() { return selBlock_; } + +private: + SelectionBlock selBlock_; +}; + +typedef void (wxEvtHandler::*GraphSelectEventFunction)(GraphSelectEvent&); + +#define GraphSelectEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(GraphSelectEventFunction, &func) + + +//------------------------------------------------------------------------------------------------------------ +class Graph2D : public wxPanel +{ +public: + Graph2D(wxWindow* parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTAB_TRAVERSAL | wxNO_BORDER, + const wxString& name = wxPanelNameStr); + + class LineAttributes + { + public: + LineAttributes() : autoColor(true), lineWidth(2) {} + + LineAttributes& setColor(const wxColour& col) { color = col; autoColor = false; return *this; } + LineAttributes& setLineWidth(size_t width) { lineWidth = width; return *this; } + + private: + friend class Graph2D; + + bool autoColor; + wxColour color; + size_t lineWidth; + }; + + void setData(const std::shared_ptr<GraphData>& data, const LineAttributes& attr = LineAttributes()); + void addData(const std::shared_ptr<GraphData>& data, const LineAttributes& attr = LineAttributes()); + + enum PosLabelY + { + Y_LABEL_LEFT, + Y_LABEL_RIGHT, + Y_LABEL_NONE + }; + + enum PosLabelX + { + X_LABEL_TOP, + X_LABEL_BOTTOM, + X_LABEL_NONE + }; + + enum SelMode + { + SELECT_NONE, + SELECT_RECTANGLE, + SELECT_X_AXIS, + SELECT_Y_AXIS, + }; + + class GraphAttributes + { + public: + GraphAttributes() : + minXauto(true), + maxXauto(true), + minX(0), + maxX(0), + minYauto(true), + maxYauto(true), + minY(0), + maxY(0), + labelposX(X_LABEL_BOTTOM), + labelHeightX(25), + labelFmtX(new DecimalNumberFormatter()), + labelposY(Y_LABEL_LEFT), + labelWidthY(60), + labelFmtY(new DecimalNumberFormatter()), + mouseSelMode(SELECT_RECTANGLE) {} + + + GraphAttributes& setMinX(double newMinX) { minX = newMinX; minXauto = false; return *this; } + GraphAttributes& setMaxX(double newMaxX) { maxX = newMaxX; maxXauto = false; return *this; } + + GraphAttributes& setMinY(double newMinY) { minY = newMinY; minYauto = false; return *this; } + GraphAttributes& setMaxY(double newMaxY) { maxY = newMaxY; maxYauto = false; return *this; } + + GraphAttributes& setAutoSize() { minXauto = true; maxXauto = true; minYauto = true; maxYauto = true; return *this; } + + GraphAttributes& setLabelX(PosLabelX posX, size_t height = 25, const std::shared_ptr<LabelFormatter>& newLabelFmt = std::shared_ptr<LabelFormatter>(new DecimalNumberFormatter())) + { + labelposX = posX; + labelHeightX = height; + labelFmtX = newLabelFmt; + return *this; + } + GraphAttributes& setLabelY(PosLabelY posY, size_t width = 60, const std::shared_ptr<LabelFormatter>& newLabelFmt = std::shared_ptr<LabelFormatter>(new DecimalNumberFormatter())) + { + labelposY = posY; + labelWidthY = width; + labelFmtY = newLabelFmt; + return *this; + } + + GraphAttributes& setSelectionMode(SelMode mode) { mouseSelMode = mode; return *this; } + + private: + friend class Graph2D; + + bool minXauto; //autodetect range for X value + bool maxXauto; + double minX; //x-range to visualize + double maxX; + + bool minYauto; //autodetect range for Y value + bool maxYauto; + double minY; //y-range to visualize + double maxY; + + PosLabelX labelposX; + size_t labelHeightX; + std::shared_ptr<LabelFormatter> labelFmtX; + + PosLabelY labelposY; + size_t labelWidthY; + std::shared_ptr<LabelFormatter> labelFmtY; + + SelMode mouseSelMode; + }; + void setAttributes(const GraphAttributes& newAttr) { attr = newAttr; Refresh(); } + GraphAttributes getAttributes() const { return attr; } + + + std::vector<SelectionBlock> getSelections() const { return oldSel; } + void setSelections(const std::vector<SelectionBlock>& sel) + { + oldSel = sel; + activeSel.reset(); + Refresh(); + } + void clearSelection() { oldSel.clear(); Refresh(); } + +private: + void OnMouseLeftDown(wxMouseEvent& event); + void OnMouseMovement(wxMouseEvent& event); + void OnMouseLeftUp (wxMouseEvent& event); + void OnMouseCaptureLost(wxMouseCaptureLostEvent& event); + + void onPaintEvent(wxPaintEvent& evt) + { + wxAutoBufferedPaintDC dc(this); //double-buffer only on systems that require it + render(dc); + } + + void onRefreshRequired(wxEvent& evt) + { + Refresh(); + evt.Skip(); + } + + void onEraseBackGround(wxEraseEvent& evt) {} + + void render(wxDC& dc) const; + + class MouseSelection + { + public: + MouseSelection(wxWindow& wnd, const wxPoint& posDragStart) : wnd_(wnd), posDragStart_(posDragStart), posDragCurrent(posDragStart) { wnd_.CaptureMouse(); } + ~MouseSelection() { if (wnd_.HasCapture()) wnd_.ReleaseMouse(); } + + wxPoint getStartPos() const { return posDragStart_; } + wxPoint& refCurrentPos() { return posDragCurrent; } + + SelectionBlock& refSelection() { return selBlock; } //set when selection is drawn: this is fine, 'cause only what's shown should be selected! + + private: + wxWindow& wnd_; + const wxPoint posDragStart_; + wxPoint posDragCurrent; + SelectionBlock selBlock; + }; + std::vector<SelectionBlock> oldSel; //applied selections + std::shared_ptr<MouseSelection> activeSel; //set during mouse selection + + GraphAttributes attr; //global attributes + + typedef std::vector<std::pair<std::shared_ptr<GraphData>, LineAttributes>> GraphList; + GraphList curves_; +}; +} + + +#endif //WX_PLOT_HEADER_2344252459 diff --git a/shared/image_tools.h b/wx+/image_tools.h index e78e7ced..e78e7ced 100644 --- a/shared/image_tools.h +++ b/wx+/image_tools.h diff --git a/shared/mouse_move_dlg.cpp b/wx+/mouse_move_dlg.cpp index 7981df49..3f7ca755 100644 --- a/shared/mouse_move_dlg.cpp +++ b/wx+/mouse_move_dlg.cpp @@ -6,7 +6,7 @@ #include "mouse_move_dlg.h" #include <vector> -#include <wx/msw/wrapwin.h> //includes "windows.h" +#include <zen/win.h> //includes "windows.h" #include <wx/stattext.h> #include <wx/statbmp.h> #include <wx/statline.h> @@ -17,35 +17,40 @@ using namespace zen; + namespace { -void getAllChildren(wxWindow& parent, std::vector<wxWindow*>& out) +template <class Fun> inline +void forEachChild(wxWindow& parent, Fun f) { wxWindowList& wl = parent.GetChildren(); - for (wxWindowList::iterator i = wl.begin(); i != wl.end(); ++i) + for (auto iter = wl.begin(); iter != wl.end(); ++iter) //yet another wxWidgets bug keeps us from using std::for_each { - if (dynamic_cast<wxStaticText*> (*i) || //redirect clicks on these "dead" controls to move dialog instead - dynamic_cast<wxStaticBitmap*> (*i) || - dynamic_cast<wxAnimationCtrl*>(*i) || - dynamic_cast<wxGauge*> (*i) || - dynamic_cast<wxStaticLine*> (*i) || - dynamic_cast<wxStatusBar*> (*i) || - dynamic_cast<wxPanel*> (*i)) - out.push_back(*i); - getAllChildren(**i, out); + wxWindow& wnd = **iter; + f(wnd); + forEachChild(wnd, f); } } } MouseMoveWindow::MouseMoveWindow(wxWindow& parent, bool includeParent) : wxWindow(&parent, wxID_ANY) { - std::vector<wxWindow*> windList; - if (includeParent) - windList.push_back(&parent); - getAllChildren(parent, windList); + wxObjectEventFunction memFunMouseDown = wxMouseEventHandler(MouseMoveWindow::LeftButtonDown); + auto connect = [&](wxWindow& wnd) + { + if (dynamic_cast<wxStaticText*> (&wnd) || //redirect clicks on these "dead" controls to move dialog instead + dynamic_cast<wxStaticBitmap*> (&wnd) || + dynamic_cast<wxAnimationCtrl*>(&wnd) || + dynamic_cast<wxGauge*> (&wnd) || + dynamic_cast<wxStaticLine*> (&wnd) || + dynamic_cast<wxStatusBar*> (&wnd) || + dynamic_cast<wxPanel*> (&wnd)) + wnd.Connect(wxEVT_LEFT_DOWN, memFunMouseDown, NULL, this); //wxWidgets macros are obviously not C++11 ready + }; - for (std::vector<wxWindow*>::const_iterator i = windList.begin(); i != windList.end(); ++i) - (*i)->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(MouseMoveWindow::LeftButtonDown), NULL, this); + if (includeParent) + connect(parent); + forEachChild(parent, connect); Hide(); //this is just a dummy window so that its parent can have ownership Disable(); diff --git a/shared/mouse_move_dlg.h b/wx+/mouse_move_dlg.h index 4412529c..44988e3a 100644 --- a/shared/mouse_move_dlg.h +++ b/wx+/mouse_move_dlg.h @@ -14,6 +14,8 @@ namespace zen /* move dialog by mouse-dragging contained sub-windows: just attach to parent via new in constructor: + +Syntax: new MouseMoveWindow(parent); //ownership passed to parent */ class MouseMoveWindow : public wxWindow //private wxEvtHandler diff --git a/shared/pch.h b/wx+/pch.h index aae74c08..acc03012 100644 --- a/shared/pch.h +++ b/wx+/pch.h @@ -12,18 +12,13 @@ #error do NOT use in release build! #endif -#ifdef _MSC_VER -#pragma warning(disable:4996) //"warning C4996: 'std::copy': Function call with parameters that may be unsafe" -#endif - //##################################################### // basic wxWidgets headers #ifndef WX_PRECOMP #define WX_PRECOMP #endif -#include <wx/wxprec.h> -//#include <wx/msw/wrapwin.h> -> already included via wxprec.h +#include <wx/wxprec.h> //#includes <wx/msw/wrapwin.h> //other wxWidgets headers #include <wx/log.h> diff --git a/shared/serialize.h b/wx+/serialize.h index 6930bcb9..c15e963d 100644 --- a/shared/serialize.h +++ b/wx+/serialize.h @@ -8,11 +8,11 @@ #define SERIALIZE_H_INCLUDED #include <vector> -#include "file_error.h" -#include <wx/stream.h> +#include <cstdint> #include <memory> -#include <boost/cstdint.hpp> -#include "file_io.h" +#include <wx/stream.h> +#include <zen/file_error.h> +#include <zen/file_io.h> namespace zen @@ -77,14 +77,10 @@ protected: void check() const; - wxInputStream& getStream() - { - return stream_; - } + wxInputStream& getStream() { return stream_; } private: wxInputStream& stream_; - void throwReadError() const; //throw FileError const wxString& errorObjName_; //used for error text only }; @@ -104,14 +100,10 @@ protected: void check() const; - wxOutputStream& getStream() - { - return stream_; - } + wxOutputStream& getStream() { return stream_; } private: wxOutputStream& stream_; - void throwWriteError() const; //throw FileError const wxString& errorObjName_; //used for error text only! }; @@ -143,9 +135,8 @@ private: -//---------------Inline Implementation--------------------------------------------------- -template <class T> -inline +//-----------------------implementation------------------------------- +template <class T> inline T readPOD(wxInputStream& stream) { T pod = 0; @@ -154,21 +145,19 @@ T readPOD(wxInputStream& stream) } -template <class T> -inline +template <class T> inline void writePOD(wxOutputStream& stream, const T& pod) { stream.Write(reinterpret_cast<const char*>(&pod), sizeof(T)); } -template <class S> -inline +template <class S> inline S readString(wxInputStream& stream) { typedef typename S::value_type CharType; - const auto strLength = readPOD<boost::uint32_t>(stream); + const auto strLength = readPOD<std::uint32_t>(stream); if (strLength <= 1000) { CharType buffer[1000]; @@ -184,11 +173,10 @@ S readString(wxInputStream& stream) } -template <class S> -inline +template <class S> inline void writeString(wxOutputStream& stream, const S& str) { - writePOD(stream, static_cast<boost::uint32_t>(str.length())); + writePOD(stream, static_cast<std::uint32_t>(str.length())); stream.Write(str.c_str(), sizeof(typename S::value_type) * str.length()); } @@ -197,7 +185,7 @@ inline void ReadInputStream::check() const { if (stream_.GetLastError() != wxSTREAM_NO_ERROR) - throwReadError(); + throw zen::FileError(_("Error reading from synchronization database:") + " \n" + "\"" + errorObjName_.c_str() + "\""); } @@ -211,8 +199,7 @@ T ReadInputStream::readNumberC() const //checked read operation } -template <class S> -inline +template <class S> inline S ReadInputStream::readStringC() const //checked read operation { S output; @@ -223,14 +210,29 @@ S ReadInputStream::readStringC() const //checked read operation } catch (std::exception&) { - throwReadError(); + throw FileError(_("Error reading from synchronization database:") + " \n" + "\"" + errorObjName_.c_str() + "\""); } return output; } -template <class T> inline +ReadInputStream::CharArray ReadInputStream::readArrayC() const +{ + const std::uint32_t byteCount = readNumberC<std::uint32_t>(); + CharArray buffer(new std::vector<char>(byteCount)); + if (byteCount > 0) + { + stream_.Read(&(*buffer)[0], byteCount); + check(); + if (stream_.LastRead() != byteCount) //some additional check + throw FileError(_("Error reading from synchronization database:") + " \n" + "\"" + errorObjName_.c_str() + "\""); + } + return buffer; +} + + +template <class T> inline void WriteOutputStream::writeNumberC(T number) const //checked write operation { writePOD<T>(stream_, number); @@ -238,8 +240,7 @@ void WriteOutputStream::writeNumberC(T number) const //checked write operation } -template <class S> -inline +template <class S> inline void WriteOutputStream::writeStringC(const S& str) const //checked write operation { writeString(stream_, str); @@ -247,12 +248,25 @@ void WriteOutputStream::writeStringC(const S& str) const //checked write operati } +inline +void WriteOutputStream::writeArrayC(const std::vector<char>& buffer) const +{ + writeNumberC<std::uint32_t>(static_cast<std::uint32_t>(buffer.size())); + if (buffer.size() > 0) + { + stream_.Write(&buffer[0], buffer.size()); + check(); + if (stream_.LastWrite() != buffer.size()) //some additional check + throw FileError(_("Error writing to synchronization database:") + " \n" + "\"" + errorObjName_.c_str() + "\""); + } +} + inline void WriteOutputStream::check() const { if (stream_.GetLastError() != wxSTREAM_NO_ERROR) - throwWriteError(); + throw FileError(_("Error writing to synchronization database:") + " \n" + "\"" + errorObjName_.c_str() + "\""); } } diff --git a/shared/shell_execute.h b/wx+/shell_execute.h index a127ee06..00faf6ea 100644 --- a/shared/shell_execute.h +++ b/wx+/shell_execute.h @@ -10,10 +10,10 @@ #include <wx/msgdlg.h> #ifdef FFS_WIN -#include "last_error.h" -#include "string_tools.h" -#include "i18n.h" -#include <wx/msw/wrapwin.h> //includes "windows.h" +#include <zen/last_error.h> +#include <zen/string_tools.h> +#include <zen/i18n.h> +#include <zen/win.h> //includes "windows.h" #elif defined FFS_LINUX #include <stdlib.h> diff --git a/shared/string_conv.h b/wx+/string_conv.h index 976080fb..3f4574ab 100644 --- a/shared/string_conv.h +++ b/wx+/string_conv.h @@ -7,9 +7,9 @@ #ifndef STRINGCONV_H_INCLUDED #define STRINGCONV_H_INCLUDED -#include <string_utf8.h> +#include <zen/utf8.h> #include <wx/string.h> -#include "zstring.h" +#include <zen/zstring.h> namespace zen { diff --git a/shared/wx_timespan.h b/wx+/timespan.h index d11b328e..d11b328e 100644 --- a/shared/wx_timespan.h +++ b/wx+/timespan.h diff --git a/shared/toggle_button.h b/wx+/toggle_button.h index f333ca24..98a39e32 100644 --- a/shared/toggle_button.h +++ b/wx+/toggle_button.h @@ -32,8 +32,8 @@ public: const wxString& inactiveTooltip); void setActive(bool value); - bool isActive() const; - void toggle(); + bool isActive() const { return active; } + void toggle() { setActive(!active); } private: bool active; @@ -46,4 +46,49 @@ private: }; + + + + + + + + + + + +//######################## implementation ######################## +inline +void ToggleButton::init(const wxBitmap& activeBmp, + const wxString& activeTooltip, + const wxBitmap& inactiveBmp, + const wxString& inactiveTooltip) +{ + m_activeBmp = activeBmp; + m_activeTooltip = activeTooltip; + m_inactiveBmp = inactiveBmp; + m_inactiveTooltip = inactiveTooltip; + + //load resources + setActive(active); +} + + +inline +void ToggleButton::setActive(bool value) +{ + active = value; + + if (active) + { + SetBitmapLabel(m_activeBmp); + SetToolTip(m_activeTooltip); + } + else + { + SetBitmapLabel(m_inactiveBmp); + SetToolTip(m_inactiveTooltip); + } +} + #endif // TOGGLEBUTTON_H_INCLUDED diff --git a/shared/custom_tooltip.cpp b/wx+/tooltip.cpp index 0e1c5172..9c2587b2 100644 --- a/shared/custom_tooltip.cpp +++ b/wx+/tooltip.cpp @@ -4,13 +4,16 @@ // * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** -#include "custom_tooltip.h" +#include "tooltip.h" #include <wx/stattext.h> #include <wx/sizer.h> #include <wx/statbmp.h> #include <wx/settings.h> -class CustomTooltip::PopupFrameGenerated : public wxFrame +using namespace zen; + + +class Tooltip::PopupFrameGenerated : public wxFrame { public: PopupFrameGenerated(wxWindow* parent, @@ -18,57 +21,47 @@ public: const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1, -1 ), - long style = wxFRAME_NO_TASKBAR | wxSTAY_ON_TOP | wxSTATIC_BORDER); - - wxStaticText* m_staticTextMain; - wxStaticBitmap* m_bitmapLeft; -}; + long style = wxFRAME_NO_TASKBAR | wxSTAY_ON_TOP | wxSTATIC_BORDER) : wxFrame(parent, id, title, pos, size, style) + { + this->SetSizeHints(wxDefaultSize, wxDefaultSize); + this->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INFOBK)); //both required: on Ubuntu background is black, foreground white! + this->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INFOTEXT)); // + wxBoxSizer* bSizer158; + bSizer158 = new wxBoxSizer(wxHORIZONTAL); -CustomTooltip::PopupFrameGenerated::PopupFrameGenerated( - 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(wxSystemSettings::GetColour(wxSYS_COLOUR_INFOBK)); //both required: on Ubuntu background is black, foreground white! - this->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INFOTEXT)); // + m_bitmapLeft = new wxStaticBitmap(this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0); + bSizer158->Add(m_bitmapLeft, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); - wxBoxSizer* bSizer158; - bSizer158 = new wxBoxSizer( wxHORIZONTAL ); + m_staticTextMain = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0); + bSizer158->Add(m_staticTextMain, 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); - 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, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizer158->Add( m_staticTextMain, 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5 ); + this->SetSizer(bSizer158); + this->Layout(); + bSizer158->Fit(this); + } - this->SetSizer( bSizer158 ); - this->Layout(); - bSizer158->Fit( this ); -} + wxStaticText* m_staticTextMain; + wxStaticBitmap* m_bitmapLeft; +}; -CustomTooltip::CustomTooltip() : tipWindow(new PopupFrameGenerated(NULL)), lastBmp(NULL) +Tooltip::Tooltip() : tipWindow(new PopupFrameGenerated(NULL)), lastBmp(NULL) { #ifdef FFS_WIN //neither looks good nor works at all on Linux tipWindow->Disable(); //prevent window stealing focus! #endif - hide(); } -CustomTooltip::~CustomTooltip() +Tooltip::~Tooltip() { tipWindow->Destroy(); } -void CustomTooltip::show(const wxString& text, wxPoint pos, const wxBitmap* bmp) +void Tooltip::show(const wxString& text, wxPoint pos, const wxBitmap* bmp) { if (bmp != lastBmp) { @@ -96,7 +89,7 @@ void CustomTooltip::show(const wxString& text, wxPoint pos, const wxBitmap* bmp) } -void CustomTooltip::hide() +void Tooltip::hide() { tipWindow->Hide(); } diff --git a/shared/custom_tooltip.h b/wx+/tooltip.h index c68856b4..d9053e2c 100644 --- a/shared/custom_tooltip.h +++ b/wx+/tooltip.h @@ -9,11 +9,13 @@ #include <wx/frame.h> -class CustomTooltip +namespace zen +{ +class Tooltip { public: - CustomTooltip(); - ~CustomTooltip(); + Tooltip(); + ~Tooltip(); void show(const wxString& text, wxPoint pos, const wxBitmap* bmp = NULL); //absolute screen coordinates void hide(); @@ -23,5 +25,6 @@ private: PopupFrameGenerated* tipWindow; const wxBitmap* lastBmp; //buffer last used bitmap pointer }; +} #endif // CUSTOMTOOLTIP_H_INCLUDED diff --git a/shared/assert_static.h b/zen/assert_static.h index 9b1a189e..00c4c5c8 100644 --- a/shared/assert_static.h +++ b/zen/assert_static.h @@ -8,14 +8,15 @@ #ifndef ASSERTSTATIC_H_INCLUDED #define ASSERTSTATIC_H_INCLUDED +/* //compile time assert based on Loki (http://loki-lib.sourceforge.net) #ifdef NDEBUG #define assert_static(x) //((void)0) -> leads to error when seen in namespace scope! -#else /* debugging enabled */ -namespace StaticCheckImpl +#else // debugging enabled +namespace static_check_impl { template<int> struct CompileTimeError; @@ -30,9 +31,14 @@ struct CompileTimeError<true> {}; #define assert_static(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; } */ +// #define assert_static(expr) \ +// { Loki::CompileTimeError<((expr) != 0)> Static_Assert_Has_Failed; (void)Static_Assert_Has_Failed; } #endif +*/ + +//C++11: +#define assert_static(X) \ + static_assert(X, "Static assert has failed!"); #endif //ASSERTSTATIC_H_INCLUDED diff --git a/shared/base64.h b/zen/base64.h index 4a81787c..4a81787c 100644 --- a/shared/base64.h +++ b/zen/base64.h diff --git a/zen/basic_math.h b/zen/basic_math.h new file mode 100644 index 00000000..24bcf27a --- /dev/null +++ b/zen/basic_math.h @@ -0,0 +1,356 @@ +// ************************************************************************** +// * This file is part of the FreeFileSync project. It is distributed under * +// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** + +#ifndef BASIC_MATH_HEADER_34726398432 +#define BASIC_MATH_HEADER_34726398432 + +#include <algorithm> +#include <iterator> +#include <limits> +#include <functional> + + +namespace numeric +{ +template <class T> +T abs(T value); + +template <class T> +T dist(T a, T b); + +template <class T> +int sign(T value); //returns -1/0/1 + +template <class T> +const T& min(const T& a, const T& b, const T& c); + +template <class T> +const T& max(const T& a, const T& b, const T& c); + +template <class T> +void confine(T& val, const T& minVal, const T& maxVal); //make sure minVal <= val && val <= maxVal + +template <class InputIterator> +std::pair<InputIterator, InputIterator> minMaxElement(InputIterator first, InputIterator last); +template <class InputIterator, class Compare> +std::pair<InputIterator, InputIterator> minMaxElement(InputIterator first, InputIterator last, Compare comp); + +template <class T> +bool isNull(T value); + +int round(double d); //little rounding function + +template <size_t N, class T> +T power(const T& value); + +double radToDeg(double rad); //convert unit [rad] into [] +double degToRad(double degree); //convert unit [] into [rad] + +template <class InputIterator> +double arithmeticMean(InputIterator first, InputIterator last); + +template <class RandomAccessIterator> +double median(RandomAccessIterator first, RandomAccessIterator last); //note: invalidates input range! + +template <class InputIterator> +double stdDeviation(InputIterator first, InputIterator last, double* mean = NULL); //estimate standard deviation (and thereby arithmetic mean) + +//median absolute deviation: "mad / 0.6745" is a robust measure for standard deviation of a normal distribution +template <class RandomAccessIterator> +double mad(RandomAccessIterator first, RandomAccessIterator last); //note: invalidates input range! + + +template <class InputIterator> +double norm2(InputIterator first, InputIterator last); + +//constants +const double pi = 3.14159265358979323846; +const double e = 2.71828182845904523536; +const double sqrt2 = 1.41421356237309504880; +const double ln2 = 0.693147180559945309417; +//---------------------------------------------------------------------------------- + + + + + + + + + + + + + + + + + + + + + + +//################# inline implementation ######################### +template <class T> inline +T abs(T value) +{ + return value < 0 ? -1 * value : value; +} + +template <class T> inline +T dist(T a, T b) +{ + return a > b ? a - b : b - a; +} + + +template <class T> inline +int sign(T value) //returns -1/0/1 +{ + return value < 0 ? -1 : (value > 0 ? 1 : 0); +} + + +template <class T> inline +const T& min(const T& a, const T& b, const T& c) +{ + return std::min(std::min(a, b), c); +} + + +template <class T> inline +const T& max(const T& a, const T& b, const T& c) +{ + return std::max(std::max(a, b), c); +} + + +template <class T> inline +void confine(T& val, const T& minVal, const T& maxVal) +{ + assert(minVal <= maxVal); + if (val < minVal) + val = minVal; + else if (val > maxVal) + val = maxVal; +} + + +template <class InputIterator, class Compare> inline +std::pair<InputIterator, InputIterator> minMaxElement(InputIterator first, InputIterator last, Compare comp) +{ + InputIterator lowest = first; + InputIterator largest = first; + + if (first != last) + while (++first != last) + { + if (comp(*largest, *first)) // or: if (comp(*largest,*lowest)) for the comp version + largest = first; + else if (comp(*first, *lowest)) + lowest = first; + } + return std::make_pair(lowest, largest); +} + + +template <class InputIterator> inline +std::pair<InputIterator, InputIterator> minMaxElement(InputIterator first, InputIterator last) +{ + return minMaxElement(first, last, std::less<typename std::iterator_traits<InputIterator>::value_type>()); +} + + +template <class T> inline +bool isNull(T value) +{ + return abs(value) <= std::numeric_limits<T>::epsilon(); //epsilon is 0 fr integral types => less-equal +} + + +inline +int round(double d) +{ + return static_cast<int>(d < 0 ? d - 0.5 : d + 0.5); +} + + +namespace +{ +template <size_t N, class T> +struct PowerImpl +{ + static T result(const T& value) + { + return PowerImpl<N - 1, T>::result(value) * value; + } +}; + +template <class T> +struct PowerImpl<2, T> +{ + static T result(const T& value) + { + return value * value; + } +}; + +template <class T> +struct PowerImpl<0, T>; //not defined: invalidates power<0> and power<1> + +template <class T> +struct PowerImpl<10, T>; //not defined: invalidates power<N> for N >= 10 +} + +template <size_t N, class T> inline +T power(const T& value) +{ + return PowerImpl<N, T>::result(value); +} + + +inline +double radToDeg(double rad) +{ + return rad * 180.0 / numeric::pi; +} + + +inline +double degToRad(double degree) +{ + return degree * numeric::pi / 180.0; +} + + +template <class InputIterator> inline +double arithmeticMean(InputIterator first, InputIterator last) +{ + //low level implementation to avoid random-access requirement on iterator + size_t n = 0; + double sum_xi = 0; + + for (; first != last; ++first, ++n) + sum_xi += *first; + + return n == 0 ? 0 : sum_xi / n; +} + + +template <class RandomAccessIterator> inline +double median(RandomAccessIterator first, RandomAccessIterator last) //note: invalidates input range! +{ + const size_t n = last - first; + if (n > 0) + { + std::nth_element(first, first + n / 2, last); //complexity: O(n) + const double midVal = *(first + n / 2); + + if (n % 2 != 0) + return midVal; + else //n is even and >= 2 in this context: return mean of two middle values + return 0.5 * (*std::max_element(first, first + n / 2) + midVal); //this operation is the reason why median() CANNOT support a comparison predicate!!! + } + return 0; +} + + +class LessMinusMedAbs : public std::binary_function<double, double, bool> +{ +public: + LessMinusMedAbs(double median) : median_(median) {} + bool operator()(double lhs, double rhs) const + { + return abs(lhs - median_) < abs(rhs - median_); + } +private: + double median_; +}; + + +template <class RandomAccessIterator> inline +double mad(RandomAccessIterator first, RandomAccessIterator last) //note: invalidates input range! +{ + //http://en.wikipedia.org/wiki/Median_absolute_deviation + + const size_t n = last - first; + if (n > 0) + { + const double m = median(first, last); + + //the second median needs to operate on absolute residuals => avoid transforming input range as it may decrease precision! + + std::nth_element(first, first + n / 2, last, LessMinusMedAbs(m)); //complexity: O(n) + const double midVal = abs(*(first + n / 2) - m); + + if (n % 2 != 0) + return midVal; + else //n is even and >= 2 in this context: return mean of two middle values + { + const double midVal2 = abs(*std::max_element(first, first + n / 2, LessMinusMedAbs(m)) - m); + return 0.5 * (midVal2 + midVal); + } + } + return 0; +} + + +template <class InputIterator> inline +double stdDeviation(InputIterator first, InputIterator last, double* arithMean) +{ + //implementation minimizing rounding errors, see: http://en.wikipedia.org/wiki/Standard_deviation + //combined with techinque avoiding overflow, see: http://www.netlib.org/blas/dnrm2.f -> only 10% performance degregation + + size_t n = 0; + double mean = 0; + double q = 0; + double scale = 1; + + for (; first != last; ++first) + { + ++n; + const double val = *first - mean; + + if (abs(val) > scale) + { + q = (n - 1.0) / n + q * power<2>(scale / val); + scale = abs(val); + } + else + q += (n - 1.0) * power<2>(val / scale) / n; + + mean += val / n; + } + + if (arithMean) + *arithMean = mean; + + return n <= 1 ? 0 : std::sqrt(q / (n - 1)) * scale; +} + + +template <class InputIterator> inline +double norm2(InputIterator first, InputIterator last) +{ + double result = 0; + double scale = 1; + for (; first != last; ++first) + { + const double tmp = abs(*first); + if (tmp > scale) + { + result = 1 + result * power<2>(scale / tmp); + scale = tmp; + } + else + result += power<2>(tmp / scale); + } + return std::sqrt(result) * scale; +} +} + +#endif //BASIC_MATH_HEADER_34726398432 diff --git a/shared/build_info.h b/zen/build_info.h index f13b2dbc..e57d0c77 100644 --- a/shared/build_info.h +++ b/zen/build_info.h @@ -7,7 +7,7 @@ #ifndef BUILDINFO_H_INCLUDED #define BUILDINFO_H_INCLUDED -namespace util +namespace zen { //determine build info //safer than checking for _WIN64 (defined on windows for 64-bit compilations only) while _WIN32 is always defined (even for x64 compiler!) @@ -15,4 +15,4 @@ static const bool is32BitBuild = sizeof(void*) == 4; static const bool is64BitBuild = sizeof(void*) == 8; } -#endif // BUILDINFO_H_INCLUDED +#endif //BUILDINFO_H_INCLUDED diff --git a/shared/com_error.h b/zen/com_error.h index e3d51d4b..2ba76c0f 100644 --- a/shared/com_error.h +++ b/zen/com_error.h @@ -9,11 +9,9 @@ #include <string> #include <cstdio> -#include <windows.h> -#undef min -#undef max +#include "win.h" //includes "windows.h" -namespace util +namespace zen { std::wstring generateErrorMsg(const std::wstring& input, HRESULT hr); std::wstring formatWin32Msg(DWORD dwMessageId); //return empty string on error @@ -38,14 +36,6 @@ std::wstring formatWin32Msg(DWORD dwMessageId); //return empty string on error - - - - - - - - //################# implementation ##################### std::wstring formatWin32Msg(DWORD dwMessageId) //return empty string on error { @@ -201,16 +191,16 @@ std::wstring generateErrorMsg(const std::wstring& input, HRESULT hr) output += L"\n"; output += L"HRESULT: " + numberToHexString(hr) + L",\n"; - //don't use _com_error(hr).ErrorMessage(), this is nothing more than a call to ::FormatMessage() + //don't use _com_error(hr).ErrorMessage(): internally this is nothing more than a call to ::FormatMessage() std::wstring win32Msg = formatWin32Msg(hr); if (!win32Msg.empty()) //empty string on error output += win32Msg; else { output += L"Facility: " + formatFacility(hr) + L",\n"; - output += L"Win32 Error: " + formatWin32Msg(HRESULT_CODE(hr)); //interpet hr as a Win32 code; this is often useful + output += L"Win32 Error: " + formatWin32Msg(HRESULT_CODE(hr)); //interpret hr as a Win32 code; this is often useful... } return output; } } -#endif //COM_ERROR_HEADER
\ No newline at end of file +#endif //COM_ERROR_HEADER diff --git a/shared/com_ptr.h b/zen/com_ptr.h index be1776fd..380f4536 100644 --- a/shared/com_ptr.h +++ b/zen/com_ptr.h @@ -7,10 +7,10 @@ #ifndef SMART_COM_PTR_H #define SMART_COM_PTR_H -#include <Objbase.h> #include <algorithm> +#include <Objbase.h> -namespace util +namespace zen { /* ComPtr: RAII class handling COM objects @@ -35,13 +35,11 @@ class ComPtr public: ComPtr() : ptr(NULL) {} - ComPtr(const ComPtr& rhs) : ptr(rhs.ptr) { if (ptr) ptr->AddRef(); } + ComPtr(const ComPtr& other) : ptr(other.ptr) { if (ptr) ptr->AddRef(); } + ComPtr( ComPtr&& other) : ptr(other.release()) {} - ComPtr& operator=(const ComPtr& rhs) - { - ComPtr(rhs).swap(*this); - return *this; - } + ComPtr& operator=(const ComPtr& other) { ComPtr(other).swap(*this); return *this; } + ComPtr& operator=( ComPtr&& other) { swap(other); return *this; } ~ComPtr() { if (ptr) ptr->Release(); } @@ -105,7 +103,7 @@ ComPtr<S> com_dynamic_cast(const ComPtr<T>& other); //throw() //we cannot specialize std::swap() for a class template and are not allowed to overload it => offer swap in own namespace template <class T> inline -void swap(util::ComPtr<T>& lhs, util::ComPtr<T>& rhs) +void swap(zen::ComPtr<T>& lhs, zen::ComPtr<T>& rhs) { lhs.swap(rhs); } diff --git a/shared/com_util.h b/zen/com_util.h index b8fc777d..db51404b 100644 --- a/shared/com_util.h +++ b/zen/com_util.h @@ -11,8 +11,7 @@ #include <string> #include <cassert> - -namespace util +namespace zen { //get an enumeration interface as a std::vector of bound(!) ComPtr(s) template <class T, class U> @@ -67,18 +66,8 @@ private: - - - - - - - - - //############################ inline implemenatation ################################## -template <class T, class U> -inline +template <class T, class U> inline std::vector<ComPtr<T> > convertEnum(const ComPtr<U>& enumObj) { std::vector<ComPtr<T> > output; @@ -106,8 +95,7 @@ std::vector<ComPtr<T> > convertEnum(const ComPtr<U>& enumObj) } -template <class T, class MemFun> -inline +template <class T, class MemFun> inline std::wstring getText(ComPtr<T> comObj, MemFun memFun) { std::wstring text; diff --git a/shared/debug_log.h b/zen/debug_log.h index 561eee9d..d8871ef9 100644 --- a/shared/debug_log.h +++ b/zen/debug_log.h @@ -8,7 +8,12 @@ #define DEBUG_LOG_HEADER_017324601673246392184621895740256342 #include "zstring.h" -#include <wx/file.h> + +cleanup this mess + remove any wxWidgets dependency! + +//small macro for writing debug information into a logfile +#define WRITE_DEBUG_LOG(x) globalLogFile().write(getCodeLocation(__TFILE__, __LINE__) + x); +//speed alternative: wxLogDebug(wxT("text")) + DebugView class DebugLog @@ -60,21 +65,18 @@ private: wxFile logFile; //logFile.close(); <- not needed }; -inline DebugLog& globalLogFile() +inline +DebugLog& globalLogFile() { static DebugLog inst; //external linkage despite header definition! return inst; } -inline wxString getCodeLocation(const wxString& file, int line) +inline +wxString getCodeLocation(const wxString& file, int line) { return wxString(file).AfterLast(FILE_NAME_SEPARATOR) + wxT(", LINE ") + toString<wxString>(line) + wxT(" | "); } -//small macro for writing debug information into a logfile -#define WRITE_DEBUG_LOG(x) globalLogFile().write(getCodeLocation(__TFILE__, __LINE__) + x); -//speed alternative: wxLogDebug(wxT("text")) + DebugView - - #endif //DEBUG_LOG_HEADER_017324601673246392184621895740256342 diff --git a/shared/debug_new.cpp b/zen/debug_new.cpp index 23a26a4e..c830a36b 100644 --- a/shared/debug_new.cpp +++ b/zen/debug_new.cpp @@ -6,14 +6,11 @@ #include "debug_new.h" -#ifdef _MSC_VER -#include <wx/msw/wrapwin.h> //includes "windows.h" +#include "win.h" //includes "windows.h" #include "DbgHelp.h" //available for MSC only #pragma comment(lib, "Dbghelp.lib") -#endif -#ifdef _MSC_VER namespace { LONG WINAPI writeDumpOnException(EXCEPTION_POINTERS* pExceptionInfo) @@ -27,14 +24,13 @@ LONG WINAPI writeDumpOnException(EXCEPTION_POINTERS* pExceptionInfo) MINIDUMP_EXCEPTION_INFORMATION* exceptParam = pExceptionInfo ? &exInfo : NULL; - ::MiniDumpWriteDump( - ::GetCurrentProcess(), //__in HANDLE hProcess, - ::GetCurrentProcessId(), //__in DWORD ProcessId, - hFile, //__in HANDLE hFile, - MiniDumpWithDataSegs, //__in MINIDUMP_TYPE DumpType, ->Standard: MiniDumpNormal, Medium: MiniDumpWithDataSegs, Full: MiniDumpWithFullMemory - exceptParam, //__in PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, - NULL, //__in PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, - NULL); //__in PMINIDUMP_CALLBACK_INFORMATION CallbackParam + ::MiniDumpWriteDump(::GetCurrentProcess(), //__in HANDLE hProcess, + ::GetCurrentProcessId(), //__in DWORD ProcessId, + hFile, //__in HANDLE hFile, + MiniDumpWithDataSegs, //__in MINIDUMP_TYPE DumpType, ->Standard: MiniDumpNormal, Medium: MiniDumpWithDataSegs, Full: MiniDumpWithFullMemory + exceptParam, //__in PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, + NULL, //__in PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, + NULL); //__in PMINIDUMP_CALLBACK_INFORMATION CallbackParam ::CloseHandle(hFile); @@ -56,5 +52,3 @@ void mem_check::writeMinidump() { writeDumpOnException(NULL); } - -#endif //_MSC_VER diff --git a/shared/debug_new.h b/zen/debug_new.h index ba31e489..2976d3d7 100644 --- a/shared/debug_new.h +++ b/zen/debug_new.h @@ -11,7 +11,6 @@ #include <sstream> #include <cstdlib> //malloc(), free() - #ifndef _MSC_VER #error currently for use with MSC only #endif diff --git a/shared/dir_watcher.cpp b/zen/dir_watcher.cpp index 5d178734..7b45b014 100644 --- a/shared/dir_watcher.cpp +++ b/zen/dir_watcher.cpp @@ -5,17 +5,14 @@ // ************************************************************************** #include "dir_watcher.h" -#include "last_error.h" -#include "i18n.h" #include <algorithm> -#include "boost_thread_wrap.h" //include <boost/thread.hpp> -#include "loki/ScopeGuard.h" #include <set> -#include <wx/log.h> //wxSafeShowMessage +#include "thread.h" //includes <boost/thread.hpp> +#include "scope_guard.h" #ifdef FFS_WIN #include "notify_removal.h" -#include <wx/msw/wrapwin.h> //includes "windows.h" +#include "win.h" //includes "windows.h" #include "long_path_prefix.h" #include "privilege.h" @@ -31,6 +28,15 @@ using namespace zen; #ifdef FFS_WIN namespace { +inline +bool errorCodeForNotExisting(const DWORD lastError) +{ + return lastError == ERROR_PATH_NOT_FOUND || + lastError == ERROR_BAD_NETPATH || + lastError == ERROR_NETNAME_DELETED; +} + + class SharedData { public: @@ -46,26 +52,28 @@ public: else { const char* bufPos = &buffer[0]; - while (true) + for(;;) { const FILE_NOTIFY_INFORMATION& notifyInfo = reinterpret_cast<const FILE_NOTIFY_INFORMATION&>(*bufPos); const Zstring fullname = dirname + Zstring(notifyInfo.FileName, notifyInfo.FileNameLength / sizeof(WCHAR)); //skip modifications sent by changed directories: reason for change, child element creation/deletion, will notify separately! - bool skip = false; - if (notifyInfo.Action == FILE_ACTION_RENAMED_OLD_NAME) //FILE_ACTION_RENAMED_NEW_NAME should suffice - skip = true; - else if (notifyInfo.Action == FILE_ACTION_MODIFIED) + [&]() { - //note: this check will not work if top watched directory has been renamed - const DWORD ret = ::GetFileAttributes(applyLongPathPrefix(fullname).c_str()); - bool isDir = ret != INVALID_FILE_ATTRIBUTES && (ret & FILE_ATTRIBUTE_DIRECTORY); //returns true for (dir-)symlinks also - skip = isDir; - } + if (notifyInfo.Action == FILE_ACTION_RENAMED_OLD_NAME) //reporting FILE_ACTION_RENAMED_NEW_NAME should suffice + return; + + if (notifyInfo.Action == FILE_ACTION_MODIFIED) + { + //note: this check will not work if top watched directory has been renamed + const DWORD ret = ::GetFileAttributes(applyLongPathPrefix(fullname).c_str()); + if (ret != INVALID_FILE_ATTRIBUTES && (ret & FILE_ATTRIBUTE_DIRECTORY)) //returns true for (dir-)symlinks also + return; + } - if (!skip) output.insert(fullname); + }(); if (notifyInfo.NextEntryOffset == 0) break; @@ -83,13 +91,20 @@ public: //context of main thread - void getChanges(std::vector<Zstring>& output) //throw FileError + void getChanges(std::vector<Zstring>& output) //throw FileError, ErrorNotExisting { boost::lock_guard<boost::mutex> dummy(lockAccess); //first check whether errors occured in thread - if (!errorMsg.empty()) - throw zen::FileError(errorMsg.c_str()); + if (!errorMsg.first.empty()) + { + const std::wstring msg = errorMsg.first.c_str(); + const DWORD lastError = errorMsg.second; + + if (errorCodeForNotExisting(lastError)) + throw ErrorNotExisting(msg); + throw FileError(msg); + } output.assign(changedFiles.begin(), changedFiles.end()); changedFiles.clear(); @@ -97,10 +112,10 @@ public: //context of worker thread - void reportError(const std::wstring& msg) //throw () + void reportError(const std::wstring& msg, DWORD errorCode) //throw() { boost::lock_guard<boost::mutex> dummy(lockAccess); - errorMsg = cvrtString<BasicWString>(msg); + errorMsg = std::make_pair(cvrtString<BasicWString>(msg), errorCode); } private: @@ -108,19 +123,19 @@ private: boost::mutex lockAccess; std::set<Zstring> changedFiles; //get rid of duplicate entries (actually occur!) - BasicWString errorMsg; //non-empty if errors occured in thread + std::pair<BasicWString, DWORD> errorMsg; //non-empty if errors occured in thread }; class ReadChangesAsync { public: + //constructed in main thread! ReadChangesAsync(const Zstring& directory, //make sure to not leak in thread-unsafe types! const std::shared_ptr<SharedData>& shared) : shared_(shared), dirname(directory) { - //still in main thread if (!endsWith(dirname, FILE_NAME_SEPARATOR)) dirname += FILE_NAME_SEPARATOR; @@ -141,10 +156,14 @@ public: FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, NULL); if (hDir == INVALID_HANDLE_VALUE ) - throw FileError(_("Could not initialize directory monitoring:") + "\n\"" + utf8CvrtTo<std::wstring>(dirname) + "\"" + "\n\n" + zen::getLastErrorFormatted()); + { + const std::wstring errorMsg = _("Could not initialize directory monitoring:") + "\n\"" + utf8CvrtTo<std::wstring>(dirname) + "\"" + "\n\n" + zen::getLastErrorFormatted(); + if (errorCodeForNotExisting(::GetLastError())) + throw ErrorNotExisting(errorMsg); + throw FileError(errorMsg); + } - //Loki::ScopeGuard guardDir = Loki::MakeGuard(::CloseHandle, hDir); - //guardDir.Dismiss(); + //end of constructor, no need to start managing "hDir" } ~ReadChangesAsync() @@ -159,7 +178,7 @@ public: { std::vector<char> buffer(64 * 1024); //needs to be aligned on a DWORD boundary; maximum buffer size restricted by some networks protocols (according to docu) - while (true) + for(;;) { boost::this_thread::interruption_point(); @@ -170,10 +189,8 @@ public: false, //__in BOOL bInitialState, NULL); //__in_opt LPCTSTR lpName if (overlapped.hEvent == NULL) - return shared_->reportError(_("Error when monitoring directories.") + " (CreateEvent)" + "\n\n" + getLastErrorFormatted()); //throw () + quit thread - - Loki::ScopeGuard dummy = Loki::MakeGuard(::CloseHandle, overlapped.hEvent); - (void)dummy; + return shared_->reportError(_("Error when monitoring directories.") + " (CreateEvent)" + "\n\n" + getLastErrorFormatted(), ::GetLastError()); + ZEN_ON_BLOCK_EXIT(::CloseHandle(overlapped.hEvent)); //asynchronous variant: runs on this thread's APC queue! if (!::ReadDirectoryChangesW(hDir, // __in HANDLE hDirectory, @@ -187,10 +204,10 @@ public: NULL, // __out_opt LPDWORD lpBytesReturned, &overlapped, // __inout_opt LPOVERLAPPED lpOverlapped, NULL)) // __in_opt LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine - return shared_->reportError(_("Error when monitoring directories.") + " (ReadDirectoryChangesW)" + "\n\n" + getLastErrorFormatted()); //throw () + quit thread + return shared_->reportError(_("Error when monitoring directories.") + " (ReadDirectoryChangesW)" + "\n\n" + getLastErrorFormatted(), ::GetLastError()); //async I/O is a resource that needs to be guarded since it will write to local variable "buffer"! - Loki::ScopeGuard lockAio = Loki::MakeGuard([&]() + zen::ScopeGuard lockAio = zen::makeGuard([&]() { //http://msdn.microsoft.com/en-us/library/aa363789(v=vs.85).aspx if (::CancelIo(hDir) == TRUE) //cancel all async I/O related to this handle and thread @@ -209,7 +226,7 @@ public: false)) //__in BOOL bWait { if (::GetLastError() != ERROR_IO_INCOMPLETE) - return shared_->reportError(_("Error when monitoring directories.") + " (GetOverlappedResult)" + "\n\n" + getLastErrorFormatted()); //throw () + quit thread + return shared_->reportError(_("Error when monitoring directories.") + " (GetOverlappedResult)" + "\n\n" + getLastErrorFormatted(), ::GetLastError()); //execute asynchronous procedure calls (APC) queued on this thread ::SleepEx(50, // __in DWORD dwMilliseconds, @@ -217,7 +234,7 @@ public: boost::this_thread::interruption_point(); } - lockAio.Dismiss(); + lockAio.dismiss(); shared_->addChanges(&buffer[0], bytesWritten, dirname); //throw () } @@ -226,10 +243,6 @@ public: { throw; //this is the only reasonable exception! } - catch (...) //exceptions must be catched per thread - { - wxSafeShowMessage(wxString(_("An exception occurred!")) + wxT("(Dir Watcher)"), wxT("Unknown exception in worker thread!")); //simple wxMessageBox won't do for threads - } } ReadChangesAsync(ReadChangesAsync && other) : @@ -273,7 +286,7 @@ public: private: virtual void onRequestRemoval(HANDLE hnd) { - //must release hDir immediately! + //must release hDir immediately => stop monitoring! worker_.interrupt(); worker_.join(); //now hDir should have been released @@ -359,7 +372,7 @@ public: virtual ReturnValDir onDir (const Zchar* shortName, const Zstring& fullName) { dirs_.push_back(fullName); - return ReturnValDir(Loki::Int2Type<ReturnValDir::TRAVERSING_DIR_CONTINUE>(), *this); + return ReturnValDir(zen::Int2Type<ReturnValDir::TRAVERSING_DIR_CONTINUE>(), *this); } virtual HandleError onError(const std::wstring& errorText) { throw FileError(errorText); } @@ -389,7 +402,7 @@ DirWatcher::DirWatcher(const Zstring& directory) : //throw FileError if (pimpl_->notifDescr == -1) throw FileError(_("Could not initialize directory monitoring:") + "\n\"" + dirname + "\"" + "\n\n" + getLastErrorFormatted()); - Loki::ScopeGuard guardDescr = Loki::MakeGuard(::close, pimpl_->notifDescr); + zen::ScopeGuard guardDescr = zen::makeGuard([&]() { ::close(pimpl_->notifDescr); }); //set non-blocking mode bool initSuccess = false; @@ -415,14 +428,19 @@ DirWatcher::DirWatcher(const Zstring& directory) : //throw FileError IN_DELETE_SELF | IN_MOVE_SELF); if (wd == -1) - throw FileError(_("Could not initialize directory monitoring:") + "\n\"" + subdir + "\"" + "\n\n" + getLastErrorFormatted()); + { + std::wstring errorMsg = _("Could not initialize directory monitoring:") + "\n\"" + subdir + "\"" + "\n\n" + getLastErrorFormatted(); + if (errno == ENOENT) + throw ErrorNotExisting(errorMsg); + throw FileError(errorMsg); + } if (!endsWith(subdir, FILE_NAME_SEPARATOR)) subdir += FILE_NAME_SEPARATOR; pimpl_->watchDescrs.insert(std::make_pair(wd, subdir)); }); - guardDescr.Dismiss(); + guardDescr.dismiss(); } diff --git a/shared/dir_watcher.h b/zen/dir_watcher.h index c2bab1d5..df3c444c 100644 --- a/shared/dir_watcher.h +++ b/zen/dir_watcher.h @@ -7,9 +7,9 @@ #ifndef DIR_WATCHER_348577025748023458 #define DIR_WATCHER_348577025748023458 -#include "file_error.h" #include <vector> #include <memory> +#include "file_error.h" namespace zen { @@ -31,7 +31,7 @@ namespace zen class DirWatcher { public: - DirWatcher(const Zstring& directory); //throw FileError + DirWatcher(const Zstring& directory); //throw FileError, ErrorNotExisting ~DirWatcher(); //extract accumulated changes since last call diff --git a/shared/disable_standby.h b/zen/disable_standby.h index 1a2a2b8a..ec112427 100644 --- a/shared/disable_standby.h +++ b/zen/disable_standby.h @@ -2,10 +2,10 @@ #define PREVENTSTANDBY_H_INCLUDED #ifdef FFS_WIN -#include <wx/msw/wrapwin.h> //includes "windows.h" +#include "win.h" //includes "windows.h" #endif -namespace util +namespace zen { class DisableStandby { diff --git a/shared/dll_loader.h b/zen/dll.h index e34fc4a9..302a3ac8 100644 --- a/shared/dll_loader.h +++ b/zen/dll.h @@ -9,18 +9,10 @@ #include <memory> #include <string> -#include "loki\ScopeGuard.h" +#include "scope_guard.h" +#include "win.h" //includes "windows.h" -#ifdef __WXMSW__ //we have wxWidgets -#include <wx/msw/wrapwin.h> //includes "windows.h" -#else -#include <windows.h> -#undef max -#undef min -#endif - - -namespace util +namespace zen { /* Manage DLL function and library ownership @@ -29,8 +21,8 @@ Manage DLL function and library ownership Usage: typedef BOOL (WINAPI *IsWow64ProcessFun)(HANDLE hProcess, PBOOL Wow64Process); - const util::DllFun<IsWow64ProcessFun> isWow64Process(L"kernel32.dll", "IsWow64Process"); - if (isWow64Process) + const zen::DllFun<IsWow64ProcessFun> isWow64Process(L"kernel32.dll", "IsWow64Process"); + if (isWow64Process) ... use function ptr ... */ template <class Func> @@ -48,10 +40,28 @@ public: private: static void deleter(HMODULE* ptr) { if (*ptr) ::FreeLibrary(*ptr); delete ptr; } - std::shared_ptr<HMODULE> hLibRef; + std::shared_ptr<const HMODULE> hLibRef; + Func fun; +}; + +//if the dll is already part of the process space, e.g. "kernel32.dll" or "shell32.dll", we can use a faster variant: +//NOTE: since the lifetime of the referenced library is *not* controlled, this is safe to use only for permanently loaded libraries like these! +template <class Func> +class SysDllFun +{ +public: + SysDllFun() : fun(NULL) {} + + SysDllFun(const wchar_t* systemLibrary, const char* functionName) : + fun(reinterpret_cast<Func>(::GetProcAddress(::GetModuleHandle(systemLibrary), functionName))) {} + + operator Func() const { return fun; } + +private: Func fun; }; + /* extract binary resources from .exe/.dll: @@ -86,7 +96,7 @@ std::string getResourceStream(const wchar_t* libraryName, size_t resourceId) HMODULE module = ::LoadLibrary(libraryName); if (module) { - LOKI_ON_BLOCK_EXIT2(::FreeLibrary(module)); + ZEN_ON_BLOCK_EXIT(::FreeLibrary(module)); const HRSRC res = ::FindResource(module, MAKEINTRESOURCE(resourceId), RT_RCDATA); if (res != NULL) diff --git a/shared/dst_hack.cpp b/zen/dst_hack.cpp index aa7a0f3e..f6579441 100644 --- a/shared/dst_hack.cpp +++ b/zen/dst_hack.cpp @@ -1,15 +1,12 @@ #include "dst_hack.h" -#include "i18n.h" +#include <bitset> +#include "basic_math.h" #include "long_path_prefix.h" -#include "string_utf8.h" -#include "last_error.h" +#include "utf8.h" #include "assert_static.h" -#include <bitset> -#include "global_func.h" -#include <limits> #include "int64.h" #include "file_error.h" -#include "dll_loader.h" +#include "dll.h" using namespace zen; @@ -32,7 +29,7 @@ Zstring getVolumeName(const Zstring& filename) if (!endsWith(nameFmt, FILE_NAME_SEPARATOR)) nameFmt += FILE_NAME_SEPARATOR; //GetVolumeInformation expects trailing backslash - if (nameFmt.StartsWith(Zstr("\\\\"))) //UNC path: "\\ComputerName\SharedFolder\" + if (startsWith(nameFmt, Zstr("\\\\"))) //UNC path: "\\ComputerName\SharedFolder\" { size_t nameSize = nameFmt.size(); const size_t posFirstSlash = nameFmt.find(Zstr("\\"), 2); @@ -85,21 +82,6 @@ bool dst::isFatDrive(const Zstring& fileName) //throw() } -bool dst::vistaOrLater() -{ - OSVERSIONINFO osvi = {}; - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - - //IFileOperation is supported with Vista and later - if (::GetVersionEx(&osvi)) - return osvi.dwMajorVersion > 5; - //XP has majorVersion == 5, minorVersion == 1 - //Vista has majorVersion == 6, minorVersion == 0 - //version overview: http://msdn.microsoft.com/en-us/library/ms724834(VS.85).aspx - return false; -} - - bool dst::isFatDrive(HANDLE hFile) //throw() { //dynamically load windows API function @@ -112,7 +94,7 @@ bool dst::isFatDrive(HANDLE hFile) //throw() LPWSTR lpFileSystemNameBuffer, DWORD nFileSystemNameSize); - const util::DllFun<GetVolumeInformationByHandleWFunc> getVolumeInformationByHandle(L"kernel32.dll", "GetVolumeInformationByHandleW"); + const DllFun<GetVolumeInformationByHandleWFunc> getVolumeInformationByHandle(L"kernel32.dll", "GetVolumeInformationByHandleW"); if (!getVolumeInformationByHandle) { assert(false); @@ -296,7 +278,7 @@ std::bitset<UTC_LOCAL_OFFSET_BITS> getUtcLocalShift() const int timeShiftQuarter = timeShiftSec / (60 * 15); //time shift in quarter-hours - const int absValue = common::abs(timeShiftQuarter); //MSVC C++0x bug: std::bitset<>(unsigned long) is ambiguous + const int absValue = numeric::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! diff --git a/shared/dst_hack.h b/zen/dst_hack.h index 2e25cf81..07d08dc5 100644 --- a/shared/dst_hack.h +++ b/zen/dst_hack.h @@ -1,7 +1,7 @@ #ifndef DST_HACK_H_INCLUDED #define DST_HACK_H_INCLUDED -#include <wx/msw/wrapwin.h> //includes "windows.h" +#include "win.h" //includes "windows.h" #include "zstring.h" #include <stdexcept> diff --git a/shared/file_error.h b/zen/file_error.h index d814e05d..8c49937c 100644 --- a/shared/file_error.h +++ b/zen/file_error.h @@ -7,10 +7,10 @@ #ifndef FILEERROR_H_INCLUDED #define FILEERROR_H_INCLUDED -#include "zstring.h" -#include "string_utf8.h" #include <string> - +#include "zstring.h" +#include "utf8.h" +#include "last_error.h" //we'll need this later anyway! namespace zen { diff --git a/shared/file_handling.cpp b/zen/file_handling.cpp index c9e85c15..7b46181b 100644 --- a/shared/file_handling.cpp +++ b/zen/file_handling.cpp @@ -8,12 +8,10 @@ #include <map> #include <algorithm> #include <stdexcept> -#include "last_error.h" #include "file_traverser.h" -#include "loki/ScopeGuard.h" +#include "scope_guard.h" #include "symlink_target.h" #include "file_io.h" -#include "i18n.h" #include "assert_static.h" #include <boost/thread/tss.hpp> #include <boost/thread/once.hpp> @@ -21,12 +19,13 @@ #ifdef FFS_WIN #include "privilege.h" -#include "dll_loader.h" -#include <wx/msw/wrapwin.h> //includes "windows.h" +#include "dll.h" +#include "win.h" //includes "windows.h" #include "long_path_prefix.h" #include <Aclapi.h> #include "dst_hack.h" #include "file_update_handle.h" +#include "win_ver.h" #elif defined FFS_LINUX #include <sys/stat.h> @@ -48,7 +47,7 @@ bool zen::fileExists(const Zstring& filename) //symbolic links (broken or not) are also treated as existing files! #ifdef FFS_WIN const DWORD ret = ::GetFileAttributes(applyLongPathPrefix(filename).c_str()); - return ret != INVALID_FILE_ATTRIBUTES && !(ret & FILE_ATTRIBUTE_DIRECTORY); //returns true for (file-)symlinks also + return ret != INVALID_FILE_ATTRIBUTES && (ret & FILE_ATTRIBUTE_DIRECTORY) == 0; //returns true for (file-)symlinks also #elif defined FFS_LINUX struct stat fileInfo = {}; @@ -63,7 +62,7 @@ bool zen::dirExists(const Zstring& dirname) //symbolic links (broken or not) are also treated as existing directories! #ifdef FFS_WIN const DWORD ret = ::GetFileAttributes(applyLongPathPrefix(dirname).c_str()); - return ret != INVALID_FILE_ATTRIBUTES && (ret & FILE_ATTRIBUTE_DIRECTORY); //returns true for (dir-)symlinks also + return ret != INVALID_FILE_ATTRIBUTES && (ret & FILE_ATTRIBUTE_DIRECTORY) != 0; //returns true for (dir-)symlinks also #elif defined FFS_LINUX struct stat dirInfo = {}; @@ -77,7 +76,7 @@ bool zen::symlinkExists(const Zstring& objname) { #ifdef FFS_WIN const DWORD ret = ::GetFileAttributes(applyLongPathPrefix(objname).c_str()); - return ret != INVALID_FILE_ATTRIBUTES && (ret & FILE_ATTRIBUTE_REPARSE_POINT); + return ret != INVALID_FILE_ATTRIBUTES && (ret & FILE_ATTRIBUTE_REPARSE_POINT) != 0; #elif defined FFS_LINUX struct stat fileInfo = {}; @@ -146,7 +145,7 @@ void getFileAttrib(const Zstring& filename, FileAttrib& attr, ProcSymlink procSl NULL); if (hFile == INVALID_HANDLE_VALUE) throw FileError(_("Error reading file attributes:") + "\n\"" + filename + "\"" + "\n\n" + getLastErrorFormatted()); - LOKI_ON_BLOCK_EXIT2(::CloseHandle(hFile)); + ZEN_ON_BLOCK_EXIT(::CloseHandle(hFile)); BY_HANDLE_FILE_INFORMATION fileInfoHnd = {}; if (!::GetFileInformationByHandle(hFile, &fileInfoHnd)) @@ -204,7 +203,7 @@ DWORD retrieveVolumeSerial(const Zstring& pathName) //return 0 on error! return 0; Zstring volumePath = &buffer[0]; - if (!volumePath.EndsWith(FILE_NAME_SEPARATOR)) + if (!endsWith(volumePath, FILE_NAME_SEPARATOR)) volumePath += FILE_NAME_SEPARATOR; DWORD volumeSerial = 0; @@ -227,13 +226,13 @@ dev_t retrieveVolumeSerial(const Zstring& pathName) //return 0 on error! Zstring volumePathName = pathName; //remove trailing slash - if (volumePathName.size() > 1 && volumePathName.EndsWith(FILE_NAME_SEPARATOR)) //exception: allow '/' - volumePathName = volumePathName.BeforeLast(FILE_NAME_SEPARATOR); + if (volumePathName.size() > 1 && endsWith(volumePathName, FILE_NAME_SEPARATOR)) //exception: allow '/' + volumePathName = beforeLast(volumePathName, FILE_NAME_SEPARATOR); struct stat fileInfo = {}; while (::lstat(volumePathName.c_str(), &fileInfo) != 0) //go up in folder hierarchy until existing folder is found { - volumePathName = volumePathName.BeforeLast(FILE_NAME_SEPARATOR); //returns empty string if ch not found + volumePathName = beforeLast(volumePathName, FILE_NAME_SEPARATOR); //returns empty string if ch not found if (volumePathName.empty()) return 0; //this includes path "/" also! } @@ -400,16 +399,16 @@ Zstring getFilenameFmt(const Zstring& filename, Function fun) //throw(); returns Zstring findUnused8Dot3Name(const Zstring& filename) //find a unique 8.3 short name { const Zstring pathPrefix = filename.find(FILE_NAME_SEPARATOR) != Zstring::npos ? - (filename.BeforeLast(FILE_NAME_SEPARATOR) + FILE_NAME_SEPARATOR) : Zstring(); + (beforeLast(filename, FILE_NAME_SEPARATOR) + FILE_NAME_SEPARATOR) : Zstring(); - Zstring extension = filename.AfterLast(FILE_NAME_SEPARATOR).AfterLast(Zchar('.')); //extension needn't contain reasonable data + Zstring extension = afterLast(afterLast(filename, FILE_NAME_SEPARATOR), Zchar('.')); //extension needn't contain reasonable data if (extension.empty()) extension = Zstr("FFS"); - extension.Truncate(3); + truncate(extension, 3); for (int index = 0; index < 100000000; ++index) //filename must be representable by <= 8 characters { - const Zstring output = pathPrefix + Zstring::fromNumber(index) + Zchar('.') + extension; + const Zstring output = pathPrefix + toString<Zstring>(index) + Zchar('.') + extension; if (!somethingExists(output)) //ensure uniqueness return output; } @@ -425,9 +424,9 @@ bool have8dot3NameClash(const Zstring& filename) if (somethingExists(filename)) //name OR directory! { - const Zstring origName = filename.AfterLast(FILE_NAME_SEPARATOR); //returns the whole string if ch not found - const Zstring shortName = getFilenameFmt(filename, ::GetShortPathName).AfterLast(FILE_NAME_SEPARATOR); //throw() returns empty string on error - const Zstring longName = getFilenameFmt(filename, ::GetLongPathName) .AfterLast(FILE_NAME_SEPARATOR); // + const Zstring origName = afterLast(filename, FILE_NAME_SEPARATOR); //returns the whole string if ch not found + const Zstring shortName = afterLast(getFilenameFmt(filename, ::GetShortPathName), FILE_NAME_SEPARATOR); //throw() returns empty string on error + const Zstring longName = afterLast(getFilenameFmt(filename, ::GetLongPathName) , FILE_NAME_SEPARATOR); // if (!shortName.empty() && !longName.empty() && @@ -447,9 +446,9 @@ class Fix8Dot3NameClash public: Fix8Dot3NameClash(const Zstring& filename) { - const Zstring longName = getFilenameFmt(filename, ::GetLongPathName).AfterLast(FILE_NAME_SEPARATOR); //throw() returns empty string on error + const Zstring longName = afterLast(getFilenameFmt(filename, ::GetLongPathName), FILE_NAME_SEPARATOR); //throw() returns empty string on error - unrelatedFile = filename.BeforeLast(FILE_NAME_SEPARATOR) + FILE_NAME_SEPARATOR + longName; + unrelatedFile = beforeLast(filename, FILE_NAME_SEPARATOR) + FILE_NAME_SEPARATOR + longName; //find another name in short format: this ensures the actual short name WILL be renamed as well! unrelatedFileParked = findUnused8Dot3Name(filename); @@ -587,7 +586,7 @@ public: virtual ReturnValDir onDir(const Zchar* shortName, const Zstring& fullName) { dirs_.push_back(NamePair(shortName, fullName)); - return Loki::Int2Type<ReturnValDir::TRAVERSING_DIR_IGNORE>(); //DON'T traverse into subdirs; moveDirectory works recursively! + return Int2Type<ReturnValDir::TRAVERSING_DIR_IGNORE>(); //DON'T traverse into subdirs; moveDirectory works recursively! } virtual HandleError onError(const std::wstring& errorText) { throw FileError(errorText); } @@ -663,7 +662,7 @@ void moveDirectoryImpl(const Zstring& sourceDir, const Zstring& targetDir, bool TraverseOneLevel traverseCallback(fileList, dirList); traverseFolder(sourceDir, false, traverseCallback); //traverse one level, don't follow symlinks - const Zstring targetDirFormatted = targetDir.EndsWith(FILE_NAME_SEPARATOR) ? //ends with path separator + const Zstring targetDirFormatted = endsWith(targetDir, FILE_NAME_SEPARATOR) ? //ends with path separator targetDir : targetDir + FILE_NAME_SEPARATOR; @@ -692,12 +691,12 @@ void zen::moveDirectory(const Zstring& sourceDir, const Zstring& targetDir, bool #elif defined FFS_LINUX const Zstring sourceDirFormatted = //remove trailing slash - sourceDir.size() > 1 && sourceDir.EndsWith(FILE_NAME_SEPARATOR) ? //exception: allow '/' - sourceDir.BeforeLast(FILE_NAME_SEPARATOR) : + sourceDir.size() > 1 && endsWith(sourceDir, FILE_NAME_SEPARATOR) ? //exception: allow '/' + beforeLast(sourceDir, FILE_NAME_SEPARATOR) : sourceDir; const Zstring targetDirFormatted = //remove trailing slash - targetDir.size() > 1 && targetDir.EndsWith(FILE_NAME_SEPARATOR) ? //exception: allow '/' - targetDir.BeforeLast(FILE_NAME_SEPARATOR) : + targetDir.size() > 1 && endsWith(targetDir, FILE_NAME_SEPARATOR) ? //exception: allow '/' + beforeLast(targetDir, FILE_NAME_SEPARATOR) : targetDir; #endif @@ -726,7 +725,7 @@ public: virtual ReturnValDir onDir(const Zchar* shortName, const Zstring& fullName) { m_dirs.push_back(fullName); - return Loki::Int2Type<ReturnValDir::TRAVERSING_DIR_IGNORE>(); //DON'T traverse into subdirs; removeDirectory works recursively! + return Int2Type<ReturnValDir::TRAVERSING_DIR_IGNORE>(); //DON'T traverse into subdirs; removeDirectory works recursively! } virtual HandleError onError(const std::wstring& errorText) { throw FileError(errorText); } @@ -865,8 +864,8 @@ void zen::setFileTime(const Zstring& filename, const Int64& modificationTime, Pr { WIN32_FILE_ATTRIBUTE_DATA debugeAttr = {}; assert(::GetFileAttributesEx(applyLongPathPrefix(filename).c_str(), //__in LPCTSTR lpFileName, - GetFileExInfoStandard, //__in GET_FILEEX_INFO_LEVELS fInfoLevelId, - &debugeAttr)); //__out LPVOID lpFileInformation + GetFileExInfoStandard, //__in GET_FILEEX_INFO_LEVELS fInfoLevelId, + &debugeAttr)); //__out LPVOID lpFileInformation assert(::CompareFileTime(&debugeAttr.ftCreationTime, &creationTime) == 0); assert(::CompareFileTime(&debugeAttr.ftLastWriteTime, &lastWriteTime) == 0); @@ -915,7 +914,7 @@ Zstring resolveDirectorySymlink(const Zstring& dirLinkName) //get full target pa NULL); if (hDir == INVALID_HANDLE_VALUE) throw FileError(_("Error resolving symbolic link:") + "\n\"" + dirLinkName + "\"" + "\n\n" + getLastErrorFormatted()); - LOKI_ON_BLOCK_EXIT2(::CloseHandle(hDir)); + ZEN_ON_BLOCK_EXIT(::CloseHandle(hDir)); const DWORD BUFFER_SIZE = 10000; std::vector<wchar_t> targetPath(BUFFER_SIZE); @@ -925,7 +924,7 @@ Zstring resolveDirectorySymlink(const Zstring& dirLinkName) //get full target pa LPTSTR lpszFilePath, DWORD cchFilePath, DWORD dwFlags); - const util::DllFun<GetFinalPathNameByHandleWFunc> getFinalPathNameByHandle(L"kernel32.dll", "GetFinalPathNameByHandleW"); + const SysDllFun<GetFinalPathNameByHandleWFunc> getFinalPathNameByHandle(L"kernel32.dll", "GetFinalPathNameByHandleW"); if (!getFinalPathNameByHandle) throw FileError(_("Error loading library function:") + "\n\"" + "GetFinalPathNameByHandleW" + "\""); @@ -962,7 +961,7 @@ void copySecurityContext(const Zstring& source, const Zstring& target, ProcSymli throw FileError(_("Error reading security context:") + "\n\"" + source + "\"" + "\n\n" + getLastErrorFormatted()); } - LOKI_ON_BLOCK_EXIT2(::freecon(contextSource)); + ZEN_ON_BLOCK_EXIT(::freecon(contextSource)); { security_context_t contextTarget = NULL; @@ -977,7 +976,7 @@ void copySecurityContext(const Zstring& source, const Zstring& target, ProcSymli } else { - LOKI_ON_BLOCK_EXIT2(::freecon(contextTarget)); + ZEN_ON_BLOCK_EXIT(::freecon(contextTarget)); if (::strcmp(contextSource, contextTarget) == 0) //nothing to do return; @@ -1030,7 +1029,7 @@ void copyObjectPermissions(const Zstring& source, const Zstring& target, ProcSym NULL); if (hSource == INVALID_HANDLE_VALUE) throw FileError(_("Error copying file permissions:") + "\n\"" + source + "\" ->\n\"" + target + "\"" + "\n\n" + getLastErrorFormatted() + " (OR)"); - LOKI_ON_BLOCK_EXIT2(::CloseHandle(hSource)); + ZEN_ON_BLOCK_EXIT(::CloseHandle(hSource)); // DWORD rc = ::GetNamedSecurityInfo(const_cast<WCHAR*>(applyLongPathPrefix(source).c_str()), -> does NOT dereference symlinks! DWORD rc = ::GetSecurityInfo(hSource, //__in LPTSTR pObjectName, @@ -1043,7 +1042,7 @@ void copyObjectPermissions(const Zstring& source, const Zstring& target, ProcSym &buffer); //__out_opt PSECURITY_DESCRIPTOR *ppSecurityDescriptor if (rc != ERROR_SUCCESS) throw FileError(_("Error copying file permissions:") + "\n\"" + source + "\" ->\n\"" + target + "\"" + "\n\n" + getLastErrorFormatted(rc) + " (R)"); - LOKI_ON_BLOCK_EXIT2(::LocalFree(buffer)); + ZEN_ON_BLOCK_EXIT(::LocalFree(buffer)); //may need to remove the readonly-attribute (e.g. FAT usb drives) FileUpdateHandle targetHandle(target, [ = ]() @@ -1157,7 +1156,7 @@ void createDirectory_straight(const Zstring& directory, const Zstring& templateD NULL); if (hDir != INVALID_HANDLE_VALUE) { - LOKI_ON_BLOCK_EXIT2(::CloseHandle(hDir)); + ZEN_ON_BLOCK_EXIT(::CloseHandle(hDir)); USHORT cmpState = COMPRESSION_FORMAT_DEFAULT; @@ -1175,13 +1174,13 @@ void createDirectory_straight(const Zstring& directory, const Zstring& templateD } } #endif - Loki::ScopeGuard guardNewDir = Loki::MakeGuard([&]() { removeDirectory(directory); }); //ensure cleanup: + zen::ScopeGuard guardNewDir = zen::makeGuard([&]() { removeDirectory(directory); }); //ensure cleanup: //enforce copying file permissions: it's advertized on GUI... if (copyFilePermissions) copyObjectPermissions(templateDir, directory, SYMLINK_FOLLOW); //throw FileError - guardNewDir.Dismiss(); //target has been created successfully! + guardNewDir.dismiss(); //target has been created successfully! } } @@ -1208,11 +1207,11 @@ void createDirectoryRecursively(const Zstring& directory, const Zstring& templat else //if "somethingExists" we needn't create the parent directory { //try to create parent folders first - const Zstring dirParent = directory.BeforeLast(FILE_NAME_SEPARATOR); + const Zstring dirParent = beforeLast(directory, FILE_NAME_SEPARATOR); if (!dirParent.empty() && !dirExists(dirParent)) { //call function recursively - const Zstring templateParent = templateDir.BeforeLast(FILE_NAME_SEPARATOR); //returns empty string if ch not found + const Zstring templateParent = beforeLast(templateDir, FILE_NAME_SEPARATOR); //returns empty string if ch not found createDirectoryRecursively(dirParent, templateParent, copyFilePermissions, level + 1); } } @@ -1226,12 +1225,12 @@ void createDirectoryRecursively(const Zstring& directory, const Zstring& templat void zen::createDirectory(const Zstring& directory, const Zstring& templateDir, bool copyFilePermissions) { //remove trailing separator - const Zstring dirFormatted = directory.EndsWith(FILE_NAME_SEPARATOR) ? - directory.BeforeLast(FILE_NAME_SEPARATOR) : + const Zstring dirFormatted = endsWith(directory, FILE_NAME_SEPARATOR) ? + beforeLast(directory, FILE_NAME_SEPARATOR) : directory; - const Zstring templateFormatted = templateDir.EndsWith(FILE_NAME_SEPARATOR) ? - templateDir.BeforeLast(FILE_NAME_SEPARATOR) : + const Zstring templateFormatted = endsWith(templateDir, FILE_NAME_SEPARATOR) ? + beforeLast(templateDir, FILE_NAME_SEPARATOR) : templateDir; createDirectoryRecursively(dirFormatted, templateFormatted, copyFilePermissions, 0); @@ -1258,7 +1257,7 @@ void zen::copySymlink(const Zstring& sourceLink, const Zstring& targetLink, bool //dynamically load windows API function typedef BOOLEAN (WINAPI *CreateSymbolicLinkFunc)(LPCTSTR lpSymlinkFileName, LPCTSTR lpTargetFileName, DWORD dwFlags); - const util::DllFun<CreateSymbolicLinkFunc> createSymbolicLink(L"kernel32.dll", "CreateSymbolicLinkW"); + const SysDllFun<CreateSymbolicLinkFunc> createSymbolicLink(L"kernel32.dll", "CreateSymbolicLinkW"); if (!createSymbolicLink) throw FileError(_("Error loading library function:") + "\n\"" + "CreateSymbolicLinkW" + "\""); @@ -1271,7 +1270,7 @@ void zen::copySymlink(const Zstring& sourceLink, const Zstring& targetLink, bool throw FileError(_("Error copying symbolic link:") + "\n\"" + sourceLink + "\" ->\n\"" + targetLink + "\"" + "\n\n" + getLastErrorFormatted()); //allow only consistent objects to be created -> don't place before ::symlink, targetLink may already exist - Loki::ScopeGuard guardNewDir = Loki::MakeGuard([&]() + zen::ScopeGuard guardNewDir = zen::makeGuard([&]() { #ifdef FFS_WIN if (isDirLink) @@ -1290,7 +1289,7 @@ void zen::copySymlink(const Zstring& sourceLink, const Zstring& targetLink, bool if (copyFilePermissions) copyObjectPermissions(sourceLink, targetLink, SYMLINK_DIRECT); //throw FileError - guardNewDir.Dismiss(); //target has been created successfully! + guardNewDir.dismiss(); //target has been created successfully! } @@ -1302,7 +1301,7 @@ Zstring createTempName(const Zstring& filename) //ensure uniqueness for (int i = 1; somethingExists(output); ++i) - output = filename + Zchar('_') + Zstring::fromNumber(i) + zen::TEMP_FILE_ENDING; + output = filename + Zchar('_') + toString<Zstring>(i) + zen::TEMP_FILE_ENDING; return output; } @@ -1443,7 +1442,7 @@ DWORD CALLBACK copyCallbackInternal( } catch (...) { -//#warning migrate to std::exception_ptr when available + //#warning migrate to std::exception_ptr when available cbd.reportUserException(UInt64(totalBytesTransferred.QuadPart)); return PROGRESS_CANCEL; @@ -1457,26 +1456,12 @@ DWORD CALLBACK copyCallbackInternal( #define COPY_FILE_ALLOW_DECRYPTED_DESTINATION 0x00000008 #endif -bool supportForNonEncryptedDestination() -{ - OSVERSIONINFO osvi = {}; - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - - //encrypted destination is not supported with Windows 2000 - if (::GetVersionEx(&osvi)) - return osvi.dwMajorVersion > 5 || - (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion > 0); //2000 has majorVersion == 5, minorVersion == 0 - //overview: http://msdn.microsoft.com/en-us/library/ms724834(VS.85).aspx - return false; -} - - void rawCopyWinApi_sub(const Zstring& sourceFile, const Zstring& targetFile, CallbackCopyFile* callback, FileAttrib* sourceAttr) //throw FileError, ErrorTargetPathMissing, ErrorTargetExisting, ErrorFileLocked { - Loki::ScopeGuard guardTarget = Loki::MakeGuard(&removeFile, targetFile); //transactional behavior: guard just before starting copy, we don't trust ::CopyFileEx(), do we ;) + zen::ScopeGuard guardTarget = zen::makeGuard([&]() { removeFile(targetFile); }); //transactional behavior: guard just before starting copy, we don't trust ::CopyFileEx(), do we ;) DWORD copyFlags = COPY_FILE_FAIL_IF_EXISTS; @@ -1484,7 +1469,7 @@ void rawCopyWinApi_sub(const Zstring& sourceFile, static bool nonEncSupported = false; { static boost::once_flag initNonEncOnce = BOOST_ONCE_INIT; //caveat: function scope static initialization is not thread-safe in VS 2010! - boost::call_once(initNonEncOnce, []() { nonEncSupported = supportForNonEncryptedDestination(); }); + boost::call_once(initNonEncOnce, []() { nonEncSupported = winXpOrLater(); }); //encrypted destination is not supported with Windows 2000 } if (nonEncSupported) copyFlags |= COPY_FILE_ALLOW_DECRYPTED_DESTINATION; @@ -1492,7 +1477,7 @@ void rawCopyWinApi_sub(const Zstring& sourceFile, static bool osIsvistaOrLater = false; { static boost::once_flag initVistaLaterOnce = BOOST_ONCE_INIT; //caveat: function scope static initialization is not thread-safe in VS 2010! - boost::call_once(initVistaLaterOnce, []() { osIsvistaOrLater = dst::vistaOrLater(); }); + boost::call_once(initVistaLaterOnce, []() { osIsvistaOrLater = vistaOrLater(); }); } CallbackData cbd(callback, sourceFile, targetFile, osIsvistaOrLater); @@ -1523,13 +1508,13 @@ void rawCopyWinApi_sub(const Zstring& sourceFile, if (lastError == ERROR_FILE_EXISTS) //if target is existing this functions is expected to throw ErrorTargetExisting!!! { - guardTarget.Dismiss(); //don't delete file that existed previously! + guardTarget.dismiss(); //don't delete file that existed previously! throw ErrorTargetExisting(errorMessage); } if (lastError == ERROR_PATH_NOT_FOUND) { - guardTarget.Dismiss(); //not relevant + guardTarget.dismiss(); //not relevant throw ErrorTargetPathMissing(errorMessage); } @@ -1558,7 +1543,7 @@ void rawCopyWinApi_sub(const Zstring& sourceFile, //perf-loss on USB sticks with many small files of about 30%! damn! } - guardTarget.Dismiss(); //target has been created successfully! + guardTarget.dismiss(); //target has been created successfully! } @@ -1624,7 +1609,7 @@ void rawCopyWinApi(const Zstring& sourceFile, // // throw FileError(errorMessage); // } -// LOKI_ON_BLOCK_EXIT2(::CloseHandle, hFileIn); +// ZEN_ON_BLOCK_EXIT(::CloseHandle, hFileIn); // // // BY_HANDLE_FILE_INFORMATION infoFileIn = {}; @@ -1681,7 +1666,7 @@ void rawCopyWinApi(const Zstring& sourceFile, // } // Loki::ScopeGuard guardTarget = Loki::MakeGuard(&removeFile, targetFile); //transactional behavior: guard just after opening target and before managing hFileOut // -// LOKI_ON_BLOCK_EXIT2(::CloseHandle, hFileOut); +// ZEN_ON_BLOCK_EXIT(::CloseHandle, hFileOut); // // //#ifndef _MSC_VER @@ -1921,7 +1906,7 @@ void rawCopyStream(const Zstring& sourceFile, CallbackCopyFile* callback, FileAttrib* sourceAttr) //throw FileError, ErrorTargetPathMissing, ErrorTargetExisting { - Loki::ScopeGuard guardTarget = Loki::MakeGuard(&removeFile, targetFile); //transactional behavior: place guard before lifetime of FileOutput + zen::ScopeGuard guardTarget = zen::makeGuard([&]() { removeFile(targetFile); }); //transactional behavior: place guard before lifetime of FileOutput try { //open sourceFile for reading @@ -1953,7 +1938,7 @@ void rawCopyStream(const Zstring& sourceFile, } catch (ErrorTargetExisting&) { - guardTarget.Dismiss(); //don't delete file that existed previously! + guardTarget.dismiss(); //don't delete file that existed previously! throw; } @@ -1978,7 +1963,7 @@ void rawCopyStream(const Zstring& sourceFile, throw FileError(_("Error changing modification time:") + "\n\"" + targetFile + "\"" + "\n\n" + getLastErrorFormatted()); } - guardTarget.Dismiss(); //target has been created successfully! + guardTarget.dismiss(); //target has been created successfully! } #endif @@ -2023,7 +2008,7 @@ void zen::copyFile(const Zstring& sourceFile, //throw FileError, ErrorTargetPath if (transactionalCopy) { Zstring temporary = targetFile + zen::TEMP_FILE_ENDING; //use temporary file until a correct date has been set - Loki::ScopeGuard guardTempFile = Loki::MakeGuard([&]() { removeFile(temporary); }); //transactional behavior: ensure cleanup (e.g. network drop) -> ref to temporary[!] + zen::ScopeGuard guardTempFile = zen::makeGuard([&]() { removeFile(temporary); }); //transactional behavior: ensure cleanup (e.g. network drop) -> ref to temporary[!] //raw file copy try @@ -2048,7 +2033,7 @@ void zen::copyFile(const Zstring& sourceFile, //throw FileError, ErrorTargetPath //perf: this call is REALLY expensive on unbuffered volumes! ~40% performance decrease on FAT USB stick! renameFile(temporary, targetFile); //throw FileError - guardTempFile.Dismiss(); + guardTempFile.dismiss(); } else { @@ -2068,8 +2053,8 @@ void zen::copyFile(const Zstring& sourceFile, //throw FileError, ErrorTargetPath //set file permissions if (copyFilePermissions) { - Loki::ScopeGuard guardTargetFile = Loki::MakeGuard(&removeFile, targetFile); + zen::ScopeGuard guardTargetFile = zen::makeGuard([&]() { removeFile(targetFile);}); copyObjectPermissions(sourceFile, targetFile, SYMLINK_FOLLOW); //throw FileError - guardTargetFile.Dismiss(); //target has been created successfully! + guardTargetFile.dismiss(); //target has been created successfully! } } diff --git a/shared/file_handling.h b/zen/file_handling.h index f1ed2d98..baa51516 100644 --- a/shared/file_handling.h +++ b/zen/file_handling.h @@ -7,7 +7,7 @@ #ifndef FILE_HANDLING_H_INCLUDED #define FILE_HANDLING_H_INCLUDED -#include "zstring.h" +#include "string.h" #include "file_error.h" #include "int64.h" @@ -18,8 +18,8 @@ struct CallbackMoveFile; struct CallbackCopyFile; -bool fileExists (const Zstring& filename); //throw() replaces wxFileExists() -bool dirExists (const Zstring& dirname); //throw() replaces wxDirExists() +bool fileExists (const Zstring& filename); //throw() check whether file or symlink exists +bool dirExists (const Zstring& dirname); //throw() check whether directory or symlink exists bool symlinkExists (const Zstring& objname); //throw() check whether a symbolic link exists bool somethingExists(const Zstring& objname); //throw() check whether any object with this name exists @@ -100,7 +100,7 @@ struct CallbackCopyFile //callback functionality virtual ~CallbackCopyFile() {} //if target is existing user needs to implement deletion: copyFile() NEVER deletes target if already existing! - //at this point full read access on source had been proven, so it's safe to delete it. + //if transactionalCopy == true, full read access on source had been proven at this point, so it's safe to delete it. virtual void deleteTargetFile(const Zstring& targetFile) = 0; //may throw exceptions //may throw: diff --git a/shared/file_id.cpp b/zen/file_id.cpp index 198598b4..c9f422ac 100644 --- a/shared/file_id.cpp +++ b/zen/file_id.cpp @@ -8,16 +8,16 @@ #include "file_id_internal.h" #ifdef FFS_WIN -#include <wx/msw/wrapwin.h> //includes "windows.h" +#include "win.h" //includes "windows.h" #include "long_path_prefix.h" -#include "loki/ScopeGuard.h" +#include "scope_guard.h" #elif defined FFS_LINUX #include <sys/stat.h> #endif -std::string util::retrieveFileID(const Zstring& filename) +std::string zen::getFileID(const Zstring& filename) { #ifdef FFS_WIN //WARNING: CreateFile() is SLOW, while GetFileInformationByHandle() is cheap! @@ -34,7 +34,7 @@ std::string util::retrieveFileID(const Zstring& filename) NULL); if (hFile != INVALID_HANDLE_VALUE) { - LOKI_ON_BLOCK_EXIT2(::CloseHandle(hFile)); + ZEN_ON_BLOCK_EXIT(::CloseHandle(hFile)); BY_HANDLE_FILE_INFORMATION fileInfo = {}; if (::GetFileInformationByHandle(hFile, &fileInfo)) @@ -42,7 +42,7 @@ std::string util::retrieveFileID(const Zstring& filename) } #elif defined FFS_LINUX - struct stat fileInfo = {}; + struct ::stat fileInfo = {}; if (::lstat(filename.c_str(), &fileInfo) == 0) //lstat() does not follow symlinks return extractFileID(fileInfo); #endif @@ -52,13 +52,13 @@ std::string util::retrieveFileID(const Zstring& filename) } -bool util::sameFileSpecified(const Zstring& file1, const Zstring& file2) +bool zen::samePhysicalFile(const Zstring& file1, const Zstring& file2) { if (EqualFilename()(file1, file2)) //quick check return true; - const std::string id1 = retrieveFileID(file1); - const std::string id2 = retrieveFileID(file2); + const std::string id1 = getFileID(file1); + const std::string id2 = getFileID(file2); if (id1.empty() || id2.empty()) return false; diff --git a/shared/file_id.h b/zen/file_id.h index eaf47e3c..f015569d 100644 --- a/shared/file_id.h +++ b/zen/file_id.h @@ -10,19 +10,18 @@ #include "zstring.h" #include <string> - - //unique file identifier -namespace util + +namespace zen { //get unique file id (symbolic link handling: opens the link!!!) //returns empty string on error! -std::string retrieveFileID(const Zstring& filename); +std::string getFileID(const Zstring& filename); //test whether two distinct paths point to the same file or directory: // true: paths point to same files/dirs // false: error occurred OR point to different files/dirs -bool sameFileSpecified(const Zstring& file1, const Zstring& file2); +bool samePhysicalFile(const Zstring& file1, const Zstring& file2); } #endif // FILEID_H_INCLUDED diff --git a/shared/file_id_internal.h b/zen/file_id_internal.h index a8a7042d..492d8432 100644 --- a/shared/file_id_internal.h +++ b/zen/file_id_internal.h @@ -10,7 +10,7 @@ #include <string> #ifdef FFS_WIN -#include <wx/msw/wrapwin.h> //includes "windows.h" +#include "win.h" //includes "windows.h" #elif defined FFS_LINUX #include <sys/stat.h> diff --git a/shared/file_io.cpp b/zen/file_io.cpp index 59b78044..6b3a5214 100644 --- a/shared/file_io.cpp +++ b/zen/file_io.cpp @@ -5,8 +5,6 @@ // ************************************************************************** #include "file_io.h" -#include "last_error.h" -#include "i18n.h" #ifdef FFS_WIN #include "long_path_prefix.h" @@ -66,7 +64,9 @@ FileInput::FileInput(const Zstring& filename) : //throw FileError, ErrorNotExis std::wstring errorMessage = _("Error opening file:") + "\n\"" + filename_ + "\"" + "\n\n" + zen::getLastErrorFormatted(lastError); if (lastError == ERROR_FILE_NOT_FOUND || - lastError == ERROR_PATH_NOT_FOUND) + lastError == ERROR_PATH_NOT_FOUND || + lastError == ERROR_BAD_NETPATH || + lastError == ERROR_NETNAME_DELETED) throw ErrorNotExisting(errorMessage); throw FileError(errorMessage); diff --git a/shared/file_io.h b/zen/file_io.h index 76713e5b..26964ae8 100644 --- a/shared/file_io.h +++ b/zen/file_io.h @@ -8,12 +8,13 @@ #define FILEIO_H_INCLUDED #ifdef FFS_WIN -#include <wx/msw/wrapwin.h> //includes "windows.h" +#include "win.h" //includes "windows.h" + #elif defined FFS_LINUX #include <cstdio> #endif -#include "zstring.h" +#include "string.h" #include "file_error.h" namespace zen diff --git a/shared/file_traverser.cpp b/zen/file_traverser.cpp index eb79b0e7..44b9d184 100644 --- a/shared/file_traverser.cpp +++ b/zen/file_traverser.cpp @@ -5,18 +5,17 @@ // ************************************************************************** #include "file_traverser.h" -#include <limits> #include "last_error.h" #include "assert_static.h" #include "symlink_target.h" #ifdef FFS_WIN -#include <wx/msw/wrapwin.h> //includes "windows.h" +#include "win.h" //includes "windows.h" #include "long_path_prefix.h" #include "dst_hack.h" #include "file_update_handle.h" -#include "dll_loader.h" -#include "FindFilePlus/find_file_plus.h" +//#include "dll_loader.h" +//#include "FindFilePlus/find_file_plus.h" #elif defined FFS_LINUX #include <sys/stat.h> @@ -69,7 +68,7 @@ bool setWin32FileInformationFromSymlink(const Zstring& linkName, zen::TraverseCa NULL); if (hFile == INVALID_HANDLE_VALUE) return false; - LOKI_ON_BLOCK_EXIT2(::CloseHandle(hFile)); + ZEN_ON_BLOCK_EXIT(::CloseHandle(hFile)); BY_HANDLE_FILE_INFORMATION fileInfoByHandle = {}; if (!::GetFileInformationByHandle(hFile, &fileInfoByHandle)) @@ -83,9 +82,10 @@ bool setWin32FileInformationFromSymlink(const Zstring& linkName, zen::TraverseCa /* warn_static("finish") - util::DllFun<findplus::OpenDirFunc> openDir (findplus::getDllName(), findplus::openDirFuncName); - util::DllFun<findplus::ReadDirFunc> readDir (findplus::getDllName(), findplus::readDirFuncName); - util::DllFun<findplus::CloseDirFunc> closeDir(findplus::getDllName(), findplus::closeDirFuncName); + DllFun<findplus::OpenDirFunc> openDir (findplus::getDllName(), findplus::openDirFuncName); + DllFun<findplus::ReadDirFunc> readDir (findplus::getDllName(), findplus::readDirFuncName); + DllFun<findplus::CloseDirFunc> closeDir(findplus::getDllName(), findplus::closeDirFuncName); + -> thread safety! */ #endif } @@ -94,10 +94,11 @@ warn_static("finish") class DirTraverser { public: - DirTraverser(const Zstring& baseDirectory, bool followSymlinks, zen::TraverseCallback& sink, zen::DstHackCallback* dstCallback) + DirTraverser(const Zstring& baseDirectory, bool followSymlinks, zen::TraverseCallback& sink, zen::DstHackCallback* dstCallback) : #ifdef FFS_WIN - : isFatFileSystem(dst::isFatDrive(baseDirectory)) + isFatFileSystem(dst::isFatDrive(baseDirectory)), #endif + followSymlinks_(followSymlinks) { #ifdef FFS_WIN //format base directory name @@ -105,16 +106,13 @@ public: #elif defined FFS_LINUX const Zstring directoryFormatted = //remove trailing slash - baseDirectory.size() > 1 && baseDirectory.EndsWith(FILE_NAME_SEPARATOR) ? //exception: allow '/' - baseDirectory.BeforeLast(FILE_NAME_SEPARATOR) : + baseDirectory.size() > 1 && endsWith(baseDirectory, FILE_NAME_SEPARATOR) ? //exception: allow '/' + beforeLast(baseDirectory, FILE_NAME_SEPARATOR) : baseDirectory; #endif //traverse directories - if (followSymlinks) - traverse<true>(directoryFormatted, sink, 0); - else - traverse<false>(directoryFormatted, sink, 0); + traverse(directoryFormatted, sink, 0); //apply daylight saving time hack AFTER file traversing, to give separate feedback to user #ifdef FFS_WIN @@ -127,7 +125,6 @@ private: DirTraverser(const DirTraverser&); DirTraverser& operator=(const DirTraverser&); - template <bool followSymlinks> void traverse(const Zstring& directory, zen::TraverseCallback& sink, int level) { tryReportingError([&](std::wstring& errorMsg) -> bool @@ -141,155 +138,23 @@ private: }, sink); #ifdef FFS_WIN -/* - //ensure directoryPf ends with backslash - const Zstring& directoryPf = directory.EndsWith(FILE_NAME_SEPARATOR) ? - directory : - directory + FILE_NAME_SEPARATOR; - - FindHandle searchHandle = NULL; - tryReportingError([&](std::wstring& errorMsg) -> bool - { - searchHandle = this->openDir(applyLongPathPrefix(directoryPf).c_str()); - //no noticable performance difference compared to FindFirstFileEx with FindExInfoBasic, FIND_FIRST_EX_CASE_SENSITIVE and/or FIND_FIRST_EX_LARGE_FETCH - - if (searchHandle == NULL) - { - //const DWORD lastError = ::GetLastError(); - //if (lastError == ERROR_FILE_NOT_FOUND) -> actually NOT okay, even for an empty directory this should not occur (., ..) - //return true; //fine: empty directory - - //else: we have a problem... report it: - errorMsg = _("Error traversing directory:") + "\n\"" + directory + "\"" + "\n\n" + zen::getLastErrorFormatted(); - return false; - } - return true; - }, sink); - - if (searchHandle == NULL) - return; //empty dir or ignore error - LOKI_ON_BLOCK_EXIT2(this->closeDir(searchHandle)); - - FileInformation fileInfo = {}; - for (;;) - { - bool moreData = false; - tryReportingError([&](std::wstring& errorMsg) -> bool - { - if (!this->readDir(searchHandle, fileInfo)) - { - if (::GetLastError() == ERROR_NO_MORE_FILES) //this is fine - return true; - - //else we have a problem... report it: - errorMsg = _("Error traversing directory:") + "\n\"" + directory + "\"" + "\n\n" + zen::getLastErrorFormatted(); - return false; - } - - moreData = true; - return true; - }, sink); - if (!moreData) //no more items or ignore error - return; - - - //don't return "." and ".." - const Zchar* const shortName = fileInfo.shortName; - if (shortName[0] == L'.' && - (shortName[1] == L'\0' || (shortName[1] == L'.' && shortName[2] == L'\0'))) - continue; - - const Zstring& fullName = directoryPf + shortName; - - const bool isSymbolicLink = (fileInfo.fileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) != 0; - - if (isSymbolicLink && !followSymlinks) //evaluate symlink directly - { - TraverseCallback::SymlinkInfo details; - try - { - details.targetPath = getSymlinkRawTargetString(fullName); //throw FileError - } - catch (FileError& e) - { - (void)e; -#ifndef NDEBUG //show broken symlink / access errors in debug build! - sink.onError(e.msg()); -#endif - } - - details.lastWriteTimeRaw = toTimeT(fileInfo.lastWriteTime); - details.dirLink = (fileInfo.fileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0; //directory symlinks have this flag on Windows - sink.onSymlink(shortName, fullName, details); - } - else if (fileInfo.fileAttributes & FILE_ATTRIBUTE_DIRECTORY) //a directory... or symlink that needs to be followed (for directory symlinks this flag is set too!) - { - const TraverseCallback::ReturnValDir rv = sink.onDir(shortName, fullName); - switch (rv.returnCode) - { - case TraverseCallback::ReturnValDir::TRAVERSING_DIR_IGNORE: - break; - - case TraverseCallback::ReturnValDir::TRAVERSING_DIR_CONTINUE: - traverse<followSymlinks>(fullName, *rv.subDirCb, level + 1); - break; - } - } - else //a file or symlink that is followed... - { - TraverseCallback::FileInfo details; - - if (isSymbolicLink) //dereference symlinks! - { - if (!setWin32FileInformationFromSymlink(fullName, details)) - { - //broken symlink... - details.lastWriteTimeRaw = 0; //we are not interested in the modification time of the link - details.fileSize = 0U; - } - } - else - { - //####################################### DST hack ########################################### - if (isFatFileSystem) - { - const dst::RawTime rawTime(fileInfo.creationTime, fileInfo.lastWriteTime); - - if (dst::fatHasUtcEncoded(rawTime)) //throw (std::runtime_error) - fileInfo.lastWriteTime = dst::fatDecodeUtcTime(rawTime); //return real UTC time; throw (std::runtime_error) - else - markForDstHack.push_back(std::make_pair(fullName, fileInfo.lastWriteTime)); - } - //####################################### DST hack ########################################### - - details.lastWriteTimeRaw = toTimeT(fileInfo.lastWriteTime); - details.fileSize = fileInfo.fileSize.QuadPart; - } - - sink.onFile(shortName, fullName, details); - } - } -*/ - - - + /* //ensure directoryPf ends with backslash const Zstring& directoryPf = directory.EndsWith(FILE_NAME_SEPARATOR) ? directory : directory + FILE_NAME_SEPARATOR; - WIN32_FIND_DATA fileInfo = {}; - HANDLE searchHandle = INVALID_HANDLE_VALUE; + FindHandle searchHandle = NULL; tryReportingError([&](std::wstring& errorMsg) -> bool { - searchHandle = ::FindFirstFile(applyLongPathPrefix(directoryPf + L'*').c_str(), &fileInfo); + searchHandle = this->openDir(applyLongPathPrefix(directoryPf).c_str()); //no noticable performance difference compared to FindFirstFileEx with FindExInfoBasic, FIND_FIRST_EX_CASE_SENSITIVE and/or FIND_FIRST_EX_LARGE_FETCH - if (searchHandle == INVALID_HANDLE_VALUE) + if (searchHandle == NULL) { //const DWORD lastError = ::GetLastError(); //if (lastError == ERROR_FILE_NOT_FOUND) -> actually NOT okay, even for an empty directory this should not occur (., ..) - //return true; //fine: empty directory + //return true; //fine: empty directory //else: we have a problem... report it: errorMsg = _("Error traversing directory:") + "\n\"" + directory + "\"" + "\n\n" + zen::getLastErrorFormatted(); @@ -298,23 +163,44 @@ private: return true; }, sink); - if (searchHandle == INVALID_HANDLE_VALUE) + if (searchHandle == NULL) return; //empty dir or ignore error - LOKI_ON_BLOCK_EXIT2(::FindClose(searchHandle)); + ZEN_ON_BLOCK_EXIT(this->closeDir(searchHandle)); - do + FileInformation fileInfo = {}; + for (;;) { + bool moreData = false; + tryReportingError([&](std::wstring& errorMsg) -> bool + { + if (!this->readDir(searchHandle, fileInfo)) + { + if (::GetLastError() == ERROR_NO_MORE_FILES) //this is fine + return true; + + //else we have a problem... report it: + errorMsg = _("Error traversing directory:") + "\n\"" + directory + "\"" + "\n\n" + zen::getLastErrorFormatted(); + return false; + } + + moreData = true; + return true; + }, sink); + if (!moreData) //no more items or ignore error + return; + + //don't return "." and ".." - const Zchar* const shortName = fileInfo.cFileName; + const Zchar* const shortName = fileInfo.shortName; if (shortName[0] == L'.' && (shortName[1] == L'\0' || (shortName[1] == L'.' && shortName[2] == L'\0'))) continue; const Zstring& fullName = directoryPf + shortName; - const bool isSymbolicLink = (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) != 0; + const bool isSymbolicLink = (fileInfo.fileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) != 0; - if (isSymbolicLink && !followSymlinks) //evaluate symlink directly + if (isSymbolicLink && !followSymlinks_) //evaluate symlink directly { TraverseCallback::SymlinkInfo details; try @@ -329,11 +215,11 @@ private: #endif } - details.lastWriteTimeRaw = toTimeT(fileInfo.ftLastWriteTime); - details.dirLink = (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0; //directory symlinks have this flag on Windows + details.lastWriteTimeRaw = toTimeT(fileInfo.lastWriteTime); + details.dirLink = (fileInfo.fileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0; //directory symlinks have this flag on Windows sink.onSymlink(shortName, fullName, details); } - else if (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) //a directory... or symlink that needs to be followed (for directory symlinks this flag is set too!) + else if (fileInfo.fileAttributes & FILE_ATTRIBUTE_DIRECTORY) //a directory... or symlink that needs to be followed (for directory symlinks this flag is set too!) { const TraverseCallback::ReturnValDir rv = sink.onDir(shortName, fullName); switch (rv.returnCode) @@ -342,7 +228,7 @@ private: break; case TraverseCallback::ReturnValDir::TRAVERSING_DIR_CONTINUE: - traverse<followSymlinks>(fullName, *rv.subDirCb, level + 1); + traverse<followSymlinks_>(fullName, *rv.subDirCb, level + 1); break; } } @@ -364,44 +250,155 @@ private: //####################################### DST hack ########################################### if (isFatFileSystem) { - const dst::RawTime rawTime(fileInfo.ftCreationTime, fileInfo.ftLastWriteTime); + const dst::RawTime rawTime(fileInfo.creationTime, fileInfo.lastWriteTime); if (dst::fatHasUtcEncoded(rawTime)) //throw (std::runtime_error) - fileInfo.ftLastWriteTime = dst::fatDecodeUtcTime(rawTime); //return real UTC time; throw (std::runtime_error) + fileInfo.lastWriteTime = dst::fatDecodeUtcTime(rawTime); //return real UTC time; throw (std::runtime_error) else - markForDstHack.push_back(std::make_pair(fullName, fileInfo.ftLastWriteTime)); + markForDstHack.push_back(std::make_pair(fullName, fileInfo.lastWriteTime)); } //####################################### DST hack ########################################### - details.lastWriteTimeRaw = toTimeT(fileInfo.ftLastWriteTime); - details.fileSize = zen::UInt64(fileInfo.nFileSizeLow, fileInfo.nFileSizeHigh); + + details.lastWriteTimeRaw = toTimeT(fileInfo.lastWriteTime); + details.fileSize = fileInfo.fileSize.QuadPart; } sink.onFile(shortName, fullName, details); } } - while ([&]() -> bool + */ + + + + //ensure directoryPf ends with backslash + const Zstring& directoryPf = endsWith(directory, FILE_NAME_SEPARATOR) ? + directory : + directory + FILE_NAME_SEPARATOR; + WIN32_FIND_DATA fileInfo = {}; + + HANDLE searchHandle = INVALID_HANDLE_VALUE; + tryReportingError([&](std::wstring& errorMsg) -> bool + { + searchHandle = ::FindFirstFile(applyLongPathPrefix(directoryPf + L'*').c_str(), &fileInfo); + //no noticable performance difference compared to FindFirstFileEx with FindExInfoBasic, FIND_FIRST_EX_CASE_SENSITIVE and/or FIND_FIRST_EX_LARGE_FETCH + + if (searchHandle == INVALID_HANDLE_VALUE) { - bool moreData = false; + //const DWORD lastError = ::GetLastError(); + //if (lastError == ERROR_FILE_NOT_FOUND) -> actually NOT okay, even for an empty directory this should not occur (., ..) + //return true; //fine: empty directory - tryReportingError([&](std::wstring& errorMsg) -> bool + //else: we have a problem... report it: + errorMsg = _("Error traversing directory:") + "\n\"" + directory + "\"" + "\n\n" + zen::getLastErrorFormatted(); + return false; + } + return true; + }, sink); + + if (searchHandle == INVALID_HANDLE_VALUE) + return; //empty dir or ignore error + ZEN_ON_BLOCK_EXIT(::FindClose(searchHandle)); + + do + { + //don't return "." and ".." + const Zchar* const shortName = fileInfo.cFileName; + if (shortName[0] == L'.' && + (shortName[1] == L'\0' || (shortName[1] == L'.' && shortName[2] == L'\0'))) + continue; + + const Zstring& fullName = directoryPf + shortName; + + const bool isSymbolicLink = (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) != 0; + + if (isSymbolicLink && !followSymlinks_) //evaluate symlink directly + { + TraverseCallback::SymlinkInfo details; + try { - if (!::FindNextFile(searchHandle, // handle to search - &fileInfo)) // pointer to structure for data on found file - { - if (::GetLastError() == ERROR_NO_MORE_FILES) //this is fine - return true; + details.targetPath = getSymlinkRawTargetString(fullName); //throw FileError + } + catch (FileError& e) + { + (void)e; +#ifndef NDEBUG //show broken symlink / access errors in debug build! + sink.onError(e.msg()); +#endif + } - //else we have a problem... report it: - errorMsg = _("Error traversing directory:") + "\n\"" + directory + "\"" + "\n\n" + zen::getLastErrorFormatted(); - return false; - } + details.lastWriteTimeRaw = toTimeT(fileInfo.ftLastWriteTime); + details.dirLink = (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0; //directory symlinks have this flag on Windows + sink.onSymlink(shortName, fullName, details); + } + else if (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) //a directory... or symlink that needs to be followed (for directory symlinks this flag is set too!) + { + const TraverseCallback::ReturnValDir rv = sink.onDir(shortName, fullName); + switch (rv.returnCode) + { + case TraverseCallback::ReturnValDir::TRAVERSING_DIR_IGNORE: + break; - moreData = true; + case TraverseCallback::ReturnValDir::TRAVERSING_DIR_CONTINUE: + traverse(fullName, *rv.subDirCb, level + 1); + break; + } + } + else //a file or symlink that is followed... + { + TraverseCallback::FileInfo details; + + if (isSymbolicLink) //dereference symlinks! + { + if (!setWin32FileInformationFromSymlink(fullName, details)) + { + //broken symlink... + details.lastWriteTimeRaw = 0; //we are not interested in the modification time of the link + details.fileSize = 0U; + } + } + else + { + //####################################### DST hack ########################################### + if (isFatFileSystem) + { + const dst::RawTime rawTime(fileInfo.ftCreationTime, fileInfo.ftLastWriteTime); + + if (dst::fatHasUtcEncoded(rawTime)) //throw (std::runtime_error) + fileInfo.ftLastWriteTime = dst::fatDecodeUtcTime(rawTime); //return real UTC time; throw (std::runtime_error) + else + markForDstHack.push_back(std::make_pair(fullName, fileInfo.ftLastWriteTime)); + } + //####################################### DST hack ########################################### + details.lastWriteTimeRaw = toTimeT(fileInfo.ftLastWriteTime); + details.fileSize = zen::UInt64(fileInfo.nFileSizeLow, fileInfo.nFileSizeHigh); + } + + sink.onFile(shortName, fullName, details); + } + } + while ([&]() -> bool + { + bool moreData = false; + + tryReportingError([&](std::wstring& errorMsg) -> bool + { + if (!::FindNextFile(searchHandle, // handle to search + &fileInfo)) // pointer to structure for data on found file + { + if (::GetLastError() == ERROR_NO_MORE_FILES) //this is fine return true; - }, sink); - return moreData; - }()); + //else we have a problem... report it: + errorMsg = _("Error traversing directory:") + "\n\"" + directory + "\"" + "\n\n" + zen::getLastErrorFormatted(); + return false; + } + + moreData = true; + return true; + }, sink); + + return moreData; + }()); #elif defined FFS_LINUX DIR* dirObj = NULL; @@ -416,7 +413,7 @@ private: return true; }, sink)) return; - LOKI_ON_BLOCK_EXIT2(::closedir(dirObj)); //never close NULL handles! -> crash + ZEN_ON_BLOCK_EXIT(::closedir(dirObj)); //never close NULL handles! -> crash while (true) { @@ -446,7 +443,7 @@ private: (shortName[1] == '\0' || (shortName[1] == '.' && shortName[2] == '\0'))) continue; - const Zstring& fullName = directory.EndsWith(FILE_NAME_SEPARATOR) ? //e.g. "/" + const Zstring& fullName = endsWith(directory, FILE_NAME_SEPARATOR) ? //e.g. "/" directory + shortName : directory + FILE_NAME_SEPARATOR + shortName; @@ -467,7 +464,7 @@ private: if (isSymbolicLink) { - if (followSymlinks) //on Linux Symlinks need to be followed to evaluate whether they point to a file or directory + if (followSymlinks_) //on Linux Symlinks need to be followed to evaluate whether they point to a file or directory { if (::stat(fullName.c_str(), &fileInfo) != 0) //stat() resolves symlinks { @@ -507,7 +504,7 @@ private: break; case TraverseCallback::ReturnValDir::TRAVERSING_DIR_CONTINUE: - traverse<followSymlinks>(fullName, *rv.subDirCb, level + 1); + traverse(fullName, *rv.subDirCb, level + 1); break; } } @@ -596,6 +593,7 @@ private: FilenameTimeList markForDstHack; //####################################### DST hack ########################################### #endif + const bool followSymlinks_; }; diff --git a/shared/file_traverser.h b/zen/file_traverser.h index 7da86c3a..4dbed9f9 100644 --- a/shared/file_traverser.h +++ b/zen/file_traverser.h @@ -8,7 +8,7 @@ #define FILETRAVERSER_H_INCLUDED #include "zstring.h" -#include "loki/TypeManip.h" +#include "type_tools.h" #include "int64.h" //advanced file traverser returning metadata and hierarchical information on files and directories @@ -41,8 +41,8 @@ public: TRAVERSING_DIR_CONTINUE }; - ReturnValDir(Loki::Int2Type<TRAVERSING_DIR_IGNORE>) : returnCode(TRAVERSING_DIR_IGNORE), subDirCb(NULL) {} - ReturnValDir(Loki::Int2Type<TRAVERSING_DIR_CONTINUE>, TraverseCallback& subDirCallback) : returnCode(TRAVERSING_DIR_CONTINUE), subDirCb(&subDirCallback) {} + ReturnValDir(Int2Type<TRAVERSING_DIR_IGNORE>) : returnCode(TRAVERSING_DIR_IGNORE), subDirCb(NULL) {} + ReturnValDir(Int2Type<TRAVERSING_DIR_CONTINUE>, TraverseCallback& subDirCallback) : returnCode(TRAVERSING_DIR_CONTINUE), subDirCb(&subDirCallback) {} ReturnValueEnh returnCode; TraverseCallback* subDirCb; diff --git a/shared/file_update_handle.h b/zen/file_update_handle.h index 1ffb7000..aa9edebd 100644 --- a/shared/file_update_handle.h +++ b/zen/file_update_handle.h @@ -1,7 +1,7 @@ #ifndef FILE_UPDATE_HANDLE_H_INCLUDED #define FILE_UPDATE_HANDLE_H_INCLUDED -#include <wx/msw/wrapwin.h> //includes "windows.h" +#include "win.h" //includes "windows.h" #include "long_path_prefix.h" namespace @@ -24,7 +24,7 @@ public: const DWORD lastError = ::GetLastError(); if (lastError == ERROR_ACCESS_DENIED) //function fails if file is read-only { - Loki::ScopeGuard guardErrorCode = Loki::MakeGuard(::SetLastError, lastError); //transactional behavior: ensure cleanup (e.g. network drop) -> cref [!] + zen::ScopeGuard guardErrorCode = zen::makeGuard([&]() { ::SetLastError(lastError); }); //transactional behavior: ensure cleanup (e.g. network drop) -> cref [!] //read-only file attribute may cause trouble: temporarily reset it const DWORD tmpAttr = ::GetFileAttributes(filenameFmt.c_str()); @@ -32,7 +32,7 @@ public: { if (::SetFileAttributes(filenameFmt.c_str(), FILE_ATTRIBUTE_NORMAL)) { - guardErrorCode.Dismiss(); + guardErrorCode.dismiss(); attr = tmpAttr; //"create" guard on read-only attribute //now try again diff --git a/shared/fixed_list.h b/zen/fixed_list.h index 97976149..c17ce0da 100644 --- a/shared/fixed_list.h +++ b/zen/fixed_list.h @@ -18,13 +18,13 @@ class FixedList { struct Node { - Node() : next(NULL) {} - template <class A> Node(A && a) : next(NULL), val(a) {} - template <class A, class B> Node(A && a, B && b) : next(NULL), val(a, b) {} - template <class A, class B, class C> Node(A && a, B && b, C && c) : next(NULL), val(a, b, c) {} - template <class A, class B, class C, class D> Node(A && a, B && b, C && c, D && d) : next(NULL), val(a, b, c, d) {} - template <class A, class B, class C, class D, class E> Node(A && a, B && b, C && c, D && d, E && e) : next(NULL), val(a, b, c, d, e) {} - template <class A, class B, class C, class D, class E, class F> Node(A && a, B && b, C && c, D && d, E && e, F && f) : next(NULL), val(a, b, c, d, e, f) {} + Node() : next(NULL), val() {} + template <class A> Node(A&& a) : next(NULL), val(a) {} + template <class A, class B> Node(A&& a, B&& b) : next(NULL), val(a, b) {} + template <class A, class B, class C> Node(A&& a, B&& b, C&& c) : next(NULL), val(a, b, c) {} + template <class A, class B, class C, class D> Node(A&& a, B&& b, C&& c, D&& d) : next(NULL), val(a, b, c, d) {} + template <class A, class B, class C, class D, class E> Node(A&& a, B&& b, C&& c, D&& d, E&& e) : next(NULL), val(a, b, c, d, e) {} + template <class A, class B, class C, class D, class E, class F> Node(A&& a, B&& b, C&& c, D&& d, E&& e, F&& f) : next(NULL), val(a, b, c, d, e, f) {} Node* next; //singly linked list is sufficient T val; @@ -71,12 +71,12 @@ public: const_reference& back() const { return lastInsert->val; } void emplace_back() { pushNode(new Node); } - template <class A> void emplace_back(A && a) { pushNode(new Node(std::forward<A>(a))); } - template <class A, class B> void emplace_back(A && a, B && b) { pushNode(new Node(std::forward<A>(a), std::forward<B>(b))); } - template <class A, class B, class C> void emplace_back(A && a, B && b, C && c) { pushNode(new Node(std::forward<A>(a), std::forward<B>(b), std::forward<C>(c))); } - template <class A, class B, class C, class D> void emplace_back(A && a, B && b, C && c, D && d) { pushNode(new Node(std::forward<A>(a), std::forward<B>(b), std::forward<C>(c), std::forward<D>(d))); } - template <class A, class B, class C, class D, class E> void emplace_back(A && a, B && b, C && c, D && d, E && e) { pushNode(new Node(std::forward<A>(a), std::forward<B>(b), std::forward<C>(c), std::forward<D>(d), std::forward<E>(e))); } - template <class A, class B, class C, class D, class E, class F> void emplace_back(A && a, B && b, C && c, D && d, E && e, F && f) { pushNode(new Node(std::forward<A>(a), std::forward<B>(b), std::forward<C>(c), std::forward<D>(d), std::forward<E>(e), std::forward<F>(f))); } + template <class A> void emplace_back(A&& a) { pushNode(new Node(std::forward<A>(a))); } + template <class A, class B> void emplace_back(A&& a, B&& b) { pushNode(new Node(std::forward<A>(a), std::forward<B>(b))); } + template <class A, class B, class C> void emplace_back(A&& a, B&& b, C&& c) { pushNode(new Node(std::forward<A>(a), std::forward<B>(b), std::forward<C>(c))); } + template <class A, class B, class C, class D> void emplace_back(A&& a, B&& b, C&& c, D&& d) { pushNode(new Node(std::forward<A>(a), std::forward<B>(b), std::forward<C>(c), std::forward<D>(d))); } + template <class A, class B, class C, class D, class E> void emplace_back(A&& a, B&& b, C&& c, D&& d, E&& e) { pushNode(new Node(std::forward<A>(a), std::forward<B>(b), std::forward<C>(c), std::forward<D>(d), std::forward<E>(e))); } + template <class A, class B, class C, class D, class E, class F> void emplace_back(A&& a, B&& b, C&& c, D&& d, E&& e, F&& f) { pushNode(new Node(std::forward<A>(a), std::forward<B>(b), std::forward<C>(c), std::forward<D>(d), std::forward<E>(e), std::forward<F>(f))); } template <class Predicate> void remove_if(Predicate pred) diff --git a/shared/guid.cpp b/zen/guid.h index 1cc304cb..218c80a5 100644 --- a/shared/guid.cpp +++ b/zen/guid.h @@ -4,21 +4,33 @@ // * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** -#include "guid.h" +#ifndef GUID_H_INCLUDED +#define GUID_H_INCLUDED + +#include <string> #include <boost/uuid/uuid.hpp> -//boost really should clean a bit up... -#ifdef __MINGW32__ +#ifdef __MINGW32__ //boost should start and clean up! +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wuninitialized" #endif #include <boost/uuid/uuid_generators.hpp> +#ifdef __MINGW32__ +#pragma GCC diagnostic pop +#endif -std::string util::generateGUID() //creates a 16 byte GUID + +namespace zen +{ +inline +std::string generateGUID() //creates a 16 byte GUID { boost::uuids::uuid nativeRep = boost::uuids::random_generator()(); return std::string(nativeRep.begin(), nativeRep.end()); } +} +#endif // GUID_H_INCLUDED diff --git a/shared/i18n.h b/zen/i18n.h index 8aa38f3c..de615cdb 100644 --- a/shared/i18n.h +++ b/zen/i18n.h @@ -8,6 +8,17 @@ #define I18_N_HEADER_3843489325045 #include <string> +#include <memory> + +//thin layer to enable localization - without platform/library dependencies! +#ifndef WXINTL_NO_GETTEXT_MACRO +#error WXINTL_NO_GETTEXT_MACRO must be defined to deactivate wxWidgets underscore macro +#endif + +#define ZEN_CONCAT_SUB(X, Y) X ## Y +#define _(s) zen::implementation::translate(ZEN_CONCAT_SUB(L, s)) +#define _P(s, p, n) zen::implementation::translate(ZEN_CONCAT_SUB(L, s), ZEN_CONCAT_SUB(L, p), n) + namespace zen { @@ -24,30 +35,62 @@ struct TranslationHandler void setTranslator(TranslationHandler* newHandler = NULL); //takes ownership TranslationHandler* getTranslator(); +inline +std::wstring getThousandsSeparator() { return getTranslator() ? getTranslator()->thousandsSeparator() : L","; }; + + + + + + + + + + + -inline std::wstring getThousandsSeparator() { return getTranslator() ? getTranslator()->thousandsSeparator() : L","; }; -inline std::wstring translate(const std::wstring& text) { return getTranslator() ? getTranslator()->translate(text) : text; } + + + + +//######################## implementation ############################## +namespace implementation +{ +inline +std::wstring translate(const std::wstring& text) +{ + return getTranslator() ? getTranslator()->translate(text) : text; +} //translate plural forms: "%x day" "%x days" //returns "%x day" if n == 1; "%x days" else for english language -inline std::wstring translate(const std::wstring& singular, const std::wstring& plural, int n) { return getTranslator() ? getTranslator()->translate(singular, plural, n) : n == 1 ? singular : plural; } +inline +std::wstring translate(const std::wstring& singular, const std::wstring& plural, int n) +{ + return getTranslator() ? getTranslator()->translate(singular, plural, n) : n == 1 ? singular : plural; +} template <class T> inline std::wstring translate(const std::wstring& singular, const std::wstring& plural, T n) { return translate(singular, plural, static_cast<int>(n % 1000000)); } -} -#define CONCAT_HELPER(txt1, txt2) txt1 ## txt2 +inline +std::unique_ptr<TranslationHandler>& globalHandler() +{ + static std::unique_ptr<TranslationHandler> inst; //external linkage even in header! + return inst; +} +} -#ifndef WXINTL_NO_GETTEXT_MACRO -#error WXINTL_NO_GETTEXT_MACRO must be defined to deactivate wxWidgets underscore macro -#endif +inline +void setTranslator(TranslationHandler* newHandler) { implementation::globalHandler().reset(newHandler); } //takes ownership -#define _(s) zen::translate(CONCAT_HELPER(L, s)) -#define _P(s, p, n) zen::translate(CONCAT_HELPER(L, s), CONCAT_HELPER(L, p), n) +inline +TranslationHandler* getTranslator() { return implementation::globalHandler().get(); } +} #endif //I18_N_HEADER_3843489325045 diff --git a/shared/int64.h b/zen/int64.h index cfd3e3d1..f7a7e800 100644 --- a/shared/int64.h +++ b/zen/int64.h @@ -8,20 +8,20 @@ #define FFS_LARGE_64_BIT_INTEGER_H_INCLUDED #include <cassert> -#include <ostream> #include <limits> -#include <boost/cstdint.hpp> -#include <boost/numeric/conversion/bounds.hpp> +#include <cstdint> +#include <cstdint> +#include <ostream> #include "assert_static.h" -#include "loki/TypeManip.h" +#include "type_tools.h" #ifdef FFS_WIN -#include <wx/msw/wrapwin.h> +#include "win.h" #endif /* -zen::Int64/zen::UInt64: wrapper classes around boost::int64_t/boost::uint64_t +zen::Int64/zen::UInt64: wrapper classes around std::int64_t/std::uint64_t - default initialization with 0 - debug runtime overflow/underflow checks @@ -36,9 +36,11 @@ namespace zen template <class T, class U> inline void checkRange(U value) { //caveat: std::numeric_limits<T>::min returns minimum positive(!) number for T = double, while behaving correctly for integer types... sigh - //std::numeric_limits<T>::lowest() not available before C++11 - assert(double(boost::numeric::bounds<T>::lowest ()) <= double(value) && - double(boost::numeric::bounds<T>::highest()) >= double(value)); + assert(double(std::numeric_limits<T>::lowest()) <= double(value) && //new with C++11! + double(std::numeric_limits<T>::max() ) >= double(value)); + + // assert(double(boost::numeric::bounds<T>::lowest ()) <= double(value) && + // double(boost::numeric::bounds<T>::highest()) >= double(value)); } class Int64 @@ -50,11 +52,11 @@ public: Int64(const Int64& rhs) : value(rhs.value) {} Int64(int rhs) : value(rhs) {} //ambiguity intentional for types other than these Int64(long rhs) : value(rhs) {} - Int64(Loki::Select<Loki::IsSameType<boost::int64_t, long>::value, DummyClass, boost::int64_t>::Result rhs) : - value(rhs) {} //-> boost::int64_t equals long int on x64 Linux! Still we want implicit behavior for all other systems! + Int64(Select<IsSameType<std::int64_t, long>::result, DummyClass, std::int64_t>::Result rhs) : + value(rhs) {} //-> std::int64_t equals long int on x64 Linux! Still we want implicit behavior for all other systems! //unsafe explicit but checked conversion from arbitrary integer type - template <class T> explicit Int64(T rhs) : value(rhs) { checkRange<boost::int64_t>(rhs); } + template <class T> explicit Int64(T rhs) : value(rhs) { checkRange<std::int64_t>(rhs); } Int64& operator=(const Int64& rhs) { value = rhs.value; return *this; } @@ -82,15 +84,15 @@ public: } #endif - Int64& operator+=(const Int64& rhs) { checkRange<boost::int64_t>(double(value) + rhs.value); value += rhs.value; return *this; } - Int64& operator-=(const Int64& rhs) { checkRange<boost::int64_t>(double(value) - rhs.value); value -= rhs.value; return *this; } - Int64& operator*=(const Int64& rhs) { checkRange<boost::int64_t>(double(value) * rhs.value); value *= rhs.value; return *this; } - Int64& operator/=(const Int64& rhs) { assert(rhs.value != 0); value /= rhs.value; return *this; } - Int64& operator%=(const Int64& rhs) { assert(rhs.value != 0); value %= rhs.value; return *this; } - Int64& operator&=(const Int64& rhs) { value &= rhs.value; return *this;} - Int64& operator|=(const Int64& rhs) { value |= rhs.value; return *this;} - Int64& operator<<=(int rhs) { assert(rhs < 0 || (value << rhs) >> rhs == value); value <<= rhs; return *this; } - Int64& operator>>=(int rhs) { assert(rhs > 0 || (value >> rhs) << rhs == value); value >>= rhs; return *this; } + Int64& operator+=(const Int64& rhs) { checkRange<std::int64_t>(double(value) + rhs.value); value += rhs.value; return *this; } + Int64& operator-=(const Int64& rhs) { checkRange<std::int64_t>(double(value) - rhs.value); value -= rhs.value; return *this; } + Int64& operator*=(const Int64& rhs) { checkRange<std::int64_t>(double(value) * rhs.value); value *= rhs.value; return *this; } + Int64& operator/=(const Int64& rhs) { assert(rhs.value != 0); value /= rhs.value; return *this; } + Int64& operator%=(const Int64& rhs) { assert(rhs.value != 0); value %= rhs.value; return *this; } + Int64& operator&=(const Int64& rhs) { value &= rhs.value; return *this;} + Int64& operator|=(const Int64& rhs) { value |= rhs.value; return *this;} + Int64& operator<<=(int rhs) { assert(rhs < 0 || (value << rhs) >> rhs == value); value <<= rhs; return *this; } + Int64& operator>>=(int rhs) { assert(rhs > 0 || (value >> rhs) << rhs == value); value >>= rhs; return *this; } inline friend bool operator==(const Int64& lhs, const Int64& rhs) { return lhs.value == rhs.value; } inline friend bool operator!=(const Int64& lhs, const Int64& rhs) { return lhs.value != rhs.value; } @@ -106,7 +108,7 @@ public: template <class T> inline friend std::basic_ostream<T>& operator<<(std::basic_ostream<T>& lhs, const Int64& rhs) { lhs << rhs.value; return lhs; } private: - boost::int64_t value; + std::int64_t value; }; inline Int64 operator+(const Int64& lhs, const Int64& rhs) { return Int64(lhs) += rhs; } @@ -129,11 +131,11 @@ public: UInt64(const UInt64& rhs) : value(rhs.value) {} UInt64(unsigned int rhs) : value(rhs) {} //ambiguity intentional for types other than these UInt64(unsigned long rhs) : value(rhs) {} - UInt64(Loki::Select<Loki::IsSameType<boost::uint64_t, unsigned long>::value, DummyClass, boost::uint64_t>::Result rhs) : - value(rhs) {} //-> boost::uint64_t equals unsigned long int on x64 Linux! Still we want implicit behavior for all other systems! + UInt64(Select<IsSameType<std::uint64_t, unsigned long>::result, DummyClass, std::uint64_t>::Result rhs) : + value(rhs) {} //-> std::uint64_t equals unsigned long int on x64 Linux! Still we want implicit behavior for all other systems! //unsafe explicit but checked conversion from arbitrary integer type - template <class T> explicit UInt64(T rhs) : value(rhs) { checkRange<boost::uint64_t>(rhs); } + template <class T> explicit UInt64(T rhs) : value(rhs) { checkRange<std::uint64_t>(rhs); } UInt64& operator=(const UInt64& rhs) { value = rhs.value; return *this; } @@ -161,9 +163,9 @@ public: } #endif - UInt64& operator+=(const UInt64& rhs) { checkRange<boost::uint64_t>(double(value) + rhs.value); value += rhs.value; return *this; } - UInt64& operator-=(const UInt64& rhs) { checkRange<boost::uint64_t>(double(value) - rhs.value); value -= rhs.value; return *this; } - UInt64& operator*=(const UInt64& rhs) { checkRange<boost::uint64_t>(double(value) * rhs.value); value *= rhs.value; return *this; } + UInt64& operator+=(const UInt64& rhs) { checkRange<std::uint64_t>(double(value) + rhs.value); value += rhs.value; return *this; } + UInt64& operator-=(const UInt64& rhs) { checkRange<std::uint64_t>(double(value) - rhs.value); value -= rhs.value; return *this; } + UInt64& operator*=(const UInt64& rhs) { checkRange<std::uint64_t>(double(value) * rhs.value); value *= rhs.value; return *this; } UInt64& operator/=(const UInt64& rhs) { assert(rhs.value != 0); value /= rhs.value; return *this; } UInt64& operator%=(const UInt64& rhs) { assert(rhs.value != 0); value %= rhs.value; return *this; } UInt64& operator&=(const UInt64& rhs) { value &= rhs.value; return *this;} @@ -185,7 +187,7 @@ public: template <class T> inline friend std::basic_ostream<T>& operator<<(std::basic_ostream<T>& lhs, const UInt64& rhs) { lhs << rhs.value; return lhs; } private: - boost::uint64_t value; + std::uint64_t value; }; inline UInt64 operator+(const UInt64& lhs, const UInt64& rhs) { return UInt64(lhs) += rhs; } @@ -198,8 +200,8 @@ inline UInt64 operator|(const UInt64& lhs, const UInt64& rhs) { return UInt64(lh inline UInt64 operator<<(const UInt64& lhs, int rhs) { return UInt64(lhs) <<= rhs; } inline UInt64 operator>>(const UInt64& lhs, int rhs) { return UInt64(lhs) >>= rhs; } -template <> inline UInt64 to(Int64 number) { checkRange<boost::uint64_t>(number.value); return UInt64(number.value); } -template <> inline Int64 to(UInt64 number) { checkRange<boost:: int64_t>(number.value); return Int64(number.value); } +template <> inline UInt64 to(Int64 number) { checkRange<std::uint64_t>(number.value); return UInt64(number.value); } +template <> inline Int64 to(UInt64 number) { checkRange<std:: int64_t>(number.value); return Int64(number.value); } #ifdef FFS_WIN @@ -224,25 +226,33 @@ FILETIME tofiletime(const Int64& utcTime) #endif } - +//specialize numeric limits namespace std { -assert_static(std::numeric_limits<boost:: int64_t>::is_specialized); -assert_static(std::numeric_limits<boost::uint64_t>::is_specialized); +assert_static(std::numeric_limits<std:: int64_t>::is_specialized); +assert_static(std::numeric_limits<std::uint64_t>::is_specialized); -template <> class numeric_limits<zen::Int64> : public numeric_limits<boost::int64_t> +template <> class numeric_limits<zen::Int64> : public numeric_limits<std::int64_t> { public: - static zen::Int64 min() throw() { return numeric_limits<boost::int64_t>::min(); } - static zen::Int64 max() throw() { return numeric_limits<boost::int64_t>::max(); } + static zen::Int64 min() throw() { return numeric_limits<std::int64_t>::min(); } + static zen::Int64 max() throw() { return numeric_limits<std::int64_t>::max(); } }; -template <> class numeric_limits<zen::UInt64> : public numeric_limits<boost::uint64_t> +template <> class numeric_limits<zen::UInt64> : public numeric_limits<std::uint64_t> { public: - static zen::UInt64 min() throw() { return numeric_limits<boost::uint64_t>::min(); } - static zen::UInt64 max() throw() { return numeric_limits<boost::uint64_t>::max(); } + static zen::UInt64 min() throw() { return numeric_limits<std::uint64_t>::min(); } + static zen::UInt64 max() throw() { return numeric_limits<std::uint64_t>::max(); } }; } +/* +//specialize zen type trait +namespace zen -> we cannot mix signed/unsigned in general arithmetic operations -> we'll use the ostream-approach +{ +template <> struct IsUnsignedInt<UInt64> { enum { result = true }; }; +template <> struct IsSignedInt <Int64> { enum { result = true }; }; +} +*/ #endif //FFS_LARGE_64_BIT_INTEGER_H_INCLUDED diff --git a/shared/last_error.cpp b/zen/last_error.h index 57053c30..d2eaebfc 100644 --- a/shared/last_error.cpp +++ b/zen/last_error.h @@ -4,23 +4,63 @@ // * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** -#include "last_error.h" -#include "string_utf8.h" +#ifndef SYSTEMFUNCTIONS_H_INCLUDED +#define SYSTEMFUNCTIONS_H_INCLUDED + +#include <string> +#include "utf8.h" #include "i18n.h" #ifdef FFS_WIN -#include <wx/msw/wrapwin.h> //includes "windows.h" +#include "win.h" //includes "windows.h" #elif defined FFS_LINUX #include <cstring> #include <cerrno> #endif -using namespace zen; +namespace zen +{ +//evaluate GetLastError()/errno and assemble specific error message +#ifdef FFS_WIN +std::wstring getLastErrorFormatted(DWORD lastError = 0); +#elif defined FFS_LINUX +std::wstring getLastErrorFormatted(int lastError = 0); +#endif + + + + + + + + + + + + + + + + + + + + + + + + + + + +//######################## Implementation ######################## + #ifdef FFS_WIN -std::wstring zen::getLastErrorFormatted(unsigned long lastError) //try to get additional Windows error information +inline +std::wstring getLastErrorFormatted(DWORD lastError) //try to get additional Windows error information { //determine error code if none was specified if (lastError == 0) @@ -47,7 +87,8 @@ std::wstring zen::getLastErrorFormatted(unsigned long lastError) //try to get ad } #elif defined FFS_LINUX -std::wstring zen::getLastErrorFormatted(int lastError) //try to get additional Linux error information +inline +std::wstring getLastErrorFormatted(int lastError) //try to get additional Linux error information { //determine error code if none was specified if (lastError == 0) @@ -63,3 +104,7 @@ std::wstring zen::getLastErrorFormatted(int lastError) //try to get additional L return output; } #endif +} + + +#endif // SYSTEMFUNCTIONS_H_INCLUDED diff --git a/shared/long_path_prefix.h b/zen/long_path_prefix.h index ca6961a9..1d9213d1 100644 --- a/shared/long_path_prefix.h +++ b/zen/long_path_prefix.h @@ -9,10 +9,6 @@ #include "zstring.h" -#ifndef FFS_WIN -#error use in windows build only! -#endif - namespace zen { //handle filenames longer-equal 260 (== MAX_PATH) characters by applying \\?\-prefix (Reference: http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx#maxpath) @@ -51,23 +47,22 @@ Zstring removeLongPathPrefix(const Zstring& path); //throw() //################## implementation ################## //there are two flavors of long path prefix: one for UNC paths, one for regular paths -const Zstring LONG_PATH_PREFIX = Zstr("\\\\?\\"); -const Zstring LONG_PATH_PREFIX_UNC = Zstr("\\\\?\\UNC"); +const Zstring LONG_PATH_PREFIX = L"\\\\?\\"; +const Zstring LONG_PATH_PREFIX_UNC = L"\\\\?\\UNC"; -template <size_t max_path> -inline +template <size_t max_path> inline Zstring applyLongPathPrefixImpl(const Zstring& path) { assert(!path.empty()); //nicely check almost all WinAPI accesses! + if (path.length() >= max_path && //maximum allowed path length without prefix is (MAX_PATH - 1) - !path.StartsWith(LONG_PATH_PREFIX)) + !zen::startsWith(path, 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 + if (zen::startsWith(path, L"\\\\")) //UNC-name, e.g. \\zenju-pc\Users + return LONG_PATH_PREFIX_UNC + zen::afterFirst(path, L'\\'); //convert to \\?\UNC\zenju-pc\Users else return LONG_PATH_PREFIX + path; //prepend \\?\ prefix } - return path; //fallback } @@ -83,21 +78,20 @@ inline Zstring zen::applyLongPathPrefixCreateDir(const Zstring& path) //throw() { //special rule for ::CreateDirectoryEx(): MAX_PATH - 12(=^ 8.3 filename) is threshold - return applyLongPathPrefixImpl < MAX_PATH - 12 > (path); + return applyLongPathPrefixImpl<MAX_PATH - 12> (path); } inline Zstring zen::removeLongPathPrefix(const Zstring& path) //throw() { - if (path.StartsWith(LONG_PATH_PREFIX)) + if (zen::startsWith(path, LONG_PATH_PREFIX)) { - if (path.StartsWith(LONG_PATH_PREFIX_UNC)) //UNC-name - return Zstring(path).Replace(LONG_PATH_PREFIX_UNC, Zstr("\\"), false); + if (zen::startsWith(path, LONG_PATH_PREFIX_UNC)) //UNC-name + return replaceCpy(path, LONG_PATH_PREFIX_UNC, Zstr("\\"), false); else - return Zstring(path).Replace(LONG_PATH_PREFIX, Zstr(""), false); + return replaceCpy(path, LONG_PATH_PREFIX, Zstr(""), false); } - return path; //fallback } diff --git a/shared/notify_removal.cpp b/zen/notify_removal.cpp index 3a9239db..805c1c09 100644 --- a/shared/notify_removal.cpp +++ b/zen/notify_removal.cpp @@ -6,15 +6,12 @@ #include "notify_removal.h" #include <set> -#include "last_error.h" -#include "Loki/ScopeGuard.h" #include <algorithm> -#include <boost/bind.hpp> #include <dbt.h> +#include "scope_guard.h" using namespace zen; - /* //convert bitmask into "real" drive-letter Zstring getDriveFromMask(ULONG unitmask) @@ -110,7 +107,7 @@ MessageProvider::MessageProvider() : if (::RegisterClass(&wc) == 0) throw zen::FileError(std::wstring(L"Could not start monitoring window notifications:") + "\n\n" + getLastErrorFormatted() + " (RegisterClass)"); - Loki::ScopeGuard guardClass = Loki::MakeGuard(::UnregisterClass, WINDOW_NAME, process); + zen::ScopeGuard guardClass = zen::makeGuard([&]() { ::UnregisterClass(WINDOW_NAME, process); }); //create dummy-window windowHandle = ::CreateWindow( @@ -128,7 +125,7 @@ MessageProvider::MessageProvider() : if (windowHandle == NULL) throw zen::FileError(std::wstring(L"Could not start monitoring window notifications:") + "\n\n" + getLastErrorFormatted() + " (CreateWindow)"); - guardClass.Dismiss(); + guardClass.dismiss(); } @@ -143,7 +140,8 @@ MessageProvider::~MessageProvider() void MessageProvider::processMessage(UINT message, WPARAM wParam, LPARAM lParam) { - std::for_each(listener.begin(), listener.end(), boost::bind(&Listener::onMessage, _1, message, wParam, lParam)); + std::for_each(listener.begin(), listener.end(), + [&](Listener* ls) { ls->onMessage(message, wParam, lParam); }); } //#################################################################################################### diff --git a/shared/notify_removal.h b/zen/notify_removal.h index f9d1cbaf..bd47684e 100644 --- a/shared/notify_removal.h +++ b/zen/notify_removal.h @@ -7,14 +7,10 @@ #ifndef NOTIFY_H_INCLUDED #define NOTIFY_H_INCLUDED -#ifndef FFS_WIN -#error use in windows build only -#endif - -#include <wx/msw/wrapwin.h> //includes "windows.h" -#include "file_error.h" #include <vector> #include <memory> +#include "win.h" //includes "windows.h" +#include "file_error.h" //handle (user-) request for device removal via template method pattern //evaluate directly after processing window messages diff --git a/shared/perf.h b/zen/perf.h index 9bcf7882..f9970d0a 100644 --- a/shared/perf.h +++ b/zen/perf.h @@ -8,16 +8,7 @@ #define DEBUG_PERF_HEADER #include <sstream> - -#ifdef __WXMSW__ //we have wxWidgets -#include <wx/msw/wrapwin.h> //includes "windows.h" -#else -//#define WIN32_LEAN_AND_MEAN -> not in a header -#include <windows.h> -#undef max -#undef min -#endif - +#include "win.h" //includes "windows.h" #ifdef __MINGW32__ #define DEPRECATED(x) x __attribute__ ((deprecated)) @@ -25,11 +16,11 @@ #define DEPRECATED(x) __declspec(deprecated) x #endif + //two macros for quick performance measurements #define PERF_START CpuTimer perfTest; #define PERF_STOP perfTest.showResult(); - class CpuTimer { public: diff --git a/shared/privilege.cpp b/zen/privilege.cpp index 6c7d951b..495b1254 100644 --- a/shared/privilege.cpp +++ b/zen/privilege.cpp @@ -1,7 +1,5 @@ #include "privilege.h" -#include "last_error.h" -#include "i18n.h" -#include "loki/ScopeGuard.h" +#include "scope_guard.h" using namespace zen; @@ -20,7 +18,7 @@ bool Privileges::privilegeIsActive(LPCTSTR privilege) //throw FileError TOKEN_QUERY, //__in DWORD DesiredAccess, &hToken)) //__out PHANDLE TokenHandle throw FileError(_("Error setting privilege:") + " \"" + privilege + "\"" + "\n\n" + getLastErrorFormatted()); - LOKI_ON_BLOCK_EXIT2(::CloseHandle(hToken)); + ZEN_ON_BLOCK_EXIT(::CloseHandle(hToken)); LUID luid = {}; if (!::LookupPrivilegeValue( @@ -53,7 +51,7 @@ void Privileges::setPrivilege(LPCTSTR privilege, bool enable) //throw FileError TOKEN_ADJUST_PRIVILEGES, //__in DWORD DesiredAccess, &hToken)) //__out PHANDLE TokenHandle throw FileError(_("Error setting privilege:") + " \"" + privilege + "\"" + "\n\n" + getLastErrorFormatted()); - LOKI_ON_BLOCK_EXIT2(::CloseHandle(hToken)); + ZEN_ON_BLOCK_EXIT(::CloseHandle(hToken)); LUID luid = {}; if (!::LookupPrivilegeValue( diff --git a/shared/privilege.h b/zen/privilege.h index 09fe0d08..4545aac7 100644 --- a/shared/privilege.h +++ b/zen/privilege.h @@ -1,11 +1,16 @@ +// ************************************************************************** +// * This file is part of the FreeFileSync project. It is distributed under * +// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** + #ifndef PRIVILEGE_H_INCLUDED #define PRIVILEGE_H_INCLUDED #include <map> #include "zstring.h" #include "file_error.h" -#include <wx/msw/wrapwin.h> //includes "windows.h" - +#include "win.h" //includes "windows.h" namespace zen { diff --git a/shared/parse_txt.cpp b/zen/read_txt.cpp index 56da3bdd..fd92a10c 100644 --- a/shared/parse_txt.cpp +++ b/zen/read_txt.cpp @@ -1,4 +1,4 @@ -#include "parse_txt.h" +#include "read_txt.h" using namespace zen; @@ -20,8 +20,6 @@ std::string detectLineBreak(const Zstring& filename) //throw (FileError) linebreakChars.begin(), linebreakChars.end()); if (iter != buffer.end()) { - wxString firstRow = wxString::FromUTF8(&buffer[0], iter - buffer.begin()); - if (*iter == '\r') { ++iter; diff --git a/shared/parse_txt.h b/zen/read_txt.h index 479f950e..479f950e 100644 --- a/shared/parse_txt.h +++ b/zen/read_txt.h diff --git a/zen/scope_guard.h b/zen/scope_guard.h new file mode 100644 index 00000000..d3633284 --- /dev/null +++ b/zen/scope_guard.h @@ -0,0 +1,77 @@ +// ************************************************************************** +// * This file is part of the zenXML project. It is distributed under the * +// * Boost Software License, Version 1.0. See accompanying file * +// * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt. * +// * Copyright (C) 2011 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** + +#ifndef ZEN_SCOPEGUARD_8971632487321434 +#define ZEN_SCOPEGUARD_8971632487321434 + +//best of Zen, Loki and C++11 + +namespace zen +{ +//Scope Guard +/* + zen::ScopeGuard lockAio = zen::makeGuard([&]() { ::CancelIo(hDir); }); + ... + lockAio.dismiss(); +*/ + +//Scope Exit +/* + ZEN_ON_BLOCK_EXIT(::CloseHandle(hDir)); +*/ + +class ScopeGuardBase +{ +public: + void dismiss() const { dismissed_ = true; } + +protected: + ScopeGuardBase() : dismissed_(false) {} + ScopeGuardBase(const ScopeGuardBase& other) : dismissed_(other.dismissed_) { other.dismissed_ = true; } //take over responsibility + ~ScopeGuardBase() {} + + bool isDismissed() const { return dismissed_; } + +private: + ScopeGuardBase& operator=(const ScopeGuardBase&); // = delete; + + mutable bool dismissed_; +}; + + +template <typename F> +class ScopeGuardImpl : public ScopeGuardBase +{ +public: + ScopeGuardImpl(F fun) : fun_(fun) {} + + ~ScopeGuardImpl() + { + if (!this->isDismissed()) + try + { + fun_(); + } + catch (...) {} + } + +private: + F fun_; +}; + +typedef const ScopeGuardBase& ScopeGuard; + +template <class F> inline +ScopeGuardImpl<F> makeGuard(F fun) { return ScopeGuardImpl<F>(fun); } +} + +#define ZEN_CONCAT_SUB(X, Y) X ## Y +#define ZEN_CONCAT(X, Y) ZEN_CONCAT_SUB(X, Y) + +#define ZEN_ON_BLOCK_EXIT(X) zen::ScopeGuard ZEN_CONCAT(dummy, __LINE__) = zen::makeGuard([&](){X;}); (void)ZEN_CONCAT(dummy, __LINE__); + +#endif //ZEN_SCOPEGUARD_8971632487321434 diff --git a/shared/stl_tools.h b/zen/stl_tools.h index 6cfe35f8..6cfe35f8 100644 --- a/shared/stl_tools.h +++ b/zen/stl_tools.h diff --git a/shared/zbase.h b/zen/string_base.h index 5f404887..914e0434 100644 --- a/shared/zbase.h +++ b/zen/string_base.h @@ -7,13 +7,14 @@ #ifndef Z_BASE_H_INCLUDED #define Z_BASE_H_INCLUDED -#include <cassert> -#include <vector> -#include <sstream> #include <algorithm> -#include <string_tools.h> +#include <cassert> +#include "string_tools.h" #include <boost/detail/atomic_count.hpp> +//Zbase - a policy based string class + + /* Allocator Policy: ----------------- @@ -54,8 +55,8 @@ template <typename T, //Character Type void setLength(T* ptr, size_t newLength) */ -template < typename T, //Character Type - class AP > //Allocator Policy +template <typename T, //Character Type + class AP> //Allocator Policy class StorageDeepCopy : public AP { protected: @@ -107,8 +108,8 @@ private: }; -template < typename T, //Character Type - class AP > //Allocator Policy +template <typename T, //Character Type + class AP> //Allocator Policy class StorageRefCountThreadSafe : public AP { protected: @@ -177,13 +178,14 @@ private: static Descriptor* descr( T* ptr) { return reinterpret_cast< Descriptor*>(ptr) - 1; } static const Descriptor* descr(const T* ptr) { return reinterpret_cast<const Descriptor*>(ptr) - 1; } }; +//################################################################################################################################################################ //perf note: interstingly StorageDeepCopy and StorageRefCountThreadSafe show same performance in FFS comparison -template < class T, //Character Type +template <class T, //Character Type template <class, class> class SP = StorageRefCountThreadSafe, //Storage Policy - class AP = AllocatorOptimalSpeed > //Allocator Policy + class AP = AllocatorOptimalSpeed> //Allocator Policy class Zbase : public SP<T, AP> { public: @@ -191,7 +193,7 @@ public: Zbase(const T* source); //implicit conversion from a C-string Zbase(const T* source, size_t length); Zbase(const Zbase& source); - Zbase(Zbase && tmp); + Zbase(Zbase&& tmp); explicit Zbase(T source); //dangerous if implicit: T buffer[]; Zbase name = buffer; ups... //allow explicit construction from different string type, prevent ambiguity via SFINAE template <class S> explicit Zbase(const S& other, typename S::value_type = 0); @@ -210,34 +212,12 @@ public: T* begin(); T* end(); - //wxString-like functions - bool StartsWith(const Zbase& prefix ) const { return zen::startsWith(*this, prefix ); } - bool StartsWith(const T* prefix ) const { return zen::startsWith(*this, prefix ); } - bool StartsWith( T prefix ) const { return zen::startsWith(*this, prefix ); } - bool EndsWith (const Zbase& postfix) const { return zen::endsWith (*this, postfix); } - bool EndsWith (const T* postfix) const { return zen::endsWith (*this, postfix); } - bool EndsWith ( T postfix) const { return zen::endsWith (*this, postfix); } - void Truncate(size_t newLen) { return zen::truncate(*this, newLen); } - Zbase& Replace(const Zbase& old, const Zbase& replacement, bool replaceAll = true) { zen::replace(*this, old, replacement, replaceAll); return *this; } - Zbase AfterLast( T ch) const { return zen::afterLast (*this, ch); } //returns the whole string if "ch" not found - Zbase BeforeLast( T ch) const { return zen::beforeLast (*this, ch); } //returns empty string if "ch" not found - Zbase AfterFirst( T ch) const { return zen::afterFirst (*this, ch); } //returns empty string if "ch" not found - Zbase BeforeFirst(T ch) const { return zen::beforeFirst(*this, ch); } //returns the whole string if "ch" not found - void Trim(bool fromLeft = true, bool fromRight = true) { zen::trim(*this, fromLeft, fromRight); } - std::vector<Zbase> Split(T delimiter) const { return zen::split(*this, delimiter); } - std::vector<Zbase> Split(const Zbase& delimiter) const { return zen::split(*this, delimiter); } - - //number conversion - template <class N> static Zbase fromNumber(N number) { return zen::toString<Zbase>(number); } - template <class N> N toNumber() const { return zen::toNumber<N>(*this); } - //std::string functions size_t length() const; size_t size() const; const T* c_str() const; //C-string format with NULL-termination const T* data() const; //internal representation, NULL-termination not guaranteed const T operator[](size_t pos) const; - Zbase substr(size_t pos = 0, size_t len = npos) const; bool empty() const; void clear(); size_t find(const Zbase& str, size_t pos = 0) const; // @@ -253,7 +233,7 @@ public: void push_back(T val); //STL access Zbase& operator=(const Zbase& source); - Zbase& operator=(Zbase && tmp); + Zbase& operator=(Zbase&& tmp); Zbase& operator=(const T* source); Zbase& operator=(T source); Zbase& operator+=(const Zbase& other); @@ -324,8 +304,7 @@ template <class T, template <class, class> class SP, class AP> const Zbase<T, SP //################################# inline implementation ######################################## -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline Zbase<T, SP, AP>::Zbase() { //resist the temptation to avoid this allocation by referening a static global: NO performance advantage, MT issues! @@ -334,8 +313,7 @@ Zbase<T, SP, AP>::Zbase() } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline Zbase<T, SP, AP>::Zbase(T source) { rawStr = this->create(1); @@ -344,18 +322,16 @@ Zbase<T, SP, AP>::Zbase(T source) } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline Zbase<T, SP, AP>::Zbase(const T* source) { - const size_t sourceLen = zen::cStringLength(source); + const size_t sourceLen = zen::strLength(source); rawStr = this->create(sourceLen); std::copy(source, source + sourceLen + 1, rawStr); //include null-termination } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline Zbase<T, SP, AP>::Zbase(const T* source, size_t sourceLen) { rawStr = this->create(sourceLen); @@ -364,25 +340,22 @@ Zbase<T, SP, AP>::Zbase(const T* source, size_t sourceLen) } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline Zbase<T, SP, AP>::Zbase(const Zbase<T, SP, AP>& source) { rawStr = this->clone(source.rawStr); } -template <class T, template <class, class> class SP, class AP> -inline -Zbase<T, SP, AP>::Zbase(Zbase<T, SP, AP> && tmp) +template <class T, template <class, class> class SP, class AP> inline +Zbase<T, SP, AP>::Zbase(Zbase<T, SP, AP>&& tmp) { rawStr = this->clone(tmp.rawStr); //for a ref-counting string there probably isn't a faster way, even with r-value references } template <class T, template <class, class> class SP, class AP> -template <class S> -inline +template <class S> inline Zbase<T, SP, AP>::Zbase(const S& other, typename S::value_type) { const size_t sourceLen = other.size(); @@ -392,16 +365,14 @@ Zbase<T, SP, AP>::Zbase(const S& other, typename S::value_type) } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline Zbase<T, SP, AP>::~Zbase() { this->destroy(rawStr); } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline size_t Zbase<T, SP, AP>::find(const Zbase& str, size_t pos) const { assert(pos <= length()); @@ -412,20 +383,18 @@ size_t Zbase<T, SP, AP>::find(const Zbase& str, size_t pos) const } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline size_t Zbase<T, SP, AP>::find(const T* str, size_t pos) const { assert(pos <= length()); const T* thisEnd = end(); //respect embedded 0 const T* iter = std::search(begin() + pos, thisEnd, - str, str + zen::cStringLength(str)); + str, str + zen::strLength(str)); return iter == thisEnd ? npos : iter - begin(); } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline size_t Zbase<T, SP, AP>::find(T ch, size_t pos) const { assert(pos <= length()); @@ -435,8 +404,7 @@ size_t Zbase<T, SP, AP>::find(T ch, size_t pos) const } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline size_t Zbase<T, SP, AP>::rfind(T ch, size_t pos) const { assert(pos == npos || pos <= length()); @@ -455,13 +423,12 @@ size_t Zbase<T, SP, AP>::rfind(T ch, size_t pos) const } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline size_t Zbase<T, SP, AP>::rfind(const T* str, size_t pos) const { assert(pos == npos || pos <= length()); - const size_t strLen = zen::cStringLength(str); + const size_t strLen = zen::strLength(str); const T* currEnd = pos == npos ? end() : begin() + std::min(pos + strLen, length()); const T* iter = std::find_end(begin(), currEnd, @@ -515,8 +482,7 @@ Zbase<T, SP, AP>& Zbase<T, SP, AP>::replace(size_t pos1, size_t n1, const Zbase& } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline void Zbase<T, SP, AP>::resize(size_t newSize, T fillChar) { if (canWrite(rawStr, newSize)) @@ -545,56 +511,49 @@ void Zbase<T, SP, AP>::resize(size_t newSize, T fillChar) } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline bool operator==(const Zbase<T, SP, AP>& lhs, const Zbase<T, SP, AP>& rhs) { return lhs.length() == rhs.length() && std::equal(lhs.begin(), lhs.end(), rhs.begin()); //respect embedded 0 } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline bool operator==(const Zbase<T, SP, AP>& lhs, const T* rhs) { - return lhs.length() == zen::cStringLength(rhs) && std::equal(lhs.begin(), lhs.end(), rhs); //respect embedded 0 + return lhs.length() == zen::strLength(rhs) && std::equal(lhs.begin(), lhs.end(), rhs); //respect embedded 0 } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline bool operator==(const T* lhs, const Zbase<T, SP, AP>& rhs) { return operator==(rhs, lhs); } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline bool operator!=(const Zbase<T, SP, AP>& lhs, const Zbase<T, SP, AP>& rhs) { return !operator==(lhs, rhs); } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline bool operator!=(const Zbase<T, SP, AP>& lhs, const T* rhs) { return !operator==(lhs, rhs); } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline bool operator!=(const T* lhs, const Zbase<T, SP, AP>& rhs) { return !operator==(lhs, rhs); } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline bool operator<(const Zbase<T, SP, AP>& lhs, const Zbase<T, SP, AP>& rhs) { return std::lexicographical_compare(lhs.begin(), lhs.end(), //respect embedded 0 @@ -602,58 +561,51 @@ bool operator<(const Zbase<T, SP, AP>& lhs, const Zbase<T, SP, AP>& rhs) } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline bool operator<(const Zbase<T, SP, AP>& lhs, const T* rhs) { return std::lexicographical_compare(lhs.begin(), lhs.end(), //respect embedded 0 - rhs, rhs + zen::cStringLength(rhs)); + rhs, rhs + zen::strLength(rhs)); } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline bool operator<(const T* lhs, const Zbase<T, SP, AP>& rhs) { - return std::lexicographical_compare(lhs, lhs + zen::cStringLength(lhs), //respect embedded 0 + return std::lexicographical_compare(lhs, lhs + zen::strLength(lhs), //respect embedded 0 rhs.begin(), rhs.end()); } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline size_t Zbase<T, SP, AP>::length() const { return SP<T, AP>::length(rawStr); } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline size_t Zbase<T, SP, AP>::size() const { return length(); } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline const T* Zbase<T, SP, AP>::c_str() const { return rawStr; } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline const T* Zbase<T, SP, AP>::data() const { return rawStr; } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline const T Zbase<T, SP, AP>::operator[](size_t pos) const { assert(pos < length()); @@ -661,24 +613,21 @@ const T Zbase<T, SP, AP>::operator[](size_t pos) const } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline const T* Zbase<T, SP, AP>::begin() const { return rawStr; } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline const T* Zbase<T, SP, AP>::end() const { return rawStr + length(); } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline T* Zbase<T, SP, AP>::begin() { reserve(length()); @@ -686,32 +635,28 @@ T* Zbase<T, SP, AP>::begin() } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline T* Zbase<T, SP, AP>::end() { return begin() + length(); } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline void Zbase<T, SP, AP>::push_back(T val) { operator+=(val); } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline bool Zbase<T, SP, AP>::empty() const { return length() == 0; } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline void Zbase<T, SP, AP>::clear() { if (!empty()) @@ -727,65 +672,49 @@ void Zbase<T, SP, AP>::clear() } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline const Zbase<T, SP, AP> operator+(const Zbase<T, SP, AP>& lhs, const Zbase<T, SP, AP>& rhs) { return Zbase<T, SP, AP>(lhs) += rhs; } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline const Zbase<T, SP, AP> operator+(const Zbase<T, SP, AP>& lhs, const T* rhs) { return Zbase<T, SP, AP>(lhs) += rhs; } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline const Zbase<T, SP, AP> operator+(const T* lhs, const Zbase<T, SP, AP>& rhs) { return Zbase<T, SP, AP>(lhs) += rhs; } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline const Zbase<T, SP, AP> operator+(T lhs, const Zbase<T, SP, AP>& rhs) { return (Zbase<T, SP, AP>() += lhs) += rhs; } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline const Zbase<T, SP, AP> operator+(const Zbase<T, SP, AP>& lhs, T rhs) { return Zbase<T, SP, AP>(lhs) += rhs; } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline void Zbase<T, SP, AP>::swap(Zbase<T, SP, AP>& other) { std::swap(rawStr, other.rawStr); } -template <class T, template <class, class> class SP, class AP> -inline -Zbase<T, SP, AP> Zbase<T, SP, AP>::substr(size_t pos, size_t len) const -{ - assert(pos + (len == npos ? 0 : len) <= length()); - return Zbase(rawStr + pos, len == npos ? length() - pos : len); -} - - -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline void Zbase<T, SP, AP>::reserve(size_t minCapacity) //make unshared and check capacity { if (!canWrite(rawStr, minCapacity)) @@ -800,8 +729,7 @@ void Zbase<T, SP, AP>::reserve(size_t minCapacity) //make unshared and check cap } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline Zbase<T, SP, AP>& Zbase<T, SP, AP>::assign(const T* source, size_t len) { if (canWrite(rawStr, len)) @@ -817,8 +745,7 @@ Zbase<T, SP, AP>& Zbase<T, SP, AP>::assign(const T* source, size_t len) } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline Zbase<T, SP, AP>& Zbase<T, SP, AP>::operator=(const Zbase<T, SP, AP>& source) { Zbase(source).swap(*this); @@ -826,25 +753,22 @@ Zbase<T, SP, AP>& Zbase<T, SP, AP>::operator=(const Zbase<T, SP, AP>& source) } -template <class T, template <class, class> class SP, class AP> -inline -Zbase<T, SP, AP>& Zbase<T, SP, AP>::operator=(Zbase<T, SP, AP> && tmp) +template <class T, template <class, class> class SP, class AP> inline +Zbase<T, SP, AP>& Zbase<T, SP, AP>::operator=(Zbase<T, SP, AP>&& tmp) { swap(tmp); return *this; } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline Zbase<T, SP, AP>& Zbase<T, SP, AP>::operator=(const T* source) { - return assign(source, zen::cStringLength(source)); + return assign(source, zen::strLength(source)); } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline Zbase<T, SP, AP>& Zbase<T, SP, AP>::operator=(T source) { if (canWrite(rawStr, 1)) @@ -860,8 +784,7 @@ Zbase<T, SP, AP>& Zbase<T, SP, AP>::operator=(T source) } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline Zbase<T, SP, AP>& Zbase<T, SP, AP>::operator+=(const Zbase<T, SP, AP>& other) { const size_t thisLen = length(); @@ -874,12 +797,11 @@ Zbase<T, SP, AP>& Zbase<T, SP, AP>::operator+=(const Zbase<T, SP, AP>& other) } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline Zbase<T, SP, AP>& Zbase<T, SP, AP>::operator+=(const T* other) { const size_t thisLen = length(); - const size_t otherLen = zen::cStringLength(other); + const size_t otherLen = zen::strLength(other); reserve(thisLen + otherLen); //make unshared and check capacity std::copy(other, other + otherLen + 1, rawStr + thisLen); //include null-termination @@ -888,8 +810,7 @@ Zbase<T, SP, AP>& Zbase<T, SP, AP>::operator+=(const T* other) } -template <class T, template <class, class> class SP, class AP> -inline +template <class T, template <class, class> class SP, class AP> inline Zbase<T, SP, AP>& Zbase<T, SP, AP>::operator+=(T ch) { const size_t thisLen = length(); diff --git a/shared/string_tools.h b/zen/string_tools.h index 8951d942..8cafad07 100644 --- a/shared/string_tools.h +++ b/zen/string_tools.h @@ -8,53 +8,23 @@ #ifndef STRING_TOOLS_HEADER_213458973046 #define STRING_TOOLS_HEADER_213458973046 -#include <cstddef> //size_t #include <cctype> //isspace #include <cwctype> //iswspace -#include <cwchar> //swprintf #include <cstdio> //sprintf +#include <cwchar> //swprintf #include <algorithm> #include <cassert> #include <sstream> -#include <functional> #include <vector> -#include "loki/TypeManip.h" -#include "loki/EmptyType.h" -#include "loki/TypeTraits.h" -#include "assert_static.h" -#ifdef _MSC_VER -template <> struct Loki::IsCustomUnsignedInt<unsigned __int64> { enum { value = 1 }; }; -template <> struct Loki::IsCustomSignedInt <signed __int64> { enum { value = 1 }; }; -#endif +#include "string_traits.h" +#include "type_traits.h" //enhance arbitray string class with useful non-member functions: namespace zen { -template <class C> size_t cStringLength(const C* str); //strlen() -template <class C> bool cStringIsWhiteSpace(C ch); -template <class C> bool cStringIsDigit(C ch); - -//uniform access to string-like types: classes and character arrays -/* -strBegin(): - std::wstring str(L"dummy"); - char array[] = "dummy"; - const wchar_t* iter = strBegin(str); //returns str.c_str() - const char* iter2 = strBegin(array); //returns array - -strLength(): - strLength(str); //equals str.size() - strLength(array); //equals cStringLength(array) - -StringTraits<>: - StringTraits<std::wstring>::CharType //equals wchar_t - StringTraits<wchar_t[5]> ::CharType //equals wchar_t - StringTraits<const wchar_t*>::isStringLike; //equals "true" - StringTraits<const int*> ::isStringLike; //equals "false" - StringTraits<std::wstring>::isStringClass //equals "true" - StringTraits<wchar_t[5]> ::isStringClass //equals "false" -*/ +template <class C> bool cStringIsWhiteSpace(C ch); +template <class C> bool cStringIsDigit(C ch); template <class S, class T> bool startsWith(const S& str, const T& prefix); //both S and T can be strings or char/wchar_t arrays or simple char/wchar_t template <class S, class T> bool endsWith (const S& str, const T& postfix); // @@ -66,19 +36,18 @@ template <class S, class T> S beforeFirst(const S& str, const T& ch); //returns template <class S, class T> std::vector<S> split(const S& str, const T& delimiter); template <class S> void truncate(S& str, size_t newLen); -template <class S, class T, class U> void replace(S& str, const T& old, const U& replacement, bool replaceAll = true); template <class S> void trim(S& str, bool fromLeft = true, bool fromRight = true); +template <class S, class T, class U> void replace ( S& str, const T& oldOne, const U& newOne, bool replaceAll = true); +template <class S, class T, class U> S replaceCpy(const S& str, const T& oldOne, const U& newOne, bool replaceAll = true); //high-performance conversion from numbers to strings -template <class S, class Num> S toString(const Num& number); -template <class Num, class S> Num toNumber(const S& str); - -//string to string conversion: converst string-like type into compatible target string class -template <class T, class S> T cvrtString(const S& str); - - +template <class S, class T, class Num> S printNumber(const T& format, const Num& number); //format a single number using ::sprintf +template <class S, class Num> S toString(const Num& number); +template <class Num, class S > Num toNumber(const S& str); +//string to string conversion: converst string-like type into char-compatible target string class +template <class T, class S> T cvrtString(const S& str); @@ -112,18 +81,6 @@ template <class T, class S> T cvrtString(const S& str); //---------------------- implementation ---------------------- - -template <class C> inline -size_t cStringLength(const C* str) //strlen() -{ - assert_static((Loki::IsSameType<C, char>::value || Loki::IsSameType<C, wchar_t>::value)); - size_t len = 0; - while (*str++ != 0) - ++len; - return len; -} - - template <> inline bool cStringIsWhiteSpace(char ch) { @@ -133,8 +90,8 @@ bool cStringIsWhiteSpace(char ch) std::isspace(static_cast<unsigned char>(ch)) != 0; } -template <> inline bool cStringIsWhiteSpace(unsigned char ch) { return cStringIsWhiteSpace<char>(ch); } -template <> inline bool cStringIsWhiteSpace(signed char ch) { return cStringIsWhiteSpace<char>(ch); } +//template <> inline bool cStringIsWhiteSpace(unsigned char ch) { return cStringIsWhiteSpace<char>(ch); } -> not character types! +//template <> inline bool cStringIsWhiteSpace(signed char ch) { return cStringIsWhiteSpace<char>(ch); } template <> inline bool cStringIsWhiteSpace(wchar_t ch) { return std::iswspace(ch) != 0; } template <> inline @@ -144,138 +101,12 @@ bool cStringIsDigit(char ch) } -template <> -inline +template <> inline bool cStringIsDigit(wchar_t ch) { return std::iswdigit(ch) != 0; } -namespace implementation -{ -template <class T> -struct UnArray { typedef T NonArrayType; }; - -template <class T, int N> -struct UnArray<T[N]> { typedef T NonArrayType; }; - -template <class T> -struct UnPointer { typedef T NonPtrType; }; - -template <class T> -struct UnPointer<T*> { typedef T NonPtrType; }; - -template <class T> -struct UnReference { typedef T NonRefType; }; - -template <class T> -struct UnReference<T&> { typedef T NonRefType; }; - - -template<typename T> -class HasValueType -{ - typedef char Yes[1]; - typedef char No [2]; - - template <typename U> class HelperTp {}; - - //detect presence of a member type called value_type - template <class U> static Yes& hasMemberValueType(HelperTp<typename U::value_type>*); - template <class U> static No& hasMemberValueType(...); - -public: - enum { Result = sizeof(hasMemberValueType<T>(NULL)) == sizeof(Yes) - }; -}; - - -template<typename T, bool isClassType> -class HasStringMembers -{ -public: - enum { Result = false }; -}; - -template<typename T> -class HasStringMembers<T, true> -{ - typedef char Yes[1]; - typedef char No [2]; - - //detect presence of member functions (without specific restriction on return type, within T or one of it's base classes) - template <typename U, U t> class HelperFn {}; - - struct Fallback - { - int c_str; - int length; - }; - - template <class U> - struct Helper2 : public U, public Fallback {}; //U must be a class-type! - - //we don't know the exact declaration of the member attribute (may be in base class), but we know what NOT to expect: - template <class U> static No& hasMemberCstr(HelperFn<int Fallback::*, &Helper2<U>::c_str>*); - template <class U> static Yes& hasMemberCstr(...); - - template <class U> static No& hasMemberLength(HelperFn<int Fallback::*, &Helper2<U>::length>*); - template <class U> static Yes& hasMemberLength(...); -public: - enum { Result = sizeof(hasMemberCstr <T>(NULL)) == sizeof(Yes) && - sizeof(hasMemberLength<T>(NULL)) == sizeof(Yes) - }; -}; - -template <class S, bool isStringClass> struct StringTraits2 { typedef Loki::EmptyType Result; }; //"StringTraits2": fix some VS bug with namespace and partial template specialization - -template <class S> struct StringTraits2<S, true> { typedef typename S::value_type Result; }; -template <> struct StringTraits2<char, false> { typedef char Result; }; -template <> struct StringTraits2<wchar_t, false> { typedef wchar_t Result; }; -} - -template <class S> -struct StringTraits -{ -private: - typedef typename implementation::UnReference<S>::NonRefType NonRefType; - typedef typename Loki::TypeTraits<NonRefType>::NonConstType UndecoratedType; - - typedef typename implementation::UnArray<UndecoratedType>::NonArrayType NonArrayType; - typedef typename implementation::UnPointer<NonArrayType>::NonPtrType NonPtrType; - typedef typename Loki::TypeTraits<NonPtrType>::NonConstType NonConstValType; //handle "const char* const" -public: - enum - { - isStringClass = implementation::HasStringMembers<UndecoratedType, implementation::HasValueType<UndecoratedType>::Result>::Result - }; - - typedef typename implementation::StringTraits2<NonConstValType, isStringClass>::Result CharType; - - enum - { - isStringLike = Loki::IsSameType<CharType, char>::value || Loki::IsSameType<CharType, wchar_t>::value - }; -}; - - -template <class S> inline -const typename StringTraits<S>::CharType* strBegin(const S& str, typename S::value_type dummy = 0) { return str.c_str(); } //SFINAE: T must be a "string" - -template <class Char> -inline const typename StringTraits<Char>::CharType* strBegin(const Char* str) { return str; } -inline const char* strBegin(const char& ch) { return &ch; } -inline const wchar_t* strBegin(const wchar_t& ch) { return &ch; } - - -template <class S> inline -size_t strLength(const S& str, typename S::value_type dummy = 0) { return str.length(); } //SFINAE: T must be a "string" - -template <class Char> -inline size_t strLength(const Char* str) { return cStringLength(str); } -inline size_t strLength(char) { return 1; } -inline size_t strLength(wchar_t) { return 1; } - template <class S, class T> inline bool startsWith(const S& str, const T& prefix) @@ -405,22 +236,46 @@ void truncate(S& str, size_t newLen) template <class S, class T, class U> inline -void replace(S& str, const T& old, const U& replacement, bool replaceAll) +S replaceCpy(const S& str, const T& oldOne, const U& newOne, bool replaceAll) { assert_static(StringTraits<T>::isStringLike); assert_static(StringTraits<U>::isStringLike); - size_t pos = 0; - size_t oldLen = strLength(old); - size_t repLen = strLength(replacement); - while ((pos = str.find(old, pos)) != S::npos) + typedef typename StringTraits<S>::CharType CharType; + + const size_t oldLen = strLength(oldOne); + const size_t newLen = strLength(newOne); + + S output; + + const CharType* strPos = strBegin(str); + const CharType* strEnd = strPos + strLength(str); + + for (;;) { - str.replace(pos, oldLen, replacement); - pos += repLen; //move past the string that was replaced + const CharType* ptr = std::search(strPos, strEnd, + strBegin(oldOne), strBegin(oldOne) + oldLen); + if (ptr == strEnd) + break; + + output += S(strPos, ptr - strPos); + output += S(strBegin(newOne), newLen); + + strPos = ptr + oldLen; if (!replaceAll) break; } + output += S(strPos, strEnd - strPos); + + return output; +} + + +template <class S, class T, class U> inline +void replace(S& str, const T& oldOne, const U& newOne, bool replaceAll) +{ + str = replaceCpy(str, oldOne, newOne, replaceAll); } @@ -474,6 +329,47 @@ T cvrtString(const S& str) { return implementation::CnvtStringToString<S, T>().c namespace implementation { +template <class Num> inline +int saferPrintf(char* buffer, size_t bufferSize, const char* format, const Num& number) //there is no such thing as a "safe" printf ;) +{ +#ifdef _MSC_VER + return ::_snprintf(buffer, bufferSize, format, number); //VS2010 doesn't respect ISO C +#else + return std::snprintf(buffer, bufferSize, format, number); //C99 +#endif +} + +template <class Num> inline +int saferPrintf(wchar_t* buffer, size_t bufferSize, const wchar_t* format, const Num& number) +{ +#ifdef __MINGW32__ //MinGW doesn't respect ISO C + return ::snwprintf(buffer, bufferSize, format, number); +#else + return std::swprintf(buffer, bufferSize, format, number); //C99 +#endif +} +} + +template <class S, class T, class Num> inline +S printNumber(const T& format, const Num& number) //format a single number using ::sprintf +{ + assert_static(StringTraits<T>::isStringLike); + assert_static((IsSameType< + typename StringTraits<S>::CharType, + typename StringTraits<T>::CharType>::result)); + + typedef typename StringTraits<S>::CharType CharType; + + const int BUFFER_SIZE = 128; + CharType buffer[BUFFER_SIZE]; + const int charsWritten = implementation::saferPrintf(buffer, BUFFER_SIZE, format, number); + + return charsWritten > 0 ? S(buffer, charsWritten) : S(); +} + + +namespace implementation +{ enum NumberType { NUM_TYPE_SIGNED_INT, @@ -503,29 +399,15 @@ struct CvrtNumberToString<S, Num, NUM_TYPE_FLOATING_POINT> S convert(const Num& number) const { return convertFloat(number, typename StringTraits<S>::CharType()); } private: - S convertFloat(const Num& number, char) const - { - char buffer[50]; - int charsWritten = std::sprintf(buffer, "%f", static_cast<double>(number)); - return charsWritten > 0 ? S(buffer, charsWritten) : S(); - } - S convertFloat(const Num& number, wchar_t) const - { - wchar_t buffer[50]; -#ifdef __MINGW32__ - int charsWritten = ::swprintf(buffer, L"%f", static_cast<double>(number)); //MinGW does not comply to the C standard here -#else - int charsWritten = std::swprintf(buffer, 50, L"%f", static_cast<double>(number)); -#endif - return charsWritten > 0 ? S(buffer, charsWritten) : S(); - } + S convertFloat(const Num& number, char ) const { return printNumber<S>( "%g", static_cast<double>(number)); } + S convertFloat(const Num& number, wchar_t) const { return printNumber<S>(L"%g", static_cast<double>(number)); } }; /* perf: integer to string: (executed 10 mio. times) std::stringstream - 14796 ms std::sprintf - 3086 ms - hand coded - 778 ms + formatInteger - 778 ms */ template <class S, class Num> inline @@ -660,12 +542,12 @@ inline S toString(const Num& number) //convert number to string the C++ way { using namespace implementation; - return CvrtNumberToString < S, Num, - Loki::TypeTraits<Num>::isSignedInt ? NUM_TYPE_SIGNED_INT : - Loki::TypeTraits<Num>::isUnsignedInt ? NUM_TYPE_UNSIGNED_INT : - Loki::TypeTraits<Num>::isFloat ? NUM_TYPE_FLOATING_POINT : + return CvrtNumberToString<S, Num, + IsSignedInt <Num>::result ? NUM_TYPE_SIGNED_INT : + IsUnsignedInt<Num>::result ? NUM_TYPE_UNSIGNED_INT : + IsFloat <Num>::result ? NUM_TYPE_FLOATING_POINT : NUM_TYPE_OTHER - > ().convert(number); + >().convert(number); } @@ -674,12 +556,12 @@ inline Num toNumber(const S& str) //convert string to number the C++ way { using namespace implementation; - return CvrtStringToNumber < S, Num, - Loki::TypeTraits<Num>::isSignedInt ? NUM_TYPE_SIGNED_INT : - Loki::TypeTraits<Num>::isUnsignedInt ? NUM_TYPE_UNSIGNED_INT : - Loki::TypeTraits<Num>::isFloat ? NUM_TYPE_FLOATING_POINT : + return CvrtStringToNumber<S, Num, + IsSignedInt <Num>::result ? NUM_TYPE_SIGNED_INT : + IsUnsignedInt<Num>::result ? NUM_TYPE_UNSIGNED_INT : + IsFloat <Num>::result ? NUM_TYPE_FLOATING_POINT : NUM_TYPE_OTHER - > ().convert(str); + >().convert(str); } } diff --git a/zen/string_traits.h b/zen/string_traits.h new file mode 100644 index 00000000..59da2f79 --- /dev/null +++ b/zen/string_traits.h @@ -0,0 +1,176 @@ +// ************************************************************************** +// * This file is part of the zenXML project. It is distributed under the * +// * Boost Software License, Version 1.0. See accompanying file * +// * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt. * +// * Copyright (C) 2011 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** + +#ifndef STRING_TRAITS_HEADER_813274321443234 +#define STRING_TRAITS_HEADER_813274321443234 + +#include "type_tools.h" +#include "assert_static.h" + + +//uniform access to string-like types: classes and character arrays +namespace zen +{ +/* +strBegin(): + std::wstring str(L"dummy"); + char array[] = "dummy"; + const wchar_t* iter = strBegin(str); //returns str.c_str() + const char* iter2 = strBegin(array); //returns array + +strLength(): + strLength(str); //equals str.size() + strLength(array); //equals cStringLength(array) + +StringTraits<>::CharType: + StringTraits<std::wstring>::CharType //equals wchar_t + StringTraits<wchar_t[5]> ::CharType //equals wchar_t + +StringTraits<>::isStringLike: + StringTraits<const wchar_t*>::isStringLike; //equals "true" + StringTraits<const int*> ::isStringLike; //equals "false" + +StringTraits<>::isStringClass: + StringTraits<std::wstring>::isStringClass //equals "true" + StringTraits<wchar_t[5]> ::isStringClass //equals "false" +*/ + + + + + + + + + + + + + +//---------------------- implementation ---------------------- +namespace implementation +{ +template<typename T> +class HasValueTypedef +{ + typedef char Yes[1]; + typedef char No [2]; + + template <typename U> class HelperTp {}; + + //detect presence of a member type called value_type + template <class U> static Yes& hasMemberValueType(HelperTp<typename U::value_type>*); + template <class U> static No& hasMemberValueType(...); + +public: + enum { result = sizeof(hasMemberValueType<T>(NULL)) == sizeof(Yes) + }; +}; + + +template<typename T, bool isClassType> +class HasStringMembers +{ +public: + enum { result = false }; +}; + +template<typename T> +class HasStringMembers<T, true> +{ + typedef char Yes[1]; + typedef char No [2]; + + //detect presence of member functions (without specific restriction on return type, within T or one of it's base classes) + template <typename U, U t> class HelperFn {}; + + struct Fallback + { + int c_str; + int length; + }; + + template <class U> + struct Helper2 : public U, public Fallback {}; //U must be a class-type! + + //we don't know the exact declaration of the member attribute (may be in base class), but we know what NOT to expect: + template <class U> static No& hasMemberCstr(HelperFn<int Fallback::*, &Helper2<U>::c_str>*); + template <class U> static Yes& hasMemberCstr(...); + + template <class U> static No& hasMemberLength(HelperFn<int Fallback::*, &Helper2<U>::length>*); + template <class U> static Yes& hasMemberLength(...); +public: + enum { result = sizeof(hasMemberCstr <T>(NULL)) == sizeof(Yes) && + sizeof(hasMemberLength<T>(NULL)) == sizeof(Yes) + }; +}; + +template <class S, bool isStringClass> struct StringTraits2 { typedef EmptyType Result; }; //"StringTraits2": fix some VS bug with namespace and partial template specialization + +template <class S> struct StringTraits2<S, true > { typedef typename S::value_type Result; }; +template <> struct StringTraits2<char, false> { typedef char Result; }; +template <> struct StringTraits2<wchar_t, false> { typedef wchar_t Result; }; +} + + +template <class S> +struct StringTraits +{ +private: + typedef typename RemoveRef <S >::Result NonRefType; + typedef typename RemoveConst <NonRefType >::Result NonConstType; + typedef typename RemoveArray <NonConstType>::Result NonArrayType; + typedef typename RemovePointer<NonArrayType>::Result NonPtrType; + typedef typename RemoveConst <NonPtrType >::Result UndecoratedType; //handle "const char* const" +public: + enum + { + isStringClass = implementation::HasStringMembers<NonConstType, implementation::HasValueTypedef<NonConstType>::result>::result + }; + + typedef typename implementation::StringTraits2<UndecoratedType, isStringClass>::Result CharType; + + enum + { + isStringLike = IsSameType<CharType, char>::result || IsSameType<CharType, wchar_t>::result + }; +}; + + +namespace implementation +{ +template <class C> inline +size_t cStringLength(const C* str) //strlen() +{ + assert_static((IsSameType<C, char>::result || IsSameType<C, wchar_t>::result)); + size_t len = 0; + while (*str++ != 0) + ++len; + return len; +} +} + + +template <class S> inline +const typename StringTraits<S>::CharType* strBegin(const S& str, typename S::value_type dummy = 0) { return str.c_str(); } //SFINAE: T must be a "string" + +template <class Char> +inline const typename StringTraits<Char>::CharType* strBegin(const Char* str) { return str; } +inline const char* strBegin(const char& ch) { return &ch; } +inline const wchar_t* strBegin(const wchar_t& ch) { return &ch; } + + +template <class S> inline +size_t strLength(const S& str, typename S::value_type dummy = 0) { return str.length(); } //SFINAE: T must be a "string" + +template <class Char> +inline size_t strLength(const Char* str) { return implementation::cStringLength(str); } +inline size_t strLength(char) { return 1; } +inline size_t strLength(wchar_t) { return 1; } +} + +#endif //STRING_TRAITS_HEADER_813274321443234 diff --git a/shared/symlink_target.h b/zen/symlink_target.h index 9ab0ea3f..3704eebe 100644 --- a/shared/symlink_target.h +++ b/zen/symlink_target.h @@ -7,13 +7,11 @@ #ifndef SYMLINK_WIN_H_INCLUDED #define SYMLINK_WIN_H_INCLUDED -#include "loki/ScopeGuard.h" -#include "last_error.h" +#include "scope_guard.h" #include "file_error.h" -#include "i18n.h" #ifdef FFS_WIN -#include <wx/msw/wrapwin.h> //includes "windows.h" +#include "win.h" //includes "windows.h" #include "WinIoCtl.h" #include "privilege.h" #include "long_path_prefix.h" @@ -24,9 +22,7 @@ #ifdef _MSC_VER //I don't have Windows Driver Kit at hands right now, so unfortunately we need to redefine this structures and cross fingers... - -//from ntifs.h -typedef struct _REPARSE_DATA_BUFFER +typedef struct _REPARSE_DATA_BUFFER //from ntifs.h { ULONG ReparseTag; USHORT ReparseDataLength; @@ -68,9 +64,8 @@ Zstring getSymlinkRawTargetString(const Zstring& linkPath) //throw FileError #ifdef FFS_WIN //FSCTL_GET_REPARSE_POINT: http://msdn.microsoft.com/en-us/library/aa364571(VS.85).aspx - try //reading certain symlinks requires admin rights! This shall not cause an error in user mode! + try //reading certain symlinks/junctions requires admin rights! This shall not cause an error in user mode! { - //allow access to certain symbolic links/junctions Privileges::getInstance().ensureActive(SE_BACKUP_NAME); //throw FileError } catch (...) {} @@ -84,7 +79,7 @@ Zstring getSymlinkRawTargetString(const Zstring& linkPath) //throw FileError NULL); if (hLink == INVALID_HANDLE_VALUE) throw FileError(_("Error resolving symbolic link:") + "\n\"" + linkPath + "\"" + "\n\n" + getLastErrorFormatted()); - LOKI_ON_BLOCK_EXIT2(::CloseHandle(hLink)); + ZEN_ON_BLOCK_EXIT(::CloseHandle(hLink)); //respect alignment issues... const DWORD bufferSize = REPARSE_DATA_BUFFER_HEADER_SIZE + MAXIMUM_REPARSE_DATA_BUFFER_SIZE; @@ -118,7 +113,7 @@ Zstring getSymlinkRawTargetString(const Zstring& linkPath) //throw FileError throw FileError(_("Error resolving symbolic link:") + "\n\"" + linkPath + "\"" + "\n\n" + "Not a symbolic link or junction!"); //absolute symlinks and junctions technically start with \??\ while relative ones do not - if (output.StartsWith(Zstr("\\??\\"))) + if (startsWith(output, Zstr("\\??\\"))) output = Zstring(output.c_str() + 4, output.length() - 4); return output; diff --git a/zen/thread.h b/zen/thread.h new file mode 100644 index 00000000..4db1e613 --- /dev/null +++ b/zen/thread.h @@ -0,0 +1,92 @@ +// ************************************************************************** +// * This file is part of the FreeFileSync project. It is distributed under * +// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** + +#ifndef BOOST_THREAD_WRAP_H +#define BOOST_THREAD_WRAP_H + +//temporary solution until C++11 thread becomes fully available + +#ifdef __MINGW32__ +#pragma GCC diagnostic push + +#pragma GCC diagnostic ignored "-Wswitch-enum" +#pragma GCC diagnostic ignored "-Wstrict-aliasing" +//#pragma GCC diagnostic ignored "-Wno-attributes" +//#pragma GCC diagnostic ignored "-Wredundant-decls" +//#pragma GCC diagnostic ignored "-Wcast-align" +//#pragma GCC diagnostic ignored "-Wunused-value" +#endif + +#include <boost/thread.hpp> + +#ifdef __MINGW32__ +#pragma GCC diagnostic pop +#endif + +namespace zen +{ +//until std::async is available: +/* +Example: + Zstring dirname = ... + auto ft = zen::async([=](){ return zen::dirExists(dirname); }); + if (ft.timed_wait(boost::posix_time::milliseconds(200)) && ft.get()) + //dir exising +*/ +template <class Function> +auto async(Function fun) -> boost::unique_future<decltype(fun())>; + +template<class InputIterator, class Duration> +void wait_for_all_timed(InputIterator first, InputIterator last, const Duration& wait_duration); + + + + + + + + + + + + + + + + + + + + +//###################### implementation ###################### +template <class T, class Function> inline +auto async2(Function fun) -> boost::unique_future<T> //workaround VS2010 bug: bool (*fun)(); decltype(fun()) == int! +{ + boost::packaged_task<T> pt([=] { return fun(); }); + auto fut = pt.get_future(); + boost::thread(std::move(pt)); + return std::move(fut); +} + + +template <class Function> inline auto async(Function fun) -> boost::unique_future<decltype(fun())> { return async2<decltype(fun())>(fun); } + + +template<class InputIterator, class Duration> inline +void wait_for_all_timed(InputIterator first, InputIterator last, const Duration& wait_duration) +{ + const boost::system_time endTime = boost::get_system_time() + wait_duration; + while (first != last) + { + first->timed_wait_until(endTime); + if (boost::get_system_time() >= endTime) + return; + ++first; + } +} +} + +#endif //BOOST_THREAD_WRAP_H diff --git a/zen/type_tools.h b/zen/type_tools.h new file mode 100644 index 00000000..06ef76e1 --- /dev/null +++ b/zen/type_tools.h @@ -0,0 +1,74 @@ +// ************************************************************************** +// * This file is part of the zenXML project. It is distributed under the * +// * Boost Software License, Version 1.0. See accompanying file * +// * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt. * +// * Copyright (C) 2011 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** + +#ifndef TYPE_TOOLS_HEADER_45237590734254545 +#define TYPE_TOOLS_HEADER_45237590734254545 + +namespace zen +{ +//########## Strawman Classes ########################## +struct EmptyType {}; +struct NullType {}; + +//########## Type Mapping ############################## +template <int n> +struct Int2Type {}; +//------------------------------------------------------ +template <class T> +struct Type2Type {}; + +//########## Control Structures ######################## +template <bool flag, class T, class U> +struct Select +{ + typedef T Result; +}; +template <class T, class U> +struct Select<false, T, U> +{ + typedef U Result; +}; +//------------------------------------------------------ +template <class T, class U> +struct IsSameType +{ + enum { result = false }; +}; + +template <class T> +struct IsSameType<T, T> +{ + enum { result = true }; +}; + +//########## Type Cleanup ############################## +template <class T> +struct RemoveRef { typedef T Result; }; + +template <class T> +struct RemoveRef<T&> { typedef T Result; }; +//------------------------------------------------------ +template <class T> +struct RemoveConst { typedef T Result; }; + +template <class T> +struct RemoveConst<const T> { typedef T Result; }; +//------------------------------------------------------ +template <class T> +struct RemovePointer { typedef T Result; }; + +template <class T> +struct RemovePointer<T*> { typedef T Result; }; +//------------------------------------------------------ +template <class T> +struct RemoveArray { typedef T Result; }; + +template <class T, int N> +struct RemoveArray<T[N]> { typedef T Result; }; +} + +#endif //TYPE_TOOLS_HEADER_45237590734254545 diff --git a/zen/type_traits.h b/zen/type_traits.h new file mode 100644 index 00000000..0a705def --- /dev/null +++ b/zen/type_traits.h @@ -0,0 +1,88 @@ +// ************************************************************************** +// * This file is part of the zenXML project. It is distributed under the * +// * Boost Software License, Version 1.0. See accompanying file * +// * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt. * +// * Copyright (C) 2011 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** + +#ifndef TYPE_TRAITS_HEADER_3425628658765467 +#define TYPE_TRAITS_HEADER_3425628658765467 + +namespace zen +{ +//Example: "IsSignedInt<int>::result" evaluates to "true" + +template <class T> struct IsUnsignedInt; +template <class T> struct IsSignedInt; +template <class T> struct IsFloat; + +template <class T> struct IsInteger; //IsSignedInt or IsUnsignedInt +template <class T> struct IsArithmetic; //IsInteger or IsFloat +//remaining non-arithmetic types: bool, char, wchar_t + +//optional: specialize new types like: +//template <> struct IsUnsignedInt<UInt64> { enum { result = true }; }; + + + + + + + + + + + + + + + + + + + + + + + +//################ implementation ###################### +#define ZEN_SPECIALIZE_TRAIT(X, Y) template <> struct X<Y> { enum { result = true }; }; + +template <class T> +struct IsUnsignedInt { enum { result = false }; }; + +ZEN_SPECIALIZE_TRAIT(IsUnsignedInt, unsigned char); +ZEN_SPECIALIZE_TRAIT(IsUnsignedInt, unsigned short int); +ZEN_SPECIALIZE_TRAIT(IsUnsignedInt, unsigned int); +ZEN_SPECIALIZE_TRAIT(IsUnsignedInt, unsigned long int); +ZEN_SPECIALIZE_TRAIT(IsUnsignedInt, unsigned long long int); //new with C++11 - same type as unsigned __int64 in VS2010 +//------------------------------------------------------ + +template <class T> +struct IsSignedInt { enum { result = false }; }; + +ZEN_SPECIALIZE_TRAIT(IsSignedInt, signed char); +ZEN_SPECIALIZE_TRAIT(IsSignedInt, short int); +ZEN_SPECIALIZE_TRAIT(IsSignedInt, int); +ZEN_SPECIALIZE_TRAIT(IsSignedInt, long int); +ZEN_SPECIALIZE_TRAIT(IsSignedInt, long long int); //new with C++11 - same type as __int64 in VS2010 +//------------------------------------------------------ + +template <class T> +struct IsFloat { enum { result = false }; }; + +ZEN_SPECIALIZE_TRAIT(IsFloat, float); +ZEN_SPECIALIZE_TRAIT(IsFloat, double); +ZEN_SPECIALIZE_TRAIT(IsFloat, long double); +//------------------------------------------------------ + +#undef ZEN_SPECIALIZE_TRAIT + +template <class T> +struct IsInteger { enum { result = IsUnsignedInt<T>::result || IsSignedInt<T>::result }; }; + +template <class T> +struct IsArithmetic { enum { result = IsInteger<T>::result || IsFloat<T>::result }; }; +} + +#endif //TYPE_TRAITS_HEADER_3425628658765467 diff --git a/shared/string_utf8.h b/zen/utf8.h index 8c920752..e72a8e3c 100644 --- a/shared/string_utf8.h +++ b/zen/utf8.h @@ -9,13 +9,13 @@ #define STRING_UTF8_HEADER_01832479146991573473545 #include <iterator> -#include "loki/TypeManip.h" #include "string_tools.h" -#include "assert_static.h" +//#include "type_tools.h" +//#include "string_traits.h" namespace zen { -//convert any(!) "string-like" object into target string by applying a UTF8 conversion (only if necessary!) +//convert any(!) "string-like" object into target string by applying a UTF8 conversion (but only if necessary!) template <class TargetString, class SourceString> TargetString utf8CvrtTo(const SourceString& str); //convert wide to utf8 string; example: std::string tmp = toUtf8<std::string>(L"abc"); @@ -134,21 +134,21 @@ OutputIterator codePointToUtf8(CodePoint cp, OutputIterator result) //http://en. *result++ = static_cast<Char8>(cp); else if (cp < 0x800) { - *result++ = static_cast<Char8>((cp >> 6 ) | 0xc0); - *result++ = static_cast<Char8>((cp & 0x3f ) | 0x80); + *result++ = static_cast<Char8>((cp >> 6 ) | 0xc0); + *result++ = static_cast<Char8>((cp & 0x3f) | 0x80); } else if (cp < 0x10000) { - *result++ = static_cast<Char8>((cp >> 12 ) | 0xe0); - *result++ = static_cast<Char8>(((cp >> 6) & 0x3f ) | 0x80); - *result++ = static_cast<Char8>((cp & 0x3f ) | 0x80); + *result++ = static_cast<Char8>((cp >> 12 ) | 0xe0); + *result++ = static_cast<Char8>(((cp >> 6) & 0x3f) | 0x80); + *result++ = static_cast<Char8>((cp & 0x3f ) | 0x80); } else { - *result++ = static_cast<Char8>((cp >> 18 ) | 0xf0); - *result++ = static_cast<Char8>(((cp >> 12) & 0x3f ) | 0x80); - *result++ = static_cast<Char8>(((cp >> 6) & 0x3f ) | 0x80); - *result++ = static_cast<Char8>((cp & 0x3f ) | 0x80); + *result++ = static_cast<Char8>((cp >> 18 ) | 0xf0); + *result++ = static_cast<Char8>(((cp >> 12) & 0x3f) | 0x80); + *result++ = static_cast<Char8>(((cp >> 6) & 0x3f) | 0x80); + *result++ = static_cast<Char8>((cp & 0x3f ) | 0x80); } return result; } @@ -251,7 +251,7 @@ private: template <class WideString, class CharString> inline -WideString utf8ToWide(const CharString& str, Loki::Int2Type<2>) //windows: convert utf8 to utf16 wchar_t +WideString utf8ToWide(const CharString& str, Int2Type<2>) //windows: convert utf8 to utf16 wchar_t { WideString output; utf8ToCodePoint(strBegin(str), strBegin(str) + strLength(str), @@ -261,7 +261,7 @@ WideString utf8ToWide(const CharString& str, Loki::Int2Type<2>) //windows: conve template <class WideString, class CharString> inline -WideString utf8ToWide(const CharString& str, Loki::Int2Type<4>) //other OS: convert utf8 to utf32 wchar_t +WideString utf8ToWide(const CharString& str, Int2Type<4>) //other OS: convert utf8 to utf32 wchar_t { WideString output; utf8ToCodePoint(strBegin(str), strBegin(str) + strLength(str), @@ -271,7 +271,7 @@ WideString utf8ToWide(const CharString& str, Loki::Int2Type<4>) //other OS: conv template <class CharString, class WideString> inline -CharString wideToUtf8(const WideString& str, Loki::Int2Type<2>) //windows: convert utf16-wchar_t to utf8 +CharString wideToUtf8(const WideString& str, Int2Type<2>) //windows: convert utf16-wchar_t to utf8 { CharString output; utf16ToCodePoint(strBegin(str), strBegin(str) + strLength(str), @@ -281,7 +281,7 @@ CharString wideToUtf8(const WideString& str, Loki::Int2Type<2>) //windows: conve template <class CharString, class WideString> inline -CharString wideToUtf8(const WideString& str, Loki::Int2Type<4>) //other OS: convert utf32-wchar_t to utf8 +CharString wideToUtf8(const WideString& str, Int2Type<4>) //other OS: convert utf32-wchar_t to utf8 { CharString output; std::for_each(strBegin(str), strBegin(str) + strLength(str), @@ -294,20 +294,20 @@ CharString wideToUtf8(const WideString& str, Loki::Int2Type<4>) //other OS: conv template <class WideString, class CharString> inline WideString utf8ToWide(const CharString& str) { - assert_static((Loki::IsSameType<typename StringTraits<CharString>::CharType, char >::value)); - assert_static((Loki::IsSameType<typename StringTraits<WideString>::CharType, wchar_t>::value)); + assert_static((IsSameType<typename StringTraits<CharString>::CharType, char >::result)); + assert_static((IsSameType<typename StringTraits<WideString>::CharType, wchar_t>::result)); - return implementation::utf8ToWide<WideString>(str, Loki::Int2Type<sizeof(wchar_t)>()); + return implementation::utf8ToWide<WideString>(str, Int2Type<sizeof(wchar_t)>()); } template <class CharString, class WideString> inline CharString wideToUtf8(const WideString& str) { - assert_static((Loki::IsSameType<typename StringTraits<CharString>::CharType, char >::value)); - assert_static((Loki::IsSameType<typename StringTraits<WideString>::CharType, wchar_t>::value)); + assert_static((IsSameType<typename StringTraits<CharString>::CharType, char >::result)); + assert_static((IsSameType<typename StringTraits<WideString>::CharType, wchar_t>::result)); - return implementation::wideToUtf8<CharString>(str, Loki::Int2Type<sizeof(wchar_t)>()); + return implementation::wideToUtf8<CharString>(str, Int2Type<sizeof(wchar_t)>()); } @@ -327,7 +327,8 @@ TargetString utf8CvrtTo(const SourceString& str, wchar_t, wchar_t) { return cvrt template <class TargetString, class SourceString> inline TargetString utf8CvrtTo(const SourceString& str) { - return utf8CvrtTo<TargetString>(str, typename StringTraits<SourceString>::CharType(), + return utf8CvrtTo<TargetString>(str, + typename StringTraits<SourceString>::CharType(), typename StringTraits<TargetString>::CharType()); } } diff --git a/shared/warn_static.h b/zen/warn_static.h index 66513871..db472ccd 100644 --- a/shared/warn_static.h +++ b/zen/warn_static.h @@ -1,8 +1,7 @@ // ************************************************************************** -// * This file is part of the zenXML project. It is distributed under the * -// * Boost Software License, Version 1.0. See accompanying file * -// * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt. * -// * Copyright (C) 2011 ZenJu (zhnmju123 AT gmx.de) * +// * This file is part of the FreeFileSync project. It is distributed under * +// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** #ifndef WARN_STATIC_HEADER_08724567834560832745 @@ -23,12 +22,12 @@ Usage: __pragma(message (__FILE__ "(" MAKE_STRING(__LINE__) "): Warning: " ## TXT)) #elif defined __GNUC__ -#define LOKI_CONCAT( X, Y ) LOKI_CONCAT_SUB( X, Y ) -#define LOKI_CONCAT_SUB( X, Y ) X##Y +#define ZEN_CONCAT_SUB(X, Y) X ## Y +#define ZEN_CONCAT(X, Y) ZEN_CONCAT_SUB(X, Y) #define warn_static(TXT) \ typedef int STATIC_WARNING __attribute__ ((deprecated)); \ - enum { LOKI_CONCAT(warn_static_dummy_value, __LINE__) = sizeof(STATIC_WARNING) }; + enum { ZEN_CONCAT(warn_static_dummy_value, __LINE__) = sizeof(STATIC_WARNING) }; #endif diff --git a/zen/win.h b/zen/win.h new file mode 100644 index 00000000..618c92fa --- /dev/null +++ b/zen/win.h @@ -0,0 +1,30 @@ +// ************************************************************************** +// * This file is part of the FreeFileSync project. It is distributed under * +// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** + +#ifndef YAWFWH_YET_ANOTHER_WRAPPER_FOR_WINDOWS_H +#define YAWFWH_YET_ANOTHER_WRAPPER_FOR_WINDOWS_H + +//------------------------------------------------------ +#ifdef __WXMSW__ //we have wxWidgets +#include <wx/msw/wrapwin.h> //includes "windows.h" +//------------------------------------------------------ +#else +//#define WIN32_LEAN_AND_MEAN + +#ifndef NOMINMAX +#define NOMINMAX +#endif + +#ifndef STRICT +#define STRICT //improve type checking +#endif + +#include <windows.h> + +#endif +//------------------------------------------------------ + +#endif //YAWFWH_YET_ANOTHER_WRAPPER_FOR_WINDOWS_H diff --git a/zen/win_ver.h b/zen/win_ver.h new file mode 100644 index 00000000..ca075bbe --- /dev/null +++ b/zen/win_ver.h @@ -0,0 +1,72 @@ +// ************************************************************************** +// * This file is part of the FreeFileSync project. It is distributed under * +// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** + +#ifndef WINDOWS_VERSION_HEADER_238470348254325 +#define WINDOWS_VERSION_HEADER_238470348254325 + +#include "win.h" + +namespace zen +{ +bool winXpOrLater(); +bool winServer2003orLater(); +bool vistaOrLater(); +bool win7OrLater(); + + + + + + + + + + + + + + + + + + +//######################### implementation ######################### +namespace impl +{ +inline +bool winXyOrLater(DWORD major, DWORD minor) +{ + OSVERSIONINFO osvi = {}; + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + if (::GetVersionEx(&osvi)) + return osvi.dwMajorVersion > major || + (osvi.dwMajorVersion == major && osvi.dwMinorVersion >= minor); + return false; +} +} + +//version overview: http://msdn.microsoft.com/en-us/library/ms724834(VS.85).aspx + +//2000 is version 5.0 +//XP is version 5.1 +//Server 2003 is version 5.2 +//Vista is version 6.0 +//Seven is version 6.1 + +inline +bool winXpOrLater() { return impl::winXyOrLater(5, 1); } + +inline +bool winServer2003orLater() { return impl::winXyOrLater(5, 2); } + +inline +bool vistaOrLater() { return impl::winXyOrLater(6, 0); } + +inline +bool win7OrLater() { return impl::winXyOrLater(6, 1); } +} + +#endif //WINDOWS_VERSION_HEADER_238470348254325 diff --git a/shared/zstring.cpp b/zen/zstring.cpp index 45762000..5331499f 100644 --- a/shared/zstring.cpp +++ b/zen/zstring.cpp @@ -9,18 +9,17 @@ #include <boost/thread/once.hpp> #ifdef FFS_WIN -#include <wx/msw/wrapwin.h> //includes "windows.h" -#undef min -#undef max -#include "dll_loader.h" -#endif //FFS_WIN +#include "dll.h" +#include "win_ver.h" +#endif #ifndef NDEBUG -#include <wx/string.h> #include <iostream> #include <cstdlib> #endif +using namespace zen; + #ifndef NDEBUG LeakChecker::~LeakChecker() @@ -85,26 +84,13 @@ void LeakChecker::reportProblem(const std::string& message) //throw (std::logic_ #ifdef FFS_WIN namespace { -bool hasInvariantLocale() -{ - OSVERSIONINFO osvi = {}; - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - - //invariant locale has been introduced with XP - if (GetVersionEx(&osvi)) - return osvi.dwMajorVersion > 5 || - (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion >= 1); //XP has majorVersion == 5, minorVersion == 1 - //overview: http://msdn.microsoft.com/en-us/library/ms724834(VS.85).aspx - return false; -} - -#ifndef LOCALE_INVARIANT +#ifndef LOCALE_INVARIANT //invariant locale has been introduced with XP #define LOCALE_INVARIANT 0x007f #endif //warning: LOCALE_INVARIANT is NOT available with Windows 2000, so we have to make yet another distinction... -const LCID ZSTRING_INVARIANT_LOCALE = hasInvariantLocale() ? +const LCID ZSTRING_INVARIANT_LOCALE = zen::winXpOrLater() ? LOCALE_INVARIANT : MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT); //see: http://msdn.microsoft.com/en-us/goglobal/bb688122.aspx @@ -116,14 +102,14 @@ typedef int (WINAPI* CompareStringOrdinalFunc)(LPCWSTR lpString1, LPCWSTR lpString2, int cchCount2, BOOL bIgnoreCase); -util::DllFun<CompareStringOrdinalFunc> ordinalCompare; //caveat: function scope static initialization is not thread-safe in VS 2010! +SysDllFun<CompareStringOrdinalFunc> ordinalCompare; //caveat: function scope static initialization is not thread-safe in VS 2010! boost::once_flag initCmpStrOrdOnce = BOOST_ONCE_INIT; } int z_impl::compareFilenamesWin(const wchar_t* a, const wchar_t* b, size_t sizeA, size_t sizeB) { - boost::call_once(initCmpStrOrdOnce, []() { ordinalCompare = util::DllFun<CompareStringOrdinalFunc>(L"kernel32.dll", "CompareStringOrdinal"); }); + boost::call_once(initCmpStrOrdOnce, []() { ordinalCompare = SysDllFun<CompareStringOrdinalFunc>(L"kernel32.dll", "CompareStringOrdinal"); }); if (ordinalCompare) //this additional test has no noticeable performance impact { @@ -142,7 +128,7 @@ int z_impl::compareFilenamesWin(const wchar_t* a, const wchar_t* b, size_t sizeA //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); + const int minSize = std::min<int>(sizeA, sizeB); if (minSize == 0) //LCMapString does not allow input sizes of 0! return static_cast<int>(sizeA) - static_cast<int>(sizeB); @@ -153,17 +139,16 @@ int z_impl::compareFilenamesWin(const wchar_t* a, const wchar_t* b, size_t sizeA wchar_t bufferA[5000]; 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) + //faster than CharUpperBuff + wmemcpy or CharUpper + wmemcpy and same speed like ::CompareString() + if (::LCMapString(ZSTRING_INVARIANT_LOCALE, //__in LCID Locale, + LCMAP_UPPERCASE, //__in DWORD dwMapFlags, + a, //__in LPCTSTR lpSrcStr, + minSize, //__in int cchSrc, + bufferA, //__out LPTSTR lpDestStr, + 5000) == 0) //__in int cchDest throw std::runtime_error("Error comparing strings! (LCMapString)"); - if (::LCMapString(ZSTRING_INVARIANT_LOCALE, LCMAP_UPPERCASE, b, static_cast<int>(minSize), bufferB, 5000) == 0) + if (::LCMapString(ZSTRING_INVARIANT_LOCALE, LCMAP_UPPERCASE, b, minSize, bufferB, 5000) == 0) throw std::runtime_error("Error comparing strings! (LCMapString)"); rv = ::wmemcmp(bufferA, bufferB, minSize); @@ -173,10 +158,10 @@ int z_impl::compareFilenamesWin(const wchar_t* a, const wchar_t* b, size_t sizeA std::vector<wchar_t> bufferA(minSize); std::vector<wchar_t> bufferB(minSize); - if (::LCMapString(ZSTRING_INVARIANT_LOCALE, LCMAP_UPPERCASE, a, static_cast<int>(minSize), &bufferA[0], static_cast<int>(minSize)) == 0) + if (::LCMapString(ZSTRING_INVARIANT_LOCALE, LCMAP_UPPERCASE, a, minSize, &bufferA[0], minSize) == 0) throw std::runtime_error("Error comparing strings! (LCMapString: FS)"); - if (::LCMapString(ZSTRING_INVARIANT_LOCALE, LCMAP_UPPERCASE, b, static_cast<int>(minSize), &bufferB[0], static_cast<int>(minSize)) == 0) + if (::LCMapString(ZSTRING_INVARIANT_LOCALE, LCMAP_UPPERCASE, b, minSize, &bufferB[0], minSize) == 0) throw std::runtime_error("Error comparing strings! (LCMapString: FS)"); rv = ::wmemcmp(&bufferA[0], &bufferB[0], minSize); diff --git a/shared/zstring.h b/zen/zstring.h index 8c30007b..0ba9f108 100644 --- a/shared/zstring.h +++ b/zen/zstring.h @@ -7,11 +7,11 @@ #ifndef ZSTRING_H_INCLUDED #define ZSTRING_H_INCLUDED -#include "zbase.h" +#include "string_base.h" #include <cstring> //strcmp() #ifndef NDEBUG -#include "boost_thread_wrap.h" //include <boost/thread.hpp> +#include "thread.h" //includes <boost/thread.hpp> #include <map> #endif @@ -120,7 +120,8 @@ const Zchar FILE_NAME_SEPARATOR = '/'; #endif //"The reason for all the fuss above" - Loki/SmartPtr -typedef Zbase<Zchar, StorageRefCountThreadSafe, AllocatorFreeStoreChecked> Zstring; //for use with file names +//a high-performant string for use as file name in multithreaded contexts +typedef Zbase<Zchar, StorageRefCountThreadSafe, AllocatorFreeStoreChecked> Zstring; @@ -205,8 +206,7 @@ void makeUpper(Zbase<wchar_t, SP, AP>& str) namespace std { -template<> -inline +template<> inline void swap(Zstring& rhs, Zstring& lhs) { rhs.swap(lhs); |