diff -Nru cb2bib-1.4.9/c2bscripts/c2bciter cb2bib-1.9.2/c2bscripts/c2bciter --- cb2bib-1.4.9/c2bscripts/c2bciter 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/c2bscripts/c2bciter 2015-08-09 19:52:56.000000000 +0000 @@ -2,7 +2,7 @@ #------------------------------------------------------------------------------- # c2bciter -- Wrapper for calling cb2Bib Citer # cb2Bib Tools -# Copyright (C) 2004-2012 by Pere Constans +# Copyright (C) 2004-2015 by Pere Constans # constans@molspaces.com # # Copyright (C) 2009 by Filippo Rusconi diff -Nru cb2bib-1.4.9/c2bscripts/c2bciter.desktop cb2bib-1.9.2/c2bscripts/c2bciter.desktop --- cb2bib-1.4.9/c2bscripts/c2bciter.desktop 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/c2bscripts/c2bciter.desktop 2015-08-09 19:52:56.000000000 +0000 @@ -12,3 +12,4 @@ Terminal=false Categories=Office; Type=Application +Keywords=bibliography,citations,scientific articles diff -Nru cb2bib-1.4.9/c2bscripts/c2bimport cb2bib-1.9.2/c2bscripts/c2bimport --- cb2bib-1.4.9/c2bscripts/c2bimport 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/c2bscripts/c2bimport 2015-08-09 19:52:56.000000000 +0000 @@ -2,7 +2,7 @@ #------------------------------------------------------------------------------- # c2bimport -- Script for calling cb2Bib in "Download Reference to cb2Bib" mode # cb2Bib Tools -# Copyright (C) 2004-2012 by Pere Constans +# Copyright (C) 2004-2015 by Pere Constans # constans@molspaces.com # # Copyright (C) 2009 by Filippo Rusconi diff -Nru cb2bib-1.4.9/c2bscripts/c2bimport.desktop cb2bib-1.9.2/c2bscripts/c2bimport.desktop --- cb2bib-1.4.9/c2bscripts/c2bimport.desktop 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/c2bscripts/c2bimport.desktop 2015-08-09 19:52:56.000000000 +0000 @@ -1,5 +1,5 @@ [Desktop Entry] -Comment=Donwload reference to cb2Bib +Comment=Download reference to cb2Bib Comment[ca]=Importa referència al cb2Bib Exec=cb2bib --import %f GenericName=cb2Bib Import Reference diff -Nru cb2bib-1.4.9/c2bscripts/cb2bib.desktop cb2bib-1.9.2/c2bscripts/cb2bib.desktop --- cb2bib-1.4.9/c2bscripts/cb2bib.desktop 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/c2bscripts/cb2bib.desktop 2015-08-09 19:52:56.000000000 +0000 @@ -12,3 +12,4 @@ Terminal=false Categories=Office; Type=Application +Keywords=bibliography,citations,scientific articles diff -Nru cb2bib-1.4.9/c2btools/bib2pdf cb2bib-1.9.2/c2btools/bib2pdf --- cb2bib-1.4.9/c2btools/bib2pdf 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/c2btools/bib2pdf 2015-08-09 19:52:56.000000000 +0000 @@ -3,7 +3,7 @@ # bib2pdf -- Script to convert BibTeX files to PDF # cb2Bib Tools # -# Copyright (C) 2005-2012 by Pere Constans +# Copyright (C) 2005-2015 by Pere Constans # constans@molspaces.com # # Improvements and modifications: diff -Nru cb2bib-1.4.9/c2btools/isi2bib cb2bib-1.9.2/c2btools/isi2bib --- cb2bib-1.4.9/c2btools/isi2bib 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/c2btools/isi2bib 2015-08-09 19:52:56.000000000 +0000 @@ -3,7 +3,7 @@ # isi2bib -- Script to convert ISI format to BibTeX # cb2Bib Tools # -# Copyright (C) 2005-2012 by Pere Constans +# Copyright (C) 2005-2015 by Pere Constans # constans@molspaces.com # # Improvements and modifications: @@ -20,7 +20,7 @@ # Usage: isi2bib input_isi output_bib #------------------------------------------------------------------------------- # Using isi2xml and xml2bib utilities from: -# http://www.scripps.edu/~cdputnam/software/bibutils/bibutils.html +# http://bibutils.refbase.org/ #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- @@ -64,7 +64,7 @@ echo "cb2Bib Tools: Script to convert ISI format to BibTeX" echo "" echo "It uses external package bibutils from" -echo "http://www.scripps.edu/~cdputnam/software/bibutils/bibutils.html" +echo "http://bibutils.refbase.org/" echo "" if test "$#" != 2; then cat < appl1-1 -### appl1-1 -### appl1_aux1 -### appl1_aux2 -### Resources/ -### appl1_res1 -### appl1_res2 -## -## # are they set as executable ? how if orig files were executable already ? are they seen as execs from the gui ? -## set_source_files_properties(c2bscripts/c2bciter c2bscripts/c2bimport PROPERTIES MACOSX_PACKAGE_LOCATION MacOS) -## # is this correct ? how about data c2btools testPDFImport directories ? -## set_source_files_properties(AUTHORS COPYRIGHT LICENSE CHANGELOG PROPERTIES MACOSX_PACKAGE_LOCATION Resources) -## # need this to copy icon ? -## set_source_files_properties(MACOSX_BUNDLE_ICON_FILE PROPERTIES MACOSX_PACKAGE_LOCATION Resources) - -endif(APPLE) -if(WIN32) -endif(WIN32) - -#------------------------------------------------------------------------------- \ No newline at end of file diff -Nru cb2bib-1.4.9/CMakeLists.txt.qt4 cb2bib-1.9.2/CMakeLists.txt.qt4 --- cb2bib-1.4.9/CMakeLists.txt.qt4 1970-01-01 00:00:00.000000000 +0000 +++ cb2bib-1.9.2/CMakeLists.txt.qt4 2015-08-09 19:52:56.000000000 +0000 @@ -0,0 +1,137 @@ +#------------------------------------------------------------------------------- +# cb2bib cmake build script +#------------------------------------------------------------------------------- +include(cmake/modules/c2bUtilities.cmake) + +#------------------------------------------------------------------------------- +# cb2bib cmake options and defaults +#------------------------------------------------------------------------------- +project(cb2bib) +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + if(WIN32) + set(CMAKE_INSTALL_PREFIX "C:\Program Files" CACHE PATH "Default install path prefix" FORCE) + elseif(APPLE) + set(CMAKE_INSTALL_PREFIX "/Applications" CACHE PATH "Default install path prefix" FORCE) + else() + set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "Default install path prefix" FORCE) + endif() +endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) +if(CMAKE_BUILD_TYPE STREQUAL "") + set(CMAKE_BUILD_TYPE Release) +endif() +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + add_definitions(-DC2B_DEBUG) +endif() + +find_package(Qt5Widgets) + +option(C2B_USE_WEBKIT "Link cb2bib against QtWebKit library." ON) +option(C2B_USE_LZO "Link cb2bib against lzo2 library." ON) +if(UNIX AND NOT APPLE) + option(C2B_USE_CBPOLL "Use clipboardPoll." ON) + path_option(C2B_INSTALL_BIN_DIR "Executables installation directory [default: CMAKE_INSTALL_PREFIX/bin]." "${CMAKE_INSTALL_PREFIX}/bin") + path_option(C2B_INSTALL_DATA_DIR "Data installation directory [default: CMAKE_INSTALL_PREFIX/share/cb2bib]." "${CMAKE_INSTALL_PREFIX}/share/cb2bib") + path_option(C2B_INSTALL_DESKTOP_DIR "Desktop file installation directory [default: CMAKE_INSTALL_PREFIX/share/applications]." "${CMAKE_INSTALL_PREFIX}/share/applications") + path_option(C2B_INSTALL_ICON_DIR "Icon file directory [default: CMAKE_INSTALL_PREFIX/share/pixmaps]." "${CMAKE_INSTALL_PREFIX}/share/pixmaps") +endif(UNIX AND NOT APPLE) +if(APPLE) + set(C2B_USE_CBPOLL OFF) + path_option(C2B_INSTALL_BIN_DIR "Executables installation directory [default: CMAKE_INSTALL_PREFIX/cb2bib.app/Contents/MacOS]." "${CMAKE_INSTALL_PREFIX}/cb2bib.app/Contents/MacOS") + path_option(C2B_INSTALL_DATA_DIR "Data installation directory [default: CMAKE_INSTALL_PREFIX/cb2bib.app/Contents/Resources]." "${CMAKE_INSTALL_PREFIX}/cb2bib.app/Contents/Resources") +endif(APPLE) +if(WIN32) + set(C2B_USE_CBPOLL OFF) + path_option(C2B_INSTALL_BIN_DIR "Executables installation directory [default: CMAKE_INSTALL_PREFIX\cb2bib]." "${CMAKE_INSTALL_PREFIX}\cb2bib") +endif(WIN32) + +if(C2B_USE_LZO) + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/") + find_package(LZO REQUIRED) + include_directories(${LZO_INCLUDE_DIR}) + add_definitions(-DC2B_USE_LZO) +endif(C2B_USE_LZO) +message("-- cb2bib uses QtWebKit library: ${C2B_USE_WEBKIT}") +message("-- cb2bib uses lzo2 library: ${C2B_USE_LZO}") +message("-- cb2bib executables installation directory: ${C2B_INSTALL_BIN_DIR}") +message("-- cb2bib data installation directory: ${C2B_INSTALL_DATA_DIR}") +if(UNIX AND NOT APPLE) + message("-- cb2bib desktop file installation directory: ${C2B_INSTALL_DESKTOP_DIR}") + message("-- cb2bib icon file installation directory: ${C2B_INSTALL_ICON_DIR}") +endif(UNIX AND NOT APPLE) +message("-- Build type: ${CMAKE_BUILD_TYPE}") + +configure_file(${CMAKE_SOURCE_DIR}/src/c2b/cb2bib_conf_parameters.h.in ${CMAKE_CURRENT_BINARY_DIR}/cb2bib_conf_parameters.h @ONLY) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +#------------------------------------------------------------------------------- +# general settings +#------------------------------------------------------------------------------- +cmake_minimum_required(VERSION 2.8.11) +set(CMAKE_COLOR_MAKEFILE ON) +set(CMAKE_VERBOSE_MAKEFILE ON) +set(CB2BIB_MINIMUM_REQUIRED_QT "5.0.0") + +#------------------------------------------------------------------------------- +# build tree structure +#------------------------------------------------------------------------------- +if(WIN32) + subdirs(src/c2b src src/win) +else() + subdirs(src/c2b src) +endif() + +#------------------------------------------------------------------------------- +# installs +#------------------------------------------------------------------------------- +if(UNIX AND NOT APPLE) + install(PROGRAMS c2bscripts/c2bciter DESTINATION ${C2B_INSTALL_BIN_DIR}) + install(PROGRAMS c2bscripts/c2bimport DESTINATION ${C2B_INSTALL_BIN_DIR}) + install(FILES AUTHORS COPYRIGHT LICENSE CHANGELOG DESTINATION ${C2B_INSTALL_DATA_DIR}) + install(DIRECTORY data c2btools testPDFImport DESTINATION ${C2B_INSTALL_DATA_DIR}) + install(FILES c2bscripts/cb2bib.desktop c2bscripts/c2bciter.desktop c2bscripts/c2bimport.desktop DESTINATION ${C2B_INSTALL_DESKTOP_DIR}) + install(FILES src/icons/cb2bib.png DESTINATION ${C2B_INSTALL_ICON_DIR}) +endif(UNIX AND NOT APPLE) +if(APPLE) + install(PROGRAMS ./c2bscripts/c2bciter DESTINATION ${C2B_INSTALL_BIN_DIR}) + install(PROGRAMS ./c2bscripts/c2bimport DESTINATION ${C2B_INSTALL_BIN_DIR}) + install(FILES AUTHORS COPYRIGHT LICENSE CHANGELOG DESTINATION ${C2B_INSTALL_DATA_DIR}) + install(DIRECTORY data c2btools testPDFImport DESTINATION ${C2B_INSTALL_DATA_DIR}) + + set(MACOSX_BUNDLE_BUNDLE_NAME cb2bib) + set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.MOLspaces.cb2Bib") + set(MACOSX_BUNDLE_ICON_FILE src/icons/cb2bib.icns) + set(MACOSX_BUNDLE_INFO_STRING "A tool for rapidly extracting unformatted bibliographic references") + set(MACOSX_BUNDLE_SHORT_VERSION_STRING "1.9") + set(MACOSX_BUNDLE_LONG_VERSION_STRING "1.9.0") + set(MACOSX_BUNDLE_BUNDLE_VERSION "1.9.0") + set(MACOSX_BUNDLE_COPYRIGHT "(C) 2004-2015 Pere Constans") + +### ?? +### set_source_files_properties(${ProjectName_RESOURCES} ${ProjectName_TRANSLATIONS} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) +## +### According to http://cmake.org/Wiki/CMake:Bundles_And_Frameworks, appl1_aux1 and appl1_aux2 would be c2bciter and c2bimport +###/Applications/ +### appl1.app/ +### Contents/ +### Info.plist +### MacOS/ +### appl1 -> appl1-1 +### appl1-1 +### appl1_aux1 +### appl1_aux2 +### Resources/ +### appl1_res1 +### appl1_res2 +## +## # are they set as executable ? how if orig files were executable already ? are they seen as execs from the gui ? +## set_source_files_properties(c2bscripts/c2bciter c2bscripts/c2bimport PROPERTIES MACOSX_PACKAGE_LOCATION MacOS) +## # is this correct ? how about data c2btools testPDFImport directories ? +## set_source_files_properties(AUTHORS COPYRIGHT LICENSE CHANGELOG PROPERTIES MACOSX_PACKAGE_LOCATION Resources) +## # need this to copy icon ? +## set_source_files_properties(MACOSX_BUNDLE_ICON_FILE PROPERTIES MACOSX_PACKAGE_LOCATION Resources) + +endif(APPLE) +if(WIN32) +endif(WIN32) + +#------------------------------------------------------------------------------- \ No newline at end of file diff -Nru cb2bib-1.4.9/configure cb2bib-1.9.2/configure --- cb2bib-1.4.9/configure 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/configure 2015-08-09 19:52:56.000000000 +0000 @@ -164,14 +164,14 @@ echo "-----------------------------------------------------------------------" echo "cb2Bib Info:" echo "-----------------------------------------------------------------------" -echo "- This version requires Qt 4.4.0 or later." +echo "- This version requires Qt 5.0.0 or later." echo " " echo "- Set the environment variable QTDIR if this script cannot determine" echo " the right Qt qmake." echo "- QTDIR will only be used during configuration; it can later be reset" echo " to its original value." echo " " -echo "- Alternatively, set Qt 4.4 qmake's fullpath name with" +echo "- Alternatively, set Qt 5.0 qmake's fullpath name with" echo " --qmakepath flag." echo "-----------------------------------------------------------------------" @@ -191,8 +191,8 @@ echo "Environment variable QTDIR not set, checking elsewhere for qmake..." echo -n "Checking for qmake tool... " if test "$f_qmake" = NO; then - qmake_name="qmake" - qmake_dirs="/usr/lib64/qt4/bin:/usr/lib/qt4/bin:/usr/bin:/usr/lib/qt/bin:/usr/share/qt/bin:/Developer/Tools/Qt:$PATH" + qmake_name="qmake-qt5" + qmake_dirs="/usr/bin:/usr/lib64/qt5/bin:/usr/lib/qt5/bin:/usr/bin:/usr/lib/qt/bin:/usr/share/qt/bin:/Developer/Tools/Qt:$PATH" qmake_prog=NO IFS=: for j in $qmake_dirs; do diff -Nru cb2bib-1.4.9/COPYRIGHT cb2bib-1.9.2/COPYRIGHT --- cb2bib-1.4.9/COPYRIGHT 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/COPYRIGHT 2015-08-09 19:52:56.000000000 +0000 @@ -1,4 +1,4 @@ -The cb2Bib. Copyright (C) 2004-2012 by Pere Constans +The cb2Bib. Copyright (C) 2004-2015 by Pere Constans The cb2Bib includes third party GPL and LGPL code that is copyrighted by others: @@ -7,11 +7,7 @@ - Function citeToLyXPipe is adapted from work by Robby Stephenson, 2005 -- Function updateUserTimestamp from KDE libraries, by Matthias K. Dalheimer, 1997 - -- Class EQRegExp is based on work by Trolltech ASA, 2008 - -- Class QtSingleApplication by Nokia Corporation, 2009 +- Class QtSingleApplication by Digia Plc, 2013 - Icons come from the Oxygen, Crystal SVG, and Noia icon sets, published by the KDE Desktop Environment. diff -Nru cb2bib-1.4.9/data/netqinf.txt cb2bib-1.9.2/data/netqinf.txt --- cb2bib-1.4.9/data/netqinf.txt 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/data/netqinf.txt 2015-08-09 19:52:56.000000000 +0000 @@ -15,23 +15,22 @@ # Bookmark Examples: bookmark=PubMed Citation Finder|http://www.ncbi.nlm.nih.gov/pubmed/citmatch bookmark=HighWire Press -- Search|http://highwire.stanford.edu/cgi/search/ -bookmark=DBLP Bibliography|http://www.informatik.uni-trier.de/~ley/db/indices/query.html +bookmark=DBLP Bibliography|http://dblp.org/search/ bookmark=arXiv.org e-Print archive|http://arxiv.org/ bookmark=CiteSeerX|http://citeseerx.ist.psu.edu/ -bookmark=Directory of Open Access Journals|http://www.doaj.org/home +bookmark=Directory of Open Access Journals|http://doaj.org/search bookmark=PLoS - The Public Library of Science|http://www.plos.org/ -bookmark=OAIster|http://www.oaister.org/ -bookmark=Scirus|http://www.scirus.com/srsapp/advanced/index.jsp +bookmark=OAIster|http://www.oclc.org/oaister.en.html bookmark=Search ACS Publications|http://pubs.acs.org/search/advanced -bookmark=Google Scholar|http://scholar.google.com/ +bookmark=Google Scholar|https://scholar.google.com/ bookmark= | bookmark=Search arXiv for selected text|http://search.arxiv.org:8081/?query=<> bookmark=Search Citebase for Authors|http://www.citebase.org/search?type=metadata&maxrows=10&author=<>&submitted=Search bookmark=Search CiteSeerX for Title|http://citeseerx.ist.psu.edu/search?q=title%3A<>&sort=cite -bookmark=Search PubMed for Title|http://www.ncbi.nlm.nih.gov/sites/entrez?orig_db=PubMed&db=pubmed&cmd=Search&TransSchema=title&term=<<title>> -bookmark=Search PubMed for DOI|http://www.ncbi.nlm.nih.gov/sites/entrez?orig_db=PubMed&db=PubMed&cmd=Search&term=<<doi>> -bookmark=Search Google for literal Title|http://www.google.com/search?ie=UTF-8&q=%22<<title>>%22 -bookmark=Search Scholar for literal Title|http://scholar.google.com/scholar?ie=UTF-8&q=%22<<title>>%22 +bookmark=Search PubMed for Title|http://www.ncbi.nlm.nih.gov/pubmed?term=<<title>> +bookmark=Search PubMed for DOI|http://www.ncbi.nlm.nih.gov/pubmed?term=<<doi>> +bookmark=Search Google for literal Title|https://www.google.com/search?ie=UTF-8&q=%22<<title>>%22 +bookmark=Search Scholar for literal Title|https://scholar.google.com/scholar?ie=UTF-8&q=%22<<title>>%22 bookmark=Search Crossref for Journal + Volume + Page|http://www.crossref.org/guestquery/?search_type=journal&auth=&issn=&title=<<journal>>&art_title=&volume=<<volume>>&page=<<pages>>&isbn=&comp_num=&series_title=&multi_hit=on&view_records=Search bookmark=Search ISBN Database|http://isbndb.com/search-all.html?kw=<<isbn>> bookmark=Open DOI Document|http://dx.doi.org/<<doi>> @@ -115,7 +114,7 @@ # QUERY INFO FOR PNAS (Volume and Page) # Extracts BibTeX reference and article PDF file journal=Proceedings of the National Academy of Sciences of the United States of America| -query=http://www.pnas.org/search?submit=yes&submit=Submit&pubdate_year=&volume=<<volume>>&firstpage=<<pages>>&doi=&author1=&author2=&title=&andorexacttitle=and&titleabstract=&andorexacttitleabs=and&fulltext=&andorexactfulltext=and&fmonth=Jan&fyear=1915&tmonth=Jul&tyear=2012&tocsectionid=all&format=standard&hits=10&sortspec=relevance&submit=yes +query=http://www.pnas.org/search?submit=yes&submit=Submit&pubdate_year=&volume=<<volume>>&firstpage=<<pages>>&doi=&author1=&author2=&title=&andorexacttitle=and&titleabstract=&andorexacttitleabs=and&fulltext=&andorexactfulltext=and&fmonth=Jan&fyear=1915&tmonth=Jul&tyear=2015&tocsectionid=all&format=standard&hits=10&sortspec=relevance&submit=yes capture_from_query=/content/(.+)\.(extract|abstract|full) referenceurl_prefix=http://www.pnas.org/citmgr?type=bibtex&gca=pnas; referenceurl_sufix= @@ -193,7 +192,7 @@ # Extracts Medline reference # Blank journal meaning 'any journal name' journal= -query=http://www.ncbi.nlm.nih.gov/sites/entrez?orig_db=PubMed&db=PubMed&cmd=Search&term=<<doi>>[doi] +query=http://www.ncbi.nlm.nih.gov/pubmed?term=<<doi>> capture_from_query=\bPMID:\D{1,10}(\d+)\D referenceurl_prefix=http://www.ncbi.nlm.nih.gov/pubmed/ referenceurl_sufix=?report=xml&format=text @@ -227,7 +226,7 @@ # Extracts Medline reference journal=Proteins: Structure, Function, and Bioinformatics|Proteins journal=Proteins: Structure, Function, and Genetics|Proteins -query=http://www.ncbi.nlm.nih.gov/sites/entrez?orig_db=PubMed&db=PubMed&cmd=Search&term=<<journal>>[Jour]+AND+<<volume>>[volume]+AND+<<pages>>[page] +query=http://www.ncbi.nlm.nih.gov/pubmed?term=<<journal>>[Jour]+AND+<<volume>>[volume]+AND+<<pages>>[page] capture_from_query=\bPMID:\D{1,10}(\d+)\D referenceurl_prefix=http://www.ncbi.nlm.nih.gov/pubmed/ referenceurl_sufix=?report=xml&format=text @@ -239,7 +238,7 @@ # Extracts Medline reference # Blank journal meaning 'any journal name' journal= -query=http://www.ncbi.nlm.nih.gov/sites/entrez?orig_db=PubMed&db=PubMed&cmd=Search&term=<<journal>>[Jour]+AND+<<volume>>[volume]+AND+<<pages>>[page] +query=http://www.ncbi.nlm.nih.gov/pubmed?term=<<journal>>[Jour]+AND+<<volume>>[volume]+AND+<<pages>>[page] capture_from_query=\bPMID:\D{1,10}(\d+)\D referenceurl_prefix=http://www.ncbi.nlm.nih.gov/pubmed/ referenceurl_sufix=?report=xml&format=text @@ -291,7 +290,7 @@ journal=Organic Letters|orlef7 journal=Organic Process Research and Development|oprdfk journal=Organometallics|orgnd7 -query=http://pubs.acs.org/action/quickLink?quickLinkJournal=<<journal>>&quickLinkVolume=<<volume>>&quickLinkPage=<<pages>> +query=http://pubs.acs.org/action/quickLink?quickLinkJournal=<<journal>>&quickLinkVolume=<<volume>>&quickLinkPage=<<pages>>&cookieSet=1 capture_from_query= referenceurl_prefix= referenceurl_sufix= @@ -328,7 +327,7 @@ # Uses <<post>> http method journal= query=<<post>>http://www.crossref.org/guestquery?search_type=journal&auth=&issn=&title=<<journal>>&art_title=&volume=<<volume>>&issue=&page=<<pages>>%20&year=&isbn=&comp_num=&series_title=&multi_hit=on&view_records=Search&queryType=bibsearch -capture_from_query=doi:(.+)</a> +capture_from_query=>\s*http://dx\.doi\.org/(.+)</a> referenceurl_prefix=http://dx.doi.org/ referenceurl_sufix= pdfurl_prefix= @@ -339,7 +338,7 @@ # Extracts Medline reference # Uses <<title>> tag journal= -query=http://www.ncbi.nlm.nih.gov/sites/entrez?orig_db=PubMed&db=pubmed&cmd=Search&TransSchema=title&term=<<title>> +query=http://www.ncbi.nlm.nih.gov/pubmed?term=<<title>> capture_from_query=\bPMID:\D{1,10}(\d+)\D referenceurl_prefix=http://www.ncbi.nlm.nih.gov/pubmed/ referenceurl_sufix=?report=xml&format=text @@ -350,7 +349,7 @@ # QUERY INFO FOR Google Scholar # Uses <<excerpt>> tag journal= -query=http://scholar.google.com/scholar?hl=en&lr=&ie=UTF-8&q=<<excerpt>>&btnG=Search +query=https://scholar.google.com/scholar?hl=en&lr=&ie=UTF-8&q=<<excerpt>>&btnG=Search capture_from_query= referenceurl_prefix= referenceurl_sufix= @@ -360,9 +359,9 @@ # QUERY INFO FOR Google Scholar journal= -query=http://scholar.google.com/scholar?hl=en&lr=&ie=UTF-8&q=<<doi>>&btnG=Search +query=https://scholar.google.com/scholar?hl=en&lr=&ie=UTF-8&q=<<doi>>&btnG=Search capture_from_query=info:(\w+):scholar -referenceurl_prefix=http://scholar.google.com/scholar.bib?hl=en&lr=&ie=UTF-8&q=info: +referenceurl_prefix=https://scholar.google.com/scholar.bib?hl=en&lr=&ie=UTF-8&q=info: referenceurl_sufix=:scholar.google.com/&output=citation&oe=ASCII&oi=citation pdfurl_prefix= pdfurl_sufix= @@ -371,9 +370,9 @@ # QUERY INFO FOR Google Scholar # Uses <<excerpt>> tag journal= -query=http://scholar.google.com/scholar?hl=en&lr=&ie=UTF-8&q=<<excerpt>>&btnG=Search +query=https://scholar.google.com/scholar?hl=en&lr=&ie=UTF-8&q=<<excerpt>>&btnG=Search capture_from_query=info:(\w+):scholar -referenceurl_prefix=http://scholar.google.com/scholar.bib?hl=en&lr=&ie=UTF-8&q=info: +referenceurl_prefix=https://scholar.google.com/scholar.bib?hl=en&lr=&ie=UTF-8&q=info: referenceurl_sufix=:scholar.google.com/&output=citation&oe=ASCII&oi=citation pdfurl_prefix= pdfurl_sufix= diff -Nru cb2bib-1.4.9/data/references-idea.css cb2bib-1.9.2/data/references-idea.css --- cb2bib-1.4.9/data/references-idea.css 1970-01-01 00:00:00.000000000 +0000 +++ cb2bib-1.9.2/data/references-idea.css 2015-08-09 19:58:26.137737274 +0000 @@ -0,0 +1,69 @@ +/* cb2Bib References CSS */ + +/* general */ + +body { +font-size: 100%; +font-family: sans-serif; +background-color: #B7B096; +color: #000000; +padding: 0; +margin: 0; +} + +a { +color: #670000; +text-decoration: none; +} + +a:link { +color: #670000; +text-decoration: underline; +} + +h1 +{ +color: #000000; +font-size: 20px; +font-variant: small-caps; +font-family: sans-serif; +} + +/* references */ + +#references{ +background-color: #AAA58C; +} + +#references blockquote{ +font-size: small; +} + +#references span{ +color: #800000; +/* font-weight: bold; */ +} + +#excerpt{ +font-style: italic; +} + +/* header */ + +#header { +vertical-align: middle; +} + +/* footer */ + +#footer { +color: #000000; +font-family: arial, sans-serif; +font-size: small; +} + +#footer td{ +padding: 10px; +padding-left: 5px; +padding-right: 5px; +} diff -Nru cb2bib-1.4.9/data/regexps.txt cb2bib-1.9.2/data/regexps.txt --- cb2bib-1.4.9/data/regexps.txt 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/data/regexps.txt 2015-08-09 19:52:56.000000000 +0000 @@ -80,7 +80,7 @@ PDF Import Example article journal volume pages year title author abstract -^(Ars Magna), (\d+), ([\d|\-|\s]+), (\d\d\d\d)<NewLine1><NewLine2>(.+)<NewLine3>(.+)<NewLine4><NewLine5>I\.<NewLine6><NewLine7>SUMMARY<NewLine8><NewLine9>(.+)<NewLine10>.+$ +^(Ars Magna), (\d+), ([\d\-–\s]+), (\d\d\d\d)<NewLine1>(.+)<NewLine3>(.+)<NewLine5>.+SUMMARY(.+)<NewLine13>.+$ # cb2Bib 0.8.1 Pattern: Example with Multiple Author Sets diff -Nru cb2bib-1.4.9/debian/cb2bib.lintian-overrides cb2bib-1.9.2/debian/cb2bib.lintian-overrides --- cb2bib-1.4.9/debian/cb2bib.lintian-overrides 2014-08-18 13:07:37.000000000 +0000 +++ cb2bib-1.9.2/debian/cb2bib.lintian-overrides 2015-08-17 13:21:57.000000000 +0000 @@ -1,3 +1,4 @@ cb2bib binary: spelling-error-in-binary - - +cb2bib binary: hardening-no-relro +cb2bib binary: hardening-no-fortify-functions +cb2bib binary: binary-without-manpage diff -Nru cb2bib-1.4.9/debian/changelog cb2bib-1.9.2/debian/changelog --- cb2bib-1.4.9/debian/changelog 2014-08-18 13:07:37.000000000 +0000 +++ cb2bib-1.9.2/debian/changelog 2015-08-17 13:21:57.000000000 +0000 @@ -1,3 +1,20 @@ +cb2bib (1.9.2-1) unstable; urgency=medium + + * New upstream version (port to QT5; uses qmake and not cmake as of this + version); + * debian/control: Standards-Version: 3.9.6 (no changes needed). Add + qt5-default to Build-Depends so that qmake is found. + + * debian/control: Change all build depends to new QT5-related package + names and add support for lzo; + + * debian/rules: call qmake instead of cmake and fix call to rm in rule + override_dh_clean; + + * debian/patches: add patch to security-harden the binary. + + -- Filippo Rusconi <lopippo@debian.org> Mon, 17 Aug 2015 10:20:21 +0200 + cb2bib (1.4.9-4) unstable; urgency=medium * mv upstream upstream/metadata; diff -Nru cb2bib-1.4.9/debian/control cb2bib-1.9.2/debian/control --- cb2bib-1.4.9/debian/control 2014-08-18 13:07:37.000000000 +0000 +++ cb2bib-1.9.2/debian/control 2015-08-17 13:21:57.000000000 +0000 @@ -3,8 +3,17 @@ Priority: optional Maintainer: Debian Science Maintainers <debian-science-maintainers@lists.alioth.debian.org> Uploaders: Filippo Rusconi <lopippo@debian.org> -Build-Depends: debhelper (>= 9), libx11-dev, x11proto-core-dev, libqt4-dev (>=4.4), libqtwebkit-dev (>=2.1.0~2011week09), cmake (>=2.6.0), imagemagick -Standards-Version: 3.9.5 +Build-Depends: debhelper (>= 9), + libx11-dev, + x11proto-core-dev, + qtchooser, + qtbase5-dev, + libqt5webkit5-dev, + libqt5x11extras5-dev, + qt5-qmake, + imagemagick, + liblzo2-dev +Standards-Version: 3.9.6 Homepage: http://www.molspaces.com/cb2bib/ Vcs-Git: git://anonscm.debian.org/debian-science/packages/cb2bib.git Vcs-Browser: http://anonscm.debian.org/git/debian-science/packages/cb2bib.git @@ -12,7 +21,13 @@ Package: cb2bib Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} -Suggests: libimage-exiftool-perl, konqueror, poppler-utils | xpdf-utils, bibutils, jsmath, texlive-latex-base, texlive-base-bin +Suggests: libimage-exiftool-perl, + konqueror, + poppler-utils, + bibutils, + jsmath, + texlive-latex-base, + texlive-binaries Description: extract bibliographic references from various sources cb2bib is a program to extract bibliographic references from unformatted and non standard sources, like: diff -Nru cb2bib-1.4.9/debian/patches/fix-keywords-desktop-files.patch cb2bib-1.9.2/debian/patches/fix-keywords-desktop-files.patch --- cb2bib-1.4.9/debian/patches/fix-keywords-desktop-files.patch 2014-08-18 13:07:37.000000000 +0000 +++ cb2bib-1.9.2/debian/patches/fix-keywords-desktop-files.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -Fix missing keywords for two c2bscripts/*.desktop files. -diff --git a/c2bscripts/c2bciter.desktop b/c2bscripts/c2bciter.desktop -index 3237e9e..6de23ff 100644 ---- a/c2bscripts/c2bciter.desktop -+++ b/c2bscripts/c2bciter.desktop -@@ -12,3 +12,4 @@ StartupNotify=false - Terminal=false - Categories=Office; - Type=Application -+Keywords=bibliography,citations,scientific articles -diff --git a/c2bscripts/cb2bib.desktop b/c2bscripts/cb2bib.desktop -index cc4dfb1..8e4223c 100644 ---- a/c2bscripts/cb2bib.desktop -+++ b/c2bscripts/cb2bib.desktop -@@ -12,3 +12,4 @@ StartupNotify=true - Terminal=false - Categories=Office; - Type=Application -+Keywords=bibliography,citations,scientific articles diff -Nru cb2bib-1.4.9/debian/patches/hardening-rules.patch cb2bib-1.9.2/debian/patches/hardening-rules.patch --- cb2bib-1.4.9/debian/patches/hardening-rules.patch 1970-01-01 00:00:00.000000000 +0000 +++ cb2bib-1.9.2/debian/patches/hardening-rules.patch 2015-08-17 13:21:57.000000000 +0000 @@ -0,0 +1,20 @@ +Patch to implement the hardening rules as defined by Debian +diff --git a/src/src.pro b/src/src.pro +index 6450fa5..48378a2 100644 +--- a/src/src.pro ++++ b/src/src.pro +@@ -211,3 +211,14 @@ macx { + # Set Library data + # QMAKE_BUNDLE_DATA += externtools + } ++ ++# Addition by FRusconi <lopippo@debian.org> to security-harden the ++# binary. ++ ++QMAKE_CPPFLAGS *= $$system(dpkg-buildflags --get CPPFLAGS) ++QMAKE_CFLAGS *= $$system(dpkg-buildflags --get CFLAGS) ++QMAKE_CXXFLAGS *= $$system(dpkg-buildflags --get CXXFLAGS) ++ ++message($$QMAKE_CPPFLAGS) ++message($$QMAKE_CFLAGS) ++message($$QMAKE_CXXFLAGS) diff -Nru cb2bib-1.4.9/debian/patches/series cb2bib-1.9.2/debian/patches/series --- cb2bib-1.4.9/debian/patches/series 2014-08-18 13:07:37.000000000 +0000 +++ cb2bib-1.9.2/debian/patches/series 2015-08-17 13:21:57.000000000 +0000 @@ -1,2 +1 @@ -typo-error.patch -fix-keywords-desktop-files.patch +hardening-rules.patch diff -Nru cb2bib-1.4.9/debian/patches/typo-error.patch cb2bib-1.9.2/debian/patches/typo-error.patch --- cb2bib-1.4.9/debian/patches/typo-error.patch 2014-08-18 13:07:37.000000000 +0000 +++ cb2bib-1.9.2/debian/patches/typo-error.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -Fix for a typo error in a .desktop file. -diff --git a/c2bscripts/c2bimport.desktop b/c2bscripts/c2bimport.desktop -index ebc02ff..3ce8255 100644 ---- a/c2bscripts/c2bimport.desktop -+++ b/c2bscripts/c2bimport.desktop -@@ -1,5 +1,5 @@ - [Desktop Entry] --Comment=Donwload reference to cb2Bib -+Comment=Download reference to cb2Bib - Comment[ca]=Importa referència al cb2Bib - Exec=cb2bib --import %f - GenericName=cb2Bib Import Reference diff -Nru cb2bib-1.4.9/debian/rules cb2bib-1.9.2/debian/rules --- cb2bib-1.4.9/debian/rules 2014-08-18 13:07:37.000000000 +0000 +++ cb2bib-1.9.2/debian/rules 2015-08-17 13:21:57.000000000 +0000 @@ -8,11 +8,10 @@ dh $@ --parallel override_dh_auto_configure: - mkdir -p $(BUILDDIR) - cd $(BUILDDIR) && cmake \ - -D C2B_USE_LZO=0 \ - -D CMAKE_INSTALL_PREFIX=/usr \ - ../../ + mkdir -p $(BUILDDIR) && \ + cp -rpf c2bscripts c2btools cb2bib.pro cb2bib.rc data src testPDFImport xpdf $(BUILDDIR) && \ + cd $(BUILDDIR) && \ + qtchooser -run-tool=qmake -qt=5 ../../ debian/cb2bib.xpm: src/icons/cb2bib.png convert src/icons/cb2bib.png -resize 32x32 debian/cb2bib.xpm @@ -22,6 +21,6 @@ override_dh_clean: dh_clean - -rm -r $(BUILDDIR) + -rm -rf $(BUILDDIR) diff -Nru cb2bib-1.4.9/qmake/cb2bib-osx.pro cb2bib-1.9.2/qmake/cb2bib-osx.pro --- cb2bib-1.4.9/qmake/cb2bib-osx.pro 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/qmake/cb2bib-osx.pro 1970-01-01 00:00:00.000000000 +0000 @@ -1,265 +0,0 @@ -###################################################################### -# qmake file for macos -# Contributed by J. Ralls, June 2011 -# -# 1) run 'qmake -project -r' to create .pro skeleton -# 2) edit to match other settings from old .pro file -# 3) run 'qmake -spec macx-xcode' to create a xcodeproj file -# -###################################################################### - -TEMPLATE = app -TARGET = cb2bib -DEPENDPATH += . src src/c2b src/c2b/qtregexp src/qtsingleapplication/src -INCLUDEPATH += . src src/c2b src/qtsingleapplication/src src/c2b/qtregexp - -# Input -HEADERS += src/bookmarkPlugin.h \ - src/c2b.h \ - src/c2bAnnote.h \ - src/c2bBibHighlighter.h \ - src/c2bBibMenu.h \ - src/c2bBibParser.h \ - src/c2bBibPreparserLog.h \ - src/c2bCiter.h \ - src/c2bCiterModel.h \ - src/c2bCiterView.h \ - src/c2bClipboard.h \ - src/c2bClipEdit.h \ - src/c2bColors.h \ - src/c2bComboBox.h \ - src/c2bConfigure.h \ - src/c2bConfigureFR.h \ - src/c2bConsole.h \ - src/c2bCoreCiter.h \ - src/c2bEditor.h \ - src/c2bExport.h \ - src/c2bExportDialog.h \ - src/c2bFileDialog.h \ - src/c2bHighlighter.h \ - src/c2bIdLineEdit.h \ - src/c2bLineEdit.h \ - src/c2bNetworkQuery.h \ - src/c2bNetworkQueryInfo.h \ - src/c2bPdfImport.h \ - src/c2bPostprocess.h \ - src/c2bReferenceList.h \ - src/c2bREHighlighter.h \ - src/c2bRLWebSearchSettings.h \ - src/c2bSaveRegExp.h \ - src/c2bSaveREHighlighter.h \ - src/c2bSearchInFiles.h \ - src/c2bSearchInFilesPattern.h \ - src/c2bSettings.h \ - src/c2bShortcutPushButton.h \ - src/c2bShortcutWidget.h \ - src/c2bTests.h \ - src/c2bTextBrowser.h \ - src/c2bTextEdit.h \ - src/c2bUpdateMetadata.h \ - src/c2bUtils.h \ - src/c2bWebBrowser.h \ - src/cb2Bib.h \ - src/findDialog.h \ - src/c2b/approximatePattern.h \ - src/c2b/authorString.h \ - src/c2b/bibExtractor.h \ - src/c2b/bibParser.h \ - src/c2b/bibPreparser.h \ - src/c2b/bibReference.h \ - src/c2b/bibSearcher.h \ - src/c2b/cb2bib_parameters.h \ - src/c2b/cb2bib_utilities.h \ - src/c2b/compositePattern.h \ - src/c2b/coreBibParser.h \ - src/c2b/document.h \ - src/c2b/documentCache.h \ - src/c2b/documentContents.h \ - src/c2b/heuristicBibParser.h \ - src/c2b/idMaker.h \ - src/c2b/journalDB.h \ - src/c2b/metadataParser.h \ - src/c2b/monthDB.h \ - src/c2b/network.h \ - src/c2b/networkQuery.h \ - src/c2b/preprocess.h \ - src/c2b/pubmedXml.h \ - src/c2b/searchPattern.h \ - src/c2b/settings.h \ - src/c2b/substringMatcher.h \ - src/c2b/texParser.h \ - src/c2b/texToHtml.h \ - src/c2b/triads.h \ - src/c2b/wordMatcher.h \ - src/c2b/wordPattern.h \ - src/c2b/qtregexp/eqregexp.h \ - src/qtsingleapplication/src/qtlocalpeer.h \ - src/qtsingleapplication/src/qtlockedfile.h \ - src/qtsingleapplication/src/qtsingleapplication.h \ - src/qtsingleapplication/src/qtsinglecoreapplication.h \ - src/qtsingleapplication/src/qtlockedfile.cpp \ - src/qtsingleapplication/src/qtlockedfile_win.cpp \ - src/qtsingleapplication/src/qtlockedfile_unix.cpp -FORMS += src/c2bCiter.ui \ - src/c2bConfigure.ui \ - src/c2bConfigureFR.ui \ - src/c2bEditor.ui \ - src/c2bExportDialog.ui \ - src/c2bLogWidget.ui \ - src/c2bPdfImport.ui \ - src/c2bReferenceList.ui \ - src/c2bRLWebSearchSettings.ui \ - src/c2bSaveRegExp.ui \ - src/c2bSearchInFiles.ui \ - src/c2bSearchInFilesPattern.ui \ - src/c2bSearchInFilesPatternEdit.ui \ - src/c2bShortcutWidget.ui \ - src/cb2Bib.ui \ - src/findDialog.ui \ - src/proxyDialog.ui -SOURCES += src/bookmarkPlugin.cpp \ - src/c2b.cpp \ - src/c2bAnnote.cpp \ - src/c2bBibHighlighter.cpp \ - src/c2bBibMenu.cpp \ - src/c2bBibParser.cpp \ - src/c2bBibPreparserLog.cpp \ - src/c2bCiter.cpp \ - src/c2bCiterModel.cpp \ - src/c2bCiterView.cpp \ - src/c2bClipboard.cpp \ - src/c2bClipEdit.cpp \ - src/c2bColors.cpp \ - src/c2bComboBox.cpp \ - src/c2bConfigure.cpp \ - src/c2bConfigureFR.cpp \ - src/c2bConsole.cpp \ - src/c2bCoreCiter.cpp \ - src/c2bEditor.cpp \ - src/c2bExport.cpp \ - src/c2bExportDialog.cpp \ - src/c2bFileDialog.cpp \ - src/c2bHighlighter.cpp \ - src/c2bIdLineEdit.cpp \ - src/c2bLineEdit.cpp \ - src/c2bNetworkQuery.cpp \ - src/c2bNetworkQueryInfo.cpp \ - src/c2bPdfImport.cpp \ - src/c2bPostprocess.cpp \ - src/c2bReferenceList.cpp \ - src/c2bREHighlighter.cpp \ - src/c2bRLWebSearchSettings.cpp \ - src/c2bSaveRegExp.cpp \ - src/c2bSaveREHighlighter.cpp \ - src/c2bSearchInFiles.cpp \ - src/c2bSearchInFilesPattern.cpp \ - src/c2bSettings.cpp \ - src/c2bShortcutPushButton.cpp \ - src/c2bShortcutWidget.cpp \ - src/c2bTests.cpp \ - src/c2bTextBrowser.cpp \ - src/c2bTextEdit.cpp \ - src/c2bUpdateMetadata.cpp \ - src/c2bUtils.cpp \ - src/c2bWebBrowser.cpp \ - src/cb2Bib.cpp \ - src/findDialog.cpp \ - src/main.cpp \ - src/c2b/approximatePattern.cpp \ - src/c2b/authorString.cpp \ - src/c2b/bibExtractor.cpp \ - src/c2b/bibParser.cpp \ - src/c2b/bibPreparser.cpp \ - src/c2b/bibSearcher.cpp \ - src/c2b/cb2bib_utilities.cpp \ - src/c2b/compositePattern.cpp \ - src/c2b/coreBibParser.cpp \ - src/c2b/document.cpp \ - src/c2b/documentCache.cpp \ - src/c2b/heuristicBibParser.cpp \ - src/c2b/idMaker.cpp \ - src/c2b/journalDB.cpp \ - src/c2b/metadataParser.cpp \ - src/c2b/monthDB.cpp \ - src/c2b/network.cpp \ - src/c2b/networkQuery.cpp \ - src/c2b/preprocess.cpp \ - src/c2b/pubmedXml.cpp \ - src/c2b/searchPattern.cpp \ - src/c2b/settings.cpp \ - src/c2b/substringMatcher.cpp \ - src/c2b/texParser.cpp \ - src/c2b/texToHtml.cpp \ - src/c2b/triads.cpp \ - src/c2b/wordMatcher.cpp \ - src/c2b/wordPattern.cpp \ - src/c2b/qtregexp/eqregexp.cpp \ - src/qtsingleapplication/src/qtlocalpeer.cpp \ - src/qtsingleapplication/src/qtlockedfile.cpp \ - src/qtsingleapplication/src/qtlockedfile_unix.cpp \ - src/qtsingleapplication/src/qtlockedfile_win.cpp \ - src/qtsingleapplication/src/qtsingleapplication.cpp \ - src/qtsingleapplication/src/qtsinglecoreapplication.cpp - -win32 { - SOURCES += src/win/main.cpp - RC_FILE = cb2bib.rc - DEPEND += src/win -} - -unix:!macx { - !disable_cbpoll { - HEADERS += src/clipboardPoll.h - SOURCES += src/clipboardPoll.cpp - DEFINES += C2B_USE_CBPOLL - } - INSTALLS += target script cb2bibdata icons desktop - target.path = /usr/bin - script.files += c2bscripts/c2bimport c2bscripts/c2bciter - script.path = /usr/bin - script.extra = chmod +x c2bscripts/c2bimport; chmod +x c2bscripts/c2bciter - desktop.files += c2bscripts/cb2bib.desktop c2bscripts/c2bciter.desktop c2bscripts/c2bimport.desktop - desktop.path = /usr/share/applications - icons.files += src/icons/cb2bib.png - icons.path = /usr/share/pixmaps - cb2bibdata.files += AUTHORS COPYRIGHT LICENSE CHANGELOG data c2btools testPDFImport - cb2bibdata.path = /usr/share/cb2bib -} -macx { - ICON = src/icons/cb2bib.icns - INSTALLS += target script cb2bibdata - script.files += c2bscripts/c2bimport c2bscripts/c2bciter - script.extra = chmod +x c2bscripts/c2bimport; chmod +x c2bscripts/c2bciter - cb2bibdata.files += AUTHORS COPYRIGHT LICENSE CHANGELOG data c2btools testPDFImport - cb2bibdata.path = Contents/Resources - QMAKE_BUNDLE_DATA += script cb2bibdata -# Set this directory if third party tools, like pdftotext are packaged -# INSTALLS += externtools -# externtools.files += -# externtools.path = c2bExternTools -# Set Library data -# QMAKE_BUNDLE_DATA += externtools - -} - -RESOURCES += src/cb2bib.qrc src/c2b/c2blib.qrc -TEMPLATE = app -QT += network webkit -CONFIG += -!macx { - LIBS += -lc2b - LIBPATH += . -} -INCLUDEPATH += c2b . -DEFINES += C2B_USE_QMAKE -QTVERSION = $$[QT_VERSION] -contains(QTVERSION, 4\.3.*) { - message(Using Qt < 4.4 --> Added xml libs) - QT += xml -} else { - exists($$[QT_INSTALL_HEADERS]/QtWebKit/qwebview.h) { - message(Using Qt > 4.4 --> Added webkit libs) - QT += webkit - CONFIG += use_webkit - } -} diff -Nru cb2bib-1.4.9/src/bookmarkPlugin.cpp cb2bib-1.9.2/src/bookmarkPlugin.cpp --- cb2bib-1.4.9/src/bookmarkPlugin.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/bookmarkPlugin.cpp 2015-08-09 19:58:26.141737234 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "bookmarkPlugin.h" @@ -16,7 +16,7 @@ bookmarkPlugin::bookmarkPlugin(QWidget* parentw) : QMenu(parentw) { setObjectName(QString::fromUtf8("menuBookmarks")); - setTitle(QApplication::translate("c2bEditor", "&Bookmarks", 0, QApplication::UnicodeUTF8)); + setTitle(QApplication::translate("c2bEditor", "&Bookmarks", 0)); connect(c2bSettingsP, SIGNAL(newSettings()), this, SLOT(init())); _fsw = new QFileSystemWatcher(this); connect(_fsw, SIGNAL(fileChanged(const QString&)), this, SLOT(parseBookmarks())); diff -Nru cb2bib-1.4.9/src/bookmarkPlugin.h cb2bib-1.9.2/src/bookmarkPlugin.h --- cb2bib-1.4.9/src/bookmarkPlugin.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/bookmarkPlugin.h 2015-08-09 19:58:26.227736370 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef BOOKMARKPLUGIN_H @@ -18,7 +18,7 @@ Q_OBJECT public: - bookmarkPlugin(QWidget* parentw = 0); + explicit bookmarkPlugin(QWidget* parentw = 0); ~bookmarkPlugin(); diff -Nru cb2bib-1.4.9/src/c2b/approximatePattern.cpp cb2bib-1.9.2/src/c2b/approximatePattern.cpp --- cb2bib-1.4.9/src/c2b/approximatePattern.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/approximatePattern.cpp 2015-08-09 19:58:26.305735587 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. * * Class implementation of the approximate search algorithm diff -Nru cb2bib-1.4.9/src/c2b/approximatePattern.h cb2bib-1.9.2/src/c2b/approximatePattern.h --- cb2bib-1.4.9/src/c2b/approximatePattern.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/approximatePattern.h 2015-08-09 19:58:26.360735035 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. * * Class implementation of the approximate search algorithm diff -Nru cb2bib-1.4.9/src/c2b/authorString.cpp cb2bib-1.9.2/src/c2b/authorString.cpp --- cb2bib-1.4.9/src/c2b/authorString.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/authorString.cpp 2015-08-09 19:58:26.307735567 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "authorString.h" diff -Nru cb2bib-1.4.9/src/c2b/authorString.h cb2bib-1.9.2/src/c2b/authorString.h --- cb2bib-1.4.9/src/c2b/authorString.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/authorString.h 2015-08-09 19:58:26.361735025 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef AUTHORSTRING_H @@ -79,7 +79,7 @@ struct encoder { encoder() {} - encoder(const QString& str) + explicit encoder(const QString& str) { encode(str); } @@ -93,7 +93,7 @@ fragments.clear(); } void encode(const QString& raw); - void scape(const int pos, const int length, const QChar c = ' ') + void scape(const int pos, const int length, const QChar c = QChar(' ')) { const int pos0(qMax(pos, 0)); const int posn(qMin(pos0 + length, code.length())); @@ -101,7 +101,7 @@ if (code.at(i) != 'L') code[i] = c; } - void scapePattern(const QString& pattern, const QChar c = ' ') + void scapePattern(const QString& pattern, const QChar c = QChar(' ')) { QRegExp rx(pattern, Qt::CaseSensitive); rx.setMinimal(true); diff -Nru cb2bib-1.4.9/src/c2b/bibExtractor.cpp cb2bib-1.9.2/src/c2b/bibExtractor.cpp --- cb2bib-1.4.9/src/c2b/bibExtractor.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/bibExtractor.cpp 2015-08-09 19:58:26.308735557 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "bibExtractor.h" diff -Nru cb2bib-1.4.9/src/c2b/bibExtractor.h cb2bib-1.9.2/src/c2b/bibExtractor.h --- cb2bib-1.4.9/src/c2b/bibExtractor.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/bibExtractor.h 2015-08-09 19:58:26.363735005 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef BIBEXTRACTOR_H @@ -29,7 +29,7 @@ Q_OBJECT public: - bibExtractor(QObject* parento = 0); + explicit bibExtractor(QObject* parento = 0); bibExtractor(bibParser* bp, metadataParser* mp, networkQuery* nq, QObject* parento = 0); ~bibExtractor(); diff -Nru cb2bib-1.4.9/src/c2b/bibParser.cpp cb2bib-1.9.2/src/c2b/bibParser.cpp --- cb2bib-1.4.9/src/c2b/bibParser.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/bibParser.cpp 2015-08-09 19:58:26.310735537 +0000 @@ -1,13 +1,14 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "bibParser.h" #include "authorString.h" #include "bibPreparser.h" +#include "document.h" #include "heuristicBibParser.h" #include "idMaker.h" #include "preprocess.h" @@ -56,6 +57,8 @@ QString v(value); if (field == "file") return v.trimmed(); + if (field == "abstract") + document::normalize(v, document::Complete); v = removeTags(v); if (v.isEmpty()) return (v); @@ -104,9 +107,7 @@ v.replace(" - ", ","); QStringList kl(v.split(QRegExp("[^\\w\\s-']"), QString::SkipEmptyParts)); kl.removeAll(" "); -#if QT_VERSION >= 0x040500 kl.removeDuplicates(); -#endif v = kl.join(", "); v.replace(QRegExp("\\s+,"), ","); v = v.toLower(); @@ -445,7 +446,7 @@ const QStringList list(fieldset.split(' ', QString::SkipEmptyParts)); const int efields(list.count()); - const int cfields(rx.numCaptures()); + const int cfields(rx.captureCount()); int npos(rx.indexIn(ottext)); c2bUtils::debug(tr("Expected Fields: |%1|").arg(efields)); c2bUtils::debug(tr("Captured Fields: |%1|").arg(cfields)); diff -Nru cb2bib-1.4.9/src/c2b/bibParser.h cb2bib-1.9.2/src/c2b/bibParser.h --- cb2bib-1.4.9/src/c2b/bibParser.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/bibParser.h 2015-08-09 19:58:26.364734995 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef BIBPARSER_H @@ -30,7 +30,7 @@ Q_OBJECT public: - bibParser(QObject* parento = 0); + explicit bibParser(QObject* parento = 0); virtual ~bibParser(); QString documentFilename(const QString& base_fn, const QString& bibtex_fn); diff -Nru cb2bib-1.4.9/src/c2b/bibPreparser.cpp cb2bib-1.9.2/src/c2b/bibPreparser.cpp --- cb2bib-1.4.9/src/c2b/bibPreparser.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/bibPreparser.cpp 2015-08-09 19:58:26.311735527 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "bibPreparser.h" diff -Nru cb2bib-1.4.9/src/c2b/bibPreparser.h cb2bib-1.9.2/src/c2b/bibPreparser.h --- cb2bib-1.4.9/src/c2b/bibPreparser.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/bibPreparser.h 2015-08-09 19:58:26.366734975 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef BIBPREPARSER_H @@ -20,7 +20,7 @@ Q_OBJECT public: - bibPreparser(QObject* parento = 0); + explicit bibPreparser(QObject* parento = 0); inline ~bibPreparser() {} void preparse(const QString& text, QString* out_text); diff -Nru cb2bib-1.4.9/src/c2b/bibReference.h cb2bib-1.9.2/src/c2b/bibReference.h --- cb2bib-1.4.9/src/c2b/bibReference.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/bibReference.h 2015-08-09 19:58:26.368734955 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef BIBREFERENCE_H diff -Nru cb2bib-1.4.9/src/c2b/bibSearcher.cpp cb2bib-1.9.2/src/c2b/bibSearcher.cpp --- cb2bib-1.4.9/src/c2b/bibSearcher.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/bibSearcher.cpp 2015-08-09 19:58:26.313735507 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "bibSearcher.h" @@ -183,7 +183,7 @@ { bibSearcher bs; QString exc; - bs._documents.load(bibtexfn, documentContents::Raw); + bs._documents.load(bibtexfn, documentContents::Complete); if (bs._documents.setCurrent(documentfn)) { QString p(keyword); @@ -251,7 +251,7 @@ if (_simplify_source) _documents.load(bib_file, documentContents::Simplified); else - _documents.load(bib_file, documentContents::Raw); + _documents.load(bib_file, documentContents::Complete); } const int hits(_hits_map.count()); diff -Nru cb2bib-1.4.9/src/c2b/bibSearcher.h cb2bib-1.9.2/src/c2b/bibSearcher.h --- cb2bib-1.4.9/src/c2b/bibSearcher.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/bibSearcher.h 2015-08-09 19:58:26.370734935 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef BIBSEARCHER_H diff -Nru cb2bib-1.4.9/src/c2b/c2blib.pro cb2bib-1.9.2/src/c2b/c2blib.pro --- cb2bib-1.4.9/src/c2b/c2blib.pro 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/c2blib.pro 2015-08-09 19:52:56.000000000 +0000 @@ -1,6 +1,6 @@ LANGUAGE = C++ -HEADERS += *.h qtregexp/*.h -SOURCES += *.cpp qtregexp/*.cpp +HEADERS += *.h +SOURCES += *.cpp RESOURCES += c2blib.qrc DEFINES += C2B_USE_QMAKE INCLUDEPATH += . diff -Nru cb2bib-1.4.9/src/c2b/cb2bib_conf_parameters.h.in cb2bib-1.9.2/src/c2b/cb2bib_conf_parameters.h.in --- cb2bib-1.4.9/src/c2b/cb2bib_conf_parameters.h.in 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/cb2bib_conf_parameters.h.in 2015-08-09 19:58:26.371734925 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef CB2BIB_CONF_PARAMETERS_H diff -Nru cb2bib-1.4.9/src/c2b/cb2bib_parameters.h cb2bib-1.9.2/src/c2b/cb2bib_parameters.h --- cb2bib-1.4.9/src/c2b/cb2bib_parameters.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/cb2bib_parameters.h 2015-08-09 19:58:26.373734904 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef CB2BIB_PARAMETERS_H @@ -33,22 +33,22 @@ const QString C2B_ICON_VIEWBIB_B("viewbib.png"); const QString C2B_ICON_VIEWC2B_B("viewcb.png"); const QString C2B_ORGANIZATION("MOLspaces"); -const QString C2B_VERSION("1.4.9"); +const QString C2B_VERSION("1.9.2"); // File Manager Client -#ifdef Q_WS_X11 +#ifdef Q_OS_UNIX const QString C2B_FM_CLIENT_COPY_ARG("copy"); const QString C2B_FM_CLIENT_COPY_BIN("kfmclient"); const QString C2B_FM_CLIENT_MOVE_ARG("move"); const QString C2B_FM_CLIENT_MOVE_BIN("kfmclient"); #endif -#ifdef Q_WS_MACX +#ifdef Q_OS_MACX const QString C2B_FM_CLIENT_COPY_ARG(""); const QString C2B_FM_CLIENT_COPY_BIN(""); const QString C2B_FM_CLIENT_MOVE_ARG(""); const QString C2B_FM_CLIENT_MOVE_BIN(""); #endif -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN const QString C2B_FM_CLIENT_COPY_ARG(""); const QString C2B_FM_CLIENT_COPY_BIN(""); const QString C2B_FM_CLIENT_MOVE_ARG(""); @@ -56,34 +56,34 @@ #endif // To text converter -#ifdef Q_WS_X11 +#ifdef Q_OS_UNIX const QString C2B_METADATAPARSER_EXIFTOOL_BIN("exiftool"); const QString C2B_BIBSEARCHER_PDF2TXT_BIN("pdftotext"); const QString C2B_PDFIMPORT_PDF2TXT_BIN("pdftotext"); #endif -#ifdef Q_WS_MACX +#ifdef Q_OS_MACX const QString C2B_METADATAPARSER_EXIFTOOL_BIN("exiftool"); const QString C2B_BIBSEARCHER_PDF2TXT_BIN("pdftotext"); const QString C2B_PDFIMPORT_PDF2TXT_BIN("pdftotext"); #endif -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN const QString C2B_METADATAPARSER_EXIFTOOL_BIN("C:\\Windows\\exiftool.exe"); -const QString C2B_PDFIMPORT_PDF2TXT_BIN("C:\\Program Files\\xpdf-3.02-win32\\pdftotext.exe"); -const QString C2B_BIBSEARCHER_PDF2TXT_BIN("C:\\Program Files\\xpdf-3.02-win32\\pdftotext.exe"); +const QString C2B_PDFIMPORT_PDF2TXT_BIN("C:\\Program Files\\xpdf-3.04-win32\\pdf2cb.exe"); +const QString C2B_BIBSEARCHER_PDF2TXT_BIN("C:\\Program Files\\xpdf-3.04-win32\\pdf2cb.exe"); #endif // BibTeX postprocessing -#ifdef Q_WS_X11 +#ifdef Q_OS_UNIX const QString C2B_POSTPROCESS_BIBTEX_BIN("c2btools/bib2pdf"); const QString C2B_POSTPROCESS_BIBTEX_ARG("%finput %foutput"); const QString C2B_POSTPROCESS_BIBTEX_EXT("bib.pdf"); #endif -#ifdef Q_WS_MACX +#ifdef Q_OS_MACX const QString C2B_POSTPROCESS_BIBTEX_BIN("c2btools/bib2pdf"); const QString C2B_POSTPROCESS_BIBTEX_ARG("%finput %foutput"); const QString C2B_POSTPROCESS_BIBTEX_EXT("bib.pdf"); #endif -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN const QString C2B_POSTPROCESS_BIBTEX_BIN("c2btools\\bib2end.bat"); const QString C2B_POSTPROCESS_BIBTEX_ARG("%finput %foutput"); const QString C2B_POSTPROCESS_BIBTEX_EXT("end"); diff -Nru cb2bib-1.4.9/src/c2b/cb2bib_utilities.cpp cb2bib-1.9.2/src/c2b/cb2bib_utilities.cpp --- cb2bib-1.4.9/src/c2b/cb2bib_utilities.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/cb2bib_utilities.cpp 2015-08-09 19:58:26.317735467 +0000 @@ -1,11 +1,13 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "cb2bib_utilities.h" +#include <QRegularExpressionMatchIterator> + #ifdef C2B_USE_LZO #include <lzo/lzoconf.h> #include <lzo/lzo1x.h> @@ -106,6 +108,24 @@ } return str; } + +QString& fillString(QString& str, const QRegularExpression& pattern, const QChar& ch) +{ + if (str.length() == 0) + return str; + const ushort uch(ch.unicode()); + ushort* const c0((ushort*)str.data()); + QRegularExpressionMatchIterator it(pattern.globalMatch(str)); + while (it.hasNext()) + { + const QRegularExpressionMatch match(it.next()); + ushort* c(c0 + match.capturedStart()); + const ushort* const cpl(c + match.capturedLength()); + while (c < cpl) + *c++ = uch; + } + return str; +} static const unsigned short _cyrillic_to_ascii[] = { diff -Nru cb2bib-1.4.9/src/c2b/cb2bib_utilities.h cb2bib-1.9.2/src/c2b/cb2bib_utilities.h --- cb2bib-1.4.9/src/c2b/cb2bib_utilities.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/cb2bib_utilities.h 2015-08-09 19:58:26.374734894 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef CB2BIB_UTILITIES_H @@ -29,6 +29,7 @@ extern QString& bibToC2b(QString& str); extern QString& c2bToBib(QString& str); extern QString& fillString(QString& str, const QRegExp& pattern, const QChar& ch); +extern QString& fillString(QString& str, const QRegularExpression& pattern, const QChar& ch); extern QString& fillString(QString& str, const QString& pattern, const QChar& ch); extern QString& fillString(QString& str, const QStringMatcher& pattern, const QChar& ch); extern QString& simplifyString(QString& str); diff -Nru cb2bib-1.4.9/src/c2b/CMakeLists.txt cb2bib-1.9.2/src/c2b/CMakeLists.txt --- cb2bib-1.4.9/src/c2b/CMakeLists.txt 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/CMakeLists.txt 2015-08-09 19:52:56.000000000 +0000 @@ -6,7 +6,6 @@ find_package(Qt4 ${CB2BIB_MINIMUM_REQUIRED_QT} COMPONENTS QtCore QtNetwork REQUIRED) list_source_files(LIBC2B_CPP LIBC2B_H LIBC2B_MOCH) -list(APPEND LIBC2B_CPP qtregexp/eqregexp.cpp) qt4_wrap_cpp(LIBC2B_MOC ${LIBC2B_MOCH}) qt4_add_resources(LIBC2B_RCC c2blib.qrc) diff -Nru cb2bib-1.4.9/src/c2b/collectionAnalyzer.cpp cb2bib-1.9.2/src/c2b/collectionAnalyzer.cpp --- cb2bib-1.4.9/src/c2b/collectionAnalyzer.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/collectionAnalyzer.cpp 2015-08-09 19:58:26.318735457 +0000 @@ -1,13 +1,14 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "collectionAnalyzer.h" #include "settings.h" +#include <QDataStream> #include <QVector> #include <cmath> @@ -16,7 +17,7 @@ template <typename T> class lengthsorting { public: - lengthsorting(const T& data) : _data(data) {} + explicit lengthsorting(const T& data) : _data(data) {} inline bool operator()(const int i, const int j) { const int ni(_data[i].length()); diff -Nru cb2bib-1.4.9/src/c2b/collectionAnalyzer.h cb2bib-1.9.2/src/c2b/collectionAnalyzer.h --- cb2bib-1.4.9/src/c2b/collectionAnalyzer.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/collectionAnalyzer.h 2015-08-09 19:58:26.376734874 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef COLLECTIONANALYZER_H diff -Nru cb2bib-1.4.9/src/c2b/collectionIndex.cpp cb2bib-1.9.2/src/c2b/collectionIndex.cpp --- cb2bib-1.4.9/src/c2b/collectionIndex.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/collectionIndex.cpp 2015-08-09 19:58:26.320735437 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "collectionIndex.h" @@ -13,6 +13,8 @@ #include "posTagger.h" #include "settings.h" +#include <QDataStream> +#include <QRegularExpression> #include <QVarLengthArray> #include <time.h> @@ -24,6 +26,10 @@ static const int _in_short_document_sentence_repetition(2); static const int _inter_document_sentence_repetition(3); +static const QRegularExpression::PatternOptions _qre_pattern_options( + QRegularExpression::UseUnicodePropertiesOption | + QRegularExpression::OptimizeOnFirstUsageOption); + #define C2B_DEBUG_COLLECTIONINDEX 0 class reversedsorting @@ -111,7 +117,7 @@ const QString bibtexfn(bibtexfns.at(i)); _out << QObject::tr("Indexing %1...").arg(bibtexfn) << endl; const QString bibtex(c2bUtils::fileToString(bibtexfn)); - dc.load(bibtexfn, documentContents::Raw); + dc.load(bibtexfn, documentContents::Complete); _bpP->initReferenceParsing(bibtexfn, fields, &reference); while (_bpP->referencesIn(bibtex, &reference)) @@ -124,9 +130,10 @@ QString title(reference.anyTitle()); c2bUtils::cleanTitle(title, true); if (dc.setCurrent(docfn)) - setKeySentences(documentid++, preprocessedText(journal, dc.current().text())); + setKeySentences(documentid, preprocessedText(journal, dc.current().text())); else ++nfailures; + ++documentid; documents.append(title); documentfns.append(docfn); } @@ -154,6 +161,11 @@ } #endif + _out << QObject::tr("Cleaning arrays...") << endl; + _keysentences.clear(); + _document_sentences.clear(); + _out << QObject::tr("done") << endl; + const QString cache_dir(_settingsP->fileName("cb2Bib/CacheDirectory")); const QString documentslfn(QDir::toNativeSeparators(cache_dir + "/documents.lc2b")); QFile documentslf(QDir::cleanPath(documentslfn)); @@ -245,7 +257,7 @@ QStringList taggedvalidlist; #endif - for (QHash<QString, KeysentenceData>::const_iterator si = _keysentences.constBegin(); si != _keysentences.constEnd(); ++si) + for (QMap<QString, KeysentenceData>::const_iterator si = _keysentences.constBegin(); si != _keysentences.constEnd(); ++si) { const QString& s(si.key()); const KeysentenceData& sdata(si.value()); @@ -257,9 +269,9 @@ validlist.append(s); #if C2B_DEBUG_COLLECTIONINDEX taggedvalidlist.append(pts + " " + s); -#endif for (int j = 0; j < sdata.documents.count(); ++j) _document_sentences.insert(sdata.documents.at(j), s); +#endif } } ussorting uss; @@ -276,7 +288,7 @@ const QChar hs('-'); const QChar us('_'); const QString ss("\\1 "); - QRegExp aprx(author::prefixes + '_', Qt::CaseSensitive); + QRegularExpression aprx(author::prefixes + '_', _qre_pattern_options); for (int i = 0; i < validlist.count(); ++i) { QString v(validlist.at(i)); @@ -336,7 +348,7 @@ _out << QObject::tr("Cleaning keyword sentences...") << endl; QStringList keysentenceskeys; - for (QHash<QString, KeysentenceData>::const_iterator si = _keysentences.constBegin(); si != _keysentences.constEnd(); ++si) + for (QMap<QString, KeysentenceData>::const_iterator si = _keysentences.constBegin(); si != _keysentences.constEnd(); ++si) { const int& v(si.value().ndocuments); if (v < _inter_document_sentence_repetition) @@ -378,21 +390,21 @@ const QString coordination_on(" on "); const QString coordination_or(" or "); - const QRegExp trailing_ae("ae\\b"); - const QRegExp trailing_ches("ches\\b"); - const QRegExp trailing_dices("dices\\b"); - const QRegExp trailing_ices("ices\\b"); - const QRegExp trailing_ies("ies\\b"); - const QRegExp trailing_is("is\\b"); - const QRegExp trailing_us("us\\b"); - const QRegExp trailing_s("s\\b"); - const QRegExp trailing_ss("ss\\b"); - const QRegExp trailing_sses("sses\\b"); + const QRegularExpression trailing_ae("ae\\b", _qre_pattern_options); + const QRegularExpression trailing_ches("ches\\b", _qre_pattern_options); + const QRegularExpression trailing_dices("dices\\b", _qre_pattern_options); + const QRegularExpression trailing_ices("ices\\b", _qre_pattern_options); + const QRegularExpression trailing_ies("ies\\b", _qre_pattern_options); + const QRegularExpression trailing_is("is\\b", _qre_pattern_options); + const QRegularExpression trailing_us("us\\b", _qre_pattern_options); + const QRegularExpression trailing_s("s\\b", _qre_pattern_options); + const QRegularExpression trailing_ss("ss\\b", _qre_pattern_options); + const QRegularExpression trailing_sses("sses\\b", _qre_pattern_options); - const QRegExp trailing_ap("'\\b"); - const QRegExp trailing_aps("'s\\b"); + const QRegularExpression trailing_ap("'\\b", _qre_pattern_options); + const QRegularExpression trailing_aps("'s\\b", _qre_pattern_options); - for (QHash<QString, KeysentenceData>::iterator si = _keysentences.begin(); si != _keysentences.end(); ++si) + for (QMap<QString, KeysentenceData>::iterator si = _keysentences.begin(); si != _keysentences.end(); ++si) { if (si.value().ndocuments == 0) continue; @@ -555,7 +567,7 @@ if (text.startsWith(QLatin1String("author's "))) return false; if (text.startsWith(QLatin1String("authors "))) return false; } - if (fc == 98) + else if (fc == 98) { if (text.startsWith(QLatin1String("based on "))) return false; if (text.startsWith(QLatin1String("be "))) return false; @@ -566,7 +578,7 @@ if (text.startsWith(QLatin1String("but "))) return false; if (text.startsWith(QLatin1String("by "))) return false; } - if (fc == 99) + else if (fc == 99) { if (text.startsWith(QLatin1String("calculated ")) && text.count(_space_char) < 3) return false; if (text.startsWith(QLatin1String("calculations "))) return false; @@ -586,7 +598,7 @@ if (text.startsWith(QLatin1String("current "))) return false; if (text.startsWith(QLatin1String("currently "))) return false; } - if (fc == 100) + else if (fc == 100) { if (text.startsWith(QLatin1String("data "))) return false; if (text.startsWith(QLatin1String("de "))) return false; @@ -608,7 +620,7 @@ if (text.startsWith(QLatin1String("due ")) && text.count(_space_char) < 3) return false; if (text.startsWith(QLatin1String("during "))) return false; } - if (fc == 101) + else if (fc == 101) { if (text.startsWith(QLatin1String("each "))) return false; if (text.startsWith(QLatin1String("easily "))) return false; @@ -619,7 +631,7 @@ if (text.startsWith(QLatin1String("either "))) return false; if (text.startsWith(QLatin1String("elsevier "))) return false; } - if (fc == 102) + else if (fc == 102) { if (text.startsWith(QLatin1String("faculty of "))) return false; if (text.startsWith(QLatin1String("figure "))) return false; @@ -640,7 +652,7 @@ if (text.startsWith(QLatin1String("fur "))) return false; if (text.startsWith(QLatin1String("further "))) return false; } - if (fc == 103) + else if (fc == 103) { if (text.startsWith(QLatin1String("gave "))) return false; if (text.startsWith(QLatin1String("give "))) return false; @@ -651,7 +663,7 @@ if (text.startsWith(QLatin1String("going "))) return false; if (text.startsWith(QLatin1String("groups "))) return false; } - if (fc == 104) + else if (fc == 104) { if (text.startsWith(QLatin1String("has "))) return false; if (text.startsWith(QLatin1String("have "))) return false; @@ -660,7 +672,7 @@ if (text.startsWith(QLatin1String("his "))) return false; if (text.startsWith(QLatin1String("how "))) return false; } - if (fc == 105) + else if (fc == 105) { if (text.startsWith(QLatin1String("i "))) return false; if (text.startsWith(QLatin1String("if "))) return false; @@ -676,18 +688,18 @@ if (text.startsWith(QLatin1String("it "))) return false; if (text.startsWith(QLatin1String("its "))) return false; } - if (fc == 106) + else if (fc == 106) { if (text.startsWith(QLatin1String("j "))) return false; if (text.startsWith(QLatin1String("journal of "))) return false; if (text.startsWith(QLatin1String("journal on "))) return false; if (text.startsWith(QLatin1String("just "))) return false; } - if (fc == 107) + else if (fc == 107) { if (text.startsWith(QLatin1String("kept "))) return false; } - if (fc == 108) + else if (fc == 108) { if (text.startsWith(QLatin1String("laboratory for "))) return false; if (text.startsWith(QLatin1String("laboratory of "))) return false; @@ -696,7 +708,7 @@ if (text.startsWith(QLatin1String("let "))) return false; if (text.startsWith(QLatin1String("lower "))) return false; } - if (fc == 109) + else if (fc == 109) { if (text.startsWith(QLatin1String("may "))) return false; if (text.startsWith(QLatin1String("mol "))) return false; @@ -705,14 +717,14 @@ if (text.startsWith(QLatin1String("much ")) && text.count(_space_char) < 3) return false; if (text.startsWith(QLatin1String("my "))) return false; } - if (fc == 110) + else if (fc == 110) { if (text.startsWith(QLatin1String("national academy of "))) return false; if (text.startsWith(QLatin1String("need "))) return false; if (text.startsWith(QLatin1String("new "))) return false; if (text.startsWith(QLatin1String("not ")) && text.count(_space_char) < 3) return false; } - if (fc == 111) + else if (fc == 111) { if (text.startsWith(QLatin1String("observed "))) return false; if (text.startsWith(QLatin1String("obtained "))) return false; @@ -729,7 +741,7 @@ if (text.startsWith(QLatin1String("our "))) return false; if (text.startsWith(QLatin1String("over "))) return false; } - if (fc == 112) + else if (fc == 112) { if (text.startsWith(QLatin1String("per "))) return false; if (text.startsWith(QLatin1String("permission of "))) return false; @@ -742,11 +754,11 @@ if (text.startsWith(QLatin1String("proceedings "))) return false; if (text.startsWith(QLatin1String("proof "))) return false; } - if (fc == 113) + else if (fc == 113) { if (text.startsWith(QLatin1String("quite "))) return false; } - if (fc == 114) + else if (fc == 114) { if (text.startsWith(QLatin1String("rather "))) return false; if (text.startsWith(QLatin1String("rest of "))) return false; @@ -754,7 +766,7 @@ if (text.startsWith(QLatin1String("reviews in "))) return false; if (text.startsWith(QLatin1String("run "))) return false; } - if (fc == 115) + else if (fc == 115) { if (text.startsWith(QLatin1String("same "))) return false; if (text.startsWith(QLatin1String("see "))) return false; @@ -774,7 +786,7 @@ if (text.startsWith(QLatin1String("suppose "))) return false; if (text.startsWith(QLatin1String("symposium on "))) return false; } - if (fc == 116) + else if (fc == 116) { if (text.startsWith(QLatin1String("than "))) return false; if (text.startsWith(QLatin1String("thank "))) return false; @@ -794,7 +806,7 @@ if (text.startsWith(QLatin1String("top "))) return false; if (text.startsWith(QLatin1String("transactions on "))) return false; } - if (fc == 117) + else if (fc == 117) { if (text.startsWith(QLatin1String("under "))) return false; if (text.startsWith(QLatin1String("us "))) return false; @@ -803,11 +815,11 @@ if (text.startsWith(QLatin1String("uses "))) return false; if (text.startsWith(QLatin1String("using "))) return false; } - if (fc == 118) + else if (fc == 118) { if (text.startsWith(QLatin1String("very ")) && text.count(_space_char) < 3) return false; } - if (fc == 119) + else if (fc == 119) { if (text.startsWith(QLatin1String("was "))) return false; if (text.startsWith(QLatin1String("we "))) return false; @@ -831,11 +843,11 @@ if (text.startsWith(QLatin1String("worth "))) return false; if (text.startsWith(QLatin1String("would "))) return false; } - if (fc == 120) + else if (fc == 120) { if (text.startsWith(QLatin1String("x "))) return false; } - if (fc == 121) + else if (fc == 121) { if (text.startsWith(QLatin1String("yes "))) return false; if (text.startsWith(QLatin1String("you "))) return false; @@ -850,7 +862,7 @@ if (text.endsWith(QLatin1String(" a"))) return false; if (text.endsWith(QLatin1String(" via"))) return false; } - if (lc == 100) + else if (lc == 100) { if (text.endsWith(QLatin1String(" and"))) return false; if (text.endsWith(QLatin1String(" applied"))) return false; @@ -864,7 +876,7 @@ if (text.endsWith(QLatin1String(" used"))) return false; if (text.endsWith(QLatin1String(" would"))) return false; } - if (lc == 101) + else if (lc == 101) { if (text.endsWith(QLatin1String(" above"))) return false; if (text.endsWith(QLatin1String(" are"))) return false; @@ -893,12 +905,12 @@ if (text.endsWith(QLatin1String(" while"))) return false; if (text.endsWith(QLatin1String(" whose"))) return false; } - if (lc == 102) + else if (lc == 102) { if (text.endsWith(QLatin1String(" if"))) return false; if (text.endsWith(QLatin1String(" of"))) return false; } - if (lc == 103) + else if (lc == 103) { if (text.endsWith(QLatin1String(" according"))) return false; if (text.endsWith(QLatin1String(" along"))) return false; @@ -906,11 +918,12 @@ if (text.endsWith(QLatin1String(" containing"))) return false; if (text.endsWith(QLatin1String(" corresponding"))) return false; if (text.endsWith(QLatin1String(" during"))) return false; + if (text.endsWith(QLatin1String(" fig"))) return false; if (text.endsWith(QLatin1String(" having"))) return false; if (text.endsWith(QLatin1String(" involving"))) return false; if (text.endsWith(QLatin1String(" using"))) return false; } - if (lc == 104) + else if (lc == 104) { if (text.endsWith(QLatin1String(" although"))) return false; if (text.endsWith(QLatin1String(" both"))) return false; @@ -920,22 +933,22 @@ if (text.endsWith(QLatin1String(" which"))) return false; if (text.endsWith(QLatin1String(" with"))) return false; } - if (lc == 105) + else if (lc == 105) { if (text.endsWith(QLatin1String(" i"))) return false; } - if (lc == 108) + else if (lc == 108) { if (text.endsWith(QLatin1String(" all"))) return false; if (text.endsWith(QLatin1String(" several"))) return false; if (text.endsWith(QLatin1String(" will"))) return false; } - if (lc == 109) + else if (lc == 109) { if (text.endsWith(QLatin1String(" from"))) return false; if (text.endsWith(QLatin1String(" them"))) return false; } - if (lc == 110) + else if (lc == 110) { if (text.endsWith(QLatin1String(" an"))) return false; if (text.endsWith(QLatin1String(" been"))) return false; @@ -954,7 +967,7 @@ if (text.endsWith(QLatin1String(" when"))) return false; if (text.endsWith(QLatin1String(" within"))) return false; } - if (lc == 111) + else if (lc == 111) { if (text.endsWith(QLatin1String(" also"))) return false; if (text.endsWith(QLatin1String(" do"))) return false; @@ -963,7 +976,7 @@ if (text.endsWith(QLatin1String(" two"))) return false; if (text.endsWith(QLatin1String(" who"))) return false; } - if (lc == 114) + else if (lc == 114) { if (text.endsWith(QLatin1String(" after"))) return false; if (text.endsWith(QLatin1String(" chapter"))) return false; @@ -978,12 +991,13 @@ if (text.endsWith(QLatin1String(" whether"))) return false; if (text.endsWith(QLatin1String(" your"))) return false; } - if (lc == 115) + else if (lc == 115) { if (text.endsWith(QLatin1String(" across"))) return false; if (text.endsWith(QLatin1String(" as"))) return false; if (text.endsWith(QLatin1String(" does"))) return false; if (text.endsWith(QLatin1String(" does"))) return false; + if (text.endsWith(QLatin1String(" figs"))) return false; if (text.endsWith(QLatin1String(" follows"))) return false; if (text.endsWith(QLatin1String(" gives"))) return false; if (text.endsWith(QLatin1String(" has"))) return false; @@ -998,7 +1012,7 @@ if (text.endsWith(QLatin1String(" yes"))) return false; if (text.endsWith(QLatin1String("acids res"))) return false; } - if (lc == 116) + else if (lc == 116) { if (text.endsWith(QLatin1String(" about"))) return false; if (text.endsWith(QLatin1String(" at"))) return false; @@ -1016,17 +1030,17 @@ if (text.endsWith(QLatin1String(" that"))) return false; if (text.endsWith(QLatin1String(" without"))) return false; } - if (lc == 117) + else if (lc == 117) { if (text.endsWith(QLatin1String(" you"))) return false; } - if (lc == 119) + else if (lc == 119) { if (text.endsWith(QLatin1String(" how"))) return false; if (text.endsWith(QLatin1String(" new"))) return false; if (text.endsWith(QLatin1String(" show"))) return false; } - if (lc == 121) + else if (lc == 121) { if (text.endsWith(QLatin1String(" any"))) return false; if (text.endsWith(QLatin1String(" by"))) return false; @@ -1041,6 +1055,8 @@ if (text.contains(QLatin1String("_ "))) return false; if (text.contains(QLatin1String(" _"))) return false; + if (_last_equals_first(text)) return false; + return true; } @@ -1057,27 +1073,25 @@ jns.append(QString(jns.at(0)).remove('.')); jns.append(QString(jns.at(1)).remove('.')); jns.append(QString(jns.at(2)).remove('.')); -#if QT_VERSION >= 0x040500 jns.removeDuplicates(); -#endif for (int i = 0; i < jns.count(); ++i) c2bUtils::fillString(pt, QStringMatcher(jns.at(i), Qt::CaseSensitive), '.'); } replace(pt, '"', ' '); replace(pt, '-', '_'); - pt.replace(QRegExp("_{2,}"), "_"); + pt.replace(QRegularExpression("_{2,}", _qre_pattern_options), "_"); - pt.replace(QRegExp("\\bin *situ\\b", Qt::CaseSensitive), " in_situ "); - pt.replace(QRegExp("\\bin *vivo\\b", Qt::CaseSensitive), " in_vivo "); - pt.replace(QRegExp("\\bin *vitro\\b", Qt::CaseSensitive), " in_vitro "); - pt.replace(QRegExp("\\bex *situ\\b", Qt::CaseSensitive), " ex_situ "); - pt.replace(QRegExp("\\bex *vivo\\b", Qt::CaseSensitive), " ex_vivo "); - pt.replace(QRegExp("\\bex *vitro\\b", Qt::CaseSensitive), " ex_vitro "); + pt.replace(QRegularExpression("\\bin *situ\\b", _qre_pattern_options), " in_situ "); + pt.replace(QRegularExpression("\\bin *vivo\\b", _qre_pattern_options), " in_vivo "); + pt.replace(QRegularExpression("\\bin *vitro\\b", _qre_pattern_options), " in_vitro "); + pt.replace(QRegularExpression("\\bex *situ\\b", _qre_pattern_options), " ex_situ "); + pt.replace(QRegularExpression("\\bex *vivo\\b", _qre_pattern_options), " ex_vivo "); + pt.replace(QRegularExpression("\\bex *vitro\\b", _qre_pattern_options), " ex_vitro "); // Clear some strings - c2bUtils::fillString(pt, QRegExp("\\bbased (?=on\\b)"), ' '); - c2bUtils::fillString(pt, QRegExp("\\bin order (?=to\\b)"), ' '); + c2bUtils::fillString(pt, QRegularExpression("\\bbased (?=on\\b)", _qre_pattern_options), ' '); + c2bUtils::fillString(pt, QRegularExpression("\\bin order (?=to\\b)", _qre_pattern_options), ' '); c2bUtils::fillString(pt, QStringMatcher(" a ", Qt::CaseSensitive), ' '); c2bUtils::fillString(pt, QStringMatcher(" an ", Qt::CaseSensitive), ' '); @@ -1094,20 +1108,20 @@ c2bUtils::fillString(pt, QStringMatcher(" was ", Qt::CaseSensitive), '.'); c2bUtils::fillString(pt, QStringMatcher(" were ", Qt::CaseSensitive), '.'); - c2bUtils::fillString(pt, QRegExp("\\binstitut\\w*", Qt::CaseSensitive), '.'); - c2bUtils::fillString(pt, QRegExp("\\buniversi\\w*", Qt::CaseSensitive), '.'); - c2bUtils::fillString(pt, QRegExp("\\bdoi\\w*", Qt::CaseSensitive), '.'); - c2bUtils::fillString(pt, QRegExp("\\bet al\\w*", Qt::CaseSensitive), '.'); + c2bUtils::fillString(pt, QRegularExpression("\\binstitut\\w*", _qre_pattern_options), '.'); + c2bUtils::fillString(pt, QRegularExpression("\\buniversi\\w*", _qre_pattern_options), '.'); + c2bUtils::fillString(pt, QRegularExpression("\\bdoi\\w*", _qre_pattern_options), '.'); + c2bUtils::fillString(pt, QRegularExpression("\\bet al\\w*", _qre_pattern_options), '.'); // Normalize proper names - c2bUtils::fillString(pt, QRegExp("\\bdo not\\b", Qt::CaseSensitive), '.'); - pt.replace(QRegExp("\\b" + author::prefixes + "\\s", Qt::CaseSensitive), QString("\\1%1").arg(QChar(127))); + c2bUtils::fillString(pt, QRegularExpression("\\bdo not\\b", _qre_pattern_options), '.'); + pt.replace(QRegularExpression("\\b" + author::prefixes + "\\s", _qre_pattern_options), QString("\\1%1").arg(QChar(127))); replace(pt, QChar(127), '_'); // Remove noisy elements from PDF articles c2bUtils::fillString(pt, QStringMatcher("page intentionally left", Qt::CaseSensitive), '.'); c2bUtils::fillString(pt, QStringMatcher("journal article", Qt::CaseSensitive), '.'); - c2bUtils::fillString(pt, QRegExp(" \\w \\w \\w "), '.'); + c2bUtils::fillString(pt, QRegularExpression(" \\w \\w \\w ", _qre_pattern_options), '.'); c2bUtils::stripDiacritics(pt); c2bUtils::simplifyString(pt); diff -Nru cb2bib-1.4.9/src/c2b/collectionIndex.h cb2bib-1.9.2/src/c2b/collectionIndex.h --- cb2bib-1.4.9/src/c2b/collectionIndex.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/collectionIndex.h 2015-08-09 19:58:26.377734864 +0000 @@ -1,13 +1,14 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef COLLECTIONINDEX_H #define COLLECTIONINDEX_H #include <QHash> +#include <QMap> #include <QStringList> @@ -21,7 +22,7 @@ { public: - collectionIndex(bibParser* bp); + explicit collectionIndex(bibParser* bp); ~collectionIndex(); int index(const QString& dir); @@ -31,7 +32,7 @@ struct KeysentenceData { inline KeysentenceData() : ndocuments(0) {} - inline KeysentenceData(const int document) : ndocuments(1) + inline explicit KeysentenceData(const int document) : ndocuments(1) { documents.append(document); } @@ -44,6 +45,21 @@ QList<int> documents; }; + inline static bool _last_equals_first(const QString& text) + { + const ushort* r((const ushort*)text.constData()); + const ushort* const cn(r + text.length()); + const ushort* s; + for (s = cn - 1; s > r; --s) + if (*s == 32) + break; + ++s; + while (s < cn) + if (*(s++) != *(r++)) + return false; + return *r == 32; + } + KeysentenceData* _digest_sentence(KeysentenceData* ksd, KeysentenceData* ksdndmax, int* ndmax) const; QString preprocessedText(const QString& journal, const QString& text) const; QString& replace(QString& str, const QChar& a, const QChar& b) const; @@ -59,7 +75,7 @@ int _nerrors; settings* _settingsP; - QHash<QString, KeysentenceData> _keysentences; + QMap<QString, KeysentenceData> _keysentences; QMultiHash<int, QString> _document_sentences; QMultiHash<int, int> _document_sentenceids; diff -Nru cb2bib-1.4.9/src/c2b/compositePattern.cpp cb2bib-1.9.2/src/c2b/compositePattern.cpp --- cb2bib-1.4.9/src/c2b/compositePattern.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/compositePattern.cpp 2015-08-09 19:58:26.322735416 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "compositePattern.h" @@ -12,7 +12,7 @@ template <typename T> class descending { public: - descending(const T& data) : _data(data) {} + explicit descending(const T& data) : _data(data) {} inline bool operator()(const int i, const int j) { return _data.at(i) > _data.at(j); diff -Nru cb2bib-1.4.9/src/c2b/compositePattern.h cb2bib-1.9.2/src/c2b/compositePattern.h --- cb2bib-1.4.9/src/c2b/compositePattern.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/compositePattern.h 2015-08-09 19:58:26.378734854 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef COMPOSITEPATTERN_H diff -Nru cb2bib-1.4.9/src/c2b/coreBibParser.cpp cb2bib-1.9.2/src/c2b/coreBibParser.cpp --- cb2bib-1.4.9/src/c2b/coreBibParser.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/coreBibParser.cpp 2015-08-09 19:58:26.324735396 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "coreBibParser.h" diff -Nru cb2bib-1.4.9/src/c2b/coreBibParser.h cb2bib-1.9.2/src/c2b/coreBibParser.h --- cb2bib-1.4.9/src/c2b/coreBibParser.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/coreBibParser.h 2015-08-09 19:58:26.380734834 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef COREBIBPARSER_H @@ -27,7 +27,7 @@ Q_OBJECT public: - coreBibParser(QObject* parento = 0); + explicit coreBibParser(QObject* parento = 0); inline virtual ~coreBibParser() {} QString referenceToBibTeX(const bibReference& ref) const; diff -Nru cb2bib-1.4.9/src/c2b/documentCache.cpp cb2bib-1.9.2/src/c2b/documentCache.cpp --- cb2bib-1.4.9/src/c2b/documentCache.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/documentCache.cpp 2015-08-09 19:58:26.328735356 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "documentCache.h" @@ -11,10 +11,12 @@ #include "settings.h" #include "triads.h" +#include <QDataStream> + documentCache::documentCache() : _current(_cache), - _content_type(documentContents::Raw), + _content_type(documentContents::Complete), _cache_load_size(0), _settingsP(settings::instance()) {} @@ -86,7 +88,7 @@ if (!_cache.contains(tkey)) { - document doc(doc_fn, document::Raw); + document doc(doc_fn, document::Complete); _current._text = doc.toString(); if (!doc.errorString().isEmpty()) { @@ -94,7 +96,6 @@ (*logString) += QObject::tr("% [cb2bib] %1\n").arg(doc.errorString()); return false; } - _current._text = c2bUtils::simplifyString(_current._text); _cache.insert(doc_fn, c2bUtils::compress(_current._text.toUtf8())); if (_content_type == documentContents::Simplified) { @@ -125,11 +126,10 @@ if (!_cache.contains(tkey)) { - document doc(doc_fn, document::Raw); + document doc(doc_fn, document::Complete); _current._text = doc.toString(); if (!doc.errorString().isEmpty()) return false; - _current._text = c2bUtils::simplifyString(_current._text); _cache.insert(doc_fn, c2bUtils::compress(_current._text.toUtf8())); if (_content_type == documentContents::Simplified) { diff -Nru cb2bib-1.4.9/src/c2b/documentCache.h cb2bib-1.9.2/src/c2b/documentCache.h --- cb2bib-1.4.9/src/c2b/documentCache.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/documentCache.h 2015-08-09 19:58:26.382734814 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef DOCUMENTCACHE_H diff -Nru cb2bib-1.4.9/src/c2b/documentContents.h cb2bib-1.9.2/src/c2b/documentContents.h --- cb2bib-1.4.9/src/c2b/documentContents.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/documentContents.h 2015-08-09 19:58:26.384734794 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef DOCUMENTCONTENTS_H @@ -17,7 +17,7 @@ { public: - enum Type {Simplified, Raw}; + enum Type {Simplified, Complete}; inline const QString& signature() const { @@ -44,7 +44,7 @@ private: - inline documentContents(const QHash<QString, QByteArray>& cache) : _cache(cache) {} + inline explicit documentContents(const QHash<QString, QByteArray>& cache) : _cache(cache) {} inline ~documentContents() {} diff -Nru cb2bib-1.4.9/src/c2b/document.cpp cb2bib-1.9.2/src/c2b/document.cpp --- cb2bib-1.4.9/src/c2b/document.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/document.cpp 2015-08-09 19:58:26.327735366 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "document.h" @@ -58,7 +58,7 @@ .arg(_converter_bin).arg(_converter_arg); return QString(); } - if (!converter.waitForFinished(_conversion_mode == Raw ? -1 : 150000)) + if (!converter.waitForFinished(_conversion_mode == Complete ? -1 : 150000)) { converter.kill(); c2bUtils::warn(QObject::tr("Error: Document conversion timeout for file '%1'").arg(_document_fn)); @@ -74,203 +74,411 @@ return QString(); } - // Do some processing + normalize(doc, _conversion_mode); - // Remove null chacracters (avoids truncation in toUtf8, djvutxt places them at the end of page) - doc.replace(QChar(0), ' '); - // Unify separator - doc.replace(QChar(8208), '-'); - doc.replace(QChar(8209), '-'); - doc.replace(QChar(8210), '-'); - doc.replace(QChar(8211), '-'); - doc.replace(QChar(8212), '-'); - doc.replace(QChar(8213), '-'); - doc.replace(QChar(8722), '-'); - doc.replace(QChar(65533), '-'); - if (_conversion_mode == Raw) - { - // Join hyphenated words - doc.remove(QRegExp("-\\s*[\\n\\r]\\s*(?=\\w)")); - doc.replace(QRegExp("[\\n\\r]"), " "); - } - // Unify apostrophe - doc.replace(QChar(8216), '\''); - doc.replace(QChar(8217), '\''); - // Unify comma - doc.replace(QChar(65292), ','); - // Revert Latin ligatures - doc.replace(QChar(306), "IJ"); - doc.replace(QChar(307), "ij"); - doc.replace(QChar(64256), "ff"); - doc.replace(QChar(64257), "fi"); - doc.replace(QChar(64258), "fl"); - doc.replace(QChar(64259), "ffi"); - doc.replace(QChar(64260), "ffl"); - doc.replace(QChar(65842), "IJ"); - doc.replace(QChar(65843), "ij"); - if (doc.contains(QChar(174))) // Correct frequent misencoding of "fi" as circle R in PDFs - doc.replace(QRegExp(QString("%1([a-z])").arg(QChar(174))), "fi\\1"); - // Corrections for pdftotext raw - doc.replace(QChar(305), 'i'); - doc.replace(QChar(711), ' '); - const QChar grave(96); - doc.replace(' ' + grave, " '"); - doc.replace(QString(2, grave), "'"); - doc.replace(grave + 'a', QChar(224)); - doc.replace(grave + 'e', QChar(232)); - doc.replace(grave + 'i', QChar(236)); - doc.replace(grave + 'o', QChar(242)); - doc.replace(grave + 'u', QChar(249)); - doc.replace(grave + 'A', QChar(192)); - doc.replace(grave + 'E', QChar(200)); - doc.replace(grave + 'I', QChar(204)); - doc.replace(grave + 'O', QChar(210)); - doc.replace(grave + 'U', QChar(217)); - doc.replace('a' + grave, QChar(224)); - doc.replace('e' + grave, QChar(232)); - doc.replace('i' + grave, QChar(236)); - doc.replace('o' + grave, QChar(242)); - doc.replace('u' + grave, QChar(249)); - doc.replace('A' + grave + ' ', QChar(192)); - doc.replace('E' + grave + ' ', QChar(200)); - doc.replace('I' + grave + ' ', QChar(204)); - doc.replace('O' + grave + ' ', QChar(210)); - doc.replace('U' + grave + ' ', QChar(217)); - doc.replace('A' + grave, QChar(192)); - doc.replace('E' + grave, QChar(200)); - doc.replace('I' + grave, QChar(204)); - doc.replace('O' + grave, QChar(210)); - doc.replace('U' + grave, QChar(217)); - const QChar dieresis(168); - doc.replace(dieresis + 'a', QChar(228)); - doc.replace(dieresis + 'e', QChar(235)); - doc.replace(dieresis + 'i', QChar(239)); - doc.replace(dieresis + 'o', QChar(246)); - doc.replace(dieresis + 'u', QChar(252)); - doc.replace(dieresis + 'A', QChar(196)); - doc.replace(dieresis + 'E', QChar(203)); - doc.replace(dieresis + 'I', QChar(207)); - doc.replace(dieresis + 'O', QChar(214)); - doc.replace(dieresis + 'U', QChar(220)); - doc.replace('a' + dieresis, QChar(228)); - doc.replace('e' + dieresis, QChar(235)); - doc.replace('i' + dieresis, QChar(239)); - doc.replace('o' + dieresis, QChar(246)); - doc.replace('u' + dieresis, QChar(252)); - doc.replace('A' + dieresis + ' ', QChar(196)); - doc.replace('E' + dieresis + ' ', QChar(203)); - doc.replace('I' + dieresis + ' ', QChar(207)); - doc.replace('O' + dieresis + ' ', QChar(214)); - doc.replace('U' + dieresis + ' ', QChar(220)); - doc.replace('A' + dieresis, QChar(196)); - doc.replace('E' + dieresis, QChar(203)); - doc.replace('I' + dieresis, QChar(207)); - doc.replace('O' + dieresis, QChar(214)); - doc.replace('U' + dieresis, QChar(220)); - const QChar accute(180); - doc.replace(accute + 'a', QChar(225)); - doc.replace(accute + 'e', QChar(233)); - doc.replace(accute + 'i', QChar(237)); - doc.replace(accute + 'o', QChar(243)); - doc.replace(accute + 'u', QChar(250)); - doc.replace(accute + 'A', QChar(193)); - doc.replace(accute + 'E', QChar(201)); - doc.replace(accute + 'I', QChar(205)); - doc.replace(accute + 'O', QChar(211)); - doc.replace(accute + 'U', QChar(218)); - doc.replace('a' + accute, QChar(225)); - doc.replace('e' + accute, QChar(233)); - doc.replace('i' + accute, QChar(237)); - doc.replace('o' + accute, QChar(243)); - doc.replace('u' + accute, QChar(250)); - doc.replace('A' + accute + ' ', QChar(193)); - doc.replace('E' + accute + ' ', QChar(201)); - doc.replace('I' + accute + ' ', QChar(205)); - doc.replace('O' + accute + ' ', QChar(211)); - doc.replace('U' + accute + ' ', QChar(218)); - doc.replace('A' + accute, QChar(193)); - doc.replace('E' + accute, QChar(201)); - doc.replace('I' + accute, QChar(205)); - doc.replace('O' + accute, QChar(211)); - doc.replace('U' + accute, QChar(218)); - const QChar circumflex(710); - doc.replace(circumflex + 'a', QChar(226)); - doc.replace(circumflex + 'e', QChar(234)); - doc.replace(circumflex + 'i', QChar(238)); - doc.replace(circumflex + 'o', QChar(244)); - doc.replace(circumflex + 'u', QChar(251)); - doc.replace(circumflex + 'A', QChar(194)); - doc.replace(circumflex + 'E', QChar(202)); - doc.replace(circumflex + 'I', QChar(206)); - doc.replace(circumflex + 'O', QChar(212)); - doc.replace(circumflex + 'U', QChar(219)); - doc.replace('a' + circumflex, QChar(226)); - doc.replace('e' + circumflex, QChar(234)); - doc.replace('i' + circumflex, QChar(238)); - doc.replace('o' + circumflex, QChar(244)); - doc.replace('u' + circumflex, QChar(251)); - doc.replace('A' + circumflex + ' ', QChar(194)); - doc.replace('E' + circumflex + ' ', QChar(202)); - doc.replace('I' + circumflex + ' ', QChar(206)); - doc.replace('O' + circumflex + ' ', QChar(212)); - doc.replace('U' + circumflex + ' ', QChar(219)); - doc.replace('A' + circumflex, QChar(194)); - doc.replace('E' + circumflex, QChar(202)); - doc.replace('I' + circumflex, QChar(206)); - doc.replace('O' + circumflex, QChar(212)); - doc.replace('U' + circumflex, QChar(219)); - const QChar cedilla(184); - doc.replace('c' + cedilla, QChar(231)); - doc.replace('C' + cedilla, QChar(199)); - doc.replace(cedilla + 'c', QChar(231)); - doc.replace(cedilla + 'C', QChar(199)); - doc.replace('s' + cedilla, QChar(351)); - doc.replace('S' + cedilla, QChar(350)); - doc.replace(cedilla + 's', QChar(351)); - doc.replace(cedilla + 'S', QChar(350)); - const QChar tilde(732); - doc.replace('n' + tilde, QChar(241)); - doc.replace('N' + tilde, QChar(209)); - doc.replace(tilde + 'n', QChar(241)); - doc.replace(tilde + 'N', QChar(209)); - doc.replace('a' + tilde, QChar(227)); - doc.replace('A' + tilde, QChar(195)); - doc.replace(tilde + 'a', QChar(227)); - doc.replace(tilde + 'A', QChar(195)); - const QChar ring(730); - doc.replace('a' + ring, QChar(229)); - doc.replace('A' + ring, QChar(197)); - doc.replace(ring + 'a', QChar(229)); - doc.replace(ring + 'A', QChar(197)); - // poppler - doc.remove(QChar(826)); - doc.remove(QChar(841)); - doc.remove(QChar(849)); - doc.remove(QChar(850)); - doc.remove(QChar(851)); - doc.remove(QChar(852)); - doc.remove(QChar(853)); - doc.remove(QChar(854)); - doc.remove(QChar(855)); - doc.remove(QChar(856)); - doc.remove(QChar(858)); - doc.remove(QChar(862)); - doc.remove(QChar(873)); - doc.remove(QChar(874)); - doc.remove(QChar(888)); - // Skip control codes - // Many are improper conversions from PDF to text mathematical symbols - doc.replace(QChar(127), ' '); - for (int i = 0; i < doc.length(); ++i) - { - QCharRef c = doc[i]; - const int u(c.unicode()); - if (u > 31) + return doc; +} + +QString& document::normalize(QString& doc, const Conversion mode) +{ + if (doc.length() == 0) + return doc; + + const ushort unull(0); + const ushort unl(10); + const ushort uspace(32); + const ushort uhyp(45); + + bool hgrave(false); + bool hdieresis(false); + bool haccute(false); + bool hcedilla(false); + bool hcircumflex(false); + bool hcaron(false); + bool hring(false); + bool htilde(false); + + bool hreg(false); + bool hligatures(false); + + ushort* const c0((ushort*)doc.data()); + const ushort* const cn(c0 + doc.length()); + ushort* c(c0 - 1); + + while (c < cn) + { + ++c; + + ushort& uc(*c); + if (uc > 96 && uc < 127) continue; - if (u > 8 && u < 14) // tabs, new lines + if (uc > 31 && uc < 94) continue; - c = ' '; + + const QChar::Category ct(QChar::category(uc)); + + if (ct == QChar::Mark_NonSpacing) + uc = unull; + else if (ct == QChar::Mark_SpacingCombining) + uc = uspace; + else if (ct == QChar::Mark_Enclosing) + uc = uspace; + else if (ct == QChar::Separator_Space) + uc = uspace; + else if (ct == QChar::Separator_Paragraph) + uc = unl; + else if (ct == QChar::Other_Control) + { + if (uc == 10 || uc == 13) + uc = unl; + else + uc = uspace; + } + else if (ct == QChar::Other_Format) + uc = uc == 173 ? uhyp : unull; + else if (ct == QChar::Other_PrivateUse) + uc = uspace; + else if (ct == QChar::Other_NotAssigned) + uc = uspace; + else if (uc == QChar::ReplacementCharacter) + uc = uspace; + + else if (uc == 96) + hgrave = true; + else if (uc == 168) + hdieresis = true; + else if (uc == 180) + haccute = true; + else if (uc == 184) + hcedilla = true; + else if (uc == 710) + hcircumflex = true; + else if (uc == 711) + hcaron = true; + else if (uc == 730) + hring = true; + else if (uc == 732) + htilde = true; + + // Normalize apostrophe + else if (uc == 8216 || uc == 8217) + uc = 39; + + // Normalize comma + else if (uc == 65292) + uc = 44; + + // Normalize quotation + else if (uc == 8220 || uc == 8221 || uc == 65282) + uc = 34; + + // Normalize separator + else if ((uc > 8207 && uc < 8213) || uc == 8722) + uc = uhyp; + + // Corrections + else if (uc == 174) + hreg = true; + else if (uc == 305) + uc = 105; + else if (uc == 1001) + uc = 43; + else if (uc == 1002 || uc == 1003) + uc = 45; + else if (uc == 306 || + uc == 307 || + uc == 455 || + uc == 460 || + uc == 498 || + uc == 64256 || + uc == 64257 || + uc == 64258 || + uc == 64259 || + uc == 64260) + hligatures = true; + } + + // Diacritics from legacy PDFs are set to text in several manners: + // - an orphan diacritic is set either before or after the letter + // - an orphan diacritic might be followed by one or more spaces, resulting in broken words + // These deficiencies impact on indexing and searching + // In the following + // - an orphan diacritic is re-set to the most probably accented letters + // - extra spaces are removed whenever the risk of joining two independent words is low + if (haccute) + { + const ushort uaccute(180); + c = c0 + 1; + const ushort* const cm(cn - 2); + while (c < cm) + { + if (*c == uaccute && *(c + 1) == uspace) + { + const QChar r(*(c - 1)); + const QChar s(*(c + 2)); + if (r.isLetter()) + if ((r.isUpper() && s.isLetter()) || + s.category() == QChar::Punctuation_Dash || + s.category() == QChar::Punctuation_Other || + s.isSpace()) + *(c + 1) = unull; + } + ++c; + } + } + + // Revert hyphenation (skip for FirstPage mode to preserve layout) + if (mode == Complete) + { + c = c0 + 1; + const ushort* const cm(cn - 2); + + while (c < cm) + { + if (*c == uhyp) + { + const QChar r(*(c - 1)); + if (r.isLetter()) + { + ushort* cs(c); + bool h(false); + while (cs < cn) + if (QChar(*(++cs)).isLetter()) + break; + else if (*cs == unl) + h = true; + else if (*cs != uspace) + { + h = false; + break; + } + if (h && cs < cn) + { + QString testw; + for (ushort* cw = c - 1; cw > c0; --cw) + if (QChar(*cw).isLetter()) + testw.prepend(QChar(*cw)); + else + break; + testw.append(QChar(uhyp)); + for (ushort* cw = cs; cw < cn; ++cw) + if (QChar(*cw).isLetter()) + testw.append(QChar(*cw)); + else + break; + const QChar s(*cs); + + // Avoid de-hyphenating 'divide-and-conquer' like cases by checking the word in document + if (doc.contains(testw)) + ++c; + // Avoid de-hyphenating 'Hartree-Fock' like cases; replace hyphen by space + else if ((r.isLower() && s.isUpper()) || (r.isUpper() && s.isLower())) + *(c++) = uspace; + + for (ushort* z = c; z < cs; ++z) + *z = unull; + c = cs + 1; + } + } + } + ++c; + } } + + // Clear extra spaces on enclosing marks + { + c = c0; + while (c < cn) + { + ++c; + + ushort& uc(*c); + if (uc < 40) + continue; + if (uc > 41 && uc < 91) + continue; + if (uc > 93 && uc < 123) + continue; + + const QChar::Category ct(QChar::category(uc)); + if (ct == QChar::Punctuation_Open) + { + for (ushort* co = c + 1; co < cn; ++co) + if (*co == uspace || *co == unl || *co == unull) + *co = unull; + else + break; + } + else if (ct == QChar::Punctuation_Close) + { + for (ushort* cc = c - 1; cc > c0; --cc) + if (*cc == uspace || *cc == unl || *cc == unull) + *cc = unull; + else + break; + } + } + } + + // Remove null characters (djvutxt end of page, and other control characters) + doc.remove(QChar(unull)); + + if (hreg) + { + // Correct frequent misencoding of "fi" as circle R in PDFs + doc.replace(QRegExp(QString("%1([a-z])").arg(QChar(174))), "fi\\1"); + } + if (hligatures) + { + // Revert Latin ligatures + doc.replace(QChar(306), "IJ"); + doc.replace(QChar(307), "ij"); + doc.replace(QChar(455), "LJ"); + doc.replace(QChar(460), "nj"); + doc.replace(QChar(498), "Dz"); + doc.replace(QChar(64256), "ff"); + doc.replace(QChar(64257), "fi"); + doc.replace(QChar(64258), "fl"); + doc.replace(QChar(64259), "ffi"); + doc.replace(QChar(64260), "ffl"); + } + if (hgrave) + { + const QChar grave(96); + doc.replace('a' + grave, QChar(224)); + doc.replace(grave + 'a', QChar(224)); + doc.replace('e' + grave, QChar(232)); + doc.replace(grave + 'e', QChar(232)); + doc.replace('o' + grave, QChar(242)); + doc.replace('u' + grave, QChar(249)); + doc.replace('y' + grave, QChar(7923)); + doc.replace('A' + grave, QChar(192)); + doc.replace('E' + grave, QChar(200)); + doc.replace('O' + grave, QChar(210)); + } + if (hdieresis) + { + const QChar dieresis(168); + doc.replace(QRegExp(dieresis + ' ' + '+'), dieresis); + doc.replace(dieresis + ' ', dieresis); + doc.replace('a' + dieresis, QChar(228)); + doc.replace('e' + dieresis, QChar(235)); + doc.replace('i' + dieresis, QChar(239)); + doc.replace('o' + dieresis, QChar(246)); + doc.replace('u' + dieresis, QChar(252)); + doc.replace('A' + dieresis, QChar(196)); + doc.replace('E' + dieresis, QChar(203)); + doc.replace('I' + dieresis, QChar(207)); + doc.replace('O' + dieresis, QChar(214)); + doc.replace('U' + dieresis, QChar(220)); + doc.replace(dieresis + 'a', QChar(228)); + doc.replace(dieresis + 'e', QChar(235)); + doc.replace(dieresis + 'i', QChar(239)); + doc.replace(dieresis + 'o', QChar(246)); + doc.replace(dieresis + 'u', QChar(252)); + doc.replace(dieresis + 'A', QChar(196)); + doc.replace(dieresis + 'E', QChar(203)); + doc.replace(dieresis + 'I', QChar(207)); + doc.replace(dieresis + 'O', QChar(214)); + doc.replace(dieresis + 'U', QChar(220)); + } + if (haccute) + { + const QChar accute(180); + doc.replace('e' + accute, QChar(233)); + doc.replace(accute + 'e', QChar(233)); + doc.replace('A' + accute, QChar(193)); + doc.replace(accute + 'A', QChar(193)); + doc.replace('a' + accute, QChar(225)); + doc.replace(accute + 'a', QChar(225)); + doc.replace('o' + accute, QChar(243)); + doc.replace(accute + 'o', QChar(243)); + doc.replace('i' + accute, QChar(237)); + doc.replace(accute + 'i', QChar(237)); + doc.replace('E' + accute, QChar(201)); + doc.replace(accute + 'E', QChar(201)); + doc.replace('u' + accute, QChar(250)); + doc.replace(accute + 'u', QChar(250)); + doc.replace('O' + accute, QChar(211)); + doc.replace(accute + 'O', QChar(211)); + doc.replace('I' + accute, QChar(205)); + doc.replace(accute + 'I', QChar(205)); + doc.replace('U' + accute, QChar(218)); + doc.replace(accute + 'U', QChar(218)); + doc.replace('c' + accute, QChar(263)); + doc.replace('C' + accute, QChar(262)); + doc.replace('y' + accute, QChar(253)); + doc.replace('Y' + accute, QChar(221)); + } + if (hcedilla) + { + const QChar cedilla(184); + doc.replace('c' + cedilla, QChar(231)); + doc.replace(cedilla + 'c', QChar(231)); + doc.replace('C' + cedilla, QChar(199)); + doc.replace(cedilla + 'C', QChar(199)); + doc.replace('s' + cedilla, QChar(351)); + doc.replace(cedilla + 's', QChar(351)); + doc.replace('S' + cedilla, QChar(350)); + doc.replace(cedilla + 'S', QChar(350)); + doc.replace('e' + cedilla, QChar(553)); + doc.replace(cedilla + 'e', QChar(553)); + doc.replace('E' + cedilla, QChar(552)); + doc.replace(cedilla + 'E', QChar(552)); + } + if (hcircumflex) + { + const QChar circumflex(710); + doc.replace('a' + circumflex, QChar(226)); + doc.replace(circumflex + 'a', QChar(226)); + doc.replace('e' + circumflex, QChar(234)); + doc.replace(circumflex + 'e', QChar(234)); + doc.replace('i' + circumflex, QChar(238)); + doc.replace(circumflex + 'i', QChar(238)); + doc.replace('o' + circumflex, QChar(244)); + doc.replace(circumflex + 'o', QChar(244)); + } + if (hcaron) + { + const QChar caron(711); + doc.replace('c' + caron, QChar(269)); + doc.replace(caron + 'c', QChar(269)); + doc.replace('C' + caron, QChar(268)); + doc.replace(caron + 'C', QChar(268)); + doc.replace('z' + caron, QChar(382)); + doc.replace(caron + 'z', QChar(382)); + doc.replace('Z' + caron, QChar(381)); + doc.replace(caron + 'Z', QChar(381)); + doc.replace('s' + caron, QChar(353)); + doc.replace(caron + 's', QChar(353)); + doc.replace('S' + caron, QChar(352)); + doc.replace(caron + 'S', QChar(352)); + doc.replace('r' + caron, QChar(345)); + doc.replace(caron + 'r', QChar(345)); + doc.replace('R' + caron, QChar(344)); + doc.replace(caron + 'R', QChar(344)); + } + if (hring) + { + const QChar ring(730); + doc.replace('a' + ring, QChar(229)); + doc.replace('A' + ring, QChar(197)); + doc.replace(ring + 'a', QChar(229)); + doc.replace(ring + 'A', QChar(197)); + } + if (htilde) + { + const QChar tilde(732); + doc.replace('n' + tilde, QChar(241)); + doc.replace('N' + tilde, QChar(209)); + doc.replace('a' + tilde, QChar(227)); + doc.replace('A' + tilde, QChar(195)); + } + + // Simplify (skip for FirstPage mode to preserve layout) + if (mode == Complete) + c2bUtils::simplifyString(doc); + return doc; } @@ -280,7 +488,7 @@ settings* s(settings::instance()); switch (_conversion_mode) { - case Raw: + case Complete: setConverter(s->fileName("c2bBibSearcher/Pdf2TextBin"), s->value("c2bBibSearcher/Pdf2TextArg").toString()); break; case FirstPage: diff -Nru cb2bib-1.4.9/src/c2b/document.h cb2bib-1.9.2/src/c2b/document.h --- cb2bib-1.4.9/src/c2b/document.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/document.h 2015-08-09 19:58:26.381734824 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef DOCUMENT_H @@ -16,9 +16,9 @@ { public: - enum Conversion {FirstPage, Raw}; + enum Conversion {FirstPage, Complete}; - document(const QString& fn = QString(), const Conversion mode = FirstPage); + document(const QString& fn, const Conversion mode); inline ~document() {} QString fileToString(const QString& fn); @@ -34,6 +34,8 @@ return _log_string.trimmed(); } + static QString& normalize(QString& doc, const Conversion mode); + private: Conversion _conversion_mode; QString _converter_arg; diff -Nru cb2bib-1.4.9/src/c2b/documentParser.cpp cb2bib-1.9.2/src/c2b/documentParser.cpp --- cb2bib-1.4.9/src/c2b/documentParser.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/documentParser.cpp 2015-08-09 19:58:26.329735346 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "documentParser.h" diff -Nru cb2bib-1.4.9/src/c2b/documentParser.h cb2bib-1.9.2/src/c2b/documentParser.h --- cb2bib-1.4.9/src/c2b/documentParser.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/documentParser.h 2015-08-09 19:58:26.385734784 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef DOCUMENTPARSER_H diff -Nru cb2bib-1.4.9/src/c2b/heuristicBibParser.cpp cb2bib-1.9.2/src/c2b/heuristicBibParser.cpp --- cb2bib-1.4.9/src/c2b/heuristicBibParser.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/heuristicBibParser.cpp 2015-08-09 19:58:26.331735326 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "heuristicBibParser.h" @@ -9,8 +9,6 @@ #include "bibParser.h" #include "journalDB.h" -#include "qtregexp/eqregexp.h" - #include <QDate> @@ -72,22 +70,22 @@ // If not, in cases as 'LnnL ... Lnn,nn,Lnn,&nnL' it will overextend addresses to include Lnn,nn,L. // This is not related to minimal/greedy. // Note also that Lnn,nn,L will not be taken, unless it is followed by another author line. This is a feature. - _author_b2_lc_rx = new EQRegExp(QString("(%1)%2{0,7}(%1)").arg(author_lc).arg(author_address), - Qt::CaseSensitive, EQRegExp::RegExp); - _author_b2_uc_rx = new EQRegExp(QString("(%1)%2{0,7}(%1)").arg(author_uc).arg(author_address), - Qt::CaseSensitive, EQRegExp::RegExp); - _author_b3_lc_rx = new EQRegExp(QString("(%1)%2{0,7}(%1)%2{0,7}(%1)").arg(author_lc).arg(author_address), - Qt::CaseSensitive, EQRegExp::RegExp); - _author_b3_uc_rx = new EQRegExp(QString("(%1)%2{0,7}(%1)%2{0,7}(%1)").arg(author_uc).arg(author_address), - Qt::CaseSensitive, EQRegExp::RegExp); - _author_b4_lc_rx = new EQRegExp(QString("(%1)%2{0,7}(%1)%2{0,7}(%1)%2{0,7}(%1)").arg(author_lc).arg(author_address), - Qt::CaseSensitive, EQRegExp::RegExp); - _author_b4_uc_rx = new EQRegExp(QString("(%1)%2{0,7}(%1)%2{0,7}(%1)%2{0,7}(%1)").arg(author_uc).arg(author_address), - Qt::CaseSensitive, EQRegExp::RegExp); - _author_b5_lc_rx = new EQRegExp(QString("(%1)%2{0,7}(%1)%2{0,7}(%1)%2{0,7}(%1)%2{0,7}(%1)").arg(author_lc).arg(author_address), - Qt::CaseSensitive, EQRegExp::RegExp); - _author_b5_uc_rx = new EQRegExp(QString("(%1)%2{0,7}(%1)%2{0,7}(%1)%2{0,7}(%1)%2{0,7}(%1)").arg(author_uc).arg(author_address), - Qt::CaseSensitive, EQRegExp::RegExp); + _author_b2_lc_rx = new QRegExp(QString("(%1)%2{0,7}(%1)").arg(author_lc).arg(author_address), + Qt::CaseSensitive, QRegExp::RegExp); + _author_b2_uc_rx = new QRegExp(QString("(%1)%2{0,7}(%1)").arg(author_uc).arg(author_address), + Qt::CaseSensitive, QRegExp::RegExp); + _author_b3_lc_rx = new QRegExp(QString("(%1)%2{0,7}(%1)%2{0,7}(%1)").arg(author_lc).arg(author_address), + Qt::CaseSensitive, QRegExp::RegExp); + _author_b3_uc_rx = new QRegExp(QString("(%1)%2{0,7}(%1)%2{0,7}(%1)").arg(author_uc).arg(author_address), + Qt::CaseSensitive, QRegExp::RegExp); + _author_b4_lc_rx = new QRegExp(QString("(%1)%2{0,7}(%1)%2{0,7}(%1)%2{0,7}(%1)").arg(author_lc).arg(author_address), + Qt::CaseSensitive, QRegExp::RegExp); + _author_b4_uc_rx = new QRegExp(QString("(%1)%2{0,7}(%1)%2{0,7}(%1)%2{0,7}(%1)").arg(author_uc).arg(author_address), + Qt::CaseSensitive, QRegExp::RegExp); + _author_b5_lc_rx = new QRegExp(QString("(%1)%2{0,7}(%1)%2{0,7}(%1)%2{0,7}(%1)%2{0,7}(%1)").arg(author_lc).arg(author_address), + Qt::CaseSensitive, QRegExp::RegExp); + _author_b5_uc_rx = new QRegExp(QString("(%1)%2{0,7}(%1)%2{0,7}(%1)%2{0,7}(%1)%2{0,7}(%1)").arg(author_uc).arg(author_address), + Qt::CaseSensitive, QRegExp::RegExp); _author_b2_lc_rx->setMinimal(true); _author_b2_uc_rx->setMinimal(true); _author_b3_lc_rx->setMinimal(true); diff -Nru cb2bib-1.4.9/src/c2b/heuristicBibParser.h cb2bib-1.9.2/src/c2b/heuristicBibParser.h --- cb2bib-1.4.9/src/c2b/heuristicBibParser.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/heuristicBibParser.h 2015-08-09 19:58:26.386734774 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef HEURISTICBIBPARSER_H @@ -11,7 +11,6 @@ #include "bibReference.h" -class EQRegExp; class bibParser; class journalDB; @@ -25,7 +24,7 @@ { public: - heuristicBibParser(bibParser* bp); + explicit heuristicBibParser(bibParser* bp); ~heuristicBibParser(); void guessFields(const QString& clean_text, const QString& tagged_text); @@ -33,14 +32,14 @@ private: - EQRegExp* _author_b2_lc_rx; - EQRegExp* _author_b2_uc_rx; - EQRegExp* _author_b3_lc_rx; - EQRegExp* _author_b3_uc_rx; - EQRegExp* _author_b4_lc_rx; - EQRegExp* _author_b4_uc_rx; - EQRegExp* _author_b5_lc_rx; - EQRegExp* _author_b5_uc_rx; + QRegExp* _author_b2_lc_rx; + QRegExp* _author_b2_uc_rx; + QRegExp* _author_b3_lc_rx; + QRegExp* _author_b3_uc_rx; + QRegExp* _author_b4_lc_rx; + QRegExp* _author_b4_uc_rx; + QRegExp* _author_b5_lc_rx; + QRegExp* _author_b5_uc_rx; QRegExp _author_sb; QRegExp _author_sb_lc; QRegExp _author_sb_uc; diff -Nru cb2bib-1.4.9/src/c2b/htm/tex2html.html cb2bib-1.9.2/src/c2b/htm/tex2html.html --- cb2bib-1.4.9/src/c2b/htm/tex2html.html 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/htm/tex2html.html 2015-08-09 19:52:56.000000000 +0000 @@ -34,7 +34,7 @@ <tr class="footer"> <td width="100%" align="left"> <a href="http://www.molspaces.com/cb2bib/index.html">The cb2Bib / version GET_CB2BIB_VERSION_NUMBER</a>. - Copyright © 2004-2012 by Pere Constans. Licensed under the terms of the + Copyright © 2004-2015 by Pere Constans. Licensed under the terms of the <a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a> version 3. </td> </tr> diff -Nru cb2bib-1.4.9/src/c2b/idMaker.cpp cb2bib-1.9.2/src/c2b/idMaker.cpp --- cb2bib-1.4.9/src/c2b/idMaker.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/idMaker.cpp 2015-08-09 19:58:26.333735306 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. * * Improvements and modifications: diff -Nru cb2bib-1.4.9/src/c2b/idMaker.h cb2bib-1.9.2/src/c2b/idMaker.h --- cb2bib-1.4.9/src/c2b/idMaker.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/idMaker.h 2015-08-09 19:58:26.388734754 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. * * Improvements and modifications: diff -Nru cb2bib-1.4.9/src/c2b/journalDB.cpp cb2bib-1.9.2/src/c2b/journalDB.cpp --- cb2bib-1.4.9/src/c2b/journalDB.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/journalDB.cpp 2015-08-09 19:58:26.334735296 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "journalDB.h" diff -Nru cb2bib-1.4.9/src/c2b/journalDB.h cb2bib-1.9.2/src/c2b/journalDB.h --- cb2bib-1.4.9/src/c2b/journalDB.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/journalDB.h 2015-08-09 19:58:26.389734744 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef JOURNALDB_H @@ -20,7 +20,7 @@ { public: - journalDB(const QString& dbfile); + explicit journalDB(const QString& dbfile); inline ~journalDB() {} QString retrieve(const QString& JQuery) const; diff -Nru cb2bib-1.4.9/src/c2b/metadataParser.cpp cb2bib-1.9.2/src/c2b/metadataParser.cpp --- cb2bib-1.4.9/src/c2b/metadataParser.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/metadataParser.cpp 2015-08-09 19:58:26.336735276 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "metadataParser.h" diff -Nru cb2bib-1.4.9/src/c2b/metadataParser.h cb2bib-1.9.2/src/c2b/metadataParser.h --- cb2bib-1.4.9/src/c2b/metadataParser.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/metadataParser.h 2015-08-09 19:58:26.390734734 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef METADATAPARSER_H @@ -21,7 +21,7 @@ Q_OBJECT public: - metadataParser(QObject* parento = 0); + explicit metadataParser(QObject* parento = 0); metadataParser(coreBibParser* bp, QObject* parento = 0); inline ~metadataParser() {} diff -Nru cb2bib-1.4.9/src/c2b/monthDB.cpp cb2bib-1.9.2/src/c2b/monthDB.cpp --- cb2bib-1.4.9/src/c2b/monthDB.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/monthDB.cpp 2015-08-09 19:58:26.337735266 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "monthDB.h" diff -Nru cb2bib-1.4.9/src/c2b/monthDB.h cb2bib-1.9.2/src/c2b/monthDB.h --- cb2bib-1.4.9/src/c2b/monthDB.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/monthDB.h 2015-08-09 19:58:26.392734714 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef MONTHDB_H diff -Nru cb2bib-1.4.9/src/c2b/network.cpp cb2bib-1.9.2/src/c2b/network.cpp --- cb2bib-1.4.9/src/c2b/network.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/network.cpp 2015-08-09 19:58:26.339735246 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "network.h" @@ -10,6 +10,7 @@ #include "settings.h" #include <QNetworkCookie> +#include <QNetworkCookieJar> #include <QNetworkProxy> #include <QNetworkReply> #include <QTimer> @@ -26,7 +27,7 @@ // Set predefined cookies QNetworkCookieJar* ncj = _fetcher->cookieJar(); QNetworkCookie nc("GSP", "ID=d093ce1ea042ad2b:IN=54afcd58e3b38df9:HIN=ff7e3a3ab3fbae0a+7e6cc990821af63:CF=4"); - ncj->setCookiesFromUrl(QList<QNetworkCookie>() << nc, QUrl("http://scholar.google.com")); + ncj->setCookiesFromUrl(QList<QNetworkCookie>() << nc, QUrl("https://scholar.google.com")); } diff -Nru cb2bib-1.4.9/src/c2b/network.h cb2bib-1.9.2/src/c2b/network.h --- cb2bib-1.4.9/src/c2b/network.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/network.h 2015-08-09 19:58:26.393734704 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef NETWORK_H @@ -25,7 +25,7 @@ Q_OBJECT public: - network(QObject* parento = 0); + explicit network(QObject* parento = 0); inline ~network() {} enum Action {Copy, Move}; diff -Nru cb2bib-1.4.9/src/c2b/networkQuery.cpp cb2bib-1.9.2/src/c2b/networkQuery.cpp --- cb2bib-1.4.9/src/c2b/networkQuery.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/networkQuery.cpp 2015-08-09 19:58:26.340735236 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "networkQuery.h" diff -Nru cb2bib-1.4.9/src/c2b/networkQuery.h cb2bib-1.9.2/src/c2b/networkQuery.h --- cb2bib-1.4.9/src/c2b/networkQuery.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/networkQuery.h 2015-08-09 19:58:26.394734694 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef NETWORKQUERY_H diff -Nru cb2bib-1.4.9/src/c2b/posTagger.cpp cb2bib-1.9.2/src/c2b/posTagger.cpp --- cb2bib-1.4.9/src/c2b/posTagger.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/posTagger.cpp 2015-08-09 19:58:26.342735216 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "posTagger.h" diff -Nru cb2bib-1.4.9/src/c2b/posTagger.h cb2bib-1.9.2/src/c2b/posTagger.h --- cb2bib-1.4.9/src/c2b/posTagger.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/posTagger.h 2015-08-09 19:58:26.396734674 +0000 @@ -1,14 +1,14 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef POSTAGGER_H #define POSTAGGER_H #include <QHash> - +#include <QString> class posTagger { diff -Nru cb2bib-1.4.9/src/c2b/preprocess.cpp cb2bib-1.9.2/src/c2b/preprocess.cpp --- cb2bib-1.4.9/src/c2b/preprocess.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/preprocess.cpp 2015-08-09 19:58:26.343735206 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "preprocess.h" diff -Nru cb2bib-1.4.9/src/c2b/preprocess.h cb2bib-1.9.2/src/c2b/preprocess.h --- cb2bib-1.4.9/src/c2b/preprocess.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/preprocess.h 2015-08-09 19:58:26.397734664 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef PREPROCESS_H @@ -20,7 +20,7 @@ Q_OBJECT public: - preprocess(QObject* parento = 0); + explicit preprocess(QObject* parento = 0); inline ~preprocess() {} diff -Nru cb2bib-1.4.9/src/c2b/pubmedXml.cpp cb2bib-1.9.2/src/c2b/pubmedXml.cpp --- cb2bib-1.4.9/src/c2b/pubmedXml.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/pubmedXml.cpp 2015-08-09 19:58:26.344735196 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "pubmedXml.h" diff -Nru cb2bib-1.4.9/src/c2b/pubmedXml.h cb2bib-1.9.2/src/c2b/pubmedXml.h --- cb2bib-1.4.9/src/c2b/pubmedXml.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/pubmedXml.h 2015-08-09 19:58:26.399734643 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef PUBMEDXML_H @@ -16,7 +16,7 @@ { public: - pubmedXml(const QString& xml); + explicit pubmedXml(const QString& xml); inline ~pubmedXml() {} inline bibReference reference() const diff -Nru cb2bib-1.4.9/src/c2b/qtregexp/eqregexp.cpp cb2bib-1.9.2/src/c2b/qtregexp/eqregexp.cpp --- cb2bib-1.4.9/src/c2b/qtregexp/eqregexp.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/qtregexp/eqregexp.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,4131 +0,0 @@ -/*************************************************************************** - * Modified QRegExp - * constans@molspaces.com, 2009 - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. - * - *************************************************************************** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** This file may be used under the terms of the GNU General Public -** License versions 2.0 or 3.0 as published by the Free Software -** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Alternatively you may (at -** your option) use any later version of the GNU General Public -** License if such license has been publicly approved by Trolltech ASA -** (or its successors, if any) and the KDE Free Qt Foundation. In -** addition, as a special exception, Trolltech gives you certain -** additional rights. These rights are described in the Trolltech GPL -** Exception version 1.2, which can be found at -** http://www.trolltech.com/products/qt/gplexception/ and in the file -** GPL_EXCEPTION.txt in this package. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. If -** you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** In addition, as a special exception, Trolltech, as the sole -** copyright holder for Qt Designer, grants users of the Qt/Eclipse -** Integration plug-in the right for the Qt/Eclipse Integration to -** link to functionality provided by Qt Designer and its related -** libraries. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not expressly -** granted herein. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -****************************************************************************/ - -#include "eqregexp.h" - -#include "qalgorithms.h" -#include "qbitarray.h" -#include "qcache.h" -#include "qdatastream.h" -#include "qlist.h" -#include "qmap.h" -#include "qmutex.h" -#include "qstring.h" -#include "qstringlist.h" -#include "qvector.h" - -#include <limits.h> - -// error strings for the regexp parser -#define RXERR_OK QT_TRANSLATE_NOOP("EQRegExp", "no error occurred") -#define RXERR_DISABLED QT_TRANSLATE_NOOP("EQRegExp", "disabled feature used") -#define RXERR_CHARCLASS QT_TRANSLATE_NOOP("EQRegExp", "bad char class syntax") -#define RXERR_LOOKAHEAD QT_TRANSLATE_NOOP("EQRegExp", "bad lookahead syntax") -#define RXERR_REPETITION QT_TRANSLATE_NOOP("EQRegExp", "bad repetition syntax") -#define RXERR_OCTAL QT_TRANSLATE_NOOP("EQRegExp", "invalid octal value") -#define RXERR_LEFTDELIM QT_TRANSLATE_NOOP("EQRegExp", "missing left delim") -#define RXERR_END QT_TRANSLATE_NOOP("EQRegExp", "unexpected end") -#define RXERR_LIMIT QT_TRANSLATE_NOOP("EQRegExp", "met internal limit") - -/* - WARNING! Be sure to read qregexp.tex before modifying this file. -*/ - -/*! - \class EQRegExp - \reentrant - \brief The EQRegExp class provides pattern matching using regular expressions. - - \ingroup tools - \ingroup misc - \ingroup shared - \mainclass - \keyword regular expression - - Regular expressions, or "regexps", provide a way to find patterns - within text. This is useful in many contexts, for example: - - \table - \row \i Validation - \i A regexp can be used to check whether a piece of text - meets some criteria, e.g. is an integer or contains no - whitespace. - \row \i Searching - \i Regexps provide a much more powerful means of searching - text than simple string matching does. For example we can - create a regexp which says "find one of the words 'mail', - 'letter' or 'correspondence' but not any of the words - 'email', 'mailman' 'mailer', 'letterbox', etc." - \row \i Search and Replace - \i A regexp can be used to replace a pattern with a piece of - text, for example replace all occurrences of '&' with - '\&' except where the '&' is already followed by 'amp;'. - \row \i String Splitting - \i A regexp can be used to identify where a string should be - split into its component fields, e.g. splitting tab-delimited - strings. - \endtable - - We present a very brief introduction to regexps, a description of - Qt's regexp language, some code examples, and finally the - function documentation itself. EQRegExp is modeled on Perl's - regexp language, and also fully supports Unicode. EQRegExp can - also be used in the weaker wildcard mode that works in a - similar way to command shells. It can even be feed with fixed - strings (see setPatternSyntax()). A good text on regexps is \e - {Mastering Regular Expressions} (Third Edition) by Jeffrey E. F. - Friedl, ISBN 0-596-52812-4. - - \tableofcontents - - \section1 Introduction - - Regexps are built up from expressions, quantifiers, and assertions. - The simplest form of expression is simply a character, e.g. - \bold{x} or \bold{5}. An expression can also be a set of - characters. For example, \bold{[ABCD]}, will match an \bold{A} or - a \bold{B} or a \bold{C} or a \bold{D}. As a shorthand we could - write this as \bold{[A-D]}. If we want to match any of the - captital letters in the English alphabet we can write - \bold{[A-Z]}. A quantifier tells the regexp engine how many - occurrences of the expression we want, e.g. \bold{x{1,1}} means - match an \bold{x} which occurs at least once and at most once. - We'll look at assertions and more complex expressions later. - - Note that in general regexps cannot be used to check for balanced - brackets or tags. For example if you want to match an opening html - \c{<b>} and its closing \c{<b>}, you can only use a regexp if you - know that these tags are not nested; the html fragment, \c{<b>bold - <b>bolder</b></b>} will not match as expected. If you know the - maximum level of nesting it is possible to create a regexp that - will match correctly, but for an unknown level of nesting, regexps - will fail. - - We'll start by writing a regexp to match integers in the range 0 - to 99. We will require at least one digit so we will start with - \bold{[0-9]{1,1}} which means match a digit exactly once. This - regexp alone will match integers in the range 0 to 9. To match one - or two digits we can increase the maximum number of occurrences so - the regexp becomes \bold{[0-9]{1,2}} meaning match a digit at - least once and at most twice. However, this regexp as it stands - will not match correctly. This regexp will match one or two digits - \e within a string. To ensure that we match against the whole - string we must use the anchor assertions. We need \bold{^} (caret) - which when it is the first character in the regexp means that the - regexp must match from the beginning of the string. And we also - need \bold{$} (dollar) which when it is the last character in the - regexp means that the regexp must match until the end of the - string. So now our regexp is \bold{^[0-9]{1,2}$}. Note that - assertions, such as \bold{^} and \bold{$}, do not match any - characters. - - If you've seen regexps elsewhere, they may have looked different from - the ones above. This is because some sets of characters and some - quantifiers are so common that they have special symbols to - represent them. \bold{[0-9]} can be replaced with the symbol - \bold{\\d}. The quantifier to match exactly one occurrence, - \bold{{1,1}}, can be replaced with the expression itself. This means - that \bold{x{1,1}} is exactly the same as \bold{x} alone. So our 0 - to 99 matcher could be written \bold{^\\d{1,2}$}. Another way of - writing it would be \bold{^\\d\\d{0,1}$}, i.e. from the start of the - string match a digit followed by zero or one digits. In practice - most people would write it \bold{^\\d\\d?$}. The \bold{?} is a - shorthand for the quantifier \bold{{0,1}}, i.e. a minimum of no - occurrences a maximum of one occurrence. This is used to make an - expression optional. The regexp \bold{^\\d\\d?$} means "from the - beginning of the string match one digit followed by zero or one - digits and then the end of the string". - - Our second example is matching the words 'mail', 'letter' or - 'correspondence' but without matching 'email', 'mailman', - 'mailer', 'letterbox', etc. We'll start by just matching 'mail'. In - full the regexp is, \bold{m{1,1}a{1,1}i{1,1}l{1,1}}, but since - each expression itself is automatically quantified by \bold{{1,1}} - we can simply write this as \bold{mail}; an 'm' followed by an 'a' - followed by an 'i' followed by an 'l'. The symbol '|' (bar) is - used for \e alternation, so our regexp now becomes - \bold{mail|letter|correspondence} which means match 'mail' \e or - 'letter' \e or 'correspondence'. Whilst this regexp will find the - words we want it will also find words we don't want such as - 'email'. We will start by putting our regexp in parentheses, - \bold{(mail|letter|correspondence)}. Parentheses have two effects, - firstly they group expressions together and secondly they identify - parts of the regexp that we wish to \l{capturing text}{capture}. - Our regexp still matches any of the three words but now - they are grouped together as a unit. This is useful for building - up more complex regexps. It is also useful because it allows us to - examine which of the words actually matched. We need to use - another assertion, this time \bold{\\b} "word boundary": - \bold{\\b(mail|letter|correspondence)\\b}. This regexp means "match - a word boundary followed by the expression in parentheses followed - by another word boundary". The \bold{\\b} assertion matches at a \e - position in the regexp not a \e character in the regexp. A word - boundary is any non-word character such as a space a newline or - the beginning or end of the string. - - For our third example we want to replace ampersands with the HTML - entity '\&'. The regexp to match is simple: \bold{\&}, i.e. - match one ampersand. Unfortunately this will mess up our text if - some of the ampersands have already been turned into HTML - entities. So what we really want to say is replace an ampersand - providing it is not followed by 'amp;'. For this we need the - negative lookahead assertion and our regexp becomes: - \bold{\&(?!amp;)}. The negative lookahead assertion is introduced - with '(?!' and finishes at the ')'. It means that the text it - contains, 'amp;' in our example, must \e not follow the expression - that preceeds it. - - Regexps provide a rich language that can be used in a variety of - ways. For example suppose we want to count all the occurrences of - 'Eric' and 'Eirik' in a string. Two valid regexps to match these - are \bold{\\b(Eric|Eirik)\\b} and \bold{\\bEi?ri[ck]\\b}. We need - the word boundary '\\b' so we don't get 'Ericsson' etc. The second - regexp actually matches more than we want, 'Eric', 'Erik', 'Eiric' - and 'Eirik'. - - We will implement some the examples above in the - \link #code-examples code examples \endlink section. - - \target characters-and-abbreviations-for-sets-of-characters - \section1 Characters and Abbreviations for Sets of Characters - - \table - \header \i Element \i Meaning - \row \i \bold{c} - \i Any character represents itself unless it has a special - regexp meaning. Thus \bold{c} matches the character \e c. - \row \i \bold{\\c} - \i A character that follows a backslash matches the character - itself except where mentioned below. For example if you - wished to match a literal caret at the beginning of a string - you would write \bold{\^}. - \row \i \bold{\\a} - \i This matches the ASCII bell character (BEL, 0x07). - \row \i \bold{\\f} - \i This matches the ASCII form feed character (FF, 0x0C). - \row \i \bold{\\n} - \i This matches the ASCII line feed character (LF, 0x0A, Unix newline). - \row \i \bold{\\r} - \i This matches the ASCII carriage return character (CR, 0x0D). - \row \i \bold{\\t} - \i This matches the ASCII horizontal tab character (HT, 0x09). - \row \i \bold{\\v} - \i This matches the ASCII vertical tab character (VT, 0x0B). - \row \i \bold{\\x\e{hhhh}} - \i This matches the Unicode character corresponding to the - hexadecimal number \e{hhhh} (between 0x0000 and 0xFFFF). - \row \i \bold{\\0\e{ooo}} (i.e., \\zero \e{ooo}) - \i matches the ASCII/Latin1 character corresponding to the - octal number \e{ooo} (between 0 and 0377). - \row \i \bold{. (dot)} - \i This matches any character (including newline). - \row \i \bold{\\d} - \i This matches a digit (QChar::isDigit()). - \row \i \bold{\\D} - \i This matches a non-digit. - \row \i \bold{\\s} - \i This matches a whitespace (QChar::isSpace()). - \row \i \bold{\\S} - \i This matches a non-whitespace. - \row \i \bold{\\w} - \i This matches a word character (QChar::isLetterOrNumber(), QChar::isMark(), or '_'). - \row \i \bold{\\W} - \i This matches a non-word character. - \row \i \bold{\\\e{n}} - \i The \e{n}-th \l backreference, e.g. \\1, \\2, etc. - \endtable - - \bold{Note:} The C++ compiler transforms backslashes in strings, - so to include a \bold{\\} in a regexp, you will need to enter it - twice, i.e. \c{\\}. To match the backslash character itself, you - will need four: \c{\\\\}. - - \target sets-of-characters - \section1 Sets of Characters - - Square brackets are used to match any character in the set of - characters contained within the square brackets. All the character - set abbreviations described above can be used within square - brackets. Apart from the character set abbreviations and the - following two exceptions no characters have special meanings in - square brackets. - - \table - \row \i \bold{^} - \i The caret negates the character set if it occurs as the - first character, i.e. immediately after the opening square - bracket. For example, \bold{[abc]} matches 'a' or 'b' or 'c', - but \bold{[^abc]} matches anything \e except 'a' or 'b' or - 'c'. - \row \i \bold{-} - \i The dash is used to indicate a range of characters, for - example \bold{[W-Z]} matches 'W' or 'X' or 'Y' or 'Z'. - \endtable - - Using the predefined character set abbreviations is more portable - than using character ranges across platforms and languages. For - example, \bold{[0-9]} matches a digit in Western alphabets but - \bold{\\d} matches a digit in \e any alphabet. - - Note that in most regexp literature sets of characters are called - "character classes". - - \target quantifiers - \section1 Quantifiers - - By default an expression is automatically quantified by - \bold{{1,1}}, i.e. it should occur exactly once. In the following - list \bold{\e {E}} stands for any expression. An expression is a - character or an abbreviation for a set of characters or a set of - characters in square brackets or any parenthesised expression. - - \table - \row \i \bold{\e {E}?} - \i Matches zero or one occurrence of \e E. This quantifier - means "the previous expression is optional" since it will - match whether or not the expression occurs in the string. It - is the same as \bold{\e {E}{0,1}}. For example \bold{dents?} - will match 'dent' and 'dents'. - - \row \i \bold{\e {E}+} - \i Matches one or more occurrences of \e E. This is the same - as \bold{\e {E}{1,}}. For example, \bold{0+} will match - '0', '00', '000', etc. - - \row \i \bold{\e {E}*} - \i Matches zero or more occurrences of \e E. This is the same - as \bold{\e {E}{0,}}. The \bold{*} quantifier is often - used by a mistake. Since it matches \e zero or more - occurrences it will match no occurrences at all. For example - if we want to match strings that end in whitespace and use - the regexp \bold{\\s*$} we would get a match on every string. - This is because we have said find zero or more whitespace - followed by the end of string, so even strings that don't end - in whitespace will match. The regexp we want in this case is - \bold{\\s+$} to match strings that have at least one - whitespace at the end. - - \row \i \bold{\e {E}{n}} - \i Matches exactly \e n occurrences of the expression. This - is the same as repeating the expression \e n times. For - example, \bold{x{5}} is the same as \bold{xxxxx}. It is also - the same as \bold{\e {E}{n,n}}, e.g. \bold{x{5,5}}. - - \row \i \bold{\e {E}{n,}} - \i Matches at least \e n occurrences of the expression. - - \row \i \bold{\e {E}{,m}} - \i Matches at most \e m occurrences of the expression. This - is the same as \bold{\e {E}{0,m}}. - - \row \i \bold{\e {E}{n,m}} - \i Matches at least \e n occurrences of the expression and at - most \e m occurrences of the expression. - \endtable - - If we wish to apply a quantifier to more than just the preceding - character we can use parentheses to group characters together in - an expression. For example, \bold{tag+} matches a 't' followed by - an 'a' followed by at least one 'g', whereas \bold{(tag)+} matches - at least one occurrence of 'tag'. - - Note that quantifiers are "greedy". They will match as much text - as they can. For example, \bold{0+} will match as many zeros as it - can from the first zero it finds, e.g. '2.\underline{000}5'. - Quantifiers can be made non-greedy, see setMinimal(). - - \target capturing parentheses - \target backreferences - \section1 Capturing Text - - Parentheses allow us to group elements together so that we can - quantify and capture them. For example if we have the expression - \bold{mail|letter|correspondence} that matches a string we know - that \e one of the words matched but not which one. Using - parentheses allows us to "capture" whatever is matched within - their bounds, so if we used \bold{(mail|letter|correspondence)} - and matched this regexp against the string "I sent you some email" - we can use the cap() or capturedTexts() functions to extract the - matched characters, in this case 'mail'. - - We can use captured text within the regexp itself. To refer to the - captured text we use \e backreferences which are indexed from 1, - the same as for cap(). For example we could search for duplicate - words in a string using \bold{\\b(\\w+)\\W+\\1\\b} which means match a - word boundary followed by one or more word characters followed by - one or more non-word characters followed by the same text as the - first parenthesized expression followed by a word boundary. - - If we want to use parentheses purely for grouping and not for - capturing we can use the non-capturing syntax, e.g. - \bold{(?:green|blue)}. Non-capturing parentheses begin '(?:' and - end ')'. In this example we match either 'green' or 'blue' but we - do not capture the match so we only know whether or not we matched - but not which color we actually found. Using non-capturing - parentheses is more efficient than using capturing parentheses - since the regexp engine has to do less book-keeping. - - Both capturing and non-capturing parentheses may be nested. - - \target greedy quantifiers - - For historical reasons, quantifiers (e.g. \bold{*}) that apply to - capturing parentheses are more "greedy" than other quantifiers. - For example, \bold{a*(a)*} will match "aaa" with cap(1) == "aaa". - This behavior is different from what other regexp engines do - (notably, Perl). To obtain a more intuitive capturing behavior, - specify EQRegExp::RegExp2 to the EQRegExp constructor or call - setPatternSyntax(EQRegExp::RegExp2). - - \target cap_in_a_loop - - When the number of matches cannot be determined in advance, a - common idiom is to use cap() in a loop. For example: - - \code - EQRegExp rx("(\\d+)"); - QString str = "Offsets: 12 14 99 231 7"; - QStringList list; - int pos = 0; - - while ((pos = rx.indexIn(str, pos)) != -1) { - list << rx.cap(1); - pos += rx.matchedLength(); - } - // list: ["12", "14", "99", "231", "7"] - \endcode - - \target assertions - \section1 Assertions - - Assertions make some statement about the text at the point where - they occur in the regexp but they do not match any characters. In - the following list \bold{\e {E}} stands for any expression. - - \table - \row \i \bold{^} - \i The caret signifies the beginning of the string. If you - wish to match a literal \c{^} you must escape it by - writing \c{\\^}. For example, \bold{^#include} will only - match strings which \e begin with the characters '#include'. - (When the caret is the first character of a character set it - has a special meaning, see \link #sets-of-characters Sets of - Characters \endlink.) - - \row \i \bold{$} - \i The dollar signifies the end of the string. For example - \bold{\\d\\s*$} will match strings which end with a digit - optionally followed by whitespace. If you wish to match a - literal \c{$} you must escape it by writing - \c{\\$}. - - \row \i \bold{\\b} - \i A word boundary. For example the regexp - \bold{\\bOK\\b} means match immediately after a word - boundary (e.g. start of string or whitespace) the letter 'O' - then the letter 'K' immediately before another word boundary - (e.g. end of string or whitespace). But note that the - assertion does not actually match any whitespace so if we - write \bold{(\\bOK\\b)} and we have a match it will only - contain 'OK' even if the string is "It's \underline{OK} now". - - \row \i \bold{\\B} - \i A non-word boundary. This assertion is true wherever - \bold{\\b} is false. For example if we searched for - \bold{\\Bon\\B} in "Left on" the match would fail (space - and end of string aren't non-word boundaries), but it would - match in "t\underline{on}ne". - - \row \i \bold{(?=\e E)} - \i Positive lookahead. This assertion is true if the - expression matches at this point in the regexp. For example, - \bold{const(?=\\s+char)} matches 'const' whenever it is - followed by 'char', as in 'static \underline{const} char *'. - (Compare with \bold{const\\s+char}, which matches 'static - \underline{const char} *'.) - - \row \i \bold{(?!\e E)} - \i Negative lookahead. This assertion is true if the - expression does not match at this point in the regexp. For - example, \bold{const(?!\\s+char)} matches 'const' \e except - when it is followed by 'char'. - \endtable - - \keyword EQRegExp wildcard matching - \section1 Wildcard Matching - - Most command shells such as \e bash or \e cmd.exe support "file - globbing", the ability to identify a group of files by using - wildcards. The setPatternSyntax() function is used to switch - between regexp and wildcard mode. Wildcard matching is much - simpler than full regexps and has only four features: - - \table - \row \i \bold{c} - \i Any character represents itself apart from those mentioned - below. Thus \bold{c} matches the character \e c. - \row \i \bold{?} - \i This matches any single character. It is the same as - \bold{.} in full regexps. - \row \i \bold{*} - \i This matches zero or more of any characters. It is the - same as \bold{.*} in full regexps. - \row \i \bold{[...]} - \i Sets of characters can be represented in square brackets, - similar to full regexps. Within the character class, like - outside, backslash has no special meaning. - \endtable - - For example if we are in wildcard mode and have strings which - contain filenames we could identify HTML files with \bold{*.html}. - This will match zero or more characters followed by a dot followed - by 'h', 't', 'm' and 'l'. - - To test a string against a wildcard expression, use exactMatch(). - For example: - - \code - EQRegExp rx("*.txt"); - rx.setPatternSyntax(EQRegExp::Wildcard); - rx.exactMatch("README.txt"); // returns true - rx.exactMatch("welcome.txt.bak"); // returns false - \endcode - - \target perl-users - \section1 Notes for Perl Users - - Most of the character class abbreviations supported by Perl are - supported by EQRegExp, see \link - #characters-and-abbreviations-for-sets-of-characters characters - and abbreviations for sets of characters \endlink. - - In EQRegExp, apart from within character classes, \c{^} always - signifies the start of the string, so carets must always be - escaped unless used for that purpose. In Perl the meaning of caret - varies automagically depending on where it occurs so escaping it - is rarely necessary. The same applies to \c{$} which in - EQRegExp always signifies the end of the string. - - EQRegExp's quantifiers are the same as Perl's greedy quantifiers - (but see the \l{greedy quantifiers}{note above}). Non-greedy - matching cannot be applied to individual quantifiers, but can be - applied to all the quantifiers in the pattern. For example, to - match the Perl regexp \bold{ro+?m} requires: \code EQRegExp - rx("ro+m"); rx.setMinimal(true); \endcode - - The equivalent of Perl's \c{/i} option is - setCaseSensitivity(Qt::CaseInsensitive). - - Perl's \c{/g} option can be emulated using a \l{#cap_in_a_loop}{loop}. - - In EQRegExp \bold{.} matches any character, therefore all EQRegExp - regexps have the equivalent of Perl's \c{/s} option. EQRegExp - does not have an equivalent to Perl's \c{/m} option, but this - can be emulated in various ways for example by splitting the input - into lines or by looping with a regexp that searches for newlines. - - Because EQRegExp is string oriented, there are no \\A, \\Z, or \\z - assertions. The \\G assertion is not supported but can be emulated - in a loop. - - Perl's $& is cap(0) or capturedTexts()[0]. There are no EQRegExp - equivalents for $`, $' or $+. Perl's capturing variables, $1, $2, - ... correspond to cap(1) or capturedTexts()[1], cap(2) or - capturedTexts()[2], etc. - - To substitute a pattern use QString::replace(). - - Perl's extended \c{/x} syntax is not supported, nor are - directives, e.g. (?i), or regexp comments, e.g. (?#comment). On - the other hand, C++'s rules for literal strings can be used to - achieve the same: - - \code - EQRegExp mark("\\b" // word boundary - "[Mm]ark" // the word we want to match - ); - \endcode - - Both zero-width positive and zero-width negative lookahead - assertions (?=pattern) and (?!pattern) are supported with the same - syntax as Perl. Perl's lookbehind assertions, "independent" - subexpressions and conditional expressions are not supported. - - Non-capturing parentheses are also supported, with the same - (?:pattern) syntax. - - See QString::split() and QStringList::join() for equivalents - to Perl's split and join functions. - - Note: because C++ transforms \\'s they must be written \e twice in - code, e.g. \bold{\\b} must be written \bold{\\\\b}. - - \target code-examples - \section1 Code Examples - - \code - EQRegExp rx("^\\d\\d?$"); // match integers 0 to 99 - rx.indexIn("123"); // returns -1 (no match) - rx.indexIn("-6"); // returns -1 (no match) - rx.indexIn("6"); // returns 0 (matched as position 0) - \endcode - - The third string matches '\underline{6}'. This is a simple validation - regexp for integers in the range 0 to 99. - - \code - EQRegExp rx("^\\S+$"); // match strings without whitespace - rx.indexIn("Hello world"); // returns -1 (no match) - rx.indexIn("This_is-OK"); // returns 0 (matched at position 0) - \endcode - - The second string matches '\underline{This_is-OK}'. We've used the - character set abbreviation '\\S' (non-whitespace) and the anchors - to match strings which contain no whitespace. - - In the following example we match strings containing 'mail' or - 'letter' or 'correspondence' but only match whole words i.e. not - 'email' - - \code - EQRegExp rx("\\b(mail|letter|correspondence)\\b"); - rx.indexIn("I sent you an email"); // returns -1 (no match) - rx.indexIn("Please write the letter"); // returns 17 - \endcode - - The second string matches "Please write the \underline{letter}". The - word 'letter' is also captured (because of the parentheses). We - can see what text we've captured like this: - - \code - QString captured = rx.cap(1); // captured == "letter" - \endcode - - This will capture the text from the first set of capturing - parentheses (counting capturing left parentheses from left to - right). The parentheses are counted from 1 since cap(0) is the - whole matched regexp (equivalent to '&' in most regexp engines). - - \code - EQRegExp rx("&(?!amp;)"); // match ampersands but not & - QString line1 = "This & that"; - line1.replace(rx, "&"); - // line1 == "This & that" - QString line2 = "His & hers & theirs"; - line2.replace(rx, "&"); - // line2 == "His & hers & theirs" - \endcode - - Here we've passed the EQRegExp to QString's replace() function to - replace the matched text with new text. - - \code - QString str = "One Eric another Eirik, and an Ericsson. " - "How many Eiriks, Eric?"; - EQRegExp rx("\\b(Eric|Eirik)\\b"); // match Eric or Eirik - int pos = 0; // where we are in the string - int count = 0; // how many Eric and Eirik's we've counted - while (pos >= 0) { - pos = rx.indexIn(str, pos); - if (pos >= 0) { - ++pos; // move along in str - ++count; // count our Eric or Eirik - } - } - \endcode - - We've used the indexIn() function to repeatedly match the regexp in - the string. Note that instead of moving forward by one character - at a time \c pos++ we could have written \c {pos += - rx.matchedLength()} to skip over the already matched string. The - count will equal 3, matching 'One \underline{Eric} another - \underline{Eirik}, and an Ericsson. How many Eiriks, \underline{Eric}?'; it - doesn't match 'Ericsson' or 'Eiriks' because they are not bounded - by non-word boundaries. - - One common use of regexps is to split lines of delimited data into - their component fields. - - \code - str = "Trolltech ASA\twww.trolltech.com\tNorway"; - QString company, web, country; - rx.setPattern("^([^\t]+)\t([^\t]+)\t([^\t]+)$"); - if (rx.indexIn(str) != -1) { - company = rx.cap(1); - web = rx.cap(2); - country = rx.cap(3); - } - \endcode - - In this example our input lines have the format company name, web - address and country. Unfortunately the regexp is rather long and - not very versatile -- the code will break if we add any more - fields. A simpler and better solution is to look for the - separator, '\\t' in this case, and take the surrounding text. The - QString::split() function can take a separator string or regexp - as an argument and split a string accordingly. - - \code - QStringList field = str.split("\t"); - \endcode - - Here field[0] is the company, field[1] the web address and so on. - - To imitate the matching of a shell we can use wildcard mode. - - \code - EQRegExp rx("*.html"); - rx.setPatternSyntax(EQRegExp::Wildcard); - rx.exactMatch("index.html"); // returns true - rx.exactMatch("default.htm"); // returns false - rx.exactMatch("readme.txt"); // returns false - \endcode - - Wildcard matching can be convenient because of its simplicity, but - any wildcard regexp can be defined using full regexps, e.g. - \bold{.*\.html$}. Notice that we can't match both \c .html and \c - .htm files with a wildcard unless we use \bold{*.htm*} which will - also match 'test.html.bak'. A full regexp gives us the precision - we need, \bold{.*\\.html?$}. - - EQRegExp can match case insensitively using setCaseSensitivity(), - and can use non-greedy matching, see setMinimal(). By - default EQRegExp uses full regexps but this can be changed with - setWildcard(). Searching can be forward with indexIn() or backward - with lastIndexIn(). Captured text can be accessed using - capturedTexts() which returns a string list of all captured - strings, or using cap() which returns the captured string for the - given index. The pos() function takes a match index and returns - the position in the string where the match was made (or -1 if - there was no match). - - \sa QString, QStringList, EQRegExpValidator, QSortFilterProxyModel, - {tools/regexp}{Regular Expression Example} -*/ - -const int NumBadChars = 64; -#define BadChar(ch) ((ch).unicode() % NumBadChars) - -const int NoOccurrence = INT_MAX; -const int EmptyCapture = INT_MAX; -const int InftyLen = INT_MAX; -const int InftyRep = 1025; -const int EOS = -1; - -static bool isWord(QChar ch) -{ - return ch.isLetterOrNumber() || ch.isMark() || ch == QLatin1Char('_'); -} - -/* - Merges two vectors of ints and puts the result into the first - one. -*/ -static void mergeInto(QVector<int> *a, const QVector<int> &b) -{ - int asize = a->size(); - int bsize = b.size(); - if (asize == 0) { - *a = b; -#ifndef QT_NO_REGEXP_OPTIM - } else if (bsize == 1 && a->at(asize - 1) < b.at(0)) { - a->resize(asize + 1); - (*a)[asize] = b.at(0); -#endif - } else if (bsize >= 1) { - int csize = asize + bsize; - QVector<int> c(csize); - int i = 0, j = 0, k = 0; - while (i < asize) { - if (j < bsize) { - if (a->at(i) == b.at(j)) { - ++i; - --csize; - } else if (a->at(i) < b.at(j)) { - c[k++] = a->at(i++); - } else { - c[k++] = b.at(j++); - } - } else { - memcpy(c.data() + k, a->constData() + i, (asize - i) * sizeof(int)); - break; - } - } - c.resize(csize); - if (j < bsize) - memcpy(c.data() + k, b.constData() + j, (bsize - j) * sizeof(int)); - *a = c; - } -} - -#ifndef QT_NO_REGEXP_WILDCARD -/* - Translates a wildcard pattern to an equivalent regular expression - pattern (e.g., *.cpp to .*\.cpp). -*/ -static QString wc2rx(const QString &wc_str) -{ - int wclen = wc_str.length(); - QString rx; - int i = 0; - const QChar *wc = wc_str.unicode(); - while (i < wclen) { - QChar c = wc[i++]; - switch (c.unicode()) { - case '*': - rx += QLatin1String(".*"); - break; - case '?': - rx += QLatin1Char('.'); - break; - case '$': - case '(': - case ')': - case '+': - case '.': - case '\\': - case '^': - case '{': - case '|': - case '}': - rx += QLatin1Char('\\'); - rx += c; - break; - case '[': - rx += c; - if (wc[i] == QLatin1Char('^')) - rx += wc[i++]; - if (i < wclen) { - if (rx[i] == QLatin1Char(']')) - rx += wc[i++]; - while (i < wclen && wc[i] != QLatin1Char(']')) { - if (wc[i] == QLatin1Char('\\')) - rx += QLatin1Char('\\'); - rx += wc[i++]; - } - } - break; - default: - rx += c; - } - } - return rx; -} -#endif - -static int caretIndex(int offset, EQRegExp::CaretMode caretMode) -{ - if (caretMode == EQRegExp::CaretAtZero) { - return 0; - } else if (caretMode == EQRegExp::CaretAtOffset) { - return offset; - } else { // EQRegExp::CaretWontMatch - return -1; - } -} - -/* - The EQRegExpEngineKey struct uniquely identifies an engine. -*/ -struct EQRegExpEngineKey -{ - QString pattern; - EQRegExp::PatternSyntax patternSyntax; - Qt::CaseSensitivity cs; - - inline EQRegExpEngineKey(const QString &pattern, EQRegExp::PatternSyntax patternSyntax, - Qt::CaseSensitivity cs) - : pattern(pattern), patternSyntax(patternSyntax), cs(cs) {} - - inline void clear() { - pattern.clear(); - patternSyntax = EQRegExp::RegExp; - cs = Qt::CaseSensitive; - } -}; - -bool operator==(const EQRegExpEngineKey &key1, const EQRegExpEngineKey &key2) -{ - return key1.pattern == key2.pattern && key1.patternSyntax == key2.patternSyntax - && key1.cs == key2.cs; -} - -class EQRegExpEngine; - -//Q_DECLARE_TYPEINFO(QVector<int>, Q_MOVABLE_TYPE); - -/* - This is the engine state during matching. -*/ -struct EQRegExpMatchState -{ - const QString *str; // a pointer to the input QString - const QChar *in; // a pointer to the input string data - int pos; // the current position in the string - int caretPos; - int len; // the length of the input string - bool minimal; // minimal matching? - QVector<int> bigArray; // big QVector<int> array - int *inNextStack; // is state is nextStack? - int *curStack; // stack of current states - int *nextStack; // stack of next states - int *curCapBegin; // start of current states' captures - int *nextCapBegin; // start of next states' captures - int *curCapEnd; // end of current states' captures - int *nextCapEnd; // end of next states' captures - int *tempCapBegin; // start of temporary captures - int *tempCapEnd; // end of temporary captures - int *capBegin; // start of captures for a next state - int *capEnd; // end of captures for a next state - int *slideTab; // bump-along slide table for bad-character heuristic - int slideTabSize; // size of slide table -#ifndef QT_NO_REGEXP_BACKREF - QList<QVector<int> > sleeping; // list of back-reference sleepers -#endif - int matchLen; // length of match - int oneTestMatchedLen; // length of partial match - - QVector<int> captured; // what match() returned last - const EQRegExpEngine *eng; - - inline EQRegExpMatchState() { captured.fill(-1, 2); } - - void drain() { bigArray.clear(); } // to save memory - void prepareForMatch(EQRegExpEngine *eng); - void match(const QString &str, int pos, bool minimal, bool oneTest, int caretIndex); - bool matchHere(); - bool testAnchor(int i, int a, const int *capBegin); -}; - -/* - The struct EQRegExpAutomatonState represents one state in a modified NFA. The - input characters matched are stored in the state instead of on - the transitions, something possible for an automaton - constructed from a regular expression. -*/ -struct EQRegExpAutomatonState -{ -#ifndef QT_NO_REGEXP_CAPTURE - int atom; // which atom does this state belong to? -#endif - int match; // what does it match? (see CharClassBit and BackRefBit) - QVector<int> outs; // out-transitions - QMap<int, int> reenter; // atoms reentered when transiting out - QMap<int, int> anchors; // anchors met when transiting out - - inline EQRegExpAutomatonState() { } -#ifndef QT_NO_REGEXP_CAPTURE - inline EQRegExpAutomatonState(int a, int m) - : atom(a), match(m) { } -#else - inline EQRegExpAutomatonState(int m) - : match(m) { } -#endif -}; - -Q_DECLARE_TYPEINFO(EQRegExpAutomatonState, Q_MOVABLE_TYPE); - -/* - The struct EQRegExpCharClassRange represents a range of characters (e.g., - [0-9] denotes range 48 to 57). -*/ -struct EQRegExpCharClassRange -{ - ushort from; // 48 - ushort len; // 10 -}; - -Q_DECLARE_TYPEINFO(EQRegExpCharClassRange, Q_PRIMITIVE_TYPE); - -#ifndef QT_NO_REGEXP_CAPTURE -/* - The struct EQRegExpAtom represents one node in the hierarchy of regular - expression atoms. -*/ -struct EQRegExpAtom -{ - enum { NoCapture = -1, OfficialCapture = -2, UnofficialCapture = -3 }; - - int parent; // index of parent in array of atoms - int capture; // index of capture, from 1 to ncap - 1 -}; - -Q_DECLARE_TYPEINFO(EQRegExpAtom, Q_PRIMITIVE_TYPE); -#endif - -struct EQRegExpLookahead; - -#ifndef QT_NO_REGEXP_ANCHOR_ALT -/* - The struct EQRegExpAnchorAlternation represents a pair of anchors with - OR semantics. -*/ -struct EQRegExpAnchorAlternation -{ - int a; // this anchor... - int b; // ...or this one -}; - -Q_DECLARE_TYPEINFO(EQRegExpAnchorAlternation, Q_PRIMITIVE_TYPE); -#endif - -#ifndef QT_NO_REGEXP_CCLASS -/* - The class EQRegExpCharClass represents a set of characters, such as can - be found in regular expressions (e.g., [a-z] denotes the set - {a, b, ..., z}). -*/ -class EQRegExpCharClass -{ -public: - EQRegExpCharClass(); - inline EQRegExpCharClass(const EQRegExpCharClass &cc) { operator=(cc); } - - EQRegExpCharClass &operator=(const EQRegExpCharClass &cc); - - void clear(); - bool negative() const { return n; } - void setNegative(bool negative); - void addCategories(int cats); - void addRange(ushort from, ushort to); - void addSingleton(ushort ch) { addRange(ch, ch); } - - bool in(QChar ch) const; -#ifndef QT_NO_REGEXP_OPTIM - const QVector<int> &firstOccurrence() const { return occ1; } -#endif - -#if defined(QT_DEBUG) - void dump() const; -#endif - -private: - int c; // character classes - QVector<EQRegExpCharClassRange> r; // character ranges - bool n; // negative? -#ifndef QT_NO_REGEXP_OPTIM - QVector<int> occ1; // first-occurrence array -#endif -}; -#else -struct EQRegExpCharClass -{ - int dummy; - -#ifndef QT_NO_REGEXP_OPTIM - EQRegExpCharClass() { occ1.fill(0, NumBadChars); } - - const QVector<int> &firstOccurrence() const { return occ1; } - QVector<int> occ1; -#endif -}; -#endif - -Q_DECLARE_TYPEINFO(EQRegExpCharClass, Q_MOVABLE_TYPE); - -/* - The EQRegExpEngine class encapsulates a modified nondeterministic - finite automaton (NFA). -*/ -class EQRegExpEngine -{ -public: - EQRegExpEngine(Qt::CaseSensitivity cs, bool greedyQuantifiers) - : cs(cs), greedyQuantifiers(greedyQuantifiers) { setup(); } - - EQRegExpEngine(const EQRegExpEngineKey &key); - ~EQRegExpEngine(); - - bool isValid() const { return valid; } - const QString &errorString() const { return yyError; } - int numCaptures() const { return officialncap; } - - int createState(QChar ch); - int createState(const EQRegExpCharClass &cc); -#ifndef QT_NO_REGEXP_BACKREF - int createState(int bref); -#endif - - void addCatTransitions(const QVector<int> &from, const QVector<int> &to); -#ifndef QT_NO_REGEXP_CAPTURE - void addPlusTransitions(const QVector<int> &from, const QVector<int> &to, int atom); -#endif - -#ifndef QT_NO_REGEXP_ANCHOR_ALT - int anchorAlternation(int a, int b); - int anchorConcatenation(int a, int b); -#else - int anchorAlternation(int a, int b) { return a & b; } - int anchorConcatenation(int a, int b) { return a | b; } -#endif - void addAnchors(int from, int to, int a); - -#ifndef QT_NO_REGEXP_OPTIM - void heuristicallyChooseHeuristic(); -#endif - -#if defined(QT_DEBUG) - void dump() const; -#endif - - int ref; - -private: - enum { CharClassBit = 0x10000, BackRefBit = 0x20000 }; - enum { InitialState = 0, FinalState = 1 }; - - void setup(); - int setupState(int match); - - /* - Let's hope that 13 lookaheads and 14 back-references are - enough. - */ - enum { MaxLookaheads = 25, MaxBackRefs = 14 }; - enum { Anchor_Dollar = 0x00000001, Anchor_Caret = 0x00000002, Anchor_Word = 0x00000004, - Anchor_NonWord = 0x00000008, Anchor_FirstLookahead = 0x00000010, - Anchor_BackRef1Empty = Anchor_FirstLookahead << MaxLookaheads, - Anchor_BackRef0Empty = Anchor_BackRef1Empty >> 1, - Anchor_Alternation = Anchor_BackRef1Empty << MaxBackRefs, - - Anchor_LookaheadMask = (Anchor_FirstLookahead - 1) ^ - ((Anchor_FirstLookahead << MaxLookaheads) - 1) }; -#ifndef QT_NO_REGEXP_CAPTURE - int startAtom(bool officialCapture); - void finishAtom(int atom, bool needCapture); -#endif - -#ifndef QT_NO_REGEXP_LOOKAHEAD - int addLookahead(EQRegExpEngine *eng, bool negative); -#endif - -#ifndef QT_NO_REGEXP_OPTIM - bool goodStringMatch(EQRegExpMatchState &matchState) const; - bool badCharMatch(EQRegExpMatchState &matchState) const; -#else - bool bruteMatch(EQRegExpMatchState &matchState) const; -#endif - - QVector<EQRegExpAutomatonState> s; // array of states -#ifndef QT_NO_REGEXP_CAPTURE - QVector<EQRegExpAtom> f; // atom hierarchy - int nf; // number of atoms - int cf; // current atom - QVector<int> captureForOfficialCapture; -#endif - int officialncap; // number of captures, seen from the outside - int ncap; // number of captures, seen from the inside -#ifndef QT_NO_REGEXP_CCLASS - QVector<EQRegExpCharClass> cl; // array of character classes -#endif -#ifndef QT_NO_REGEXP_LOOKAHEAD - QVector<EQRegExpLookahead *> ahead; // array of lookaheads -#endif -#ifndef QT_NO_REGEXP_ANCHOR_ALT - QVector<EQRegExpAnchorAlternation> aa; // array of (a, b) pairs of anchors -#endif -#ifndef QT_NO_REGEXP_OPTIM - bool caretAnchored; // does the regexp start with ^? - bool trivial; // is the good-string all that needs to match? -#endif - bool valid; // is the regular expression valid? - Qt::CaseSensitivity cs; // case sensitive? - bool greedyQuantifiers; // RegExp2? -#ifndef QT_NO_REGEXP_BACKREF - int nbrefs; // number of back-references -#endif - -#ifndef QT_NO_REGEXP_OPTIM - bool useGoodStringHeuristic; // use goodStringMatch? otherwise badCharMatch - - int goodEarlyStart; // the index where goodStr can first occur in a match - int goodLateStart; // the index where goodStr can last occur in a match - QString goodStr; // the string that any match has to contain - - int minl; // the minimum length of a match - QVector<int> occ1; // first-occurrence array -#endif - - /* - The class Box is an abstraction for a regular expression - fragment. It can also be seen as one node in the syntax tree of - a regular expression with synthetized attributes. - - Its interface is ugly for performance reasons. - */ - class Box - { - public: - Box(EQRegExpEngine *engine); - Box(const Box &b) { operator=(b); } - - Box &operator=(const Box &b); - - void clear() { operator=(Box(eng)); } - void set(QChar ch); - void set(const EQRegExpCharClass &cc); -#ifndef QT_NO_REGEXP_BACKREF - void set(int bref); -#endif - - void cat(const Box &b); - void orx(const Box &b); - void plus(int atom); - void opt(); - void catAnchor(int a); -#ifndef QT_NO_REGEXP_OPTIM - void setupHeuristics(); -#endif - -#if defined(QT_DEBUG) - void dump() const; -#endif - - private: - void addAnchorsToEngine(const Box &to) const; - - EQRegExpEngine *eng; // the automaton under construction - QVector<int> ls; // the left states (firstpos) - QVector<int> rs; // the right states (lastpos) - QMap<int, int> lanchors; // the left anchors - QMap<int, int> ranchors; // the right anchors - int skipanchors; // the anchors to match if the box is skipped - -#ifndef QT_NO_REGEXP_OPTIM - int earlyStart; // the index where str can first occur - int lateStart; // the index where str can last occur - QString str; // a string that has to occur in any match - QString leftStr; // a string occurring at the left of this box - QString rightStr; // a string occurring at the right of this box - int maxl; // the maximum length of this box (possibly InftyLen) -#endif - - int minl; // the minimum length of this box -#ifndef QT_NO_REGEXP_OPTIM - QVector<int> occ1; // first-occurrence array -#endif - }; - - friend class Box; - - /* - This is the lexical analyzer for regular expressions. - */ - enum { Tok_Eos, Tok_Dollar, Tok_LeftParen, Tok_MagicLeftParen, Tok_PosLookahead, - Tok_NegLookahead, Tok_RightParen, Tok_CharClass, Tok_Caret, Tok_Quantifier, Tok_Bar, - Tok_Word, Tok_NonWord, Tok_Char = 0x10000, Tok_BackRef = 0x20000 }; - int getChar(); - int getEscape(); -#ifndef QT_NO_REGEXP_INTERVAL - int getRep(int def); -#endif -#ifndef QT_NO_REGEXP_LOOKAHEAD - void skipChars(int n); -#endif - void error(const char *msg); - void startTokenizer(const QChar *rx, int len); - int getToken(); - - const QChar *yyIn; // a pointer to the input regular expression pattern - int yyPos0; // the position of yyTok in the input pattern - int yyPos; // the position of the next character to read - int yyLen; // the length of yyIn - int yyCh; // the last character read - EQRegExpCharClass *yyCharClass; // attribute for Tok_CharClass tokens - int yyMinRep; // attribute for Tok_Quantifier - int yyMaxRep; // ditto - QString yyError; // syntax error or overflow during parsing? - - /* - This is the syntactic analyzer for regular expressions. - */ - int parse(const QChar *rx, int len); - void parseAtom(Box *box); - void parseFactor(Box *box); - void parseTerm(Box *box); - void parseExpression(Box *box); - - int yyTok; // the last token read - bool yyMayCapture; // set this to false to disable capturing - - friend struct EQRegExpMatchState; -}; - -#ifndef QT_NO_REGEXP_LOOKAHEAD -/* - The struct EQRegExpLookahead represents a lookahead a la Perl (e.g., - (?=foo) and (?!bar)). -*/ -struct EQRegExpLookahead -{ - EQRegExpEngine *eng; // NFA representing the embedded regular expression - bool neg; // negative lookahead? - - inline EQRegExpLookahead(EQRegExpEngine *eng0, bool neg0) - : eng(eng0), neg(neg0) { } - inline ~EQRegExpLookahead() { delete eng; } -}; -#endif - -EQRegExpEngine::EQRegExpEngine(const EQRegExpEngineKey &key) - : cs(key.cs), greedyQuantifiers(key.patternSyntax == EQRegExp::RegExp2) -{ - setup(); - - QString rx; - - switch (key.patternSyntax) { - case EQRegExp::Wildcard: -#ifndef QT_NO_REGEXP_WILDCARD - rx = wc2rx(key.pattern); -#endif - break; - case EQRegExp::FixedString: - rx = EQRegExp::escape(key.pattern); - break; - default: - rx = key.pattern; - } - - valid = (parse(rx.unicode(), rx.length()) == rx.length()); - if (!valid) { -#ifndef QT_NO_REGEXP_OPTIM - trivial = false; -#endif - error(RXERR_LEFTDELIM); - } -} - -EQRegExpEngine::~EQRegExpEngine() -{ -#ifndef QT_NO_REGEXP_LOOKAHEAD - qDeleteAll(ahead); -#endif -} - -void EQRegExpMatchState::prepareForMatch(EQRegExpEngine *eng) -{ - /* - We use one QVector<int> for all the big data used a lot in - matchHere() and friends. - */ - int ns = eng->s.size(); // number of states - int ncap = eng->ncap; -#ifndef QT_NO_REGEXP_OPTIM - slideTabSize = qMax(eng->minl + 1, 16); -#else - slideTabSize = 0; -#endif - bigArray.resize((3 + 4 * ncap) * ns + 4 * ncap + slideTabSize); - - inNextStack = bigArray.data(); - memset(inNextStack, -1, ns * sizeof(int)); - curStack = inNextStack + ns; - nextStack = inNextStack + 2 * ns; - - curCapBegin = inNextStack + 3 * ns; - nextCapBegin = curCapBegin + ncap * ns; - curCapEnd = curCapBegin + 2 * ncap * ns; - nextCapEnd = curCapBegin + 3 * ncap * ns; - - tempCapBegin = curCapBegin + 4 * ncap * ns; - tempCapEnd = tempCapBegin + ncap; - capBegin = tempCapBegin + 2 * ncap; - capEnd = tempCapBegin + 3 * ncap; - - slideTab = tempCapBegin + 4 * ncap; - this->eng = eng; -} - -/* - Tries to match in str and returns an array of (begin, length) pairs - for captured text. If there is no match, all pairs are (-1, -1). -*/ -void EQRegExpMatchState::match(const QString &str0, int pos0, bool minimal0, bool oneTest, - int caretIndex) -{ - bool matched = false; - QChar char_null; - -#ifndef QT_NO_REGEXP_OPTIM - if (eng->trivial && !oneTest) { - pos = str0.indexOf(eng->goodStr, pos0, eng->cs); - matchLen = eng->goodStr.length(); - matched = (pos != -1); - } else -#endif - { - str = &str0; - in = str0.unicode(); - if (in == 0) - in = &char_null; - pos = pos0; - caretPos = caretIndex; - len = str0.length(); - minimal = minimal0; - matchLen = 0; - oneTestMatchedLen = 0; - - if (eng->valid && pos >= 0 && pos <= len) { -#ifndef QT_NO_REGEXP_OPTIM - if (oneTest) { - matched = matchHere(); - } else { - if (pos <= len - eng->minl) { - if (eng->caretAnchored) { - matched = matchHere(); - } else if (eng->useGoodStringHeuristic) { - matched = eng->goodStringMatch(*this); - } else { - matched = eng->badCharMatch(*this); - } - } - } -#else - matched = oneTest ? matchHere() : eng->bruteMatch(*this); -#endif - } - } - - int numCaptures = eng->numCaptures(); - int capturedSize = 2 + 2 * numCaptures; - captured.resize(capturedSize); - if (matched) { - int *c = captured.data(); - *c++ = pos; - *c++ = matchLen; - -#ifndef QT_NO_REGEXP_CAPTURE - for (int i = 0; i < numCaptures; ++i) { - int j = eng->captureForOfficialCapture.at(i); - int len = capEnd[j] - capBegin[j]; - *c++ = (len > 0) ? pos + capBegin[j] : 0; - *c++ = len; - } -#endif - } else { - // we rely on 2's complement here - memset(captured.data(), -1, capturedSize * sizeof(int)); - } -} - -/* - The three following functions add one state to the automaton and - return the number of the state. -*/ - -int EQRegExpEngine::createState(QChar ch) -{ - return setupState(ch.unicode()); -} - -int EQRegExpEngine::createState(const EQRegExpCharClass &cc) -{ -#ifndef QT_NO_REGEXP_CCLASS - int n = cl.size(); - cl += EQRegExpCharClass(cc); - return setupState(CharClassBit | n); -#else - Q_UNUSED(cc); - return setupState(CharClassBit); -#endif -} - -#ifndef QT_NO_REGEXP_BACKREF -int EQRegExpEngine::createState(int bref) -{ - if (bref > nbrefs) { - nbrefs = bref; - if (nbrefs > MaxBackRefs) { - error(RXERR_LIMIT); - return 0; - } - } - return setupState(BackRefBit | bref); -} -#endif - -/* - The two following functions add a transition between all pairs of - states (i, j) where i is fond in from, and j is found in to. - - Cat-transitions are distinguished from plus-transitions for - capturing. -*/ - -void EQRegExpEngine::addCatTransitions(const QVector<int> &from, const QVector<int> &to) -{ - for (int i = 0; i < from.size(); i++) - mergeInto(&s[from.at(i)].outs, to); -} - -#ifndef QT_NO_REGEXP_CAPTURE -void EQRegExpEngine::addPlusTransitions(const QVector<int> &from, const QVector<int> &to, int atom) -{ - for (int i = 0; i < from.size(); i++) { - EQRegExpAutomatonState &st = s[from.at(i)]; - const QVector<int> oldOuts = st.outs; - mergeInto(&st.outs, to); - if (f.at(atom).capture != EQRegExpAtom::NoCapture) { - for (int j = 0; j < to.size(); j++) { - // ### st.reenter.contains(to.at(j)) check looks suspicious - if (!st.reenter.contains(to.at(j)) && - qBinaryFind(oldOuts.begin(), oldOuts.end(), to.at(j)) == oldOuts.end()) - st.reenter.insert(to.at(j), atom); - } - } - } -} -#endif - -#ifndef QT_NO_REGEXP_ANCHOR_ALT -/* - Returns an anchor that means a OR b. -*/ -int EQRegExpEngine::anchorAlternation(int a, int b) -{ - if (((a & b) == a || (a & b) == b) && ((a | b) & Anchor_Alternation) == 0) - return a & b; - - int n = aa.size(); -#ifndef QT_NO_REGEXP_OPTIM - if (n > 0 && aa.at(n - 1).a == a && aa.at(n - 1).b == b) - return Anchor_Alternation | (n - 1); -#endif - - aa.resize(n + 1); - aa[n].a = a; - aa[n].b = b; - return Anchor_Alternation | n; -} - -/* - Returns an anchor that means a AND b. -*/ -int EQRegExpEngine::anchorConcatenation(int a, int b) -{ - if (((a | b) & Anchor_Alternation) == 0) - return a | b; - if ((b & Anchor_Alternation) != 0) - qSwap(a, b); - - int aprime = anchorConcatenation(aa.at(a ^ Anchor_Alternation).a, b); - int bprime = anchorConcatenation(aa.at(a ^ Anchor_Alternation).b, b); - return anchorAlternation(aprime, bprime); -} -#endif - -/* - Adds anchor a on a transition caracterised by its from state and - its to state. -*/ -void EQRegExpEngine::addAnchors(int from, int to, int a) -{ - EQRegExpAutomatonState &st = s[from]; - if (st.anchors.contains(to)) - a = anchorAlternation(st.anchors.value(to), a); - st.anchors.insert(to, a); -} - -#ifndef QT_NO_REGEXP_OPTIM -/* - This function chooses between the good-string and the bad-character - heuristics. It computes two scores and chooses the heuristic with - the highest score. - - Here are some common-sense constraints on the scores that should be - respected if the formulas are ever modified: (1) If goodStr is - empty, the good-string heuristic scores 0. (2) If the regular - expression is trivial, the good-string heuristic should be used. - (3) If the search is case insensitive, the good-string heuristic - should be used, unless it scores 0. (Case insensitivity turns all - entries of occ1 to 0.) (4) If (goodLateStart - goodEarlyStart) is - big, the good-string heuristic should score less. -*/ -void EQRegExpEngine::heuristicallyChooseHeuristic() -{ - if (minl == 0) { - useGoodStringHeuristic = false; - } else if (trivial) { - useGoodStringHeuristic = true; - } else { - /* - Magic formula: The good string has to constitute a good - proportion of the minimum-length string, and appear at a - more-or-less known index. - */ - int goodStringScore = (64 * goodStr.length() / minl) - - (goodLateStart - goodEarlyStart); - /* - Less magic formula: We pick some characters at random, and - check whether they are good or bad. - */ - int badCharScore = 0; - int step = qMax(1, NumBadChars / 32); - for (int i = 1; i < NumBadChars; i += step) { - if (occ1.at(i) == NoOccurrence) - badCharScore += minl; - else - badCharScore += occ1.at(i); - } - badCharScore /= minl; - useGoodStringHeuristic = (goodStringScore > badCharScore); - } -} -#endif - -#if defined(QT_DEBUG) -void EQRegExpEngine::dump() const -{ - int i, j; - qDebug("Case %ssensitive engine", cs ? "" : "in"); - qDebug(" States"); - for (i = 0; i < s.size(); i++) { - qDebug(" %d%s", i, i == InitialState ? " (initial)" : i == FinalState ? " (final)" : ""); -#ifndef QT_NO_REGEXP_CAPTURE - if (nf > 0) - qDebug(" in atom %d", s[i].atom); -#endif - int m = s[i].match; - if ((m & CharClassBit) != 0) { - qDebug(" match character class %d", m ^ CharClassBit); -#ifndef QT_NO_REGEXP_CCLASS - cl[m ^ CharClassBit].dump(); -#else - qDebug(" negative character class"); -#endif - } else if ((m & BackRefBit) != 0) { - qDebug(" match back-reference %d", m ^ BackRefBit); - } else if (m >= 0x20 && m <= 0x7e) { - qDebug(" match 0x%.4x (%c)", m, m); - } else { - qDebug(" match 0x%.4x", m); - } - for (j = 0; j < s[i].outs.size(); j++) { - int next = s[i].outs[j]; - qDebug(" -> %d", next); - if (s[i].reenter.contains(next)) - qDebug(" [reenter %d]", s[i].reenter[next]); - if (s[i].anchors.value(next) != 0) - qDebug(" [anchors 0x%.8x]", s[i].anchors[next]); - } - } -#ifndef QT_NO_REGEXP_CAPTURE - if (nf > 0) { - qDebug(" Atom Parent Capture"); - for (i = 0; i < nf; i++) { - if (f[i].capture == EQRegExpAtom::NoCapture) { - qDebug(" %6d %6d nil", i, f[i].parent); - } else { - int cap = f[i].capture; - bool official = captureForOfficialCapture.contains(cap); - qDebug(" %6d %6d %6d %s", i, f[i].parent, f[i].capture, - official ? "official" : ""); - } - } - } -#endif -#ifndef QT_NO_REGEXP_ANCHOR_ALT - for (i = 0; i < aa.size(); i++) - qDebug(" Anchor alternation 0x%.8x: 0x%.8x 0x%.9x", i, aa[i].a, aa[i].b); -#endif -} -#endif - -void EQRegExpEngine::setup() -{ - ref = 1; -#ifndef QT_NO_REGEXP_CAPTURE - f.resize(32); - nf = 0; - cf = -1; -#endif - officialncap = 0; - ncap = 0; -#ifndef QT_NO_REGEXP_OPTIM - caretAnchored = true; - trivial = true; -#endif - valid = false; -#ifndef QT_NO_REGEXP_BACKREF - nbrefs = 0; -#endif -#ifndef QT_NO_REGEXP_OPTIM - useGoodStringHeuristic = true; - minl = 0; - occ1.fill(0, NumBadChars); -#endif -} - -int EQRegExpEngine::setupState(int match) -{ -#ifndef QT_NO_REGEXP_CAPTURE - s += EQRegExpAutomatonState(cf, match); -#else - s += EQRegExpAutomatonState(match); -#endif - return s.size() - 1; -} - -#ifndef QT_NO_REGEXP_CAPTURE -/* - Functions startAtom() and finishAtom() should be called to delimit - atoms. When a state is created, it is assigned to the current atom. - The information is later used for capturing. -*/ -int EQRegExpEngine::startAtom(bool officialCapture) -{ - if ((nf & (nf + 1)) == 0 && nf + 1 >= f.size()) - f.resize((nf + 1) << 1); - f[nf].parent = cf; - cf = nf++; - f[cf].capture = officialCapture ? EQRegExpAtom::OfficialCapture : EQRegExpAtom::NoCapture; - return cf; -} - -void EQRegExpEngine::finishAtom(int atom, bool needCapture) -{ - if (greedyQuantifiers && needCapture && f[atom].capture == EQRegExpAtom::NoCapture) - f[atom].capture = EQRegExpAtom::UnofficialCapture; - cf = f.at(atom).parent; -} -#endif - -#ifndef QT_NO_REGEXP_LOOKAHEAD -/* - Creates a lookahead anchor. -*/ -int EQRegExpEngine::addLookahead(EQRegExpEngine *eng, bool negative) -{ - int n = ahead.size(); - if (n == MaxLookaheads) { - error(RXERR_LIMIT); - return 0; - } - ahead += new EQRegExpLookahead(eng, negative); - return Anchor_FirstLookahead << n; -} -#endif - -#ifndef QT_NO_REGEXP_CAPTURE -/* - We want the longest leftmost captures. -*/ -static bool isBetterCapture(int ncap, const int *begin1, const int *end1, const int *begin2, - const int *end2) -{ - for (int i = 0; i < ncap; i++) { - int delta = begin2[i] - begin1[i]; // it has to start early... - if (delta == 0) - delta = end1[i] - end2[i]; // ...and end late - - if (delta != 0) - return delta > 0; - } - return false; -} -#endif - -/* - Returns true if anchor a matches at position pos + i in the input - string, otherwise false. -*/ -bool EQRegExpMatchState::testAnchor(int i, int a, const int *capBegin) -{ - int j; - -#ifndef QT_NO_REGEXP_ANCHOR_ALT - if ((a & EQRegExpEngine::Anchor_Alternation) != 0) - return testAnchor(i, eng->aa.at(a ^ EQRegExpEngine::Anchor_Alternation).a, capBegin) - || testAnchor(i, eng->aa.at(a ^ EQRegExpEngine::Anchor_Alternation).b, capBegin); -#endif - - if ((a & EQRegExpEngine::Anchor_Caret) != 0) { - if (pos + i != caretPos) - return false; - } - if ((a & EQRegExpEngine::Anchor_Dollar) != 0) { - if (pos + i != len) - return false; - } -#ifndef QT_NO_REGEXP_ESCAPE - if ((a & (EQRegExpEngine::Anchor_Word | EQRegExpEngine::Anchor_NonWord)) != 0) { - bool before = false; - bool after = false; - if (pos + i != 0) - before = isWord(in[pos + i - 1]); - if (pos + i != len) - after = isWord(in[pos + i]); - if ((a & EQRegExpEngine::Anchor_Word) != 0 && (before == after)) - return false; - if ((a & EQRegExpEngine::Anchor_NonWord) != 0 && (before != after)) - return false; - } -#endif -#ifndef QT_NO_REGEXP_LOOKAHEAD - if ((a & EQRegExpEngine::Anchor_LookaheadMask) != 0) { - QString cstr((QChar *) in + pos + i, len - pos - i); - const QVector<EQRegExpLookahead *> &ahead = eng->ahead; - for (j = 0; j < ahead.size(); j++) { - if ((a & (EQRegExpEngine::Anchor_FirstLookahead << j)) != 0) { - EQRegExpMatchState matchState; - matchState.prepareForMatch(ahead[j]->eng); - matchState.match(cstr, 0, true, true, matchState.caretPos - matchState.pos - i); - if ((matchState.captured.at(0) == 0) == ahead[j]->neg) - return false; - } - } - } -#endif -#ifndef QT_NO_REGEXP_CAPTURE -#ifndef QT_NO_REGEXP_BACKREF - for (j = 0; j < eng->nbrefs; j++) { - if ((a & (EQRegExpEngine::Anchor_BackRef1Empty << j)) != 0) { - int i = eng->captureForOfficialCapture.at(j); - if (capBegin[i] != EmptyCapture) - return false; - } - } -#endif -#endif - return true; -} - -#ifndef QT_NO_REGEXP_OPTIM -/* - The three following functions are what Jeffrey Friedl would call - transmissions (or bump-alongs). Using one or the other should make - no difference except in performance. -*/ - -bool EQRegExpEngine::goodStringMatch(EQRegExpMatchState &matchState) const -{ - int k = matchState.pos + goodEarlyStart; - while ((k = matchState.str->indexOf(goodStr, k, cs)) != -1) { - int from = k - goodLateStart; - int to = k - goodEarlyStart; - if (from > matchState.pos) - matchState.pos = from; - - while (matchState.pos <= to) { - if (matchState.matchHere()) - return true; - ++matchState.pos; - } - ++k; - } - return false; -} - -bool EQRegExpEngine::badCharMatch(EQRegExpMatchState &matchState) const -{ - int slideHead = 0; - int slideNext = 0; - int i; - int lastPos = matchState.len - minl; - memset(matchState.slideTab, 0, matchState.slideTabSize * sizeof(int)); - - /* - Set up the slide table, used for the bad-character heuristic, - using the table of first occurrence of each character. - */ - for (i = 0; i < minl; i++) { - int sk = occ1[BadChar(matchState.in[matchState.pos + i])]; - if (sk == NoOccurrence) - sk = i + 1; - if (sk > 0) { - int k = i + 1 - sk; - if (k < 0) { - sk = i + 1; - k = 0; - } - if (sk > matchState.slideTab[k]) - matchState.slideTab[k] = sk; - } - } - - if (matchState.pos > lastPos) - return false; - - for (;;) { - if (++slideNext >= matchState.slideTabSize) - slideNext = 0; - if (matchState.slideTab[slideHead] > 0) { - if (matchState.slideTab[slideHead] - 1 > matchState.slideTab[slideNext]) - matchState.slideTab[slideNext] = matchState.slideTab[slideHead] - 1; - matchState.slideTab[slideHead] = 0; - } else { - if (matchState.matchHere()) - return true; - } - - if (matchState.pos == lastPos) - break; - - /* - Update the slide table. This code has much in common with - the initialization code. - */ - int sk = occ1[BadChar(matchState.in[matchState.pos + minl])]; - if (sk == NoOccurrence) { - matchState.slideTab[slideNext] = minl; - } else if (sk > 0) { - int k = slideNext + minl - sk; - if (k >= matchState.slideTabSize) - k -= matchState.slideTabSize; - if (sk > matchState.slideTab[k]) - matchState.slideTab[k] = sk; - } - slideHead = slideNext; - ++matchState.pos; - } - return false; -} -#else -bool EQRegExpEngine::bruteMatch(EQRegExpMatchState &matchState) const -{ - while (matchState.pos <= matchState.len) { - if (matchState.matchHere()) - return true; - ++matchState.pos; - } - return false; -} -#endif - -/* - Here's the core of the engine. It tries to do a match here and now. -*/ -bool EQRegExpMatchState::matchHere() -{ - int ncur = 1, nnext = 0; - int i = 0, j, k, m; - bool stop = false; - - matchLen = -1; - oneTestMatchedLen = -1; - curStack[0] = EQRegExpEngine::InitialState; - - int ncap = eng->ncap; -#ifndef QT_NO_REGEXP_CAPTURE - if (ncap > 0) { - for (j = 0; j < ncap; j++) { - curCapBegin[j] = EmptyCapture; - curCapEnd[j] = EmptyCapture; - } - } -#endif - -#ifndef QT_NO_REGEXP_BACKREF - while ((ncur > 0 || !sleeping.isEmpty()) && i <= len - pos && !stop) -#else - while (ncur > 0 && i <= len - pos && !stop) -#endif - { - int ch = (i < len - pos) ? in[pos + i].unicode() : 0; - for (j = 0; j < ncur; j++) { - int cur = curStack[j]; - const EQRegExpAutomatonState &scur = eng->s.at(cur); - const QVector<int> &outs = scur.outs; - for (k = 0; k < outs.size(); k++) { - int next = outs.at(k); - const EQRegExpAutomatonState &snext = eng->s.at(next); - bool inside = true; -#if !defined(QT_NO_REGEXP_BACKREF) && !defined(QT_NO_REGEXP_CAPTURE) - int needSomeSleep = 0; -#endif - - /* - First, check if the anchors are anchored properly. - */ - int a = scur.anchors.value(next); - if (a != 0 && !testAnchor(i, a, curCapBegin + j * ncap)) - inside = false; - - /* - If indeed they are, check if the input character is - correct for this transition. - */ - if (inside) { - m = snext.match; - if ((m & (EQRegExpEngine::CharClassBit | EQRegExpEngine::BackRefBit)) == 0) { - if (eng->cs) - inside = (m == ch); - else - inside = (QChar(m).toLower() == QChar(ch).toLower()); - } else if (next == EQRegExpEngine::FinalState) { - matchLen = i; - stop = minimal; - inside = true; - } else if ((m & EQRegExpEngine::CharClassBit) != 0) { -#ifndef QT_NO_REGEXP_CCLASS - const EQRegExpCharClass &cc = eng->cl.at(m ^ EQRegExpEngine::CharClassBit); - if (eng->cs) - inside = cc.in(ch); - else if (cc.negative()) - inside = cc.in(QChar(ch).toLower()) && - cc.in(QChar(ch).toUpper()); - else - inside = cc.in(QChar(ch).toLower()) || - cc.in(QChar(ch).toUpper()); -#endif -#if !defined(QT_NO_REGEXP_BACKREF) && !defined(QT_NO_REGEXP_CAPTURE) - } else { /* ((m & EQRegExpEngine::BackRefBit) != 0) */ - int bref = m ^ EQRegExpEngine::BackRefBit; - int ell = j * ncap + eng->captureForOfficialCapture.at(bref - 1); - - inside = bref <= ncap && curCapBegin[ell] != EmptyCapture; - if (inside) { - if (eng->cs) - inside = (in[pos + curCapBegin[ell]] == QChar(ch)); - else - inside = (in[pos + curCapBegin[ell]].toLower() - == QChar(ch).toLower()); - } - - if (inside) { - int delta; - if (curCapEnd[ell] == EmptyCapture) - delta = i - curCapBegin[ell]; - else - delta = curCapEnd[ell] - curCapBegin[ell]; - - inside = (delta <= len - (pos + i)); - if (inside && delta > 1) { - int n = 1; - if (eng->cs) { - while (n < delta) { - if (in[pos + curCapBegin[ell] + n] - != in[pos + i + n]) - break; - ++n; - } - } else { - while (n < delta) { - QChar a = in[pos + curCapBegin[ell] + n]; - QChar b = in[pos + i + n]; - if (a.toLower() != b.toLower()) - break; - ++n; - } - } - inside = (n == delta); - if (inside) - needSomeSleep = delta - 1; - } - } -#endif - } - } - - /* - We must now update our data structures. - */ - if (inside) { -#ifndef QT_NO_REGEXP_CAPTURE - int *capBegin, *capEnd; -#endif - /* - If the next state was not encountered yet, all - is fine. - */ - if ((m = inNextStack[next]) == -1) { - m = nnext++; - nextStack[m] = next; - inNextStack[next] = m; -#ifndef QT_NO_REGEXP_CAPTURE - capBegin = nextCapBegin + m * ncap; - capEnd = nextCapEnd + m * ncap; - - /* - Otherwise, we'll first maintain captures in - temporary arrays, and decide at the end whether - it's best to keep the previous capture zones or - the new ones. - */ - } else { - capBegin = tempCapBegin; - capEnd = tempCapEnd; -#endif - } - -#ifndef QT_NO_REGEXP_CAPTURE - /* - Updating the capture zones is much of a task. - */ - if (ncap > 0) { - memcpy(capBegin, curCapBegin + j * ncap, ncap * sizeof(int)); - memcpy(capEnd, curCapEnd + j * ncap, ncap * sizeof(int)); - int c = scur.atom, n = snext.atom; - int p = -1, q = -1; - int cap; - - /* - Lemma 1. For any x in the range [0..nf), we - have f[x].parent < x. - - Proof. By looking at startAtom(), it is - clear that cf < nf holds all the time, and - thus that f[nf].parent < nf. - */ - - /* - If we are reentering an atom, we empty all - capture zones inside it. - */ - if ((q = scur.reenter.value(next)) != 0) { - QBitArray b(eng->nf, false); - b.setBit(q, true); - for (int ell = q + 1; ell < eng->nf; ell++) { - if (b.testBit(eng->f.at(ell).parent)) { - b.setBit(ell, true); - cap = eng->f.at(ell).capture; - if (cap >= 0) { - capBegin[cap] = EmptyCapture; - capEnd[cap] = EmptyCapture; - } - } - } - p = eng->f.at(q).parent; - - /* - Otherwise, close the capture zones we are - leaving. We are leaving f[c].capture, - f[f[c].parent].capture, - f[f[f[c].parent].parent].capture, ..., - until f[x].capture, with x such that - f[x].parent is the youngest common ancestor - for c and n. - - We go up along c's and n's ancestry until - we find x. - */ - } else { - p = c; - q = n; - while (p != q) { - if (p > q) { - cap = eng->f.at(p).capture; - if (cap >= 0) { - if (capBegin[cap] == i) { - capBegin[cap] = EmptyCapture; - capEnd[cap] = EmptyCapture; - } else { - capEnd[cap] = i; - } - } - p = eng->f.at(p).parent; - } else { - q = eng->f.at(q).parent; - } - } - } - - /* - In any case, we now open the capture zones - we are entering. We work upwards from n - until we reach p (the parent of the atom we - reenter or the youngest common ancestor). - */ - while (n > p) { - cap = eng->f.at(n).capture; - if (cap >= 0) { - capBegin[cap] = i; - capEnd[cap] = EmptyCapture; - } - n = eng->f.at(n).parent; - } - /* - If the next state was already in - nextStack, we must choose carefully which - capture zones we want to keep. - */ - if (capBegin == tempCapBegin && - isBetterCapture(ncap, capBegin, capEnd, nextCapBegin + m * ncap, - nextCapEnd + m * ncap)) { - memcpy(nextCapBegin + m * ncap, capBegin, ncap * sizeof(int)); - memcpy(nextCapEnd + m * ncap, capEnd, ncap * sizeof(int)); - } - } -#ifndef QT_NO_REGEXP_BACKREF - /* - We are done with updating the capture zones. - It's now time to put the next state to sleep, - if it needs to, and to remove it from - nextStack. - */ - if (needSomeSleep > 0) { - QVector<int> zzZ(2 + 2 * ncap); - zzZ[0] = i + needSomeSleep; - zzZ[1] = next; - if (ncap > 0) { - memcpy(zzZ.data() + 2, capBegin, ncap * sizeof(int)); - memcpy(zzZ.data() + 2 + ncap, capEnd, ncap * sizeof(int)); - } - inNextStack[nextStack[--nnext]] = -1; - sleeping.append(zzZ); - } -#endif -#endif - } - } - } -#ifndef QT_NO_REGEXP_CAPTURE - /* - If we reached the final state, hurray! Copy the captured - zone. - */ - if (ncap > 0 && (m = inNextStack[EQRegExpEngine::FinalState]) != -1) { - memcpy(capBegin, nextCapBegin + m * ncap, ncap * sizeof(int)); - memcpy(capEnd, nextCapEnd + m * ncap, ncap * sizeof(int)); - } -#ifndef QT_NO_REGEXP_BACKREF - /* - It's time to wake up the sleepers. - */ - j = 0; - while (j < sleeping.count()) { - if (sleeping.at(j)[0] == i) { - const QVector<int> &zzZ = sleeping.at(j); - int next = zzZ[1]; - const int *capBegin = zzZ.data() + 2; - const int *capEnd = zzZ.data() + 2 + ncap; - bool copyOver = true; - - if ((m = inNextStack[next]) == -1) { - m = nnext++; - nextStack[m] = next; - inNextStack[next] = m; - } else { - copyOver = isBetterCapture(ncap, nextCapBegin + m * ncap, nextCapEnd + m * ncap, - capBegin, capEnd); - } - if (copyOver) { - memcpy(nextCapBegin + m * ncap, capBegin, ncap * sizeof(int)); - memcpy(nextCapEnd + m * ncap, capEnd, ncap * sizeof(int)); - } - - sleeping.removeAt(j); - } else { - ++j; - } - } -#endif -#endif - for (j = 0; j < nnext; j++) - inNextStack[nextStack[j]] = -1; - - // avoid needless iteration that confuses oneTestMatchedLen - if (nnext == 1 && nextStack[0] == EQRegExpEngine::FinalState -#ifndef QT_NO_REGEXP_BACKREF - && sleeping.isEmpty() -#endif - ) - stop = true; - - qSwap(curStack, nextStack); -#ifndef QT_NO_REGEXP_CAPTURE - qSwap(curCapBegin, nextCapBegin); - qSwap(curCapEnd, nextCapEnd); -#endif - ncur = nnext; - nnext = 0; - ++i; - } - -#ifndef QT_NO_REGEXP_BACKREF - /* - If minimal matching is enabled, we might have some sleepers - left. - */ - if (!sleeping.isEmpty()) - sleeping.clear(); -#endif - - oneTestMatchedLen = i - 1; - return (matchLen >= 0); -} - -#ifndef QT_NO_REGEXP_CCLASS - -EQRegExpCharClass::EQRegExpCharClass() - : c(0), n(false) -{ -#ifndef QT_NO_REGEXP_OPTIM - occ1.fill(NoOccurrence, NumBadChars); -#endif -} - -EQRegExpCharClass &EQRegExpCharClass::operator=(const EQRegExpCharClass &cc) -{ - c = cc.c; - r = cc.r; - n = cc.n; -#ifndef QT_NO_REGEXP_OPTIM - occ1 = cc.occ1; -#endif - return *this; -} - -void EQRegExpCharClass::clear() -{ - c = 0; - r.resize(0); - n = false; -} - -void EQRegExpCharClass::setNegative(bool negative) -{ - n = negative; -#ifndef QT_NO_REGEXP_OPTIM - occ1.fill(0, NumBadChars); -#endif -} - -void EQRegExpCharClass::addCategories(int cats) -{ - c |= cats; -#ifndef QT_NO_REGEXP_OPTIM - occ1.fill(0, NumBadChars); -#endif -} - -void EQRegExpCharClass::addRange(ushort from, ushort to) -{ - if (from > to) - qSwap(from, to); - int m = r.size(); - r.resize(m + 1); - r[m].from = from; - r[m].len = to - from + 1; - -#ifndef QT_NO_REGEXP_OPTIM - int i; - - if (to - from < NumBadChars) { - if (from % NumBadChars <= to % NumBadChars) { - for (i = from % NumBadChars; i <= to % NumBadChars; i++) - occ1[i] = 0; - } else { - for (i = 0; i <= to % NumBadChars; i++) - occ1[i] = 0; - for (i = from % NumBadChars; i < NumBadChars; i++) - occ1[i] = 0; - } - } else { - occ1.fill(0, NumBadChars); - } -#endif -} - -bool EQRegExpCharClass::in(QChar ch) const -{ -#ifndef QT_NO_REGEXP_OPTIM - if (occ1.at(BadChar(ch)) == NoOccurrence) - return n; -#endif - - if (c != 0 && (c & (1 << (int)ch.category())) != 0) - return !n; - - const int uc = ch.unicode(); - int size = r.size(); - - for (int i = 0; i < size; ++i) { - const EQRegExpCharClassRange &range = r.at(i); - if (uint(uc - range.from) < uint(r.at(i).len)) - return !n; - } - return n; -} - -#if defined(QT_DEBUG) -void EQRegExpCharClass::dump() const -{ - int i; - qDebug(" %stive character class", n ? "nega" : "posi"); -#ifndef QT_NO_REGEXP_CCLASS - if (c != 0) - qDebug(" categories 0x%.8x", c); -#endif - for (i = 0; i < r.size(); i++) - qDebug(" 0x%.4x through 0x%.4x", r[i].from, r[i].from + r[i].len - 1); -} -#endif -#endif - -EQRegExpEngine::Box::Box(EQRegExpEngine *engine) - : eng(engine), skipanchors(0) -#ifndef QT_NO_REGEXP_OPTIM - , earlyStart(0), lateStart(0), maxl(0) -#endif -{ -#ifndef QT_NO_REGEXP_OPTIM - occ1.fill(NoOccurrence, NumBadChars); -#endif - minl = 0; -} - -EQRegExpEngine::Box &EQRegExpEngine::Box::operator=(const Box &b) -{ - eng = b.eng; - ls = b.ls; - rs = b.rs; - lanchors = b.lanchors; - ranchors = b.ranchors; - skipanchors = b.skipanchors; -#ifndef QT_NO_REGEXP_OPTIM - earlyStart = b.earlyStart; - lateStart = b.lateStart; - str = b.str; - leftStr = b.leftStr; - rightStr = b.rightStr; - maxl = b.maxl; - occ1 = b.occ1; -#endif - minl = b.minl; - return *this; -} - -void EQRegExpEngine::Box::set(QChar ch) -{ - ls.resize(1); - ls[0] = eng->createState(ch); - rs = ls; -#ifndef QT_NO_REGEXP_OPTIM - str = ch; - leftStr = ch; - rightStr = ch; - maxl = 1; - occ1[BadChar(ch)] = 0; -#endif - minl = 1; -} - -void EQRegExpEngine::Box::set(const EQRegExpCharClass &cc) -{ - ls.resize(1); - ls[0] = eng->createState(cc); - rs = ls; -#ifndef QT_NO_REGEXP_OPTIM - maxl = 1; - occ1 = cc.firstOccurrence(); -#endif - minl = 1; -} - -#ifndef QT_NO_REGEXP_BACKREF -void EQRegExpEngine::Box::set(int bref) -{ - ls.resize(1); - ls[0] = eng->createState(bref); - rs = ls; - if (bref >= 1 && bref <= MaxBackRefs) - skipanchors = Anchor_BackRef0Empty << bref; -#ifndef QT_NO_REGEXP_OPTIM - maxl = InftyLen; -#endif - minl = 0; -} -#endif - -void EQRegExpEngine::Box::cat(const Box &b) -{ - eng->addCatTransitions(rs, b.ls); - addAnchorsToEngine(b); - if (minl == 0) { - lanchors.unite(b.lanchors); - if (skipanchors != 0) { - for (int i = 0; i < b.ls.size(); i++) { - int a = eng->anchorConcatenation(lanchors.value(b.ls.at(i), 0), skipanchors); - lanchors.insert(b.ls.at(i), a); - } - } - mergeInto(&ls, b.ls); - } - if (b.minl == 0) { - ranchors.unite(b.ranchors); - if (b.skipanchors != 0) { - for (int i = 0; i < rs.size(); i++) { - int a = eng->anchorConcatenation(ranchors.value(rs.at(i), 0), b.skipanchors); - ranchors.insert(rs.at(i), a); - } - } - mergeInto(&rs, b.rs); - } else { - ranchors = b.ranchors; - rs = b.rs; - } - -#ifndef QT_NO_REGEXP_OPTIM - if (maxl != InftyLen) { - if (rightStr.length() + b.leftStr.length() > - qMax(str.length(), b.str.length())) { - earlyStart = minl - rightStr.length(); - lateStart = maxl - rightStr.length(); - str = rightStr + b.leftStr; - } else if (b.str.length() > str.length()) { - earlyStart = minl + b.earlyStart; - lateStart = maxl + b.lateStart; - str = b.str; - } - } - - if (leftStr.length() == maxl) - leftStr += b.leftStr; - - if (b.rightStr.length() == b.maxl) { - rightStr += b.rightStr; - } else { - rightStr = b.rightStr; - } - - if (maxl == InftyLen || b.maxl == InftyLen) { - maxl = InftyLen; - } else { - maxl += b.maxl; - } - - for (int i = 0; i < NumBadChars; i++) { - if (b.occ1.at(i) != NoOccurrence && minl + b.occ1.at(i) < occ1.at(i)) - occ1[i] = minl + b.occ1.at(i); - } -#endif - - minl += b.minl; - if (minl == 0) - skipanchors = eng->anchorConcatenation(skipanchors, b.skipanchors); - else - skipanchors = 0; -} - -void EQRegExpEngine::Box::orx(const Box &b) -{ - mergeInto(&ls, b.ls); - lanchors.unite(b.lanchors); - mergeInto(&rs, b.rs); - ranchors.unite(b.ranchors); - - if (b.minl == 0) { - if (minl == 0) - skipanchors = eng->anchorAlternation(skipanchors, b.skipanchors); - else - skipanchors = b.skipanchors; - } - -#ifndef QT_NO_REGEXP_OPTIM - for (int i = 0; i < NumBadChars; i++) { - if (occ1.at(i) > b.occ1.at(i)) - occ1[i] = b.occ1.at(i); - } - earlyStart = 0; - lateStart = 0; - str = QString(); - leftStr = QString(); - rightStr = QString(); - if (b.maxl > maxl) - maxl = b.maxl; -#endif - if (b.minl < minl) - minl = b.minl; -} - -void EQRegExpEngine::Box::plus(int atom) -{ -#ifndef QT_NO_REGEXP_CAPTURE - eng->addPlusTransitions(rs, ls, atom); -#else - Q_UNUSED(atom); - eng->addCatTransitions(rs, ls); -#endif - addAnchorsToEngine(*this); -#ifndef QT_NO_REGEXP_OPTIM - maxl = InftyLen; -#endif -} - -void EQRegExpEngine::Box::opt() -{ -#ifndef QT_NO_REGEXP_OPTIM - earlyStart = 0; - lateStart = 0; - str = QString(); - leftStr = QString(); - rightStr = QString(); -#endif - skipanchors = 0; - minl = 0; -} - -void EQRegExpEngine::Box::catAnchor(int a) -{ - if (a != 0) { - for (int i = 0; i < rs.size(); i++) { - a = eng->anchorConcatenation(ranchors.value(rs.at(i), 0), a); - ranchors.insert(rs.at(i), a); - } - if (minl == 0) - skipanchors = eng->anchorConcatenation(skipanchors, a); - } -} - -#ifndef QT_NO_REGEXP_OPTIM -void EQRegExpEngine::Box::setupHeuristics() -{ - eng->goodEarlyStart = earlyStart; - eng->goodLateStart = lateStart; - eng->goodStr = eng->cs ? str : str.toLower(); - - eng->minl = minl; - if (eng->cs) { - /* - A regular expression such as 112|1 has occ1['2'] = 2 and minl = - 1 at this point. An entry of occ1 has to be at most minl or - infinity for the rest of the algorithm to go well. - - We waited until here before normalizing these cases (instead of - doing it in Box::orx()) because sometimes things improve by - themselves. Consider for example (112|1)34. - */ - for (int i = 0; i < NumBadChars; i++) { - if (occ1.at(i) != NoOccurrence && occ1.at(i) >= minl) - occ1[i] = minl; - } - eng->occ1 = occ1; - } else { - eng->occ1.fill(0, NumBadChars); - } - - eng->heuristicallyChooseHeuristic(); -} -#endif - -#if defined(QT_DEBUG) -void EQRegExpEngine::Box::dump() const -{ - int i; - qDebug("Box of at least %d character%s", minl, minl == 1 ? "" : "s"); - qDebug(" Left states:"); - for (i = 0; i < ls.size(); i++) { - if (lanchors.value(ls[i], 0) == 0) - qDebug(" %d", ls[i]); - else - qDebug(" %d [anchors 0x%.8x]", ls[i], lanchors[ls[i]]); - } - qDebug(" Right states:"); - for (i = 0; i < rs.size(); i++) { - if (ranchors.value(rs[i], 0) == 0) - qDebug(" %d", rs[i]); - else - qDebug(" %d [anchors 0x%.8x]", rs[i], ranchors[rs[i]]); - } - qDebug(" Skip anchors: 0x%.8x", skipanchors); -} -#endif - -void EQRegExpEngine::Box::addAnchorsToEngine(const Box &to) const -{ - for (int i = 0; i < to.ls.size(); i++) { - for (int j = 0; j < rs.size(); j++) { - int a = eng->anchorConcatenation(ranchors.value(rs.at(j), 0), - to.lanchors.value(to.ls.at(i), 0)); - eng->addAnchors(rs[j], to.ls[i], a); - } - } -} - -int EQRegExpEngine::getChar() -{ - return (yyPos == yyLen) ? EOS : yyIn[yyPos++].unicode(); -} - -int EQRegExpEngine::getEscape() -{ -#ifndef QT_NO_REGEXP_ESCAPE - const char tab[] = "afnrtv"; // no b, as \b means word boundary - const char backTab[] = "\a\f\n\r\t\v"; - ushort low; - int i; -#endif - ushort val; - int prevCh = yyCh; - - if (prevCh == EOS) { - error(RXERR_END); - return Tok_Char | '\\'; - } - yyCh = getChar(); -#ifndef QT_NO_REGEXP_ESCAPE - if ((prevCh & ~0xff) == 0) { - const char *p = strchr(tab, prevCh); - if (p != 0) - return Tok_Char | backTab[p - tab]; - } -#endif - - switch (prevCh) { -#ifndef QT_NO_REGEXP_ESCAPE - case '0': - val = 0; - for (i = 0; i < 3; i++) { - if (yyCh >= '0' && yyCh <= '7') - val = (val << 3) | (yyCh - '0'); - else - break; - yyCh = getChar(); - } - if ((val & ~0377) != 0) - error(RXERR_OCTAL); - return Tok_Char | val; -#endif -#ifndef QT_NO_REGEXP_ESCAPE - case 'B': - return Tok_NonWord; -#endif -#ifndef QT_NO_REGEXP_CCLASS - case 'D': - // see QChar::isDigit() - yyCharClass->addCategories(0x7fffffef); - return Tok_CharClass; - case 'S': - // see QChar::isSpace() - yyCharClass->addCategories(0x7ffff87f); - yyCharClass->addRange(0x0000, 0x0008); - yyCharClass->addRange(0x000e, 0x001f); - yyCharClass->addRange(0x007f, 0x009f); - return Tok_CharClass; - case 'W': - // see QChar::isLetterOrNumber() and QChar::isMark() - yyCharClass->addCategories(0x7fe07f81); - yyCharClass->addRange(0x203f, 0x2040); - yyCharClass->addSingleton(0x2040); - yyCharClass->addSingleton(0x2054); - yyCharClass->addSingleton(0x30fb); - yyCharClass->addRange(0xfe33, 0xfe34); - yyCharClass->addRange(0xfe4d, 0xfe4f); - yyCharClass->addSingleton(0xff3f); - yyCharClass->addSingleton(0xff65); - return Tok_CharClass; -#endif -#ifndef QT_NO_REGEXP_ESCAPE - case 'b': - return Tok_Word; -#endif -#ifndef QT_NO_REGEXP_CCLASS - case 'd': - // see QChar::isDigit() - yyCharClass->addCategories(0x00000010); - return Tok_CharClass; - case 's': - // see QChar::isSpace() - yyCharClass->addCategories(0x00000380); - yyCharClass->addRange(0x0009, 0x000d); - return Tok_CharClass; - case 'w': - // see QChar::isLetterOrNumber() and QChar::isMark() - yyCharClass->addCategories(0x000f807e); - yyCharClass->addSingleton(0x005f); // '_' - return Tok_CharClass; -#endif -#ifndef QT_NO_REGEXP_ESCAPE - case 'x': - val = 0; - for (i = 0; i < 4; i++) { - low = QChar(yyCh).toLower().unicode(); - if (low >= '0' && low <= '9') - val = (val << 4) | (low - '0'); - else if (low >= 'a' && low <= 'f') - val = (val << 4) | (low - 'a' + 10); - else - break; - yyCh = getChar(); - } - return Tok_Char | val; -#endif - default: - if (prevCh >= '1' && prevCh <= '9') { -#ifndef QT_NO_REGEXP_BACKREF - val = prevCh - '0'; - while (yyCh >= '0' && yyCh <= '9') { - val = (val * 10) + (yyCh - '0'); - yyCh = getChar(); - } - return Tok_BackRef | val; -#else - error(RXERR_DISABLED); -#endif - } - return Tok_Char | prevCh; - } -} - -#ifndef QT_NO_REGEXP_INTERVAL -int EQRegExpEngine::getRep(int def) -{ - if (yyCh >= '0' && yyCh <= '9') { - int rep = 0; - do { - rep = 10 * rep + yyCh - '0'; - if (rep >= InftyRep) { - error(RXERR_REPETITION); - rep = def; - } - yyCh = getChar(); - } while (yyCh >= '0' && yyCh <= '9'); - return rep; - } else { - return def; - } -} -#endif - -#ifndef QT_NO_REGEXP_LOOKAHEAD -void EQRegExpEngine::skipChars(int n) -{ - if (n > 0) { - yyPos += n - 1; - yyCh = getChar(); - } -} -#endif - -void EQRegExpEngine::error(const char *msg) -{ - if (yyError.isEmpty()) - yyError = QLatin1String(msg); -} - -void EQRegExpEngine::startTokenizer(const QChar *rx, int len) -{ - yyIn = rx; - yyPos0 = 0; - yyPos = 0; - yyLen = len; - yyCh = getChar(); - yyCharClass = new EQRegExpCharClass; - yyMinRep = 0; - yyMaxRep = 0; - yyError = QString(); -} - -int EQRegExpEngine::getToken() -{ -#ifndef QT_NO_REGEXP_CCLASS - ushort pendingCh = 0; - bool charPending; - bool rangePending; - int tok; -#endif - int prevCh = yyCh; - - yyPos0 = yyPos - 1; -#ifndef QT_NO_REGEXP_CCLASS - yyCharClass->clear(); -#endif - yyMinRep = 0; - yyMaxRep = 0; - yyCh = getChar(); - - switch (prevCh) { - case EOS: - yyPos0 = yyPos; - return Tok_Eos; - case '$': - return Tok_Dollar; - case '(': - if (yyCh == '?') { - prevCh = getChar(); - yyCh = getChar(); - switch (prevCh) { -#ifndef QT_NO_REGEXP_LOOKAHEAD - case '!': - return Tok_NegLookahead; - case '=': - return Tok_PosLookahead; -#endif - case ':': - return Tok_MagicLeftParen; - default: - error(RXERR_LOOKAHEAD); - return Tok_MagicLeftParen; - } - } else { - return Tok_LeftParen; - } - case ')': - return Tok_RightParen; - case '*': - yyMinRep = 0; - yyMaxRep = InftyRep; - return Tok_Quantifier; - case '+': - yyMinRep = 1; - yyMaxRep = InftyRep; - return Tok_Quantifier; - case '.': -#ifndef QT_NO_REGEXP_CCLASS - yyCharClass->setNegative(true); -#endif - return Tok_CharClass; - case '?': - yyMinRep = 0; - yyMaxRep = 1; - return Tok_Quantifier; - case '[': -#ifndef QT_NO_REGEXP_CCLASS - if (yyCh == '^') { - yyCharClass->setNegative(true); - yyCh = getChar(); - } - charPending = false; - rangePending = false; - do { - if (yyCh == '-' && charPending && !rangePending) { - rangePending = true; - yyCh = getChar(); - } else { - if (charPending && !rangePending) { - yyCharClass->addSingleton(pendingCh); - charPending = false; - } - if (yyCh == '\\') { - yyCh = getChar(); - tok = getEscape(); - if (tok == Tok_Word) - tok = '\b'; - } else { - tok = Tok_Char | yyCh; - yyCh = getChar(); - } - if (tok == Tok_CharClass) { - if (rangePending) { - yyCharClass->addSingleton('-'); - yyCharClass->addSingleton(pendingCh); - charPending = false; - rangePending = false; - } - } else if ((tok & Tok_Char) != 0) { - if (rangePending) { - yyCharClass->addRange(pendingCh, tok ^ Tok_Char); - charPending = false; - rangePending = false; - } else { - pendingCh = tok ^ Tok_Char; - charPending = true; - } - } else { - error(RXERR_CHARCLASS); - } - } - } while (yyCh != ']' && yyCh != EOS); - if (rangePending) - yyCharClass->addSingleton('-'); - if (charPending) - yyCharClass->addSingleton(pendingCh); - if (yyCh == EOS) - error(RXERR_END); - else - yyCh = getChar(); - return Tok_CharClass; -#else - error(RXERR_END); - return Tok_Char | '['; -#endif - case '\\': - return getEscape(); - case ']': - error(RXERR_LEFTDELIM); - return Tok_Char | ']'; - case '^': - return Tok_Caret; - case '{': -#ifndef QT_NO_REGEXP_INTERVAL - yyMinRep = getRep(0); - yyMaxRep = yyMinRep; - if (yyCh == ',') { - yyCh = getChar(); - yyMaxRep = getRep(InftyRep); - } - if (yyMaxRep < yyMinRep) - qSwap(yyMinRep, yyMaxRep); - if (yyCh != '}') - error(RXERR_REPETITION); - yyCh = getChar(); - return Tok_Quantifier; -#else - error(RXERR_DISABLED); - return Tok_Char | '{'; -#endif - case '|': - return Tok_Bar; - case '}': - error(RXERR_LEFTDELIM); - return Tok_Char | '}'; - default: - return Tok_Char | prevCh; - } -} - -int EQRegExpEngine::parse(const QChar *pattern, int len) -{ - valid = true; - startTokenizer(pattern, len); - yyTok = getToken(); -#ifndef QT_NO_REGEXP_CAPTURE - yyMayCapture = true; -#else - yyMayCapture = false; -#endif - -#ifndef QT_NO_REGEXP_CAPTURE - int atom = startAtom(false); -#endif - EQRegExpCharClass anything; - Box box(this); // create InitialState - box.set(anything); - Box rightBox(this); // create FinalState - rightBox.set(anything); - - Box middleBox(this); - parseExpression(&middleBox); -#ifndef QT_NO_REGEXP_CAPTURE - finishAtom(atom, false); -#endif -#ifndef QT_NO_REGEXP_OPTIM - middleBox.setupHeuristics(); -#endif - box.cat(middleBox); - box.cat(rightBox); - delete yyCharClass; - yyCharClass = 0; - -#ifndef QT_NO_REGEXP_CAPTURE - for (int i = 0; i < nf; ++i) { - switch (f[i].capture) { - case EQRegExpAtom::NoCapture: - break; - case EQRegExpAtom::OfficialCapture: - f[i].capture = ncap; - captureForOfficialCapture.append(ncap); - ++ncap; - ++officialncap; - break; - case EQRegExpAtom::UnofficialCapture: - f[i].capture = greedyQuantifiers ? ncap++ : EQRegExpAtom::NoCapture; - } - } - -#ifndef QT_NO_REGEXP_BACKREF -#ifndef QT_NO_REGEXP_OPTIM - if (officialncap == 0 && nbrefs == 0) { - ncap = nf = 0; - f.clear(); - } -#endif - // handle the case where there's a \5 with no corresponding capture - // (captureForOfficialCapture.size() != officialncap) - for (int i = 0; i < nbrefs - officialncap; ++i) { - captureForOfficialCapture.append(ncap); - ++ncap; - } -#endif -#endif - - if (!yyError.isEmpty()) - return -1; - -#ifndef QT_NO_REGEXP_OPTIM - const EQRegExpAutomatonState &sinit = s.at(InitialState); - caretAnchored = !sinit.anchors.isEmpty(); - if (caretAnchored) { - const QMap<int, int> &anchors = sinit.anchors; - QMap<int, int>::const_iterator a; - for (a = anchors.begin(); a != anchors.end(); ++a) { - if ( -#ifndef QT_NO_REGEXP_ANCHOR_ALT - (*a & Anchor_Alternation) != 0 || -#endif - (*a & Anchor_Caret) == 0) - { - caretAnchored = false; - break; - } - } - } -#endif - - // cleanup anchors - int numStates = s.count(); - for (int i = 0; i < numStates; ++i) { - EQRegExpAutomatonState &state = s[i]; - if (!state.anchors.isEmpty()) { - QMap<int, int>::iterator a = state.anchors.begin(); - while (a != state.anchors.constEnd()) { - if (a.value() == 0) - a = state.anchors.erase(a); - else - ++a; - } - } - } - - return yyPos0; -} - -void EQRegExpEngine::parseAtom(Box *box) -{ -#ifndef QT_NO_REGEXP_LOOKAHEAD - EQRegExpEngine *eng = 0; - bool neg; - int len; -#endif - - if ((yyTok & Tok_Char) != 0) { - box->set(QChar(yyTok ^ Tok_Char)); - } else { -#ifndef QT_NO_REGEXP_OPTIM - trivial = false; -#endif - switch (yyTok) { - case Tok_Dollar: - box->catAnchor(Anchor_Dollar); - break; - case Tok_Caret: - box->catAnchor(Anchor_Caret); - break; -#ifndef QT_NO_REGEXP_LOOKAHEAD - case Tok_PosLookahead: - case Tok_NegLookahead: - neg = (yyTok == Tok_NegLookahead); - eng = new EQRegExpEngine(cs, greedyQuantifiers); - len = eng->parse(yyIn + yyPos - 1, yyLen - yyPos + 1); - if (len >= 0) - skipChars(len); - else - error(RXERR_LOOKAHEAD); - box->catAnchor(addLookahead(eng, neg)); - yyTok = getToken(); - if (yyTok != Tok_RightParen) - error(RXERR_LOOKAHEAD); - break; -#endif -#ifndef QT_NO_REGEXP_ESCAPE - case Tok_Word: - box->catAnchor(Anchor_Word); - break; - case Tok_NonWord: - box->catAnchor(Anchor_NonWord); - break; -#endif - case Tok_LeftParen: - case Tok_MagicLeftParen: - yyTok = getToken(); - parseExpression(box); - if (yyTok != Tok_RightParen) - error(RXERR_END); - break; - case Tok_CharClass: - box->set(*yyCharClass); - break; - case Tok_Quantifier: - error(RXERR_REPETITION); - break; - default: -#ifndef QT_NO_REGEXP_BACKREF - if ((yyTok & Tok_BackRef) != 0) - box->set(yyTok ^ Tok_BackRef); - else -#endif - error(RXERR_DISABLED); - } - } - yyTok = getToken(); -} - -void EQRegExpEngine::parseFactor(Box *box) -{ -#ifndef QT_NO_REGEXP_CAPTURE - int outerAtom = greedyQuantifiers ? startAtom(false) : -1; - int innerAtom = startAtom(yyMayCapture && yyTok == Tok_LeftParen); - bool magicLeftParen = (yyTok == Tok_MagicLeftParen); -#else - const int innerAtom = -1; -#endif - -#ifndef QT_NO_REGEXP_INTERVAL -#define YYREDO() \ - yyIn = in, yyPos0 = pos0, yyPos = pos, yyLen = len, yyCh = ch, \ - *yyCharClass = charClass, yyMinRep = 0, yyMaxRep = 0, yyTok = tok - - const QChar *in = yyIn; - int pos0 = yyPos0; - int pos = yyPos; - int len = yyLen; - int ch = yyCh; - EQRegExpCharClass charClass; - if (yyTok == Tok_CharClass) - charClass = *yyCharClass; - int tok = yyTok; - bool mayCapture = yyMayCapture; -#endif - - parseAtom(box); -#ifndef QT_NO_REGEXP_CAPTURE - finishAtom(innerAtom, magicLeftParen); -#endif - - bool hasQuantifier = (yyTok == Tok_Quantifier); - if (hasQuantifier) { -#ifndef QT_NO_REGEXP_OPTIM - trivial = false; -#endif - if (yyMaxRep == InftyRep) { - box->plus(innerAtom); -#ifndef QT_NO_REGEXP_INTERVAL - } else if (yyMaxRep == 0) { - box->clear(); -#endif - } - if (yyMinRep == 0) - box->opt(); - -#ifndef QT_NO_REGEXP_INTERVAL - yyMayCapture = false; - int alpha = (yyMinRep == 0) ? 0 : yyMinRep - 1; - int beta = (yyMaxRep == InftyRep) ? 0 : yyMaxRep - (alpha + 1); - - Box rightBox(this); - int i; - - for (i = 0; i < beta; i++) { - YYREDO(); - Box leftBox(this); - parseAtom(&leftBox); - leftBox.cat(rightBox); - leftBox.opt(); - rightBox = leftBox; - } - for (i = 0; i < alpha; i++) { - YYREDO(); - Box leftBox(this); - parseAtom(&leftBox); - leftBox.cat(rightBox); - rightBox = leftBox; - } - rightBox.cat(*box); - *box = rightBox; -#endif - yyTok = getToken(); -#ifndef QT_NO_REGEXP_INTERVAL - yyMayCapture = mayCapture; -#endif - } -#undef YYREDO -#ifndef QT_NO_REGEXP_CAPTURE - if (greedyQuantifiers) - finishAtom(outerAtom, hasQuantifier); -#endif -} - -void EQRegExpEngine::parseTerm(Box *box) -{ -#ifndef QT_NO_REGEXP_OPTIM - if (yyTok != Tok_Eos && yyTok != Tok_RightParen && yyTok != Tok_Bar) - parseFactor(box); -#endif - while (yyTok != Tok_Eos && yyTok != Tok_RightParen && yyTok != Tok_Bar) { - Box rightBox(this); - parseFactor(&rightBox); - box->cat(rightBox); - } -} - -void EQRegExpEngine::parseExpression(Box *box) -{ - parseTerm(box); - while (yyTok == Tok_Bar) { -#ifndef QT_NO_REGEXP_OPTIM - trivial = false; -#endif - Box rightBox(this); - yyTok = getToken(); - parseTerm(&rightBox); - box->orx(rightBox); - } -} - -/* - The struct EQRegExpPrivate contains the private data of a regular - expression other than the automaton. It makes it possible for many - EQRegExp objects to use the same EQRegExpEngine object with different - EQRegExpPrivate objects. -*/ -struct EQRegExpPrivate -{ - EQRegExpEngine *eng; - EQRegExpEngineKey engineKey; - bool min; -#ifndef QT_NO_REGEXP_CAPTURE - QString t; // last string passed to EQRegExp::indexIn() or lastIndexIn() - QStringList capturedCache; // what EQRegExp::capturedTexts() returned last -#endif - EQRegExpMatchState matchState; - - inline EQRegExpPrivate() - : eng(0), engineKey(QString(), EQRegExp::RegExp, Qt::CaseSensitive), min(false) {} - inline EQRegExpPrivate(const EQRegExpEngineKey &key) - : eng(0), engineKey(key), min(false) {} -}; - -#if !defined(QT_NO_REGEXP_OPTIM) -uint qHash(const EQRegExpEngineKey &key) -{ - return qHash(key.pattern); -} - -typedef QCache<EQRegExpEngineKey, EQRegExpEngine> EngineCache; -Q_GLOBAL_STATIC(EngineCache, globalEngineCache) -Q_GLOBAL_STATIC(QMutex, mutex) -#endif // QT_NO_REGEXP_OPTIM - -static void derefEngine(EQRegExpEngine *eng, const EQRegExpEngineKey &key) -{ -#if !defined(QT_NO_REGEXP_OPTIM) - QMutexLocker locker(mutex()); -#endif // QT_NO_REGEXP_OPTIM - - if (!--eng->ref) { -#if !defined(QT_NO_REGEXP_OPTIM) - if (globalEngineCache()) - globalEngineCache()->insert(key, eng, 4 + key.pattern.length() / 4); - else - delete eng; -#else - Q_UNUSED(key); - delete eng; -#endif - } -} - -static void prepareEngine_helper(EQRegExpPrivate *priv) -{ - bool initMatchState; - - { -#if !defined(QT_NO_REGEXP_OPTIM) - // the mutex protects both the globalEngineCache() and the priv->eng pointer - QMutexLocker locker(mutex()); -#endif - - initMatchState = !priv->eng; - -#if !defined(QT_NO_REGEXP_OPTIM) - if (!priv->eng) { - priv->eng = globalEngineCache()->take(priv->engineKey); - if (priv->eng != 0) - ++priv->eng->ref; - } -#endif // QT_NO_REGEXP_OPTIM - - if (!priv->eng) - priv->eng = new EQRegExpEngine(priv->engineKey); - } - - if (initMatchState) - priv->matchState.captured.fill(-1, 2 + 2 * priv->eng->numCaptures()); -} - -inline static void prepareEngine(EQRegExpPrivate *priv) -{ - if (priv->eng) - return; - prepareEngine_helper(priv); -} - -static void prepareEngineForMatch(EQRegExpPrivate *priv, const QString &str) -{ - prepareEngine(priv); - priv->matchState.prepareForMatch(priv->eng); -#ifndef QT_NO_REGEXP_CAPTURE - priv->t = str; - priv->capturedCache.clear(); -#else - Q_UNUSED(str); -#endif -} - -static void invalidateEngine(EQRegExpPrivate *priv) -{ - if (priv->eng != 0) { - derefEngine(priv->eng, priv->engineKey); - priv->eng = 0; - priv->matchState.drain(); - } -} - -/*! - \enum EQRegExp::CaretMode - - The CaretMode enum defines the different meanings of the caret - (\bold{^}) in a regular expression. The possible values are: - - \value CaretAtZero - The caret corresponds to index 0 in the searched string. - - \value CaretAtOffset - The caret corresponds to the start offset of the search. - - \value CaretWontMatch - The caret never matches. -*/ - -/*! - \enum EQRegExp::PatternSyntax - - The syntax used to interpret the meaning of the pattern. - - \value RegExp A rich Perl-like pattern matching syntax. This is - the default. - - \value RegExp2 Like RegExp, but with \l{greedy quantifiers}. This - will be the default in Qt 5. (Introduced in Qt 4.2.) - - \value Wildcard This provides a simple pattern matching syntax - similar to that used by shells (command interpreters) for "file - globbing". See \l{Wildcard Matching}. - - \value FixedString The pattern is a fixed string. This is - equivalent to using the RegExp pattern on a string in - which all metacharacters are escaped using escape(). - - \sa setPatternSyntax() -*/ - -/*! - Constructs an empty regexp. - - \sa isValid(), errorString() -*/ -EQRegExp::EQRegExp() -{ - priv = new EQRegExpPrivate; -} - -/*! - Constructs a regular expression object for the given \a pattern - string. The pattern must be given using wildcard notation if \a - syntax is \l Wildcard; the default is \l RegExp. The pattern is - case sensitive, unless \a cs is Qt::CaseInsensitive. Matching is - greedy (maximal), but can be changed by calling - setMinimal(). - - \sa setPattern(), setCaseSensitivity(), setPatternSyntax() -*/ -EQRegExp::EQRegExp(const QString &pattern, Qt::CaseSensitivity cs, PatternSyntax syntax) -{ - priv = new EQRegExpPrivate(EQRegExpEngineKey(pattern, syntax, cs)); -} - -/*! - Constructs a regular expression as a copy of \a rx. - - \sa operator=() -*/ -EQRegExp::EQRegExp(const EQRegExp &rx) -{ - priv = new EQRegExpPrivate; - operator=(rx); -} - -/*! - Destroys the regular expression and cleans up its internal data. -*/ -EQRegExp::~EQRegExp() -{ - invalidateEngine(priv); - delete priv; -} - -/*! - Copies the regular expression \a rx and returns a reference to the - copy. The case sensitivity, wildcard, and minimal matching options - are also copied. -*/ -EQRegExp &EQRegExp::operator=(const EQRegExp &rx) -{ - prepareEngine(rx.priv); // to allow sharing - EQRegExpEngine *otherEng = rx.priv->eng; - if (otherEng) - ++otherEng->ref; - invalidateEngine(priv); - priv->eng = otherEng; - priv->engineKey = rx.priv->engineKey; - priv->min = rx.priv->min; -#ifndef QT_NO_REGEXP_CAPTURE - priv->t = rx.priv->t; - priv->capturedCache = rx.priv->capturedCache; -#endif - if (priv->eng) - priv->matchState.prepareForMatch(priv->eng); - priv->matchState.captured = rx.priv->matchState.captured; - return *this; -} - -/*! - Returns true if this regular expression is equal to \a rx; - otherwise returns false. - - Two EQRegExp objects are equal if they have the same pattern - strings and the same settings for case sensitivity, wildcard and - minimal matching. -*/ -bool EQRegExp::operator==(const EQRegExp &rx) const -{ - return priv->engineKey == rx.priv->engineKey && priv->min == rx.priv->min; -} - -/*! - \fn bool EQRegExp::operator!=(const EQRegExp &rx) const - - Returns true if this regular expression is not equal to \a rx; - otherwise returns false. - - \sa operator==() -*/ - -/*! - Returns true if the pattern string is empty; otherwise returns - false. - - If you call exactMatch() with an empty pattern on an empty string - it will return true; otherwise it returns false since it operates - over the whole string. If you call indexIn() with an empty pattern - on \e any string it will return the start offset (0 by default) - because the empty pattern matches the 'emptiness' at the start of - the string. In this case the length of the match returned by - matchedLength() will be 0. - - See QString::isEmpty(). -*/ - -bool EQRegExp::isEmpty() const -{ - return priv->engineKey.pattern.isEmpty(); -} - -/*! - Returns true if the regular expression is valid; otherwise returns - false. An invalid regular expression never matches. - - The pattern \bold{[a-z} is an example of an invalid pattern, since - it lacks a closing square bracket. - - Note that the validity of a regexp may also depend on the setting - of the wildcard flag, for example \bold{*.html} is a valid - wildcard regexp but an invalid full regexp. - - \sa errorString() -*/ -bool EQRegExp::isValid() const -{ - if (priv->engineKey.pattern.isEmpty()) { - return true; - } else { - prepareEngine(priv); - return priv->eng->isValid(); - } -} - -/*! - Returns the pattern string of the regular expression. The pattern - has either regular expression syntax or wildcard syntax, depending - on patternSyntax(). - - \sa patternSyntax(), caseSensitivity() -*/ -QString EQRegExp::pattern() const -{ - return priv->engineKey.pattern; -} - -/*! - Sets the pattern string to \a pattern. The case sensitivity, - wildcard, and minimal matching options are not changed. - - \sa setPatternSyntax(), setCaseSensitivity() -*/ -void EQRegExp::setPattern(const QString &pattern) -{ - if (priv->engineKey.pattern != pattern) { - invalidateEngine(priv); - priv->engineKey.pattern = pattern; - } -} - -/*! - Returns Qt::CaseSensitive if the regexp is matched case - sensitively; otherwise returns Qt::CaseInsensitive. - - \sa patternSyntax(), pattern(), isMinimal() -*/ -Qt::CaseSensitivity EQRegExp::caseSensitivity() const -{ - return priv->engineKey.cs; -} - -/*! - Sets case sensitive matching to \a cs. - - If \a cs is Qt::CaseSensitive, \bold{\\.txt$} matches - \c{readme.txt} but not \c{README.TXT}. - - \sa setPatternSyntax(), setPattern(), setMinimal() -*/ -void EQRegExp::setCaseSensitivity(Qt::CaseSensitivity cs) -{ - if ((bool)cs != (bool)priv->engineKey.cs) { - invalidateEngine(priv); - priv->engineKey.cs = cs; - } -} - -/*! - Returns the syntax used by the regular expression. The default is - EQRegExp::RegExp. - - \sa pattern(), caseSensitivity() -*/ -EQRegExp::PatternSyntax EQRegExp::patternSyntax() const -{ - return priv->engineKey.patternSyntax; -} - -/*! - Sets the syntax mode for the regular expression. The default is - EQRegExp::RegExp. - - Setting \a syntax to EQRegExp::Wildcard enables simple shell-like - \l{wildcard matching}. For example, \bold{r*.txt} matches the - string \c{readme.txt} in wildcard mode, but does not match - \c{readme}. - - Setting \a syntax to EQRegExp::FixedString means that the pattern - is interpreted as a plain string. Special characters (e.g., - backslash) don't need to be escaped then. - - \sa setPattern(), setCaseSensitivity(), escape() -*/ -void EQRegExp::setPatternSyntax(PatternSyntax syntax) -{ - if (syntax != priv->engineKey.patternSyntax) { - invalidateEngine(priv); - priv->engineKey.patternSyntax = syntax; - } -} - -/*! - Returns true if minimal (non-greedy) matching is enabled; - otherwise returns false. - - \sa caseSensitivity() -*/ -bool EQRegExp::isMinimal() const -{ - return priv->min; -} - -/*! - Enables or disables minimal matching. If \a minimal is false, - matching is greedy (maximal) which is the default. - - For example, suppose we have the input string "We must be - <b>bold</b>, very <b>bold</b>!" and the pattern - \bold{<b>.*</b>}. With the default greedy (maximal) matching, - the match is "We must be \underline{<b>bold</b>, very - <b>bold</b>}!". But with minimal (non-greedy) matching, the - first match is: "We must be \underline{<b>bold</b>}, very - <b>bold</b>!" and the second match is "We must be <b>bold</b>, - very \underline{<b>bold</b>}!". In practice we might use the pattern - \bold{<b>[^<]*\</b>} instead, although this will still fail for - nested tags. - - \sa setCaseSensitivity() -*/ -void EQRegExp::setMinimal(bool minimal) -{ - priv->min = minimal; -} - -/*! - Returns true if \a str is matched exactly by this regular - expression; otherwise returns false. You can determine how much of - the string was matched by calling matchedLength(). - - For a given regexp string R, exactMatch("R") is the equivalent of - indexIn("^R$") since exactMatch() effectively encloses the regexp - in the start of string and end of string anchors, except that it - sets matchedLength() differently. - - For example, if the regular expression is \bold{blue}, then - exactMatch() returns true only for input \c blue. For inputs \c - bluebell, \c blutak and \c lightblue, exactMatch() returns false - and matchedLength() will return 4, 3 and 0 respectively. - - Although const, this function sets matchedLength(), - capturedTexts(), and pos(). - - \sa indexIn(), lastIndexIn() -*/ -bool EQRegExp::exactMatch(const QString &str) const -{ - prepareEngineForMatch(priv, str); - priv->matchState.match(str, 0, priv->min, true, 0); - if (priv->matchState.captured.at(1) == str.length()) { - return true; - } else { - priv->matchState.captured[0] = 0; - priv->matchState.captured[1] = priv->matchState.oneTestMatchedLen; - return false; - } -} - -/*! - Attempts to find a match in \a str from position \a offset (0 by - default). If \a offset is -1, the search starts at the last - character; if -2, at the next to last character; etc. - - Returns the position of the first match, or -1 if there was no - match. - - The \a caretMode parameter can be used to instruct whether \bold{^} - should match at index 0 or at \a offset. - - You might prefer to use QString::indexOf(), QString::contains(), - or even QStringList::filter(). To replace matches use - QString::replace(). - - Example: - \code - QString str = "offsets: 1.23 .50 71.00 6.00"; - EQRegExp rx("\\d*\\.\\d+"); // primitive floating point matching - int count = 0; - int pos = 0; - while ((pos = rx.indexIn(str, pos)) != -1) { - ++count; - pos += rx.matchedLength(); - } - // pos will be 9, 14, 18 and finally 24; count will end up as 4 - \endcode - - Although const, this function sets matchedLength(), - capturedTexts() and pos(). - - If the EQRegExp is a wildcard expression (see setPatternSyntax()) - and want to test a string against the whole wildcard expression, - use exactMatch() instead of this function. - - \sa lastIndexIn(), exactMatch() -*/ - -int EQRegExp::indexIn(const QString &str, int offset, CaretMode caretMode) const -{ - prepareEngineForMatch(priv, str); - if (offset < 0) - offset += str.length(); - priv->matchState.match(str, offset, priv->min, false, caretIndex(offset, caretMode)); - return priv->matchState.captured.at(0); -} - -/*! - Attempts to find a match backwards in \a str from position \a - offset. If \a offset is -1 (the default), the search starts at the - last character; if -2, at the next to last character; etc. - - Returns the position of the first match, or -1 if there was no - match. - - The \a caretMode parameter can be used to instruct whether \bold{^} - should match at index 0 or at \a offset. - - Although const, this function sets matchedLength(), - capturedTexts() and pos(). - - \warning Searching backwards is much slower than searching - forwards. - - \sa indexIn(), exactMatch() -*/ - -int EQRegExp::lastIndexIn(const QString &str, int offset, CaretMode caretMode) const -{ - prepareEngineForMatch(priv, str); - if (offset < 0) - offset += str.length(); - if (offset < 0 || offset > str.length()) { - priv->matchState.captured.fill(-1); - return -1; - } - - while (offset >= 0) { - priv->matchState.match(str, offset, priv->min, true, caretIndex(offset, caretMode)); - if (priv->matchState.captured.at(0) == offset) - return offset; - --offset; - } - return -1; -} - -/*! - Returns the length of the last matched string, or -1 if there was - no match. - - \sa exactMatch(), indexIn(), lastIndexIn() -*/ -int EQRegExp::matchedLength() const -{ - return priv->matchState.captured.at(1); -} - -#ifndef QT_NO_REGEXP_CAPTURE -/*! - Returns the number of captures contained in the regular expression. - */ -int EQRegExp::numCaptures() const -{ - prepareEngine(priv); - return priv->eng->numCaptures(); -} - -/*! - Returns a list of the captured text strings. - - The first string in the list is the entire matched string. Each - subsequent list element contains a string that matched a - (capturing) subexpression of the regexp. - - For example: - \code - EQRegExp rx("(\\d+)(\\s*)(cm|inch(es)?)"); - int pos = rx.indexIn("Length: 36 inches"); - QStringList list = rx.capturedTexts(); - // list is now ("36 inches", "36", " ", "inches", "es") - \endcode - - The above example also captures elements that may be present but - which we have no interest in. This problem can be solved by using - non-capturing parentheses: - - \code - EQRegExp rx("(\\d+)(?:\\s*)(cm|inch(?:es)?)"); - int pos = rx.indexIn("Length: 36 inches"); - QStringList list = rx.capturedTexts(); - // list is now ("36 inches", "36", "inches") - \endcode - - Note that if you want to iterate over the list, you should iterate - over a copy, e.g. - \code - QStringList list = rx.capturedTexts(); - QStringList::iterator it = list.begin(); - while (it != list.end()) { - myProcessing(*it); - ++it; - } - \endcode - - Some regexps can match an indeterminate number of times. For - example if the input string is "Offsets: 12 14 99 231 7" and the - regexp, \c{rx}, is \bold{(\\d+)+}, we would hope to get a list of - all the numbers matched. However, after calling - \c{rx.indexIn(str)}, capturedTexts() will return the list ("12", - "12"), i.e. the entire match was "12" and the first subexpression - matched was "12". The correct approach is to use cap() in a - \l{EQRegExp#cap_in_a_loop}{loop}. - - The order of elements in the string list is as follows. The first - element is the entire matching string. Each subsequent element - corresponds to the next capturing open left parentheses. Thus - capturedTexts()[1] is the text of the first capturing parentheses, - capturedTexts()[2] is the text of the second and so on - (corresponding to $1, $2, etc., in some other regexp languages). - - \sa cap(), pos() -*/ -QStringList EQRegExp::capturedTexts() -{ - if (priv->capturedCache.isEmpty()) { - prepareEngine(priv); - const QVector<int> &captured = priv->matchState.captured; - int n = captured.size(); - - for (int i = 0; i < n; i += 2) { - QString m; - if (captured.at(i + 1) == 0) - m = QLatin1String(""); // ### Qt 5: don't distinguish between null and empty - else if (captured.at(i) >= 0) - m = priv->t.mid(captured.at(i), captured.at(i + 1)); - priv->capturedCache.append(m); - } - priv->t.clear(); - } - return priv->capturedCache; -} - -/*! - Returns the text captured by the \a nth subexpression. The entire - match has index 0 and the parenthesized subexpressions have - indexes starting from 1 (excluding non-capturing parentheses). - - \code - EQRegExp rxlen("(\\d+)(?:\\s*)(cm|inch)"); - int pos = rxlen.indexIn("Length: 189cm"); - if (pos > -1) { - QString value = rxlen.cap(1); // "189" - QString unit = rxlen.cap(2); // "cm" - // ... - } - \endcode - - The order of elements matched by cap() is as follows. The first - element, cap(0), is the entire matching string. Each subsequent - element corresponds to the next capturing open left parentheses. - Thus cap(1) is the text of the first capturing parentheses, cap(2) - is the text of the second, and so on. - - \sa capturedTexts(), pos() -*/ -QString EQRegExp::cap(int nth) -{ - return capturedTexts().value(nth); -} - -/*! - Returns the position of the \a nth captured text in the searched - string. If \a nth is 0 (the default), pos() returns the position - of the whole match. - - Example: - \code - EQRegExp rx("/([a-z]+)/([a-z]+)"); - rx.indexIn("Output /dev/null"); // returns 7 (position of /dev/null) - rx.pos(0); // returns 7 (position of /dev/null) - rx.pos(1); // returns 8 (position of dev) - rx.pos(2); // returns 12 (position of null) - \endcode - - For zero-length matches, pos() always returns -1. (For example, if - cap(4) would return an empty string, pos(4) returns -1.) This is - a feature of the implementation. - - \sa cap(), capturedTexts() -*/ -int EQRegExp::pos(int nth) -{ - if (nth < 0 || nth >= priv->matchState.captured.size() / 2) - return -1; - else - return priv->matchState.captured.at(2 * nth); -} - -/*! - Returns a text string that explains why a regexp pattern is - invalid the case being; otherwise returns "no error occurred". - - \sa isValid() -*/ -QString EQRegExp::errorString() -{ - if (isValid()) { - return QString::fromLatin1(RXERR_OK); - } else { - return priv->eng->errorString(); - } -} -#endif - -/*! - Returns the string \a str with every regexp special character - escaped with a backslash. The special characters are $, (,), *, +, - ., ?, [, \,], ^, {, | and }. - - Example: - - \code - s1 = EQRegExp::escape("bingo"); // s1 == "bingo" - s2 = EQRegExp::escape("f(x)"); // s2 == "f\\(x\\)" - \endcode - - This function is useful to construct regexp patterns dynamically: - - \code - EQRegExp rx("(" + EQRegExp::escape(name) + - "|" + EQRegExp::escape(alias) + ")"); - \endcode - - \sa setPatternSyntax() -*/ -QString EQRegExp::escape(const QString &str) -{ - static const char meta[] = "$()*+.?[\\]^{|}"; - QString quoted = str; - int i = 0; - - while (i < quoted.length()) { - if (strchr(meta, quoted.at(i).toLatin1()) != 0) - quoted.insert(i++, QLatin1Char('\\')); - ++i; - } - return quoted; -} - -/*! - \fn bool EQRegExp::caseSensitive() const - - Use \l caseSensitivity() instead. -*/ - -/*! - \fn void EQRegExp::setCaseSensitive(bool sensitive) - - Use \l setCaseSensitivity() instead. -*/ - -/*! - \fn bool EQRegExp::wildcard() const - - Use \l patternSyntax() instead. - - \oldcode - bool wc = rx.wildcard(); - \newcode - bool wc = (rx.patternSyntax() == EQRegExp::Wildcard); - \endcode -*/ - -/*! - \fn void EQRegExp::setWildcard(bool wildcard) - - Use \l setPatternSyntax() instead. - - \oldcode - rx.setWildcard(wc); - \newcode - rx.setPatternSyntax(wc ? EQRegExp::Wildcard : EQRegExp::RegExp); - \endcode -*/ - -/*! - \fn bool EQRegExp::minimal() const - - Use \l isMinimal() instead. -*/ - -/*! - \fn int EQRegExp::search(const QString &str, int from = 0, - CaretMode caretMode = CaretAtZero) const - - Use \l indexIn() instead. -*/ - -/*! - \fn int EQRegExp::searchRev(const QString &str, int from = -1, \ - CaretMode caretMode = CaretAtZero) const - - Use \l lastIndexIn() instead. -*/ - -/*! - \fn EQRegExp::EQRegExp(const QString &pattern, bool cs, bool wildcard = false) - - Use another constructor instead. - - \oldcode - EQRegExp rx("*.txt", false, true); - \newcode - EQRegExp rx("*.txt", Qt::CaseInsensitive, EQRegExp::Wildcard); - \endcode -*/ - -#ifndef QT_NO_DATASTREAM -/*! - \relates EQRegExp - - Writes the regular expression \a regExp to stream \a out. - - \sa {Format of the QDataStream Operators} -*/ -QDataStream &operator<<(QDataStream &out, const EQRegExp ®Exp) -{ - return out << regExp.pattern() << (quint8)regExp.caseSensitivity() - << (quint8)regExp.patternSyntax() - << (quint8)!!regExp.isMinimal(); -} - -/*! - \relates EQRegExp - - Reads a regular expression from stream \a in into \a regExp. - - \sa {Format of the QDataStream Operators} -*/ -QDataStream &operator>>(QDataStream &in, EQRegExp ®Exp) -{ - QString pattern; - quint8 cs; - quint8 patternSyntax; - quint8 isMinimal; - - in >> pattern >> cs >> patternSyntax >> isMinimal; - - EQRegExp newRegExp(pattern, Qt::CaseSensitivity(cs), - EQRegExp::PatternSyntax(patternSyntax)); - - newRegExp.setMinimal(isMinimal); - regExp = newRegExp; - return in; -} -#endif diff -Nru cb2bib-1.4.9/src/c2b/qtregexp/eqregexp.h cb2bib-1.9.2/src/c2b/qtregexp/eqregexp.h --- cb2bib-1.4.9/src/c2b/qtregexp/eqregexp.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/qtregexp/eqregexp.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,168 +0,0 @@ -/*************************************************************************** - * Modified QRegExp - * constans@molspaces.com, 2009 - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. - * - *************************************************************************** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** This file may be used under the terms of the GNU General Public -** License versions 2.0 or 3.0 as published by the Free Software -** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Alternatively you may (at -** your option) use any later version of the GNU General Public -** License if such license has been publicly approved by Trolltech ASA -** (or its successors, if any) and the KDE Free Qt Foundation. In -** addition, as a special exception, Trolltech gives you certain -** additional rights. These rights are described in the Trolltech GPL -** Exception version 1.2, which can be found at -** http://www.trolltech.com/products/qt/gplexception/ and in the file -** GPL_EXCEPTION.txt in this package. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. If -** you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** In addition, as a special exception, Trolltech, as the sole -** copyright holder for Qt Designer, grants users of the Qt/Eclipse -** Integration plug-in the right for the Qt/Eclipse Integration to -** link to functionality provided by Qt Designer and its related -** libraries. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not expressly -** granted herein. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -****************************************************************************/ - -#ifndef EQREGEXP_H -#define EQREGEXP_H - -#ifndef QT_NO_REGEXP - -#include <QtCore/qstring.h> -#ifdef QT3_SUPPORT -#include <new> -#endif - - -struct EQRegExpPrivate; -class QStringList; - -class EQRegExp -{ -public: - enum PatternSyntax { RegExp, Wildcard, FixedString, RegExp2 }; - enum CaretMode { CaretAtZero, CaretAtOffset, CaretWontMatch }; - - EQRegExp(); - explicit EQRegExp(const QString& pattern, Qt::CaseSensitivity cs = Qt::CaseSensitive, - PatternSyntax syntax = RegExp); - EQRegExp(const EQRegExp& rx); - ~EQRegExp(); - EQRegExp& operator=(const EQRegExp& rx); - - bool operator==(const EQRegExp& rx) const; - inline bool operator!=(const EQRegExp& rx) const - { - return !operator==(rx); - } - - bool isEmpty() const; - bool isValid() const; - QString pattern() const; - void setPattern(const QString& pattern); - Qt::CaseSensitivity caseSensitivity() const; - void setCaseSensitivity(Qt::CaseSensitivity cs); -#ifdef QT3_SUPPORT - inline QT3_SUPPORT bool caseSensitive() const - { - return caseSensitivity() == Qt::CaseSensitive; - } - inline QT3_SUPPORT void setCaseSensitive(bool sensitive) - { - setCaseSensitivity(sensitive ? Qt::CaseSensitive : Qt::CaseInsensitive); - } -#endif - PatternSyntax patternSyntax() const; - void setPatternSyntax(PatternSyntax syntax); -#ifdef QT3_SUPPORT - inline QT3_SUPPORT bool wildcard() const - { - return patternSyntax() == Wildcard; - } - inline QT3_SUPPORT void setWildcard(bool wildcard) - { - setPatternSyntax(wildcard ? Wildcard : RegExp); - } -#endif - - bool isMinimal() const; - void setMinimal(bool minimal); -#ifdef QT3_SUPPORT - inline QT3_SUPPORT bool minimal() const - { - return isMinimal(); - } -#endif - - bool exactMatch(const QString& str) const; - - int indexIn(const QString& str, int offset = 0, CaretMode caretMode = CaretAtZero) const; - int lastIndexIn(const QString& str, int offset = -1, CaretMode caretMode = CaretAtZero) const; -#ifdef QT3_SUPPORT - inline QT3_SUPPORT int search(const QString& str, int from = 0, - CaretMode caretMode = CaretAtZero) const - { - return indexIn(str, from, caretMode); - } - inline QT3_SUPPORT int searchRev(const QString& str, int from = -1, - CaretMode caretMode = CaretAtZero) const - { - return lastIndexIn(str, from, caretMode); - } -#endif - int matchedLength() const; -#ifndef QT_NO_REGEXP_CAPTURE - int numCaptures() const; - QStringList capturedTexts(); - QString cap(int nth = 0); - int pos(int nth = 0); - QString errorString(); -#endif - - static QString escape(const QString& str); - -#ifdef QT3_SUPPORT - inline QT3_SUPPORT_CONSTRUCTOR EQRegExp(const QString& pattern, bool cs, bool wildcard = false) - { - new(this) - EQRegExp(pattern, cs ? Qt::CaseSensitive : Qt::CaseInsensitive, - wildcard ? Wildcard : RegExp); - } -#endif - -private: - EQRegExpPrivate* priv; -}; - -Q_DECLARE_TYPEINFO(EQRegExp, Q_MOVABLE_TYPE); - -#ifndef QT_NO_DATASTREAM -QDataStream& operator<<(QDataStream& out, const EQRegExp& regExp); -QDataStream& operator>>(QDataStream& in, EQRegExp& regExp); -#endif - -#endif // QT_NO_REGEXP - -#endif // QREGEXP_H diff -Nru cb2bib-1.4.9/src/c2b/searchPattern.cpp cb2bib-1.9.2/src/c2b/searchPattern.cpp --- cb2bib-1.4.9/src/c2b/searchPattern.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/searchPattern.cpp 2015-08-09 19:58:26.346735175 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "searchPattern.h" diff -Nru cb2bib-1.4.9/src/c2b/searchPattern.h cb2bib-1.9.2/src/c2b/searchPattern.h --- cb2bib-1.4.9/src/c2b/searchPattern.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/searchPattern.h 2015-08-09 19:58:26.402734613 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef SEARCHPATTERN_H diff -Nru cb2bib-1.4.9/src/c2b/settings.cpp cb2bib-1.9.2/src/c2b/settings.cpp --- cb2bib-1.4.9/src/c2b/settings.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/settings.cpp 2015-08-09 19:58:26.347735165 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "settings.h" @@ -9,7 +9,6 @@ #include <QCoreApplication> #include <QDir> -#include <QFSFileEngine> /** @@ -50,7 +49,6 @@ if (_is_usb_configured_mode) { _c2bAppDir = QDir(_c2bApp->applicationDirPath()); - QFSFileEngine::setCurrentPath(_c2bApp->applicationDirPath()); _tmp_dir_path = _c2bApp->applicationDirPath(); } else @@ -110,7 +108,7 @@ defaults["cb2Bib/CacheDirectory"] = QDir::cleanPath(QDir::homePath() + dsep + "PdfDocuments" + dsep + "c2b.tmp"); defaults["cb2Bib/PdfDirectory"] = QDir::cleanPath(QDir::homePath() + dsep + "PdfDocuments"); -#ifdef Q_WS_X11 +#ifdef Q_OS_UNIX defaults["c2bAnnote/AnnoteCssFile"] = QDir::cleanPath(C2B_DATA_DIR + dsep + "data/tex2html.css"); defaults["c2bBibSearcher/Pdf2TextBin"] = QDir::cleanPath(C2B_BIBSEARCHER_PDF2TXT_BIN); defaults["c2bPdfImport/LastFile"] = QDir::cleanPath(C2B_DATA_DIR + dsep + "testPDFImport/nomeaning1.pdf"); @@ -124,7 +122,7 @@ defaults["cb2Bib/PreparserBin"] = QDir::cleanPath(C2B_DATA_DIR + dsep + "c2btools/ris2bib"); defaults["cb2Bib/RegularExpressionFile"] = QDir::cleanPath(C2B_DATA_DIR + dsep + "data/regexps.txt"); #endif -#ifdef Q_WS_MACX +#ifdef Q_OS_MACX QString C2B_DATA_DIR_MAC(C2B_DATA_DIR); if (QDir(C2B_DATA_DIR + "/data/").exists()) C2B_DATA_DIR_MAC = QDir::cleanPath(C2B_DATA_DIR + '/'); @@ -143,12 +141,12 @@ defaults["cb2Bib/PreparserBin"] = QDir::cleanPath(C2B_DATA_DIR_MAC + "/c2btools/ris2bib"); defaults["cb2Bib/RegularExpressionFile"] = QDir::cleanPath(C2B_DATA_DIR_MAC + "/data/regexps.txt"); #endif -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN const QString C2B_APP_DIR(_c2bApp->applicationDirPath() + dsep); defaults["c2bAnnote/AnnoteCssFile"] = C2B_APP_DIR + "data\\tex2html.css"; - defaults["c2bBibSearcher/Pdf2TextBin"] = C2B_APP_DIR + "externtools\\xpdf\\pdftotext.exe"; + defaults["c2bBibSearcher/Pdf2TextBin"] = C2B_APP_DIR + "externtools\\xpdf\\pdf2cb.exe"; defaults["c2bPdfImport/LastFile"] = C2B_APP_DIR + "testPDFImport\\nomeaning1.pdf"; - defaults["c2bPdfImport/Pdf2TextBin"] = C2B_APP_DIR + "externtools\\xpdf\\pdftotext.exe"; + defaults["c2bPdfImport/Pdf2TextBin"] = C2B_APP_DIR + "externtools\\xpdf\\pdf2cb.exe"; defaults["cb2Bib/BrowserCssFile"] = C2B_APP_DIR + "data\\references.css"; defaults["cb2Bib/JournalFile"] = C2B_APP_DIR + "data\\abbreviations.txt"; defaults["cb2Bib/NetworkFile"] = C2B_APP_DIR + "data\\netqinf.txt"; @@ -202,8 +200,8 @@ defaults["cb2Bib/UseFullNames"] = false; // Pdf2Text arguments - defaults["c2bBibSearcher/Pdf2TextArg"] = "-raw -enc UTF-8"; - defaults["c2bPdfImport/Pdf2TextArg"] = "-f 1 -l 1 -enc UTF-8"; + defaults["c2bBibSearcher/Pdf2TextArg"] = "-q"; + defaults["c2bPdfImport/Pdf2TextArg"] = "-q -f 1 -l 1"; // Construct current settings const QStringList keys(defaults.keys()); @@ -302,17 +300,19 @@ bool settings::isConfiguredMode() { const QCoreApplication* capp = QCoreApplication::instance(); - if (capp->argc() > 1) + const QStringList argv(capp->arguments()); + const int argc(argv.count()); + if (argc > 1) { - for (int i = 1; i < capp->argc(); i++) - if (QString(capp->argv()[i]) == "--conf") + for (int i = 1; i < argc; ++i) + if (argv.at(i) == "--conf") return true; - for (int i = 1; i < capp->argc(); i++) - if (QString(capp->argv()[i]) == "--configure") + for (int i = 1; i < argc; ++i) + if (argv.at(i) == "--configure") { const int j(i + 1); - if (j < capp->argc()) - if (!QString(capp->argv()[j]).startsWith('-')) + if (j < argc) + if (!argv.at(j).startsWith('-')) return true; return false; } @@ -325,9 +325,10 @@ const QCoreApplication* capp = QCoreApplication::instance(); QStringList arguments(capp->arguments()); arguments.removeAll(QString()); + const int argc(arguments.count()); QString filename; - for (int i = 1; i < capp->argc() - 1; ++i) - if (QString(arguments.at(i)) == "--conf" || QString(arguments.at(i)) == "--configure") + for (int i = 1; i < argc - 1; ++i) + if (arguments.at(i) == "--conf" || arguments.at(i) == "--configure") { const int j(i + 1); if (!arguments.at(j).startsWith('-')) diff -Nru cb2bib-1.4.9/src/c2b/settings.h cb2bib-1.9.2/src/c2b/settings.h --- cb2bib-1.4.9/src/c2b/settings.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/settings.h 2015-08-09 19:58:26.403734603 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef SETTINGS_H @@ -22,7 +22,7 @@ Q_OBJECT public: - settings(QObject* parento = 0); + explicit settings(QObject* parento = 0); virtual ~settings(); // Command line data. (Set public for easiest access. Only settings or derived classes should modify it) diff -Nru cb2bib-1.4.9/src/c2b/substringMatcher.cpp cb2bib-1.9.2/src/c2b/substringMatcher.cpp --- cb2bib-1.4.9/src/c2b/substringMatcher.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/substringMatcher.cpp 2015-08-09 19:58:26.349735145 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "substringMatcher.h" @@ -13,7 +13,8 @@ substringMatcher::substringMatcher() : _hook(-1), _substring_count(0), _matched_length(-1), _p0(0), _pn(0) {} -substringMatcher::substringMatcher(const QString& pattern, const Qt::CaseSensitivity cs) : _hook(-1), _matched_length(-1) +substringMatcher::substringMatcher(const QString& pattern, const Qt::CaseSensitivity cs) : + _hook(-1), _matched_length(-1), _p0(0), _pn(0) { QRegExp sep("\\.\\{(\\d+),(\\d+)\\}"); QStringList substrings(pattern.split(sep, QString::SkipEmptyParts)); @@ -22,7 +23,7 @@ QList<int> stretches; while ((s = sep.indexIn(pattern, s)) != -1) { - Q_ASSERT_X(sep.numCaptures() == 2, "substringMatcher", "Expected two digits in repetition"); + Q_ASSERT_X(sep.captureCount() == 2, "substringMatcher", "Expected two digits in repetition"); Q_ASSERT_X(sep.cap(1).toInt() == 0, "substringMatcher", "Expected zero in first repetition digit"); stretches.append(sep.cap(2).toInt()); s += sep.matchedLength(); diff -Nru cb2bib-1.4.9/src/c2b/substringMatcher.h cb2bib-1.9.2/src/c2b/substringMatcher.h --- cb2bib-1.4.9/src/c2b/substringMatcher.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/substringMatcher.h 2015-08-09 19:58:26.405734583 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef SUBSTRINGMATCHER_H @@ -48,12 +48,7 @@ #else if (p0 >= pn) return -1; -#if QT_VERSION >= 0x040500 return _substrings.at(s).indexIn(str.unicode(), std::min(_pn, pn), p0); -#else - const QString substr(QString::fromRawData(str.unicode(), std::min(_pn, pn))); - return _substrings.at(s).indexIn(substr, p0); -#endif #endif } inline int _p_back(const int s, const int p0) const diff -Nru cb2bib-1.4.9/src/c2b/texParser.cpp cb2bib-1.9.2/src/c2b/texParser.cpp --- cb2bib-1.4.9/src/c2b/texParser.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/texParser.cpp 2015-08-09 19:58:26.350735135 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "texParser.h" diff -Nru cb2bib-1.4.9/src/c2b/texParser.h cb2bib-1.9.2/src/c2b/texParser.h --- cb2bib-1.4.9/src/c2b/texParser.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/texParser.h 2015-08-09 19:58:26.406734573 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef TEXPARSER_H diff -Nru cb2bib-1.4.9/src/c2b/texToHtml.cpp cb2bib-1.9.2/src/c2b/texToHtml.cpp --- cb2bib-1.4.9/src/c2b/texToHtml.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/texToHtml.cpp 2015-08-09 19:58:26.352735115 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "texToHtml.h" diff -Nru cb2bib-1.4.9/src/c2b/texToHtml.h cb2bib-1.9.2/src/c2b/texToHtml.h --- cb2bib-1.4.9/src/c2b/texToHtml.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/texToHtml.h 2015-08-09 19:58:26.408734553 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef TEXTOHTML_H diff -Nru cb2bib-1.4.9/src/c2b/triads.cpp cb2bib-1.9.2/src/c2b/triads.cpp --- cb2bib-1.4.9/src/c2b/triads.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/triads.cpp 2015-08-09 19:58:26.353735105 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "triads.h" diff -Nru cb2bib-1.4.9/src/c2b/triads.h cb2bib-1.9.2/src/c2b/triads.h --- cb2bib-1.4.9/src/c2b/triads.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/triads.h 2015-08-09 19:58:26.410734533 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef TRIADS_H diff -Nru cb2bib-1.4.9/src/c2b/wordMatcher.cpp cb2bib-1.9.2/src/c2b/wordMatcher.cpp --- cb2bib-1.4.9/src/c2b/wordMatcher.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/wordMatcher.cpp 2015-08-09 19:58:26.355735085 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "wordMatcher.h" diff -Nru cb2bib-1.4.9/src/c2b/wordMatcher.h cb2bib-1.9.2/src/c2b/wordMatcher.h --- cb2bib-1.4.9/src/c2b/wordMatcher.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/wordMatcher.h 2015-08-09 19:58:26.411734523 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef WORDMATCHER_H @@ -37,12 +37,7 @@ { if (p0 >= pn) return -1; -#if QT_VERSION >= 0x040500 return _substrings.at(s).indexIn(str.unicode(), std::min(_pn, pn), p0); -#else - const QString substr(QString::fromRawData(str.unicode(), std::min(_pn, pn))); - return _substrings.at(s).indexIn(substr, p0); -#endif } inline int _index_around(const QString& str, const int phook) const { diff -Nru cb2bib-1.4.9/src/c2b/wordPattern.cpp cb2bib-1.9.2/src/c2b/wordPattern.cpp --- cb2bib-1.4.9/src/c2b/wordPattern.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/wordPattern.cpp 2015-08-09 19:58:26.356735075 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "wordPattern.h" diff -Nru cb2bib-1.4.9/src/c2b/wordPattern.h cb2bib-1.9.2/src/c2b/wordPattern.h --- cb2bib-1.4.9/src/c2b/wordPattern.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b/wordPattern.h 2015-08-09 19:58:26.413734503 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef WORDPATTERN_H diff -Nru cb2bib-1.4.9/src/c2bAnnote.cpp cb2bib-1.9.2/src/c2bAnnote.cpp --- cb2bib-1.4.9/src/c2bAnnote.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bAnnote.cpp 2015-08-09 19:58:26.145737194 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bAnnote.h" diff -Nru cb2bib-1.4.9/src/c2bAnnote.h cb2bib-1.9.2/src/c2bAnnote.h --- cb2bib-1.4.9/src/c2bAnnote.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bAnnote.h 2015-08-09 19:58:26.232736320 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BANNOTE_H @@ -21,7 +21,7 @@ Q_OBJECT public: - c2bAnnote(QWidget* parentw = 0); + explicit c2bAnnote(QWidget* parentw = 0); ~c2bAnnote(); bool show(); diff -Nru cb2bib-1.4.9/src/c2bBibHighlighter.cpp cb2bib-1.9.2/src/c2bBibHighlighter.cpp --- cb2bib-1.4.9/src/c2bBibHighlighter.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bBibHighlighter.cpp 2015-08-09 19:58:26.147737174 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bBibHighlighter.h" diff -Nru cb2bib-1.4.9/src/c2bBibHighlighter.h cb2bib-1.9.2/src/c2bBibHighlighter.h --- cb2bib-1.4.9/src/c2bBibHighlighter.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bBibHighlighter.h 2015-08-09 19:58:26.233736310 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BBIBHIGHLIGHTER_H @@ -22,7 +22,7 @@ { public: - c2bBibHighlighter(QTextDocument* doc); + explicit c2bBibHighlighter(QTextDocument* doc); ~c2bBibHighlighter(); diff -Nru cb2bib-1.4.9/src/c2bBibMenu.cpp cb2bib-1.9.2/src/c2bBibMenu.cpp --- cb2bib-1.4.9/src/c2bBibMenu.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bBibMenu.cpp 2015-08-09 19:58:26.148737163 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bBibMenu.h" diff -Nru cb2bib-1.4.9/src/c2bBibMenu.h cb2bib-1.9.2/src/c2bBibMenu.h --- cb2bib-1.4.9/src/c2bBibMenu.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bBibMenu.h 2015-08-09 19:58:26.235736290 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BBIBMENU_H @@ -16,7 +16,7 @@ Q_OBJECT public: - c2bBibMenu(QWidget* parentw = 0); + explicit c2bBibMenu(QWidget* parentw = 0); inline ~c2bBibMenu() {} inline QAction* addAuthorAction() const diff -Nru cb2bib-1.4.9/src/c2bBibParser.cpp cb2bib-1.9.2/src/c2bBibParser.cpp --- cb2bib-1.4.9/src/c2bBibParser.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bBibParser.cpp 2015-08-09 19:58:26.150737143 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bBibParser.h" diff -Nru cb2bib-1.4.9/src/c2bBibParser.h cb2bib-1.9.2/src/c2bBibParser.h --- cb2bib-1.4.9/src/c2bBibParser.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bBibParser.h 2015-08-09 19:58:26.236736280 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BBIBPARSER_H @@ -31,7 +31,7 @@ Q_OBJECT public: - c2bBibParser(QObject* parento = 0); + explicit c2bBibParser(QObject* parento = 0); ~c2bBibParser(); void clearCurrentReference(); diff -Nru cb2bib-1.4.9/src/c2bBibPreparserLog.cpp cb2bib-1.9.2/src/c2bBibPreparserLog.cpp --- cb2bib-1.4.9/src/c2bBibPreparserLog.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bBibPreparserLog.cpp 2015-08-09 19:58:26.151737133 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bBibPreparserLog.h" @@ -21,7 +21,7 @@ PreparserShowLog = new QCheckBox(); PreparserShowLog->setObjectName(QString::fromUtf8("PreparserShowLog")); PreparserShowLog->setLayoutDirection(Qt::RightToLeft); - PreparserShowLog->setText(QApplication::translate("c2bBibPreparserLog", "Do not show log", 0, QApplication::UnicodeUTF8)); + PreparserShowLog->setText(QApplication::translate("c2bBibPreparserLog", "Do not show log", 0)); ui.buttonBox->addButton(PreparserShowLog, QDialogButtonBox::ActionRole); connect(ui.buttonBox, SIGNAL(helpRequested()), this, SLOT(help())); connect(this, SIGNAL(finished(int)), this, SLOT(close())); diff -Nru cb2bib-1.4.9/src/c2bBibPreparserLog.h cb2bib-1.9.2/src/c2bBibPreparserLog.h --- cb2bib-1.4.9/src/c2bBibPreparserLog.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bBibPreparserLog.h 2015-08-09 19:58:26.238736260 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BBIBPREPARSERLOG_H @@ -21,7 +21,7 @@ Q_OBJECT public: - c2bBibPreparserLog(QWidget* parentw = 0); + explicit c2bBibPreparserLog(QWidget* parentw = 0); ~c2bBibPreparserLog(); void append(const QString& ms); diff -Nru cb2bib-1.4.9/src/c2bCiterExcerptView.cpp cb2bib-1.9.2/src/c2bCiterExcerptView.cpp --- cb2bib-1.4.9/src/c2bCiterExcerptView.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bCiterExcerptView.cpp 2015-08-09 19:58:26.153737113 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bCiterExcerptView.h" diff -Nru cb2bib-1.4.9/src/c2bCiterExcerptView.h cb2bib-1.9.2/src/c2bCiterExcerptView.h --- cb2bib-1.4.9/src/c2bCiterExcerptView.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bCiterExcerptView.h 2015-08-09 19:58:26.241736230 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BCITEREXCERPTVIEW_H diff -Nru cb2bib-1.4.9/src/c2bCiter.h cb2bib-1.9.2/src/c2bCiter.h --- cb2bib-1.4.9/src/c2bCiter.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bCiter.h 2015-08-09 19:58:26.240736240 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BCITER_H diff -Nru cb2bib-1.4.9/src/c2bCiterHistory.cpp cb2bib-1.9.2/src/c2bCiterHistory.cpp --- cb2bib-1.4.9/src/c2bCiterHistory.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bCiterHistory.cpp 2015-08-09 19:58:26.154737103 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bCiterHistory.h" diff -Nru cb2bib-1.4.9/src/c2bCiterHistory.h cb2bib-1.9.2/src/c2bCiterHistory.h --- cb2bib-1.4.9/src/c2bCiterHistory.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bCiterHistory.h 2015-08-09 19:58:26.243736210 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BCITERHISTORY_H diff -Nru cb2bib-1.4.9/src/c2bCiterModel.cpp cb2bib-1.9.2/src/c2bCiterModel.cpp --- cb2bib-1.4.9/src/c2bCiterModel.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bCiterModel.cpp 2015-08-09 19:58:26.156737083 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bCiterModel.h" @@ -17,7 +17,7 @@ template <typename T> class ascending { public: - ascending(const T& data) : _data(data) {} + explicit ascending(const T& data) : _data(data) {} inline bool operator()(const int i, const int j) { return _data.at(i) < _data.at(j); @@ -413,7 +413,7 @@ { if (_history.currentState() == -1) _history.saveCurrentState(_format, _filter, _current_item(current_index), current_index, _fstring); - const c2bCiter::State s(_history.previousState()); + const c2bCiter::State& s(_history.previousState()); restoreState(s, 0); if (current_index) *current_index = index(s.viewer_index, 0); @@ -423,7 +423,7 @@ { if (_history.currentState() == -1) return; - const c2bCiter::State s(_history.nextState()); + const c2bCiter::State& s(_history.nextState()); restoreState(s, 0); if (current_index) *current_index = index(s.viewer_index, 0); diff -Nru cb2bib-1.4.9/src/c2bCiterModel.h cb2bib-1.9.2/src/c2bCiterModel.h --- cb2bib-1.4.9/src/c2bCiterModel.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bCiterModel.h 2015-08-09 19:58:26.244736200 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BCITERMODEL_H @@ -25,7 +25,7 @@ Q_OBJECT public: - c2bCiterModel(QObject* parento = 0); + explicit c2bCiterModel(QObject* parento = 0); inline ~c2bCiterModel() {} QList<int> sizeHintForColumns() const; diff -Nru cb2bib-1.4.9/src/c2bCiterView.cpp cb2bib-1.9.2/src/c2bCiterView.cpp --- cb2bib-1.4.9/src/c2bCiterView.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bCiterView.cpp 2015-08-09 19:58:26.158737063 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bCiterView.h" @@ -23,10 +23,10 @@ setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); - horizontalHeader()->setResizeMode(QHeaderView::Fixed); + horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed); horizontalHeader()->setVisible(false); verticalHeader()->setDefaultSectionSize(fontMetrics().height() + 5); - verticalHeader()->setResizeMode(QHeaderView::Fixed); + verticalHeader()->setSectionResizeMode(QHeaderView::Fixed); verticalHeader()->setVisible(false); _citationsP = 0; @@ -34,7 +34,7 @@ } -void c2bCiterView::reloadModel(QAbstractItemModel* citations, const QStringList& bibtex_files, const c2bCiter::State& state) +void c2bCiterView::reloadModel(QAbstractItemModel* citations, const QStringList& bibtex_files, const c2bCiter::State& s) { _filter_mode = false; _filter_string.clear(); @@ -47,7 +47,7 @@ connect(_citationsP, SIGNAL(patternFilterChanged(const QString&)), this, SLOT(updatePatternFilter(const QString&))); } QModelIndex i(currentIndex()); - _citationsP->reloadCitations(bibtex_files, state, &i); + _citationsP->reloadCitations(bibtex_files, s, &i); updateViewport(); updateCurrentIndex(i); } diff -Nru cb2bib-1.4.9/src/c2bCiterView.h cb2bib-1.9.2/src/c2bCiterView.h --- cb2bib-1.4.9/src/c2bCiterView.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bCiterView.h 2015-08-09 19:58:26.246736180 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BCITERVIEW_H @@ -18,11 +18,11 @@ Q_OBJECT public: - c2bCiterView(QWidget* parentw = 0); + explicit c2bCiterView(QWidget* parentw = 0); inline ~c2bCiterView() {} c2bCiter::State currentState() const; - void reloadModel(QAbstractItemModel* citations, const QStringList& bibtex_files, const c2bCiter::State& state); + void reloadModel(QAbstractItemModel* citations, const QStringList& bibtex_files, const c2bCiter::State& s); void setPatternFilter(const QString& pattern); diff -Nru cb2bib-1.4.9/src/c2bCiterWidget.cpp cb2bib-1.9.2/src/c2bCiterWidget.cpp --- cb2bib-1.4.9/src/c2bCiterWidget.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bCiterWidget.cpp 2015-08-09 19:58:26.159737053 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bCiterWidget.h" @@ -19,12 +19,6 @@ #include <QLabel> #include <QMenu> -#ifdef Q_WS_X11 -#include <QX11Info> -#include <X11/Xatom.h> -#include <X11/Xlib.h> -#endif - c2bCiterWidget::c2bCiterWidget(QWidget* parentw) : QWidget(parentw) { @@ -109,9 +103,6 @@ void c2bCiterWidget::show() { -#ifdef Q_WS_X11 - updateUserTimestamp(); -#endif if (isHidden()) QWidget::show(); raise(); @@ -119,27 +110,6 @@ ui.citationsView->setFocus(); } -void c2bCiterWidget::updateUserTimestamp() -{ -#ifdef Q_WS_X11 - // Bypass focus stealing prevention - // Adapted from KDE libraries: - // Copyright (C) 1997 Matthias Kalle Dalheimer (kalle@kde.org) - // Copyright (C) 1998, 1999, 2000 KDE Team - // http://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/kapplication_8cpp_source.html - Window w = XCreateSimpleWindow(QX11Info::display(), QX11Info::appRootWindow(), 0, 0, 1, 1, 0, 0, 0); - XSelectInput(QX11Info::display(), w, PropertyChangeMask); - unsigned char cdata[ 1 ]; - XChangeProperty(QX11Info::display(), w, XA_ATOM, XA_ATOM, 8, PropModeAppend, cdata, 1); - XEvent ev; - XWindowEvent(QX11Info::display(), w, PropertyChangeMask, &ev); - const unsigned long time = ev.xproperty.time; - XDestroyWindow(QX11Info::display(), w); - QX11Info::setAppUserTime(time); - QX11Info::setAppTime(time); -#endif -} - void c2bCiterWidget::setTrayIcon() { _tray_icon = new QSystemTrayIcon(this); @@ -231,9 +201,7 @@ a = new QAction(this); a->setText(tr("Exit")); -#if QT_VERSION >= 0x040600 a->setShortcut(QKeySequence(QKeySequence::Quit)); -#endif addAction(a); connect(a, SIGNAL(triggered()), c2b::instance(), SLOT(exitRequested())); } diff -Nru cb2bib-1.4.9/src/c2bCiterWidget.h cb2bib-1.9.2/src/c2bCiterWidget.h --- cb2bib-1.4.9/src/c2bCiterWidget.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bCiterWidget.h 2015-08-09 19:58:26.247736169 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BCITERWIDGET_H @@ -24,7 +24,7 @@ Q_OBJECT public: - c2bCiterWidget(QWidget* parentw = 0); + explicit c2bCiterWidget(QWidget* parentw = 0); ~c2bCiterWidget(); @@ -53,7 +53,6 @@ c2bSettings* _settingsP; void reload(const c2bCiter::State& state); void setActions(); - void updateUserTimestamp(); private slots: diff -Nru cb2bib-1.4.9/src/c2bClipboard.cpp cb2bib-1.9.2/src/c2bClipboard.cpp --- cb2bib-1.4.9/src/c2bClipboard.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bClipboard.cpp 2015-08-09 19:58:26.161737033 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bClipboard.h" @@ -28,7 +28,7 @@ _poll = new clipboardPoll(); connect(_poll, SIGNAL(clipboardChanged(bool)), this, SLOT(newClipboardData(bool))); #else -#ifdef Q_WS_X11 +#ifdef Q_OS_UNIX _timer = new QTimer(this); connect(_timer, SIGNAL(timeout()), this, SLOT(checkData())); #endif @@ -96,7 +96,7 @@ #ifdef C2B_USE_CBPOLL _poll->startT(_interval); #else -#ifdef Q_WS_X11 +#ifdef Q_OS_UNIX _timer->start(_interval); #endif #endif @@ -106,7 +106,7 @@ #ifdef C2B_USE_CBPOLL _poll->stopT(); #else -#ifdef Q_WS_X11 +#ifdef Q_OS_UNIX _timer->stop(); #endif #endif diff -Nru cb2bib-1.4.9/src/c2bClipboard.h cb2bib-1.9.2/src/c2bClipboard.h --- cb2bib-1.4.9/src/c2bClipboard.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bClipboard.h 2015-08-09 19:58:26.248736159 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BCLIPBOARD_H @@ -29,7 +29,7 @@ { Q_OBJECT public: - c2bClipboard(QObject* parento = 0); + explicit c2bClipboard(QObject* parento = 0); ~c2bClipboard(); const QString text(); @@ -50,7 +50,7 @@ #ifdef C2B_USE_CBPOLL clipboardPoll* _poll; #else -#ifdef Q_WS_X11 +#ifdef Q_OS_UNIX QTimer* _timer; #endif #endif diff -Nru cb2bib-1.4.9/src/c2bClipEdit.cpp cb2bib-1.9.2/src/c2bClipEdit.cpp --- cb2bib-1.4.9/src/c2bClipEdit.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bClipEdit.cpp 2015-08-09 19:58:26.162737023 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bClipEdit.h" diff -Nru cb2bib-1.4.9/src/c2bClipEdit.h cb2bib-1.9.2/src/c2bClipEdit.h --- cb2bib-1.4.9/src/c2bClipEdit.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bClipEdit.h 2015-08-09 19:58:26.250736139 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BCLIPEDIT_H diff -Nru cb2bib-1.4.9/src/c2bCollectionIndex.cpp cb2bib-1.9.2/src/c2bCollectionIndex.cpp --- cb2bib-1.4.9/src/c2bCollectionIndex.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bCollectionIndex.cpp 2015-08-09 19:58:26.163737013 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bCollectionIndex.h" diff -Nru cb2bib-1.4.9/src/c2bCollectionIndex.h cb2bib-1.9.2/src/c2bCollectionIndex.h --- cb2bib-1.4.9/src/c2bCollectionIndex.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bCollectionIndex.h 2015-08-09 19:58:26.251736129 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BCOLLECTIONINDEX_H @@ -19,7 +19,7 @@ Q_OBJECT public: - c2bCollectionIndex(QWidget* parentw = 0); + explicit c2bCollectionIndex(QWidget* parentw = 0); ~c2bCollectionIndex(); void index(); diff -Nru cb2bib-1.4.9/src/c2bColors.cpp cb2bib-1.9.2/src/c2bColors.cpp --- cb2bib-1.4.9/src/c2bColors.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bColors.cpp 2015-08-09 19:58:26.166736983 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bColors.h" diff -Nru cb2bib-1.4.9/src/c2bColors.h cb2bib-1.9.2/src/c2bColors.h --- cb2bib-1.4.9/src/c2bColors.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bColors.h 2015-08-09 19:58:26.252736119 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BCOLORS_H diff -Nru cb2bib-1.4.9/src/c2bComboBox.cpp cb2bib-1.9.2/src/c2bComboBox.cpp --- cb2bib-1.4.9/src/c2bComboBox.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bComboBox.cpp 2015-08-09 19:58:26.167736973 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bComboBox.h" diff -Nru cb2bib-1.4.9/src/c2bComboBox.h cb2bib-1.9.2/src/c2bComboBox.h --- cb2bib-1.4.9/src/c2bComboBox.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bComboBox.h 2015-08-09 19:58:26.254736099 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BCOMBOBOX_H @@ -16,7 +16,7 @@ Q_OBJECT public: - c2bComboBox(QWidget* parentw = 0); + explicit c2bComboBox(QWidget* parentw = 0); ~c2bComboBox(); diff -Nru cb2bib-1.4.9/src/c2bConfigure.cpp cb2bib-1.9.2/src/c2bConfigure.cpp --- cb2bib-1.4.9/src/c2bConfigure.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bConfigure.cpp 2015-08-09 19:58:26.169736953 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bConfigure.h" @@ -142,7 +142,7 @@ this particular syntax requirement. Two examples, <tt>isi2bib</tt> and <tt>ris2bib</tt> are provided. To test them, make sure the \htmlonly - <a href="http://www.scripps.edu/~cdputnam/software/bibutils/bibutils.html" + <a href="http://bibutils.refbase.org/" target="_blank">BibUtils Package</a> \endhtmlonly is available on your machine. Otherwise, modify these scripts according to @@ -352,13 +352,15 @@ files prior to reference extraction and searching. cb2Bib executes the line command <tt>converter [options] inputfile tmp_output.txt</tt>, where <tt>[options]</tt> are user defined arguments. As a default, cb2Bib - launches <tt>pdftotext</tt>, a PDF to text utility found in many platforms. - Default arguments are <tt>-f 1 -l 1</tt> to extract only the first, title - page when used within PDFImport, and <tt>-raw</tt>, to convert the complete - document when used within Search in Files. Appropriate for PDFImport could - also be a document metadata extractor. Often metadata contains structured - information regarding document authors, title, and source. A simple shell - script wrapper could be the following <tt>any2text_search</tt>: + launches <tt>pdf2cb</tt>, a modified PDF to text utility found in the XPDF + package. Modifications are available at xpdf/ directory in the cb2Bib + sources. Default arguments are <tt>-q -f 1 -l 1</tt> to extract only the + first, title page when used within PDFImport, and <tt>-q</tt>, to convert + the complete document when used within Search in Files. Appropriate for + PDFImport could also be a document metadata extractor. Often metadata + contains structured information regarding document authors, title, and + source. A simple shell script wrapper could be the following + <tt>any2text_search</tt>: \verbatim #!/bin/csh @@ -372,7 +374,10 @@ (/usr/local/bin/archmage -c text "$1" "$2") >& /dev/null if ($status) exit 1 else - /usr/bin/pdftotext -raw -enc UTF-8 "$1" "$2" + # If using pdf2cb + /path/to/pdf2cb -q "$1" "$2" + # If using pdftotex + # /usr/bin/pdftotext -enc UTF-8 "$1" "$2" if ($status) exit 1 endif \endverbatim diff -Nru cb2bib-1.4.9/src/c2bConfigureFR.cpp cb2bib-1.9.2/src/c2bConfigureFR.cpp --- cb2bib-1.4.9/src/c2bConfigureFR.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bConfigureFR.cpp 2015-08-09 19:58:26.170736943 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bConfigureFR.h" diff -Nru cb2bib-1.4.9/src/c2bConfigureFR.h cb2bib-1.9.2/src/c2bConfigureFR.h --- cb2bib-1.4.9/src/c2bConfigureFR.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bConfigureFR.h 2015-08-09 19:58:26.256736079 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BCONFIGUREFR_H diff -Nru cb2bib-1.4.9/src/c2bConfigure.h cb2bib-1.9.2/src/c2bConfigure.h --- cb2bib-1.4.9/src/c2bConfigure.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bConfigure.h 2015-08-09 19:58:26.255736089 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BCONFIGURE_H @@ -22,7 +22,7 @@ Q_OBJECT public: - c2bConfigure(QWidget* parentw = 0); + explicit c2bConfigure(QWidget* parentw = 0); ~c2bConfigure(); void setPage(int index); diff -Nru cb2bib-1.4.9/src/c2bConsole.cpp cb2bib-1.9.2/src/c2bConsole.cpp --- cb2bib-1.4.9/src/c2bConsole.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bConsole.cpp 2015-08-09 19:58:26.172736923 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bConsole.h" diff -Nru cb2bib-1.4.9/src/c2bConsole.h cb2bib-1.9.2/src/c2bConsole.h --- cb2bib-1.4.9/src/c2bConsole.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bConsole.h 2015-08-09 19:58:26.258736059 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BCONSOLE_H @@ -19,7 +19,7 @@ Q_OBJECT public: - c2bConsole(QObject* parento = 0); + explicit c2bConsole(QObject* parento = 0); ~c2bConsole(); void load(); diff -Nru cb2bib-1.4.9/src/c2bCoreCiter.cpp cb2bib-1.9.2/src/c2bCoreCiter.cpp --- cb2bib-1.4.9/src/c2bCoreCiter.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bCoreCiter.cpp 2015-08-09 19:58:26.173736913 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. * * The LyX pipe procedure in citeToLyXPipe has been adapted from Tellico diff -Nru cb2bib-1.4.9/src/c2bCoreCiter.h cb2bib-1.9.2/src/c2bCoreCiter.h --- cb2bib-1.4.9/src/c2bCoreCiter.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bCoreCiter.h 2015-08-09 19:58:26.259736049 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BCORECITER_H @@ -20,7 +20,7 @@ Q_OBJECT public: - c2bCoreCiter(QWidget* parentw = 0); + explicit c2bCoreCiter(QWidget* parentw = 0); ~c2bCoreCiter(); void cite(const QStringList& keys) const; diff -Nru cb2bib-1.4.9/src/c2b.cpp cb2bib-1.9.2/src/c2b.cpp --- cb2bib-1.4.9/src/c2b.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b.cpp 2015-08-09 19:58:26.143737214 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2b.h" @@ -36,7 +36,8 @@ this, SLOT(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*))); connect(_c2b_network, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(updateDownloadProgress(qint64, qint64))); _download_progress = new QProgressDialog(_c2b_main); - _download_progress->setWindowTitle("cb2Bib"); + _download_progress->setWindowTitle("Downloading..."); + _download_progress->reset(); connect(_download_progress, SIGNAL(canceled()), _c2b_network, SLOT(cancelDownload())); // Create cb2Bib network query info diff -Nru cb2bib-1.4.9/src/c2bEditor.cpp cb2bib-1.9.2/src/c2bEditor.cpp --- cb2bib-1.4.9/src/c2bEditor.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bEditor.cpp 2015-08-09 19:58:26.175736892 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bEditor.h" @@ -284,10 +284,8 @@ ui.helpEditorAction->setShortcut(QKeySequence(QKeySequence::HelpContents)); ui.viewZoomInAction->setShortcut(QKeySequence(QKeySequence::ZoomIn)); ui.viewZoomOutAction->setShortcut(QKeySequence(QKeySequence::ZoomOut)); -#if QT_VERSION >= 0x040600 ui.fileExitAction->setShortcut(QKeySequence(QKeySequence::Quit)); ui.fileSaveAsAction->setShortcut(QKeySequence(QKeySequence::SaveAs)); -#endif // Editor Settings resize(_settingsP->value("c2bEditor/size", size()).toSize()); diff -Nru cb2bib-1.4.9/src/c2bEditor.h cb2bib-1.9.2/src/c2bEditor.h --- cb2bib-1.4.9/src/c2bEditor.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bEditor.h 2015-08-09 19:58:26.260736039 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BEDITOR_H diff -Nru cb2bib-1.4.9/src/c2bExport.cpp cb2bib-1.9.2/src/c2bExport.cpp --- cb2bib-1.4.9/src/c2bExport.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bExport.cpp 2015-08-09 19:58:26.176736882 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bExport.h" diff -Nru cb2bib-1.4.9/src/c2bExportDialog.cpp cb2bib-1.9.2/src/c2bExportDialog.cpp --- cb2bib-1.4.9/src/c2bExportDialog.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bExportDialog.cpp 2015-08-09 19:58:26.178736862 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bExportDialog.h" diff -Nru cb2bib-1.4.9/src/c2bExportDialog.h cb2bib-1.9.2/src/c2bExportDialog.h --- cb2bib-1.4.9/src/c2bExportDialog.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bExportDialog.h 2015-08-09 19:58:26.263736009 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BEXPORTDIALOG_H diff -Nru cb2bib-1.4.9/src/c2bExport.h cb2bib-1.9.2/src/c2bExport.h --- cb2bib-1.4.9/src/c2bExport.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bExport.h 2015-08-09 19:58:26.262736019 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BEXPORT_H @@ -17,7 +17,7 @@ Q_OBJECT public: - c2bExport(QObject* parento = 0); + explicit c2bExport(QObject* parento = 0); ~c2bExport(); struct export_data diff -Nru cb2bib-1.4.9/src/c2bFileDialog.cpp cb2bib-1.9.2/src/c2bFileDialog.cpp --- cb2bib-1.4.9/src/c2bFileDialog.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bFileDialog.cpp 2015-08-09 19:58:26.179736852 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bFileDialog.h" @@ -18,7 +18,7 @@ { setModal(true); settings = c2bSettingsP; -#ifdef Q_WS_X11 +#ifdef Q_OS_UNIX // Distinguish executable files fip = new fileIconProvider(); setIconProvider(fip); @@ -27,7 +27,7 @@ c2bFileDialog::~c2bFileDialog() { -#ifdef Q_WS_X11 +#ifdef Q_OS_UNIX delete fip; #endif } @@ -40,7 +40,7 @@ dlg->setFileMode(AnyFile); dlg->setAcceptMode(AcceptSave); dlg->setLabelText(QFileDialog::Accept, "Select"); - QString fn(dlg->exec(path)); + const QString fn(dlg->exec(path)); delete dlg; return fn; } @@ -50,7 +50,7 @@ c2bFileDialog* dlg = new c2bFileDialog(parentw, _caption(tr("Select a filename"), caption), _path(path), filter); dlg->setFileMode(ExistingFile); dlg->setLabelText(QFileDialog::Accept, "Select"); - QString fn(dlg->exec(path)); + const QString fn(dlg->exec(path)); delete dlg; return fn; } @@ -60,7 +60,7 @@ c2bFileDialog* dlg = new c2bFileDialog(parentw, _caption(tr("Select filenames"), caption), _path(path), filter); dlg->setFileMode(ExistingFiles); dlg->setLabelText(QFileDialog::Accept, "Select"); - QString fn(dlg->exec(path)); + const QString fn(dlg->exec(path)); QStringList fns; if (!fn.isEmpty()) fns = dlg->selectedFiles(); @@ -73,7 +73,7 @@ c2bFileDialog* dlg = new c2bFileDialog(parentw, _caption(tr("Save As"), caption), _path(path), filter); dlg->setFileMode(AnyFile); dlg->setAcceptMode(AcceptSave); - QString fn(dlg->exec(path)); + const QString fn(dlg->exec(path)); delete dlg; return fn; } @@ -83,7 +83,7 @@ c2bFileDialog* dlg = new c2bFileDialog(parentw, _caption("Select directory", caption), _dirpath(path), QString()); dlg->setFileMode(DirectoryOnly); dlg->setLabelText(QFileDialog::Accept, "Select"); - QString fn(dlg->exec()); + const QString fn(dlg->exec(QString())); delete dlg; return fn; } @@ -93,22 +93,20 @@ c2bFileDialog* dlg = new c2bFileDialog(parentw, _caption(tr("Select a filename"), caption), _path(path), filter); dlg->setFileMode(AnyFile); dlg->setLabelText(QFileDialog::Accept, "Select"); -#if QT_VERSION >= 0x040400 dlg->setFilter(QDir::Drives | QDir::AllDirs | QDir::NoDotAndDotDot | QDir::System); dlg->setNameFilterDetailsVisible(false); -#endif - QString fn(dlg->exec(path)); + const QString fn(dlg->exec(path)); delete dlg; return fn; } -const QString c2bFileDialog::exec(const QString& path) +QString c2bFileDialog::exec(const QString& path) { readSettings(); _current_file = path; - const QStringList fnf(filters().filter(QFileInfo(path).completeSuffix() + ')', Qt::CaseInsensitive)); + const QStringList fnf(nameFilters().filter(QFileInfo(path).completeSuffix() + ')', Qt::CaseInsensitive)); if (fnf.count() > 0) - selectFilter(fnf.at(0)); + selectNameFilter(fnf.at(0)); QTimer::singleShot(250, this, SLOT(selectCurrentFile())); QString sfn; if (QFileDialog::exec() == QDialog::Accepted) @@ -126,7 +124,7 @@ // Set suffix for getSaveFilename dialog if (acceptMode() == AcceptSave) { - QString suffix(selectedFilter()); + QString suffix(selectedNameFilter()); QRegExp sre("\\*\\.([\\w\\.]+)"); if (sre.indexIn(suffix) != -1) { diff -Nru cb2bib-1.4.9/src/c2bFileDialog.h cb2bib-1.9.2/src/c2bFileDialog.h --- cb2bib-1.4.9/src/c2bFileDialog.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bFileDialog.h 2015-08-09 19:58:26.264735999 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BFILEDIALOG_H @@ -38,8 +38,8 @@ ~c2bFileDialog(); QString _current_file; + QString exec(const QString& path); c2bSettings* settings; - const QString exec(const QString& path = QString()); fileIconProvider* fip; static QString _caption(const QString& generic, const QString& caption); static QString _dirpath(const QString& path); diff -Nru cb2bib-1.4.9/src/c2b.h cb2bib-1.9.2/src/c2b.h --- cb2bib-1.4.9/src/c2b.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2b.h 2015-08-09 19:58:26.230736340 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2B_H diff -Nru cb2bib-1.4.9/src/c2bHighlighter.cpp cb2bib-1.9.2/src/c2bHighlighter.cpp --- cb2bib-1.4.9/src/c2bHighlighter.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bHighlighter.cpp 2015-08-09 19:58:26.181736832 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bHighlighter.h" diff -Nru cb2bib-1.4.9/src/c2bHighlighter.h cb2bib-1.9.2/src/c2bHighlighter.h --- cb2bib-1.4.9/src/c2bHighlighter.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bHighlighter.h 2015-08-09 19:58:26.266735979 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BHIGHLIGHTER_H @@ -22,7 +22,7 @@ { public: - c2bHighlighter(QTextDocument* doc); + explicit c2bHighlighter(QTextDocument* doc); ~c2bHighlighter(); diff -Nru cb2bib-1.4.9/src/c2bIdLineEdit.cpp cb2bib-1.9.2/src/c2bIdLineEdit.cpp --- cb2bib-1.4.9/src/c2bIdLineEdit.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bIdLineEdit.cpp 2015-08-09 19:58:26.182736822 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. * * Improvements and modifications: diff -Nru cb2bib-1.4.9/src/c2bIdLineEdit.h cb2bib-1.9.2/src/c2bIdLineEdit.h --- cb2bib-1.4.9/src/c2bIdLineEdit.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bIdLineEdit.h 2015-08-09 19:58:26.267735969 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. * * Improvements and modifications: @@ -26,7 +26,7 @@ Q_OBJECT public: - c2bIdLineEdit(QWidget* parentw = 0); + explicit c2bIdLineEdit(QWidget* parentw = 0); ~c2bIdLineEdit(); void setDocumentIDEdit(); diff -Nru cb2bib-1.4.9/src/c2bLineEdit.cpp cb2bib-1.9.2/src/c2bLineEdit.cpp --- cb2bib-1.4.9/src/c2bLineEdit.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bLineEdit.cpp 2015-08-09 19:58:26.184736802 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bLineEdit.h" diff -Nru cb2bib-1.4.9/src/c2bLineEdit.h cb2bib-1.9.2/src/c2bLineEdit.h --- cb2bib-1.4.9/src/c2bLineEdit.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bLineEdit.h 2015-08-09 19:58:26.269735949 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BLINEEDIT_H @@ -16,7 +16,7 @@ Q_OBJECT public: - c2bLineEdit(QWidget* parentw = 0); + explicit c2bLineEdit(QWidget* parentw = 0); ~c2bLineEdit(); protected: diff -Nru cb2bib-1.4.9/src/c2bNetworkQuery.cpp cb2bib-1.9.2/src/c2bNetworkQuery.cpp --- cb2bib-1.4.9/src/c2bNetworkQuery.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bNetworkQuery.cpp 2015-08-09 19:58:26.187736772 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bNetworkQuery.h" diff -Nru cb2bib-1.4.9/src/c2bNetworkQuery.h cb2bib-1.9.2/src/c2bNetworkQuery.h --- cb2bib-1.4.9/src/c2bNetworkQuery.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bNetworkQuery.h 2015-08-09 19:58:26.271735929 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BNETWORKQUERY_H diff -Nru cb2bib-1.4.9/src/c2bNetworkQueryInfo.cpp cb2bib-1.9.2/src/c2bNetworkQueryInfo.cpp --- cb2bib-1.4.9/src/c2bNetworkQueryInfo.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bNetworkQueryInfo.cpp 2015-08-09 19:58:26.188736762 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bNetworkQueryInfo.h" diff -Nru cb2bib-1.4.9/src/c2bNetworkQueryInfo.h cb2bib-1.9.2/src/c2bNetworkQueryInfo.h --- cb2bib-1.4.9/src/c2bNetworkQueryInfo.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bNetworkQueryInfo.h 2015-08-09 19:58:26.274735898 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BNETWORKQUERYINFO_H @@ -24,7 +24,7 @@ Q_OBJECT public: - c2bNetworkQueryInfo(QObject* parento = 0); + explicit c2bNetworkQueryInfo(QObject* parento = 0); ~c2bNetworkQueryInfo(); QList<QAction*> bookmarkActions(const QString& selection); diff -Nru cb2bib-1.4.9/src/c2bPdfImport.cpp cb2bib-1.9.2/src/c2bPdfImport.cpp --- cb2bib-1.4.9/src/c2bPdfImport.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bPdfImport.cpp 2015-08-09 19:58:26.191736732 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bPdfImport.h" @@ -14,6 +14,7 @@ #include <document.h> #include <QDropEvent> +#include <QMimeData> #include <QPushButton> #include <QTimer> #include <QUrl> diff -Nru cb2bib-1.4.9/src/c2bPdfImport.h cb2bib-1.9.2/src/c2bPdfImport.h --- cb2bib-1.4.9/src/c2bPdfImport.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bPdfImport.h 2015-08-09 19:58:26.275735888 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BPDFIMPORT_H @@ -19,7 +19,7 @@ Q_OBJECT public: - c2bPdfImport(QWidget* parentw = 0); + explicit c2bPdfImport(QWidget* parentw = 0); ~c2bPdfImport(); QString processedFile; diff -Nru cb2bib-1.4.9/src/c2bPostprocess.cpp cb2bib-1.9.2/src/c2bPostprocess.cpp --- cb2bib-1.4.9/src/c2bPostprocess.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bPostprocess.cpp 2015-08-09 19:58:26.193736712 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bPostprocess.h" diff -Nru cb2bib-1.4.9/src/c2bPostprocess.h cb2bib-1.9.2/src/c2bPostprocess.h --- cb2bib-1.4.9/src/c2bPostprocess.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bPostprocess.h 2015-08-09 19:58:26.277735868 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BPOSTPROCESS_H diff -Nru cb2bib-1.4.9/src/c2bReferenceList.cpp cb2bib-1.9.2/src/c2bReferenceList.cpp --- cb2bib-1.4.9/src/c2bReferenceList.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bReferenceList.cpp 2015-08-09 19:58:26.195736692 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bReferenceList.h" @@ -27,7 +27,7 @@ { // Reimplement sorting public: - TreeWidgetItem(const QStringList& strings) : QTreeWidgetItem(strings) {} + explicit TreeWidgetItem(const QStringList& strings) : QTreeWidgetItem(strings) {} bool operator< (const QTreeWidgetItem& other) const { const int sortCol(treeWidget()->sortColumn()); @@ -45,7 +45,7 @@ _browserP = br; _citerP = new c2bCoreCiter(this); _settingsP = c2bSettingsP; - _settingsP->setDefaultValue("c2bReferenceList/SearchEngine", "http://www.google.com/search?ie=UTF-8&q="); + _settingsP->setDefaultValue("c2bReferenceList/SearchEngine", "https://www.google.com/search?ie=UTF-8&q="); _settingsP->setDefaultValue("c2bReferenceList/SearchEngineAddQuotes", false); setupFilterBar(); diff -Nru cb2bib-1.4.9/src/c2bReferenceList.h cb2bib-1.9.2/src/c2bReferenceList.h --- cb2bib-1.4.9/src/c2bReferenceList.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bReferenceList.h 2015-08-09 19:58:26.278735858 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BREFERENCELIST_H diff -Nru cb2bib-1.4.9/src/c2bREHighlighter.cpp cb2bib-1.9.2/src/c2bREHighlighter.cpp --- cb2bib-1.4.9/src/c2bREHighlighter.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bREHighlighter.cpp 2015-08-09 19:58:26.197736672 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bREHighlighter.h" diff -Nru cb2bib-1.4.9/src/c2bREHighlighter.h cb2bib-1.9.2/src/c2bREHighlighter.h --- cb2bib-1.4.9/src/c2bREHighlighter.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bREHighlighter.h 2015-08-09 19:58:26.280735838 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BREHIGHLIGHTER_H @@ -22,7 +22,7 @@ { public: - c2bREHighlighter(QTextDocument* doc); + explicit c2bREHighlighter(QTextDocument* doc); ~c2bREHighlighter(); diff -Nru cb2bib-1.4.9/src/c2bRLWebSearchSettings.cpp cb2bib-1.9.2/src/c2bRLWebSearchSettings.cpp --- cb2bib-1.4.9/src/c2bRLWebSearchSettings.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bRLWebSearchSettings.cpp 2015-08-09 19:58:26.199736652 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bRLWebSearchSettings.h" @@ -15,8 +15,8 @@ c2bSettings* settings(c2bSettingsP); const QString searchEngine(settings->value("c2bReferenceList/SearchEngine").toString()); ui.searchEngine->addItem(searchEngine); - ui.searchEngine->addItem("http://www.google.com/search?ie=UTF-8&q="); - ui.searchEngine->addItem("http://scholar.google.com/scholar?ie=UTF-8&q="); + ui.searchEngine->addItem("https://www.google.com/search?ie=UTF-8&q="); + ui.searchEngine->addItem("https://scholar.google.com/scholar?ie=UTF-8&q="); ui.searchEngine->addItem("http://www.ncbi.nlm.nih.gov/pubmed?term="); ui.searchEngine->setCurrentIndex(0); ui.searchEngine->setFocus(); diff -Nru cb2bib-1.4.9/src/c2bRLWebSearchSettings.h cb2bib-1.9.2/src/c2bRLWebSearchSettings.h --- cb2bib-1.4.9/src/c2bRLWebSearchSettings.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bRLWebSearchSettings.h 2015-08-09 19:58:26.282735818 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BRLWEBSEARCHSETTINGS_H @@ -17,7 +17,7 @@ Q_OBJECT public: - c2bRLWebSearchSettings(QWidget* parentw = 0); + explicit c2bRLWebSearchSettings(QWidget* parentw = 0); ~c2bRLWebSearchSettings(); diff -Nru cb2bib-1.4.9/src/c2bSaveRegExp.cpp cb2bib-1.9.2/src/c2bSaveRegExp.cpp --- cb2bib-1.4.9/src/c2bSaveRegExp.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bSaveRegExp.cpp 2015-08-09 19:58:26.200736642 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bSaveRegExp.h" @@ -43,8 +43,8 @@ Information about the basics on the editing and working with Regular Expressions as used by cb2Bib can be found at the Qt document file \htmlonly -<a href="http://qt-project.org/doc/qt-4.8/QRegExp.html#introduction" -target="_blank">http://qt-project.org/doc/qt-4.8/qregexp.html#introduction</a>. +<a href="http://doc.qt.io/qt-4.8/QRegExp.html#introduction" +target="_blank">http://doc.qt.io/qt-4.8/QRegExp.html#introduction</a>. \endhtmlonly @@ -138,7 +138,7 @@ const QStringList field_list(ui.Fields->text().split(' ', QString::SkipEmptyParts)); const int fields(field_list.count()); _pattern_rx.setPattern(ui.RegExp->text()); - const int captures(_pattern_rx.numCaptures()); + const int captures(_pattern_rx.captureCount()); if (_pattern_rx.isValid() && fields > 0 && fields == captures && !ui.Type->text().isEmpty()) { info += tr("Reference type: %1\n").arg(ui.Type->text()); diff -Nru cb2bib-1.4.9/src/c2bSaveRegExp.h cb2bib-1.9.2/src/c2bSaveRegExp.h --- cb2bib-1.4.9/src/c2bSaveRegExp.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bSaveRegExp.h 2015-08-09 19:58:26.283735808 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BSAVEREGEXP_H diff -Nru cb2bib-1.4.9/src/c2bSaveREHighlighter.cpp cb2bib-1.9.2/src/c2bSaveREHighlighter.cpp --- cb2bib-1.4.9/src/c2bSaveREHighlighter.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bSaveREHighlighter.cpp 2015-08-09 19:58:26.202736621 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bSaveREHighlighter.h" diff -Nru cb2bib-1.4.9/src/c2bSaveREHighlighter.h cb2bib-1.9.2/src/c2bSaveREHighlighter.h --- cb2bib-1.4.9/src/c2bSaveREHighlighter.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bSaveREHighlighter.h 2015-08-09 19:58:26.285735788 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BSAVEREHIGHLIGHTER_H diff -Nru cb2bib-1.4.9/src/c2bSearchInFiles.cpp cb2bib-1.9.2/src/c2bSearchInFiles.cpp --- cb2bib-1.4.9/src/c2bSearchInFiles.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bSearchInFiles.cpp 2015-08-09 19:58:26.203736611 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bSearchInFiles.h" @@ -20,8 +20,8 @@ ui.setupUi(this); // Set blank title to columns 0 and 4. Qt 4.4.0 needs it, otherwise it takes column number as default title. // Recheck whenever ui files are generated for 4.4 instead of current 4.2. - ui.patternList->headerItem()->setText(0, QApplication::translate("c2bSearchInFiles", "", 0, QApplication::UnicodeUTF8)); - ui.patternList->headerItem()->setText(4, QApplication::translate("c2bSearchInFiles", "", 0, QApplication::UnicodeUTF8)); + ui.patternList->headerItem()->setText(0, QApplication::translate("c2bSearchInFiles", "", 0)); + ui.patternList->headerItem()->setText(4, QApplication::translate("c2bSearchInFiles", "", 0)); for (int i = 0; i < ITEMS_IN_SEARCH_PATTERN; ++i) ui.patternList->resizeColumnToContents(i); diff -Nru cb2bib-1.4.9/src/c2bSearchInFiles.h cb2bib-1.9.2/src/c2bSearchInFiles.h --- cb2bib-1.4.9/src/c2bSearchInFiles.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bSearchInFiles.h 2015-08-09 19:58:26.286735778 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BSEARCHINFILES_H diff -Nru cb2bib-1.4.9/src/c2bSearchInFilesPattern.cpp cb2bib-1.9.2/src/c2bSearchInFilesPattern.cpp --- cb2bib-1.4.9/src/c2bSearchInFilesPattern.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bSearchInFilesPattern.cpp 2015-08-09 19:58:26.204736601 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bSearchInFilesPattern.h" diff -Nru cb2bib-1.4.9/src/c2bSearchInFilesPattern.h cb2bib-1.9.2/src/c2bSearchInFilesPattern.h --- cb2bib-1.4.9/src/c2bSearchInFilesPattern.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bSearchInFilesPattern.h 2015-08-09 19:58:26.288735758 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BSEARCHINFILESPATTERN_H @@ -22,7 +22,7 @@ Q_OBJECT public: - c2bSearchInFilesPattern(QWidget* parentw = 0); + explicit c2bSearchInFilesPattern(QWidget* parentw = 0); ~c2bSearchInFilesPattern(); const QStringList patterns(); diff -Nru cb2bib-1.4.9/src/c2bSettings.cpp cb2bib-1.9.2/src/c2bSettings.cpp --- cb2bib-1.4.9/src/c2bSettings.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bSettings.cpp 2015-08-09 19:58:26.206736581 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bSettings.h" @@ -199,7 +199,7 @@ c2bUtils::warn(tr("Shortcut '%1' is not registered in default keysequence list").arg(fullname)); } -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN #include <QFileDialog> QString c2bSettings::decodeFilename(const QString& fn) const { diff -Nru cb2bib-1.4.9/src/c2bSettings.h cb2bib-1.9.2/src/c2bSettings.h --- cb2bib-1.4.9/src/c2bSettings.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bSettings.h 2015-08-09 19:58:26.289735748 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BSETTINGS_H @@ -67,7 +67,7 @@ void init(); void processReferenceFile(); void setDefaults(); -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN QString decodeFilename(const QString& fn) const; #endif diff -Nru cb2bib-1.4.9/src/c2bShortcutPushButton.cpp cb2bib-1.9.2/src/c2bShortcutPushButton.cpp --- cb2bib-1.4.9/src/c2bShortcutPushButton.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bShortcutPushButton.cpp 2015-08-09 19:58:26.207736571 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bShortcutPushButton.h" diff -Nru cb2bib-1.4.9/src/c2bShortcutPushButton.h cb2bib-1.9.2/src/c2bShortcutPushButton.h --- cb2bib-1.4.9/src/c2bShortcutPushButton.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bShortcutPushButton.h 2015-08-09 19:58:26.290735738 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BSHORTCUTPUSHBUTTON_H @@ -16,7 +16,7 @@ Q_OBJECT public: - inline c2bShortcutPushButton(QWidget* parentw = 0) : QPushButton(parentw) {} + explicit inline c2bShortcutPushButton(QWidget* parentw = 0) : QPushButton(parentw) {} inline ~c2bShortcutPushButton() {} void setKeysequence(const QKeySequence& ks); diff -Nru cb2bib-1.4.9/src/c2bShortcutWidget.cpp cb2bib-1.9.2/src/c2bShortcutWidget.cpp --- cb2bib-1.4.9/src/c2bShortcutWidget.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bShortcutWidget.cpp 2015-08-09 19:58:26.209736551 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bShortcutWidget.h" @@ -30,10 +30,8 @@ _standard_keysequences.append(QKeySequence::ZoomIn); _standard_keysequences.append(QKeySequence::ZoomOut); _standard_keysequences.append(Qt::Key_F2); -#if QT_VERSION >= 0x040600 _standard_keysequences.append(QKeySequence::Quit); _standard_keysequences.append(QKeySequence::SaveAs); -#endif connect(ui.Clear, SIGNAL(clicked()), ui.Shortcut, SLOT(clear())); connect(ui.Reset, SIGNAL(clicked()), ui.Shortcut, SLOT(reset())); diff -Nru cb2bib-1.4.9/src/c2bShortcutWidget.h cb2bib-1.9.2/src/c2bShortcutWidget.h --- cb2bib-1.4.9/src/c2bShortcutWidget.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bShortcutWidget.h 2015-08-09 19:58:26.292735718 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BSHORTCUTWIDGET_H @@ -23,7 +23,7 @@ Q_OBJECT public: - c2bShortcutWidget(QWidget* parentw = 0); + explicit c2bShortcutWidget(QWidget* parentw = 0); inline ~c2bShortcutWidget() {} void setShortcutNames(const QString& path, const QStringList& fullnames); diff -Nru cb2bib-1.4.9/src/c2bTests.cpp cb2bib-1.9.2/src/c2bTests.cpp --- cb2bib-1.4.9/src/c2bTests.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bTests.cpp 2015-08-09 19:58:26.211736531 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #define C2B_CHECK_CAPITALIZATION 0 @@ -17,6 +17,7 @@ #include <settings.h> #include <QCoreApplication> +#include <QDataStream> #include <QTextStream> @@ -42,6 +43,10 @@ { _test_count = 0; _failed_test_count = 0; +#if C2B_CHECK_PATTERNS + heuristic_check_patterns(); + return 0; +#endif #if C2B_CHECK_JOURNALS heuristic_journal(); #else @@ -132,7 +137,7 @@ #endif cout << "Application binary path: " << QCoreApplication::instance()->applicationDirPath() << endl; cout << "Application hardcoded data path: " << C2B_DATA_DIR << endl; -#ifdef Q_WS_MACX +#ifdef Q_OS_MACX QString C2B_DATA_DIR_MAC(C2B_DATA_DIR); if (QDir(C2B_DATA_DIR + "/data/").exists()) C2B_DATA_DIR_MAC = QDir::cleanPath(C2B_DATA_DIR + '/'); @@ -265,7 +270,7 @@ const QString file(reference.value("file")); if (excluded.contains(file) || file.contains("/stacks/")) continue; - document d(file); + document d(file, document::FirstPage); const QString doc(d.toString()); doc_cache.insert(reference.value("file"), doc); } diff -Nru cb2bib-1.4.9/src/c2bTests.h cb2bib-1.9.2/src/c2bTests.h --- cb2bib-1.4.9/src/c2bTests.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bTests.h 2015-08-09 19:58:26.293735708 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BTESTS_H diff -Nru cb2bib-1.4.9/src/c2bTextBrowser.cpp cb2bib-1.9.2/src/c2bTextBrowser.cpp --- cb2bib-1.4.9/src/c2bTextBrowser.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bTextBrowser.cpp 2015-08-09 19:58:26.212736521 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bTextBrowser.h" diff -Nru cb2bib-1.4.9/src/c2bTextBrowser.h cb2bib-1.9.2/src/c2bTextBrowser.h --- cb2bib-1.4.9/src/c2bTextBrowser.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bTextBrowser.h 2015-08-09 19:58:26.294735698 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BTEXTBROWSER_H @@ -21,7 +21,7 @@ Q_OBJECT public: - c2bTextBrowser(QWidget* parentw = 0); + explicit c2bTextBrowser(QWidget* parentw = 0); ~c2bTextBrowser(); void updateHtml(const QString& newHtml); diff -Nru cb2bib-1.4.9/src/c2bTextEdit.cpp cb2bib-1.9.2/src/c2bTextEdit.cpp --- cb2bib-1.4.9/src/c2bTextEdit.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bTextEdit.cpp 2015-08-09 19:58:26.214736501 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bTextEdit.h" diff -Nru cb2bib-1.4.9/src/c2bTextEdit.h cb2bib-1.9.2/src/c2bTextEdit.h --- cb2bib-1.4.9/src/c2bTextEdit.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bTextEdit.h 2015-08-09 19:58:26.296735678 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BTEXTEDIT_H @@ -19,7 +19,7 @@ Q_OBJECT public: - c2bTextEdit(QWidget* parentw = 0); + explicit c2bTextEdit(QWidget* parentw = 0); ~c2bTextEdit(); QAction* convertSelection2LaTeXAction; @@ -90,7 +90,7 @@ { public: - LineNumberArea(c2bTextEdit* editor) : QWidget(editor) + explicit LineNumberArea(c2bTextEdit* editor) : QWidget(editor) { _editor = editor; } diff -Nru cb2bib-1.4.9/src/c2bUpdateMetadata.cpp cb2bib-1.9.2/src/c2bUpdateMetadata.cpp --- cb2bib-1.4.9/src/c2bUpdateMetadata.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bUpdateMetadata.cpp 2015-08-09 19:58:26.215736491 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bUpdateMetadata.h" diff -Nru cb2bib-1.4.9/src/c2bUpdateMetadata.h cb2bib-1.9.2/src/c2bUpdateMetadata.h --- cb2bib-1.4.9/src/c2bUpdateMetadata.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bUpdateMetadata.h 2015-08-09 19:58:26.297735668 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BUPDATEMETADATA_H @@ -22,7 +22,7 @@ Q_OBJECT public: - c2bUpdateMetadata(QWidget* parentw = 0); + explicit c2bUpdateMetadata(QWidget* parentw = 0); ~c2bUpdateMetadata(); void update(const QString& fn, const QString& bibtex); diff -Nru cb2bib-1.4.9/src/c2bUtils.cpp cb2bib-1.9.2/src/c2bUtils.cpp --- cb2bib-1.4.9/src/c2bUtils.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bUtils.cpp 2015-08-09 19:58:26.217736471 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bUtils.h" diff -Nru cb2bib-1.4.9/src/c2bUtils.h cb2bib-1.9.2/src/c2bUtils.h --- cb2bib-1.4.9/src/c2bUtils.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bUtils.h 2015-08-09 19:58:26.298735658 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BUTILS_H diff -Nru cb2bib-1.4.9/src/c2bWebBrowser.cpp cb2bib-1.9.2/src/c2bWebBrowser.cpp --- cb2bib-1.4.9/src/c2bWebBrowser.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bWebBrowser.cpp 2015-08-09 19:58:26.218736461 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "c2bWebBrowser.h" diff -Nru cb2bib-1.4.9/src/c2bWebBrowser.h cb2bib-1.9.2/src/c2bWebBrowser.h --- cb2bib-1.4.9/src/c2bWebBrowser.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/c2bWebBrowser.h 2015-08-09 19:58:26.300735637 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef C2BWEBBROWSER_H @@ -17,7 +17,7 @@ Q_OBJECT public: - c2bWebBrowser(QWidget* parentw = 0); + explicit c2bWebBrowser(QWidget* parentw = 0); virtual ~c2bWebBrowser(); QAction* viewBackwardAction; diff -Nru cb2bib-1.4.9/src/cb2Bib.cpp cb2bib-1.9.2/src/cb2Bib.cpp --- cb2bib-1.4.9/src/cb2Bib.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/cb2Bib.cpp 2015-08-09 19:58:26.220736441 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "cb2Bib.h" @@ -26,7 +26,7 @@ #include <bibSearcher.h> #include <network.h> -#include <QtGui> +#include <QtWidgets> /** \page overview Overview @@ -43,7 +43,7 @@ documents, inserting bibliographic metadata to documents, and writing short notes that interrelate several references. - See \ref relnotes147. + See \ref relnotes190. <b>Current version: cb2Bib GET_VERSION</b>. (See \ref changelog for a detailed list of changes and acknowledgments, and \ref relnotes for @@ -340,9 +340,15 @@ \subsection requirements_comp Compilation To compile cb2Bib, the following libraries must be present and accessible: + - Qt 5.0 or higher from + \htmlonly + <a href="http://www.qt.io/download/" target="_blank">Qt Project</a> + \endhtmlonly + for cb2Bib prereleases 1.9. + - Qt 4.4.0 or higher from \htmlonly - <a href="http://qt-project.org/downloads" target="_blank">Qt Project</a>. + <a href="http://www.qt.io/download/" target="_blank">Qt Project</a>. \endhtmlonly On a Linux platform with Qt preinstalled, make sure that the <tt>devel</tt> packages and Qt tools are also present. @@ -387,7 +393,7 @@ - The <tt>bib2xml</tt> and <tt>xml2end</tt> \htmlonly - <a href="http://www.scripps.edu/~cdputnam/software/bibutils/bibutils.html" target="_blank">BibUtils</a>, + <a href="http://bibutils.refbase.org/" target="_blank">BibUtils</a>, \endhtmlonly to test the postprocess script <tt>bib2end.bat</tt> on Windows platforms. @@ -414,11 +420,61 @@ <p> </p> - <em>The <b>cb2Bib</b>, Pere Constans, Copyright © 2004-2012.\n + <em>The <b>cb2Bib</b>, Pere Constans, Copyright © 2004-2015.\n First released, version 0.1.0 on 2004-06-29. \n GET_UPDATEDON</em> */ + +/** \page relnotes Release Notes + +\section relnotes190 Release Note cb2Bib 1.9.0 + + The cb2Bib sources have been ported to Qt5. To highlight this major update + in library requirements the version number is set to 1.9.0. Later, once + stabilized and new functionality related to Qt5 enhancements are applied, + version number will be set to 2. + + At this point the cb2Bib has exactly the same functionality as its + preceding version 1.5.0. To build the program, however, only qmake and its + related config procedure are available. The cmake scripts have not yet been + ported. + + Qt5 brings important enhancements related to regular expressions and string + processing. Some careful updates to the cb2Bib sources are needed to fully + benefit from them. They will implemented through the 1.9.x series. We + expect by then a performance boost on full text, regular expression based + searches. + + <p> </p> +*/ + + +/** \page relnotes Release Notes + +\section relnotes150 Release Note cb2Bib 1.5.0 + + Included in version 1.5.0 sources there is a patch for XPDF 3.0.4, the + default tool to convert PDF documents to plain text. The modified code + separates superscripts to avoid words being joined to reference numbers and + author names joined to affiliations' glyphs. Interested users will need to + download the package, apply the patch, and compile it. + + Additionally, this version improves converted text postprocessing. This + step normalizes character codes, reverts ligatures, restores when possible + orphan diacritics and broken words, and undoes text hyphenation. + + Conversion to text and postprocessing is important for reference + extraction, and document indexing and searching. It is therefore + recommended to delete cached document-to-text data to benefit from the + present improvements. The cb2Bib stores cached texts in *c2b files in an + user specified directory. After that, by performing a search or initiating + indexing an updated cache will be created. + + <p> </p> +*/ + + /** \page relnotes Release Notes \section relnotes147 Release Note cb2Bib 1.4.7 @@ -866,10 +922,7 @@ MacOSX platforms. First, if you encounter a 'nothing to install'-error during installation on - MacOSX 10.4.x using the cb2Bib binary installer available at - \htmlonly - <a href="http://naranja.umh.es/~atg/" target="_blank">http://naranja.umh.es/~atg/</a>, - \endhtmlonly + MacOSX 10.4.x using the cb2Bib binary installer available at naranja.umh.es/~atg/, please delete the cb2bib-receipts from <tt>/Library/Receipts</tt> and then rerun the installer. See also M. Bongard's clarifying note 'MACOSX 10.4.X "NOTHING TO INSTALL"-ERROR' for details. @@ -1313,7 +1366,7 @@ "</td></tr></tbody>" "</table>" "<br /> %2 <br />" - "<p align=\"center\">Copyright (C) 2004-2012 by Pere Constans<br />" + "<p align=\"center\">Copyright (C) 2004-2015 by Pere Constans<br />" "<a href=\"http://www.molspaces.com/cb2bib/index.html\">" "http://www.molspaces.com/cb2bib</a></p> " "<p align=\"center\"><i>The cb2Bib is licensed under the terms of the " @@ -1471,9 +1524,7 @@ ui.AddBibB->setShortcut(QKeySequence::Save); ui.EditBibTeXB->setShortcut(QKeySequence::Open); ui.SearchInFilesB->setShortcut(QKeySequence::Find); -#if QT_VERSION >= 0x040600 ui.ExitB->setShortcut(QKeySequence::Quit); -#endif ui.BibTeXDir->setShortcut(_settingsP->keysequence("Shortcuts/cb2Bib/Select BibTeX File")); ui.ConfigureB->setShortcut(_settingsP->keysequence("Shortcuts/cb2Bib/Button Configure")); diff -Nru cb2bib-1.4.9/src/cb2Bib.h cb2bib-1.9.2/src/cb2Bib.h --- cb2bib-1.4.9/src/cb2Bib.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/cb2Bib.h 2015-08-09 19:58:26.301735627 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #ifndef CB2BIB_H @@ -32,7 +32,7 @@ Q_OBJECT public: - cb2Bib(QWidget* parentw = 0); + explicit cb2Bib(QWidget* parentw = 0); ~cb2Bib(); diff -Nru cb2bib-1.4.9/src/clipboardPoll.cpp cb2bib-1.9.2/src/clipboardPoll.cpp --- cb2bib-1.4.9/src/clipboardPoll.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/clipboardPoll.cpp 2015-08-09 19:58:26.222736421 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** * clipboardPoll, modified by Pere Constans for the cb2Bib, 2005 * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * * * Author and Copyright (C) 2003 by Lubos Lunak <l.lunak@kde.org> diff -Nru cb2bib-1.4.9/src/clipboardPoll.h cb2bib-1.9.2/src/clipboardPoll.h --- cb2bib-1.4.9/src/clipboardPoll.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/clipboardPoll.h 2015-08-09 19:58:26.302735617 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** * clipboardPoll, modified by Pere Constans for the cb2Bib, 2005 * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * * * Author and Copyright (C) 2003 by Lubos Lunak <l.lunak@kde.org> @@ -34,6 +34,7 @@ #include <QWidget> #include <QTimer> #include <X11/Xlib.h> +#undef Bool // Workaround for unqualified-id before 'int' for bool signal and slot /** @@ -45,7 +46,7 @@ Q_OBJECT public: - clipboardPoll(QWidget* parentw = 0); + explicit clipboardPoll(QWidget* parentw = 0); ~clipboardPoll(); inline void startT(uint interval) diff -Nru cb2bib-1.4.9/src/findDialog.cpp cb2bib-1.9.2/src/findDialog.cpp --- cb2bib-1.4.9/src/findDialog.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/findDialog.cpp 2015-08-09 19:58:26.224736400 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. * findDialog was originally adapted from Qt Designer * Copyright (C) 2001 Trolltech AS. All rights reserved. @@ -146,7 +146,7 @@ if (newCursor.isNull()) { QTextCursor ac(doc); - ac.movePosition(options & QTextDocument::FindBackward ? QTextCursor::End : QTextCursor::Start); + ac.movePosition((options & QTextDocument::FindBackward) ? QTextCursor::End : QTextCursor::Start); newCursor = doc->find(m_find_pattern, ac, options); if (newCursor.isNull()) { diff -Nru cb2bib-1.4.9/src/findDialog.h cb2bib-1.9.2/src/findDialog.h --- cb2bib-1.4.9/src/findDialog.h 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/findDialog.h 2015-08-09 19:58:26.304735597 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. * findDialog is adapted from Qt Designer * Copyright (C) 2001 Trolltech AS. All rights reserved. @@ -25,7 +25,7 @@ Q_OBJECT public: - findDialog(QWidget* parentw = 0); + explicit findDialog(QWidget* parentw = 0); ~findDialog(); QAction* findAction; diff -Nru cb2bib-1.4.9/src/htm/references.html cb2bib-1.9.2/src/htm/references.html --- cb2bib-1.4.9/src/htm/references.html 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/src/htm/references.html 2015-08-09 19:52:56.000000000 +0000 @@ -34,7 +34,7 @@ <tr id="footer"> <td width="100%" align="left"><a href= "http://www.molspaces.com/cb2bib/index.html">The cb2Bib / version - GET_CB2BIB_VERSION_NUMBER</a>. Copyright © 2004-2012 by Pere Constans. Licensed + GET_CB2BIB_VERSION_NUMBER</a>. Copyright © 2004-2015 by Pere Constans. Licensed under the terms of the <a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a> version 3.</td> </tr> diff -Nru cb2bib-1.4.9/src/htm/references-idea.css cb2bib-1.9.2/src/htm/references-idea.css --- cb2bib-1.4.9/src/htm/references-idea.css 1970-01-01 00:00:00.000000000 +0000 +++ cb2bib-1.9.2/src/htm/references-idea.css 2015-08-09 19:52:56.000000000 +0000 @@ -0,0 +1,69 @@ +/* cb2Bib References CSS */ + +/* general */ + +body { +font-size: 100%; +font-family: sans-serif; +background-color: #B7B096; +color: #000000; +padding: 0; +margin: 0; +} + +a { +color: #670000; +text-decoration: none; +} + +a:link { +color: #670000; +text-decoration: underline; +} + +h1 +{ +color: #000000; +font-size: 20px; +font-variant: small-caps; +font-family: sans-serif; +} + +/* references */ + +#references{ +background-color: #AAA58C; +} + +#references blockquote{ +font-size: small; +} + +#references span{ +color: #800000; +/* font-weight: bold; */ +} + +#excerpt{ +font-style: italic; +} + +/* header */ + +#header { +vertical-align: middle; +} + +/* footer */ + +#footer { +color: #000000; +font-family: arial, sans-serif; +font-size: small; +} + +#footer td{ +padding: 10px; +padding-left: 5px; +padding-right: 5px; +} diff -Nru cb2bib-1.4.9/src/main.cpp cb2bib-1.9.2/src/main.cpp --- cb2bib-1.4.9/src/main.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/main.cpp 2015-08-09 19:58:26.225736390 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include "qtsingleapplication/src/qtsingleapplication.h" @@ -33,11 +33,11 @@ if (c2bSettings::isConsoleMode(argc, argv)) { // Cannot use QCoreApplication, QTextDocument is required by c2bUtils::fromHtmlString -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN // Needs also workaround c2bSettings::decodeFilename() QApplication app(argc, argv); #else - QApplication app(argc, argv, QApplication::Tty); + QApplication app(argc, argv); #endif app.setOrganizationName(C2B_ORGANIZATION); app.setApplicationName(C2B_APPLICATION); @@ -79,11 +79,6 @@ QApplication app(argc, argv); app.setOrganizationName(C2B_ORGANIZATION); app.setApplicationName(C2B_APPLICATION); -#if QT_VERSION >= 0x040400 - // Avoid flickering (e.g. white panel) at startup - // Consider: QT_USE_NATIVE_WINDOWS=1 - // app.setAttribute(Qt::AA_NativeWindows, true); -#endif c2b_settings = c2bSettings::initSettings(); if (c2b_settings->loaded()) { diff -Nru cb2bib-1.4.9/src/qtsingleapplication/INSTALL.TXT cb2bib-1.9.2/src/qtsingleapplication/INSTALL.TXT --- cb2bib-1.4.9/src/qtsingleapplication/INSTALL.TXT 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/src/qtsingleapplication/INSTALL.TXT 2015-08-09 19:52:56.000000000 +0000 @@ -166,7 +166,7 @@ 1. In Assistant, open the Edit->Preferences dialog and choose the Documentation tab. In the list of Registered Documentation, select - the item com.trolltech.qtsolutions.some-package_version, and click + the item com.nokia.qtsolutions.some-package_version, and click the Remove button. For Qt versions prior to 4.4, do instead the following: diff -Nru cb2bib-1.4.9/src/qtsingleapplication/LGPL_EXCEPTION.txt cb2bib-1.9.2/src/qtsingleapplication/LGPL_EXCEPTION.txt --- cb2bib-1.4.9/src/qtsingleapplication/LGPL_EXCEPTION.txt 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/src/qtsingleapplication/LGPL_EXCEPTION.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -Nokia Qt LGPL Exception version 1.0 - -As a special exception to the GNU Lesser General Public License -version 2.1, the object code form of a "work that uses the Library" -may incorporate material from a header file that is part of the -Library. You may distribute such object code under terms of your -choice, provided that the incorporated material (i) does not exceed -more than 5% of the total size of the Library; and (ii) is limited to -numerical parameters, data structure layouts, accessors, macros, -inline functions and templates. diff -Nru cb2bib-1.4.9/src/qtsingleapplication/LICENSE.GPL3 cb2bib-1.9.2/src/qtsingleapplication/LICENSE.GPL3 --- cb2bib-1.4.9/src/qtsingleapplication/LICENSE.GPL3 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/src/qtsingleapplication/LICENSE.GPL3 1970-01-01 00:00:00.000000000 +0000 @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff -Nru cb2bib-1.4.9/src/qtsingleapplication/LICENSE.LGPL cb2bib-1.9.2/src/qtsingleapplication/LICENSE.LGPL --- cb2bib-1.4.9/src/qtsingleapplication/LICENSE.LGPL 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/src/qtsingleapplication/LICENSE.LGPL 1970-01-01 00:00:00.000000000 +0000 @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - <one line to give the library's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - <signature of Ty Coon>, 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff -Nru cb2bib-1.4.9/src/qtsingleapplication/README.TXT cb2bib-1.9.2/src/qtsingleapplication/README.TXT --- cb2bib-1.4.9/src/qtsingleapplication/README.TXT 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/src/qtsingleapplication/README.TXT 2015-08-09 19:52:56.000000000 +0000 @@ -1,7 +1,33 @@ -Single Application v2.6 +Qt Solutions Component: Single Application The QtSingleApplication component provides support for applications that can be only started once per user. +Version history: + +2.0: - Version 1.3 ported to Qt 4. + +2.1: - Fix compilation problem on Mac. + +2.2: - Really fix the Mac compilation problem. + - Mac: fix crash due to wrong object releasing. + - Mac: Fix memory leak. + +2.3: - Windows: Force creation of internal widget to make it work + with Qt 4.2. + +2.4: - Fix the system for automatic window raising on message + reception. NOTE: minor API change. + +2.5: - Mac: Fix isRunning() to work and report correctly. + +2.6: - - initialize() is now obsolete, no longer necessary to call + it + - - Fixed race condition where multiple instances migth be started + - - QtSingleCoreApplication variant provided for non-GUI (console) + usage + - Complete reimplementation. Visible changes: + - LGPL release. + diff -Nru cb2bib-1.4.9/src/qtsingleapplication/src/qtlocalpeer.cpp cb2bib-1.9.2/src/qtsingleapplication/src/qtlocalpeer.cpp --- cb2bib-1.4.9/src/qtsingleapplication/src/qtlocalpeer.cpp 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/src/qtsingleapplication/src/qtlocalpeer.cpp 2015-08-09 19:52:56.000000000 +0000 @@ -1,61 +1,57 @@ /**************************************************************************** ** -** This file is part of a Qt Solutions component. -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Solutions Commercial License Agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** Please note Third Party Software included with Qt Solutions may impose -** additional restrictions and it is the user's responsibility to ensure -** that they have met the licensing requirements of the GPL, LGPL, or Qt -** Solutions Commercial license and the relevant license of the Third -** Party Software they are using. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Solutions component. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** ****************************************************************************/ #include "qtlocalpeer.h" -#include <QtCore/QCoreApplication> -#include <QtCore/QTime> +#include <QCoreApplication> +#include <QDataStream> +#include <QTime> #if defined(Q_OS_WIN) -#include <QtCore/QLibrary> -#include <QtCore/qt_windows.h> +#include <QLibrary> +#include <qt_windows.h> typedef BOOL(WINAPI*PProcessIdToSessionId)(DWORD,DWORD*); static PProcessIdToSessionId pProcessIdToSessionId = 0; #endif #if defined(Q_OS_UNIX) +#include <sys/types.h> #include <time.h> #include <unistd.h> #endif @@ -165,8 +161,11 @@ QDataStream ds(&socket); ds.writeBytes(uMsg.constData(), uMsg.size()); bool res = socket.waitForBytesWritten(timeout); - res &= socket.waitForReadyRead(timeout); // wait for ack - res &= (socket.read(qstrlen(ack)) == ack); + if (res) { + res &= socket.waitForReadyRead(timeout); // wait for ack + if (res) + res &= (socket.read(qstrlen(ack)) == ack); + } return res; } @@ -192,7 +191,7 @@ uMsgBuf += got; } while (remaining && got >= 0 && socket->waitForReadyRead(2000)); if (got < 0) { - qWarning() << "QtLocalPeer: Message reception failed" << socket->errorString(); + qWarning("QtLocalPeer: Message reception failed %s", socket->errorString().toLatin1().constData()); delete socket; return; } diff -Nru cb2bib-1.4.9/src/qtsingleapplication/src/qtlocalpeer.h cb2bib-1.9.2/src/qtsingleapplication/src/qtlocalpeer.h --- cb2bib-1.4.9/src/qtsingleapplication/src/qtlocalpeer.h 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/src/qtsingleapplication/src/qtlocalpeer.h 2015-08-09 19:52:56.000000000 +0000 @@ -1,57 +1,51 @@ /**************************************************************************** ** -** This file is part of a Qt Solutions component. -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Solutions Commercial License Agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** Please note Third Party Software included with Qt Solutions may impose -** additional restrictions and it is the user's responsibility to ensure -** that they have met the licensing requirements of the GPL, LGPL, or Qt -** Solutions Commercial license and the relevant license of the Third -** Party Software they are using. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Solutions component. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** ****************************************************************************/ +#ifndef QTLOCALPEER_H +#define QTLOCALPEER_H -#include <QtNetwork/QLocalServer> -#include <QtNetwork/QLocalSocket> -#include <QtCore/QDir> +#include <QLocalServer> +#include <QLocalSocket> +#include <QDir> -namespace QtLP_Private { #include "qtlockedfile.h" -} class QtLocalPeer : public QObject { @@ -79,3 +73,5 @@ private: static const char* ack; }; + +#endif // QTLOCALPEER_H diff -Nru cb2bib-1.4.9/src/qtsingleapplication/src/qtlockedfile.cpp cb2bib-1.9.2/src/qtsingleapplication/src/qtlockedfile.cpp --- cb2bib-1.4.9/src/qtsingleapplication/src/qtlockedfile.cpp 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/src/qtsingleapplication/src/qtlockedfile.cpp 2015-08-09 19:52:56.000000000 +0000 @@ -1,47 +1,41 @@ /**************************************************************************** ** -** This file is part of a Qt Solutions component. -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Solutions Commercial License Agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** Please note Third Party Software included with Qt Solutions may impose -** additional restrictions and it is the user's responsibility to ensure -** that they have met the licensing requirements of the GPL, LGPL, or Qt -** Solutions Commercial license and the relevant license of the Third -** Party Software they are using. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Solutions component. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** ****************************************************************************/ #include "qtlockedfile.h" diff -Nru cb2bib-1.4.9/src/qtsingleapplication/src/qtlockedfile.h cb2bib-1.9.2/src/qtsingleapplication/src/qtlockedfile.h --- cb2bib-1.4.9/src/qtsingleapplication/src/qtlockedfile.h 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/src/qtsingleapplication/src/qtlockedfile.h 2015-08-09 19:52:56.000000000 +0000 @@ -1,58 +1,52 @@ /**************************************************************************** ** -** This file is part of a Qt Solutions component. -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Solutions Commercial License Agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** Please note Third Party Software included with Qt Solutions may impose -** additional restrictions and it is the user's responsibility to ensure -** that they have met the licensing requirements of the GPL, LGPL, or Qt -** Solutions Commercial license and the relevant license of the Third -** Party Software they are using. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Solutions component. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** ****************************************************************************/ #ifndef QTLOCKEDFILE_H #define QTLOCKEDFILE_H -#include <QtCore/QFile> +#include <QFile> #ifdef Q_OS_WIN -#include <QtCore/QVector> +#include <QVector> #endif -#if defined(Q_WS_WIN) +#if defined(Q_OS_WIN) # if !defined(QT_QTLOCKEDFILE_EXPORT) && !defined(QT_QTLOCKEDFILE_IMPORT) # define QT_QTLOCKEDFILE_EXPORT # elif defined(QT_QTLOCKEDFILE_IMPORT) @@ -68,13 +62,15 @@ # define QT_QTLOCKEDFILE_EXPORT #endif +namespace QtLP_Private { + class QT_QTLOCKEDFILE_EXPORT QtLockedFile : public QFile { public: enum LockMode { NoLock = 0, ReadLock, WriteLock }; QtLockedFile(); - QtLockedFile(const QString &name); + explicit QtLockedFile(const QString &name); ~QtLockedFile(); bool open(OpenMode mode); @@ -97,5 +93,5 @@ #endif LockMode m_lock_mode; }; - +} #endif diff -Nru cb2bib-1.4.9/src/qtsingleapplication/src/qtlockedfile_unix.cpp cb2bib-1.9.2/src/qtsingleapplication/src/qtlockedfile_unix.cpp --- cb2bib-1.4.9/src/qtsingleapplication/src/qtlockedfile_unix.cpp 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/src/qtsingleapplication/src/qtlockedfile_unix.cpp 2015-08-09 19:52:56.000000000 +0000 @@ -1,47 +1,41 @@ /**************************************************************************** ** -** This file is part of a Qt Solutions component. -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Solutions Commercial License Agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** Please note Third Party Software included with Qt Solutions may impose -** additional restrictions and it is the user's responsibility to ensure -** that they have met the licensing requirements of the GPL, LGPL, or Qt -** Solutions Commercial license and the relevant license of the Third -** Party Software they are using. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Solutions component. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** ****************************************************************************/ #include <string.h> diff -Nru cb2bib-1.4.9/src/qtsingleapplication/src/qtlockedfile_win.cpp cb2bib-1.9.2/src/qtsingleapplication/src/qtlockedfile_win.cpp --- cb2bib-1.4.9/src/qtsingleapplication/src/qtlockedfile_win.cpp 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/src/qtsingleapplication/src/qtlockedfile_win.cpp 2015-08-09 19:52:56.000000000 +0000 @@ -1,57 +1,55 @@ /**************************************************************************** ** -** This file is part of a Qt Solutions component. -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Solutions Commercial License Agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** Please note Third Party Software included with Qt Solutions may impose -** additional restrictions and it is the user's responsibility to ensure -** that they have met the licensing requirements of the GPL, LGPL, or Qt -** Solutions Commercial license and the relevant license of the Third -** Party Software they are using. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Solutions component. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** ****************************************************************************/ #include "qtlockedfile.h" #include <qt_windows.h> -#include <QtCore/QFileInfo> +#include <QFileInfo> #define MUTEX_PREFIX "QtLockedFile mutex " // Maximum number of concurrent read locks. Must not be greater than MAXIMUM_WAIT_OBJECTS #define MAX_READERS MAXIMUM_WAIT_OBJECTS +#if QT_VERSION >= 0x050000 +#define QT_WA(unicode, ansi) unicode +#endif + Qt::HANDLE QtLockedFile::getMutexHandle(int idx, bool doCreate) { if (mutexname.isEmpty()) { diff -Nru cb2bib-1.4.9/src/qtsingleapplication/src/qtsingleapplication.cpp cb2bib-1.9.2/src/qtsingleapplication/src/qtsingleapplication.cpp --- cb2bib-1.4.9/src/qtsingleapplication/src/qtsingleapplication.cpp 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/src/qtsingleapplication/src/qtsingleapplication.cpp 2015-08-09 19:52:56.000000000 +0000 @@ -1,53 +1,47 @@ /**************************************************************************** ** -** This file is part of a Qt Solutions component. -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Solutions Commercial License Agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** Please note Third Party Software included with Qt Solutions may impose -** additional restrictions and it is the user's responsibility to ensure -** that they have met the licensing requirements of the GPL, LGPL, or Qt -** Solutions Commercial license and the relevant license of the Third -** Party Software they are using. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Solutions component. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** ****************************************************************************/ #include "qtsingleapplication.h" #include "qtlocalpeer.h" -#include <QtGui/QWidget> +#include <QWidget> /*! @@ -68,28 +62,31 @@ that will be compared instead. The application should create the QtSingleApplication object early - in the startup phase, and call isRunning() or sendMessage() to - find out if another instance of this application is already - running. Startup parameters (e.g. the name of the file the user - wanted this new instance to open) can be passed to the running - instance in the sendMessage() function. - - If isRunning() or sendMessage() returns false, it means that no - other instance is running, and this instance has assumed the role - as the running instance. The application should continue with the - initialization of the application user interface before entering - the event loop with exec(), as normal. The messageReceived() - signal will be emitted when the application receives messages from - another instance of the same application. - - If isRunning() or sendMessage() returns true, another instance is - already running, and the application should terminate or enter - client mode. - - If a message is received it might be helpful to the user to raise - the application so that it becomes visible. To facilitate this, - QtSingleApplication provides the setActivationWindow() function - and the activateWindow() slot. + in the startup phase, and call isRunning() to find out if another + instance of this application is already running. If isRunning() + returns false, it means that no other instance is running, and + this instance has assumed the role as the running instance. In + this case, the application should continue with the initialization + of the application user interface before entering the event loop + with exec(), as normal. + + The messageReceived() signal will be emitted when the running + application receives messages from another instance of the same + application. When a message is received it might be helpful to the + user to raise the application so that it becomes visible. To + facilitate this, QtSingleApplication provides the + setActivationWindow() function and the activateWindow() slot. + + If isRunning() returns true, another instance is already + running. It may be alerted to the fact that another instance has + started by using the sendMessage() function. Also data such as + startup parameters (e.g. the name of the file the user wanted this + new instance to open) can be passed to the running instance with + this function. Then, the application should terminate (or enter + client mode). + + If isRunning() returns true, but sendMessage() fails, that is an + indication that the running instance is frozen. Here's an example that shows how to convert an existing application to use QtSingleApplication. It is very simple and does @@ -103,7 +100,6 @@ QApplication app(argc, argv); MyMainWidget mmw; - mmw.show(); return app.exec(); } @@ -114,19 +110,17 @@ QtSingleApplication app(argc, argv); if (app.isRunning()) - return 0; + return !app.sendMessage(someDataString); MyMainWidget mmw; - app.setActivationWindow(&mmw); - mmw.show(); return app.exec(); } \endcode - Once this QtSingleApplication instance is destroyed(for example, - when the user quits), when the user next attempts to run the + Once this QtSingleApplication instance is destroyed (normally when + the process exits or crashes), when the user next attempts to run the application this instance will not, of course, be encountered. The next instance to call isRunning() or sendMessage() will assume the role as the new running instance. @@ -150,7 +144,7 @@ /*! Creates a QtSingleApplication object. The application identifier will be QCoreApplication::applicationFilePath(). \a argc, \a - argv, and \a GUIenabled are passed on to the QApplication constructor. + argv, and \a GUIenabled are passed on to the QAppliation constructor. If you are creating a console application (i.e. setting \a GUIenabled to false), you may consider using @@ -167,7 +161,7 @@ /*! Creates a QtSingleApplication object with the application identifier \a appId. \a argc and \a argv are passed on to the - QApplication constructor. + QAppliation constructor. */ QtSingleApplication::QtSingleApplication(const QString &appId, int &argc, char **argv) @@ -176,11 +170,12 @@ sysInit(appId); } +#if QT_VERSION < 0x050000 /*! Creates a QtSingleApplication object. The application identifier will be QCoreApplication::applicationFilePath(). \a argc, \a - argv, and \a type are passed on to the QApplication constructor. + argv, and \a type are passed on to the QAppliation constructor. */ QtSingleApplication::QtSingleApplication(int &argc, char **argv, Type type) : QApplication(argc, argv, type) @@ -189,7 +184,7 @@ } -#if defined(Q_WS_X11) +# if defined(Q_WS_X11) /*! Special constructor for X11, ref. the documentation of QApplication's corresponding constructor. The application identifier @@ -227,7 +222,8 @@ { sysInit(appId); } -#endif +# endif // Q_WS_X11 +#endif // QT_VERSION < 0x050000 /*! diff -Nru cb2bib-1.4.9/src/qtsingleapplication/src/qtsingleapplication.h cb2bib-1.9.2/src/qtsingleapplication/src/qtsingleapplication.h --- cb2bib-1.4.9/src/qtsingleapplication/src/qtsingleapplication.h 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/src/qtsingleapplication/src/qtsingleapplication.h 2015-08-09 19:52:56.000000000 +0000 @@ -1,55 +1,51 @@ /**************************************************************************** ** -** This file is part of a Qt Solutions component. -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Solutions Commercial License Agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** Please note Third Party Software included with Qt Solutions may impose -** additional restrictions and it is the user's responsibility to ensure -** that they have met the licensing requirements of the GPL, LGPL, or Qt -** Solutions Commercial license and the relevant license of the Third -** Party Software they are using. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Solutions component. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** ****************************************************************************/ +#ifndef QTSINGLEAPPLICATION_H +#define QTSINGLEAPPLICATION_H -#include <QtGui/QApplication> +#include <QApplication> class QtLocalPeer; -#if defined(Q_WS_WIN) +#if defined(Q_OS_WIN) # if !defined(QT_QTSINGLEAPPLICATION_EXPORT) && !defined(QT_QTSINGLEAPPLICATION_IMPORT) # define QT_QTSINGLEAPPLICATION_EXPORT # elif defined(QT_QTSINGLEAPPLICATION_IMPORT) @@ -72,12 +68,14 @@ public: QtSingleApplication(int &argc, char **argv, bool GUIenabled = true); QtSingleApplication(const QString &id, int &argc, char **argv); +#if QT_VERSION < 0x050000 QtSingleApplication(int &argc, char **argv, Type type); -#if defined(Q_WS_X11) +# if defined(Q_WS_X11) QtSingleApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0); QtSingleApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0); QtSingleApplication(Display* dpy, const QString &appId, int argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0); -#endif +# endif // Q_WS_X11 +#endif // QT_VERSION < 0x050000 bool isRunning(); QString id() const; @@ -103,3 +101,5 @@ QtLocalPeer *peer; QWidget *actWin; }; + +#endif // QTSINGLEAPPLICATION_H diff -Nru cb2bib-1.4.9/src/qtsingleapplication/src/qtsinglecoreapplication.cpp cb2bib-1.9.2/src/qtsingleapplication/src/qtsinglecoreapplication.cpp --- cb2bib-1.4.9/src/qtsingleapplication/src/qtsinglecoreapplication.cpp 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/src/qtsingleapplication/src/qtsinglecoreapplication.cpp 2015-08-09 19:52:56.000000000 +0000 @@ -1,47 +1,41 @@ /**************************************************************************** ** -** This file is part of a Qt Solutions component. -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Solutions Commercial License Agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** Please note Third Party Software included with Qt Solutions may impose -** additional restrictions and it is the user's responsibility to ensure -** that they have met the licensing requirements of the GPL, LGPL, or Qt -** Solutions Commercial license and the relevant license of the Third -** Party Software they are using. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Solutions component. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** ****************************************************************************/ @@ -73,7 +67,7 @@ /*! Creates a QtSingleCoreApplication object. The application identifier will be QCoreApplication::applicationFilePath(). \a argc and \a - argv are passed on to the QCoreApplication constructor. + argv are passed on to the QCoreAppliation constructor. */ QtSingleCoreApplication::QtSingleCoreApplication(int &argc, char **argv) @@ -87,7 +81,7 @@ /*! Creates a QtSingleCoreApplication object with the application identifier \a appId. \a argc and \a argv are passed on to the - QCoreApplication constructor. + QCoreAppliation constructor. */ QtSingleCoreApplication::QtSingleCoreApplication(const QString &appId, int &argc, char **argv) : QCoreApplication(argc, argv) diff -Nru cb2bib-1.4.9/src/qtsingleapplication/src/qtsinglecoreapplication.h cb2bib-1.9.2/src/qtsingleapplication/src/qtsinglecoreapplication.h --- cb2bib-1.4.9/src/qtsingleapplication/src/qtsinglecoreapplication.h 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/src/qtsingleapplication/src/qtsinglecoreapplication.h 2015-08-09 19:52:56.000000000 +0000 @@ -1,51 +1,47 @@ /**************************************************************************** ** -** This file is part of a Qt Solutions component. -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Solutions Commercial License Agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** Please note Third Party Software included with Qt Solutions may impose -** additional restrictions and it is the user's responsibility to ensure -** that they have met the licensing requirements of the GPL, LGPL, or Qt -** Solutions Commercial license and the relevant license of the Third -** Party Software they are using. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Solutions component. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** ****************************************************************************/ +#ifndef QTSINGLECOREAPPLICATION_H +#define QTSINGLECOREAPPLICATION_H -#include <QtCore/QCoreApplication> +#include <QCoreApplication> class QtLocalPeer; @@ -71,3 +67,5 @@ private: QtLocalPeer* peer; }; + +#endif // QTSINGLECOREAPPLICATION_H diff -Nru cb2bib-1.4.9/src/src.pro cb2bib-1.9.2/src/src.pro --- cb2bib-1.4.9/src/src.pro 2012-11-04 17:03:28.000000000 +0000 +++ cb2bib-1.9.2/src/src.pro 2015-08-09 19:52:56.000000000 +0000 @@ -119,36 +119,22 @@ findDialog.cpp \ main.cpp TEMPLATE = app -QT += network +QT += widgets network CONFIG += LIBS += -lc2b -LIBPATH += . +QMAKE_LIBDIR += . INCLUDEPATH += c2b . DEFINES += C2B_USE_QMAKE -QTVERSION = $$[QT_VERSION] -contains(QTVERSION, 4\.3.*) { - message(Using Qt < 4.4 --> Added xml libs) - QT += xml -} else { - exists($$[QT_INSTALL_HEADERS]/QtWebKit/qwebview.h) { - message(Using Qt > 4.4 --> Added webkit libs) - QT += webkit - CONFIG += use_webkit - } -} -QTWEBKIT_HEADERS = /usr/include/QtWebKit -exists($$QTWEBKIT_HEADERS/qwebview.h) { - message(Using webkit header files --> $$QTWEBKIT_HEADERS) - LIBS += -lQtWebKit - INCLUDEPATH += $$QTWEBKIT_HEADERS - CONFIG += use_webkit -} + +CONFIG += use_webkit use_webkit { message(The cb2Bib will be linked against webkit library) HEADERS += c2bAnnote.h c2bWebBrowser.h SOURCES += c2bAnnote.cpp c2bWebBrowser.cpp DEFINES += C2B_USE_WEBKIT + QT += webkitwidgets } + CONFIG += use_lzo use_lzo { LIBS += -llzo2 @@ -160,12 +146,13 @@ DEFINES -= C2B_USE_LZO } unix { + QT += x11extras LIBS += -lX11 } TARGET = cb2bib DESTDIR = ../bin DEPENDPATH += . -TARGETDEPS += libc2b.a +POST_TARGETDEPS += libc2b.a QMAKE_CXXFLAGS_DEBUG += -DC2B_DEBUG DEFINES += C2B_USE_CBPOLL disable_cbpoll { diff -Nru cb2bib-1.4.9/src/win/main.cpp cb2bib-1.9.2/src/win/main.cpp --- cb2bib-1.4.9/src/win/main.cpp 2012-11-04 17:04:40.000000000 +0000 +++ cb2bib-1.9.2/src/win/main.cpp 2015-08-09 19:58:26.414734493 +0000 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2004-2012 by Pere Constans + * Copyright (C) 2004-2015 by Pere Constans * constans@molspaces.com - * cb2Bib version 1.4.9. Licensed under the GNU GPL version 3. + * cb2Bib version 1.9.2. Licensed under the GNU GPL version 3. * See the LICENSE file that comes with this distribution. ***************************************************************************/ #include <QFileInfo> diff -Nru cb2bib-1.4.9/xpdf/COPYING3 cb2bib-1.9.2/xpdf/COPYING3 --- cb2bib-1.4.9/xpdf/COPYING3 1970-01-01 00:00:00.000000000 +0000 +++ cb2bib-1.9.2/xpdf/COPYING3 2015-08-09 19:52:56.000000000 +0000 @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff -Nru cb2bib-1.4.9/xpdf/HTMLGen.cc cb2bib-1.9.2/xpdf/HTMLGen.cc --- cb2bib-1.4.9/xpdf/HTMLGen.cc 1970-01-01 00:00:00.000000000 +0000 +++ cb2bib-1.9.2/xpdf/HTMLGen.cc 2015-08-09 19:52:56.000000000 +0000 @@ -0,0 +1,223 @@ +//======================================================================== +// +// Modified pdftohtml (constans@molspaces.com, 2014) +// +// HTMLGen.cc +// +// Copyright 2010 Glyph & Cog, LLC +// +//======================================================================== + +#include <aconf.h> + +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + +#include <stdlib.h> + +#include "gmem.h" +#include "GString.h" +#include "GList.h" +#include "PDFDoc.h" +#include "TextOutputDev.h" +#include "SplashOutputDev.h" +#include "ErrorCodes.h" + +#include "HTMLGen.h" + +#ifdef _WIN32 +# define strcasecmp stricmp +# define strncasecmp strnicmp +#endif + +//------------------------------------------------------------------------ + +// Map Unicode indexes from the private use area, following the Adobe +// Glyph list. +#define privateUnicodeMapStart 0xf6f9 +#define privateUnicodeMapEnd 0xf7ff +static int +privateUnicodeMap[privateUnicodeMapEnd - privateUnicodeMapStart + 1] = +{ + 0x0141, 0x0152, 0, 0, 0x0160, 0, 0x017d, // f6f9 + 0, 0, 0, 0, 0, 0, 0, 0, // f700 + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, // f710 + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0x0021, 0, 0, 0x0024, 0, 0x0026, 0, // f720 + 0, 0, 0, 0, 0, 0, 0, 0, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, // f730 + 0x0038, 0x0039, 0, 0, 0, 0, 0, 0x003f, + 0, 0, 0, 0, 0, 0, 0, 0, // f740 + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, // f750 + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, // f760 + 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, // f770 + 0x0058, 0x0059, 0x005a, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, // f780 + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, // f790 + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0x00a1, 0x00a2, 0, 0, 0, 0, 0, // f7a0 + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, // f7b0 + 0, 0, 0, 0, 0, 0, 0, 0x00bf, + 0, 0, 0, 0, 0, 0, 0, 0, // f7c0 + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, // f7d0 + 0, 0, 0, 0, 0, 0, 0, 0, + 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, // f7e0 + 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, + 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0, // f7f0 + 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x0178 +}; + +//------------------------------------------------------------------------ + + + +//------------------------------------------------------------------------ + +HTMLGen::HTMLGen() +{ + TextOutputControl textOutControl; + SplashColor paperColor; + + ok = gTrue; + + backgroundResolution = 150; + drawInvisibleText = gTrue; + + // set up the TextOutputDev + textOutControl.mode = textOutReadingOrder; + textOutControl.html = gTrue; + textOut = new TextOutputDev(NULL, &textOutControl, gFalse); + if (!textOut->isOk()) + { + ok = gFalse; + } + + // set up the SplashOutputDev + paperColor[0] = paperColor[1] = paperColor[2] = 0xff; + splashOut = new SplashOutputDev(splashModeRGB8, 1, gFalse, paperColor); + splashOut->setSkipText(gTrue, gFalse); +} + +HTMLGen::~HTMLGen() +{ + delete textOut; + delete splashOut; +} + +void HTMLGen::startDoc(PDFDoc* docA) +{ + doc = docA; + splashOut->startDoc(doc->getXRef()); +} + +int HTMLGen::convertPage(int pg, int (*writeHTML)(void* stream, const char* data, int size), void* htmlStream) +{ + TextPage* text; + GList* cols, *pars, *lines, *words; + TextColumn* col; + TextParagraph* par; + TextLine* line; + TextWord* word1; + GString* s; + double base; + int colIdx, parIdx, lineIdx, wordIdx; + int i, u; + const char parsep('\n'); + + // get the PDF text + doc->displayPage(textOut, pg, 72, 72, 0, gFalse, gTrue, gFalse); + text = textOut->takeText(); + + // generate the PDF text + cols = text->makeColumns(); + for (colIdx = 0; colIdx < cols->getLength(); ++colIdx) + { + col = (TextColumn*)cols->get(colIdx); + pars = col->getParagraphs(); + for (parIdx = 0; parIdx < pars->getLength(); ++parIdx) + { + par = (TextParagraph*)pars->get(parIdx); + lines = par->getLines(); + for (lineIdx = 0; lineIdx < lines->getLength(); ++lineIdx) + { + line = (TextLine*)lines->get(lineIdx); + words = line->getWords(); + base = line->getBaseline(); + s = new GString(); + for (wordIdx = 0; wordIdx < words->getLength(); ++wordIdx) + { + word1 = (TextWord*)words->get(wordIdx); + if (word1->getBaseline() - base < -0.55) + s->append(' '); // superscript + for (i = 0; i < word1->getLength(); ++i) + { + u = word1->getChar(i); + if (u >= privateUnicodeMapStart && + u <= privateUnicodeMapEnd && + privateUnicodeMap[u - privateUnicodeMapStart]) + { + u = privateUnicodeMap[u - privateUnicodeMapStart]; + } + if (u <= 0x7f) + { + s->append((char)u); + } + else if (u <= 0x7ff) + { + s->append((char)(0xc0 + (u >> 6))); + s->append((char)(0x80 + (u & 0x3f))); + } + else if (u <= 0xffff) + { + s->append((char)0xe0 + (u >> 12)); + s->append((char)0x80 + ((u >> 6) & 0x3f)); + s->append((char)0x80 + (u & 0x3f)); + } + else if (u <= 0x1fffff) + { + s->append((char)0xf0 + (u >> 18)); + s->append((char)0x80 + ((u >> 12) & 0x3f)); + s->append((char)0x80 + ((u >> 6) & 0x3f)); + s->append((char)0x80 + (u & 0x3f)); + } + else if (u <= 0x3ffffff) + { + s->append((char)0xf8 + (u >> 24)); + s->append((char)0x80 + ((u >> 18) & 0x3f)); + s->append((char)0x80 + ((u >> 12) & 0x3f)); + s->append((char)0x80 + ((u >> 6) & 0x3f)); + s->append((char)0x80 + (u & 0x3f)); + } + else if (u <= 0x7fffffff) + { + s->append((char)0xfc + (u >> 30)); + s->append((char)0x80 + ((u >> 24) & 0x3f)); + s->append((char)0x80 + ((u >> 18) & 0x3f)); + s->append((char)0x80 + ((u >> 12) & 0x3f)); + s->append((char)0x80 + ((u >> 6) & 0x3f)); + s->append((char)0x80 + (u & 0x3f)); + } + } + if (word1->getSpaceAfter()) + s->append(' '); + } + s->append('\n'); + writeHTML(htmlStream, s->getCString(), s->getLength()); + delete s; + } + writeHTML(htmlStream, &parsep, 1); + } + } + delete text; + deleteGList(cols, TextColumn); + + return errNone; +} diff -Nru cb2bib-1.4.9/xpdf/HTMLGen.h cb2bib-1.9.2/xpdf/HTMLGen.h --- cb2bib-1.4.9/xpdf/HTMLGen.h 1970-01-01 00:00:00.000000000 +0000 +++ cb2bib-1.9.2/xpdf/HTMLGen.h 2015-08-09 19:52:56.000000000 +0000 @@ -0,0 +1,62 @@ +//======================================================================== +// +// Modified pdftohtml (constans@molspaces.com, 2014) +// +// HTMLGen.h +// +// Copyright 2010 Glyph & Cog, LLC +// +//======================================================================== + +#ifndef HTMLGEN_H +#define HTMLGEN_H + +#include <aconf.h> + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +class PDFDoc; +class TextOutputDev; +class SplashOutputDev; + +//------------------------------------------------------------------------ + +class HTMLGen +{ +public: + + HTMLGen(); + ~HTMLGen(); + + GBool isOk() const + { + return ok; + } + + GBool getDrawInvisibleText() const + { + return drawInvisibleText; + } + void setDrawInvisibleText(GBool drawInvisibleTextA) + { + drawInvisibleText = drawInvisibleTextA; + } + + void startDoc(PDFDoc* docA); + int convertPage(int pg, int (*writeHTML)(void* stream, const char* data, int size), void* htmlStream); + +private: + + double backgroundResolution; + GBool drawInvisibleText; + + PDFDoc* doc; + TextOutputDev* textOut; + SplashOutputDev* splashOut; + + GBool ok; +}; + +#endif diff -Nru cb2bib-1.4.9/xpdf/PDF2CB.README cb2bib-1.9.2/xpdf/PDF2CB.README --- cb2bib-1.4.9/xpdf/PDF2CB.README 1970-01-01 00:00:00.000000000 +0000 +++ cb2bib-1.9.2/xpdf/PDF2CB.README 2015-08-09 19:52:56.000000000 +0000 @@ -0,0 +1,20 @@ + +pdf2cb: a modified pdftohtml 3.04 for cb2bib + +. Separate superscripts to avoid words being joined to reference numbers and + author names joined to affiliations' glyphs. + + +Download ftp://ftp.foolabs.com/pub/xpdf/xpdf-3.04.tar.gz + +Copy/Overwrite: +cp pdftohtml.cc xpdf-3.04/xpdf/ +cp HTMLGen.cc xpdf-3.04/xpdf/ +cp HTMLGen.h xpdf-3.04/xpdf/ + +cd xpdf-3.04/ +./configure +make + +Rename modified pdftohtml: +mv xpdf/pdftohtml ../pdf2cb diff -Nru cb2bib-1.4.9/xpdf/pdftohtml.cc cb2bib-1.9.2/xpdf/pdftohtml.cc --- cb2bib-1.4.9/xpdf/pdftohtml.cc 1970-01-01 00:00:00.000000000 +0000 +++ cb2bib-1.9.2/xpdf/pdftohtml.cc 2015-08-09 19:52:56.000000000 +0000 @@ -0,0 +1,207 @@ +//======================================================================== +// +// Modified pdftohtml (constans@molspaces.com, 2014) +// +// pdftohtml.cc +// +// Copyright 2005 Glyph & Cog, LLC +// +//======================================================================== + +#include <aconf.h> +#include <stdio.h> +#include <stdlib.h> +#include "parseargs.h" +#include "gmem.h" +#include "gfile.h" +#include "GString.h" +#include "GlobalParams.h" +#include "PDFDoc.h" +#include "HTMLGen.h" +#include "Error.h" +#include "ErrorCodes.h" +#include "config.h" + +//------------------------------------------------------------------------ + +static int firstPage = 1; +static int lastPage = 0; +static GBool skipInvisible = gFalse; +static char ownerPassword[33] = "\001"; +static char userPassword[33] = "\001"; +static GBool quiet = gFalse; +static char cfgFileName[256] = ""; +static GBool printVersion = gFalse; +static GBool printHelp = gFalse; + +static ArgDesc argDesc[] = +{ + { + "-f", argInt, &firstPage, 0, "first page to convert" + }, + { + "-l", argInt, &lastPage, 0, "last page to convert" + }, + { + "-skipinvisible", argFlag, &skipInvisible, 0, "do not draw invisible text" + }, + { + "-opw", argString, ownerPassword, sizeof(ownerPassword), "owner password (for encrypted files)" + }, + { + "-upw", argString, userPassword, sizeof(userPassword), "user password (for encrypted files)" + }, + { + "-q", argFlag, &quiet, 0, "don't print any messages or errors" + }, + { + "-cfg", argString, cfgFileName, sizeof(cfgFileName), "configuration file to use in place of .xpdfrc" + }, + { + "-v", argFlag, &printVersion, 0, "print copyright and version info" + }, + { + "-h", argFlag, &printHelp, 0, "print usage information" + }, + { + "-help", argFlag, &printHelp, 0, "print usage information" + }, + { + "--help", argFlag, &printHelp, 0, "print usage information" + }, + { + "-?", argFlag, &printHelp, 0, "print usage information" + }, + {NULL} +}; + +//------------------------------------------------------------------------ + +static int writeToFile(void* file, const char* data, int size) +{ + return (int)fwrite(data, 1, size, (FILE*)file); +} + +int main(int argc, char* argv[]) +{ + PDFDoc* doc; + GString* fileName; + GString* ownerPW, *userPW; + HTMLGen* htmlGen; + GString* htmlFileName; + FILE* htmlFile; + int pg, err, exitCode; + GBool ok; + + exitCode = 99; + + // parse args + ok = parseArgs(argDesc, &argc, argv); + if (!ok || argc != 3 || printVersion || printHelp) + { + fprintf(stderr, "\npdf2cb (a modified pdftohtml version %s for cb2bib)\n", xpdfVersion); + fprintf(stderr, "\n%s\n", xpdfCopyright); + if (!printVersion) + { + printUsage("pdf2cb", "<PDF-file> <TXT-file>", argDesc); + } + goto err0; + } + fileName = new GString(argv[1]); + htmlFileName = new GString(argv[2]); + + // read config file + globalParams = new GlobalParams(cfgFileName); + if (quiet) + { + globalParams->setErrQuiet(quiet); + } + globalParams->setupBaseFonts(NULL); + globalParams->setTextEncoding("UTF-8"); + + // open PDF file + if (ownerPassword[0] != '\001') + ownerPW = new GString(ownerPassword); + else + ownerPW = NULL; + if (userPassword[0] != '\001') + userPW = new GString(userPassword); + else + userPW = NULL; + doc = new PDFDoc(fileName, ownerPW, userPW); + if (userPW) + delete userPW; + if (ownerPW) + delete ownerPW; + if (!doc->isOk()) + { + exitCode = 1; + goto err1; + } + + // check for copy permission + if (!doc->okToCopy()) + { + error(errNotAllowed, -1, "Copying of text from this document is not allowed."); + exitCode = 3; + goto err1; + } + + // get page range + if (firstPage < 1) + { + firstPage = 1; + } + if (lastPage < 1 || lastPage > doc->getNumPages()) + { + lastPage = doc->getNumPages(); + } + + // set up the HTMLGen object + htmlGen = new HTMLGen(); + if (!htmlGen->isOk()) + { + exitCode = 99; + goto err1; + } + htmlGen->setDrawInvisibleText(!skipInvisible); + htmlGen->startDoc(doc); + + if (!(htmlFile = fopen(htmlFileName->getCString(), "wb"))) + { + error(errIO, -1, "Couldn't open TXT file '{0:t}'", htmlFileName); + goto err2; + } + + // convert the pages + for (pg = firstPage; pg <= lastPage; ++pg) + { + err = htmlGen->convertPage(pg, writeToFile, htmlFile); + + if (err != errNone) + { + error(errIO, -1, "Error converting page {0:d}", pg); + exitCode = 2; + goto err2; + } + } + + fclose(htmlFile); + + exitCode = 0; + + // clean up +err2: + delete htmlFileName; + delete htmlGen; +err1: + delete doc; + delete globalParams; +err0: + + // check for memory leaks + Object::memCheck(stderr); + gMemReport(stderr); + + return exitCode; +} diff -Nru cb2bib-1.4.9/xpdf/README cb2bib-1.9.2/xpdf/README --- cb2bib-1.4.9/xpdf/README 1970-01-01 00:00:00.000000000 +0000 +++ cb2bib-1.9.2/xpdf/README 2015-08-09 19:52:56.000000000 +0000 @@ -0,0 +1,432 @@ +Xpdf +==== + +version 3.04 +2014-may-28 + +The Xpdf software and documentation are +copyright 1996-2014 Glyph & Cog, LLC. + +Email: derekn@foolabs.com +WWW: http://www.foolabs.com/xpdf/ + +The PDF data structures, operators, and specification are +copyright 1985-2006 Adobe Systems Inc. + + +What is Xpdf? +------------- + +Xpdf is an open source viewer for Portable Document Format (PDF) +files. (These are also sometimes also called 'Acrobat' files, from +the name of Adobe's PDF software.) The Xpdf project also includes a +PDF text extractor, PDF-to-PostScript converter, and various other +utilities. + +Xpdf runs under the X Window System on UNIX and OS/2. The non-X +components (pdftops, pdftotext, etc.) also run on Windows and Mac OSX +systems and should run on pretty much any system with a decent C++ +compiler. Xpdf will run on 32-bit and 64-bit machines. + + +License & Distribution +---------------------- + +Xpdf is licensed under the GNU General Pulbic License (GPL), version 2 +or 3. This means that you can distribute derivatives of Xpdf under +any of the following: + - GPL v2 only + - GPL v3 only + - GPL v2 or v3 + +The Xpdf source package includes the text of both GPL versions: +COPYING for GPL v2, COPYING3 for GPL v3. + +Please note that Xpdf is NOT licensed under "any later version" of the +GPL, as I have no idea what those versions will look like. + +If you are redistributing unmodified copies of Xpdf (or any of the +Xpdf tools) in binary form, you need to include all of the +documentation: README, man pages (or help files), COPYING, and +COPYING3. + +If you want to incorporate the Xpdf source code into another program +(or create a modified version of Xpdf), and you are distributing that +program, you have two options: release your program under the GPL (v2 +and/or v3), or purchase a commercial Xpdf source license. + +If you're interested in commercial licensing, please see the Glyph & +Cog web site: + + http://www.glyphandcog.com/ + + +Compatibility +------------- + +Xpdf is developed and tested on Linux. + +In addition, it has been compiled by others on Solaris, AIX, HP-UX, +Digital Unix, Irix, and numerous other Unix implementations, as well +as OS/2. It should work on pretty much any system which runs X11 and +has Unix-like libraries. You'll need ANSI C++ and C compilers to +compile it. + +The non-X components of Xpdf (pdftops, pdftotext, pdfinfo, pdffonts, +pdfdetach, pdftoppm, and pdfimages) can also be compiled on Windows +and Mac OSX systems. See the Xpdf web page for details. + +If you compile Xpdf for a system not listed on the web page, please +let me know. If you're willing to make your binary available by ftp +or on the web, I'll be happy to add a link from the Xpdf web page. I +have decided not to host any binaries I didn't compile myself (for +disk space and support reasons). + +If you can't get Xpdf to compile on your system, send me email and +I'll try to help. + +Xpdf has been ported to the Acorn, Amiga, BeOS, and EPOC. See the +Xpdf web page for links. + + +Getting Xpdf +------------ + +The latest version is available from: + + http://www.foolabs.com/xpdf/ + +or: + + ftp://ftp.foolabs.com/pub/xpdf/ + +Source code and several precompiled executables are available. + +Announcements of new versions are posted to comp.text.pdf and emailed +to a list of people. If you'd like to receive email notification of +new versions, just let me know. + + +Running Xpdf +------------ + +To run xpdf, simply type: + + xpdf file.pdf + +To generate a PostScript file, hit the "print" button in xpdf, or run +pdftops: + + pdftops file.pdf + +To generate a plain text file, run pdftotext: + + pdftotext file.pdf + +There are five additional utilities (which are fully described in +their man pages): + + pdfinfo -- dumps a PDF file's Info dictionary (plus some other + useful information) + pdffonts -- lists the fonts used in a PDF file along with various + information for each font + pdfdetach -- lists or extracts embedded files (attachments) from a + PDF file + pdftoppm -- converts a PDF file to a series of PPM/PGM/PBM-format + bitmaps + pdfimages -- extracts the images from a PDF file + +Command line options and many other details are described in the man +pages: xpdf(1), etc. + +All of these utilities read an optional configuration file: see the +xpdfrc(5) man page. + + +Upgrading from Xpdf 3.02 (and earlier) +-------------------------------------- + +The font configuration system has been changed. Previous versions +used mostly separate commands to configure fonts for display and for +PostScript output. As of 3.03, configuration options that make sense +for both display and PS output have been unified. + +The following xpdfrc commands have been removed: +* displayFontT1, displayFontTT: replaced with fontFile +* displayNamedCIDFontT1, displayNamedCIDFontTT: replaced with fontFile +* displayCIDFontT1, displayCIDFontTT: replaced with fontFileCC +* psFont: replaced with psResidentFont +* psNamedFont16: replaced with psResidentFont16 +* psFont16: replaced with psResidentFontCC + +See the xpdfrc(5) man page for more information on the new commands. + +Pdftops will now embed external 16-bit fonts (configured with the +fontFileCC command) when the PDF file refers to a non-embedded font. +It does not do any subsetting (yet), so the resulting PS files will be +large. + + +Compiling Xpdf +-------------- + +See the separate file, INSTALL. + + +Bugs +---- + +If you find a bug in Xpdf, i.e., if it prints an error message, +crashes, or incorrectly displays a document, and you don't see that +bug listed here, please send me email, with a pointer (URL, ftp site, +etc.) to the PDF file. + + +Third-Party Libraries +--------------------- + +Xpdf uses the following libraries: +* FreeType [http://www.freetype.org/] +* libpng [http://www.libpng.com/pub/png/libpng.html] (used by pdftohtml) +* zlib [http://zlib.net/] (used by pdftohtml) + + +Acknowledgments +--------------- + +Thanks to: + +* Patrick Voigt for help with the remote server code. +* Patrick Moreau, Martin P.J. Zinser, and David Mathog for the VMS + port. +* David Boldt and Rick Rodgers for sample man pages. +* Brendan Miller for the icon idea. +* Olly Betts for help testing pdftotext. +* Peter Ganten for the OS/2 port. +* Michael Richmond for the Win32 port of pdftops and pdftotext and the + xpdf/cygwin/XFree86 build instructions. +* Frank M. Siegert for improvements in the PostScript code. +* Leo Smiers for the decryption patches. +* Rainer Menzner for creating t1lib, and for helping me adapt it to + xpdf. +* Pine Tree Systems A/S for funding the OPI and EPS support in + pdftops. +* Easy Software Products for funding several improvements to the + PostScript output code. +* Tom Kacvinsky for help with FreeType and for being my interface to + the FreeType team. +* Theppitak Karoonboonyanan for help with Thai support. +* Leonard Rosenthol for help and contributions on a bunch of things. +* Alexandros Diamantidis and Maria Adaloglou for help with Greek + support. +* Lawrence Lai for help with the CJK Unicode maps. + +Various people have contributed modifications made for use by the +pdftex project: + +* Han The Thanh +* Martin Schröder of ArtCom GmbH + + +References +---------- + +Adobe Systems Inc., _PDF Reference, sixth edition: Adobe Portable +Document Format version 1.7_. +http://www.adobe.com/devnet/pdf/pdf_reference.html +[The manual for PDF version 1.7.] + +Adobe Systems Inc., "Errata for the PDF Reference, sixth edition, +version 1.7", October 16, 2006. +http://www.adobe.com/devnet/pdf/pdf_reference.html +[The errata for the PDF 1.7 spec.] + +Adobe Systems Inc., _PostScript Language Reference_, 3rd ed. +Addison-Wesley, 1999, ISBN 0-201-37922-8. +[The official PostScript manual.] + +Adobe Systems, Inc., _The Type 42 Font Format Specification_, +Adobe Developer Support Technical Specification #5012. 1998. +http://partners.adobe.com/asn/developer/pdfs/tn/5012.Type42_Spec.pdf +[Type 42 is the format used to embed TrueType fonts in PostScript +files.] + +Adobe Systems, Inc., _Adobe CMap and CIDFont Files Specification_, +Adobe Developer Support Technical Specification #5014. 1995. +http://www.adobe.com/supportservice/devrelations/PDFS/TN/5014.CIDFont_Spec.pdf +[CMap file format needed for Japanese and Chinese font support.] + +Adobe Systems, Inc., _Adobe-Japan1-4 Character Collection for +CID-Keyed Fonts_, Adobe Developer Support Technical Note #5078. +2000. +http://partners.adobe.com/asn/developer/PDFS/TN/5078.CID_Glyph.pdf +[The Adobe Japanese character set.] + +Adobe Systems, Inc., _Adobe-GB1-4 Character Collection for +CID-Keyed Fonts_, Adobe Developer Support Technical Note #5079. +2000. +http://partners.adobe.com/asn/developer/pdfs/tn/5079.Adobe-GB1-4.pdf +[The Adobe Chinese GB (simplified) character set.] + +Adobe Systems, Inc., _Adobe-CNS1-3 Character Collection for +CID-Keyed Fonts_, Adobe Developer Support Technical Note #5080. +2000. +http://partners.adobe.com/asn/developer/PDFS/TN/5080.CNS_CharColl.pdf +[The Adobe Chinese CNS (traditional) character set.] + +Adobe Systems Inc., _Supporting the DCT Filters in PostScript Level +2_, Adobe Developer Support Technical Note #5116. 1992. +http://www.adobe.com/supportservice/devrelations/PDFS/TN/5116.PS2_DCT.PDF +[Description of the DCTDecode filter parameters.] + +Adobe Systems Inc., _Open Prepress Interface (OPI) Specification - +Version 2.0_, Adobe Developer Support Technical Note #5660. 2000. +http://partners.adobe.com/asn/developer/PDFS/TN/5660.OPI_2.0.pdf + +Adobe Systems Inc., CMap files. +ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/ +[The actual CMap files for the 16-bit CJK encodings.] + +Adobe Systems Inc., Unicode glyph lists. +http://partners.adobe.com/asn/developer/type/unicodegn.html +http://partners.adobe.com/asn/developer/type/glyphlist.txt +http://partners.adobe.com/asn/developer/type/corporateuse.txt +http://partners.adobe.com/asn/developer/type/zapfdingbats.txt +[Mappings between character names to Unicode.] + +Adobe Systems Inc., OpenType Specification v. 1.4. +http://partners.adobe.com/public/developer/opentype/index_spec.html +[The OpenType font format spec.] + +Aldus Corp., _OPI: Open Prepress Interface Specification 1.3_. 1993. +http://partners.adobe.com/asn/developer/PDFS/TN/OPI_13.pdf + +Anonymous, RC4 source code. +ftp://ftp.ox.ac.uk/pub/crypto/misc/rc4.tar.gz +ftp://idea.sec.dsi.unimi.it/pub/crypt/code/rc4.tar.gz +[This is the algorithm used to encrypt PDF files.] + +T. Boutell, et al., "PNG (Portable Network Graphics) Specification, +Version 1.0". RFC 2083. +[PDF uses the PNG filter algorithms.] + +CCITT, "Information Technology - Digital Compression and Coding of +Continuous-tone Still Images - Requirements and Guidelines", CCITT +Recommendation T.81. +http://www.w3.org/Graphics/JPEG/ +[The official JPEG spec.] + +A. Chernov, "Registration of a Cyrillic Character Set". RFC 1489. +[Documentation for the KOI8-R Cyrillic encoding.] + +Roman Czyborra, "The ISO 8859 Alphabet Soup". +http://czyborra.com/charsets/iso8859.html +[Documentation on the various ISO 859 encodings.] + +L. Peter Deutsch, "ZLIB Compressed Data Format Specification version +3.3". RFC 1950. +[Information on the general format used in FlateDecode streams.] + +L. Peter Deutsch, "DEFLATE Compressed Data Format Specification +version 1.3". RFC 1951. +[The definition of the compression algorithm used in FlateDecode +streams.] + +Morris Dworkin, "Recommendation for Block Cipher Modes of Operation", +National Institute of Standards, NIST Special Publication 800-38A, +2001. +[The cipher block chaining (CBC) mode used with AES in PDF files.] + +Federal Information Processing Standards Publication 197 (FIPS PUBS +197), "Advanced Encryption Standard (AES)", November 26, 2001. +[AES encryption, used in PDF 1.6.] + +Jim Flowers, "X Logical Font Description Conventions", Version 1.5, X +Consortium Standard, X Version 11, Release 6.1. +ftp://ftp.x.org/pub/R6.1/xc/doc/hardcopy/XLFD/xlfd.PS.Z +[The official specification of X font descriptors, including font +transformation matrices.] + +Foley, van Dam, Feiner, and Hughes, _Computer Graphics: Principles and +Practice_, 2nd ed. Addison-Wesley, 1990, ISBN 0-201-12110-7. +[Colorspace conversion functions, Bezier spline math.] + +Robert L. Hummel, _Programmer's Technical Reference: Data and Fax +Communications_. Ziff-Davis Press, 1993, ISBN 1-56276-077-7. +[CCITT Group 3 and 4 fax decoding.] + +ISO/IEC, _Information technology -- Lossy/lossless coding of bi-level +images_. ISO/IEC 14492, First edition (2001-12-15). +http://webstore.ansi.org/ +[The official JBIG2 standard. The final draft of this spec is +available from http://www.jpeg.org/jbighomepage.html.] + +ISO/IEC, _Information technology -- JPEG 2000 image coding system -- +Part 1: Core coding system_. ISO/IEC 15444-1, First edition +(2000-12-15). +http://webstore.ansi.org/ +[The official JPEG 2000 standard. The final committee draft of this +spec is available from http://www.jpeg.org/JPEG2000.html, but there +were changes made to the bitstream format between that draft and the +published spec.] + +ITU, "Standardization of Group 3 facsimile terminals for document +transmission", ITU-T Recommendation T.4, 1999. +ITU, "Facsimile coding schemes and coding control functions for Group 4 +facsimile apparatus", ITU-T Recommendation T.6, 1993. +http://www.itu.int/ +[The official Group 3 and 4 fax standards - used by the CCITTFaxDecode +stream, as well as the JBIG2Decode stream.] + +B. Kaliski, "PKCS #5: Password-Based Cryptography Specification, +Version 2.0". RFC 2898. +[Defines the padding scheme used with AES encryption in PDF files.] + +Christoph Loeffler, Adriaan Ligtenberg, George S. Moschytz, "Practical +Fast 1-D DCT Algorithms with 11 Multiplications". IEEE Intl. Conf. on +Acoustics, Speech & Signal Processing, 1989, 988-991. +[The fast IDCT algorithm used in the DCTDecode filter.] + +Microsoft, _TrueType 1.0 Font Files_, rev. 1.66. 1995. +http://www.microsoft.com/typography/tt/tt.htm +[The TrueType font spec (in MS Word format, naturally).] + +V. Ostromoukhov, R.D. Hersch, "Stochastic Clustered-Dot Dithering", +Conf. Color Imaging: Device-Independent Color, Color Hardcopy, and +Graphic Arts IV, 1999, SPIE Vol. 3648, 496-505. +http://diwww.epfl.ch/w3lsp/publications/colour/scd.html +[The stochastic dithering algorithm used in Xpdf.] + +P. Peterlin, "ISO 8859-2 (Latin 2) Resources". +http://sizif.mf.uni-lj.si/linux/cee/iso8859-2.html +[This is a web page with all sorts of useful Latin-2 character set and +font information.] + +Charles Poynton, "Color FAQ". +http://www.inforamp.net/~poynton/ColorFAQ.html +[The mapping from the CIE 1931 (XYZ) color space to RGB.] + +R. Rivest, "The MD5 Message-Digest Algorithm". RFC 1321. +[MD5 is used in PDF document encryption.] + +Thai Industrial Standard, "Standard for Thai Character Codes for +Computers", TIS-620-2533 (1990). +http://www.nectec.or.th/it-standards/std620/std620.htm +[The TIS-620 Thai encoding.] + +Unicode Consortium, "Unicode Home Page". +http://www.unicode.org/ +[Online copy of the Unicode spec.] + +W3C Recommendation, "PNG (Portable Network Graphics) Specification +Version 1.0". +http://www.w3.org/Graphics/PNG/ +[Defines the PNG image predictor.] + +Gregory K. Wallace, "The JPEG Still Picture Compression Standard". +ftp://ftp.uu.net/graphics/jpeg/wallace.ps.gz +[Good description of the JPEG standard. Also published in CACM, April +1991, and submitted to IEEE Transactions on Consumer Electronics.] + +F. Yergeau, "UTF-8, a transformation format of ISO 10646". RFC 2279. +[A commonly used Unicode encoding.]