2
#include "zipios-config.h"
14
// FIXME: make InvalidStateException message customized for
15
// subclasses. maybe make an InvalidStateException factory ;-)
17
ConstEntries FileCollection::entries() const {
19
throw InvalidStateException( "Attempt to get entries from an invalid FileCollection" ) ;
21
// The constructor below is not in all vector impl. (not those
22
// without member templates)
23
// ConstEntries ( _entries.begin(), _entries.end() ) ;
24
// Instead of using that we copy the vector manually
25
ConstEntries cep_vec ;
26
cep_vec.reserve( _entries.size() ) ;
27
Entries::const_iterator cit ;
28
for ( cit = _entries.begin() ; cit != _entries.end() ; ++cit )
29
cep_vec.push_back( *cit ) ;
34
ConstEntryPointer FileCollection::getEntry( const string &name,
35
MatchPath matchpath ) const {
37
throw InvalidStateException( "Attempt to get an entry from an invalid FileCollection" ) ;
39
Entries::const_iterator iter ;
40
if ( matchpath == MATCH )
41
iter = find_if( _entries.begin(), _entries.end(), FileEntry::MatchName( name ) ) ;
43
iter = find_if( _entries.begin(), _entries.end(), FileEntry::MatchFileName( name ) ) ;
44
if ( iter == _entries.end() )
50
string FileCollection::getName() const {
52
throw InvalidStateException( "Attempt to get the name of an invalid FileCollection" ) ;
57
int FileCollection::size() const {
59
throw InvalidStateException( "Attempt to get size of an invalid FileCollection" ) ;
60
return _entries.size() ;
63
FileCollection::~FileCollection() {
70
Implementation of FileCollection.
74
Zipios++ - a small C++ library that provides easy access to .zip files.
75
Copyright (C) 2000 Thomas Søndergaard
77
This library is free software; you can redistribute it and/or
78
modify it under the terms of the GNU Lesser General Public
79
License as published by the Free Software Foundation; either
80
version 2 of the License, or (at your option) any later version.
82
This library is distributed in the hope that it will be useful,
83
but WITHOUT ANY WARRANTY; without even the implied warranty of
84
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
85
Lesser General Public License for more details.
87
You should have received a copy of the GNU Lesser General Public
88
License along with this library; if not, write to the Free Software
89
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA