Shaka Packager SDK
callback_file.h
1 // Copyright 2017 Google LLC. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #include <packager/file.h>
8 
9 namespace shaka {
10 
13 class CallbackFile : public File {
14  public:
20  CallbackFile(const char* file_name, const char* mode);
21 
24  bool Close() override;
25  int64_t Read(void* buffer, uint64_t length) override;
26  int64_t Write(const void* buffer, uint64_t length) override;
27  void CloseForWriting() override;
28  int64_t Size() override;
29  bool Flush() override;
30  bool Seek(uint64_t position) override;
31  bool Tell(uint64_t* position) override;
33 
34  protected:
35  ~CallbackFile() override;
36 
37  bool Open() override;
38 
39  private:
40  CallbackFile(const CallbackFile&) = delete;
41  CallbackFile& operator=(const CallbackFile&) = delete;
42 
43  const BufferCallbackParams* callback_params_ = nullptr;
44  std::string name_;
45  std::string file_mode_;
46 };
47 
48 } // namespace shaka
CallbackFile(const char *file_name, const char *mode)
All the methods that are virtual are virtual for mocking.
Definition: crypto_flags.cc:66