Commit 40a0bfdba094eb8dcf13b815507c42deb524373f
1 parent
4a9b93b0
Exists in
master
and in
1 other branch
Documentação do componente 'util'
Showing
2 changed files
with
131 additions
and
0 deletions
Show diff stats
util/src/include/argParser.h
1 | +/** | ||
2 | + * \file argParser.h | ||
3 | + * | ||
4 | + * \author Wesnydy Lima Ribeiro <wesnydy@lavid.ufpb.br> | ||
5 | + * \date 2015 | ||
6 | + */ | ||
7 | + | ||
1 | #ifndef ARG_PARSER_H | 8 | #ifndef ARG_PARSER_H |
2 | #define ARG_PARSER_H | 9 | #define ARG_PARSER_H |
3 | 10 | ||
@@ -15,23 +22,90 @@ | @@ -15,23 +22,90 @@ | ||
15 | using namespace std; | 22 | using namespace std; |
16 | using namespace util; | 23 | using namespace util; |
17 | 24 | ||
25 | +/** \brief Analizador de argumentos de linha de comando. | ||
26 | + * | ||
27 | + * \headerfile util/src/include/argParser.h | ||
28 | + */ | ||
18 | class ArgParser { | 29 | class ArgParser { |
19 | public: | 30 | public: |
31 | + /** Construtor */ | ||
20 | ArgParser(); | 32 | ArgParser(); |
33 | + | ||
34 | + /** Destrutor */ | ||
21 | ~ArgParser(); | 35 | ~ArgParser(); |
36 | + | ||
37 | + /** Analiza os argumentos da linha de comando. | ||
38 | + * | ||
39 | + * \param argv Os argumentos. | ||
40 | + * \param arc O número de argumentos. | ||
41 | + * \exception RuntimeException Se forem encontrados argumentos inválidos ou na falta de argumentos. | ||
42 | + */ | ||
22 | void readArgs(char** argv, int argc); | 43 | void readArgs(char** argv, int argc); |
23 | 44 | ||
45 | + /** Retorna o serviço requisitado. | ||
46 | + * | ||
47 | + * \return O serviço. | ||
48 | + */ | ||
24 | int getService(); | 49 | int getService(); |
50 | + | ||
51 | + /** Retorna a linguagem do arquivo de entrada. | ||
52 | + * | ||
53 | + * \return A linguagem do arquivo. | ||
54 | + */ | ||
25 | int getLanguage(); | 55 | int getLanguage(); |
56 | + | ||
57 | + /** Retorna a posição do vídeo de LIBRAS. | ||
58 | + * | ||
59 | + * \return A posição do vídeo. | ||
60 | + */ | ||
26 | int getPosition(); | 61 | int getPosition(); |
62 | + | ||
63 | + /** Retorna o tamanho do vídeo de LIBRAS. | ||
64 | + * | ||
65 | + * \return O tamanho do vídeo. | ||
66 | + */ | ||
27 | int getSize(); | 67 | int getSize(); |
68 | + | ||
69 | + /** Retorna a transparência do plano de fundo. | ||
70 | + * | ||
71 | + * \return O background do vídeo. | ||
72 | + */ | ||
28 | int getBackground(); | 73 | int getBackground(); |
74 | + | ||
75 | + /** Retorna o modo de execução. | ||
76 | + * | ||
77 | + * \return O modo de execução. | ||
78 | + */ | ||
29 | int getMode(); | 79 | int getMode(); |
80 | + | ||
81 | + /** Retorna opções extras ativadas. | ||
82 | + * | ||
83 | + * \return A opção extra. | ||
84 | + */ | ||
30 | int getOption(); | 85 | int getOption(); |
31 | 86 | ||
87 | + /** Retorna o path arquivo de entrada. | ||
88 | + * | ||
89 | + * \return O path do arquivo. | ||
90 | + */ | ||
32 | string getInput(); | 91 | string getInput(); |
92 | + | ||
93 | + /** Retorna o path arquivo de legendas. | ||
94 | + * | ||
95 | + * \return O path do arquivo de legendas. | ||
96 | + */ | ||
33 | string getInputSRT(); | 97 | string getInputSRT(); |
98 | + | ||
99 | + /** Retorna a identificação do cliente. | ||
100 | + * | ||
101 | + * \return O ID do cliente. | ||
102 | + */ | ||
34 | string getId(); | 103 | string getId(); |
104 | + | ||
105 | + /** Retorna o nível de log selecionado. | ||
106 | + * | ||
107 | + * \return O nível do log. | ||
108 | + */ | ||
35 | util::logLevel getLog(); | 109 | util::logLevel getLog(); |
36 | 110 | ||
37 | private: | 111 | private: |
@@ -57,12 +131,46 @@ private: | @@ -57,12 +131,46 @@ private: | ||
57 | util::logLevel l_level; | 131 | util::logLevel l_level; |
58 | }globalArgs; | 132 | }globalArgs; |
59 | 133 | ||
134 | + /** Exibe erros ocorridos durante a analise dos argumentos. | ||
135 | + * | ||
136 | + * \param option A mensagem de erro. | ||
137 | + */ | ||
60 | void returnErr(const string& option); | 138 | void returnErr(const string& option); |
139 | + | ||
140 | + /** Retorna a opção de linguagem a partir de uma string. | ||
141 | + * | ||
142 | + * \return A linguagem do arquivo. | ||
143 | + */ | ||
61 | Languages languageFromString(const string& language); | 144 | Languages languageFromString(const string& language); |
145 | + | ||
146 | + /** Retorna a opção de posição a partir de uma string. | ||
147 | + * | ||
148 | + * \return A posição do vídeo. | ||
149 | + */ | ||
62 | Positions positionFromString(const string& position); | 150 | Positions positionFromString(const string& position); |
151 | + | ||
152 | + /** Retorna a opção de resolução a partir de uma string. | ||
153 | + * | ||
154 | + * \return A resolução do vídeo. | ||
155 | + */ | ||
63 | Resolution resolutionFromString(const string& resolution); | 156 | Resolution resolutionFromString(const string& resolution); |
157 | + | ||
158 | + /** Retorna a opção de background a partir de uma string. | ||
159 | + * | ||
160 | + * \return O background do vídeo. | ||
161 | + */ | ||
64 | Background backgroundFromString(const string& backg); | 162 | Background backgroundFromString(const string& backg); |
163 | + | ||
164 | + /** Retorna a opção do modo de execução a partir de uma string. | ||
165 | + * | ||
166 | + * \return O modo de execução. | ||
167 | + */ | ||
65 | Mode executionModeFromString(const string& mode); | 168 | Mode executionModeFromString(const string& mode); |
169 | + | ||
170 | + /** Retorna o nível de log selecionado. | ||
171 | + * | ||
172 | + * \return O nível de log. | ||
173 | + */ | ||
66 | util::logLevel logFromString(const string& level); | 174 | util::logLevel logFromString(const string& level); |
67 | }; | 175 | }; |
68 | 176 |
util/src/include/logging.h
1 | +/** | ||
2 | + * \file logging.h | ||
3 | + * | ||
4 | + * \author Wesnydy Lima Ribeiro <wesnydy@lavid.ufpb.br> | ||
5 | + * \date 2015 | ||
6 | + */ | ||
7 | + | ||
1 | #ifndef LOGGING_H | 8 | #ifndef LOGGING_H |
2 | #define LOGGING_H | 9 | #define LOGGING_H |
3 | 10 | ||
@@ -17,11 +24,27 @@ namespace util { | @@ -17,11 +24,27 @@ namespace util { | ||
17 | 24 | ||
18 | enum logLevel { _QUIET = 1 , _ERROR, _WARNING, _INFO, _DEBUG}; | 25 | enum logLevel { _QUIET = 1 , _ERROR, _WARNING, _INFO, _DEBUG}; |
19 | 26 | ||
27 | + /** \brief Classe responsável pelo log exibido no terminal. | ||
28 | + * | ||
29 | + * \headerfile util/src/include/logging.h | ||
30 | + */ | ||
20 | class Logging { | 31 | class Logging { |
21 | public: | 32 | public: |
22 | static Logging* instance(); | 33 | static Logging* instance(); |
34 | + | ||
35 | + /** Retorna o nível de log selecionado. | ||
36 | + * | ||
37 | + * \return O nível de log. | ||
38 | + */ | ||
23 | logLevel getLevel(); | 39 | logLevel getLevel(); |
40 | + | ||
41 | + /** Seta o nível de log, no terminal. */ | ||
24 | void setLevel(logLevel level); | 42 | void setLevel(logLevel level); |
43 | + | ||
44 | + /** Escreve o log em um arquivo. | ||
45 | + * | ||
46 | + * \param logMsg A mensagem do log. | ||
47 | + */ | ||
25 | void writeLog(const char* logMsg); | 48 | void writeLog(const char* logMsg); |
26 | 49 | ||
27 | private: | 50 | private: |