forked from pocoproject/poco
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirectoryIterator_VMS.cpp
More file actions
67 lines (51 loc) · 1.23 KB
/
DirectoryIterator_VMS.cpp
File metadata and controls
67 lines (51 loc) · 1.23 KB
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
//
// DirectoryIterator_VMS.cpp
//
// $Id: //poco/1.4/Foundation/src/DirectoryIterator_VMS.cpp#1 $
//
// Library: Foundation
// Package: Filesystem
// Module: DirectoryIterator
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#include "Poco/DirectoryIterator_VMS.h"
#include "Poco/Path.h"
#include "Poco/Exception.h"
#include <iodef.h>
#include <atrdef.h>
#include <fibdef.h>
#include <starlet.h>
namespace Poco {
DirectoryIteratorImpl::DirectoryIteratorImpl(const std::string& path): _rc(1)
{
Path p(path);
p.makeDirectory();
_search = p.toString();
_search.append("*.*;*");
_fab = cc$rms_fab;
_fab.fab$l_fna = (char*) _search.c_str();
_fab.fab$b_fns = _search.size();
_fab.fab$l_nam = &_nam;
_nam = cc$rms_nam;
_nam.nam$l_esa = _spec;
_nam.nam$b_ess = sizeof(_spec);
if (sys$parse(&_fab) & 1)
throw OpenFileException(path);
next();
}
DirectoryIteratorImpl::~DirectoryIteratorImpl()
{
}
const std::string& DirectoryIteratorImpl::next()
{
if (sys$search(&_fab) & 1)
_current.clear();
else
_current.assign(_fab.fab$l_nam->nam$l_name, _fab.fab$l_nam->nam$b_name + _fab.fab$l_nam->nam$b_type);
return _current;
}
} // namespace Poco