Shaka Packager SDK
local_file.h
1 // Copyright 2014 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 #ifndef PACKAGER_FILE_LOCAL_FILE_H_
8 #define PACKAGER_FILE_LOCAL_FILE_H_
9 
10 #include <cstdint>
11 #include <string>
12 
13 #include <packager/file.h>
14 #include <packager/macros/classes.h>
15 
16 namespace shaka {
17 
19 class LocalFile : public File {
20  public:
24  LocalFile(const char* file_name, const char* mode);
25 
28  bool Close() override;
29  int64_t Read(void* buffer, uint64_t length) override;
30  int64_t Write(const void* buffer, uint64_t length) override;
31  void CloseForWriting() override;
32  int64_t Size() override;
33  bool Flush() override;
34  bool Seek(uint64_t position) override;
35  bool Tell(uint64_t* position) override;
37 
41  static bool Delete(const char* file_name);
42 
43  protected:
44  ~LocalFile() override;
45 
46  bool Open() override;
47 
48  private:
49  std::string file_mode_;
50  FILE* internal_file_;
51 
52  DISALLOW_COPY_AND_ASSIGN(LocalFile);
53 };
54 
55 } // namespace shaka
56 
57 #endif // PACKAGER_FILE_LOCAL_FILE_H_
Implement LocalFile which deals with local storage.
Definition: local_file.h:19
LocalFile(const char *file_name, const char *mode)
Definition: local_file.cc:28
static bool Delete(const char *file_name)
Definition: local_file.cc:138
All the methods that are virtual are virtual for mocking.
Definition: crypto_flags.cc:66