Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
temp_file.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Roc authors
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
8 
9 //! @file roc_core/target_posix/roc_core/temp_file.h
10 //! @brief Filesystem functions.
11 
12 #ifndef ROC_CORE_TEMP_FILE_H_
13 #define ROC_CORE_TEMP_FILE_H_
14 
15 #include <limits.h>
16 
17 #include "roc_core/noncopyable.h"
18 #include "roc_core/stddefs.h"
19 
20 namespace roc {
21 namespace core {
22 
23 //! Temporary file.
24 //! @remarks
25 //! A temporary file is created in constructor and removed in destructor.
26 class TempFile : public core::NonCopyable<> {
27 public:
28  //! Create temporary file.
29  //! @remarks
30  //! Creates a temporary directory and a file with given @p name inside it.
31  //! Both will be removed in destructor.
32  TempFile(const char* name);
33 
34  ~TempFile();
35 
36  //! Get file path.
37  const char* path() const;
38 
39 private:
40  char dir_[PATH_MAX];
41  char file_[PATH_MAX];
42 };
43 
44 } // namespace core
45 } // namespace roc
46 
47 #endif // ROC_CORE_TEMP_FILE_H_
Temporary file.
Definition: temp_file.h:26
Root namespace.
Commonly used types and functions.
Base class for non-copyable objects.
Definition: noncopyable.h:23
TempFile(const char *name)
Create temporary file.
Non-copyable object.
const char * path() const
Get file path.