CSndHandler.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef CSNDHANDLER_H
  2. #define CSNDHANDLER_H
  3. #include <vector>
  4. #include <fstream>
  5. #include <map>
  6. struct MemberFile
  7. {
  8. std::ifstream * ifs;
  9. int length;
  10. };
  11. class CSndHandler
  12. {
  13. protected:
  14. const int CHUNK;
  15. struct Entry
  16. {
  17. std::string name;
  18. int size, offset;
  19. };
  20. std::ifstream file;
  21. int readNormalNr (int pos, int bytCon);
  22. bool opened;
  23. public:
  24. std::vector<Entry> entries;
  25. std::map<std::string, int> fimap; // map of wav file and index
  26. ~CSndHandler();
  27. CSndHandler(std::string fname);
  28. void extract(std::string srcfile, std::string dstfile, bool caseSens=true); //saves selected file
  29. unsigned char * extract (std::string srcfile, int & size); //return selecte file data, NULL if file doesn't exist
  30. void extract(int index, std::string dstfile); //saves selected file
  31. MemberFile getFile(std::string name);//nie testowane - sprawdzic
  32. unsigned char * extract (int index, int & size); //return selecte file - NIE TESTOWANE
  33. };
  34. class CVidHandler
  35. {
  36. protected:
  37. const int CHUNK;
  38. struct Entry
  39. {
  40. std::string name;
  41. int size, offset, something;
  42. };
  43. std::ifstream file;
  44. int readNormalNr (int pos, int bytCon);
  45. bool opened;
  46. public:
  47. std::vector<Entry> entries;
  48. ~CVidHandler();
  49. CVidHandler(std::string fname);
  50. std::ifstream & extract(std::string srcfile);
  51. void extract(std::string srcfile, std::string dstfile, bool caseSens=true); //saves selected file
  52. unsigned char * extract (std::string srcfile, int & size); //return selecte file,
  53. void extract(int index, std::string dstfile); //saves selected file
  54. MemberFile getFile(std::string name); //nie testowane - sprawdzic
  55. };
  56. #endif //CSNDHANDLER_H