OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Collabora, Ltd. All rights reserved. | 3 * Copyright (C) 2008 Collabora, Ltd. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 20 matching lines...) Expand all Loading... |
31 #define FileSystem_h | 31 #define FileSystem_h |
32 | 32 |
33 #include <time.h> | 33 #include <time.h> |
34 #include "wtf/Forward.h" | 34 #include "wtf/Forward.h" |
35 #include "wtf/MathExtras.h" | 35 #include "wtf/MathExtras.h" |
36 #include "wtf/Vector.h" | 36 #include "wtf/Vector.h" |
37 #include "wtf/text/WTFString.h" | 37 #include "wtf/text/WTFString.h" |
38 | 38 |
39 namespace WebCore { | 39 namespace WebCore { |
40 | 40 |
41 #if OS(WINDOWS) | |
42 typedef void *HANDLE; | |
43 typedef HANDLE PlatformFileHandle; | |
44 #else | |
45 typedef int PlatformFileHandle; | |
46 #endif | |
47 | |
48 enum FileOpenMode { | |
49 OpenForRead = 0, | |
50 OpenForWrite | |
51 }; | |
52 | |
53 struct FileMetadata; | 41 struct FileMetadata; |
54 | 42 |
55 bool getFileSize(const String&, long long& result); | 43 bool getFileSize(const String&, long long& result); |
56 bool getFileModificationTime(const String&, time_t& result); | 44 bool getFileModificationTime(const String&, time_t& result); |
57 bool getFileMetadata(const String&, FileMetadata&); | 45 bool getFileMetadata(const String&, FileMetadata&); |
58 String directoryName(const String&); | 46 String directoryName(const String&); |
59 | 47 |
60 inline double invalidFileTime() { return std::numeric_limits<double>::quiet_NaN(
); } | 48 inline double invalidFileTime() { return std::numeric_limits<double>::quiet_NaN(
); } |
61 inline bool isValidFileTime(double time) { return std::isfinite(time); } | 49 inline bool isValidFileTime(double time) { return std::isfinite(time); } |
62 | 50 |
63 // FIXME: Only used by test code, move them into WebUnitTestSupport. | |
64 PlatformFileHandle openFile(const String& path, FileOpenMode); | |
65 void closeFile(PlatformFileHandle&); | |
66 // Returns number of bytes actually written if successful, -1 otherwise. | |
67 int readFromFile(PlatformFileHandle, char* data, int length); | |
68 | |
69 } // namespace WebCore | 51 } // namespace WebCore |
70 | 52 |
71 #endif // FileSystem_h | 53 #endif // FileSystem_h |
OLD | NEW |