cef/libcef_dll/ctocpp/zip_reader_ctocpp.cc

142 lines
3.2 KiB
C++

// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// A portion of this file was generated by the CEF translator tool. When
// making changes by hand only do so within the body of existing static and
// virtual method implementations. See the translator.README.txt file in the
// tools directory for more information.
//
#include "libcef_dll/ctocpp/stream_reader_ctocpp.h"
#include "libcef_dll/ctocpp/zip_reader_ctocpp.h"
// STATIC METHODS - Body may be edited by hand.
CefRefPtr<CefZipReader> CefZipReader::Create(CefRefPtr<CefStreamReader> stream)
{
cef_zip_reader_t* impl = cef_zip_reader_create(
CefStreamReaderCToCpp::Unwrap(stream));
if(impl)
return CefZipReaderCToCpp::Wrap(impl);
return NULL;
}
// VIRTUAL METHODS - Body may be edited by hand.
bool CefZipReaderCToCpp::MoveToFirstFile()
{
if(CEF_MEMBER_MISSING(struct_, move_to_first_file))
return false;
return struct_->move_to_first_file(struct_) ? true : false;
}
bool CefZipReaderCToCpp::MoveToNextFile()
{
if(CEF_MEMBER_MISSING(struct_, move_to_next_file))
return false;
return struct_->move_to_next_file(struct_) ? true : false;
}
bool CefZipReaderCToCpp::MoveToFile(const std::wstring& fileName,
bool caseSensitive)
{
if(CEF_MEMBER_MISSING(struct_, move_to_file))
return false;
return struct_->move_to_file(struct_, fileName.c_str(), caseSensitive) ?
true : false;
}
bool CefZipReaderCToCpp::Close()
{
if(CEF_MEMBER_MISSING(struct_, close))
return false;
return struct_->close(struct_) ? true : false;
}
std::wstring CefZipReaderCToCpp::GetFileName()
{
std::wstring str;
if(CEF_MEMBER_MISSING(struct_, get_file_name))
return str;
cef_string_t cef_str = struct_->get_file_name(struct_);
if(cef_str) {
str = cef_str;
cef_string_free(cef_str);
}
return str;
}
long CefZipReaderCToCpp::GetFileSize()
{
if(CEF_MEMBER_MISSING(struct_, get_file_size))
return -1;
return struct_->get_file_size(struct_);
}
time_t CefZipReaderCToCpp::GetFileLastModified()
{
if(CEF_MEMBER_MISSING(struct_, get_file_last_modified))
return 0;
return struct_->get_file_last_modified(struct_);
}
bool CefZipReaderCToCpp::OpenFile(const std::wstring& password)
{
if(CEF_MEMBER_MISSING(struct_, open_file))
return 0;
return struct_->open_file(struct_, password.c_str()) ? true : false;
}
bool CefZipReaderCToCpp::CloseFile()
{
if(CEF_MEMBER_MISSING(struct_, close_file))
return 0;
return struct_->close_file(struct_) ? true : false;
}
int CefZipReaderCToCpp::ReadFile(void* buffer, size_t bufferSize)
{
if(CEF_MEMBER_MISSING(struct_, read_file))
return -1;
return struct_->read_file(struct_, buffer, bufferSize);
}
long CefZipReaderCToCpp::Tell()
{
if(CEF_MEMBER_MISSING(struct_, tell))
return -1;
return struct_->tell(struct_);
}
bool CefZipReaderCToCpp::Eof()
{
if(CEF_MEMBER_MISSING(struct_, eof))
return false;
return struct_->eof(struct_) ? true : false;
}
#ifdef _DEBUG
long CefCToCpp<CefZipReaderCToCpp, CefZipReader, cef_zip_reader_t>::DebugObjCt =
0;
#endif