summaryrefslogtreecommitdiff
path: root/libs/gtkmm2/pango/pangomm/attriter.h
blob: ce654e92dd01af849d23f424967b2e40466f6167 (plain)
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
// -*- c++ -*-
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _PANGOMM_ATTRITER_H
#define _PANGOMM_ATTRITER_H

#include <glibmm.h>

/* attriter.h
 *
 * Copyright (C) 1998-1999 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <glibmm/slisthandle.h>
#include <pangomm/attributes.h>


namespace Pango
{

/** A Pango::AttrIter is used to represent an iterator through a Pango::AttrList.
 * A new iterator is created with Pango::AttrList::get_iter(). Once the iterator is created,
 * it can be advanced through the style changes in the text using Pango::AttrIter::next().
 * At each style change, the range of the current style segment and the attributes currently in effect can be queried.
 */
class AttrIter
{
  public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
  typedef AttrIter CppObjectType;
  typedef PangoAttrIterator BaseObjectType;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

private:

  
public:
  typedef std::forward_iterator_tag iterator_category;
  typedef int                       difference_type;

protected:
  AttrIter();

public:
  explicit AttrIter(PangoAttrIterator* castitem, bool take_copy=true);
  AttrIter(const AttrIter& src);

  ~AttrIter();

  AttrIter& operator=(const AttrIter& src);

  /** Advance the iterator until the next change of style.
   * The iterator becomes invalid if the end of the list is reached.
   * @return The iterator itself.
   */
  AttrIter&      operator++();

  const AttrIter operator++(int);

  /** Check whether the iterator is valid.
   * @return <tt>true</tt> if the iterator is valid.
   */
  operator bool() const;

  /** The same as operator++().
   * @return <tt>false</tt> if the end of the list is reached.
   */
  bool next();

  
  /** Get the range of the current segment.
   * @param start Location to store the start of the range.
   * @param end Location to store the end of the range.
   */
  void get_range(int& start, int& end) const;
  
  /** Find the current attribute of a particular type at the iterator
   * location. When multiple attributes of the same type overlap,
   * the attribute whose range starts closest to the current location
   * is used.
   * @param type The type of attribute to find.
   * @return The current attribute of the given type, or <tt>0</tt>
   * if no attribute of that type applies to the current
   * location.
   */
  Attribute get_attribute(AttrType type) const;

  /** Get the font description used at the current iterator position.
   * @return The font description used at the current iterator position.
   */
  FontDescription get_font_desc() const;

  /** Gets the language tag used at current iterator position.
   * @return The language tag or an empty Pango::Language object if non is found.
   */
  Language get_language() const;

  /** Gets a list of non-font attributes at the the current iterator position.
   * Only the highest priority value of each attribute will be added to this list.
   * @return The list of non-font attributes at the current iterator position.
   */
  SListHandle_Attribute get_extra_attrs() const;

  /** Gets a list all attributes a the current position of the
   * iterator.
   *
   * @result A list of all attributes for the current range.
   */
  SListHandle_Attribute get_attrs() const;
  

  PangoAttrIterator*       gobj()       { return gobject_; }
  const PangoAttrIterator* gobj() const { return gobject_; }

protected:
  PangoAttrIterator* gobject_;


};

} // namespace Pango


namespace Glib
{

/** @relates Pango::AttrIter */
Pango::AttrIter wrap(PangoAttrIterator* object, bool take_copy=false);

} // namespace Glib


#endif /* _PANGOMM_ATTRITER_H */