CPN
Computational Process Networks
Main Page
Namespaces
Classes
Files
File List
File Members
include
cpn
utils
Directory.h
Go to the documentation of this file.
1
//=============================================================================
2
// Computational Process Networks class library
3
// Copyright (C) 1997-2006 Gregory E. Allen and The University of Texas
4
//
5
// This library is free software; you can redistribute it and/or modify it
6
// under the terms of the GNU Library General Public License as published
7
// by the Free Software Foundation; either version 2 of the License, or
8
// (at your option) any later version.
9
//
10
// This library is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
// Library General Public License for more details.
14
//
15
// The GNU Public License is available in the file LICENSE, or you
16
// can write to the Free Software Foundation, Inc., 59 Temple Place -
17
// Suite 330, Boston, MA 02111-1307, USA, or you can find it on the
18
// World Wide Web at http://www.fsf.org.
19
//=============================================================================
23
#ifndef DIRECTORY_H
24
#define DIRECTORY_H
25
#pragma once
26
#include <
cpn/common.h
>
27
#include <string>
28
#include <sys/types.h>
29
#include <dirent.h>
30
#include <sys/stat.h>
31
#include <unistd.h>
32
33
class
Directory
{
34
public
:
35
Directory
(
const
std::string &dirname_);
36
37
~Directory
();
38
42
void
Rewind
();
43
48
bool
End
()
const
{
return
entry
== 0; }
49
53
std::string
BaseName
()
const
;
54
std::string
FullName
()
const
{
return
DirName
() +
"/"
+
BaseName
(); }
55
std::string
DirName
()
const
{
return
dirname
; }
56
60
void
Next
();
61
62
bool
IsDirectory
()
const
;
63
bool
IsRegularFile
()
const
;
64
std::size_t
Size
()
const
;
65
private
:
66
void
Stat
()
const
;
67
DIR *
dir
;
68
std::string
dirname
;
69
dirent *
entry
;
70
mutable
struct
stat
status
;
71
mutable
bool
stated
;
72
};
73
74
75
#endif
Directory::dirname
std::string dirname
Definition:
Directory.h:68
Directory::Size
std::size_t Size() const
Definition:
Directory.cc:64
Directory::End
bool End() const
Definition:
Directory.h:48
Directory
Definition:
Directory.h:33
Directory::Next
void Next()
Definition:
Directory.cc:45
Directory::status
struct stat status
Definition:
Directory.h:70
Directory::FullName
std::string FullName() const
Definition:
Directory.h:54
Directory::Stat
void Stat() const
Definition:
Directory.cc:69
Directory::BaseName
std::string BaseName() const
Definition:
Directory.cc:50
Directory::IsDirectory
bool IsDirectory() const
Definition:
Directory.cc:54
Directory::entry
dirent * entry
Definition:
Directory.h:69
Directory::stated
bool stated
Definition:
Directory.h:71
Directory::dir
DIR * dir
Definition:
Directory.h:67
Directory::Rewind
void Rewind()
Definition:
Directory.cc:41
common.h
Directory::Directory
Directory(const std::string &dirname_)
Definition:
Directory.cc:27
Directory::~Directory
~Directory()
Definition:
Directory.cc:37
Directory::DirName
std::string DirName() const
Definition:
Directory.h:55
Directory::IsRegularFile
bool IsRegularFile() const
Definition:
Directory.cc:59
Generated by
1.8.5