/* 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 #include _DEFS(pangomm,pango) 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 { _CLASS_GENERIC(AttrIter, PangoAttrIterator) _IGNORE(pango_attr_iterator_copy, pango_attr_iterator_destroy, pango_attr_iterator_next, pango_attr_iterator_get_font) 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 true if the iterator is valid. */ operator bool() const; /** The same as operator++(). * @return false if the end of the list is reached. */ bool next(); _WRAP_METHOD(void get_range(int& start, int& end) const, pango_attr_iterator_range) _WRAP_METHOD(Attribute get_attribute(AttrType type) const, pango_attr_iterator_get) /** 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; _IGNORE(pango_attr_iterator_get_attrs) 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