-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathXTBImageComplexIterator.cpp
51 lines (43 loc) · 1.24 KB
/
XTBImageComplexIterator.cpp
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
//
// XTBImageComplexIterator.cpp
// XTBook
//
// Created by Kawada Tomoaki on 8/1/11.
// Copyright 2011 Nexhawks. All rights reserved.
//
#include "XTBImageComplexIterator.h"
#include "XTBImageComplexDictionary.h"
#include "XTBIndexDBReader.h"
#include <tcw/twStrConv.h>
XTBImageComplexIterator::XTBImageComplexIterator(const XTBImageComplexDictionary *dictionary,
XTBIndexDBReader *index,
unsigned int lowerBound,
unsigned int upperBound):
m_lowerBound(lowerBound),
m_upperBound(upperBound),
m_dictionary(dictionary),
m_isCurrentResultValid(false),
m_pos(m_lowerBound),
m_index(index){}
XTBImageComplexIterator::~XTBImageComplexIterator(){
}
int XTBImageComplexIterator::resultCount() const{
return m_upperBound-m_lowerBound;
}
XTBDictionaryResult XTBImageComplexIterator::currentResult() const{
if(!m_isCurrentResultValid){
XTBIndexDBEntry entry=m_index->entryAtIndex(m_pos);
m_currentResult.key=twM2W(entry.key);
m_currentResult.title=twM2W(entry.title);
m_currentResult.dictionary=m_dictionary;
m_isCurrentResultValid=true;
}
return m_currentResult;
}
void XTBImageComplexIterator::next(){
m_pos++;
m_isCurrentResultValid=false;
}
bool XTBImageComplexIterator::isEOF(){
return m_pos>=m_upperBound;
}