52 lines
1.1 KiB
C++
52 lines
1.1 KiB
C++
// Copyright 2013 Google Inc. All Rights Reserved.
|
|
|
|
#ifndef WVCDM_CDM_CDM_HOST_FILE_H_
|
|
#define WVCDM_CDM_CDM_HOST_FILE_H_
|
|
|
|
#include "file_store.h"
|
|
#include "content_decryption_module.h"
|
|
|
|
namespace wvcdm {
|
|
|
|
class IFileFactory;
|
|
|
|
class File::Impl {
|
|
public:
|
|
explicit Impl(cdm::Host* const host) : host_(host) {}
|
|
|
|
static void RegisterFileFactory(IFileFactory* factory) {
|
|
factory_ = factory;
|
|
}
|
|
|
|
virtual bool Exists(const std::string& name);
|
|
virtual bool Open(const std::string& name);
|
|
virtual bool Close();
|
|
virtual bool Remove(const std::string& name);
|
|
virtual ssize_t Read(char* buffer, size_t bytes);
|
|
virtual ssize_t Write(const char* buffer, size_t bytes);
|
|
virtual ssize_t FileSize(const std::string& name);
|
|
|
|
private:
|
|
static IFileFactory* factory_;
|
|
friend class File;
|
|
|
|
cdm::Host* const host_;
|
|
std::string fname_;
|
|
};
|
|
|
|
class IFileFactory {
|
|
protected:
|
|
IFileFactory() {
|
|
File::Impl::RegisterFileFactory(this);
|
|
}
|
|
|
|
virtual ~IFileFactory() {}
|
|
|
|
public:
|
|
virtual File::Impl* NewFileImpl() = 0;
|
|
};
|
|
|
|
} // namespace wvcdm
|
|
|
|
#endif // WVCDM_CDM_CDM_HOST_FILE_H_
|