Commit 4a9b93b07806b60ad3bfe064a53f18bb0761d355

Authored by Wesnydy Ribeiro
1 parent 11e4cfc4
Exists in master and in 1 other branch devel

Documentação do componente extrator

extrator/src/include/extrator.h
  1 +/**
  2 + * \file extrator.h
  3 + *
  4 + * \author Wesnydy Lima Ribeiro <wesnydy@lavid.ufpb.br>
  5 + * \date 2015
  6 + */
  7 +
1 #ifndef EXTRATOR_H 8 #ifndef EXTRATOR_H
2 #define EXTRATOR_H 9 #define EXTRATOR_H
3 10
@@ -11,6 +18,10 @@ @@ -11,6 +18,10 @@
11 using namespace util; 18 using namespace util;
12 using namespace lavidlib; 19 using namespace lavidlib;
13 20
  21 +/** \brief A classe base para todos os extratores.
  22 + *
  23 + * \headerfile extrator/src/include/extrator.h
  24 + */
14 class Extrator { 25 class Extrator {
15 26
16 protected: 27 protected:
@@ -26,9 +37,26 @@ public: @@ -26,9 +37,26 @@ public:
26 SRT, 37 SRT,
27 TXT 38 TXT
28 }; 39 };
  40 +
  41 + /** Notifica o fim da extração do conteúdo do arquivo.
  42 + *
  43 + * \param size Quantidade de conteúdo extraído.
  44 + */
29 virtual void notifyEndExtraction(int size) = 0; 45 virtual void notifyEndExtraction(int size) = 0;
  46 +
  47 + /** Define o path do arquivo de entrada.
  48 + *
  49 + * \param path O path do arquivo.
  50 + */
30 virtual void setFilePath(char* path) = 0; 51 virtual void setFilePath(char* path) = 0;
  52 +
  53 + /** Inicializa a extração do conteúdo. */
31 virtual void initialize() = 0; 54 virtual void initialize() = 0;
  55 +
  56 + /** Indica o fim do processo de extração.
  57 + *
  58 + * \return O status do do processo.
  59 + */
32 virtual bool isFinished() = 0; 60 virtual bool isFinished() = 0;
33 }; 61 };
34 62
extrator/src/include/extratorException.h
  1 +/**
  2 + * \file extratorException.h
  3 + */
  4 +
1 #ifndef EXTRATOREXCEPTION_H 5 #ifndef EXTRATOREXCEPTION_H
2 #define EXTRATOREXCEPTION_H 6 #define EXTRATOREXCEPTION_H
3 7
@@ -8,18 +12,7 @@ using namespace std; @@ -8,18 +12,7 @@ using namespace std;
8 12
9 class ExtratorException : public RuntimeException { 13 class ExtratorException : public RuntimeException {
10 public: 14 public:
11 - /**  
12 - * Construtor da classe.  
13 - * Cria uma nova exceção com uma mensagem detalhada.  
14 - * @param message A mensagem em forma de um objeto string.  
15 - */  
16 ExtratorException(const string message); 15 ExtratorException(const string message);
17 -  
18 - /**  
19 - * Construtor da classe.  
20 - * Cria uma nova exceção com uma mensagem detalhada.  
21 - * @param message A mensagem em forma de um array de caracteres.  
22 - */  
23 ExtratorException(const char* message); 16 ExtratorException(const char* message);
24 }; 17 };
25 18
extrator/src/include/extratorFactory.h
  1 +/**
  2 + * \file extratorFactory.h
  3 + *
  4 + * \author Wesnydy Lima Ribeiro <wesnydy@lavid.ufpb.br>
  5 + * \date 2015
  6 + */
1 #ifndef EXTRATORFACTORY_H 7 #ifndef EXTRATORFACTORY_H
2 #define EXTRATORFACTORY_H 8 #define EXTRATORFACTORY_H
3 9
extrator/src/include/extratorSRT.h
1 -/*  
2 - * File: extratorSRT.h  
3 - * Author: leonardo 1 +/**
  2 + * \file extratorSRT.h
4 * 3 *
5 - * Created on 17 de Fevereiro de 2012, 17:51 4 + * \author Leonardo de Araújo Domingues <leonardo.araujo@lavid.ufpb.br>
  5 + * \date 17/02/2012
6 */ 6 */
  7 +
