From 1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353 Mon Sep 17 00:00:00 2001 From: The Android Open Source Project Date: Wed, 17 Dec 2008 18:05:15 -0800 Subject: Code drop from //branches/cupcake/...@124589 --- WebCore/platform/FileSystem.h | 103 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 101 insertions(+), 2 deletions(-) (limited to 'WebCore/platform/FileSystem.h') diff --git a/WebCore/platform/FileSystem.h b/WebCore/platform/FileSystem.h index da31281..a3d5d2d 100644 --- a/WebCore/platform/FileSystem.h +++ b/WebCore/platform/FileSystem.h @@ -30,21 +30,107 @@ #ifndef FileSystem_h #define FileSystem_h +#if PLATFORM(GTK) +#include +#endif +#if PLATFORM(QT) +#include +#include +#if defined(Q_OS_WIN32) +#include +#endif +#endif + +#if PLATFORM(DARWIN) +#include +#endif + +#include + #include +#include + +#include "PlatformString.h" typedef const struct __CFData* CFDataRef; +#if PLATFORM(WIN) +// These are to avoid including in a header for Chromium +typedef void *HANDLE; +// Assuming STRICT +typedef struct HINSTANCE__* HINSTANCE; +typedef HINSTANCE HMODULE; +#endif + namespace WebCore { class CString; -class String; #if PLATFORM(WIN) typedef HANDLE PlatformFileHandle; -const PlatformFileHandle invalidPlatformFileHandle = INVALID_HANDLE_VALUE; +typedef HMODULE PlatformModule; +// FIXME: -1 is INVALID_HANDLE_VALUE, defined in . Chromium tries to +// avoid using Windows headers in headers. We'd rather move this into the .cpp. +const PlatformFileHandle invalidPlatformFileHandle = reinterpret_cast(-1); + +struct PlatformModuleVersion { + unsigned leastSig; + unsigned mostSig; + + PlatformModuleVersion(unsigned) + : leastSig(0) + , mostSig(0) + { + } + + PlatformModuleVersion(unsigned lsb, unsigned msb) + : leastSig(lsb) + , mostSig(msb) + { + } + +}; +#elif PLATFORM(QT) + +typedef QFile* PlatformFileHandle; +const PlatformFileHandle invalidPlatformFileHandle = 0; +#if defined(Q_WS_MAC) +typedef CFBundleRef PlatformModule; +typedef unsigned PlatformModuleVersion; +#elif defined(Q_WS_X11) || defined(Q_WS_QWS) +typedef QLibrary* PlatformModule; +typedef unsigned PlatformModuleVersion; +#elif defined(Q_OS_WIN32) +typedef HMODULE PlatformModule; +struct PlatformModuleVersion { + unsigned leastSig; + unsigned mostSig; + + PlatformModuleVersion(unsigned) + : leastSig(0) + , mostSig(0) + { + } + + PlatformModuleVersion(unsigned lsb, unsigned msb) + : leastSig(lsb) + , mostSig(msb) + { + } + +}; +#endif + #else typedef int PlatformFileHandle; +#if PLATFORM(GTK) +typedef GModule* PlatformModule; +#else +typedef void* PlatformModule; +#endif const PlatformFileHandle invalidPlatformFileHandle = -1; + +typedef unsigned PlatformModuleVersion; #endif bool fileExists(const String&); @@ -55,6 +141,10 @@ bool getFileModificationTime(const String&, time_t& result); String pathByAppendingComponent(const String& path, const String& component); bool makeAllDirectories(const String& path); String homeDirectoryPath(); +String pathGetFileName(const String&); +String directoryName(const String&); + +Vector listDirectory(const String& path, const String& filter = String()); CString fileSystemRepresentation(const String&); @@ -65,6 +155,9 @@ CString openTemporaryFile(const char* prefix, PlatformFileHandle&); void closeFile(PlatformFileHandle&); int writeToFile(PlatformFileHandle, const char* data, int length); +// Methods for dealing with loadable modules +bool unloadModule(PlatformModule); + #if PLATFORM(WIN) String localUserSpecificStorageDirectory(); String roamingUserSpecificStorageDirectory(); @@ -72,6 +165,12 @@ String roamingUserSpecificStorageDirectory(); bool safeCreateFile(const String&, CFDataRef); #endif +#if PLATFORM(GTK) +String filenameToString(const char*); +char* filenameFromString(const String&); +String filenameForDisplay(const String&); +#endif + } // namespace WebCore #endif // FileSystem_h -- cgit v1.1