Old stuff/ecole_etude_fac_de_pau/licence_3/projet_lzw/include/inflater.h
(Deskargatu)
/*
This file is part of projet_lzw_univ_pau.
projet_lzw_univ_pau is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
projet_lzw_univ_pau is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with projet_lzw_univ_pau; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _LZW_in
#define _LZW_in
#include <map>
#include <vector>
/*
Classe Inflater
- Utilisation priviliegiee d'un tableau de chars:
si l'on compresse un fichier binaire contenant le caractere ascii nul '\0'
on aura alors une fin de string non justifiee...
- Utilisation d'un vecteur egalement pour le dictionnaire puisque les indices
de cle sont numeriques et successifs. Un tableau associatif est donc superflux.
*/
class Inflater {
public:
Inflater(); // constructeur
int inflate(int); // decompression
void setInput(std::vector<unsigned int>&); // entree
int needInput(); // inutilise
std::vector<char> decompression; // buffer de sortie
private:
int commence; // booleen de premier buffer
std::vector<unsigned int> buffer; // buffer d entree
std::vector<std::pair<unsigned int,char> > dico; // dictionnaire
void add_word(const std::pair<unsigned int,char >&); // ajout d un mot
int find_word(const unsigned int&); // recherche d un mot
};
#endif