1/*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef DATA_SOURCE_H
6#define DATA_SOURCE_H
7
8#include <Entry.h>
9#include <File.h>
10#include <Path.h>
11
12
13struct BString;
14
15
16class DataSource {
17public:
18								DataSource();
19	virtual						~DataSource();
20
21	virtual	status_t			CreateDataIO(BDataIO** _io) = 0;
22
23	virtual	status_t			GetName(BString& name);
24};
25
26
27class FileDataSource : public DataSource {
28public:
29	virtual	status_t			CreateDataIO(BDataIO** _io);
30
31protected:
32	virtual	status_t			OpenFile(BFile& file) = 0;
33};
34
35
36class PathDataSource : public FileDataSource {
37public:
38			status_t			Init(const char* path);
39
40	virtual	status_t			GetName(BString& name);
41
42protected:
43	virtual	status_t			OpenFile(BFile& file);
44
45private:
46			BPath				fPath;
47};
48
49
50class EntryRefDataSource : public FileDataSource {
51public:
52			status_t			Init(const entry_ref* ref);
53
54	virtual	status_t			GetName(BString& name);
55
56protected:
57	virtual	status_t			OpenFile(BFile& file);
58
59private:
60			entry_ref			fRef;
61};
62
63
64#endif	// DATA_SOURCE_H
65