summaryrefslogtreecommitdiff
path: root/poppler-glib/src/layers_iter.hg
blob: 64df78ffb7eef816ad93aca4c03f483b9aa519ec (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
/* Copyright (c) 2010  Glenn Rice <glennricster@gmail.com>
 *
 * This file is part of poppler-glibmm.
 *
 * poppler-glibmm 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 2.1 of the License,
 * or (at your option) any later version.
 *
 * poppler-glibmm 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

_DEFS(poppler-glibmm,poppler-glib)
#include <poppler-glibmm/layer.h>
_CC_INCLUDE(poppler.h)

namespace Poppler
{

/** Poppler::LayersIter is used to iterate through the layers of a document
 */
class LayersIter
{
  _CLASS_BOXEDTYPE(LayersIter, PopplerLayersIter, NONE, poppler_layers_iter_copy, poppler_layers_iter_free)
  _IGNORE(poppler_layers_iter_copy, poppler_layers_iter_free)

  public:
    _WRAP_METHOD(LayersIter get_child() const, poppler_layers_iter_get_child)
    _WRAP_METHOD(Glib::RefPtr<Layer> get_layer() const, poppler_layers_iter_get_layer)
    _WRAP_METHOD(Glib::ustring get_title() const, poppler_layers_iter_get_title)
    _WRAP_METHOD(bool next() const, poppler_layers_iter_next)

    /** This typedef is just to make it more obvious that
     * our operator const void* should be used like operator bool().
     */
    typedef const void* BoolExpr;

    /** Tests whether the LayersIter is valid.
     * For instance,
     * @code
     * if (layers_iter) do_something()
     * @endcode
     */
    inline operator BoolExpr() const { return gobj() ? GINT_TO_POINTER(1) : 0; }
};

} // namespace Poppler