LCOV - code coverage report
Current view: top level - src/bindings/cpp/examples - cpp_example_iter_name.cpp (source / functions) Hit Total Coverage
Test: coverage-filtered.info Lines: 0 24 0.0 %
Date: 2022-05-21 16:19:22 Functions: 0 1 0.0 %

          Line data    Source code
       1             : /**
       2             :  * @file
       3             :  *
       4             :  * @brief
       5             :  *
       6             :  * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
       7             :  */
       8             : 
       9             : #include <keyset.hpp>
      10             : 
      11             : #include <iostream>
      12             : 
      13           0 : int main ()
      14             : {
      15           0 :         using namespace kdb;
      16             : 
      17           0 :         Key k ("user:/name/a/very/long\\/name/to\\\\/iterate\\with\\/some\\\\\\/escaping", KEY_END);
      18             : 
      19           0 :         std::cout << "begin: " << *k.begin () << std::endl;
      20           0 :         std::cout << "end: " << *k.end () << std::endl;
      21             : 
      22           0 :         std::cout << "rbegin: " << *k.rbegin () << std::endl;
      23           0 :         std::cout << "rend: " << *k.rend () << std::endl;
      24             : 
      25           0 :         std::cout << "forward iterator: ";
      26           0 :         for (auto && elem : k)
      27             :         {
      28           0 :                 std::cout << elem << " ";
      29             :         }
      30           0 :         std::cout << std::endl;
      31             : 
      32           0 :         std::cout << "output reverse except first: ";
      33           0 :         for (Key::iterator i = --k.end (); i != k.begin (); --i)
      34             :         {
      35           0 :                 std::cout << *i << " ";
      36             :         }
      37           0 :         std::cout << std::endl;
      38             : 
      39           0 :         std::cout << "reverse iterator: ";
      40           0 :         for (Key::reverse_iterator i = k.rbegin (); i != k.rend (); ++i)
      41             :         {
      42           0 :                 std::cout << *i << " ";
      43             :         }
      44           0 :         std::cout << std::endl;
      45             : 
      46           0 :         std::cout << "output except first: ";
      47           0 :         for (Key::reverse_iterator i = --k.rend (); i != k.rbegin (); --i)
      48             :         {
      49           0 :                 std::cout << *i << " ";
      50             :         }
      51           0 :         std::cout << std::endl;
      52           0 : }

Generated by: LCOV version 1.13