LCOV - code coverage report
Current view: top level - gcc/text-art - canvas.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 100.0 % 4 4
Test Date: 2024-05-11 15:19:56 Functions: - 0 0
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : /* Canvas for random-access procedural text art.
       2                 :             :    Copyright (C) 2023-2024 Free Software Foundation, Inc.
       3                 :             :    Contributed by David Malcolm <dmalcolm@redhat.com>.
       4                 :             : 
       5                 :             : This file is part of GCC.
       6                 :             : 
       7                 :             : GCC is free software; you can redistribute it and/or modify it
       8                 :             : under the terms of the GNU General Public License as published by
       9                 :             : the Free Software Foundation; either version 3, or (at your option)
      10                 :             : any later version.
      11                 :             : 
      12                 :             : GCC is distributed in the hope that it will be useful, but
      13                 :             : WITHOUT ANY WARRANTY; without even the implied warranty of
      14                 :             : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      15                 :             : General Public License for more details.
      16                 :             : 
      17                 :             : You should have received a copy of the GNU General Public License
      18                 :             : along with GCC; see the file COPYING3.  If not see
      19                 :             : <http://www.gnu.org/licenses/>.  */
      20                 :             : 
      21                 :             : #ifndef GCC_TEXT_ART_CANVAS_H
      22                 :             : #define GCC_TEXT_ART_CANVAS_H
      23                 :             : 
      24                 :             : #include "text-art/types.h"
      25                 :             : 
      26                 :             : namespace text_art {
      27                 :             : 
      28                 :             : class canvas;
      29                 :             : 
      30                 :             : /* A 2 dimensional grid of text cells (a "canvas"), which
      31                 :             :    can be written to ("painted") via random access, and then
      32                 :             :    written out to a pretty_printer once the picture is complete.
      33                 :             : 
      34                 :             :    Each text cell can be styled independently (colorization,
      35                 :             :    URLs, etc).  */
      36                 :             : 
      37                 :         293 : class canvas
      38                 :             : {
      39                 :             :  public:
      40                 :             :   typedef styled_unichar cell_t;
      41                 :             :   typedef size<class canvas> size_t;
      42                 :             :   typedef coord<class canvas> coord_t;
      43                 :             :   typedef range<class canvas> range_t;
      44                 :             :   typedef rect<class canvas> rect_t;
      45                 :             : 
      46                 :             :   canvas (size_t size, const style_manager &style_mgr);
      47                 :             : 
      48                 :         161 :   size_t get_size () const { return m_cells.get_size (); }
      49                 :             : 
      50                 :             :   void paint (coord_t coord, cell_t c);
      51                 :             :   void paint_text (coord_t coord, const styled_string &text);
      52                 :             : 
      53                 :             :   void fill (rect_t rect, cell_t c);
      54                 :             :   void debug_fill ();
      55                 :             : 
      56                 :             :   void print_to_pp (pretty_printer *pp,
      57                 :             :                     const char *per_line_prefix = NULL) const;
      58                 :             :   void debug (bool styled) const;
      59                 :             : 
      60                 :          60 :   const cell_t &get (coord_t coord) const
      61                 :             :   {
      62                 :          60 :     return m_cells.get (coord);
      63                 :             :   }
      64                 :             : 
      65                 :             :  private:
      66                 :             :   int get_final_x_in_row (int y) const;
      67                 :             : 
      68                 :             :   array2<cell_t, size_t, coord_t> m_cells;
      69                 :             :   const style_manager &m_style_mgr;
      70                 :             : };
      71                 :             : 
      72                 :             : } // namespace text_art
      73                 :             : 
      74                 :             : #endif /* GCC_TEXT_ART_CANVAS_H */
        

Generated by: LCOV version 2.1-beta

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.