byte.h 834 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef AFUN_BYTE_H
  2. #define AFUN_BYTE_H
  3. #include <cstdio> // NOLINT
  4. #include <iostream>
  5. #include "aFunToolExport.h"
  6. namespace aFuntool {
  7. enum EndianType {
  8. little_endian = 0,
  9. big_endian
  10. };
  11. AFUN_TOOL_EXPORT extern enum EndianType endian;
  12. AFUN_TOOL_EXPORT extern enum EndianType save_as;
  13. AFUN_TOOL_EXPORT void getEndian();
  14. template <typename T>
  15. bool byteWriteInt(FILE *file, T num);;
  16. AFUN_TOOL_EXPORT bool byteWriteStr(FILE *file, const char *str);
  17. AFUN_TOOL_EXPORT bool byteWriteStr(FILE *file, const std::string &str);
  18. template <typename T>
  19. bool byteReadInt(FILE *file, T *num);
  20. AFUN_TOOL_EXPORT bool byteReadStr(FILE *file, std::string &str);
  21. AFUN_TOOL_EXPORT bool byteReadStr(FILE *file, char *&str);
  22. }
  23. #include "byte.template.h"
  24. #endif //AFUN_BYTE_H