-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.h
More file actions
79 lines (72 loc) · 2.58 KB
/
Copy pathmain.h
File metadata and controls
79 lines (72 loc) · 2.58 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/**
* @file main.h
* @version 1.0
* @brief MP3enc_cpp main application header
* @date Mar 4, 2020
* @author Siwon Kang (kkangshawn@gmail.com)
*/
#ifndef _MAIN_H
#define _MAIN_H
#include "common.h"
#include "audio.h"
#include "utils.h"
/**
* @class MP3enc main.h "main.h"
* @brief main class for MP3enc application.
* Designed as singleton to prevent from any conflicts by multiple access
* to encoding library.
*/
class MP3enc : public Utils, DEBUG {
public:
static int main(int argc, char** argv); /**< main function. */
static MP3enc* getInstance(int argc, char** argv); /**< getInstance() that replaces constructor. */
void freeInstance(); /**< freeInstance() that replaces destructor. */
void showUsage(); /**< show usage. */
private:
/**
* @struct Options main.h "main.h"
* @brief Options structure which stores setting arguments of user input.
*/
struct Options {
/**
* @var std::string inPath
* @brief Path of wav file or directory to encode.
*/
std::string inPath;
/**
* @var std::string outPath
* @brief Output filename delivered through -o option.
*/
std::string outPath;
/**
* @var bool recursive
* @brief Flag if to search for sub directories, delivered through -r option.
*/
bool recursive;
/**
* @var bool verbose
* @brief Flag to show debug messages, delivered through -v option.
*/
bool verbose;
};
MP3enc() : m_opt{ {}, {}, false, false } {}
virtual ~MP3enc() {}
/**
* @fn bool parseOption(int argc, char** argv)
* @brief A function to parse input arguments.
* @param [in] argc The number of arguments
* @param [in] argv Argument strings
* @return bool true if successful in parsing all the arguments
*/
bool parseOption(int argc, char** argv);
/**
* @fn void checkPath(string path)
* @brief A function to process input path. This can handle both single file and a directory.
* @param [in] path input path
*/
void checkPath(std::string path, std::vector<AudioData*>& v);
Options m_opt; /**< input arguments */
static MP3enc* m_instance; /**< pointer to the instance */
static size_t refCnt; /**< reference counter to the instance */
};
#endif /* _MAIN_H */