Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Side by Side Diff: webrtc/base/fileutils.h

Issue 2898753002: ReadDirectory() added in webrtc/test/testsupport/fileutils.h (Closed)
Patch Set: add trailing sep char to dir paths Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/base/fileutils.cc » ('j') | webrtc/test/testsupport/fileutils.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 12 matching lines...) Expand all
23 23
24 #include "webrtc/base/checks.h" 24 #include "webrtc/base/checks.h"
25 #include "webrtc/base/constructormagic.h" 25 #include "webrtc/base/constructormagic.h"
26 #include "webrtc/base/platform_file.h" 26 #include "webrtc/base/platform_file.h"
27 27
28 namespace rtc { 28 namespace rtc {
29 29
30 class FileStream; 30 class FileStream;
31 class Pathname; 31 class Pathname;
32 32
33 //////////////////////////
34 // Directory Iterator //
35 //////////////////////////
36
37 // A DirectoryIterator is created with a given directory. It originally points 33 // A DirectoryIterator is created with a given directory. It originally points
38 // to the first file in the directory, and can be advanecd with Next(). This 34 // to the first file in the directory, and can be advanecd with Next(). This
39 // allows you to get information about each file. 35 // allows you to get information about each file.
40
41 class DirectoryIterator { 36 class DirectoryIterator {
42 friend class Filesystem; 37 friend class Filesystem;
43 public: 38 public:
44 // Constructor 39 // Constructor
45 DirectoryIterator(); 40 DirectoryIterator();
46 // Destructor 41 // Destructor
47 virtual ~DirectoryIterator(); 42 virtual ~DirectoryIterator();
48 43
49 // Starts traversing a directory 44 // Starts traversing a directory and returns true if the directory exists and
50 // dir is the directory to traverse 45 // is valid. |dir| is the directory to traverse. The iterator will point to
51 // returns true if the directory exists and is valid 46 // the first entry in the directory.
nisse-webrtc 2017/05/29 07:20:40 I don't think edits to the comments in this file r
AleBzk 2017/05/29 09:50:51 Acknowledged.
52 // The iterator will point to the first entry in the directory 47 virtual bool Iterate(const Pathname &dir);
53 virtual bool Iterate(const Pathname &path);
54 48
55 // Advances to the next file 49 // Advances to the next file and returns true if there were more files in the
56 // returns true if there were more files in the directory. 50 // directory.
57 virtual bool Next(); 51 virtual bool Next();
58 52
59 // returns true if the file currently pointed to is a directory 53 // Returns true if the file currently pointed to is a directory.
60 virtual bool IsDirectory() const; 54 virtual bool IsDirectory() const;
61 55
62 // returns the name of the file currently pointed to 56 // Returns the name of the file currently pointed to.
63 virtual std::string Name() const; 57 virtual std::string Name() const;
64 58
65 private: 59 private:
66 std::string directory_; 60 std::string directory_;
67 #if defined(WEBRTC_WIN) 61 #if defined(WEBRTC_WIN)
68 WIN32_FIND_DATA data_; 62 WIN32_FIND_DATA data_;
69 HANDLE handle_; 63 HANDLE handle_;
70 #else 64 #else
71 DIR *dir_; 65 DIR *dir_;
72 struct dirent *dirent_; 66 struct dirent *dirent_;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 private: 241 private:
248 static FilesystemInterface* default_filesystem_; 242 static FilesystemInterface* default_filesystem_;
249 243
250 static FilesystemInterface *EnsureDefaultFilesystem(); 244 static FilesystemInterface *EnsureDefaultFilesystem();
251 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Filesystem); 245 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Filesystem);
252 }; 246 };
253 247
254 } // namespace rtc 248 } // namespace rtc
255 249
256 #endif // WEBRTC_BASE_FILEUTILS_H_ 250 #endif // WEBRTC_BASE_FILEUTILS_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/fileutils.cc » ('j') | webrtc/test/testsupport/fileutils.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698