2009-12-07 Rolf Bjarne Kvinge <RKvinge@novell.com>
[moon.git] / src / file-downloader.h
blob0d8e382925d7ce0fe8f4401d8464a60b8d861b13
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3 * file-downloader.h: File Downloader class.
5 * Contact:
6 * Moonlight List (moonlight-list@lists.ximian.com)
8 * Copyright 2008 Novell, Inc. (http://www.novell.com)
10 * See the LICENSE file included with the distribution for details.
14 #ifndef __FILE_DOWNLOADER_H__
15 #define __FILE_DOWNLOADER_H__
17 #include <glib.h>
19 #include "internal-downloader.h"
20 #include "downloader.h"
22 class FileDownloader : public InternalDownloader {
23 private:
24 char *filename;
25 char *unzipdir;
26 char *uri;
28 bool unlinkit;
29 bool unzipped;
31 bool DownloadedFileIsZipped ();
32 void CleanupUnzipDir ();
34 virtual ~FileDownloader ();
36 public:
37 FileDownloader (Downloader *dl);
39 virtual void Open (const char *verb, const char *uri);
40 virtual void Write (void *buf, gint32 offset, gint32 n);
41 virtual char *GetDownloadedFilename (const char *partname);
42 virtual char *GetResponseText (const char *partname, gint64 *size);
44 const char *GetDownloadedFile ();
46 const char *GetUnzippedPath ();
48 virtual void SetFilename (const char *fname) { g_free (filename); filename = g_strdup (fname); }
49 void SetUnlink (bool value) { unlinkit = value; }
52 #endif /* __FILE_DOWNLOADER_H__ */