reader.inline.h 831 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef AFUN_READER_INLINE_H
  2. #define AFUN_READER_INLINE_H
  3. #include "reader.h"
  4. namespace aFuncore {
  5. inline Reader::Reader(aFuntool::FilePath path_, aFuntool::FileLine line_)
  6. : path{std::move(path_)}, line{line_}, read_end{false}, read_error{false} {
  7. buf = aFuntool::safeCalloc<char>(DEFAULT_BUF_SIZE + 1);
  8. buf_size = DEFAULT_BUF_SIZE; // buf_size 不包括NUL
  9. read = buf;
  10. }
  11. size_t Reader::countRead() const {
  12. return read - buf;
  13. }
  14. bool Reader::isEnd() const {
  15. return read_end;
  16. }
  17. bool Reader::isError() const {
  18. return read_error;
  19. }
  20. aFuntool::FileLine Reader::getFileLine() const {
  21. return line;
  22. }
  23. const aFuntool::FilePath &Reader::getFilePath() const {
  24. return path;
  25. }
  26. }
  27. #endif //AFUN_READER_INLINE_H