SpECTRE Documentation Coverage Report
Current view: top level - Utilities - MakeString.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 8.3 % 12 1
Test Date: 2026-10-22 17:29:42
Legend: Lines:     hit not hit

            Line data    Source code
       1            0 : // Distributed under the MIT License.
       2              : // See LICENSE.txt for details.
       3              : 
       4              : #pragma once
       5              : 
       6              : #include <ostream>
       7              : #include <sstream>
       8              : #include <string>
       9              : 
      10              : #include "Utilities/StlStreamDeclarations.hpp"
      11              : 
      12              : /*!
      13              :  * \ingroup UtilitiesGroup
      14              :  * \brief Make a string by streaming into object.
      15              :  *
      16              :  * \snippet Test_MakeString.cpp make_string
      17              :  */
      18            1 : class MakeString {
      19              :  public:
      20            0 :   MakeString() = default;
      21            0 :   MakeString(const MakeString&) = delete;
      22            0 :   MakeString& operator=(const MakeString&) = delete;
      23            0 :   MakeString(MakeString&&) = default;
      24            0 :   MakeString& operator=(MakeString&&) = delete;
      25            0 :   ~MakeString() = default;
      26              : 
      27              :   // NOLINTNEXTLINE(google-explicit-constructor)
      28              :   operator std::string() const { return stream_.str(); }
      29              : 
      30              :   template <class T>
      31            0 :   friend MakeString operator<<(MakeString&& ms, const T& t) {
      32              :     // clang-tidy: can get unintentional pointer casts
      33              :     ms.stream_ << t;  // NOLINT
      34              :     return std::move(ms);
      35              :   }
      36              : 
      37              :   template <class T>
      38            0 :   friend MakeString& operator<<(MakeString& ms, const T& t) {
      39              :     // clang-tidy: can get unintentional pointer casts
      40              :     ms.stream_ << t;  // NOLINT
      41              :     return ms;
      42              :   }
      43              : 
      44              :  private:
      45            0 :   std::stringstream stream_{};
      46              : };
      47              : 
      48            0 : inline std::ostream& operator<<(std::ostream& os, const MakeString& t) {
      49              :   return os << std::string{t};
      50              : }
        

Generated by: LCOV version 2.0-1