7 #ifndef EXTRATORSRT_H 8 #ifndef EXTRATORSRT_H
8 #define EXTRATORSRT_H 9 #define EXTRATORSRT_H
9 10
@@ -27,28 +28,73 @@ using namespace jthread; @@ -27,28 +28,73 @@ using namespace jthread;
27 using namespace std; 28 using namespace std;
28 using namespace sndesc; 29 using namespace sndesc;
29 30
30 -/** Classe que modela ExtratorSRT.  
31 -* Instâncias do tipo ExtratorSRT são modelados  
32 -* a partir desta classe, esses objetos são  
33 -* responsáveis por extrair o conteudo de arquivos  
34 -* com a extensão SubRipText(SRT). 31 +/** \brief Classe que implementa o extrator de legenda.
  32 +*
  33 +* Instâncias desta classe extraem o conteúdo de
  34 +* arquivos SubRipText(SRT).
  35 +*
  36 +* \headerfile extrator/src/include/extratorSRT.h
35 */ 37 */
36 class ExtratorSRT: public Extrator, public Thread { 38 class ExtratorSRT: public Extrator, public Thread {
37 39
38 public: 40 public:
  41 + /** Construtor */
39 ExtratorSRT(); 42 ExtratorSRT();
  43 +
  44 + /** Destrutor */
40 ~ExtratorSRT(); 45 ~ExtratorSRT();
41 46
  47 + /** Adiciona ouvintes do extratorSRT.
  48 + *
  49 + * \param listener O ouvinte a ser registrado.
  50 + */
42 void addListener(ListenerSRT* listener); 51 void addListener(ListenerSRT* listener);
  52 +
  53 + /** Notifica os ouvintes sobre novas extrações realizadas.
  54 + *
  55 + * \param subtitle A legenda extraída.
  56 + * \param pts Etiqueta de tempo (Presentation timestamp) da legenda.
  57 + */
43 void notifyListeners(unsigned char* subtitle, int64_t pts); 58 void notifyListeners(unsigned char* subtitle, int64_t pts);
  59 +
  60 + /** Notifica o fim da extração das legendas.
  61 + *
  62 + * \param size Quantidade de legendas extraídas.
  63 + */
44 void notifyEndExtraction(int size); 64 void notifyEndExtraction(int size);
45 65
  66 + /** Define o path do arquivo de entrada.
  67 + *
  68 + * \param path O path do arquivo.
  69 + */
46 void setFilePath(char* path); 70 void setFilePath(char* path);
  71 +
  72 + /** Inicializa o processo de extração da legendas.
  73 + *
  74 + * \exception ExtratorException caso o arquivo de legenda não seja encontrado.
  75 + */
47 void initialize(); 76 void initialize();
  77 +
  78 + /** Indica o fim do processo de extração das legendas.
  79 + *
  80 + * \return O status do do processo.
  81 + */
48 bool isFinished(); 82 bool isFinished();
49 83
  84 + /** Retorna o conteúdo da legenda extraída.
  85 + *
  86 + * \return Referência para um objeto Subtitle.
  87 + * \exception ExtratorException se ocorrer algum erro no processo de extração.
  88 + */
50 Subtitle* next(); 89 Subtitle* next();
  90 +
  91 + /** Indica se há legendas para serem extraídas do arquivo.
  92 + *
  93 + * \return True se houver legendas, caso contrário, retorna False.
  94 + */
51 bool hasNextSubtitle(); 95 bool hasNextSubtitle();
  96 +
  97 + /** Este método é chamado quando a Thread for iniciada. */
52 void Run(); 98 void Run();
53 99
54 private: 100 private:
extrator/src/include/extratorTXT.h
1 -/***************************************************************************  
2 - * Universidade Federal da Paraíba *  
3 - * Copyright (C) 2014 by Laboratório de Aplicações de Vídeo Digital *  
4 - * *  
5 - * Centro de Informática - UFPB - Campus I *  
6 - * João Pessoa - PB - Brasil *  
7 - * *  
8 - * Author: Erickson Silva (erickson.silva@lavid.ufpb.br) *  
9 - * *  
10 - **************************************************************************/ 1 +/**
  2 + * \file extratorTXT.h
  3 + *
  4 + * \author Erickson Silva <erickson.silva@lavid.ufpb.br>
  5 + * \date 2014
  6 + */
11 7
12 #ifndef EXTRATORTXT_H 8 #ifndef EXTRATORTXT_H
13 #define EXTRATORTXT_H 9 #define EXTRATORTXT_H
@@ -23,25 +19,59 @@ @@ -23,25 +19,59 @@
23 using namespace jthread; 19 using namespace jthread;
24 using namespace std; 20 using namespace std;
25 21
26 -/**  
27 -* Classe que modela o ExtratorTXT.  
28 -* O ExtratorTXT extrai o conteúdo  
29 -* de um arquivo txt. 22 +/** \brief Classe que implementa o extrator de texto.
  23 +*
  24 +* Instâncias desta classe extraem o conteúdo de
  25 +* arquivos txt.
  26 +*
  27 +* \headerfile extrator/src/include/extratorTXT.h
30 */ 28 */
31 class ExtratorTXT: public Extrator, public Thread { 29 class ExtratorTXT: public Extrator, public Thread {
32 30
33 public: 31 public:
  32 + /** Construtor */
34 ExtratorTXT(); 33 ExtratorTXT();
  34 +
  35 + /** Destrutor */
35 ~ExtratorTXT(); 36 ~ExtratorTXT();
36 37
  38 + /** Adiciona ouvintes do extratorTXT.
  39 + *
  40 + * \param listener O ouvinte a ser registrado.
  41 + */
37 void addListener(ListenerTXT* listener); 42 void addListener(ListenerTXT* listener);
  43 +
  44 + /** Notifica os ouvintes sobre novas extrações realizadas.
  45 + *
  46 + * \param line A linha extraída.
  47 + */
38 void notifyListeners(unsigned char* line); 48 void notifyListeners(unsigned char* line);
  49 +
  50 + /** Notifica o fim da extração do texto.
  51 + *
  52 + * \param size Quantidade de linhas extraídas.
  53 + */
39 void notifyEndExtraction(int size); 54 void notifyEndExtraction(int size);
40 55
  56 + /** Define o path do arquivo de entrada.
  57 + *
  58 + * \param path O path do arquivo.
  59 + */
41 void setFilePath(char* path); 60 void setFilePath(char* path);
  61 +
  62 + /** Inicializa o processo de extração do texto.
  63 + *
  64 + * \exception ExtratorException caso o arquivo de texto não seja encontrado.
  65 + */
42 void initialize(); 66 void initialize();
  67 +
  68 + /** Indica o fim do processo de extração do texto.
  69 + *
  70 + * \return O status do do processo.
  71 + */
43 bool isFinished(); 72 bool isFinished();
44 73
  74 + /** Este método é chamado quando a Thread for iniciada. */
45 void Run(); 75 void Run();
46 76
47 private: 77 private:
extrator/src/include/listenerSRT.h
  1 +/**
  2 + * \file listenerSRT.h
  3 + */
  4 +
1 #ifndef LISTENERSRT_H 5 #ifndef LISTENERSRT_H
2 #define LISTENERSRT_H 6 #define LISTENERSRT_H
3 7
extrator/src/include/listenerTXT.h
  1 +/**
  2 + * \file listenerTXT.h
  3 + */
  4 +
1 #ifndef LISTENERTXT_H 5 #ifndef LISTENERTXT_H
2 #define LISTENERTXT_H 6 #define LISTENERTXT_H
3 7
extrator/src/include/subtitle.h
1 -/***************************************************************************  
2 - * Universidade Federal da Paraíba *  
3 - * Copyright (C) 2013 by Laboratório de Aplicações de Vídeo Digital *  
4 - * *  
5 - * Centro de Informática - UFPB - Campus I *  
6 - * João Pessoa - PB - Brasil *  
7 - * *  
8 - * Author: Leonardo de Araújo Domingues (leonardo.araujo@lavid.ufpb.br) *  
9 - * Date: Qui Out 24 22:26:35 BRT 2013 *  
10 - * *  
11 - **************************************************************************/ 1 +/**
  2 + * \file subtitle.h
  3 + *
  4 + * \author Leonardo de Araújo Domingues <leonardo.araujo@lavid.ufpb.br>
  5 + * \date 24/10/2015
  6 + */
12 7
13 #ifndef SUBTITLE_H 8 #ifndef SUBTITLE_H
14 #define SUBTITLE_H 9 #define SUBTITLE_H
@@ -23,115 +18,90 @@ @@ -23,115 +18,90 @@
23 18
24 namespace sndesc { 19 namespace sndesc {
25 20
26 - /**  
27 - * Classe que modela legendas.  
28 - * Objetos com informações de legendas  
29 - * são implementados através desta classe.  
30 - */ 21 + /** \brief Classe que modela legendas.
  22 + *
  23 + * Objetos com informações de legendas
  24 + * são implementados através desta classe.
  25 + * \headerfile extrator/src/include/subtitle.h
  26 + */
31 class Subtitle { 27 class Subtitle {
32 28
33 public: 29 public:
34 - /**  
35 - * Construtor da classe.  
36 - * Cria uma nova instância da classe para  
37 - * representar uma legenda, as variáveis  
38 - * iniciam com valores default.  
39 - */ 30 + /** Construtor */
40 Subtitle(); 31 Subtitle();
41 32
42 - /**  
43 - * Construtor da clasee.  
44 - * Cria uma nova instância da classe para a representar uma legenda,  
45 - * as variáveis iniciam com valores passados por parametros.  
46 - * @param _id O numero da legenda.  
47 - * @param _sub_text O texto da legenda.  
48 - * @param _timein O tempo de inicio da legenda.  
49 - * @param _timeout O tempo de termino da legenda. 33 + /** Construtor.
  34 + *
  35 + * \param _id Número da legenda.
  36 + * \param _sub_text Texto da legenda.
  37 + * \param _timein Tempo de inicio da legenda.
  38 + * \param _timeout Tempo de termino da legenda.
50 */ 39 */
51 Subtitle(int _id, string _sub_text, int64_t _timein, int64_t _timeout); 40 Subtitle(int _id, string _sub_text, int64_t _timein, int64_t _timeout);
52 41
53 - /**  
54 - * Destrutor da classe.  
55 - * Desaloca todo espaço de armazenamento atribuído  
56 - * para a instância do Subtitle.  
57 - */ 42 + /** Destrutor */
58 ~Subtitle(); 43 ~Subtitle();
59 44
60 - /**  
61 - * Seta o id da legenda.  
62 - * @param _id O numero da legenda. 45 + /** Seta o id da legenda.
  46 + *
  47 + * \param _id O numero da legenda.
63 */ 48 */
64 void setID(int _id); 49 void setID(int _id);
65 50
66 - /**  
67 - * Seta o texto da legenda.  
68 - * @param _subtext O texto da legenda. 51 + /** Seta o texto da legenda.
  52 + *
  53 + * \param _subtext O texto da legenda.
69 */ 54 */
70 void setSubtitleText(std::string _subtext); 55 void setSubtitleText(std::string _subtext);
71 56
72 - /**  
73 - * Seta o tempo de inicio da legenda.  
74 - * @param _timein O tempo de entrada da legenda. 57 + /** Seta o tempo de inicio da legenda.
  58 + *
  59 + * \param _timein O tempo de entrada da legenda.
75 */ 60 */
76 void setTimeIn(int64_t _timein); 61 void setTimeIn(int64_t _timein);
77 62
78 - /**  
79 - * Seta o tempo de termino da legenda.  
80 - * @param _timeout O tempo de saida da legenda. 63 + /** Seta o tempo de termino da legenda.
  64 + *
  65 + * \param _timeout O tempo de saida da legenda.
81 */ 66 */
82 void setTimeOut(int64_t _timeout); 67 void setTimeOut(int64_t _timeout);
83 68
84 - /**  
85 - * Obtém o texto da legenda.  
86 - * @return O texto da legenda. 69 + /** Obtém o texto da legenda.
  70 + *
  71 + * \return O texto da legenda.
87 */ 72 */
88 std::string getSubtitleText(); 73 std::string getSubtitleText();
89 74
90 - /**  
91 - * Obtém o tempo de inicio da legenda.  
92 - * @return O tempo de inicio. 75 + /** Obtém o tempo de inicio da legenda.
  76 + *
  77 + * \return O tempo de inicio.
93 */ 78 */
94 int64_t getTimeIn(); 79 int64_t getTimeIn();
95 80
96 - /**  
97 - * Obtém o tempo de termino da legenda.  
98 - * @return O tempo de saida. 81 + /** Obtém o tempo de termino da legenda.
  82 + *
  83 + * \return O tempo de termino.
99 */ 84 */
100 int64_t getTimeOut(); 85 int64_t getTimeOut();
101 86
102 - /**  
103 - * Obtém o id da legenda.  
104 - * @return O numero da legenda. 87 + /** Obtém o id da legenda.
  88 + *
  89 + * \return O numero da legenda.
105 */ 90 */
106 int getID(); 91 int getID();
107 92
108 - /**  
109 - * Converte os dados de uma legenda em uma string.  
110 - * @return Uma string com a representação da legenda. 93 + /** Converte os dados de uma legenda em uma string.
  94 + *
  95 + * \return Uma string com a representação da legenda.
111 */ 96 */
112 string toString(); 97 string toString();
113 98
114 private: 99 private:
115 - /**  
116 - * O numero da legenda.  
117 - */  
118 - int id;  
119 -  
120 - /**  
121 - * O texto da legenda.  
122 - */  
123 - string subtitle_text;  
124 100
125 - /**  
126 - * O tempo de entrada da legenda.  
127 - */ 101 + int id;
128 int64_t time_in; 102 int64_t time_in;
129 -  
130 - /**  
131 - * O tempo de saida da legenda.  
132 - */  
133 int64_t time_out; 103 int64_t time_out;
134 - 104 + string subtitle_text;
135 }; 105 };
136 } 106 }
137 107