files.h 1.46 KB
Newer Older
Matteo's avatar
Matteo committed
1
2
3
4
5
6
/**
 * @file files.h
 * @author Matteo Spanio (dev2@audioinnova.com)
 * @brief A collection of functions to handle files.
 * @version 1.0
 * @date 2023-05-13
Matteo's avatar
Matteo committed
7
 *
Matteo's avatar
Matteo committed
8
 * @copyright Copyright (c) 2023
Matteo's avatar
Matteo committed
9
 *
Matteo's avatar
Matteo committed
10
11
12
13
 */

#ifndef FILES_H
#define FILES_H
Matteo's avatar
Matteo committed
14
15
#include <stdlib.h>

Matteo's avatar
update  
Matteo committed
16
17
18
#include <filesystem>
#include <fstream>
#include <iostream>
Matteo's avatar
Matteo committed
19
#include <string>
Matteo's avatar
update  
Matteo committed
20

Matteo's avatar
Matteo committed
21
22
23
/**
 * @namespace files
 * @brief A collection of functions to handle files.
Matteo's avatar
Matteo committed
24
 *
Matteo's avatar
Matteo committed
25
 */
Matteo's avatar
update  
Matteo committed
26
namespace files {
Matteo's avatar
Matteo committed
27
/**
Matteo's avatar
Matteo committed
28
 * @fn void save_file(std::filesystem::path fileName, std::string content)
Matteo's avatar
Matteo committed
29
30
31
32
33
 * @brief Save content to a file
 *
 * @param fileName the name of the file
 * @param content the content to be saved
 */
Matteo's avatar
Matteo committed
34
void save_file(std::filesystem::path fileName, std::string content);
Matteo's avatar
update  
Matteo committed
35

Matteo's avatar
Matteo committed
36
37
38
39
40
41
42
43
44
45
/**
 * @fn void findFileNameFromPath(std::string* path, std::string* fileName,
 * std::string* extension)
 * @brief Separates video file name from its extension.
 *
 * @param[in] path Full video path;
 * @param[out] fileName Video file name;
 * @param[out] extension Video extension.
 */
void findFileNameFromPath(std::string* path, std::string* fileName, std::string* extension);
Matteo's avatar
update  
Matteo committed
46

Matteo's avatar
Matteo committed
47
/**
Matteo's avatar
Matteo committed
48
 * @fn std::pair<std::string, std::string> findFileName(std::string videoPath)
Matteo's avatar
Matteo committed
49
50
 * @brief Check if the specified input video file exists and is supported.
 *
Matteo's avatar
Matteo committed
51
52
 * @param videoPath Full video path;
 * @return a pair of strings containing the video file name and its extension.
Matteo's avatar
Matteo committed
53
 */
Matteo's avatar
Matteo committed
54
std::pair<std::string, std::string> get_filename_and_extension(std::string videoPath);
Matteo's avatar
Matteo committed
55
56
}  // namespace files
#endif  // FILES_H