lha_file_header.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. Copyright (c) 2011, 2012, Simon Howard
  3. Permission to use, copy, modify, and/or distribute this software
  4. for any purpose with or without fee is hereby granted, provided
  5. that the above copyright notice and this permission notice appear
  6. in all copies.
  7. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  8. WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  9. WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  10. AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
  11. CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  12. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  13. NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef LHASA_LHA_FILE_HEADER_H
  17. #define LHASA_LHA_FILE_HEADER_H
  18. #include "public/lha_file_header.h"
  19. #include "lha_input_stream.h"
  20. /**
  21. * Read a file header from the input stream.
  22. *
  23. * @param stream The input stream to read from.
  24. * @return Pointer to a new LHAFileHeader structure, or NULL
  25. * if an error occurred or a valid header could not
  26. * be read.
  27. */
  28. LHAFileHeader *lha_file_header_read(LHAInputStream *stream);
  29. /**
  30. * Free a file header structure.
  31. *
  32. * @param header The file header to free.
  33. */
  34. void lha_file_header_free(LHAFileHeader *header);
  35. /**
  36. * Add a reference to the specified file header, to stop it from being
  37. * freed.
  38. *
  39. * @param header The file header to add a reference to.
  40. */
  41. void lha_file_header_add_ref(LHAFileHeader *header);
  42. /**
  43. * Get the full path for the given file header.
  44. *
  45. * @param header Pointer to the file header structure.
  46. * @return Pointer to an allocated string containing the full
  47. * file or directory path, or NULL for failure. The
  48. * string must be freed by the caller.
  49. */
  50. char *lha_file_header_full_path(LHAFileHeader *header);
  51. #endif /* #ifndef LHASA_LHA_FILE_HEADER_H */