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

Side by Side Diff: include/core/SkOSFile.h

Issue 920593002: Move SkOSFile::Iter impls into ports. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments. Created 5 years, 10 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 | src/ports/SkOSFile_none.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 // TODO: add unittests for all these operations 10 // TODO: add unittests for all these operations
11 11
12 #ifndef SkOSFile_DEFINED 12 #ifndef SkOSFile_DEFINED
13 #define SkOSFile_DEFINED 13 #define SkOSFile_DEFINED
14 14
15 #include "SkString.h" 15 #include "SkString.h"
16 16
17 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_ FOR_ANDROID) || defined(SK_BUILD_FOR_IOS)
18 #include <dirent.h>
19 #endif
20
21 #include <stddef.h> // ptrdiff_t
22
23 struct SkFILE; 17 struct SkFILE;
24 18
25 enum SkFILE_Flags { 19 enum SkFILE_Flags {
26 kRead_SkFILE_Flag = 0x01, 20 kRead_SkFILE_Flag = 0x01,
27 kWrite_SkFILE_Flag = 0x02 21 kWrite_SkFILE_Flag = 0x02
28 }; 22 };
29 23
30 #ifdef _WIN32 24 #ifdef _WIN32
31 const static char SkPATH_SEPARATOR = '\\'; 25 const static char SkPATH_SEPARATOR = '\\';
32 #else 26 #else
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 Iter(const char path[], const char suffix[] = NULL); 96 Iter(const char path[], const char suffix[] = NULL);
103 ~Iter(); 97 ~Iter();
104 98
105 void reset(const char path[], const char suffix[] = NULL); 99 void reset(const char path[], const char suffix[] = NULL);
106 /** If getDir is true, only returns directories. 100 /** If getDir is true, only returns directories.
107 Results are undefined if true and false calls are 101 Results are undefined if true and false calls are
108 interleaved on a single iterator. 102 interleaved on a single iterator.
109 */ 103 */
110 bool next(SkString* name, bool getDir = false); 104 bool next(SkString* name, bool getDir = false);
111 105
106 static const size_t kStorageSize = 40;
112 private: 107 private:
113 #ifdef SK_BUILD_FOR_WIN 108 SkAlignedSStorage<kStorageSize> fSelf;
114 HANDLE fHandle;
115 uint16_t* fPath16;
116 #elif defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_UNIX) || defined(SK_BUIL D_FOR_ANDROID) || defined(SK_BUILD_FOR_IOS)
117 DIR* fDIR;
118 SkString fPath, fSuffix;
119 #endif
120 }; 109 };
121 }; 110 };
122 111
123 /** 112 /**
124 * Functions for modifying SkStrings which represent paths on the filesystem. 113 * Functions for modifying SkStrings which represent paths on the filesystem.
125 */ 114 */
126 class SkOSPath { 115 class SkOSPath {
127 public: 116 public:
128 /** 117 /**
129 * Assembles rootPath and relativePath into a single path, like this: 118 * Assembles rootPath and relativePath into a single path, like this:
(...skipping 17 matching lines...) Expand all
147 136
148 /** 137 /**
149 * Given a qualified file name returns the directory. 138 * Given a qualified file name returns the directory.
150 * Behaves like python's os.path.dirname. If the fullPath is 139 * Behaves like python's os.path.dirname. If the fullPath is
151 * /dir/subdir/ the return will be /dir/subdir/ 140 * /dir/subdir/ the return will be /dir/subdir/
152 * @param fullPath Full path to the file. 141 * @param fullPath Full path to the file.
153 * @return SkString The dir containing the file - anything preceding the 142 * @return SkString The dir containing the file - anything preceding the
154 * final slash, or the full name if ending in a slash. 143 * final slash, or the full name if ending in a slash.
155 */ 144 */
156 static SkString Dirname(const char* fullPath); 145 static SkString Dirname(const char* fullPath);
157
158 }; 146 };
159 147
160 #endif 148 #endif
OLDNEW
« no previous file with comments | « no previous file | src/ports/SkOSFile_none.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698