LCOV - code coverage report
Current view: top level - src/plugins/cpptemplate - cpptemplate_delegate.cpp (source / functions) Hit Total Coverage
Test: coverage-filtered.info Lines: 11 11 100.0 %
Date: 2019-09-12 12:28:41 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /**
       2             :  * @file
       3             :  *
       4             :  * @brief Delegate implementation for the `cpptemplate` plugin
       5             :  *
       6             :  * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
       7             :  *
       8             :  */
       9             : 
      10             : #include "cpptemplate_delegate.hpp"
      11             : 
      12             : using kdb::Key;
      13             : using kdb::KeySet;
      14             : 
      15             : namespace elektra
      16             : {
      17             : 
      18             : /**
      19             :  * @brief This constructor creates a new delegate object used by the `cpptemplate` plugin
      20             :  *
      21             :  * @param config This key set contains configuration values provided by the `cpptemplate` plugin
      22             :  */
      23          44 : CppTemplateDelegate::CppTemplateDelegate (KeySet config)
      24             : {
      25          22 :         configuration = config;
      26          22 : }
      27             : 
      28             : /**
      29             :  * @brief This method returns the configuration of the plugin, prefixing key names with the name of `parent`.
      30             :  *
      31             :  *  This is only an example to show you how to use the delegate. You can add any method you want here and then call it in
      32             :  *  `cpptemplate.cpp` via `delegator::get (handle)->functionName(parameter1, parameter2, …)`.
      33             :  *
      34             :  * @param parent This key specifies the name this function adds to the stored configuration values.
      35             :  *
      36             :  * @return A key set storing the configuration values of the plugin
      37             :  */
      38           3 : kdb::KeySet CppTemplateDelegate::getConfig (Key const & parent)
      39             : {
      40           3 :         KeySet keys{ 0, KS_END };
      41             : 
      42          36 :         for (auto configKey : configuration)
      43             :         {
      44          27 :                 Key key{ parent.getName (), KEY_END };
      45          18 :                 key.addBaseName (configKey.getBaseName ());
      46          27 :                 if (configKey.isString ()) key.setString (configKey.getString ());
      47           9 :                 keys.append (key);
      48             :         }
      49             : 
      50           3 :         return keys;
      51             : }
      52             : 
      53             : } // end namespace elektra

Generated by: LCOV version 1.13