diff options
author | Adrian Kummerlaender | 2017-10-06 22:07:52 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2017-10-06 23:30:00 +0200 |
commit | 574e79243648debf57a0d92653bd0df83398e772 (patch) | |
tree | f9ab6acc79cea0b4c6b5c569dd53999c80b9edb1 /example.cc | |
parent | 7f0c89c1890c662904bc6aa740a4515c2d5b595e (diff) | |
download | DictzipQuery-574e79243648debf57a0d92653bd0df83398e772.tar DictzipQuery-574e79243648debf57a0d92653bd0df83398e772.tar.gz DictzipQuery-574e79243648debf57a0d92653bd0df83398e772.tar.bz2 DictzipQuery-574e79243648debf57a0d92653bd0df83398e772.tar.lz DictzipQuery-574e79243648debf57a0d92653bd0df83398e772.tar.xz DictzipQuery-574e79243648debf57a0d92653bd0df83398e772.tar.zst DictzipQuery-574e79243648debf57a0d92653bd0df83398e772.zip |
Print all matching definitions in example
Diffstat (limited to 'example.cc')
-rw-r--r-- | example.cc | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -21,14 +21,14 @@ int main(int argc, char** argv) { if ( argc != 2 ) { std::cerr << "Empty query." << std::endl; } else { - // Get index entry of requested word definition - const std::string line = dictzip::get_line_starting_with("gcide.index", argv[1]); - - // Decode location in compressed archive - const std::size_t offset = dictzip::base64_decode(dictzip::get_encoded_offset(line)); - const std::size_t length = dictzip::base64_decode(dictzip::get_encoded_length(line)); - - // Print the GCIDE definition of _Accession_ - std::cout << get("gcide.dict.dz", offset, length) << std::endl; + // Get index entries of requested word definitions + for ( auto& line : dictzip::get_lines_starting_with("gcide.index", argv[1]) ) { + // Decode location in compressed archive + const std::size_t offset = dictzip::base64_decode(dictzip::get_encoded_offset(line)); + const std::size_t length = dictzip::base64_decode(dictzip::get_encoded_length(line)); + + // Print the GCIDE definition of _Accession_ + std::cout << get("gcide.dict.dz", offset, length) << std::endl; + } } } |