LCOV - code coverage report
Current view: top level - libs/http/src/server - escape_html.cpp (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 0.0 % 25 0
Test Date: 2026-01-20 00:11:34 Functions: 0.0 % 1 0

            Line data    Source code
       1              : //
       2              : // Copyright (c) 2025 Vinnie Falco (vinnie dot falco at gmail dot com)
       3              : //
       4              : // Distributed under the Boost Software License, Version 1.0. (See accompanying
       5              : // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       6              : //
       7              : // Official repository: https://github.com/cppalliance/http
       8              : //
       9              : 
      10              : #include <boost/http/server/escape_html.hpp>
      11              : 
      12              : namespace boost {
      13              : namespace http {
      14              : 
      15              : std::string
      16            0 : escape_html( core::string_view s )
      17              : {
      18            0 :     std::string result;
      19            0 :     result.reserve( s.size() );
      20              : 
      21            0 :     for( char c : s )
      22              :     {
      23            0 :         switch( c )
      24              :         {
      25            0 :         case '&':
      26            0 :             result.append( "&amp;" );
      27            0 :             break;
      28            0 :         case '<':
      29            0 :             result.append( "&lt;" );
      30            0 :             break;
      31            0 :         case '>':
      32            0 :             result.append( "&gt;" );
      33            0 :             break;
      34            0 :         case '"':
      35            0 :             result.append( "&quot;" );
      36            0 :             break;
      37            0 :         case '\'':
      38            0 :             result.append( "&#39;" );
      39            0 :             break;
      40            0 :         default:
      41            0 :             result.push_back( c );
      42            0 :             break;
      43              :         }
      44              :     }
      45              : 
      46            0 :     return result;
      47            0 : }
      48              : 
      49              : } // http
      50              : } // boost
        

Generated by: LCOV version 2.3