From 2a918d5fddebc445122e149b563d83cdb5f78514 Mon Sep 17 00:00:00 2001 From: shenleban tongying Date: Tue, 24 Sep 2024 21:29:59 -0400 Subject: [PATCH] refactor: reorganize dictionary processing related code --- CMakeLists.txt | 1 + src/dict/bgl.cc | 2 +- src/{ => dict}/btreeidx.cc | 0 src/{ => dict}/btreeidx.hh | 2 +- src/{ => dict}/chunkedstorage.cc | 0 src/{ => dict}/chunkedstorage.hh | 2 +- src/dict/lsa.cc | 2 +- src/dict/mdx.cc | 2 +- src/dict/sounddir.cc | 1 - src/{ => dict/utils}/decompress.cc | 0 src/{ => dict/utils}/decompress.hh | 0 src/{common/file.cc => dict/utils/dictfile.cc} | 2 +- src/{common/file.hh => dict/utils/dictfile.hh} | 0 src/{ => dict/utils}/dictzip.c | 2 +- src/{ => dict/utils}/dictzip.hh | 0 src/{ => dict/utils}/indexedzip.cc | 0 src/{ => dict/utils}/indexedzip.hh | 0 src/dict/{ => utils}/ripemd.cc | 0 src/dict/{ => utils}/ripemd.hh | 0 src/{ => dict/utils}/splitfile.cc | 0 src/{ => dict/utils}/splitfile.hh | 0 src/{common => dict/utils}/ufile.cc | 0 src/{common => dict/utils}/ufile.hh | 3 +++ src/{ => dict/utils}/zipfile.cc | 0 src/{ => dict/utils}/zipfile.hh | 0 src/dict/xdxf2html.cc | 2 +- src/dict/zim.cc | 2 +- src/dict/zipsounds.cc | 2 +- src/ftshelpers.cc | 2 +- 29 files changed, 15 insertions(+), 12 deletions(-) rename src/{ => dict}/btreeidx.cc (100%) rename src/{ => dict}/btreeidx.hh (99%) rename src/{ => dict}/chunkedstorage.cc (100%) rename src/{ => dict}/chunkedstorage.hh (99%) rename src/{ => dict/utils}/decompress.cc (100%) rename src/{ => dict/utils}/decompress.hh (100%) rename src/{common/file.cc => dict/utils/dictfile.cc} (99%) rename src/{common/file.hh => dict/utils/dictfile.hh} (100%) rename src/{ => dict/utils}/dictzip.c (99%) rename src/{ => dict/utils}/dictzip.hh (100%) rename src/{ => dict/utils}/indexedzip.cc (100%) rename src/{ => dict/utils}/indexedzip.hh (100%) rename src/dict/{ => utils}/ripemd.cc (100%) rename src/dict/{ => utils}/ripemd.hh (100%) rename src/{ => dict/utils}/splitfile.cc (100%) rename src/{ => dict/utils}/splitfile.hh (100%) rename src/{common => dict/utils}/ufile.cc (100%) rename src/{common => dict/utils}/ufile.hh (91%) rename src/{ => dict/utils}/zipfile.cc (100%) rename src/{ => dict/utils}/zipfile.hh (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index a32127df..3e26f8aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -167,6 +167,7 @@ target_include_directories(${GOLDENDICT} PRIVATE ${PROJECT_SOURCE_DIR}/src/ ${PROJECT_SOURCE_DIR}/src/common ${PROJECT_SOURCE_DIR}/src/dict + ${PROJECT_SOURCE_DIR}/src/dict/utils ${PROJECT_SOURCE_DIR}/src/ui ) diff --git a/src/dict/bgl.cc b/src/dict/bgl.cc index 09c52919..a0784beb 100644 --- a/src/dict/bgl.cc +++ b/src/dict/bgl.cc @@ -5,7 +5,7 @@ #include "bgl_babylon.hh" #include "btreeidx.hh" #include "chunkedstorage.hh" -#include "file.hh" +#include "dictfile.hh" #include "folding.hh" #include "ftshelpers.hh" #include "gddebug.hh" diff --git a/src/btreeidx.cc b/src/dict/btreeidx.cc similarity index 100% rename from src/btreeidx.cc rename to src/dict/btreeidx.cc diff --git a/src/btreeidx.hh b/src/dict/btreeidx.hh similarity index 99% rename from src/btreeidx.hh rename to src/dict/btreeidx.hh index 21ff0579..b029adcd 100644 --- a/src/btreeidx.hh +++ b/src/dict/btreeidx.hh @@ -5,7 +5,7 @@ #define __BTREEIDX_HH_INCLUDED__ #include "dict/dictionary.hh" -#include "file.hh" +#include "dictfile.hh" #include #include diff --git a/src/chunkedstorage.cc b/src/dict/chunkedstorage.cc similarity index 100% rename from src/chunkedstorage.cc rename to src/dict/chunkedstorage.cc diff --git a/src/chunkedstorage.hh b/src/dict/chunkedstorage.hh similarity index 99% rename from src/chunkedstorage.hh rename to src/dict/chunkedstorage.hh index 29705b49..7d231f2c 100644 --- a/src/chunkedstorage.hh +++ b/src/dict/chunkedstorage.hh @@ -5,7 +5,7 @@ #define __CHUNKEDSTORAGE_HH_INCLUDED__ #include "ex.hh" -#include "file.hh" +#include "dictfile.hh" #include #include diff --git a/src/dict/lsa.cc b/src/dict/lsa.cc index 4874a97f..9c56a422 100644 --- a/src/dict/lsa.cc +++ b/src/dict/lsa.cc @@ -2,7 +2,7 @@ * Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */ #include "lsa.hh" -#include "file.hh" +#include "dictfile.hh" #include "iconv.hh" #include "folding.hh" #include "utf8.hh" diff --git a/src/dict/mdx.cc b/src/dict/mdx.cc index 689cae2d..75938d92 100644 --- a/src/dict/mdx.cc +++ b/src/dict/mdx.cc @@ -5,7 +5,7 @@ #include "btreeidx.hh" #include "folding.hh" #include "utf8.hh" -#include "file.hh" +#include "dictfile.hh" #include "wstring.hh" #include "wstring_qt.hh" #include "chunkedstorage.hh" diff --git a/src/dict/sounddir.cc b/src/dict/sounddir.cc index f6d38f9b..b2001b34 100644 --- a/src/dict/sounddir.cc +++ b/src/dict/sounddir.cc @@ -2,7 +2,6 @@ * Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */ #include "sounddir.hh" -#include "file.hh" #include "folding.hh" #include "utf8.hh" #include "btreeidx.hh" diff --git a/src/decompress.cc b/src/dict/utils/decompress.cc similarity index 100% rename from src/decompress.cc rename to src/dict/utils/decompress.cc diff --git a/src/decompress.hh b/src/dict/utils/decompress.hh similarity index 100% rename from src/decompress.hh rename to src/dict/utils/decompress.hh diff --git a/src/common/file.cc b/src/dict/utils/dictfile.cc similarity index 99% rename from src/common/file.cc rename to src/dict/utils/dictfile.cc index 6c542bbc..d0beb319 100644 --- a/src/common/file.cc +++ b/src/dict/utils/dictfile.cc @@ -1,7 +1,7 @@ /* This file is (c) 2008-2012 Konstantin Isakov * Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */ -#include "file.hh" +#include "dictfile.hh" #include "zipfile.hh" diff --git a/src/common/file.hh b/src/dict/utils/dictfile.hh similarity index 100% rename from src/common/file.hh rename to src/dict/utils/dictfile.hh diff --git a/src/dictzip.c b/src/dict/utils/dictzip.c similarity index 99% rename from src/dictzip.c rename to src/dict/utils/dictzip.c index 60496075..36712458 100644 --- a/src/dictzip.c +++ b/src/dict/utils/dictzip.c @@ -1,4 +1,4 @@ -/* Made up from data.c and other supplementary files of dictd-1.0.11 for the +/* Made up from data.c and other supplementary files of dictd-1.11.0 for the * GoldenDict program. */ diff --git a/src/dictzip.hh b/src/dict/utils/dictzip.hh similarity index 100% rename from src/dictzip.hh rename to src/dict/utils/dictzip.hh diff --git a/src/indexedzip.cc b/src/dict/utils/indexedzip.cc similarity index 100% rename from src/indexedzip.cc rename to src/dict/utils/indexedzip.cc diff --git a/src/indexedzip.hh b/src/dict/utils/indexedzip.hh similarity index 100% rename from src/indexedzip.hh rename to src/dict/utils/indexedzip.hh diff --git a/src/dict/ripemd.cc b/src/dict/utils/ripemd.cc similarity index 100% rename from src/dict/ripemd.cc rename to src/dict/utils/ripemd.cc diff --git a/src/dict/ripemd.hh b/src/dict/utils/ripemd.hh similarity index 100% rename from src/dict/ripemd.hh rename to src/dict/utils/ripemd.hh diff --git a/src/splitfile.cc b/src/dict/utils/splitfile.cc similarity index 100% rename from src/splitfile.cc rename to src/dict/utils/splitfile.cc diff --git a/src/splitfile.hh b/src/dict/utils/splitfile.hh similarity index 100% rename from src/splitfile.hh rename to src/dict/utils/splitfile.hh diff --git a/src/common/ufile.cc b/src/dict/utils/ufile.cc similarity index 100% rename from src/common/ufile.cc rename to src/dict/utils/ufile.cc diff --git a/src/common/ufile.hh b/src/dict/utils/ufile.hh similarity index 91% rename from src/common/ufile.hh rename to src/dict/utils/ufile.hh index 0acee8bf..4435e3f4 100644 --- a/src/common/ufile.hh +++ b/src/dict/utils/ufile.hh @@ -1,6 +1,9 @@ #ifndef UFILE_HH_INCLUDED #define UFILE_HH_INCLUDED +// Don't use this thing. +// Use QFile instead. + #ifdef __WIN32 #include "zlib.h" diff --git a/src/zipfile.cc b/src/dict/utils/zipfile.cc similarity index 100% rename from src/zipfile.cc rename to src/dict/utils/zipfile.cc diff --git a/src/zipfile.hh b/src/dict/utils/zipfile.hh similarity index 100% rename from src/zipfile.hh rename to src/dict/utils/zipfile.hh diff --git a/src/dict/xdxf2html.cc b/src/dict/xdxf2html.cc index c51bdf9a..1a22767d 100644 --- a/src/dict/xdxf2html.cc +++ b/src/dict/xdxf2html.cc @@ -9,7 +9,7 @@ #include "folding.hh" #include "audiolink.hh" -#include "file.hh" +#include "dictfile.hh" #include "filetype.hh" #include "htmlescape.hh" #include "utils.hh" diff --git a/src/dict/zim.cc b/src/dict/zim.cc index 78a05048..89a1a3d3 100644 --- a/src/dict/zim.cc +++ b/src/dict/zim.cc @@ -11,7 +11,7 @@ #include "utf8.hh" #include "langcoder.hh" #include "filetype.hh" - #include "file.hh" + #include "dictfile.hh" #include "utils.hh" #include "tiff.hh" #include "ftshelpers.hh" diff --git a/src/dict/zipsounds.cc b/src/dict/zipsounds.cc index 61f60ef3..4fbe9d8e 100644 --- a/src/dict/zipsounds.cc +++ b/src/dict/zipsounds.cc @@ -2,7 +2,7 @@ * Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */ #include "zipsounds.hh" -#include "file.hh" +#include "dictfile.hh" #include "folding.hh" #include "utf8.hh" #include "btreeidx.hh" diff --git a/src/ftshelpers.cc b/src/ftshelpers.cc index 95e54713..6bcd65ab 100644 --- a/src/ftshelpers.cc +++ b/src/ftshelpers.cc @@ -6,7 +6,7 @@ #include "fulltextsearch.hh" #include "ftshelpers.hh" #include "wstring_qt.hh" -#include "file.hh" +#include "dictfile.hh" #include "gddebug.hh" #include "folding.hh" #include "utils.hh"