1 /***********************************************************************
2  *
3  * Copyright (C) 2010 Graeme Gott <graeme@gottcode.org>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  *
18  ***********************************************************************/
19 
20 #include "deltas.h"
21 
22 #include "document.h"
23 
24 //-----------------------------------------------------------------------------
25 
Deltas(Document * document)26 Deltas::Deltas(Document* document)
27 	: m_document(document)
28 {
29 	refresh();
30 }
31 
32 //-----------------------------------------------------------------------------
33 
characterCount() const34 int Deltas::characterCount() const
35 {
36 	return m_document->characterCount() - m_character_count;
37 }
38 
39 //-----------------------------------------------------------------------------
40 
characterAndSpaceCount() const41 int Deltas::characterAndSpaceCount() const
42 {
43 	return m_document->characterAndSpaceCount() - m_character_and_space_count;
44 }
45 
46 //-----------------------------------------------------------------------------
47 
pageCount() const48 int Deltas::pageCount() const
49 {
50 	return m_document->pageCount() - m_page_count;
51 }
52 
53 //-----------------------------------------------------------------------------
54 
paragraphCount() const55 int Deltas::paragraphCount() const
56 {
57 	return m_document->paragraphCount() - m_paragraph_count;
58 }
59 
60 //-----------------------------------------------------------------------------
61 
wordCount() const62 int Deltas::wordCount() const
63 {
64 	return m_document->wordCount() - m_word_count;
65 }
66 
67 //-----------------------------------------------------------------------------
68 
refresh()69 void Deltas::refresh()
70 {
71 	m_character_count = m_document->characterCount();
72 	m_character_and_space_count = m_document->characterAndSpaceCount();
73 	m_page_count = m_document->pageCount();
74 	m_paragraph_count = m_document->paragraphCount();
75 	m_word_count = m_document->wordCount();
76 }
77 
78 //-----------------------------------------------------------------------------
79