LibPkg
dirstream.h
Go to the documentation of this file.
1 // This file is part of LibPkg.
2 //
3 // Copyright 2003-2020 Graham Shaw
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 #ifndef LIBPKG_DIRSTREAM
18 #define LIBPKG_DIRSTREAM
19 
20 #include <string>
21 
22 namespace pkg {
23 
24 using std::string;
25 
27 class dirstream
28 {
29 public:
30  struct object;
31 private:
33  unsigned int _buffer_size;
34 
36  char* _buffer;
37 
39  int _offset;
40 
42  string _pathname;
43 
45  string _pattern;
46 
50  bool _buffer_full;
51 public:
56  dirstream(const string& pathname,const string& pattern="*");
57 
59  ~dirstream();
60 
64  operator bool();
65 
70  dirstream& operator>>(object& obj);
71 private:
73  void fill_buffer();
74 };
75 
77 {
79  unsigned long loadaddr;
81  unsigned long execaddr;
83  unsigned long length;
85  unsigned long attr;
87  unsigned long objtype;
89  unsigned long filetype;
91  string name;
92 };
93 
94 }; /* namespace pkg */
95 
96 #endif
unsigned long loadaddr
The load address.
Definition: dirstream.h:79
The namespace used to hold the package management library.
Definition: auto_dir.cc:23
unsigned long filetype
The file type.
Definition: dirstream.h:89
unsigned long attr
The file attributes.
Definition: dirstream.h:85
unsigned long execaddr
The execution address.
Definition: dirstream.h:81
unsigned long objtype
The object type.
Definition: dirstream.h:87
Definition: dirstream.h:76
~dirstream()
Destroy directory stream.
Definition: dirstream.cc:32
dirstream(const string &pathname, const string &pattern="*")
Construct directory stream.
Definition: dirstream.cc:23
A class for reading directories.
Definition: dirstream.h:27
dirstream & operator>>(object &obj)
Read file information.
Definition: dirstream.cc:43
string name
The object name.
Definition: dirstream.h:91
unsigned long length
The file length.
Definition: dirstream.h:83

Reference Manual LibPkg Version 0.9.0 (4 Sep 2020)