FileInMemory.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef _FileInMemory_h_
  2. #define _FileInMemory_h_
  3. /* FileInMemory.h
  4. *
  5. * Copyright (C) 2011-2017 David Weenink, 2015,2018 Paul Boersma
  6. *
  7. * This code is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * This code is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this work. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #include "Collection.h"
  21. #include "Strings_.h"
  22. #include "FileInMemory_def.h"
  23. autoFileInMemory FileInMemory_create (MelderFile file);
  24. /*
  25. If the FileInMemory is created from static data we do not need to copy the data into the object but only
  26. create a link to the data. This implies that the data cannot be deleted if the FileInMemory object gets
  27. destroyed. However, if the FileInMemory object is copied, for example, then we also have to copy the data,
  28. and the copied object has to become owner of these copied data. This is automatically guaranteed by our
  29. implementation, because _dontOwnData is default-initialised as false.
  30. Only if we create a FileInMemory object from data we have to be explicit about ownership.
  31. */
  32. autoFileInMemory FileInMemory_createWithData (integer numberOfBytes, const char *data, bool isStaticData, conststring32 path, conststring32 id);
  33. void FileInMemory_setId (FileInMemory me, conststring32 newId);
  34. void FileInMemory_showAsCode (FileInMemory me, conststring32 name, integer numberOfBytesPerLine);
  35. #endif // _FileInMemory_h_