virtual_file.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. XCC Utilities and Library
  3. Copyright (C) 2000 Olaf van der Spek <[email protected]>
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <https://www.gnu.org/licenses/>.
  14. */
  15. #pragma once
  16. #include <list>
  17. #include <virtual_binary.h>
  18. using namespace std;
  19. class Cvirtual_file
  20. {
  21. public:
  22. int save(const string& fname) const;
  23. int load(const string& fname);
  24. void clear();
  25. void compact();
  26. const byte* data() const;
  27. int size() const;
  28. Cvirtual_binary read() const;
  29. int read(void* d) const;
  30. void write(const Cvirtual_binary& d);
  31. void write(const void* d, int cb_d);
  32. Cvirtual_file();
  33. Cvirtual_file(const Cvirtual_binary& d);
  34. private:
  35. using t_data = list<Cvirtual_binary>;
  36. t_data m_data;
  37. };