1#
2# Copyright (C) 2016 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17
18class FileSummary(object):
19    """Summarizes structure and coverage information from GCC output.
20
21    Represents the data in .gcno and .gcda files.
22
23    Attributes:
24    functions: Dictionary of FunctionSummary objects for each function described
25        in a GCNO file (key: integer ident, value: FunctionSummary object)
26    """
27
28    def __init__(self):
29        """Inits the object with an empty list in its functions attribute.
30        """
31        self.functions = {}
32
33    def __str__(self):
34        """Serializes the summary as a string.
35
36        Returns:
37            String representation of the functions, blocks, arcs, and lines.
38        """
39        output = 'Coverage Summary:\r\n'
40        for ident in self.functions:
41            output += str(self.functions[ident])
42        return output
43