/usr/include/libabigail/abg-viz-svg.h is in libabigail-dev 1.0~rc6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | // -*- mode: C++ -*-
//
// Copyright (C) 2013-2015 Red Hat, Inc.
//
// This file is part of the GNU Application Binary Interface Generic
// Analysis and Instrumentation Library (libabigail). This library is
// free software; you can redistribute it and/or modify it under the
// terms of the GNU Lesser General Public License as published by the
// Free Software Foundation; either version 3, or (at your option) any
// later version.
// This library 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 Lesser Public License for more details.
// You should have received a copy of the GNU Lesser General Public
// License along with this program; see the file COPYING-LGPLV3. If
// not, see <http://www.gnu.org/licenses/>.
/// @file
#ifndef __ABG_VIZ_SVG_H__
#define __ABG_VIZ_SVG_H__
#include <abg-viz-common.h>
namespace abigail
{
/**
Row displaying one element of member data.
Wide open background spaces, what do they look like, what do the
things in the foreground look like? Rectangle, for one.
Some characteristics:
- horizontal label (text anchor = start ie left).
- background box
- text data (text anchor = middle ie centered).
*/
struct row
{
std::string _M_id;
const style& _M_style;
units_type _M_offset;
units_type _M_size;
units_type _M_align;
};
/// Useful row constants. Maybe just do enum->value map.
extern const style primary_row_sty;
extern const style base_row_sty;
extern const style member_row_sty;
extern const style implementation_row_sty;
/**
SVG "array" style notation for size/layout/alignment.
This is a compact SVG representation of class layout.
It is composed of a minimum of three data points for each member or
base of a class:
- offset index
- size
- align
Including annotations for holes, padding, and
implementation-specified and otherwise invisible objects.
It's constructed by creating vertical columns for each of the data
points specified above, and filling in horizontal rows for each of
the class components.
*/
struct svg
{
private:
const std::string _M_title;
const canvas& _M_canvas;
const typography& _M_typo;
const units_type _M_x_size = 3; // Number of columns
units_type _M_x_space; // Column spacing.
units_type _M_x_origin; // X origin
units_type _M_y_size; // Number of rows
units_type _M_y_space; // Row spacing.
units_type _M_y_origin; // Y origin
std::ostringstream _M_sstream;
// static const units_type _M_stroke_width = 1;
// static const units_type _M_text_padding = 10;
public:
svg(const std::string __title,
const canvas& __cv = ansi_letter_canvas,
const typography& __typo = arial_typo)
: _M_title(__title), _M_canvas(__cv), _M_typo(__typo), _M_y_size(0)
{
// Offsets require: typo, canvas units, size.
_M_x_space = 40;
_M_y_space = 40;
_M_x_origin = _M_x_space * 1;
_M_y_origin = _M_y_space * 2;
}
// Empty when the output buffer is.
bool
empty() { return _M_sstream.str().empty(); }
void
start_element();
void
finish_element();
void
add_title();
void
add_y_row(const row&);
void
add_y_lines();
void
add_y_label();
void
write();
void
start()
{
this->start_element();
this->add_title();
}
void
finish()
{
this->add_y_label();
this->add_y_lines();
this->finish_element();
this->write();
}
};
// XXX connect external xml file to input.
// parse input, pick apart elements, attributes.
}// end namespace abigail
#endif //__ABG_VIZ_SVG_H__
|