46 lines
1.0 KiB
C++
46 lines
1.0 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) {}
|
|
FILE* file_;
|
|
static void RegisterFileFactory(IFileFactory* factory) {
|
|
factory_ = factory;
|
|
}
|
|
static IFileFactory* 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 size_t Read(char* buffer, size_t bytes);
|
|
virtual size_t Write(const char* buffer, size_t bytes);
|
|
virtual size_t FileSize(const std::string& name);
|
|
|
|
private:
|
|
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_
|