From 574e79243648debf57a0d92653bd0df83398e772 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Fri, 6 Oct 2017 22:07:52 +0200 Subject: Print all matching definitions in example --- example.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'example.cc') diff --git a/example.cc b/example.cc index af91d93..e42a7fb 100644 --- a/example.cc +++ b/example.cc @@ -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; + } } } -- cgit v1.2.3