LCOV - code coverage report
Current view: top level - src - BString.cpp (source / functions) Hit Total Coverage
Test: cpp-bencoding code coverage Lines: 13 13 100.0 %
Date: 2018-04-21 15:28:44 Functions: 6 6 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /**
       2             : * @file      BString.cpp
       3             : * @copyright (c) 2014 by Petr Zemek (s3rvac@gmail.com) and contributors
       4             : * @license   BSD, see the @c LICENSE file for more details
       5             : * @brief     Implementation of the BString class.
       6             : */
       7             : 
       8             : #include "BString.h"
       9             : 
      10             : #include "BItemVisitor.h"
      11             : 
      12             : namespace bencoding {
      13             : 
      14             : /**
      15             : * @brief Constructs the string with the given @a value.
      16             : */
      17          39 : BString::BString(ValueType value): _value(value) {}
      18             : 
      19             : /**
      20             : * @brief Creates and returns a new string.
      21             : */
      22          39 : std::unique_ptr<BString> BString::create(ValueType value) {
      23          39 :     return std::unique_ptr<BString>(new BString(value));
      24             : }
      25             : 
      26             : /**
      27             : * @brief Returns the string's value.
      28             : */
      29          76 : auto BString::value() const -> ValueType {
      30          76 :     return _value;
      31             : }
      32             : 
      33             : /**
      34             : * @brief Sets a new value.
      35             : */
      36           1 : void BString::setValue(ValueType value) {
      37           1 :     _value = value;
      38           1 : }
      39             : 
      40             : /**
      41             : * @brief Returns the number of characters in the string.
      42             : */
      43           8 : auto BString::length() const -> ValueType::size_type {
      44           8 :     return _value.length();
      45             : }
      46             : 
      47          16 : void BString::accept(BItemVisitor *visitor) {
      48          16 :     visitor->visit(this);
      49          16 : }
      50             : 
      51             : } // namespace bencoding

Generated by: LCOV version 1.13