DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
file_closer.h
1 // Copyright 2014 Google Inc. 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 "packager/base/logging.h"
11 #include "packager/media/file/file.h"
12 
13 namespace edash_packager {
14 namespace media {
15 
18 struct FileCloser {
19  inline void operator()(File* file) const {
20  if (file != NULL) {
21  const std::string filename = file->file_name();
22  if (!file->Close()) {
23  LOG(WARNING) << "Failed to close the file properly: "
24  << filename;
25  }
26  }
27  }
28 };
29 
30 } // namespace media
31 } // namespace edash_packager
32 
33 #endif // MEDIA_FILE_FILE_CLOSER_H_
Define an abstract file interface.
Definition: file.h:24
const std::string & file_name() const
Definition: file.h:91