DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs
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 && !file->Close()) {
21  LOG(WARNING) << "Failed to close the file properly: "
22  << file->file_name();
23  }
24  }
25 };
26 
27 } // namespace media
28 } // namespace edash_packager
29 
30 #endif // MEDIA_FILE_FILE_CLOSER_H_
Define an abstract file interface.
Definition: file.h:22
const std::string & file_name() const
Definition: file.h:89