QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgstextblock.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgstextblock.cpp
3  ---------------
4  begin : May 2020
5  copyright : (C) Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #include "qgstextblock.h"
17 #include "qgstextfragment.h"
18 
20 {
21  mFragments.append( fragment );
22 }
23 
24 void QgsTextBlock::append( const QgsTextFragment &fragment )
25 {
26  mFragments.append( fragment );
27 }
28 
30 {
31  mFragments.push_back( fragment );
32 }
33 
35 {
36  mFragments.clear();
37 }
38 
39 bool QgsTextBlock::empty() const
40 {
41  return mFragments.empty();
42 }
43 
44 int QgsTextBlock::size() const
45 {
46  return mFragments.size();
47 }
48 
49 const QgsTextFragment &QgsTextBlock::at( int index ) const
50 {
51  return mFragments.at( index );
52 }
53 
55 {
56  return mFragments[ index ];
57 }
58 
60 QVector< QgsTextFragment >::const_iterator QgsTextBlock::begin() const
61 {
62  return mFragments.begin();
63 }
64 
65 QVector< QgsTextFragment >::const_iterator QgsTextBlock::end() const
66 {
67  return mFragments.end();
68 }
QgsTextBlock::operator[]
QgsTextFragment & operator[](int index)
Returns the fragment at the specified index.
Definition: qgstextblock.cpp:54
qgstextfragment.h
QgsTextBlock::clear
void clear()
Clears the block, removing all its contents.
Definition: qgstextblock.cpp:34
QgsTextBlock::at
const QgsTextFragment & at(int index) const
Returns the fragment at the specified index.
Definition: qgstextblock.cpp:49
QgsTextBlock::size
int size() const
Returns the number of fragments in the block.
Definition: qgstextblock.cpp:44
QgsTextBlock::append
void append(const QgsTextFragment &fragment)
Appends a fragment to the block.
Definition: qgstextblock.cpp:24
QgsTextBlock::empty
bool empty() const
Returns true if the block is empty.
Definition: qgstextblock.cpp:39
QgsTextBlock::QgsTextBlock
QgsTextBlock()=default
Constructor for an empty text block.
QgsTextFragment
Definition: qgstextfragment.h:34
qgstextblock.h