2
0

tool_byte.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef AFUN_TOOL_BYTE_H
  2. #define AFUN_TOOL_BYTE_H
  3. #include "aFunToolExport.h"
  4. #ifdef __cplusplus
  5. #include <cstdio> // NOLINT
  6. #include <iostream>
  7. #else
  8. #include <stdio.h>
  9. #endif
  10. #ifndef AFUN_TOOL_C
  11. namespace aFuntool {
  12. #endif
  13. enum EndianType {
  14. little_endian = 0,
  15. big_endian
  16. };
  17. AFUN_TOOL_C_EXPORT_VAR enum EndianType endian;
  18. AFUN_TOOL_C_EXPORT_VAR enum EndianType save_as;
  19. AFUN_TOOL_C_EXPORT_FUNC void getEndian();
  20. #ifdef __cplusplus
  21. template <typename T>
  22. bool byteWriteInt(FILE *file, T num);
  23. #endif
  24. AFUN_TOOL_C_EXPORT_FUNC bool byteWriteStr(FILE *file, const char *str);
  25. #ifdef __cplusplus
  26. AFUN_TOOL_EXPORT bool byteWriteStr(FILE *file, const std::string &str);
  27. #endif
  28. #ifdef __cplusplus
  29. template <typename T>
  30. bool byteReadInt(FILE *file, T *num);
  31. #endif
  32. AFUN_TOOL_EXPORT bool byteReadStr(FILE *file, char **str);
  33. #ifdef __cplusplus
  34. AFUN_TOOL_C_EXPORT_FUNC bool byteReadStr(FILE *file, std::string &str);
  35. #endif
  36. #ifndef AFUN_TOOL_C
  37. }
  38. #endif
  39. #include "tool_byte.template.h"
  40. #endif //AFUN_TOOL_BYTE_H