stamenStatic Menu Generator | 
          
| git clone git://git.dimitrijedobrota.com/stamen.git | 
| Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING | 
example_cpp.cpp (1047B)
    0 #include <iostream>
              1 #include <span>
          
              3 #include "demo_menu.hpp"
              4 #include "stamen/stamen.hpp"
          
              6 int test_display(const char* title, const stamen::item_t itemv[], size_t size)
              7 {
              8   const auto items = std::span(itemv, itemv + size);
          
             10   std::cout << title << std::endl;
             11   for (auto i = 0UL; i < size; i++)
             12   {
             13     std::cout << i + 1 << ": " << items[i].prompt << '\n';
             14   }
             15   std::cout << "Auto calling option 1...\n";
             16   items[1].callback(1);
             17   return 0;
             18 }
          
             20 int operation1(size_t /* unused */)
             21 {
             22   std::cout << "operation 1" << std::endl;
             23   std::cout << "Some operation is done" << std::endl;
             24   return 1;
             25 }
          
             27 int operation2(size_t /* unused */)
             28 {
             29   std::cout << "operation 2" << std::endl;
             30   std::cout << "Some other operation is done" << std::endl;
             31   return 1;
             32 }
          
             34 int operation3(size_t /* unused */)
             35 {
             36   std::cout << "operation 3" << std::endl;
             37   std::cout << "Yet another operation is done" << std::endl;
             38   return 1;
             39 }
          
             41 int finish(size_t /* unused */)
             42 {
             43   std::cout << "finishing..." << std::endl;
             44   exit(0);
             45 }
          
             47 int main()
             48 {
             49   menu_main(0);
             50   return 0;
             51 }