LCOV - code coverage report
Current view: top level - source - Properties.cpp (source / functions) Hit Total Coverage
Test: LibForBES Unit Tests Lines: 20 21 95.2 %
Date: 2016-04-18 Functions: 6 6 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* 
       2             :  * File:   Properties.cpp
       3             :  * Author: Pantelis Sopasakis
       4             :  *
       5             :  * Created on March 4, 2016, 4:07 PM
       6             :  * 
       7             :  * ForBES is free software: you can redistribute it and/or modify
       8             :  * it under the terms of the GNU Lesser General Public License as published by
       9             :  * the Free Software Foundation, either version 3 of the License, or
      10             :  * (at your option) any later version.
      11             :  *  
      12             :  * ForBES is distributed in the hope that it will be useful,
      13             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      14             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      15             :  * GNU Lesser General Public License for more details.
      16             :  * 
      17             :  * You should have received a copy of the GNU Lesser General Public License
      18             :  * along with ForBES. If not, see <http://www.gnu.org/licenses/>.
      19             :  */
      20             : 
      21             : 
      22             : #include "Properties.h"
      23             : 
      24             : const int Properties::DOUBLE_TYPE = 1;
      25             : const int Properties::INT_TYPE = 2;
      26             : const int Properties::SIZE_T_TYPE = 3;
      27             : const int Properties::STRING_TYPE = 4;
      28             : const int Properties::VECTOR_TYPE = 100;
      29             : const int Properties::CUSTOM_TYPE = 666;
      30             : 
      31           4 : Properties::Properties() {
      32           4 :     init();
      33           4 : }
      34             : 
      35           7 : Properties::~Properties() {
      36           4 :     if (m_map != NULL) {
      37           4 :         delete m_map;
      38           4 :         m_map = NULL;
      39             :     }
      40           7 : }
      41             : 
      42           4 : void Properties::init() {
      43           4 :     m_map = new PropertiesMap;
      44           4 : }
      45             : 
      46             : 
      47           3 : bool Properties::get_typed_property(std::string key, int& type, void*& value) {
      48           3 :     PropertiesMap::iterator value_it = m_map->find(key);
      49           3 :     if (value_it != m_map->end()) {
      50           3 :         TypedPair value_found = value_it->second;
      51           3 :         type = value_found.first;
      52           3 :         value = value_found.second;
      53           3 :         return true;
      54             :     }    
      55           0 :     return false;
      56             : }
      57             : 
      58           1 : size_t Properties::size() {
      59           1 :     return m_map->size();
      60             : }
      61             : 
      62             : 
      63             : 
      64             : 
      65             : 

Generated by: LCOV version 1.10