File: cov_line.H

package info (click to toggle)
ggcov 0.9-14
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 4,400 kB
  • ctags: 4,055
  • sloc: cpp: 17,077; sh: 12,380; ansic: 7,743; php: 1,644; perl: 1,509; makefile: 259; yacc: 23
file content (88 lines) | stat: -rw-r--r-- 2,337 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
 * ggcov - A GTK frontend for exploring gcov coverage data
 * Copyright (c) 2003-2004 Greg Banks <gnb@users.sourceforge.net>
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef _ggcov_cov_line_H_
#define _ggcov_cov_line_H_ 1

#include "string_var.H"
#include "list.H"

class cov_file_t;
class cov_function_t;

class cov_line_t
{
public:

    count_t count()
    {
	if (!count_valid_)
    	    calculate_count();
	return count_;
    }

    cov::status_t status()
    {
	if (!count_valid_)
    	    calculate_count();
	return status_;
    }
    /* Check for suppression without the side effect of calculate_count() */
    gboolean is_suppressed() const
    {
	return (suppression_ != 0);
    }

    const list_t<cov_block_t> &blocks() const
    {
	return blocks_;
    }
    cov_function_t *function() const;
    
    static cov_line_t *find(const cov_location_t *);
    
    /*
     * Format a string compactly describing the list of blocks
     * on a particular line.  Used in the Source window and
     * for tggcov.  Width should be at least 8.
     */
    unsigned int format_blocks(char *buf, unsigned int maxlen);
    
    
private:
    cov_line_t();
    ~cov_line_t();
    static void remove(const cov_location_t *, cov_block_t *);
    void calculate_count();
    void suppress(const cov_suppression_t *);
    void finalise();

    list_t<cov_block_t> blocks_;
    boolean count_valid_;  /* covers status_, count_ */
    cov::status_t status_;
    count_t count_;
    const cov_suppression_t *suppression_;
    
    friend class cov_file_t;
    friend class cov_block_t;
    friend class cov_file_src_parser_t;
};


#endif /* _ggcov_cov_line_H_ */