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 Streaming 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 "roc_core/noncopyable.h"
16 #include "roc_core/stddefs.h"
17 
18 namespace roc {
19 namespace core {
20 
21 //! Temporary file.
22 //! @remarks
23 //! A temporary file is created in constructor and removed in destructor.
24 class TempFile : public core::NonCopyable<> {
25 public:
26  //! Create temporary file.
27  //! @remarks
28  //! Creates a temporary directory and a file with given @p name inside it.
29  //! Both will be removed in destructor.
30  TempFile(const char* name);
31 
32  ~TempFile();
33 
34  //! Get file path.
35  const char* path() const;
36 
37 private:
38  char dir_[1024];
39  char file_[1024];
40 };
41 
42 } // namespace core
43 } // namespace roc
44 
45 #endif // ROC_CORE_TEMP_FILE_H_
Base class for non-copyable objects.
Definition: noncopyable.h:23
Temporary file.
Definition: temp_file.h:24
TempFile(const char *name)
Create temporary file.
const char * path() const
Get file path.
Root namespace.
Non-copyable object.
Commonly used types and functions.