A C++ implementation for interpreting MDX/MDD dictionary files. This library provides functionality to read and parse MDX/MDD dictionary files commonly used in electronic dictionaries.
- Parse MDX/MDD dictionary files
- Extract dictionary entries and definitions
- Support for both MDX (dictionary content) and MDD (resource files)
- Simple and efficient C++ implementation
- CMake (version 3.10 or higher)
- C++ compiler with C++17 support
- Git
- Clone the repository:
git clone [email protected]:dictlab/mdict-cpp.git
cd mdict-cpp
- Initialize and update submodules:
git submodule init
git submodule update --recursive
- Build the project:
mkdir build
cd build
cmake ..
make
To install the library system-wide (requires root privileges):
mkdir build
cd build
cmake -DINSTALL_TO_SYSTEM=ON ..
make
sudo make install
it will install those files:
-- Installing: /usr/local/lib/libmdict.a
-- Installing: /usr/local/lib/libmdictminiz.a
-- Installing: /usr/local/lib/libmdictbase64.a
-- Up-to-date: /usr/local/include/mdict/mdict.h
-- Up-to-date: /usr/local/include/mdict/mdict_extern.h
-- Installing: /usr/local/bin/mydict
This will install:
- The library to
/usr/lib
(Linux) or/usr/local/lib
(macOS/BSD) - Headers to
/usr/include
(Linux) or/usr/local/include
(macOS/BSD)
mkdir build
cd build
cmake ..
make mydict
The executable will be generated at build/bin/mydict
./build/bin/mydict your_mdx_file.mdx yourword
# output the resource binary as base64 format
./build/bin/mydict your_mdx_file.mdd \\xxx\\xx.png
# output the resource binary as hex string format
./build/bin/mydict -x your_mdx_file.mdd \\xxx\\xx.png
./build/bin/mydict -l your_mdx_file.mdx
./build/bin/mydict -l your_mdx_file.mdd
mkdir build
cd build
cmake ..
make mdict
The library will be generated at target/lib/libmdict.a
- Include the header files:
#include "mdict_extern.h"
- Link against the library:
target_link_libraries(your_project mdict)
# after make install
cd src
g++ -std=c++17 -I/usr/local/ -I. -L/usr/local/lib -lmdict -lmdictminiz -lmdictbase64 mydict.cc -o mmdict
The MDX/MDD file format is a dictionary format commonly used in electronic dictionaries. MDX files contain the dictionary content (text, HTML, etc.), while MDD files contain associated resources (images, audio, etc.).
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the BSD-3-Clause License - see the LICENSE file for details.