/usr/include/mimetic/os/file_iterator.h is in libmimetic-dev 0.9.7-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | /***************************************************************************
copyright : (C) 2002-2008 by Stefano Barbato
email : stefano@codesink.org
$Id: file_iterator.h,v 1.11 2008-10-27 18:30:42 tat Exp $
***************************************************************************/
#ifndef _MIMETIC_OS_FILE_ITERATOR_H_
#define _MIMETIC_OS_FILE_ITERATOR_H_
#include <string>
#include <iterator>
namespace mimetic
{
struct StdFile;
struct ifile_iterator: public std::iterator<std::input_iterator_tag, char>
{
ifile_iterator();
ifile_iterator(StdFile* f);
ifile_iterator(const ifile_iterator&);
ifile_iterator& operator=(const ifile_iterator&);
~ifile_iterator();
inline ifile_iterator& operator++();
inline ifile_iterator operator++(int);
inline reference operator*();
inline bool operator!=(const ifile_iterator& right) const;
inline bool operator==(const ifile_iterator& right) const;
private:
void cp(const ifile_iterator&);
void setBufsz();
enum { defBufsz = 4096 }; // default buffer size(4 missing getpagesize)
void underflow();
bool m_eof;
value_type* m_buf;
value_type* m_ptr;
int m_count;
StdFile* m_pFile;
unsigned int m_read; //bytes read so far
unsigned int m_bufsz;
};
inline
ifile_iterator ifile_iterator::operator++(int) // postfix
{
ifile_iterator cp = *this;
operator++();
return cp;
}
inline
ifile_iterator& ifile_iterator::operator++() // prefix
{
if(--m_count > 0)
++m_ptr;
else
underflow();
return *this;
}
inline
ifile_iterator::reference ifile_iterator::operator*()
{
return *m_ptr;
}
inline
bool ifile_iterator::operator!=(const ifile_iterator& right) const
{
// always different except when both are EOF
return !operator==(right);
}
inline
bool ifile_iterator::operator==(const ifile_iterator& right) const
{
// are equal if both are EOF
return (m_eof && right.m_eof);
}
}
#endif
|