本文整理汇总了C++中IsOpened函数的典型用法代码示例。如果您正苦于以下问题:C++ IsOpened函数的具体用法?C++ IsOpened怎么用?C++ IsOpened使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsOpened函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: wxCHECK_MSG
bool wxDir::GetFirst(wxString *filename,
const wxString& filespec,
int flags) const
{
wxCHECK_MSG( IsOpened(), false, wxT("must wxDir::Open() first") );
M_DIR->Rewind();
M_DIR->SetFileSpec(filespec);
M_DIR->SetFlags(flags);
return GetNext(filename);
}
开发者ID:lukesingh24,项目名称:wxWidgets,代码行数:13,代码来源:dir.cpp
示例2: UNREFERENCED_PARAMETER
void CLCDOutput::OnDisconnecting(int hConnection)
{
UNREFERENCED_PARAMETER(hConnection);
LOGITRACE(_T("CLCDOutput::OnDisconnecting\n"));
// let's hope our device is already gone
LOGIASSERT(!IsOpened());
if (LGLCD_INVALID_CONNECTION != m_hConnection)
{
lgLcdDisconnect(m_hConnection);
m_hConnection = LGLCD_INVALID_CONNECTION;
}
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:13,代码来源:LCDOutput.cpp
示例3: MULE_VALIDATE_STATE
bool CFile::SetLength(size_t new_len)
{
MULE_VALIDATE_STATE(IsOpened(), wxT("CFile: Cannot set length when no file is open."));
#ifdef __WXMSW__
int result = chsize(m_fd, new_len);
#else
int result = ftruncate(m_fd, new_len);
#endif
SYSCALL_CHECK((result != -1), wxT("truncating file"));
return (result != -1);
}
开发者ID:palopezv,项目名称:amule-emc,代码行数:14,代码来源:CFile.cpp
示例4: Flush
bool wxFFile::Flush()
{
if ( IsOpened() )
{
if ( fflush(m_fp) != 0 )
{
wxLogSysError(_("failed to flush the file '%s'"), m_name.c_str());
return false;
}
}
return true;
}
开发者ID:krossell,项目名称:wxWidgets,代码行数:14,代码来源:ffile.cpp
示例5: DropTables
void CompilationDatabase::DropTables()
{
if(!IsOpened()) return;
try {
// Create the schema
m_db->ExecuteUpdate("DROP TABLE COMPILATION_TABLE");
m_db->ExecuteUpdate("DROP TABLE SCHEMA_VERSION");
} catch(wxSQLite3Exception& e) {
wxUnusedVar(e);
}
}
开发者ID:292388900,项目名称:codelite,代码行数:14,代码来源:compilation_database.cpp
示例6: UNREFERENCED_PARAMETER
void CLCDOutput::OnDisconnecting(int hConnection)
{
UNREFERENCED_PARAMETER(hConnection);
LCDUITRACE(_T("CLCDOutput::OnDisconnecting\n"));
// let's hope our device is already gone
LCDUIASSERT(!IsOpened());
if (LGLCD_INVALID_CONNECTION != m_hConnection)
{
lgLcdDisconnect(m_hConnection);
m_hConnection = LGLCD_INVALID_CONNECTION;
ZeroMemory(m_pLastBitmap, sizeof(lgLcdBitmap160x43x1));
}
}
开发者ID:Samangan,项目名称:mpc-hc,代码行数:14,代码来源:LCDOutput.cpp
示例7: Bind
void TCPSocket::Bind( const sockaddr_in& addr )
{
int error;
if (!IsOpened())
{
throw TCPException("Socket::bind","Socket没有打开");
}
const sockaddr* socketAddress = reinterpret_cast<const sockaddr*>(&addr);
error = ::bind(m_descriptor,socketAddress,sizeof(addr));
if(error == SOCKET_ERROR )
{
throw TCPException("Socket::bind","绑定Socket失败",error);
}
}
开发者ID:jiangxilong,项目名称:RemoteControlSystem,代码行数:14,代码来源:TCPSocket.cpp
示例8: throw
void TCPSocket::Connect( const sockaddr_in& addr ) throw(TCPException)
{
int error;
if(!IsOpened())
{
throw TCPException("Socket::connect", "Socket没有打开");
}
const sockaddr* socketAddress = reinterpret_cast<const sockaddr*>(&addr);
error = ::connect(m_descriptor, socketAddress, sizeof(addr));
if (error == SOCKET_ERROR)
{
//throw TCPException("Socket::connect","Socket连接出错",error);
}
}
开发者ID:jiangxilong,项目名称:RemoteControlSystem,代码行数:14,代码来源:TCPSocket.cpp
示例9: wxCHECK
// read
ssize_t wxFile::Read(void *pBuf, size_t nCount)
{
wxCHECK( (pBuf != NULL) && IsOpened(), 0 );
ssize_t iRc = wxRead(m_fd, pBuf, nCount);
if ( CheckForError(iRc) )
{
wxLogSysError(_("can't read from file descriptor %d"), m_fd);
return wxInvalidOffset;
}
return iRc;
}
开发者ID:Toonerz,项目名称:project64,代码行数:15,代码来源:file.cpp
示例10: GetOvelappedIoResult
bool AdbIOCompletion::GetOvelappedIoResult(LPOVERLAPPED ovl_data,
ULONG* bytes_transferred,
bool wait) {
if (NULL != bytes_transferred)
*bytes_transferred = 0;
if (!IsOpened()) {
SetLastError(ERROR_INVALID_HANDLE);
return false;
}
ULONG transfer;
bool ret = GetOverlappedResult(parent_io_object()->usb_handle(),
overlapped(),
&transfer,
wait) ? true :
false;
// TODO: This is bizzare but I've seen it happening
// that GetOverlappedResult with wait set to true returns "prematurely",
// with wrong transferred bytes value and GetLastError reporting
// ERROR_IO_PENDING. So, lets give it an up to a 20 ms loop!
ULONG error = GetLastError();
if (wait && ret && (0 == transfer) && (0 != expected_transfer_size_) &&
((ERROR_IO_INCOMPLETE == error) || (ERROR_IO_PENDING == error))) {
for (int trying = 0; trying < 10; trying++) {
Sleep(2);
ret = GetOverlappedResult(parent_io_object()->usb_handle(),
overlapped(),
&transfer,
wait) ? true :
false;
error = GetLastError();
if (!ret || (0 != transfer) ||
((ERROR_IO_INCOMPLETE != error) && (ERROR_IO_PENDING != error))) {
break;
}
}
}
if (NULL != ovl_data)
CopyMemory(ovl_data, overlapped(), sizeof(OVERLAPPED));
if (NULL != bytes_transferred)
*bytes_transferred = is_write_ioctl() ? transferred_bytes_ : transfer;
return ret;
}
开发者ID:Katarzynasrom,项目名称:patch-hosting-for-android-x86-support,代码行数:49,代码来源:adb_io_completion.cpp
示例11: GetUsbDeviceDescriptor
bool AdbInterfaceObject::GetUsbDeviceDescriptor(USB_DEVICE_DESCRIPTOR* desc) {
if (!IsOpened()) {
SetLastError(ERROR_INVALID_HANDLE);
return false;
}
if (NULL == desc) {
SetLastError(ERROR_INVALID_PARAMETER);
return false;
}
CopyMemory(desc, usb_device_descriptor(), sizeof(USB_DEVICE_DESCRIPTOR));
return true;
}
开发者ID:26597925,项目名称:mt36k_android_4.0.4,代码行数:15,代码来源:adb_interface.cpp
示例12: MULE_VALIDATE_STATE
sint64 CFile::doSeek(sint64 offset) const
{
MULE_VALIDATE_STATE(IsOpened(), wxT("Cannot seek on closed file."));
MULE_VALIDATE_PARAMS(offset >= 0, wxT("Invalid position, must be positive."));
sint64 result = SEEK_FD(m_fd, offset, SEEK_SET);
if (result == offset) {
return result;
} else if (result == wxInvalidOffset) {
throw CSeekFailureException(wxString(wxT("Seeking failed: ")) + wxSysErrorMsg());
} else {
throw CSeekFailureException(wxT("Seeking returned incorrect position"));
}
}
开发者ID:StrongZhu,项目名称:amule,代码行数:15,代码来源:CFile.cpp
示例13: Close
// close
bool wxFile::Close()
{
if ( IsOpened() ) {
if ( CheckForError(wxClose(m_fd)) )
{
wxLogSysError(_("can't close file descriptor %d"), m_fd);
m_fd = fd_invalid;
return false;
}
else
m_fd = fd_invalid;
}
return true;
}
开发者ID:Toonerz,项目名称:project64,代码行数:16,代码来源:file.cpp
示例14: wxConstCast
bool wxPipeInputStream::CanRead() const
{
// we can read if there's something in the put back buffer
// even pipe is closed
if ( m_wbacksize > m_wbackcur )
return true;
wxPipeInputStream * const self = wxConstCast(this, wxPipeInputStream);
if ( !IsOpened() )
{
// set back to mark Eof as it may have been unset by Ungetch()
self->m_lasterror = wxSTREAM_EOF;
return false;
}
DWORD nAvailable;
// function name is misleading, it works with anon pipes as well
DWORD rc = ::PeekNamedPipe
(
m_hInput, // handle
NULL, 0, // ptr to buffer and its size
NULL, // [out] bytes read
&nAvailable, // [out] bytes available
NULL // [out] bytes left
);
if ( !rc )
{
if ( ::GetLastError() != ERROR_BROKEN_PIPE )
{
// unexpected error
wxLogLastError(wxT("PeekNamedPipe"));
}
// don't try to continue reading from a pipe if an error occurred or if
// it had been closed
::CloseHandle(m_hInput);
self->m_hInput = INVALID_HANDLE_VALUE;
self->m_lasterror = wxSTREAM_EOF;
nAvailable = 0;
}
return nAvailable != 0;
}
开发者ID:vdm113,项目名称:wxWidgets-ICC-patch,代码行数:48,代码来源:utilsexc.cpp
示例15: assert
int Tcp::Connect(/* [in] */ const Address &addr,
/* [in] */ OutConnectHandler *handler)
{
assert(IsOpened());
int result = uv_tcp_connect(&m_connectReq,
*this,
addr,
OnConnected);
if(! result) {
Ref();
m_pOutConnectHandler = handler;
}
return result;
}
开发者ID:LiTianjue,项目名称:uvpp,代码行数:16,代码来源:uv++-tcp.cpp
示例16: Flush
// flush
bool wxFile::Flush()
{
if ( IsOpened() ) {
#if defined(__VISUALC__) || wxHAVE_FSYNC
if ( wxFsync(m_fd) == -1 )
{
wxLogSysError(_("can't flush file descriptor %d"), m_fd);
return false;
}
#else // no fsync
// just do nothing
#endif // fsync
}
return true;
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:17,代码来源:file.cpp
示例17: printf
void Minesweeper::PrintSolvingField()
{
printf( "\n");
for (size_t i = 0; i < m_height + 2; ++i)
{
for (size_t j = 0; j < m_width + 2; ++j)
{
//if (m_solvingField[i][j] == 10)
if (!IsOpened(j, i))
printf( ANSI_COLOR_YELLOW "- " ANSI_COLOR_RESET);
else
printf("%lu ", m_solvingField[i][j]);
}
printf( "\n");
}
}
开发者ID:FruitClover,项目名称:Minesweeper,代码行数:16,代码来源:Minesweeper.cpp
示例18: wxCHECK_MSG
size_t wxFFile::Write(const void *pBuf, size_t nCount)
{
if ( !nCount )
return 0;
wxCHECK_MSG( pBuf, 0, wxT("invalid parameter") );
wxCHECK_MSG( IsOpened(), 0, wxT("can't write to closed file") );
size_t nWritten = fwrite(pBuf, 1, nCount, m_fp);
if ( nWritten < nCount )
{
wxLogSysError(_("Write error on file '%s'"), m_name.c_str());
}
return nWritten;
}
开发者ID:vdm113,项目名称:wxWidgets-ICC-patch,代码行数:16,代码来源:ffile.cpp
示例19: ASSUME
i64 FileCFILEStream::OffsetGet( FileOffsetMode::mode_t offsetMode, CError *error )
{
ASSUME( IsOpened() );
if( offsetMode == FileOffsetMode::FromCurrent )
{
DSA( error, Error::Ok() );
return 0;
}
DSA( error, Error::UnknownError() );
i64 currentOffset = ftell( (FILE *)_file );
if( currentOffset == -1 )
{
return 0;
}
if( offsetMode == FileOffsetMode::FromBegin )
{
DSA( error, Error::Ok() );
return currentOffset - _offsetToStart;
}
ASSUME( offsetMode == FileOffsetMode::FromEnd );
if( fseek( (FILE *)_file, 0, SEEK_END ) != 0 )
{
return 0;
}
i64 fileEnd = ftell( (FILE *)_file );
if( fileEnd == -1 )
{
return 0;
}
i64 offsetDiff = currentOffset - fileEnd;
if( fseek( (FILE *)_file, currentOffset, SEEK_SET ) != 0 )
{
return 0;
}
DSA( error, Error::Ok() );
return offsetDiff;
}
开发者ID:Industrialice,项目名称:StdLib,代码行数:47,代码来源:FileCFILEStream.cpp
示例20: Flush
// flush
bool wxFile::Flush()
{
#ifdef HAVE_FSYNC
// fsync() only works on disk files and returns errors for pipes, don't
// call it then
if ( IsOpened() && GetKind() == wxFILE_KIND_DISK )
{
if ( CheckForError(wxFsync(m_fd)) )
{
wxLogSysError(_("can't flush file descriptor %d"), m_fd);
return false;
}
}
#endif // HAVE_FSYNC
return true;
}
开发者ID:Toonerz,项目名称:project64,代码行数:18,代码来源:file.cpp
注:本文中的IsOpened函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论