1
// -*- mode: C++; tab-width: 2; -*-
4
// --------------------------------------------------------------------------
5
// OpenMS Mass Spectrometry Framework
6
// --------------------------------------------------------------------------
7
// Copyright (C) 2003-2011 -- Oliver Kohlbacher, Knut Reinert
9
// This library is free software; you can redistribute it and/or
10
// modify it under the terms of the GNU Lesser General Public
11
// License as published by the Free Software Foundation; either
12
// version 2.1 of the License, or (at your option) any later version.
14
// This library is distributed in the hope that it will be useful,
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
// Lesser General Public License for more details.
19
// You should have received a copy of the GNU Lesser General Public
20
// License along with this library; if not, write to the Free Software
21
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
// --------------------------------------------------------------------------
24
// $Maintainer: Clemens Groepl,Andreas Bertsch$
26
// --------------------------------------------------------------------------
29
#include <OpenMS/FORMAT/FastaIteratorIntern.h>
30
#include <OpenMS/FORMAT/FASTAFile.h>
37
typedef std::pair<String,String> FASTAEntry;
39
FastaIteratorIntern::FastaIteratorIntern() :
44
FastaIteratorIntern::~FastaIteratorIntern()
49
FastaIteratorIntern::FastaIteratorIntern(const FastaIteratorIntern & source) :
51
fasta_file_(source.fasta_file_),
52
entrys_(source.entrys_),
58
FASTAEntry FastaIteratorIntern::operator*()
62
throw Exception::InvalidIterator(__FILE__, __LINE__, __PRETTY_FUNCTION__);
67
PepIterator & FastaIteratorIntern::operator++()
71
throw Exception::InvalidIterator(__FILE__, __LINE__, __PRETTY_FUNCTION__);
77
PepIterator * FastaIteratorIntern::operator++(int)
81
throw Exception::InvalidIterator(__FILE__, __LINE__, __PRETTY_FUNCTION__);
83
PepIterator * old = new FastaIteratorIntern (*this);
88
void FastaIteratorIntern::setFastaFile (const String & f)
92
std::vector<FASTAFile::FASTAEntry> entries;
94
ffile.load (f,entries);
96
entrys_.resize(entries.size(), std::make_pair("", ""));
97
for (Size i = 0; i < entries.size(); ++i)
99
entrys_[i].first = (entries[i].identifier + " " + entries[i].description);
100
entrys_[i].second = entries[i].sequence;
104
it_ = entrys_.begin();
107
String FastaIteratorIntern::getFastaFile ()
109
return (fasta_file_);
112
bool FastaIteratorIntern::begin ()
116
throw Exception::InvalidIterator(__FILE__, __LINE__, __PRETTY_FUNCTION__);
121
bool FastaIteratorIntern::isAtEnd ()
123
return (it_ == entrys_.end());