files.h 1.15 KB
Newer Older
Matteo's avatar
update  
Matteo committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <filesystem>
#include <fstream>
#include <string>
#include <iostream>
#include <stdlib.h>

namespace files {
    /**
     * @brief Save content to a file
     * 
     * @param fileName the name of the file
     * @param content the content to be saved
     * @param append if true, the content will be appended to the file, otherwise the file will be overwritten
     */
    void saveFile(std::filesystem::path fileName, std::string content, bool append);

    /**
     * @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);

    /**
     * @brief Check if the specified input video file exists and is supported.
     *
     * @param[in] videoPath Full video path;
     * @param[out] fileName Video file name;
     * @param[out] extension Video extension.
     * @return int -1 if the format is not supported, 0 otherwise.
     */
    int findFileName(std::string videoPath, std::string &fileName, std::string &extension);
}