Shaka Packager SDK
Loading...
Searching...
No Matches
file_closer.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 MEDIA_FILE_FILE_CLOSER_H_
8#define MEDIA_FILE_FILE_CLOSER_H_
9
10#include <cstddef>
11#include <string>
12
13#include <absl/log/log.h>
14
15#include <packager/file.h>
16
17namespace shaka {
18
21struct FileCloser {
22 inline void operator()(File* file) const {
23 if (file != NULL) {
24 const std::string filename = file->file_name();
25 if (!file->Close()) {
26 LOG(WARNING) << "Failed to close the file properly: " << filename;
27 }
28 }
29 }
30};
31
32} // namespace shaka
33
34#endif // MEDIA_FILE_FILE_CLOSER_H_
All the methods that are virtual are virtual for mocking.