Opera 12.15 Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FileWrapper.cpp 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. /* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
  2. **
  3. ** Copyright (C) 2011 Opera Software ASA. All rights reserved.
  4. **
  5. ** This file is part of the Opera web browser.
  6. ** It may not be distributed under any circumstances.
  7. */
  8. #include "core/pch.h"
  9. #include "modules/search_engine/FileWrapper.h"
  10. FileWrapper::FileWrapper(OpLowLevelFile* wrapped_file, BOOL transfer_ownership)
  11. : m_f(wrapped_file),
  12. m_owns_file(transfer_ownership),
  13. m_mode(0)
  14. {
  15. }
  16. FileWrapper::~FileWrapper()
  17. {
  18. if (m_owns_file)
  19. OP_DELETE(m_f);
  20. }
  21. OP_STATUS FileWrapper::GetFileInfo(OpFileInfo* info)
  22. {
  23. return m_f->GetFileInfo(info);
  24. }
  25. const uni_char* FileWrapper::GetFullPath() const
  26. {
  27. return m_f->GetFullPath();
  28. }
  29. const uni_char* FileWrapper::GetSerializedName() const
  30. {
  31. return m_f->GetSerializedName();
  32. }
  33. OP_STATUS FileWrapper::GetLocalizedPath(OpString *localized_path) const
  34. {
  35. return m_f->GetLocalizedPath(localized_path);
  36. }
  37. BOOL FileWrapper::IsWritable() const
  38. {
  39. return m_f->IsWritable();
  40. }
  41. OP_STATUS FileWrapper::Open(int mode)
  42. {
  43. m_mode = mode;
  44. OP_STATUS status = m_f->Open(mode);
  45. if (OpStatus::IsError(status))
  46. m_mode = 0;
  47. return status;
  48. }
  49. BOOL FileWrapper::IsOpen() const
  50. {
  51. return m_f->IsOpen();
  52. }
  53. OP_STATUS FileWrapper::Close()
  54. {
  55. return m_f->Close();
  56. }
  57. OP_STATUS FileWrapper::MakeDirectory()
  58. {
  59. return m_f->MakeDirectory();
  60. }
  61. #ifdef SUPPORT_OPFILEINFO_CHANGE
  62. OP_STATUS FileWrapper::ChangeFileInfo(const OpFileInfoChange* changes)
  63. {
  64. return m_f->ChangeFileInfo(changes);
  65. }
  66. #endif
  67. BOOL FileWrapper::Eof() const
  68. {
  69. return m_f->Eof();
  70. }
  71. OP_STATUS FileWrapper::Exists(BOOL* exists) const
  72. {
  73. return m_f->Exists(exists);
  74. }
  75. OP_STATUS FileWrapper::GetFilePos(OpFileLength* pos) const
  76. {
  77. return m_f->GetFilePos(pos);
  78. }
  79. OP_STATUS FileWrapper::SetFilePos(OpFileLength pos, OpSeekMode mode /* = SEEK_FROM_START */)
  80. {
  81. return m_f->SetFilePos(pos, mode);
  82. }
  83. OP_STATUS FileWrapper::GetFileLength(OpFileLength* len) const
  84. {
  85. return m_f->GetFilePos(len);
  86. }
  87. OP_STATUS FileWrapper::Write(const void* data, OpFileLength len)
  88. {
  89. return m_f->Write(data, len);
  90. }
  91. OP_STATUS FileWrapper::Read(void* data, OpFileLength len, OpFileLength* bytes_read)
  92. {
  93. return m_f->Read(data, len, bytes_read);
  94. }
  95. OP_STATUS FileWrapper::ReadLine(char** data)
  96. {
  97. return m_f->ReadLine(data);
  98. }
  99. OpLowLevelFile* FileWrapper::CreateCopy()
  100. {
  101. return m_f->CreateCopy();
  102. }
  103. OpLowLevelFile* FileWrapper::CreateTempFile(const uni_char* prefix)
  104. {
  105. return m_f->CreateTempFile(prefix);
  106. }
  107. OP_STATUS FileWrapper::CopyContents(const OpLowLevelFile* copy)
  108. {
  109. return m_f->CopyContents(copy);
  110. }
  111. OP_STATUS FileWrapper::SafeClose()
  112. {
  113. return m_f->SafeClose();
  114. }
  115. OP_STATUS FileWrapper::SafeReplace(OpLowLevelFile* new_file)
  116. {
  117. return m_f->SafeReplace(new_file);
  118. }
  119. OP_STATUS FileWrapper::Delete()
  120. {
  121. return m_f->Delete();
  122. }
  123. OP_STATUS FileWrapper::Flush()
  124. {
  125. return m_f->Flush();
  126. }
  127. OP_STATUS FileWrapper::SetFileLength(OpFileLength len)
  128. {
  129. return m_f->SetFileLength(len);
  130. }
  131. #ifdef PI_ASYNC_FILE_OP
  132. void FileWrapper::SetListener(OpLowLevelFileListener* listener)
  133. {
  134. OP_ASSERT(!"Not implemented");
  135. }
  136. OP_STATUS FileWrapper::ReadAsync(void* data, OpFileLength len, OpFileLength abs_pos)
  137. {
  138. OP_ASSERT(!"Not implemented");
  139. return OpStatus::ERR_NOT_SUPPORTED;
  140. }
  141. OP_STATUS FileWrapper::WriteAsync(const void* data, OpFileLength len, OpFileLength abs_pos)
  142. {
  143. OP_ASSERT(!"Not implemented");
  144. return OpStatus::ERR_NOT_SUPPORTED;
  145. }
  146. OP_STATUS FileWrapper::DeleteAsync()
  147. {
  148. OP_ASSERT(!"Not implemented");
  149. return OpStatus::ERR_NOT_SUPPORTED;
  150. }
  151. OP_STATUS FileWrapper::FlushAsync()
  152. {
  153. OP_ASSERT(!"Not implemented");
  154. return OpStatus::ERR_NOT_SUPPORTED;
  155. }
  156. OP_STATUS FileWrapper::Sync()
  157. {
  158. OP_ASSERT(!"Not implemented");
  159. return OpStatus::ERR_NOT_SUPPORTED;
  160. }
  161. BOOL FileWrapper::IsAsyncInProgress()
  162. {
  163. OP_ASSERT(!"Not implemented");
  164. return OpStatus::ERR_NOT_SUPPORTED;
  165. }
  166. #endif // PI_ASYNC_FILE_OP