diff options
| author | 2009-12-05 17:34:44 +0000 | |
|---|---|---|
| committer | 2009-12-05 17:34:44 +0000 | |
| commit | 282b7c3cdbbe5a210f2d07cf01d1c493f77e9526 (patch) | |
| tree | 1e3d4c06b636f596584942a8b97a8a349aecf8fc | |
| parent | avoid an error message on popups for dead channels (diff) | |
| download | KVIrc-282b7c3cdbbe5a210f2d07cf01d1c493f77e9526.tar.gz KVIrc-282b7c3cdbbe5a210f2d07cf01d1c493f77e9526.tar.bz2 KVIrc-282b7c3cdbbe5a210f2d07cf01d1c493f77e9526.zip | |
reworked namespace KviQString;
improved hungarian notation;
added Doxygen comments;
added TODO for hungarian notation: keep it updated!
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@3666 17fca916-40b9-46aa-a4ea-0a15b648b75c
27 files changed, 2458 insertions, 745 deletions
diff --git a/TODO-doxygen b/TODO-doxygen index 95a79dafa..9931a7625 100644 --- a/TODO-doxygen +++ b/TODO-doxygen @@ -54,7 +54,6 @@ core/kvi_bswap.h - incomplete from line 40 core/kvi_heapobject.h - incomplete from line 75 to 80 core/kvi_strasm.h core/kvi_string.h -core/kvi_qstring.h - incomplete lines 56-61, 70-75 core/kvi_error.h - incomplete from line 36 to 185 file/kvi_file.h system/kvi_locale.h diff --git a/TODO.Events b/TODO-events index 3c5ff166d..3c5ff166d 100644 --- a/TODO.Events +++ b/TODO-events diff --git a/TODO-hu-notation b/TODO-hu-notation new file mode 100644 index 000000000..a5992b88d --- /dev/null +++ b/TODO-hu-notation @@ -0,0 +1,1017 @@ +In this file, there are all files which have to port to the Hungarian Notation. + +kvilib: +config/kvi_version.h +config/kvi_settings.h +config/kvi_defaults.h +config/kvi_debug.h +config/kvi_confignames.h +config/kvi_wincfg.h +config/kvi_sourcesdate.h +config/kvi_buildinfo.h +config/kvi_fileextensions.h +config/kvi_buildinfo.cpp +core/kvi_memmove.h +core/kvi_inttypes.h +core/kvi_hstrEqualCIN.h +core/kvi_pointerhashtable.h +core/kvi_malloc.h +core/kvi_bswap.h +core/kvi_heapobject.h +core/kvi_error.h +core/kvi_strasm.h +core/kvi_pointerlist.h +core/kvi_string.h +core/kvi_error.cpp +core/kvi_string.cpp +core/kvi_hstrEqualCIN.cpp +core/kvi_heapobject.cpp +core/kvi_malloc.cpp +core/kvi_memmove.cpp +ext/kvi_animatedpixmap.h +ext/kvi_oggtheora.h +ext/kvi_osinfo.h +ext/kvi_parameterlist.h +ext/kvi_proxydb.h +ext/avdevice/sonix_compress.h +ext/avdevice/videodevice.h +ext/avdevice/videoinput.h +ext/avdevice/dummyvideodevice.h +ext/avdevice/bayer.h +ext/avdevice/videodevicevector.h +ext/avdevice/videodevicemodelpool.h +ext/avdevice/videodevicepool.h +ext/kvi_config.h +ext/kvi_databuffer.h +ext/kvi_cmdformatter.h +ext/kvi_pixmap.h +ext/kvi_crypt.h +ext/kvi_dbusadaptor.h +ext/kvi_regusersdb.h +ext/kvi_xlib.h +ext/kvi_stringconversion.h +ext/kvi_msgtype.h +ext/kvi_garbage.h +ext/kvi_animatedpixmapcache.h +ext/kvi_miscutils.h +ext/kvi_mediatype.h +ext/kvi_sharedfiles.h +ext/kvi_regchan.h +ext/kvi_crypt.cpp +ext/kvi_cmdformatter.cpp +ext/kvi_pixmap.cpp +ext/kvi_config.cpp +ext/kvi_parameterlist.cpp +ext/avdevice/dummyvideodevice.cpp +ext/avdevice/videodevice.cpp +ext/avdevice/videodevicevector.cpp +ext/avdevice/videodevicemodelpool.cpp +ext/avdevice/videodevicepool.cpp +ext/avdevice/sonix_compress.cpp +ext/avdevice/bayer.cpp +ext/avdevice/videoinput.cpp +ext/kvi_garbage.cpp +ext/kvi_animatedpixmapcache.cpp +ext/kvi_sharedfiles.cpp +ext/kvi_msgtype.cpp +ext/kvi_miscutils.cpp +ext/kvi_mediatype.cpp +ext/kvi_regchan.cpp +ext/kvi_dbusadaptor.cpp +ext/kvi_oggtheora.cpp +ext/kvi_databuffer.cpp +ext/kvi_osinfo.cpp +ext/kvi_regusersdb.cpp +ext/kvi_animatedpixmap.cpp +ext/kvi_proxydb.cpp +ext/kvi_stringconversion.cpp +file/kvi_packagefile.h +file/kvi_file.h +file/kvi_fileutils.h +file/kvi_fileutils.cpp +file/kvi_file.cpp +file/kvi_packagefile.cpp +irc/kvi_avatar.h +irc/kvi_ircmask.h +irc/kvi_ircserver.h +irc/kvi_useridentity.h +irc/kvi_ircuserdb.h +irc/kvi_identityprofile.h +irc/kvi_mirccntrl.h +irc/kvi_ircserverdb.h +irc/kvi_avatarcache.h +irc/kvi_network.h +irc/kvi_nickserv.h +irc/kvi_ircmask.cpp +irc/kvi_mirccntrl.cpp +irc/kvi_network.cpp +irc/kvi_identityprofile.cpp +irc/kvi_useridentity.cpp +irc/kvi_ircserver.cpp +irc/kvi_ircuserdb.cpp +irc/kvi_avatarcache.cpp +irc/kvi_nickserv.cpp +irc/kvi_avatar.cpp +irc/kvi_ircserverdb.cpp +net/kvi_sockettype.h +net/kvi_dns.h +net/kvi_ssl.h +net/kvi_url.h +net/kvi_netutils.h +net/kvi_http.h +net/kvi_socket.h +net/kvi_url.cpp +net/kvi_netutils.cpp +net/kvi_http.cpp +net/kvi_socket.cpp +net/kvi_dns.cpp +net/kvi_ssl.cpp +system/kvi_env.h +system/kvi_locale.h +system/kvi_time.h +system/kvi_stdarg.h +system/kvi_byteorder.h +system/kvi_thread.h +system/kvi_process.h +system/kvi_locale.cpp +system/kvi_thread.cpp +system/kvi_time.cpp +system/kvi_env.cpp +tal/kvi_tal_menubar.h +tal/kvi_tal_toolbar.h +tal/kvi_tal_application.h +tal/kvi_tal_tablewidget.h +tal/kvi_tal_tooltip.h +tal/kvi_tal_splitter.h +tal/kvi_tal_hbox.h +tal/kvi_tal_tabdialog.h +tal/kvi_tal_popupmenu.h +tal/kvi_tal_listwidget.h +tal/kvi_tal_vbox.h +tal/kvi_tal_wizard.h +tal/kvi_tal_mainwindow.h +tal/kvi_tal_groupbox.h +tal/kvi_tal_filedialog.h +tal/kvi_tal_itemdelegates.h +tal/kvi_tal_popupmenu.cpp +tal/kvi_tal_listwidget.cpp +tal/kvi_tal_hbox.cpp +tal/kvi_tal_splitter.cpp +tal/kvi_tal_menubar.cpp +tal/kvi_tal_wizard.cpp +tal/kvi_tal_application.cpp +tal/kvi_tal_tablewidget.cpp +tal/kvi_tal_tooltip.cpp +tal/kvi_tal_vbox.cpp +tal/kvi_tal_tabdialog.cpp +tal/kvi_tal_groupbox.cpp +tal/kvi_tal_mainwindow.cpp +tal/kvi_tal_itemdelegates.cpp +tal/kvi_tal_filedialog.cpp +tal/kvi_tal_toolbar.cpp + +kvirc/ui: +kvi_historywin.h +kvi_optionswidget.h +kvi_cryptcontroller.h +kvi_filedialog.h +kvi_splash.h +kvi_windowlist.h +kvi_ctcppagedialog.h +kvi_maskeditor.h +kvi_texticonwin.h +kvi_menubar.h +kvi_input_history.h +kvi_ircview.h +kvi_userlistview.h +kvi_toolwindows_container.h +kvi_toolbar.h +kvi_modeeditor.h +kvi_input.h +kvi_ircviewtools.h +kvi_channel.h +kvi_colorwin.h +kvi_statusbarapplet.h +kvi_windowlist_tree.h +kvi_actiondrawer.h +kvi_debugwindow.h +kvi_htmldialog.h +kvi_console.h +kvi_window.h +kvi_themedlabel.h +kvi_query.h +kvi_dynamictooltip.h +kvi_imagedialog.h +kvi_selectors.h +kvi_topicw.h +kvi_ipeditor.h +kvi_scriptbutton.h +kvi_input_editor.h +kvi_customtoolbar.h +kvi_ircviewprivate.h +kvi_scripteditor.h +kvi_msgbox.h +kvi_statusbar.h +kvi_irctoolbar.h +kvi_modew.h +kvi_frame.h +kvi_mdimanager.h +kvi_mdichild.h +kvi_mdimanager.cpp +kvi_scripteditor.cpp +kvi_actiondrawer.cpp +kvi_splash.cpp +kvi_ircview_gettextline.cpp +kvi_windowlist.cpp +kvi_topicw.cpp +kvi_frame.cpp +kvi_filedialog.cpp +kvi_channel.cpp +kvi_input_history.cpp +kvi_msgbox.cpp +kvi_selectors.cpp +kvi_toolbar.cpp +kvi_toolwindows_container.cpp +kvi_modeeditor.cpp +kvi_debugwindow.cpp +kvi_ctcppagedialog.cpp +kvi_maskeditor.cpp +kvi_cryptcontroller.cpp +kvi_texticonwin.cpp +kvi_colorwin.cpp +kvi_input_editor.cpp +kvi_customtoolbar.cpp +kvi_ircview.cpp +kvi_themedlabel.cpp +kvi_userlistview.cpp +kvi_modew.cpp +kvi_irctoolbar.cpp +kvi_window.cpp +kvi_htmldialog.cpp +kvi_statusbarapplet.cpp +kvi_ircview_events.cpp +kvi_input.cpp +kvi_console.cpp +kvi_ircview_loghandling.cpp +kvi_windowlist_tree.cpp +kvi_scriptbutton.cpp +kvi_optionswidget.cpp +kvi_menubar.cpp +kvi_dynamictooltip.cpp +kvi_historywin.cpp +kvi_statusbar.cpp +kvi_mdichild.cpp +kvi_ircviewtools.cpp +kvi_ipeditor.cpp +kvi_imagedialog.cpp +kvi_query.cpp + +kvirc/kvs: +kvi_kvs_object_class.h +kvi_kvs_object_functionhandlerimpl.h +kvi_kvs_object_functionhandler.h +kvi_kvs_action.h +kvi_kvs_treenode_variable.h +kvi_kvs_scriptaddonmanager.h +kvi_kvs_variant.h +kvi_kvs_treenode_parameterreturn.h +kvi_kvs_timermanager.h +kvi_kvs_object.h +kvi_kvs_types.h +kvi_kvs_treenode_thisobjectfunctioncall.h +kvi_kvs_switchlist.h +kvi_kvs_treenode_specialcommandforeach.h +kvi_kvs_popupmenu.h +kvi_kvs_coresimplecommands.h +kvi_kvs_treenode_specialcommanddefpopup.h +kvi_kvs_rwevaluationresult.h +kvi_kvs.h +kvi_kvs_object_functioncall.h +kvi_kvs_treenode_arraycount.h +kvi_kvs_treenode_extendedscopevariable.h +kvi_kvs_runtimecall.h +kvi_kvs_hash.h +kvi_kvs_kernel.h +kvi_kvs_array.h +kvi_kvs_treenode_baseobjectfunctioncall.h +kvi_kvs_corefunctions.h +kvi_kvs_corecallbackcommands.h +kvi_kvs_treenode_specialcommand.h +kvi_kvs_arraycast.h +kvi_kvs_treenode_base.h +kvi_kvs_treenode_specialcommandunset.h +kvi_kvs_object_controller.h +kvi_kvs_callbackobject.h +kvi_kvs_treenode_simplecommand.h +kvi_kvs_treenode_data.h +kvi_kvs_treenode_aliasfunctioncall.h +kvi_kvs_treenode_commandwithparameters.h +kvi_kvs_treenode_voidfunctioncall.h +kvi_kvs_treenode_specialcommanddo.h +kvi_kvs_treenode_specialcommandif.h +kvi_kvs_treenode_command.h +kvi_kvs_treenode_switchlist.h +kvi_kvs_treenode_objectfield.h +kvi_kvs_treenode_globalvariable.h +kvi_kvs_eventtriggers.h +kvi_kvs_treenode_corefunctioncall.h +kvi_kvs_treenode_rebindingswitch.h +kvi_kvs_useraction.h +kvi_kvs_treenode_stringcast.h +kvi_kvs_treenode_compositedata.h +kvi_kvs_treenode_specialcommandfor.h +kvi_kvs_dnsmanager.h +kvi_kvs_report.h +kvi_kvs_eventmanager.h +kvi_kvs_treenode_instruction.h +kvi_kvs_treenode_specialcommandwhile.h +kvi_kvs_treenode_hashreferenceassert.h +kvi_kvs_parameterprocessor.h +kvi_kvs_popupmanager.h +kvi_kvs_treenode_arrayorhashelement.h +kvi_kvs_treenode_constantdata.h +kvi_kvs_treenode_operation.h +kvi_kvs_treenode_specialcommandbreak.h +kvi_kvs_treenode_localvariable.h +kvi_kvs_treenode_indirectdata.h +kvi_kvs_asyncoperation.h +kvi_kvs_treenode_corecallbackcommand.h +kvi_kvs_treenode_aliassimplecommand.h +kvi_kvs_treenode_datalist.h +kvi_kvs_treenode_specialcommandclass.h +kvi_kvs_treenode.h +kvi_kvs_treenode_coresimplecommand.h +kvi_kvs_treenode_expression.h +kvi_kvs_eventtable.h +kvi_kvs_treenode_multipleparameteridentifier.h +kvi_kvs_treenode_modulesimplecommand.h +kvi_kvs_treenode_instructionblock.h +kvi_kvs_eventhandler.h +kvi_kvs_treenode_modulefunctioncall.h +kvi_kvs_treenode_arrayelement.h +kvi_kvs_treenode_commandevaluation.h +kvi_kvs_parser.h +kvi_kvs_treenode_functioncall.h +kvi_kvs_aliasmanager.h +kvi_kvs_parser_macros.h +kvi_kvs_treenode_objectfunctioncall.h +kvi_kvs_treenode_singleparameteridentifier.h +kvi_kvs_treenode_modulecallbackcommand.h +kvi_kvs_treenode_scopeoperator.h +kvi_kvs_runtimecontext.h +kvi_kvs_treenode_hashcount.h +kvi_kvs_script.h +kvi_kvs_treenode_specialcommandcontinue.h +kvi_kvs_treenode_arrayreferenceassert.h +kvi_kvs_asyncdnsoperation.h +kvi_kvs_event.h +kvi_kvs_treenode_expressionreturn.h +kvi_kvs_variantlist.h +kvi_kvs_moduleinterface.h +kvi_kvs_processmanager.h +kvi_kvs_treenode_specialcommandswitch.h +kvi_kvs_treenode_callbackcommand.h +kvi_kvs_treenode_hashelement.h +kvi_kvs_treenode_hashcount.cpp +kvi_kvs_treenode_commandevaluation.cpp +kvi_kvs_eventtable.cpp +kvi_kvs_dnsmanager.cpp +kvi_kvs_object.cpp +kvi_kvs_treenode_corecallbackcommand.cpp +kvi_kvs_parser_command.cpp +kvi_kvs_coresimplecommands_gl.cpp +kvi_kvs_treenode_thisobjectfunctioncall.cpp +kvi_kvs_scriptaddonmanager.cpp +kvi_kvs_treenode_specialcommandforeach.cpp +kvi_kvs_popupmanager.cpp +kvi_kvs_variantlist.cpp +kvi_kvs_parser_lside.cpp +kvi_kvs_asyncdnsoperation.cpp +kvi_kvs_event.cpp +kvi_kvs_coresimplecommands_mr.cpp +kvi_kvs_corecallbackcommands.cpp +kvi_kvs_eventmanager.cpp +kvi_kvs_treenode_expressionreturn.cpp +kvi_kvs_treenode_specialcommandfor.cpp +kvi_kvs_moduleinterface.cpp +kvi_kvs_treenode_corefunctioncall.cpp +kvi_kvs_treenode_parameterreturn.cpp +kvi_kvs_treenode_callbackcommand.cpp +kvi_kvs_array.cpp +kvi_kvs_parser_expression.cpp +kvi_kvs_coresimplecommands_sz.cpp +kvi_kvs_treenode_coresimplecommand.cpp +kvi_kvs_treenode_constantdata.cpp +kvi_kvs_treenode_rebindingswitch.cpp +kvi_kvs_object_functioncall.cpp +kvi_kvs_treenode_scopeoperator.cpp +kvi_kvs_runtimecall.cpp +kvi_kvs_treenode_arrayreferenceassert.cpp +kvi_kvs_script.cpp +kvi_kvs_treenode_functioncall.cpp +kvi_kvs_treenode_expression.cpp +kvi_kvs_runtimecontext.cpp +kvi_kvs_callbackobject.cpp +kvi_kvs_asyncoperation.cpp +kvi_kvs_treenode_hashelement.cpp +kvi_kvs_treenode_specialcommandunset.cpp +kvi_kvs_treenode_hashreferenceassert.cpp +kvi_kvs_object_functionhandler.cpp +kvi_kvs_treenode_aliassimplecommand.cpp +kvi_kvs_treenode_objectfunctioncall.cpp +kvi_kvs_aliasmanager.cpp +kvi_kvs_treenode_extendedscopevariable.cpp +kvi_kvs_treenode_specialcommandclass.cpp +kvi_kvs_treenode_specialcommand.cpp +kvi_kvs_rwevaluationresult.cpp +kvi_kvs_treenode_switchlist.cpp +kvi_kvs_treenode_modulesimplecommand.cpp +kvi_kvs_treenode_instruction.cpp +kvi_kvs_treenode_objectfield.cpp +kvi_kvs_popupmenu.cpp +kvi_kvs_treenode_modulefunctioncall.cpp +kvi_kvs_timermanager.cpp +kvi_kvs_treenode_operation.cpp +kvi_kvs_parser_dollar.cpp +kvi_kvs_treenode_specialcommandwhile.cpp +kvi_kvs_treenode_specialcommandswitch.cpp +kvi_kvs_treenode_specialcommanddo.cpp +kvi_kvs_treenode_simplecommand.cpp +kvi_kvs_treenode_specialcommandif.cpp +kvi_kvs_parameterprocessor.cpp +kvi_kvs_treenode_variable.cpp +kvi_kvs_treenode_specialcommandcontinue.cpp +kvi_kvs_treenode_globalvariable.cpp +kvi_kvs_corefunctions_af.cpp +kvi_kvs_parser_comment.cpp +kvi_kvs_treenode_commandwithparameters.cpp +kvi_kvs_treenode_aliasfunctioncall.cpp +kvi_kvs_treenode_base.cpp +kvi_kvs_switchlist.cpp +kvi_kvs_treenode_arrayelement.cpp +kvi_kvs_arraycast.cpp +kvi_kvs_useraction.cpp +kvi_kvs_object_functionhandlerimpl.cpp +kvi_kvs_corefunctions_gl.cpp +kvi_kvs_coresimplecommands.cpp +kvi_kvs_parser_specialcommands.cpp +kvi_kvs_parser.cpp +kvi_kvs.cpp +kvi_kvs_treenode_datalist.cpp +kvi_kvs_treenode_stringcast.cpp +kvi_kvs_processmanager.cpp +kvi_kvs_treenode_arraycount.cpp +kvi_kvs_treenode_indirectdata.cpp +kvi_kvs_treenode_command.cpp +kvi_kvs_corefunctions_mr.cpp +kvi_kvs_treenode_arrayorhashelement.cpp +kvi_kvs_variant.cpp +kvi_kvs_treenode_voidfunctioncall.cpp +kvi_kvs_treenode_singleparameteridentifier.cpp +kvi_kvs_treenode_specialcommandbreak.cpp +kvi_kvs_treenode_baseobjectfunctioncall.cpp +kvi_kvs_treenode_data.cpp +kvi_kvs_treenode_localvariable.cpp +kvi_kvs_treenode_compositedata.cpp +kvi_kvs_treenode_instructionblock.cpp +kvi_kvs_report.cpp +kvi_kvs_corefunctions_sz.cpp +kvi_kvs_object_controller.cpp +kvi_kvs_action.cpp +kvi_kvs_hash.cpp +kvi_kvs_object_class.cpp +kvi_kvs_kernel.cpp +kvi_kvs_corefunctions.cpp +kvi_kvs_coresimplecommands_af.cpp +kvi_kvs_treenode_multipleparameteridentifier.cpp +kvi_kvs_treenode_modulecallbackcommand.cpp +kvi_kvs_eventhandler.cpp +kvi_kvs_treenode_specialcommanddefpopup.cpp + +kvirc/sparser: +kvi_numeric.h +kvi_antispam.h +kvi_sparser.h +kvi_ircmessage.h +kvi_sp_ctcp.cpp +kvi_sparser.cpp +kvi_sp_literal.cpp +kvi_ircmessage.cpp +kvi_antispam.cpp +kvi_sp_numeric.cpp +kvi_sp_tables.cpp + +kvirc/kernel: +kvi_iconmanager.h +kvi_ircconnectionstatedata.h +kvi_irccontext.h +kvi_coreactions.h +kvi_irclink.h +kvi_app.h +kvi_ipc.h +kvi_out.h +kvi_lagmeter.h +kvi_ircurl.h +kvi_ircconnectiontargetresolver.h +kvi_ircconnectionnetsplitdetectordata.h +kvi_actionmanager.h +kvi_userinput.h +kvi_ircconnection.h +kvi_customtoolbardescriptor.h +kvi_coreactionnames.h +kvi_notifylist.h +kvi_ircconnectiontarget.h +kvi_action.h +kvi_customtoolbarmanager.h +kvi_internalcmd.h +kvi_ircsocket.h +kvi_ircconnectionuserinfo.h +kvi_ircconnectionasyncwhoisdata.h +kvi_ircconnectionserverinfo.h +kvi_sslmaster.h +kvi_texticonmanager.h +kvi_ircconnectionantictcpflooddata.h +kvi_ircconnectionstatistics.h +kvi_options.h +kvi_useraction.h +kvi_theme.h +kvi_ircdatastreammonitor.h +kvi_filetransfer.h +kvi_asynchronousconnectiondata.h +kvirc/module/kvi_mextoolbar.h +kvirc/module/kvi_module.h +kvirc/module/kvi_mexserverimport.h +kvirc/module/kvi_modulemanager.h +kvirc/module/kvi_moduleextension.h +kvirc/module/kvi_mexlinkfilter.h +kvi_ircconnection.cpp +kvi_ircconnectionstatedata.cpp +kvi_ircdatastreammonitor.cpp +kvi_action.cpp +kvi_useraction.cpp +kvi_ircconnectionnetsplitdetectordata.cpp +kvi_asynchronousconnectiondata.cpp +kvi_filetransfer.cpp +kvi_customtoolbardescriptor.cpp +kvi_ircurl.cpp +kvi_app.cpp +kvi_sslmaster.cpp +kvi_ircconnectionuserinfo.cpp +kvi_irccontext.cpp +kvi_main.cpp +kvi_ircconnectiontarget.cpp +kvi_ipc.cpp +kvi_options.cpp +kvi_ircconnectionasyncwhoisdata.cpp +kvi_texticonmanager.cpp +kvi_actionmanager.cpp +kvi_customtoolbarmanager.cpp +kvi_lagmeter.cpp +kvi_ircconnectiontargetresolver.cpp +kvi_ircconnectionserverinfo.cpp +kvi_app_fs.cpp +kvi_irclink.cpp +kvi_ircsocket.cpp +kvi_ircconnectionantictcpflooddata.cpp +kvi_theme.cpp +kvi_internalcmd.cpp +kvi_coreactions.cpp +kvi_ircconnectionstatistics.cpp +kvi_app_setup.cpp +kvi_notifylist.cpp +kvi_userinput.cpp +kvi_iconmanager.cpp +kvirc/module/kvi_mextoolbar.cpp +kvirc/module/kvi_moduleextension.cpp +kvirc/module/kvi_mexlinkfilter.cpp +kvirc/module/kvi_modulemanager.cpp +kvirc/module/kvi_mexserverimport.cpp +kvirc/module/kvi_module.cpp + +modules: +about/aboutdialog.h +about/libkviabout.h +about/libkviabout.cpp +about/aboutdialog.cpp +action/libkviaction.cpp +actioneditor/actioneditor.h +actioneditor/libkviactioneditor.cpp +actioneditor/actioneditor.cpp +addon/managementdialog.h +addon/addonfunctions.h +addon/packaddondialog.h +addon/managementdialog.cpp +addon/addonfunctions.cpp +addon/libkviaddon.cpp +addon/packaddondialog.cpp +aliaseditor/aliaseditor.h +aliaseditor/libkvialiaseditor.cpp +aliaseditor/aliaseditor.cpp +avatar/libkviavatar.h +avatar/libkviavatar.cpp +chan/libkvichan.cpp +channelsjoin/channelsjoinwindow.h +channelsjoin/libkvichannelsjoin.cpp +channelsjoin/channelsjoinwindow.cpp +codetester/codetester.h +codetester/codetester.cpp +codetester/libkvicodetester.cpp +config/libkviconfig.cpp +context/libkvicontext.cpp +dcc/codec.h +dcc/canvaswidget.h +dcc/marshal.h +dcc/broker.h +dcc/descriptor.h +dcc/dialogs.h +dcc/chat.h +dcc/canvas.h +dcc/adpcmcodec.h +dcc/window.h +dcc/send.h +dcc/video.h +dcc/utils.h +dcc/thread.h +dcc/voice.h +dcc/gsmcodec.h +dcc/video.cpp +dcc/descriptor.cpp +dcc/broker.cpp +dcc/chat.cpp +dcc/voice.cpp +dcc/adpcmcodec.cpp +dcc/libkvidcc.cpp +dcc/gsmcodec.cpp +dcc/marshal.cpp +dcc/send.cpp +dcc/canvas.cpp +dcc/canvaswidget.cpp +dcc/codec.cpp +dcc/window.cpp +dcc/requests.cpp +dcc/dialogs.cpp +dcc/thread.cpp +dcc/utils.cpp +dialog/libkvidialog.h +dialog/libkvidialog.cpp +editor/scripteditor.h +editor/libkvieditor.cpp +editor/scripteditor.cpp +eventeditor/eventeditor.h +eventeditor/libkvieventeditor.cpp +eventeditor/eventeditor.cpp +file/libkvifile.cpp +filetransferwindow/filetransferwindow.h +filetransferwindow/filetransferwindow.cpp +filetransferwindow/libkvifiletransferwindow.cpp +help/helpwidget.h +help/helpwindow.h +help/index.h +help/helpwidget.cpp +help/libkvihelp.cpp +help/index.cpp +help/helpwindow.cpp +http/httpfiletransfer.h +http/libkvihttp.cpp +http/httpfiletransfer.cpp +ident/libkviident.h +ident/libkviident.cpp +iograph/libkviiograph.h +iograph/libkviiograph.cpp +lamerizer/libkvilamerizer.h +lamerizer/libkvilamerizer.cpp +language/detector.h +language/detector.cpp +language/libkvilanguage.cpp +links/linkswindow.h +links/libkvilinks.cpp +links/linkswindow.cpp +list/listwindow.h +list/listwindow.cpp +list/libkvilist.cpp +log/libkvilog.cpp +logview/logviewwidget.h +logview/logviewmdiwindow.h +logview/libkvilogview.cpp +logview/logviewmdiwindow.cpp +logview/logviewwidget.cpp +mask/libkvimask.cpp +math/libkvimath.cpp +mediaplayer/mp_xmmsinterface.h +mediaplayer/mp_winampinterface.h +mediaplayer/mp_amipinterface.h +mediaplayer/mp_mp3.h +mediaplayer/mp_mprisinterface.h +mediaplayer/mp_interface.h +mediaplayer/mp_mprisinterface.cpp +mediaplayer/mp_winampinterface.cpp +mediaplayer/winamp.cpp +mediaplayer/mp_interface.cpp +mediaplayer/mp_mp3.cpp +mediaplayer/mp_xmmsinterface.cpp +mediaplayer/mp_amipinterface.cpp +mediaplayer/libkvimediaplayer.cpp +mircimport/libkvimircimport.h +mircimport/libkvimircimport.cpp +my/idle.h +my/idle_x11.cpp +my/idle_mac.cpp +my/idle.cpp +my/libkvimy.cpp +my/idle_win.cpp +notifier/notifiermessage.h +notifier/notifierwindowtab.h +notifier/notifiersettings.h +notifier/notifierwindowborder.h +notifier/notifierwindow.h +notifier/notifierwindow.cpp +notifier/notifiermessage.cpp +notifier/notifierwindowtab.cpp +notifier/libkvinotifier.cpp +notifier/notifierwindowborder.cpp +objects/class_toolbar.h +objects/class_file.h +objects/class_datetimeedit.h +objects/class_hbox.h +objects/class_http.h +objects/class_treewidget.h +objects/class_list.h +objects/class_widget.h +objects/class_workspace.h +objects/class_label.h +objects/class_pixmap.h +objects/class_combobox.h +objects/class_slider.h +objects/class_vbox.h +objects/class_tbrowser.h +objects/class_window.h +objects/class_tablewidget.h +objects/class_spinbox.h +objects/class_progressbar.h +objects/class_memorybuffer.h +objects/class_wizard.h +objects/class_listwidget.h +objects/class_popupmenu.h +objects/class_button.h +objects/class_process.h +objects/class_radiobutton.h +objects/class_painter.h +objects/class_checkbox.h +objects/class_layout.h +objects/class_socket.h +objects/class_wrapper.h +objects/class_dialog.h +objects/class_mainwindow.h +objects/class_ftp.h +objects/class_lcd.h +objects/class_sql.h +objects/class_multilineedit.h +objects/class_dockwindow.h +objects/class_toolbutton.h +objects/class_treewidgetitem.h +objects/class_tabwidget.h +objects/class_menubar.h +objects/class_xmlreader.h +objects/class_buttongroup.h +objects/class_lineedit.h +objects/object_macros.h +objects/class_groupbox.h +objects/class_lineedit.cpp +objects/class_mainwindow.cpp +objects/class_label.cpp +objects/class_toolbar.cpp +objects/class_painter.cpp +objects/class_widget.cpp +objects/class_multilineedit.cpp +objects/class_popupmenu.cpp +objects/class_pixmap.cpp +objects/class_hbox.cpp +objects/class_combobox.cpp +objects/class_lcd.cpp +objects/class_process.cpp +objects/class_checkbox.cpp +objects/class_datetimeedit.cpp +objects/class_toolbutton.cpp +objects/class_dialog.cpp +objects/class_slider.cpp +objects/class_treewidget.cpp +objects/class_tablewidget.cpp +objects/class_button.cpp +objects/class_sql.cpp +objects/class_listwidget.cpp +objects/class_menubar.cpp +objects/class_socket.cpp +objects/class_ftp.cpp +objects/class_wizard.cpp +objects/class_spinbox.cpp +objects/class_xmlreader.cpp +objects/class_tabwidget.cpp +objects/class_list.cpp +objects/class_vbox.cpp +objects/class_workspace.cpp +objects/class_wrapper.cpp +objects/class_layout.cpp +objects/class_progressbar.cpp +objects/class_window.cpp +objects/class_treewidgetitem.cpp +objects/class_groupbox.cpp +objects/class_buttongroup.cpp +objects/class_radiobutton.cpp +objects/class_http.cpp +objects/class_tbrowser.cpp +objects/class_dockwindow.cpp +objects/libkviobjects.cpp +objects/class_memorybuffer.cpp +objects/class_file.cpp +options/dialog.h +options/optw_away.h +options/optw_ctcp.h +options/optw_dcc.h +options/optw_irc.h +options/optw_lag.h +options/optw_nickserv.h +options/optw_textencoding.h +options/instances.h +options/optw_notify.h +options/optw_messages.h +options/optw_avatar.h +options/optw_sound.h +options/optw_urlhandlers.h +options/optw_windowlist.h +options/optw_tray.h +options/optw_notifier.h +options/optw_tools.h +options/optw_generalopt.h +options/optw_interfacefeatures.h +options/optw_texticons.h +options/optw_ircview.h +options/optw_mediatypes.h +options/optw_interfacelookglobal.h +options/optw_servers.h +options/optw_channel.h +options/optw_protection.h +options/optw_identity.h +options/optw_antispam.h +options/optw_ircoutput.h +options/optw_logging.h +options/optw_input.h +options/optw_proxy.h +options/optw_highlighting.h +options/optw_ctcpfloodprotection.h +options/optw_userlist.h +options/optw_topiclabel.h +options/optw_uparser.h +options/optw_connection.h +options/optw_ignore.h +options/optw_query.h +options/container.h +options/optw_ircview.cpp +options/optw_nickserv.cpp +options/optw_topiclabel.cpp +options/optw_tray.cpp +options/optw_protection.cpp +options/optw_ctcp.cpp +options/optw_servers.cpp +options/optw_uparser.cpp +options/optw_notifier.cpp +options/optw_identity.cpp +options/optw_query.cpp +options/optw_interfacelookglobal.cpp +options/optw_avatar.cpp +options/optw_notify.cpp +options/optw_away.cpp +options/libkvioptions.cpp +options/optw_urlhandlers.cpp +options/optw_proxy.cpp +options/optw_mediatypes.cpp +options/optw_userlist.cpp +options/optw_ctcpfloodprotection.cpp +options/dialog.cpp +options/optw_texticons.cpp +options/optw_highlighting.cpp +options/optw_ircoutput.cpp +options/optw_interfacefeatures.cpp +options/container.cpp +options/optw_windowlist.cpp +options/optw_tools.cpp +options/optw_connection.cpp +options/optw_generalopt.cpp +options/optw_logging.cpp +options/optw_channel.cpp +options/optw_irc.cpp +options/optw_textencoding.cpp +options/optw_antispam.cpp +options/instances.cpp +options/optw_dcc.cpp +options/optw_ignore.cpp +options/optw_sound.cpp +options/optw_input.cpp +options/optw_messages.cpp +options/optw_lag.cpp +perl/libkviperl.cpp +perlcore/ppport.h +perlcore/perlcoreinterface.h +perlcore/libkviperlcore.cpp +popupeditor/popupeditor.h +popupeditor/libkvipopupeditor.cpp +popupeditor/popupeditor.cpp +proxydb/libkviproxydb.cpp +python/libkvipython.cpp +pythoncore/kvircmodule.h +pythoncore/pythoncoreinterface.h +pythoncore/libkvipythoncore.cpp +pythoncore/kvircmodule.cpp +raweditor/raweditor.h +raweditor/libkviraweditor.cpp +raweditor/raweditor.cpp +regchan/libkviregchan.cpp +reguser/dialog.h +reguser/wizard.h +reguser/edituser.h +reguser/edituser.cpp +reguser/dialog.cpp +reguser/wizard.cpp +reguser/libkvireguser.cpp +rijndael/libkvirijndael.h +rijndael/ablowfish.h +rijndael/rijndael.h +rijndael/libkvirijndael_cryptopp.h +rijndael/libkvirijndael.cpp +rijndael/rijndael.cpp +rijndael/libkvirijndael_cryptopp.cpp +rijndael/ablowfish.cpp +rot13/libkvirot13.h +rot13/libkvirot13.cpp +serverdb/libkviserverdb.cpp +setup/setupwizard.h +setup/libkvisetup.cpp +setup/setupwizard.cpp +sharedfile/libkvisharedfile.cpp +sharedfileswindow/sharedfileswindow.h +sharedfileswindow/libkvisharedfileswindow.cpp +sharedfileswindow/sharedfileswindow.cpp +snd/libkvisnd.h +snd/libkvisnd.cpp +socketspy/socketspywindow.h +socketspy/libkvisocketspy.cpp +socketspy/socketspywindow.cpp +spaste/libkvispaste.h +spaste/controller.h +spaste/libkvispaste.cpp +spaste/controller.cpp +str/libkvistr.cpp +system/plugin.h +system/plugin.cpp +system/libkvisystem.cpp +term/termwindow.h +term/termwidget.h +term/termwindow.cpp +term/libkviterm.cpp +term/termwidget.cpp +texticons/libkvitexticons.cpp +theme/packthemedialog.h +theme/managementdialog.h +theme/savethemedialog.h +theme/themefunctions.h +theme/themefunctions.cpp +theme/packthemedialog.cpp +theme/libkvitheme.cpp +theme/managementdialog.cpp +theme/savethemedialog.cpp +tip/libkvitip.h +tip/libkvitip.cpp +tmphighlight/libkvitmphighlight.cpp +toolbar/libkvitoolbar.cpp +toolbareditor/toolbareditor.h +toolbareditor/libkvitoolbareditor.cpp +toolbareditor/toolbareditor.cpp +torrent/tc_statusbarapplet.h +torrent/tc_ktorrentdbusinterface.h +torrent/tc_interface.h +torrent/tc_interface.cpp +torrent/tc_statusbarapplet.cpp +torrent/libkvitorrent.cpp +torrent/tc_ktorrentdbusinterface.cpp +trayicon/libkvitrayicon.h +trayicon/libkvitrayicon.cpp +upnp/ssdpconnection.h +upnp/wanconnectionservice.h +upnp/service.h +upnp/igdcontrolpoint.h +upnp/xmlfunctions.h +upnp/manager.h +upnp/rootservice.h +upnp/wanconnectionservice.cpp +upnp/xmlfunctions.cpp +upnp/manager.cpp +upnp/ssdpconnection.cpp +upnp/igdcontrolpoint.cpp +upnp/rootservice.cpp +upnp/service.cpp +upnp/libkviupnp.cpp +url/icons.h +url/libkviurl.h +url/libkviurl.cpp +window/userwindow.h +window/userwindow.cpp +window/libkviwindow.cpp diff --git a/doc/INSTALL b/doc/INSTALL index c8ecde745..286d45d07 100644 --- a/doc/INSTALL +++ b/doc/INSTALL @@ -78,7 +78,7 @@ General notes for the installation of the 4.0 release of KVIrc On my system the output is: QMake version 2.01a - Using Qt version 4.5.1 in /usr/lib64/qt/lib + Using Qt version 4.5.3 in /usr/lib64/qt/lib If you have multiple versions of qt4 installed in your system and you want to use a specific version, exporting QTDIR won't suffice. Since the CMake module searching for Qt4 uses qmake itself to determine @@ -104,7 +104,7 @@ General notes for the installation of the 4.0 release of KVIrc On my system the ouput is: - # cmake version 2.6-patch 2 + # cmake version 2.6-patch 4 # @@ -243,15 +243,12 @@ General notes for the installation of the 4.0 release of KVIrc complains about it. Some system have the interface builtin in libc. The configure script can detect it. - # - # WITH_NO_EMBEDDED_CODE (Optional) - # - If you want to build with no (or at least less) embedded copies of code or - reimplementations of code which can be found in widely tested libraries, - you need to install the following libraries (for building you also need the - corresponding headers): - - Crypto++ 5.6 <http://cryptopp.com/> + - (Optional) If you want to build with no (or at least less) embedded copies + of code or reimplementations of code which can be found in widely tested + libraries, you need to install the following libraries (for building you also + need the corresponding headers): + - Crypto++ 5.6 <http://cryptopp.com/> ############################################################################### # 3. Configuring the environment @@ -312,8 +309,9 @@ General notes for the installation of the 4.0 release of KVIrc KVIrc versions can cohexist in the same system. -DUSE_ENV_FLAGS - Kvirc install rules won't try to figure out and set CMAKE_C(XX)_FLAGS; instead, it will let CMake use - the ones from environment variables. Activating this flag will override -DDEBUG. + Kvirc install rules won't try to figure out and set CMAKE_C(XX)_FLAGS; instead, it + will let CMake use the ones from environment variables. Activating this flag will + override -DDEBUG. -DCMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT It will re-initialize the installation path to a good default. @@ -330,7 +328,8 @@ General notes for the installation of the 4.0 release of KVIrc Disable Phonon audio backend support. -DWITHOUT_OSS - Disable Oss audio backend support. This automatically disables Audiofile support, too. + Disable Oss audio backend support. This automatically disables Audiofile support, + too. -DWITHOUT_AUDIOFILE Disable Audiofile audio backend support. diff --git a/src/kvilib/core/kvi_pointerhashtable.h b/src/kvilib/core/kvi_pointerhashtable.h index 61c5bd0bd..4d30257d9 100644 --- a/src/kvilib/core/kvi_pointerhashtable.h +++ b/src/kvilib/core/kvi_pointerhashtable.h @@ -277,7 +277,7 @@ inline void kvi_hash_key_destroy(QString &,bool) inline const QString & kvi_hash_key_default(QString *) { - return KviQString::empty; + return KviQString::Empty; } template<typename Key,typename T> class KviPointerHashTable; diff --git a/src/kvilib/core/kvi_qstring.cpp b/src/kvilib/core/kvi_qstring.cpp index 84e52bd6d..631d329bd 100644 --- a/src/kvilib/core/kvi_qstring.cpp +++ b/src/kvilib/core/kvi_qstring.cpp @@ -47,530 +47,767 @@ extern unsigned char iso88591_toUpper_map[256]; namespace KviQString { // The global empty (and null) string - const QString empty; + const QString Empty; + + static char cHexDigits[16] = { '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f' }; - bool equalCSN(const QString &sz1,const QString &sz2,unsigned int len) + bool equalCSN(const QString & sz1, const QString & sz2, unsigned int uLen) { - if(len == 0)return true; // assume equal - const QChar * c1 = sz1.unicode(); - const QChar * c2 = sz2.unicode(); - unsigned int lmin = MY_MIN(sz1.length(),sz2.length()); - if(lmin < len)return false; - const QChar * c1e = c1 + len; + if(uLen == 0) + { + // assume equal + return true; + } + const QChar * pC1 = sz1.unicode(); + const QChar * pC2 = sz2.unicode(); + unsigned int uLMin = MY_MIN(sz1.length(),sz2.length()); + if(uLMin < uLen) + { + return false; + } + const QChar * pC1e = pC1 + uLen; - if(!c1 || !c2)return (c1 == c2); + if(!pC1 || !pC2) + { + return (pC1 == pC2); + } - while(c1 < c1e) + while(pC1 < pC1e) { - if(c1->unicode() != c2->unicode())return false; - c1++; - c2++; + if(pC1->unicode() != pC2->unicode()) + { + return false; + } + pC1++; + pC2++; } - return (c1 == c1e); + return (pC1 == pC1e); } - bool equalCIN(const QString &sz1,const QString &sz2,unsigned int len) + bool equalCIN(const QString & sz1, const QString & sz2, unsigned int uLen) { - if(len == 0)return true; // assume equal - const QChar * c1 = sz1.unicode(); - const QChar * c2 = sz2.unicode(); - unsigned int lmin = MY_MIN(sz1.length(),sz2.length()); - if(lmin < len)return false; - const QChar * c1e = c1 + len; + if(uLen == 0) + { + // assume equal + return true; + } + const QChar * pC1 = sz1.unicode(); + const QChar * pC2 = sz2.unicode(); + unsigned int uLMin = MY_MIN(sz1.length(),sz2.length()); + if(uLMin < uLen) + { + return false; + } + const QChar * pC1e = pC1 + uLen; - if(!c1 || !c2)return (c1 == c2); + if(!pC1 || !pC2) + { + return (pC1 == pC2); + } - while(c1 < c1e) + while(pC1 < pC1e) { - if(c1->toLower().unicode() != c2->toLower().unicode())return false; - c1++; - c2++; + if(pC1->toLower().unicode() != pC2->toLower().unicode()) + { + return false; + } + pC1++; + pC2++; } - return (c1 == c1e); + return (pC1 == pC1e); } - bool equalCSN(const QString &sz1,const char * sz2,unsigned int len) + bool equalCSN(const QString & sz1, const char * pc2, unsigned int uLen) { - if(len == 0)return true; // assume equal - const QChar * c1 = sz1.unicode(); - if((unsigned)sz1.length() < len)return false; - const QChar * c1e = c1 + len; + if(uLen == 0) + { + // assume equal + return true; + } + const QChar * pC1 = sz1.unicode(); + if((unsigned)sz1.length() < uLen) + { + return false; + } + const QChar * pC1e = pC1 + uLen; - if(!sz2)return !c1; - if(!c1)return !sz2; + if(!pc2) + { + return !pC1; + } + if(!pC1) + { + return !pc2; + } - while((c1 < c1e) && (*sz2)) + while((pC1 < pC1e) && (*pc2)) { - if(c1->unicode() != *sz2)return false; - c1++; - sz2++; + if(pC1->unicode() != *pc2) + { + return false; + } + pC1++; + pc2++; } - return (c1 == c1e); + return (pC1 == pC1e); } - bool equalCIN(const QString &sz1,const char * sz2,unsigned int len) + bool equalCIN(const QString & sz1, const char * pc2, unsigned int uLen) { - if(len == 0)return true; // assume equal - const QChar * c1 = sz1.unicode(); - if((unsigned)sz1.length() < len)return false; - const QChar * c1e = c1 + len; + if(uLen == 0) + { + // assume equal + return true; + } + const QChar * pC1 = sz1.unicode(); + if((unsigned)sz1.length() < uLen) + { + return false; + } + const QChar * pC1e = pC1 + uLen; - if(!sz2)return !c1; - if(!c1)return !(*sz2); + if(!pc2) + { + return !pC1; + } + if(!pC1) + { + return !(*pc2); + } - while((c1 < c1e) && (*sz2)) + while((pC1 < pC1e) && (*pc2)) { - if(c1->toLower().unicode() != tolower(*sz2))return false; - c1++; - sz2++; + if(pC1->toLower().unicode() != tolower(*pc2)) + { + return false; + } + pC1++; + pc2++; } - return (c1 == c1e); + return (pC1 == pC1e); } - // sz2 is assumed to be null terminated, sz1 is not! - bool equalCIN(const QString &sz1,const QChar *sz2,unsigned int len) + // pC2 is assumed to be null terminated, sz1 is not! + bool equalCIN(const QString & sz1, const QChar * pC2, unsigned int uLen) { - if(len == 0)return true; // assume equal - const QChar * c1 = sz1.unicode(); - if((unsigned)sz1.length() < len)return false; - const QChar * c1e = c1 + len; + if(uLen == 0) + { + // assume equal + return true; + } + const QChar * pC1 = sz1.unicode(); + if((unsigned)sz1.length() < uLen) + { + return false; + } + const QChar * pC1e = pC1 + uLen; - if(!sz2)return !c1; - if(!c1)return !(sz2->unicode()); + if(!pC2) + { + return !pC1; + } + if(!pC1) + { + return !(pC2->unicode()); + } - while((c1 < c1e) && (sz2->unicode())) + while((pC1 < pC1e) && (pC2->unicode())) { - if(c1->toLower().unicode() != sz2->toLower().unicode())return false; - c1++; - sz2++; + if(pC1->toLower().unicode() != pC2->toLower().unicode()) + { + return false; + } + pC1++; + pC2++; } - return (c1 == c1e); + return (pC1 == pC1e); } QString makeSizeReadable(size_t bytes) { - double size = bytes; - if(size<1024) - return QString(__tr2qs("%1 bytes")).arg(size,0,'f',0); + double dSize = bytes; + if(dSize < 1024) + { + return QString(__tr2qs("%1 bytes")).arg(dSize,0,'f',0); + } - size/=1024; - if(size<1024) - return QString(__tr2qs("%1 KiB")).arg(size,0,'f',3); + dSize /= 1024; + if(dSize < 1024) + { + return QString(__tr2qs("%1 KiB")).arg(dSize,0,'f',3); + } - size/=1024; - if(size<1024) - return QString(__tr2qs("%1 MiB")).arg(size,0,'f',3); + dSize /= 1024; + if(dSize < 1024) + { + return QString(__tr2qs("%1 MiB")).arg(dSize,0,'f',3); + } //Pirated DVD?;) - size/=1024; - if(size<1024) - return QString(__tr2qs("%1 GiB")).arg(size,0,'f',3); + dSize /= 1024; + if(dSize < 1024) + { + return QString(__tr2qs("%1 GiB")).arg(dSize,0,'f',3); + } //Uhm.. We are downloading a whole internet:))) - size/=1024; - return QString(__tr2qs("%1 TiB")).arg(size,0,'f',3); + dSize /= 1024; + return QString(__tr2qs("%1 TiB")).arg(dSize,0,'f',3); } - bool equalCS(const QString &sz1,const QString &sz2) + bool equalCS(const QString & sz1, const QString & sz2) { - if(sz1.length() != sz2.length())return false; + if(sz1.length() != sz2.length()) + { + return false; + } - const QChar * c1 = sz1.unicode(); - const QChar * c2 = sz2.unicode(); - const QChar * c1e = c1 + sz1.length(); + const QChar * pC1 = sz1.unicode(); + const QChar * pC2 = sz2.unicode(); + const QChar * pC1e = pC1 + sz1.length(); - if(!c1 || !c2)return (c1 == c2); + if(!pC1 || !pC2) + { + return (pC1 == pC2); + } - while(c1 < c1e) + while(pC1 < pC1e) { - if(c1->unicode() != c2->unicode())return false; - c1++; - c2++; + if(pC1->unicode() != pC2->unicode()) + { + return false; + } + pC1++; + pC2++; } - return (c1 == c1e); + return (pC1 == pC1e); } - bool equalCI(const QString &sz1,const QString &sz2) + bool equalCI(const QString & sz1, const QString & sz2) { - if(sz1.length() != sz2.length())return false; + if(sz1.length() != sz2.length()) + { + return false; + } - const QChar * c1 = sz1.unicode(); - const QChar * c2 = sz2.unicode(); - const QChar * c1e = c1 + sz1.length(); + const QChar * pC1 = sz1.unicode(); + const QChar * pC2 = sz2.unicode(); + const QChar * pC1e = pC1 + sz1.length(); - if(!c1 || !c2)return (c1 == c2); + if(!pC1 || !pC2) + { + return (pC1 == pC2); + } - while(c1 < c1e) + while(pC1 < pC1e) { - if(c1->toLower().unicode() != c2->toLower().unicode())return false; - c1++; - c2++; + if(pC1->toLower().unicode() != pC2->toLower().unicode()) + { + return false; + } + pC1++; + pC2++; } - return (c1 == c1e); + return (pC1 == pC1e); } // sz2 is assumed to be null terminated, sz1 is not! - bool equalCI(const QString &sz1,const QChar *sz2) + bool equalCI(const QString & sz1, const QChar * pC2) { - const QChar * c1 = sz1.unicode(); - const QChar * c1e = c1 + sz1.length(); + const QChar * pC1 = sz1.unicode(); + const QChar * pC1e = pC1 + sz1.length(); - if(!c1 || !sz2)return (c1 == sz2); + if(!pC1 || !pC2) + { + return (pC1 == pC2); + } - while(c1 < c1e) + while(pC1 < pC1e) { - if(!sz2->unicode())return false; // sz1 has at least another character - if(c1->toLower().unicode() != sz2->toLower().unicode())return false; - c1++; - sz2++; + if(!pC2->unicode()) + { + // sz1 has at least another character + return false; + } + if(pC1->toLower().unicode() != pC2->toLower().unicode()) + { + return false; + } + pC1++; + pC2++; } - return (c1 == c1e) && (!sz2->unicode()); + return (pC1 == pC1e) && (!pC2->unicode()); } - bool equalCS(const QString &sz1,const char * sz2) + bool equalCS(const QString & sz1, const char * pc2) { - const QChar * c1 = sz1.unicode(); - const QChar * c1e = c1 + sz1.length(); + const QChar * pC1 = sz1.unicode(); + const QChar * pC1e = pC1 + sz1.length(); - if(!c1)return !sz2; + if(!pC1) + { + return !pc2; + } - while((c1 < c1e) && (*sz2)) + while((pC1 < pC1e) && (*pc2)) { - if(c1->unicode() != *sz2)return false; - c1++; - sz2++; + if(pC1->unicode() != *pc2) + { + return false; + } + pC1++; + pc2++; } - return ((c1 == c1e) && (*sz2 == '\0')); + return ((pC1 == pC1e) && (*pc2 == '\0')); } - bool equalCI(const QString &sz1,const char * sz2) + bool equalCI(const QString & sz1, const char * pc2) { - const QChar * c1 = sz1.unicode(); - const QChar * c1e = c1 + sz1.length(); + const QChar * pC1 = sz1.unicode(); + const QChar * pC1e = pC1 + sz1.length(); - if(!c1)return !sz2; + if(!pC1) + { + return !pc2; + } - while((c1 < c1e) && (*sz2)) + while((pC1 < pC1e) && (*pc2)) { - if(c1->toLower().unicode() != tolower(*sz2))return false; - c1++; - sz2++; + if(pC1->toLower().unicode() != tolower(*pc2)) + { + return false; + } + pC1++; + pc2++; } - return ((c1 == c1e) && (*sz2 == '\0')); + return ((pC1 == pC1e) && (*pc2 == '\0')); } - int cmpCS(const QString &sz1,const QString &sz2) + int cmpCS(const QString & sz1, const QString & sz2) { - const QChar * c1 = sz1.unicode(); - const QChar * c2 = sz2.unicode(); - const QChar * c1e = c1 + sz1.length(); - const QChar * c2e = c2 + sz2.length(); + const QChar * pC1 = sz1.unicode(); + const QChar * pC2 = sz2.unicode(); + const QChar * pC1e = pC1 + sz1.length(); + const QChar * pC2e = pC2 + sz2.length(); - if(!c1) + if(!pC1) { - if(!c2)return 0; + if(!pC2) + { + return 0; + } return -1; } - if(!c2)return 1; + if(!pC2) + { + return 1; + } for(;;) { - if(c1 >= c1e) + if(pC1 >= pC1e) { - if(c2 < c2e)return /* 0 */ - (c2->unicode()); + if(pC2 < pC2e) + { + return /* 0 */ - (pC2->unicode()); + } return 0; } - if(c2 >= c2e)return c1->unicode() /* - 0 */; + if(pC2 >= pC2e) + { + return pC1->unicode() /* - 0 */; + } - int diff = c1->unicode() - c2->unicode(); - if(diff)return diff; + int iDiff = pC1->unicode() - pC2->unicode(); + if(iDiff) + { + return iDiff; + } - c1++; - c2++; + pC1++; + pC2++; } return 0; // never here } - int cmpCI(const QString &sz1,const QString &sz2,bool nonAlphaGreater) + int cmpCI(const QString & sz1, const QString & sz2, bool bNonAlphaGreater) { - const QChar * c1 = sz1.unicode(); - const QChar * c2 = sz2.unicode(); - const QChar * c1e = c1 + sz1.length(); - const QChar * c2e = c2 + sz2.length(); + const QChar * pC1 = sz1.unicode(); + const QChar * pC2 = sz2.unicode(); + const QChar * pC1e = pC1 + sz1.length(); + const QChar * pC2e = pC2 + sz2.length(); - if(!c1) + if(!pC1) { - if(!c2)return 0; + if(!pC2) + { + return 0; + } return -1; } - if(!c2)return 1; + if(!pC2) + { + return 1; + } for(;;) { - if(nonAlphaGreater) { - if(c1->isLetterOrNumber() && !c2->isLetterOrNumber()) { + if(bNonAlphaGreater) + { + if(pC1->isLetterOrNumber() && !pC2->isLetterOrNumber()) + { return -1; - } else if(!c1->isLetterOrNumber() && c2->isLetterOrNumber()) { + } else if(!pC1->isLetterOrNumber() && pC2->isLetterOrNumber()) + { return 1; } } - if(c1 >= c1e) + if(pC1 >= pC1e) { - if(c2 < c2e)return /* 0 */ - (c2->toLower().unicode()); + if(pC2 < pC2e) + { + return /* 0 */ - (pC2->toLower().unicode()); + } return 0; } - if(c2 >= c2e)return c1->toLower().unicode() /* - 0 */; + if(pC2 >= pC2e) + { + return pC1->toLower().unicode() /* - 0 */; + } - int diff = c1->toLower().unicode() - c2->toLower().unicode(); + int iDiff = pC1->toLower().unicode() - pC2->toLower().unicode(); - if(diff)return diff; + if(iDiff) + { + return iDiff; + } - c1++; - c2++; + pC1++; + pC2++; } return 0; // never here } - int cmpCIN(const QString &sz1,const QString &sz2,unsigned int len) + int cmpCIN(const QString & sz1, const QString & sz2, unsigned int uLen) { - if(len == 0)return 0; // assume equal - unsigned int l1 = MY_MIN(len,(unsigned)sz1.length()); - unsigned int l = MY_MIN(l1,(unsigned)sz2.length()); // FIXME: THIS IS NOT OK + if(uLen == 0) + { + // assume equal + return 0; + } + unsigned int u1 = MY_MIN(uLen,(unsigned)sz1.length()); + unsigned int u2 = MY_MIN(u1,(unsigned)sz2.length()); // FIXME: THIS IS NOT OK - const QChar * c1 = sz1.unicode(); - const QChar * c2 = sz2.unicode(); - const QChar * c1e = c1 + l; + const QChar * pC1 = sz1.unicode(); + const QChar * pC2 = sz2.unicode(); + const QChar * pC1e = pC1 + u2; - if(!c1) + if(!pC1) { - if(!c2)return 0; + if(!pC2) + { + return 0; + } return -1; } - if(!c2)return 1; + if(!pC2) + { + return 1; + } - int diff = 0; + int iDiff = 0; - while((c1 < c1e) && !(diff = (c1->toLower().unicode() - c2->toLower().unicode()))) + while((pC1 < pC1e) && !(iDiff = (pC1->toLower().unicode() - pC2->toLower().unicode()))) { - c1++; - c2++; + pC1++; + pC2++; } - return diff; + return iDiff; } - void ensureLastCharIs(QString &szString,const QChar &c) + void ensureLastCharIs(QString & szSrc, const QChar & c) { - if(!lastCharIs(szString,c))szString.append(c); + if(!lastCharIs(szSrc,c)) + { + szSrc.append(c); + } } - QString getToken(QString &szString,const QChar &sep) + QString getToken(QString & szSrc, const QChar & sep) { - int i=0; - while(i < szString.length()) + int i = 0; + while(i < szSrc.length()) { - if(szString[i] == sep)break; + if(szSrc[i] == sep) + { + break; + } i++; } - QString ret; - if(i == szString.length()) + QString szRet; + if(i == szSrc.length()) { - ret = szString; - szString = ""; + szRet = szSrc; + szSrc = ""; } else { - ret = szString.left(i); - while(i < szString.length()) + szRet = szSrc.left(i); + while(i < szSrc.length()) { - if(szString[i] != sep)break; + if(szSrc[i] != sep) + { + break; + } i++; } - if(i == szString.length())szString = ""; - else szString.remove(0,i); + if(i == szSrc.length()) + { + szSrc = ""; + } else { + szSrc.remove(0,i); + } } - return ret; + return szRet; } - void stripRightWhiteSpace(QString &s) + void stripRightWhiteSpace(QString & szSrc) { int iRemove = 0; - while(iRemove < s.length()) + while(iRemove < szSrc.length()) { - if(s.at(s.length() - (iRemove + 1)).isSpace())iRemove++; - else break; + if(szSrc.at(szSrc.length() - (iRemove + 1)).isSpace()) + { + iRemove++; + } else { + break; + } + } + if(iRemove > 0) + { + szSrc.remove(szSrc.length() - iRemove,iRemove); } - if(iRemove > 0)s.remove(s.length() - iRemove,iRemove); } - void stripRight(QString &s,const QChar &c) + void stripRight(QString & szSrc, const QChar & c) { int iRemove = 0; - while(iRemove < s.length()) + while(iRemove < szSrc.length()) + { + if(szSrc.at(szSrc.length() - (iRemove + 1)) == c) + { + iRemove++; + } else { + break; + } + } + if(iRemove > 0) { - if(s.at(s.length() - (iRemove + 1)) == c)iRemove++; - else break; + szSrc.remove(szSrc.length() - iRemove,iRemove); } - if(iRemove > 0)s.remove(s.length() - iRemove,iRemove); } - - void stripLeft(QString &s,const QChar &c) + + void stripLeft(QString & szSrc, const QChar & c) { int iRemove = 0; - while(iRemove < s.length()) + while(iRemove < szSrc.length()) { - if(s[iRemove] == c) + if(szSrc[iRemove] == c) + { iRemove++; - else + } else { break; + } + } + if(iRemove > 0) + { + szSrc.remove(0,iRemove); } - if(iRemove > 0)s.remove(0,iRemove); } - void detach(QString &sz) + void detach(QString & szSrc) { - sz.resize(sz.length()); + szSrc.resize(szSrc.length()); } - const QChar * nullTerminatedArray(const QString &sz) + const QChar * nullTerminatedArray(const QString & szSrc) { - //sz.resize(sz.length()); // detach! - return sz.constData(); + //szSrc.resize(szSrc.length()); // detach! + return szSrc.constData(); } - void appendNumber(QString &s,double dReal) + void appendNumber(QString & szSrc, double dReal) { - char buffer[512]; - ::sprintf(buffer,"%f",dReal); - s.append(buffer); + char cBuffer[512]; + ::sprintf(cBuffer,"%f",dReal); + szSrc.append(cBuffer); } - void appendNumber(QString &s,int iInteger) + void appendNumber(QString & szSrc, int iInteger) { - char buffer[64]; - ::sprintf(buffer,"%d",iInteger); - s.append(buffer); + char cBuffer[64]; + ::sprintf(cBuffer,"%d",iInteger); + szSrc.append(cBuffer); } - void appendNumber(QString &s,kvi_i64_t iInteger) + void appendNumber(QString & szSrc, kvi_i64_t iInteger) { - char buffer[64]; - ::sprintf(buffer,"%lld", (long long int) iInteger); - s.append(buffer); + char cBuffer[64]; + ::sprintf(cBuffer,"%lld", (long long int)iInteger); + szSrc.append(cBuffer); } - void appendNumber(QString &s,kvi_u64_t uInteger) + void appendNumber(QString & szSrc, kvi_u64_t uInteger) { - char buffer[64]; - ::sprintf(buffer,"%llu", (long long unsigned int) uInteger); - s.append(buffer); + char cBuffer[64]; + ::sprintf(cBuffer,"%llu", (long long unsigned int)uInteger); + szSrc.append(cBuffer); } - void appendNumber(QString &s,unsigned int uInteger) + void appendNumber(QString & szSrc, unsigned int uInteger) { - char buffer[64]; - ::sprintf(buffer,"%u",uInteger); - s.append(buffer); + char cBuffer[64]; + ::sprintf(cBuffer,"%u",uInteger); + szSrc.append(cBuffer); } - void vsprintf(QString &s,const QString &szFmt,kvi_va_list list) + void vsprintf(QString & szSrc, const QString & szFmt, kvi_va_list list) { #define MEMINCREMENT 32 - int reallen = 0; - int allocsize = MEMINCREMENT; + int iRealLen = 0; + int iAllocSize = MEMINCREMENT; - //s.resize(allocsize); + //szSrc.resize(allocsize); - const QChar * fmt = nullTerminatedArray(szFmt); - if(!fmt) + const QChar * pFmt = nullTerminatedArray(szFmt); + if(!pFmt) { - s = QString(); + szSrc = QString(); return; } - QChar * buffer = (QChar *)kvi_malloc(sizeof(QChar) * allocsize); + QChar * pBuffer = (QChar *)kvi_malloc(sizeof(QChar) * iAllocSize); //QChar * p = (QChar *)s.unicode(); - char *argString; - long argValue; - unsigned long argUValue; + char * pcArgString; + long lArgValue; + unsigned long ulArgValue; //9999999999999999999999999999999\0 - char numberBuffer[32]; //enough ? 10 is enough for 32bit unsigned int... - char *pNumBuf; - unsigned int tmp; + char cNumberBuffer[32]; //enough ? 10 is enough for 32bit unsigned int... + char * pcNumBuf; + unsigned int iTmp; - QChar * p = buffer; + QChar * p = pBuffer; #define INCREMENT_MEM \ { \ - allocsize += MEMINCREMENT; \ - buffer = (QChar *)kvi_realloc(buffer,sizeof(QChar) * allocsize); \ - p = buffer + reallen; \ + iAllocSize += MEMINCREMENT; \ + pBuffer = (QChar *)kvi_realloc(pBuffer,sizeof(QChar) * iAllocSize); \ + p = pBuffer + iRealLen; \ } #define INCREMENT_MEM_BY(numchars) \ { \ - allocsize += numchars + MEMINCREMENT; \ - buffer = (QChar *)kvi_realloc(buffer,sizeof(QChar) * allocsize); \ - p = buffer + reallen; \ + iAllocSize += numchars + MEMINCREMENT; \ + pBuffer = (QChar *)kvi_realloc(pBuffer,sizeof(QChar) * iAllocSize); \ + p = pBuffer + iRealLen; \ } - - for(; fmt->unicode() ; ++fmt) + for(; pFmt->unicode() ; ++pFmt) { - if(reallen == allocsize)INCREMENT_MEM + if(iRealLen == iAllocSize)INCREMENT_MEM //copy up to a '%' - if(fmt->unicode() != '%') + if(pFmt->unicode() != '%') { - *p++ = *fmt; - reallen++; + *p++ = *pFmt; + iRealLen++; continue; } - ++fmt; //skip this '%' - switch(fmt->unicode()) + ++pFmt; //skip this '%' + switch(pFmt->unicode()) { case 's': // char * string { - argString = kvi_va_arg(list,char *); - if(!argString)argString = (char*) "[!NULL!]"; - QString str(argString); - if(str.isEmpty())continue; - int len = str.length(); - const QChar * ch = str.unicode(); - if(!ch)continue; - if((allocsize - reallen) < len)INCREMENT_MEM_BY(len) - while(len--)*p++ = *ch++; - reallen += str.length(); + pcArgString = kvi_va_arg(list,char *); + if(!pcArgString) + { + pcArgString = (char*) "[!NULL!]"; + } + QString szStr(pcArgString); + if(szStr.isEmpty()) + { + continue; + } + int iLen = szStr.length(); + const QChar * pCh = szStr.unicode(); + if(!pCh) + { + continue; + } + if((iAllocSize - iRealLen) < iLen) + { + INCREMENT_MEM_BY(iLen) + } + while(iLen--) + { + *p++ = *pCh++; + } + iRealLen += szStr.length(); continue; } case 'S': // KviStr * string { - KviStr * str = kvi_va_arg(list,KviStr *); - if(!str)continue; - if((allocsize - reallen) < str->len())INCREMENT_MEM_BY(str->len()) - argString = str->ptr(); - while(*argString)*p++ = QChar(*argString++); - reallen += str->len(); + KviStr * szStr = kvi_va_arg(list,KviStr *); + if(!szStr) + { + continue; + } + if((iAllocSize - iRealLen) < szStr->len()) + { + INCREMENT_MEM_BY(szStr->len()) + } + pcArgString = szStr->ptr(); + while(*pcArgString) + { + *p++ = QChar(*pcArgString++); + } + iRealLen += szStr->len(); continue; } case 'Q': // QString * string { - QString * str = kvi_va_arg(list,QString *); - if(!str)continue; - if(str->isEmpty())continue; - int len = str->length(); - const QChar * ch = str->unicode(); - if(!ch)continue; - if((allocsize - reallen) < len)INCREMENT_MEM_BY(len) - while(len--)*p++ = *ch++; - reallen += str->length(); + QString * szStr = kvi_va_arg(list,QString *); + if(!szStr) + { + continue; + } + if(szStr->isEmpty()) + { + continue; + } + int iLen = szStr->length(); + const QChar * pCh = szStr->unicode(); + if(!pCh) + { + continue; + } + if((iAllocSize - iRealLen) < iLen) + { + INCREMENT_MEM_BY(iLen) + } + while(iLen--) + { + *p++ = *pCh++; + } + iRealLen += szStr->length(); continue; } case 'c': //char @@ -584,7 +821,7 @@ namespace KviQString // Is this always true ? // *p++ = (char)kvi_va_arg(list,int); - reallen++; + iRealLen++; continue; } case 'q': // QChar * @@ -598,133 +835,159 @@ namespace KviQString // Is this always true ? // *p++ = *((QChar *)kvi_va_arg(list,QChar *)); - reallen++; + iRealLen++; continue; } case 'd': //signed integer { - argValue = kvi_va_arg(list,int); - if(argValue < 0) - { //negative integer + lArgValue = kvi_va_arg(list,int); + if(lArgValue < 0) + { + //negative integer *p++ = '-'; - reallen++; - argValue = -argValue; //need to have it positive - // most negative integer exception (avoid completely senseless (non digit) responses) - if(argValue < 0)argValue = 0; //we get -0 here + iRealLen++; + //need to have it positive. most negative integer exception (avoid completely senseless (non digit) responses) + lArgValue = -lArgValue; + if(lArgValue < 0) + { + //we get -0 here + lArgValue = 0; + } } //write the number in a temporary buffer - pNumBuf = numberBuffer; + pcNumBuf = cNumberBuffer; do { - tmp = argValue / 10; - *pNumBuf++ = argValue - (tmp * 10) + '0'; - } while((argValue = tmp)); + iTmp = lArgValue / 10; + *pcNumBuf++ = lArgValue - (iTmp * 10) + '0'; + } while((lArgValue = iTmp)); //copy now.... - argUValue = pNumBuf - numberBuffer; //length of the number string - if((allocsize - reallen) < (int)argUValue)INCREMENT_MEM_BY(argUValue) - do { *p++ = QChar(*--pNumBuf); } while(pNumBuf != numberBuffer); - reallen += argUValue; + ulArgValue = pcNumBuf - cNumberBuffer; //length of the number string + if((iAllocSize - iRealLen) < (int)ulArgValue) + { + INCREMENT_MEM_BY(ulArgValue) + } + do { + *p++ = QChar(*--pcNumBuf); + } while(pcNumBuf != cNumberBuffer); + iRealLen += ulArgValue; continue; } case 'u': //unsigned integer { - argUValue = kvi_va_arg(list,unsigned int); //many implementations place int here + ulArgValue = kvi_va_arg(list,unsigned int); //many implementations place int here //write the number in a temporary buffer - pNumBuf = numberBuffer; + pcNumBuf = cNumberBuffer; do { - tmp = argUValue / 10; - *pNumBuf++ = argUValue - (tmp * 10) + '0'; - } while((argUValue = tmp)); + iTmp = ulArgValue / 10; + *pcNumBuf++ = ulArgValue - (iTmp * 10) + '0'; + } while((ulArgValue = iTmp)); //copy now.... - argValue = pNumBuf - numberBuffer; //length of the number string - if((allocsize - reallen) < argValue)INCREMENT_MEM_BY(argValue) - do { *p++ = *--pNumBuf; } while(pNumBuf != numberBuffer); - reallen += argValue; + lArgValue = pcNumBuf - cNumberBuffer; //length of the number string + if((iAllocSize - iRealLen) < lArgValue) + { + INCREMENT_MEM_BY(lArgValue) + } + do { + *p++ = *--pcNumBuf; + } while(pcNumBuf != cNumberBuffer); + iRealLen += lArgValue; continue; } case 'h': case 'x': // hexadecimal unsigned integer { - static char hexsmalldigits[]="0123456789abcdef"; - argUValue = kvi_va_arg(list,unsigned int); //many implementations place int here + static char cHexSmallDigits[] = "0123456789abcdef"; + ulArgValue = kvi_va_arg(list,unsigned int); //many implementations place int here //write the number in a temporary buffer - pNumBuf = numberBuffer; + pcNumBuf = cNumberBuffer; do { - tmp = argUValue / 16; - *pNumBuf++ = hexsmalldigits[argUValue - (tmp * 16)]; - } while((argUValue = tmp)); + iTmp = ulArgValue / 16; + *pcNumBuf++ = cHexSmallDigits[ulArgValue - (iTmp * 16)]; + } while((ulArgValue = iTmp)); //copy now.... - argValue = pNumBuf - numberBuffer; //length of the number string - if((allocsize - reallen) < argValue)INCREMENT_MEM_BY(argValue) - do { *p++ = *--pNumBuf; } while(pNumBuf != numberBuffer); - reallen += argValue; + lArgValue = pcNumBuf - cNumberBuffer; //length of the number string + if((iAllocSize - iRealLen) < lArgValue) + { + INCREMENT_MEM_BY(lArgValue) + } + do { + *p++ = *--pcNumBuf; + } while(pcNumBuf != cNumberBuffer); + iRealLen += lArgValue; continue; } case 'H': case 'X': // hexadecimal unsigned integer { - static char hexbigdigits[]="0123456789ABCDEF"; - argUValue = kvi_va_arg(list,unsigned int); //many implementations place int here + static char cHexBigDigits[] = "0123456789ABCDEF"; + ulArgValue = kvi_va_arg(list,unsigned int); //many implementations place int here //write the number in a temporary buffer - pNumBuf = numberBuffer; + pcNumBuf = cNumberBuffer; do { - tmp = argUValue / 16; - *pNumBuf++ = hexbigdigits[argUValue - (tmp * 16)]; - } while((argUValue = tmp)); + iTmp = ulArgValue / 16; + *pcNumBuf++ = cHexBigDigits[ulArgValue - (iTmp * 16)]; + } while((ulArgValue = iTmp)); //copy now.... - argValue = pNumBuf - numberBuffer; //length of the number string - if((allocsize - reallen) < argValue)INCREMENT_MEM_BY(argValue) - do { *p++ = *--pNumBuf; } while(pNumBuf != numberBuffer); - reallen += argValue; + lArgValue = pcNumBuf - cNumberBuffer; //length of the number string + if((iAllocSize - iRealLen) < lArgValue) + { + INCREMENT_MEM_BY(lArgValue) + } + do { + *p++ = *--pcNumBuf; + } while(pcNumBuf != cNumberBuffer); + iRealLen += lArgValue; continue; } - default: //a normal percent followed by some char + default: { + // a normal percent followed by some char *p++ = '%'; //write it - reallen++; - if(fmt->unicode()) + iRealLen++; + if(pFmt->unicode()) { - if(reallen == allocsize)INCREMENT_MEM - *p++ = *fmt; - reallen++; + if(iRealLen == iAllocSize) + { + INCREMENT_MEM + } + *p++ = *pFmt; + iRealLen++; } continue; } } } - s.setUnicode(buffer,reallen); - kvi_free(buffer); - //s.squeeze(); + szSrc.setUnicode(pBuffer,iRealLen); + kvi_free(pBuffer); + //szSrc.squeeze(); } - - QString & sprintf(QString &s,const QString &szFmt,...) + QString & sprintf(QString & szSrc, const QString & szFmt, ...) { kvi_va_list list; kvi_va_start_by_reference(list,szFmt); //print...with max 256 chars - KviQString::vsprintf(s,szFmt,list); + KviQString::vsprintf(szSrc,szFmt,list); kvi_va_end(list); - return s; + return szSrc; } - void appendFormatted(QString &s,const QString &szFmt,...) + void appendFormatted(QString & szSrc, const QString & szFmt, ...) { - QString tmp; + QString szTmp; kvi_va_list list; kvi_va_start_by_reference(list,szFmt); //print...with max 256 chars - KviQString::vsprintf(tmp,szFmt,list); + KviQString::vsprintf(szTmp,szFmt,list); kvi_va_end(list); - s.append(tmp); + szSrc.append(szTmp); } - bool matchWildExpressionsCI(const QString &szM1,const QString &szM2) + bool matchWildExpressions(const QString & szM1, const QString & szM2) { - //Matches two regular expressions containging wildcards (* and ?) - // s1 - // m1 + // pM1 // mask1 : *xor // mask2 : xorand*xor // m2 @@ -737,286 +1000,303 @@ namespace KviQString // // *!*@*.net // | - // m1 + // pM1 // s1 // - const QChar * m1 = (const QChar *)szM1.constData(); - const QChar * m2 = (const QChar *)szM2.constData(); + const QChar * pM1 = (const QChar *)szM1.constData(); + const QChar * pM2 = (const QChar *)szM2.constData(); - if(!(m1 && m2 && (m1->unicode())))return false; - const QChar * savePos1 = 0; - const QChar * savePos2 = m2; - while(m1->unicode()) + if(!(pM1 && pM2 && (pM1->unicode()))) + { + return false; + } + + const QChar * pSavePos1 = 0; + const QChar * pSavePos2 = pM2; + while(pM1->unicode()) { - //loop managed by m1 (initially first mask) - if(m1->unicode()=='*') + //loop managed by pM1 (initially first mask) + if(pM1->unicode() == '*') + { + //Found a wildcard in pM1 + //move to the next char and save the position...this is our jolly + pSavePos1 = ++pM1; + if(!pSavePos1->unicode()) + { + //last was a wildcard , matches everything ahead... + return true; + } + //next return state for the second string + pSavePos2 = pM2 + 1; + //and return + continue; + } + if(!pM2->unicode()) { - //Found a wildcard in m1 - savePos1 = ++m1; //move to the next char and save the position...this is our jolly - if(!savePos1->unicode())return true; //last was a wildcard , matches everything ahead... - savePos2 = m2+1; //next return state for the second string - continue; //and return + //pM2 finished and we had something to match here! + return false; } - if(!m2->unicode())return false; //m2 finished and we had something to match here! - if(m1->toLower()==m2->toLower()) + if(pM1->toLower() == pM2->toLower()) { - //chars matched - m1++; //Go ahead in the two strings - m2++; // - if((!(m1->unicode())) && m2->unicode() && savePos1) + //chars matched. go ahead in the two strings + pM1++; + pM2++; + if((!(pM1->unicode())) && pM2->unicode() && pSavePos1) { - //m1 finished , but m2 not yet and we have a savePosition for m1 (there was a wildcard)... + //pM1 finished , but pM2 not yet and we have a savePosition for pM1 (there was a wildcard)... //retry matching the string following the * from the savePos2 (one char ahead last time) - m1 = savePos1; //back to char after wildcard - m2 = savePos2; //back to last savePos2 - savePos2++; //next savePos2 will be next char + //back to char after wildcard + pM1 = pSavePos1; + //back to last savePos2 + pM2 = pSavePos2; + //next savePos2 will be next char + pSavePos2++; } } else { - if(m2->unicode() == '*') + if(pM2->unicode() == '*') { //A wlidcard in the second string //Invert the game : mask1 <-> mask2 //mask2 now leads the game... - savePos1 = m1; //aux - m1 = m2; //...swap - m2 = savePos1; //...swap - savePos1 = m1; //sync save pos1 - savePos2 = m2 + 1; //sync save pos2 - continue; //...and again + //aux + pSavePos1 = pM1; + //...swap + pM1 = pM2; + //...swap + pM2 = pSavePos1; + //sync save pos1 + pSavePos1 = pM1; + //sync save pos2 + pSavePos2 = pM2 + 1; + //...and again + continue; } - // m1 != m2 , m1 != * , m2 != * - if((m1->unicode() == '?') || (m2->unicode() == '?')) + // pM1 != pM2 , pM1 != * , pM2 != * + if((pM1->unicode() == '?') || (pM2->unicode() == '?')) { - m1++; - m2++; - if((!(m1->unicode())) && m2->unicode() && savePos1) + pM1++; + pM2++; + if((!(pM1->unicode())) && pM2->unicode() && pSavePos1) { - //m1 finished , but m2 not yet and we have a savePosition for m1 (there was a wildcard)... - //retry matching the string following the * from the savePos2 (one char ahead last time) - m1 = savePos1; //back to char after wildcard - m2 = savePos2; //back to last savePos2 - savePos2++; //next savePos2 will be next char + //pM1 finished , but pM2 not yet and we have a savePosition for pM1 (there was a wildcard)... + //retry matching the string following the * from the pSavePos2 (one char ahead last time) + //back to char after wildcard + pM1 = pSavePos1; + //back to last pSavePos2 + pM2 = pSavePos2; + //next pSavePos2 will be next char + pSavePos2++; } } else { - if(savePos1) + if(pSavePos1) { //Have a jolly man...allow not matching... - m1 = savePos1; //go back to char after wildcard...need to rematch... - m2 = savePos2; //back to last savePos2 - savePos2++; //and set next savePos2 - } else return false; //No previous wildcards...not matched! + //go back to char after wildcard...need to rematch... + pM1 = pSavePos1; + //back to last pSavePos2 + pM2 = pSavePos2; + //and set next pSavePos2 + pSavePos2++; + } else { + //No previous wildcards...not matched! + return false; + } } } } - return (!(m2->unicode())); //m1 surely finished , so for the match , m2 must be finished too + //pM1 surely finished , so for the match , pM2 must be finished too + return (!(pM2->unicode())); } - bool matchStringCI(const QString &szExp,const QString &szStr,bool bIsRegExp,bool bExact) + bool matchString(const QString & szExp, const QString & szStr, bool bIsRegExp, bool bExact, bool bCs) { QString szWildcard; - QChar* ptr=(QChar*)szExp.constData(); + QChar * pPtr = (QChar*)szExp.constData(); - if(!ptr) return 0; - while(ptr->unicode()) + if(!pPtr) { - if((ptr->unicode()=='[') || (ptr->unicode()==']')) - { - szWildcard.append("["); - szWildcard.append(*ptr); - szWildcard.append("]"); - } else { - szWildcard.append(*ptr); - } - ptr++; + return 0; } - QRegExp re(szWildcard,Qt::CaseInsensitive,bIsRegExp ? QRegExp::RegExp : QRegExp::Wildcard); - - if(bExact) return re.exactMatch(szStr); - return re.indexIn(szStr) != -1; - } - - bool matchStringCS(const QString &szExp,const QString &szStr,bool bIsRegExp,bool bExact) - { - QString szWildcard; - QChar* ptr=(QChar*)szExp.constData(); - - if(!ptr) return 0; - while(ptr->unicode()) + while(pPtr->unicode()) { - if((ptr->unicode()=='[')) // <-- hum ? + if((pPtr->unicode() == '[') || (pPtr->unicode() == ']')) { szWildcard.append("["); - szWildcard.append(*ptr); + szWildcard.append(*pPtr); szWildcard.append("]"); } else { - szWildcard.append(*ptr); + szWildcard.append(*pPtr); } - ptr++; + pPtr++; } - QRegExp re(szWildcard,Qt::CaseSensitive,bIsRegExp ? QRegExp::RegExp : QRegExp::Wildcard); + QRegExp re(szWildcard,bCs ? Qt::CaseSensitive : Qt::CaseInsensitive,bIsRegExp ? QRegExp::RegExp : QRegExp::Wildcard); - if(bExact) return re.exactMatch(szStr); + if(bExact) + { + return re.exactMatch(szStr); + } return re.indexIn(szStr) != -1; } - void cutFromFirst(QString &s,const QChar &c,bool bIncluded) + void cutFromFirst(QString & szSrc, const QChar & c, bool bIncluded) { - int idx = s.indexOf(c); + int iIdx = szSrc.indexOf(c); - if(idx == -1)return; - s.truncate(bIncluded ? idx : idx + 1); + if(iIdx == -1) return; + szSrc.truncate(bIncluded ? iIdx : iIdx + 1); + } + + void cutFromFirst(QString & szSrc, const QString & szFind, bool bIncluded) + { + int iIdx = szSrc.indexOf(szFind); + if(iIdx == -1) return; + szSrc.truncate(bIncluded ? iIdx : iIdx + szFind.length()); } - void cutFromLast(QString &s,const QChar &c,bool bIncluded) + void cutFromLast(QString & szSrc, const QChar & c, bool bIncluded) { - int idx = s.lastIndexOf(c); + int iIdx = szSrc.lastIndexOf(c); - if(idx == -1)return; - s.truncate(bIncluded ? idx : idx + 1); + if(iIdx == -1) return; + szSrc.truncate(bIncluded ? iIdx : iIdx + 1); + } + + void cutFromLast(QString & szSrc, const QString & szFind, bool bIncluded) + { + int iIdx = szSrc.lastIndexOf(szFind); + if(iIdx == -1) return; + szSrc.truncate(bIncluded ? iIdx : iIdx + szFind.length()); } - void cutToFirst(QString &s,const QChar &c,bool bIncluded,bool bClearIfNotFound) + void cutToFirst(QString & szSrc, const QChar & c, bool bIncluded, bool bClearIfNotFound) { - int idx = s.indexOf(c); - if(idx == -1) + int iIdx = szSrc.indexOf(c); + if(iIdx == -1) { - if(bClearIfNotFound)s = ""; + if(bClearIfNotFound) szSrc = ""; return; } - s.remove(0,bIncluded ? idx + 1 : idx); + szSrc.remove(0,bIncluded ? iIdx + 1 : iIdx); } - - void cutToLast(QString &s,const QChar &c,bool bIncluded,bool bClearIfNotFound) + + void cutToFirst(QString & szSrc, const QString & szFind, bool bIncluded, bool bClearIfNotFound) { - int idx = s.lastIndexOf(c); - if(idx == -1) + int iIdx = szSrc.indexOf(szFind); + if(iIdx == -1) { - if(bClearIfNotFound)s = ""; + if(bClearIfNotFound) szSrc = ""; return; } - s.remove(0,bIncluded ? idx + 1 : idx); - } - - void cutFromFirst(QString &s,const QString &c,bool bIncluded) - { - int idx = s.indexOf(c); - if(idx == -1)return; - s.truncate(bIncluded ? idx : idx + c.length()); - } - - void cutFromLast(QString &s,const QString &c,bool bIncluded) - { - int idx = s.lastIndexOf(c); - if(idx == -1)return; - s.truncate(bIncluded ? idx : idx + c.length()); + szSrc.remove(0,bIncluded ? iIdx + szFind.length() : iIdx); } - void cutToFirst(QString &s,const QString &c,bool bIncluded,bool bClearIfNotFound) + void cutToLast(QString & szSrc, const QChar & c, bool bIncluded, bool bClearIfNotFound) { - int idx = s.indexOf(c); - if(idx == -1) + int iIdx = szSrc.lastIndexOf(c); + if(iIdx == -1) { - if(bClearIfNotFound)s = ""; + if(bClearIfNotFound) szSrc = ""; return; } - s.remove(0,bIncluded ? idx + c.length() : idx); + szSrc.remove(0,bIncluded ? iIdx + 1 : iIdx); } - - void cutToLast(QString &s,const QString &c,bool bIncluded,bool bClearIfNotFound) + + void cutToLast(QString & szSrc, const QString & szFind, bool bIncluded, bool bClearIfNotFound) { - int idx = s.lastIndexOf(c); - if(idx == -1) + int iIdx = szSrc.lastIndexOf(szFind); + if(iIdx == -1) { - if(bClearIfNotFound)s = ""; + if(bClearIfNotFound) szSrc = ""; return; } - s.remove(0,bIncluded ? idx + c.length() : idx); + szSrc.remove(0,bIncluded ? iIdx + szFind.length() : iIdx); } - QString upperISO88591(const QString &szSrc) + QString upperISO88591(const QString & szSrc) { - const QChar * c = nullTerminatedArray(szSrc); - if(!c) + const QChar * pC = nullTerminatedArray(szSrc); + if(!pC) { - QString ret; - return ret; + QString szRet; + return szRet; } - QChar * buffer = (QChar *)kvi_malloc(sizeof(QChar) * szSrc.length()); - QChar * b = buffer; - unsigned short us = c->unicode(); - while(us) + QChar * pBuffer = (QChar *)kvi_malloc(sizeof(QChar) * szSrc.length()); + QChar * pB = pBuffer; + unsigned short usX = pC->unicode(); + while(usX) { - if(us < 256) - *b=QChar((unsigned short)iso88591_toUpper_map[us]); + if(usX < 256) + *pB = QChar((unsigned short)iso88591_toUpper_map[usX]); else - *b = *c; - c++; - b++; - us = c->unicode(); + *pB = *pC; + pC++; + pB++; + usX = pC->unicode(); } - QString ret(buffer,szSrc.length()); - kvi_free(buffer); - return ret; + QString szRet(pBuffer,szSrc.length()); + kvi_free(pBuffer); + return szRet; } - QString lowerISO88591(const QString &szSrc) + QString lowerISO88591(const QString & szSrc) { - const QChar * c = nullTerminatedArray(szSrc); - if(!c) + const QChar * pC = nullTerminatedArray(szSrc); + if(!pC) { - QString ret; - return ret; + QString szRet; + return szRet; } - QChar * buffer = (QChar *)kvi_malloc(sizeof(QChar) * szSrc.length()); - QChar * b = buffer; - unsigned short us = c->unicode(); - while(us) + QChar * pBuffer = (QChar *)kvi_malloc(sizeof(QChar) * szSrc.length()); + QChar * pB = pBuffer; + unsigned short usX = pC->unicode(); + while(usX) { - if(us < 256) + if(usX < 256) { - *b=QChar((unsigned short)iso88591_toLower_map[us]); + *pB = QChar((unsigned short)iso88591_toLower_map[usX]); } else - *b = *c; - c++; - b++; - us = c->unicode(); + *pB = *pC; + pC++; + pB++; + usX = pC->unicode(); } - QString ret(buffer,szSrc.length()); - kvi_free(buffer); - return ret; + QString szRet(pBuffer,szSrc.length()); + kvi_free(pBuffer); + return szRet; } - void transliterate(QString &s,const QString &szToFind,const QString &szReplacement) + void transliterate(QString & szSrc, const QString & szToFind, const QString & szReplacement) { - int i=0; + int i = 0; int il = MY_MIN(szToFind.length(),szReplacement.length()); while(i < il) { - int k=0; - int kl = s.length(); + int k = 0; + int kl = szSrc.length(); while(k < kl) { - if(s[k] == szToFind[i])s[k] = szReplacement[i]; + if(szSrc[k] == szToFind[i]) + { + szSrc[k] = szReplacement[i]; + } k++; } i++; } } - static char hexdigits[16] = { '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f' }; - - void bufferToHex(QString &szRetBuffer,const unsigned char * buffer,unsigned int len) + void bufferToHex(QString & szRetBuffer, const unsigned char * pcBuffer, unsigned int uLen) { - szRetBuffer.resize(len * 2); - unsigned int i=0; - while(i < (len*2)) + szRetBuffer.resize(uLen * 2); + unsigned int u = 0; + while(u < (uLen * 2)) { - szRetBuffer[int(i)] = QChar( (unsigned int) hexdigits[(*buffer) / 16] ); - i++; - szRetBuffer[int(i)] = QChar( (unsigned int)hexdigits[(*buffer) % 16] ); - i++; - buffer++; + szRetBuffer[int(u)] = QChar((unsigned int)cHexDigits[(*pcBuffer) / 16] ); + u++; + szRetBuffer[int(u)] = QChar((unsigned int)cHexDigits[(*pcBuffer) % 16] ); + u++; + pcBuffer++; } } } diff --git a/src/kvilib/core/kvi_qstring.h b/src/kvilib/core/kvi_qstring.h index d6b3447ac..60c678479 100644 --- a/src/kvilib/core/kvi_qstring.h +++ b/src/kvilib/core/kvi_qstring.h @@ -46,170 +46,587 @@ */ namespace KviQString { + /** + * \brief A global empty string (note that this is ALSO NULL under Qt 3.x) + */ + extern KVILIB_API const QString Empty; + + /** + * \brief Returns a readable size in byte's multiples + * + * This will return strings like KiB, MiB, GiB, TiB and so on + * \param size The size of the file + * \return QString + */ extern KVILIB_API QString makeSizeReadable(size_t size); - extern KVILIB_API bool equalCS(const QString &sz1,const QString &sz2); - extern KVILIB_API bool equalCI(const QString &sz1,const QString &sz2); - extern KVILIB_API bool equalCS(const QString &sz1,const char * sz2); - extern KVILIB_API bool equalCI(const QString &sz1,const char * sz2); - // sz2 is assumed to be null terminated here! - extern KVILIB_API bool equalCI(const QString &sz1,const QChar * sz2); - inline bool equalCS(const char * sz1,const QString &sz2) - { return equalCS(sz2,sz1); } - inline bool equalCI(const char * sz1,const QString &sz2) - { return equalCI(sz2,sz1); } - // sz1 is assumed to be null terminated here! - inline bool equalCI(const QChar * sz1,const QString &sz2) - { return equalCI(sz2,sz1); } - - extern KVILIB_API bool equalCSN(const QString &sz1,const QString &sz2,unsigned int len); - extern KVILIB_API bool equalCIN(const QString &sz1,const QString &sz2,unsigned int len); - extern KVILIB_API bool equalCSN(const QString &sz1,const char * sz2,unsigned int len); - extern KVILIB_API bool equalCIN(const QString &sz1,const char * sz2,unsigned int len); - // sz2 is assumed to be null terminated here! - extern KVILIB_API bool equalCIN(const QString &sz1,const QChar * sz2,unsigned int len); - inline bool equalCSN(const char * sz1,const QString &sz2,unsigned int len) - { return equalCSN(sz2,sz1,len); } - inline bool equalCIN(const char * sz1,const QString &sz2,unsigned int len) - { return equalCIN(sz2,sz1,len); } - // sz1 is assumed to be null terminated here! - inline bool equalCIN(const QChar * sz1,const QString &sz2,unsigned int len) - { return equalCIN(sz2,sz1,len); } + + /** + * \brief Compares two strings with case sensitive + * + * It returns true if the strings are equal, false otherwise + * \param sz1 First string + * \param sz2 Second string + * \return bool + */ + extern KVILIB_API bool equalCS(const QString & sz1, const QString & sz2); + + /** + * \brief Compares two strings with case sensitive + * + * It returns true if the strings are equal, false otherwise + * \param sz1 First string + * \param pc2 Second string + * \return bool + */ + extern KVILIB_API bool equalCS(const QString & sz1, const char * pc2); + + /** + * \brief Compares two strings with case sensitive + * + * It returns true if the strings are equal, false otherwise + * \param pc1 First string + * \param sz2 Second string + * \return bool + */ + inline bool equalCS(const char * pc1, const QString & sz2) + { return equalCS(sz2,pc1); } + + /** + * \brief Compares two strings with case insensitive + * + * It returns true if the strings are equal, false otherwise + * \param sz1 First string + * \param sz2 Second string + * \return bool + */ + extern KVILIB_API bool equalCI(const QString & sz1, const QString & sz2); + + /** + * \brief Compares two strings with case insensitive + * + * It returns true if the strings are equal, false otherwise + * \param sz1 First string + * \param pc2 Second string + * \return bool + */ + extern KVILIB_API bool equalCI(const QString & sz1, const char * pc2); + + /** + * \brief Compares two strings with case insensitive + * + * It returns true if the strings are equal, false otherwise. + * The parameter pC2 is assumed to be null terminated here! + * \param sz1 First string + * \param pC2 Second string + * \return bool + */ + extern KVILIB_API bool equalCI(const QString & sz1, const QChar * pC2); + + /** + * \brief Compares two strings with case insensitive + * + * It returns true if the strings are equal, false otherwise. + * \param pc1 First string + * \param sz2 Second string + * \return bool + */ + inline bool equalCI(const char * pc1, const QString & sz2) + { return equalCI(sz2,pc1); } + + /** + * \brief Compares two strings with case insensitive + * + * It returns true if the strings are equal, false otherwise. + * The parameter pC1 is assumed to be null terminated here! + * \param pC1 First string + * \param sz2 Second string + * \return bool + */ + inline bool equalCI(const QChar * pC1, const QString & sz2) + { return equalCI(sz2,pC1); } + + /** + * \brief Compares two strings with case sensitive up to N chars + * + * It returns true if the strings are equal, false otherwise + * \param sz1 First string + * \param sz2 Second string + * \param uLen The length of the string to check + * \return bool + */ + extern KVILIB_API bool equalCSN(const QString & sz1, const QString & sz2, unsigned int uLen); + + /** + * \brief Compares two strings with case sensitive up to N chars + * + * It returns true if the strings are equal, false otherwise + * \param sz1 First string + * \param pc2 Second string + * \param uLen The length of the string to check + * \return bool + */ + extern KVILIB_API bool equalCSN(const QString & sz1, const char * pc2, unsigned int uLen); + + /** + * \brief Compares two strings with case sensitive up to N chars + * + * It returns true if the strings are equal, false otherwise + * \param pc1 First string + * \param sz2 Second string + * \param uLen The length of the string to check + * \return bool + */ + inline bool equalCSN(const char * pc1, const QString & sz2, unsigned int uLen) + { return equalCSN(sz2,pc1,uLen); } + + /** + * \brief Compares two strings with case insensitive up to N chars + * + * It returns true if the strings are equal, false otherwise + * \param sz1 First string + * \param sz2 Second string + * \param uLen The length of the string to check + * \return bool + */ + extern KVILIB_API bool equalCIN(const QString & sz1, const QString & sz2, unsigned int uLen); + + /** + * \brief Compares two strings with case insensitive up to N chars + * + * It returns true if the strings are equal, false otherwise + * \param sz1 First string + * \param pc2 Second string + * \param uLen The length of the string to check + * \return bool + */ + extern KVILIB_API bool equalCIN(const QString & sz1, const char * pc2, unsigned int uLen); + + /** + * \brief Compares two strings with case insensitive up to N chars + * + * It returns true if the strings are equal, false otherwise + * pC2 is assumed to be null terminated here! + * \param sz1 First string + * \param pC2 Second string + * \param uLen The length of the string to check + * \return bool + */ + extern KVILIB_API bool equalCIN(const QString & sz1, const QChar * pC2, unsigned int uLen); + + /** + * \brief Compares two strings with case insensitive up to N chars + * + * It returns true if the strings are equal, false otherwise + * \param pc1 First string + * \param sz2 Second string + * \param uLen The length of the string to check + * \return bool + */ + inline bool equalCIN(const char * pc1, const QString & sz2, unsigned int uLen) + { return equalCIN(sz2,pc1,uLen); } + + /** + * \brief Compares two strings with case insensitive up to N chars + * + * It returns true if the strings are equal, false otherwise + * pC1 is assumed to be null terminated here! + * \param pC1 First string + * \param sz2 Second string + * \param uLen The length of the string to check + * \return bool + */ + inline bool equalCIN(const QChar * pC1, const QString & sz2, unsigned int uLen) + { return equalCIN(sz2,pC1,uLen); } - //note that greater here means that come AFTER in the alphabetic order - // return < 0 ---> str1 < str2 - // return = 0 ---> str1 = str2 - // return > 0 ---> str1 > str2 - extern KVILIB_API int cmpCI(const QString &sz1,const QString &sz2,bool nonAlphaGreater = false); - extern KVILIB_API int cmpCIN(const QString &sz1,const QString &sz2,unsigned int len); - extern KVILIB_API int cmpCS(const QString &sz1,const QString &sz2); + /** + * \brief Compares two strings with case insensitive + * + * Note that greater here means that come AFTER in the alphabetic order + * return < 0 ---> str1 < str2 + * return = 0 ---> str1 = str2 + * return > 0 ---> str1 > str2 + * \param sz1 The first string + * \param sz2 The second string + * \param bNonAlphaGreater Wheter to check if strings are not alphabetics + * \return int + */ + extern KVILIB_API int cmpCI(const QString & sz1, const QString & sz2, bool bNonAlphaGreater = false); + + /** + * \brief Compares two strings with case insensitive up to N chars + * + * Note that greater here means that come AFTER in the alphabetic order + * return < 0 ---> str1 < str2 + * return = 0 ---> str1 = str2 + * return > 0 ---> str1 > str2 + * \param sz1 The first string + * \param sz2 The second string + * \param uLen The number of chars to check + * \return int + */ + extern KVILIB_API int cmpCIN(const QString & sz1, const QString & sz2, unsigned int uLen); + + /** + * \brief Compares two strings with case sensitive + * + * Note that greater here means that come AFTER in the alphabetic order + * return < 0 ---> str1 < str2 + * return = 0 ---> str1 = str2 + * return > 0 ---> str1 > str2 + * \param sz1 The first string + * \param sz2 The second string + * \return int + */ + extern KVILIB_API int cmpCS(const QString & sz1, const QString & sz2); - extern KVILIB_API void detach(QString &sz); + /** + * \brief Resets the size of the string + * \param szSrc The source string + * \return void + */ + extern KVILIB_API void detach(QString & szSrc); - // this makes the QString sz appear as a null terminated array - // it MAY RETURN 0 when the QString is null! - extern KVILIB_API const QChar * nullTerminatedArray(const QString &sz); + /** + * \brief Returns a pointer to the data stored in the string. + * + * This makes the string szSrc appear as a null terminated array. + * It MAY RETURN 0 when the string is null! + * \param szSrc The source string + * \return QChar * + */ + extern KVILIB_API const QChar * nullTerminatedArray(const QString & szSrc); /** - * \brief Returns true if the string ends with character c - * \param szString The source string + * \brief Returns true if the string ends with the given character + * \param szSrc The source string * \param c The char to check * \return bool */ - inline bool lastCharIs(QString & szString, const QChar & c) - { return szString.endsWith(c); } + inline bool lastCharIs(QString & szSrc, const QChar & c) + { return szSrc.endsWith(c); } - extern KVILIB_API void ensureLastCharIs(QString &szString,const QChar &c); - - // wild expression matching - extern KVILIB_API bool matchWildExpressionsCI(const QString &szM1,const QString &szM2); - // wild or regexp matching - extern KVILIB_API bool matchStringCI(const QString &szExp,const QString &szStr,bool bIsRegExp = false,bool bExact = false); - extern KVILIB_API bool matchStringCS(const QString &szExp,const QString &szStr,bool bIsRegExp = false,bool bExact = false); + /** + * \brief Ensures the last char of a string is the given char + * + * If the string does not end with the given char, it appends it + * \param szSrc The source string + * \param c The char to check + * \return void + */ + extern KVILIB_API void ensureLastCharIs(QString & szSrc, const QChar & c); - extern KVILIB_API void vsprintf(QString &s,const QString &szFmt,kvi_va_list list); - extern KVILIB_API QString & sprintf(QString &s,const QString &szFmt,...); - extern KVILIB_API void stripRightWhiteSpace(QString &s); - extern KVILIB_API void stripLeft(QString &s,const QChar &c); - extern KVILIB_API void stripRight(QString &s,const QChar &c); - extern KVILIB_API void appendFormatted(QString &s,const QString &szFmt,...); - extern KVILIB_API void appendNumber(QString &s,double dReal); - extern KVILIB_API void appendNumber(QString &s,kvi_i64_t iInteger); - extern KVILIB_API void appendNumber(QString &s,int iInteger); - extern KVILIB_API void appendNumber(QString &s,unsigned int uInteger); - extern KVILIB_API void appendNumber(QString &s,kvi_u64_t uInteger); + /** + * \brief Matches two strings containging wildcards (* and ?) + * \param szM1 The first string to match + * \param szM2 The second string to match + * \return bool + */ + extern KVILIB_API bool matchWildExpressions(const QString & szM1, const QString & szM2); + + /** + * \brief Matches two string containging wildcards (* and ?) or regular expressions + * \param szExp The regular expression to match + * \param szStr The source string + * \param bIsRegExp Wheter to use a wildcard or regexp matching + * \param bExact Wheter to match the whole string + * \param bCs Wheter to match with case sensitive + * \return bool + */ + extern KVILIB_API bool matchString(const QString & szExp, const QString & szStr, bool bIsRegExp = false, bool bExact = false, bool bCs = false); - extern KVILIB_API void cutFromFirst(QString &s,const QChar &c,bool bIncluded = true); - extern KVILIB_API void cutFromLast(QString &s,const QChar &c,bool bIncluded = true); - extern KVILIB_API void cutToFirst(QString &s,const QChar &c,bool bIncluded = true,bool bClearIfNotFound = false); - extern KVILIB_API void cutToLast(QString &s,const QChar &c,bool bIncluded = true,bool bClearIfNotFound = false); - extern KVILIB_API void cutFromFirst(QString &s,const QString &c,bool bIncluded = true); - extern KVILIB_API void cutFromLast(QString &s,const QString &c,bool bIncluded = true); - extern KVILIB_API void cutToFirst(QString &s,const QString &c,bool bIncluded = true,bool bClearIfNotFound = false); - extern KVILIB_API void cutToLast(QString &s,const QString &c,bool bIncluded = true,bool bClearIfNotFound = false); + /** + * \brief Writes to the character string + * \param szSrc The source string + * \param szFmt The format string + * \param list The list of format parameters + * \return void + */ + extern KVILIB_API void vsprintf(QString & szSrc, const QString & szFmt, kvi_va_list list); + + /** + * \brief Writes to the character string + * \param szSrc The source string + * \param szFmt The format string + * \param ... The list of format parameters + * \return QString + */ + extern KVILIB_API QString & sprintf(QString & szSrc, const QString & szFmt, ...); + + /** + * \brief Trims all the whitespaces at the end of the given string + * \param szSrc The source string + * \return void + */ + extern KVILIB_API void stripRightWhiteSpace(QString & szSrc); + + /** + * \brief Trims all c chars at the start of the given string + * \param szSrc The source string + * \param c The char to trim + * \return void + */ + extern KVILIB_API void stripLeft(QString & szSrc, const QChar & c); + + /** + * \brief Trims all c chars at the end of the given string + * \param szSrc The source string + * \param c The char to trim + * \return void + */ + extern KVILIB_API void stripRight(QString & szSrc, const QChar & c); + + /** + * \brief Appends a formatted string + * \param szSrc The source string + * \param szFmt The format string + * \param ... Format string parameters + * \return void + */ + extern KVILIB_API void appendFormatted(QString & szSrc, const QString & szFmt, ...); + + /** + * \brief Appends the given number to the source string + * \param szSrc The source string + * \param dReal Number in double format + * \return void + */ + extern KVILIB_API void appendNumber(QString & szSrc, double dReal); + + /** + * \brief Appends the given number to the source string + * \param szSrc The source string + * \param iInteger Number in kvi_i64_t format + * \return void + */ + extern KVILIB_API void appendNumber(QString & szSrc, kvi_i64_t iInteger); + + /** + * \brief Appends the given number to the source string + * \param szSrc The source string + * \param iInteger Number in int format + * \return void + */ + extern KVILIB_API void appendNumber(QString & szSrc, int iInteger); + + /** + * \brief Appends the given number to the source string + * \param szSrc The source string + * \param uInteger Number in unsigned int format + * \return void + */ + extern KVILIB_API void appendNumber(QString & szSrc, unsigned int uInteger); + + /** + * \brief Appends the given number to the source string + * \param szSrc The source string + * \param uInteger Number in kvi_i64_t format + * \return void + */ + extern KVILIB_API void appendNumber(QString & szSrc, kvi_u64_t uInteger); - extern KVILIB_API QString upperISO88591(const QString &szSrc); - extern KVILIB_API QString lowerISO88591(const QString &szSrc); - extern KVILIB_API QString getToken(QString &szString,const QChar &sep); + /** + * \brief Cuts the string after the first occurrence of the given char + * + * If the char is not found, the string is returned as it is. + * \param szSrc The source string + * \param c The char to search for + * \param bIncluded Wheter to include the given char + * \return void + */ + extern KVILIB_API void cutFromFirst(QString & szSrc, const QChar & c, bool bIncluded = true); + + /** + * \brief Cuts the string after the first occurrence of the given char + * + * If the char is not found, the string is returned as it is. + * \param szSrc The source string + * \param szFind The string to search for + * \param bIncluded Wheter to include the given string + * \return void + */ + extern KVILIB_API void cutFromFirst(QString & szSrc, const QString & szFind, bool bIncluded = true); + + /** + * \brief Cuts the string after the last occurrence of the given char + * + * If the char is not found, the string is returned as it is. + * \param szSrc The source string + * \param c The char to search for + * \param bIncluded Wheter to include the given char + * \return void + */ + extern KVILIB_API void cutFromLast(QString & szSrc, const QChar & c, bool bIncluded = true); + + /** + * \brief Cuts the string after the last occurrence of the given char + * + * If the char is not found, the string is returned as it is. + * \param szSrc The source string + * \param szFind The string to search for + * \param bIncluded Wheter to include the given string + * \return void + */ + extern KVILIB_API void cutFromLast(QString & szSrc, const QString & szFind, bool bIncluded = true); + + /** + * \brief Cuts the string until the first occurrence of the given char is found + * + * If the char is not found, the string is returned as it is. + * \param szSrc The source string + * \param c The char to search for + * \param bIncluded Wheter to include the given char in the cut + * \param bClearIfNotFound Wheter to cut the whole string if the char is not found + * \return void + */ + extern KVILIB_API void cutToFirst(QString & szSrc, const QChar & c, bool bIncluded = true, bool bClearIfNotFound = false); + + /** + * \brief Cuts the string until the first occurrence of the given char is found + * + * If the char is not found, the string is returned as it is. + * \param szSrc The source string + * \param szFind The string to search for + * \param bIncluded Wheter to include the given string in the cut + * \param bClearIfNotFound Wheter to cut the whole string if the string is not found + * \return void + */ + extern KVILIB_API void cutToFirst(QString & szSrc, const QString & szFind, bool bIncluded = true, bool bClearIfNotFound = false); + + /** + * \brief Cuts the string until the last occurrence of the given char is found + * + * If the char is not found, the string is returned as it is. + * \param szSrc The source string + * \param c The char to search for + * \param bIncluded Wheter to include the given char in the cut + * \param bClearIfNotFound Wheter to cut the whole string if the char is not found + * \return void + */ + extern KVILIB_API void cutToLast(QString & szSrc, const QChar & c, bool bIncluded = true, bool bClearIfNotFound = false); + + /** + * \brief Cuts the string until the last occurrence of the given char is found + * + * If the char is not found, the string is returned as it is. + * \param szSrc The source string + * \param szFind The string to search for + * \param bIncluded Wheter to include the given string in the cut + * \param bClearIfNotFound Wheter to cut the whole string if the string is not found + * \return void + */ + extern KVILIB_API void cutToLast(QString & szSrc, const QString & szFind, bool bIncluded = true, bool bClearIfNotFound = false); - extern KVILIB_API void transliterate(QString &s,const QString &szToFind,const QString &szReplacement); + /** + * \brief Returns an ISO-8859-1 upper case string + * \param szSrc The source string + * \return QString + */ + extern KVILIB_API QString upperISO88591(const QString & szSrc); + + /** + * \brief Returns an ISO-8859-1 lower case string + * \param szSrc The source string + * \return QString + */ + extern KVILIB_API QString lowerISO88591(const QString & szSrc); + + /** + * \brief Returns a token from a string + * \param szSrc The source string + * \param sep The token to find + * \return QString + */ + extern KVILIB_API QString getToken(QString & szSrc, const QChar & sep); - extern KVILIB_API void bufferToHex(QString &szRetBuffer,const unsigned char * buffer,unsigned int len); + /** + * \brief Replaces a string with another + * \param szSrc The source string + * \param szToFind The string to replace + * \param szReplacement The string to replace with + * \return void + */ + extern KVILIB_API void transliterate(QString & szSrc, const QString & szToFind, const QString & szReplacement); - // a global empty string (note that this is ALSO NULL under Qt 3.x) - extern KVILIB_API const QString empty; + /** + * \brief Returns an hexadecimal converted string starting from a buffer + * \param szRetBuffer The buffer to hold the hexadecimal string + * \param pcBuffer The buffer containing the string to convert + * \param uLen The max length of the original string + */ + extern KVILIB_API void bufferToHex(QString & szRetBuffer, const unsigned char * pcBuffer, unsigned int uLen); /** * \brief Returns the index position of the last occurrence of the character * * The search is made forward starting from index. - * \param s The source string + * \param szSrc The source string * \param c The character to find - * \param index The index to start from - * \param cs Case sensitive search + * \param iIndex The index to start from + * \param bCs Case sensitive search * \return int */ - inline int find(const QString & s, QChar c, int index = 0, bool cs = true) + inline int find(const QString & szSrc, QChar c, int iIndex = 0, bool bCs = true) { - return s.indexOf(c,index,cs ? Qt::CaseSensitive : Qt::CaseInsensitive); + return szSrc.indexOf(c,iIndex,bCs ? Qt::CaseSensitive : Qt::CaseInsensitive); } /** * \brief Returns the index position of the last occurrence of the character * * The search is made forward starting from index. - * \param s The source string + * \param szSrc The source string * \param c The character to find - * \param index The index to start from - * \param cs Case sensitive search + * \param iIndex The index to start from + * \param bCs Case sensitive search * \return int */ - inline int find(const QString & s, char c, int index = 0, bool cs = true) + inline int find(const QString & szSrc, char c, int iIndex = 0, bool bCs = true) { - return s.indexOf(c,index,cs ? Qt::CaseSensitive : Qt::CaseInsensitive); + return szSrc.indexOf(c,iIndex,bCs ? Qt::CaseSensitive : Qt::CaseInsensitive); } /** * \brief Returns the index position of the last occurrence of the string * * The search is made forward starting from index. - * \param s The source string - * \param str The string to find - * \param index The index to start from - * \param cs Case sensitive search + * \param szSrc The source string + * \param szStr The string to find + * \param iIndex The index to start from + * \param bCs Case sensitive search * \return int */ - inline int find(const QString & s, const QString & str, int index = 0, bool cs = true) + inline int find(const QString & szSrc, const QString & szStr, int iIndex = 0, bool bCs = true) { - return s.indexOf(str,index,cs ? Qt::CaseSensitive : Qt::CaseInsensitive); + return szSrc.indexOf(szStr,iIndex,bCs ? Qt::CaseSensitive : Qt::CaseInsensitive); } /** * \brief Returns the index position of the last occurrence of the string * * The search is made forward starting from index. - * \param s The source string - * \param str The string to find - * \param index The index to start from - * \param cs Case sensitive search + * \param szSrc The source string + * \param pcStr The string to find + * \param iIndex The index to start from + * \param bCs Case sensitive search * \return int */ - inline int find(const QString & s, const char * str, int index = 0, bool cs = true) + inline int find(const QString & szSrc, const char * pcStr, int iIndex = 0, bool bCs = true) { - return s.indexOf(QString(str),index,cs ? Qt::CaseSensitive : Qt::CaseInsensitive); + return szSrc.indexOf(QString(pcStr),iIndex,bCs ? Qt::CaseSensitive : Qt::CaseInsensitive); } /** * \brief Returns the index position of the last occurrence of the string * * The search is made forward starting from index. - * \param s The source string + * \param szSrc The source string * \param rx The regexp to match - * \param index The index to start from + * \param iIndex The index to start from * \return int */ - inline int find(const QString & s, const QRegExp & rx, int index = 0) + inline int find(const QString & szSrc, const QRegExp & rx, int iIndex = 0) { - return s.indexOf(rx,index); + return szSrc.indexOf(rx,iIndex); } /** @@ -217,15 +634,15 @@ namespace KviQString * * The search is made backward. * If index is -1 the search starts at the last character. - * \param s The source string + * \param szSrc The source string * \param c The character to find - * \param index The index to start from - * \param cs Case sensitive search + * \param iIndex The index to start from + * \param bCs Case sensitive search * \return int */ - inline int findRev(const QString & s ,QChar c, int index = -1, bool cs = true) + inline int findRev(const QString & szSrc, QChar c, int iIndex = -1, bool bCs = true) { - return s.lastIndexOf(c,index,cs ? Qt::CaseSensitive : Qt::CaseInsensitive); + return szSrc.lastIndexOf(c,iIndex,bCs ? Qt::CaseSensitive : Qt::CaseInsensitive); } /** @@ -233,47 +650,47 @@ namespace KviQString * * The search is made backward. * If index is -1 the search starts at the last character. - * \param s The source string + * \param szSrc The source string * \param c The character to find - * \param index The index to start from - * \param cs Case sensitive search + * \param iIndex The index to start from + * \param bCs Case sensitive search * \return int */ - inline int findRev(const QString & s, char c, int index = -1, bool cs = true) + inline int findRev(const QString & szSrc, char c, int iIndex = -1, bool bCs = true) { - return s.lastIndexOf(c,index,cs ? Qt::CaseSensitive : Qt::CaseInsensitive); + return szSrc.lastIndexOf(c,iIndex,bCs ? Qt::CaseSensitive : Qt::CaseInsensitive); } /** - * \brief Returns the index position of the last occurrence of the string str + * \brief Returns the index position of the last occurrence of the given string * * The search is made backward. * If index is -1 the search starts at the last character. - * \param s The source string - * \param str The string to find - * \param index The index to start from - * \param cs Case sensitive search + * \param szSrc The source string + * \param szStr The string to find + * \param iIndex The index to start from + * \param bCs Case sensitive search * \return int */ - inline int findRev(const QString & s, const QString & str, int index = -1, bool cs = true) + inline int findRev(const QString & szSrc, const QString & szStr, int iIndex = -1, bool bCs = true) { - return s.lastIndexOf(str,index,cs ? Qt::CaseSensitive : Qt::CaseInsensitive); + return szSrc.lastIndexOf(szStr,iIndex,bCs ? Qt::CaseSensitive : Qt::CaseInsensitive); } /** - * \brief Returns the index position of the last occurrence of the string str + * \brief Returns the index position of the last occurrence of the given string * * The search is made backward. * If index is -1 the search starts at the last character. - * \param s The source string - * \param str The string to find - * \param index The index to start from - * \param cs Case sensitive search + * \param szSrc The source string + * \param pcStr The string to find + * \param iIndex The index to start from + * \param bCs Case sensitive search * \return int */ - inline int findRev(const QString & s, const char * str, int index = -1, bool cs = true) + inline int findRev(const QString & szSrc, const char * pcStr, int iIndex = -1, bool bCs = true) { - return s.lastIndexOf(QString(str),index,cs ? Qt::CaseSensitive : Qt::CaseInsensitive); + return szSrc.lastIndexOf(QString(pcStr),iIndex,bCs ? Qt::CaseSensitive : Qt::CaseInsensitive); } /** @@ -281,31 +698,31 @@ namespace KviQString * * The search is made backward. * If index is -1 the search starts at the last character. - * \param s The source string + * \param szSrc The source string * \param rx The regexp to match - * \param index The index to start from + * \param iIndex The index to start from * \return int */ - inline int findRev(const QString & s, const QRegExp & rx, int index = -1) + inline int findRev(const QString & szSrc, const QRegExp & rx, int iIndex = -1) { - return s.lastIndexOf(rx,index); + return szSrc.lastIndexOf(rx,iIndex); } /** * \brief Return a whitespace-trimmed string * * Spaces are trimmed at start and end of the string - * \param s The source string + * \param szSrc The source string * \return QString */ - inline QString trimmed(const QString & s) + inline QString trimmed(const QString & szSrc) { - return s.trimmed(); + return szSrc.trimmed(); } /** * \brief Return a UTF-8 formatted string - * \param s The source string + * \param szSrc The source string * \return QByteArray * \warning: DO NOT USE CONSTRUCTS LIKE char * c = KviQString::toUtf8(something).data(); * They are dangerous since with many compilers the returned string @@ -317,24 +734,24 @@ namespace KviQString * instead. Yes, I know that it sucks, but it's the only way to * transit to Qt 4.x more or less cleanly... */ - inline QByteArray toUtf8(const QString & s) + inline QByteArray toUtf8(const QString & szSrc) { - return s.toUtf8(); + return szSrc.toUtf8(); } /** * \brief Return the local 8-bit representation of the string - * \param s The source string + * \param szSrc The source string * \return QByteArray */ - inline QByteArray toLocal8Bit(const QString & s) + inline QByteArray toLocal8Bit(const QString & szSrc) { - return s.toLocal8Bit(); + return szSrc.toLocal8Bit(); } /** * \brief Return the string converted to a long - * \param s The source string + * \param szNumber The source number * \param bOk The conversion error handling * \return kvi_i64_t */ @@ -349,7 +766,7 @@ namespace KviQString /** * \brief Return the string converted to an unsigned long - * \param s The source string + * \param szNumber The source number * \param bOk The conversion error handling * \return kvi_u64_t */ @@ -363,6 +780,4 @@ namespace KviQString } } -// QT4SUX: Because QString::null is gone. QString() is SLOWER than QString::null since it invokes a constructor and destructor. - #endif //_KVI_QSTRING_H_ diff --git a/src/kvilib/ext/kvi_osinfo.cpp b/src/kvilib/ext/kvi_osinfo.cpp index 47f84756e..19fd7e699 100644 --- a/src/kvilib/ext/kvi_osinfo.cpp +++ b/src/kvilib/ext/kvi_osinfo.cpp @@ -444,7 +444,7 @@ namespace KviOsInfo struct utsname uts; if(uname(&uts) == 0) return QString::fromLocal8Bit(uts.sysname); - return KviQString::empty; + return KviQString::Empty; #endif #endif } @@ -457,7 +457,7 @@ namespace KviOsInfo struct utsname uts; if(uname(&uts) == 0) return QString::fromLocal8Bit(uts.version); - return KviQString::empty; + return KviQString::Empty; #endif } @@ -469,7 +469,7 @@ namespace KviOsInfo struct utsname uts; if(uname(&uts) == 0) return QString::fromLocal8Bit(uts.release); - return KviQString::empty; + return KviQString::Empty; #endif } @@ -482,7 +482,7 @@ namespace KviOsInfo struct utsname uts; if(uname(&uts) == 0) return QString::fromLocal8Bit(uts.machine); - return KviQString::empty; + return KviQString::Empty; #endif } @@ -494,7 +494,7 @@ namespace KviOsInfo struct utsname uts; if(uname(&uts) == 0) return QString::fromLocal8Bit(uts.nodename); - return KviQString::empty; + return KviQString::Empty; #endif } @@ -504,6 +504,6 @@ namespace KviOsInfo if(gethostname(hbuffer,1024) == 0) return QString::fromLocal8Bit(hbuffer); else - return KviQString::empty; + return KviQString::Empty; } } diff --git a/src/kvilib/ext/kvi_regusersdb.cpp b/src/kvilib/ext/kvi_regusersdb.cpp index 4d91ea34a..c34bc26e8 100644 --- a/src/kvilib/ext/kvi_regusersdb.cpp +++ b/src/kvilib/ext/kvi_regusersdb.cpp @@ -253,11 +253,11 @@ bool KviRegisteredUser::getProperty(const QString & name,QString &value) const QString & KviRegisteredUser::getProperty(const QString & name) { - if(!m_pPropertyDict)return KviQString::empty; - if(name.isEmpty())return KviQString::empty; + if(!m_pPropertyDict)return KviQString::Empty; + if(name.isEmpty())return KviQString::Empty; QString * pValue = m_pPropertyDict->find(name); if(pValue)return *pValue; - return KviQString::empty; + return KviQString::Empty; } bool KviRegisteredUser::getBoolProperty(const QString & name,bool def) diff --git a/src/kvilib/irc/kvi_avatarcache.cpp b/src/kvilib/irc/kvi_avatarcache.cpp index e31cf9a1c..9add20d8d 100644 --- a/src/kvilib/irc/kvi_avatarcache.cpp +++ b/src/kvilib/irc/kvi_avatarcache.cpp @@ -116,7 +116,7 @@ const QString & KviAvatarCache::lookup(const KviIrcMask &mask,const QString &szN szKey.append(szNetwork); KviAvatarCacheEntry * e = m_pAvatarDict->find(szKey); - if(!e)return KviQString::empty; + if(!e)return KviQString::Empty; e->tLastAccess = kvi_unixTime(); return e->szIdString; } diff --git a/src/kvilib/irc/kvi_identityprofile.cpp b/src/kvilib/irc/kvi_identityprofile.cpp index cdcaed8e8..004e119f5 100644 --- a/src/kvilib/irc/kvi_identityprofile.cpp +++ b/src/kvilib/irc/kvi_identityprofile.cpp @@ -148,7 +148,7 @@ KviIdentityProfile * KviIdentityProfileSet::findName(const QString & szName) KviIdentityProfile * pProfile; for(pProfile = m_pProfiles->first(); pProfile; pProfile = m_pProfiles->next()) { - if(KviQString::matchStringCI(pProfile->name(),szName,false,true)) + if(KviQString::matchString(pProfile->name(),szName,false,true)) return pProfile; } @@ -162,7 +162,7 @@ KviIdentityProfile * KviIdentityProfileSet::findNetwork(const QString & szNetwor KviIdentityProfile * pProfile; for(pProfile = m_pProfiles->first(); pProfile; pProfile = m_pProfiles->next()) { - if(KviQString::matchStringCI(pProfile->network(),szNetwork,false,true)) + if(KviQString::matchString(pProfile->network(),szNetwork,false,true)) return pProfile; } diff --git a/src/kvilib/irc/kvi_ircmask.cpp b/src/kvilib/irc/kvi_ircmask.cpp index 5c27dc6ea..7020b5deb 100644 --- a/src/kvilib/irc/kvi_ircmask.cpp +++ b/src/kvilib/irc/kvi_ircmask.cpp @@ -557,11 +557,11 @@ bool KviIrcMask::matchedBy(const QString &szMask) const bool KviIrcMask::matches(const KviIrcMask &mask) const { - if(KviQString::matchWildExpressionsCI(m_szNick,mask.m_szNick)) + if(KviQString::matchWildExpressions(m_szNick,mask.m_szNick)) { - if(KviQString::matchWildExpressionsCI(m_szUser,mask.m_szUser)) + if(KviQString::matchWildExpressions(m_szUser,mask.m_szUser)) { - if(KviQString::matchWildExpressionsCI(m_szHost,mask.m_szHost))return true; + if(KviQString::matchWildExpressions(m_szHost,mask.m_szHost))return true; } } return false; @@ -569,11 +569,14 @@ bool KviIrcMask::matches(const KviIrcMask &mask) const bool KviIrcMask::matchesFixed(const KviIrcMask &mask) const { - if(KviQString::matchStringCI(m_szNick,mask.m_szNick,0,1)) + if(KviQString::matchString(m_szNick,mask.m_szNick,false,true)) { - if(KviQString::matchStringCI(m_szUser,mask.m_szUser,0,1)) + if(KviQString::matchString(m_szUser,mask.m_szUser,false,true)) { - if(KviQString::matchStringCI(m_szHost,mask.m_szHost,0,1))return true; + if(KviQString::matchString(m_szHost,mask.m_szHost,false,true)) + { + return true; + } } } return false; @@ -602,9 +605,9 @@ bool KviIrcMask::matches(const char * nick,const char * user,const char * host) bool KviIrcMask::matchesFixed(const QString &nick,const QString &user,const QString &host) const { - if(!KviQString::matchStringCI(m_szNick,nick,0,1))return false; - if(!KviQString::matchStringCI(m_szUser,user,0,1))return false; - if(!KviQString::matchStringCI(m_szHost,host,0,1))return false; + if(!KviQString::matchString(m_szNick,nick,false,true)) return false; + if(!KviQString::matchString(m_szUser,user,false,true)) return false; + if(!KviQString::matchString(m_szHost,host,false,true)) return false; return true; } diff --git a/src/kvilib/irc/kvi_nickserv.cpp b/src/kvilib/irc/kvi_nickserv.cpp index a7222fbe0..401ac555e 100644 --- a/src/kvilib/irc/kvi_nickserv.cpp +++ b/src/kvilib/irc/kvi_nickserv.cpp @@ -199,7 +199,7 @@ KviNickServRule * KviNickServRuleSet::matchRule(const QString &szNick,const KviI if(!m_pRules)return 0; for(KviNickServRule *r = m_pRules->first();r;r = m_pRules->next()) { - if(!KviQString::matchStringCI(r->registeredNick(),szNick,false,true)) continue; + if(!KviQString::matchString(r->registeredNick(),szNick,false,true)) continue; if(!szServer.isEmpty()) { QRegExp res(r->serverMask(),Qt::CaseInsensitive,QRegExp::Wildcard); diff --git a/src/kvilib/net/kvi_dns.cpp b/src/kvilib/net/kvi_dns.cpp index 2911524ab..25fed2a8a 100644 --- a/src/kvilib/net/kvi_dns.cpp +++ b/src/kvilib/net/kvi_dns.cpp @@ -413,14 +413,14 @@ const QString & KviDns::firstHostname() { QString * pStr = result()->hostnameList()->first(); if(pStr)return *pStr; - return KviQString::empty; + return KviQString::Empty; } const QString & KviDns::firstIpAddress() { QString * pStr = result()->ipAddressList()->first(); if(pStr)return *pStr; - return KviQString::empty; + return KviQString::Empty; } const QString & KviDns::query() diff --git a/src/kvilib/tal/kvi_tal_popupmenu.h b/src/kvilib/tal/kvi_tal_popupmenu.h index edb497e74..644b6fa6d 100644 --- a/src/kvilib/tal/kvi_tal_popupmenu.h +++ b/src/kvilib/tal/kvi_tal_popupmenu.h @@ -40,7 +40,7 @@ protected: QHash<QAction*, QSignalMapper*> signalMapper; int identifier; public: - KviTalPopupMenu(QWidget * pParent=0,const QString &szName = KviQString::empty); + KviTalPopupMenu(QWidget * pParent=0,const QString &szName = KviQString::Empty); virtual ~KviTalPopupMenu() ; int insertItem(const QString &szText); int insertItem(const QPixmap &pix,const QString &szText); diff --git a/src/kvirc/kernel/kvi_ircconnectionserverinfo.cpp b/src/kvirc/kernel/kvi_ircconnectionserverinfo.cpp index 9a739112a..d6286ff25 100644 --- a/src/kvirc/kernel/kvi_ircconnectionserverinfo.cpp +++ b/src/kvirc/kernel/kvi_ircconnectionserverinfo.cpp @@ -213,14 +213,14 @@ const QString & KviBasicIrcServerInfo::getChannelModeDescription(QChar mode) { QString tmp=getCustomChannelModeDescription(mode); if(tmp.isNull()) return getBasicChannelModeDescription(mode); - return KviQString::empty; + return KviQString::Empty; } const QString & KviBasicIrcServerInfo::getUserModeDescription(QChar mode) { QString tmp=getCustomUserModeDescription(mode); if(tmp.isNull()) return getBasicUserModeDescription(mode); - return KviQString::empty; + return KviQString::Empty; } const QString & KviBasicIrcServerInfo::getBasicChannelModeDescription(QChar mode) @@ -260,7 +260,7 @@ const QString & KviBasicIrcServerInfo::getBasicChannelModeDescription(QChar mode case '7': return __tr2qs("Only 7-bit letters in nicknames allowed"); break; case 'x': return __tr2qs("Impossible to use both 7-bit and 8-bit letters in nicknames"); break; } - return KviQString::empty; + return KviQString::Empty; } const QString & KviBasicIrcServerInfo::getBasicUserModeDescription(QChar mode) @@ -281,5 +281,5 @@ const QString & KviBasicIrcServerInfo::getBasicUserModeDescription(QChar mode) case 'd': return __tr2qs("d: Obscure 'DEBUG' flag"); break; case 'n': return __tr2qs("n: Recipient for nick changes"); break; } - return KviQString::empty; + return KviQString::Empty; } diff --git a/src/kvirc/kernel/kvi_ircconnectionserverinfo.h b/src/kvirc/kernel/kvi_ircconnectionserverinfo.h index 460373561..108c542b2 100644 --- a/src/kvirc/kernel/kvi_ircconnectionserverinfo.h +++ b/src/kvirc/kernel/kvi_ircconnectionserverinfo.h @@ -33,11 +33,11 @@ class KVIRC_API KviBasicIrcServerInfo protected: QString m_szServerVersion; public: - KviBasicIrcServerInfo(const QString & version = KviQString::empty); + KviBasicIrcServerInfo(const QString & version = KviQString::Empty); virtual ~KviBasicIrcServerInfo(); protected: - virtual const QString & getCustomChannelModeDescription(QChar) { return KviQString::empty; }; - virtual const QString & getCustomUserModeDescription(QChar) { return KviQString::empty; }; + virtual const QString & getCustomChannelModeDescription(QChar) { return KviQString::Empty; }; + virtual const QString & getCustomUserModeDescription(QChar) { return KviQString::Empty; }; private: const QString & getBasicChannelModeDescription(QChar mode); const QString & getBasicUserModeDescription(QChar mode); @@ -50,7 +50,7 @@ public: class KVIRC_API KviUnrealIrcServerInfo : public KviBasicIrcServerInfo { public: - KviUnrealIrcServerInfo(const QString & version = KviQString::empty) + KviUnrealIrcServerInfo(const QString & version = KviQString::Empty) :KviBasicIrcServerInfo(version) {;}; virtual char getRegisterModeChar() { return 'r'; }; }; @@ -58,7 +58,7 @@ public: class KVIRC_API KviBahamutIrcServerInfo : public KviBasicIrcServerInfo { public: - KviBahamutIrcServerInfo(const QString & version = KviQString::empty) + KviBahamutIrcServerInfo(const QString & version = KviQString::Empty) :KviBasicIrcServerInfo(version) {;}; virtual char getRegisterModeChar() { return 'r'; }; }; @@ -66,7 +66,7 @@ public: class KVIRC_API KviHyperionIrcServerInfo : public KviBasicIrcServerInfo { public: - KviHyperionIrcServerInfo(const QString & version = KviQString::empty) + KviHyperionIrcServerInfo(const QString & version = KviQString::Empty) :KviBasicIrcServerInfo(version) {;}; virtual char getRegisterModeChar() { return 'e'; }; }; diff --git a/src/kvirc/kernel/kvi_userinput.h b/src/kvirc/kernel/kvi_userinput.h index 263eb6d8d..d3a059752 100644 --- a/src/kvirc/kernel/kvi_userinput.h +++ b/src/kvirc/kernel/kvi_userinput.h @@ -49,7 +49,7 @@ namespace KviUserInput * \return bool * \warning May destroy szData */ - KVIRC_API bool parse(QString & szData, KviWindow * pWindow, const QString & szContext = KviQString::empty, bool bUserFriendlyCommandline = false); + KVIRC_API bool parse(QString & szData, KviWindow * pWindow, const QString & szContext = KviQString::Empty, bool bUserFriendlyCommandline = false); /** * \brief Returns true if the command run @@ -59,7 +59,7 @@ namespace KviUserInput * \param bUserFriendlyCommandline Whether the commandline is in user friendly mode * \return bool */ - KVIRC_API bool parseCommand(const QString & szData, KviWindow * pWindow, const QString & szContext = KviQString::empty, bool bUserFriendlyCommandline = false); + KVIRC_API bool parseCommand(const QString & szData, KviWindow * pWindow, const QString & szContext = KviQString::Empty, bool bUserFriendlyCommandline = false); /** * \brief Parses the non command input data @@ -69,7 +69,7 @@ namespace KviUserInput */ KVIRC_API void parseNonCommand(QString & szData, KviWindow * pWindow); - //bool parseCommandWithSingleArgument(const QString & szData, KviWindow * pWindow, const QString & szContext = KviQString::empty); + //bool parseCommandWithSingleArgument(const QString & szData, KviWindow * pWindow, const QString & szContext = KviQString::Empty); } #endif //_KVI_USERINPUT_H_ diff --git a/src/kvirc/kvs/kvi_kvs_scriptaddonmanager.cpp b/src/kvirc/kvs/kvi_kvs_scriptaddonmanager.cpp index 3a6114705..58009889a 100644 --- a/src/kvirc/kvs/kvi_kvs_scriptaddonmanager.cpp +++ b/src/kvirc/kvs/kvi_kvs_scriptaddonmanager.cpp @@ -116,13 +116,13 @@ const QString & KviKvsScriptAddon::uninstallCallbackCode() const QString & KviKvsScriptAddon::configureCallbackCode() { if(m_pConfigureCallback)return m_pConfigureCallback->code(); - return KviQString::empty; + return KviQString::Empty; } const QString & KviKvsScriptAddon::helpCallbackCode() { if(m_pHelpCallback)return m_pHelpCallback->code(); - return KviQString::empty; + return KviQString::Empty; } bool KviKvsScriptAddon::load(KviConfig * cfg,const QString &szName) diff --git a/src/kvirc/kvs/kvi_kvs_variant.h b/src/kvirc/kvs/kvi_kvs_variant.h index ffc505e41..99298b729 100644 --- a/src/kvirc/kvs/kvi_kvs_variant.h +++ b/src/kvirc/kvs/kvi_kvs_variant.h @@ -163,7 +163,7 @@ public: kvs_int_t integer() const { return m_pData ? m_pData->m_u.iInteger : 0; }; kvs_real_t real() const { return m_pData ? *(m_pData->m_u.pReal) : 0.0; }; - const QString & string() const { return m_pData ? *(m_pData->m_u.pString) : KviQString::empty; }; + const QString & string() const { return m_pData ? *(m_pData->m_u.pString) : KviQString::Empty; }; KviKvsArray * array() const { return m_pData ? m_pData->m_u.pArray : 0; }; KviKvsHash * hash() const { return m_pData ? m_pData->m_u.pHash : 0; }; bool boolean() const { return m_pData ? m_pData->m_u.bBoolean : false; }; diff --git a/src/kvirc/ui/kvi_ircview_loghandling.cpp b/src/kvirc/ui/kvi_ircview_loghandling.cpp index 4604a7607..78536f504 100644 --- a/src/kvirc/ui/kvi_ircview_loghandling.cpp +++ b/src/kvirc/ui/kvi_ircview_loghandling.cpp @@ -145,12 +145,12 @@ const QString & KviIrcView::lastMessageText() } pCur=pCur->pPrev; } - return KviQString::empty; + return KviQString::Empty; } const QString & KviIrcView::lastLineOfText() { - if(!m_pLastLine)return KviQString::empty; + if(!m_pLastLine)return KviQString::Empty; return m_pLastLine->szText; } diff --git a/src/kvirc/ui/kvi_window.cpp b/src/kvirc/ui/kvi_window.cpp index 06601252b..1f140bf1b 100644 --- a/src/kvirc/ui/kvi_window.cpp +++ b/src/kvirc/ui/kvi_window.cpp @@ -424,14 +424,14 @@ const QString & KviWindow::lastLineOfText() { if(m_pIrcView) return m_pIrcView->lastLineOfText(); - return KviQString::empty; + return KviQString::Empty; } const QString & KviWindow::lastMessageText() { if(m_pIrcView) return m_pIrcView->lastMessageText(); - return KviQString::empty; + return KviQString::Empty; } // The following three have to be here even if the crypt support is disabled...moc does not support conditional compilations @@ -561,7 +561,7 @@ void KviWindow::saveProperties(KviConfig *cfg) QTextCodec * c = defaultTextCodec(); if(c && m_pTextCodec) { - if(KviQString::equalCI(szCodec,c->name().data()))szCodec = KviQString::empty; // store "default" + if(KviQString::equalCI(szCodec,c->name().data()))szCodec = KviQString::Empty; // store "default" } QString szKey = "TextEncoding_"; szKey += m_szName; @@ -582,7 +582,7 @@ void KviWindow::loadProperties(KviConfig *cfg) { QString szKey = "TextEncoding_"; szKey += m_szName; - setTextEncoding(cfg->readQStringEntry(szKey,KviQString::empty).toUtf8().data()); + setTextEncoding(cfg->readQStringEntry(szKey,KviQString::Empty).toUtf8().data()); if(m_pInput) { m_pInput->setButtonsHidden(cfg->readBoolEntry("inputToolButtonsHidden",KVI_OPTION_BOOL(KviOption_boolHideInputToolButtons))); m_pInput->setUserFriendly(cfg->readBoolEntry("commandLineIsUserFriendly",KVI_OPTION_BOOL(KviOption_boolCommandlineInUserFriendlyModeByDefault))); diff --git a/src/kvirc/ui/kvi_window.h b/src/kvirc/ui/kvi_window.h index 697c0a2c0..a55faeeb7 100644 --- a/src/kvirc/ui/kvi_window.h +++ b/src/kvirc/ui/kvi_window.h @@ -219,9 +219,9 @@ public: inline KviInput * input(){ return m_pInput; }; // The target of this window: empty when it makes no sense :D - virtual const QString & target(){ return KviQString::empty; }; + virtual const QString & target(){ return KviQString::Empty; }; // The local nickname bound to this window: might be empty when a local nickname makes no sense - virtual const QString & localNick(){ return KviQString::empty; }; + virtual const QString & localNick(){ return KviQString::Empty; }; #ifdef COMPILE_CRYPT_SUPPORT KviCryptSessionInfo * cryptSessionInfo(){ return m_pCryptSessionInfo; }; diff --git a/src/modules/chan/libkvichan.cpp b/src/modules/chan/libkvichan.cpp index ed51151ff..7f72a9459 100644 --- a/src/modules/chan/libkvichan.cpp +++ b/src/modules/chan/libkvichan.cpp @@ -1343,7 +1343,7 @@ static bool chan_kvs_fnc_matchban(KviKvsModuleFunctionCall * c) for(KviMaskEntry * e = l->first();e;e = l->next()) { - if(KviQString::matchStringCI(e->szMask,szMask)) + if(KviQString::matchString(e->szMask,szMask)) { c->returnValue()->setString(e->szMask); return true; @@ -1392,7 +1392,7 @@ static bool chan_kvs_fnc_matchbanexception(KviKvsModuleFunctionCall * c) for(KviMaskEntry * e = l->first();e;e = l->next()) { - if(KviQString::matchStringCI(e->szMask,szMask)) + if(KviQString::matchString(e->szMask,szMask)) { c->returnValue()->setString(e->szMask); return true; @@ -1441,7 +1441,7 @@ static bool chan_kvs_fnc_matchinvite(KviKvsModuleFunctionCall * c) for(KviMaskEntry * e = l->first();e;e = l->next()) { - if(KviQString::matchStringCI(e->szMask,szMask)) + if(KviQString::matchString(e->szMask,szMask)) { c->returnValue()->setString(e->szMask); return true; @@ -1494,7 +1494,7 @@ static bool chan_kvs_fnc_matchqban(KviKvsModuleFunctionCall * c) for(KviMaskEntry * e = l->first();e;e = l->next()) { - if(KviQString::matchStringCI(e->szMask,szMask)) + if(KviQString::matchString(e->szMask,szMask)) { c->returnValue()->setString(e->szMask); return true; diff --git a/src/modules/logview/logviewmdiwindow.cpp b/src/modules/logview/logviewmdiwindow.cpp index 194743da2..9252730e5 100644 --- a/src/modules/logview/logviewmdiwindow.cpp +++ b/src/modules/logview/logviewmdiwindow.cpp @@ -273,13 +273,13 @@ void KviLogViewMDIWindow::setupItemList() continue; if(enableNameFilter) - if(!KviQString::matchStringCI(nameFilterText,pFile->name())) + if(!KviQString::matchString(nameFilterText,pFile->name())) continue; if(enableContentFilter) { pFile->getText(textBuffer,m_szLogDirectory); - if(!KviQString::matchStringCI(contentFilterText,textBuffer)) + if(!KviQString::matchString(contentFilterText,textBuffer)) continue; } diff --git a/src/modules/regchan/libkviregchan.cpp b/src/modules/regchan/libkviregchan.cpp index 2201fd1e5..356103582 100644 --- a/src/modules/regchan/libkviregchan.cpp +++ b/src/modules/regchan/libkviregchan.cpp @@ -264,8 +264,8 @@ static bool regchan_kvs_fnc_list(KviKvsModuleFunctionCall * c) while(KviRegisteredChannelList * l = it.current()) { for(KviRegisteredChannel * ch = l->first();ch;ch = l->next()) - if(KviQString::matchWildExpressionsCI(ch->name().ptr(),szChan) && - KviQString::matchWildExpressionsCI(ch->netMask().ptr(),szNetmask)) + if(KviQString::matchWildExpressions(ch->name().ptr(),szChan) && + KviQString::matchWildExpressions(ch->netMask().ptr(),szNetmask)) { // FIXME: WE NEED TO RETURN AN ARRAY OF 2-ELEMENT ARRAYS (chan name, netmask) pArray->set(aid,new KviKvsVariant(QString(ch->name()+"@"+ch->netMask()))); diff --git a/src/modules/str/libkvistr.cpp b/src/modules/str/libkvistr.cpp index a735b1e1c..d23eb67c0 100644 --- a/src/modules/str/libkvistr.cpp +++ b/src/modules/str/libkvistr.cpp @@ -1309,7 +1309,7 @@ static bool str_kvs_fnc_match(KviKvsModuleFunctionCall * c) KVSM_PARAMETERS_END(c) bool bRegExp = (szFlags.indexOf(QChar('r')) != -1) || (szFlags.indexOf(QChar('R')) != -1); bool bExact = (szFlags.indexOf(QChar('e')) != -1) || (szFlags.indexOf(QChar('E')) != -1); - c->returnValue()->setBoolean(KviQString::matchStringCS(szWildcard,szString,bRegExp,bExact)); + c->returnValue()->setBoolean(KviQString::matchString(szWildcard,szString,bRegExp,bExact,true)); return true; } @@ -1355,7 +1355,7 @@ static bool str_kvs_fnc_matchnocase(KviKvsModuleFunctionCall * c) KVSM_PARAMETERS_END(c) bool bRegExp = (szFlags.indexOf(QChar('r')) != -1) || (szFlags.indexOf(QChar('R')) != -1); bool bExact = (szFlags.indexOf(QChar('e')) != -1) || (szFlags.indexOf(QChar('E')) != -1); - c->returnValue()->setBoolean(KviQString::matchStringCI(szWildcard,szString,bRegExp,bExact)); + c->returnValue()->setBoolean(KviQString::matchString(szWildcard,szString,bRegExp,bExact)); return true; } |
