/usr/include/cwidget/fragment_cache.h is in libcwidget-dev 0.5.17-4ubuntu2.
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 | // fragment_cache.h -*-c++-*-
//
// Copyright (C) 2005 Daniel Burrows
//
// 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; see the file COPYING. If not, write to
// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
//
// A special fragment class that caches its contents.
#ifndef FRAGMENT_CACHE_H
#define FRAGMENT_CACHE_H
#include "fragment.h"
namespace cwidget
{
/** A fragment that caches its contents; a cached result is used if
* the same width is passed to the layout routine twice in a row.
* Obviously this should only be done if you know that the contents
* are static.
*/
class fragment_cache:public fragment
{
fragment *contents;
/** The last cached result. */
mutable fragment_contents cached_lines;
/** If cached_lines is valid, it was formatted in this style: */
mutable style cached_lines_style;
/** If cached_lines is valid, cached_lines was formatted for these
* widths.
*/
mutable size_t cached_lines_first_width, cached_lines_rest_width;
/** The cached max_width value. */
mutable size_t cached_max_width;
/** For what indents is cached_max_width valid? */
mutable size_t cached_max_width_first_indent, cached_max_width_rest_indent;
/** The cached trailing_width value. */
mutable size_t cached_trailing_width;
/** For what indents is cached_trailing_width valid? */
mutable size_t cached_trailing_width_first_indent, cached_trailing_width_rest_indent;
/** The cached final_newline value. */
mutable bool cached_final_nl:1;
/** If \b true, the corresponding property is valid. */
mutable bool cached_lines_valid:1, cached_max_width_valid:1;
/** If \b true, the corresponding property is valid. */
mutable bool cached_trailing_width_valid:1, cached_final_nl_valid:1;
public:
fragment_cache(fragment *_contents);
~fragment_cache();
void invalidate();
fragment_contents layout(size_t firstw, size_t restw,
const style &st);
void set_attr(int attr);
size_t max_width(size_t first_indent, size_t rest_indent) const;
size_t trailing_width(size_t first_indent, size_t rest_indent) const;
bool final_newline() const;
};
}
#endif
|