• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ CloseAll函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中CloseAll函数的典型用法代码示例。如果您正苦于以下问题:C++ CloseAll函数的具体用法?C++ CloseAll怎么用?C++ CloseAll使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了CloseAll函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: InitListeningSocket

static int InitListeningSocket(ChatDetails* _chat, char* _ip)
{
	int optval = 1;
	struct ip_mreq mreq;

	mreq.imr_multiaddr.s_addr = inet_addr(_ip);
	mreq.imr_interface.s_addr = htonl(INADDR_ANY);

	if ((_chat->m_listeningSocket = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
	{
		perror("socket failed1\n");
		free(_chat);
		return -1;
	}
	if (setsockopt(_chat->m_listeningSocket, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) < 0)
	{
		perror("setsockopt failed1\n");
		CloseAll(_chat);
		return -1;
	}
	if (bind(_chat->m_listeningSocket, (struct sockaddr*)&_chat->m_recvAddr, sizeof(_chat->m_recvAddr)) < 0)
	{
		perror("bind failed\n");
		CloseAll(_chat);
		return -1;
	}
	if (setsockopt(_chat->m_listeningSocket, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char*)&mreq, sizeof(mreq)) < 0)
	{
		perror("setsockopt failed2\n");
		CloseAll(_chat);
		return -1;
	}
	return 0;
}
开发者ID:yonathanPodolak,项目名称:c_chatServer,代码行数:34,代码来源:chat.c


示例2: InitSelectGroup

void InitSelectGroup (struct MCMap *SelectGroup, gint start)
{
    gulong i,j;

    errormsg(MAPDEBUG1,"InitSelectGroup: Entered");

    SelectGroup->mm_MapSize.x = SELXSIZE;
    SelectGroup->mm_MapSize.y = SELYSIZE;
    SelectGroup->mm_MapSize.l = 2;
    SelectGroup->mm_Copy = FALSE;
    SelectGroup->mm_Size = sizeof(struct MCMap);
    SelectGroup->mm_NextLayer = NULL;
    SelectGroup->mm_Columns = g_malloc0(sizeof(gulong)*SELYSIZE);
    if (!SelectGroup->mm_Columns)
    {
      printf("Could not allocate memory for SelectGroup\n");
      CloseAll();
      exit(20);
    }
#if DEBUGLEV > 2
    errormsg(MAPDEBUG3,"InitSelectGroup: SelectGroup->mm_Columns=%x, ",
	     SelectGroup->mm_Columns);
#endif

    for(i=0;i<SELYSIZE;i++)
    {
        SelectGroup->mm_Rows = g_malloc0(sizeof(struct MapPiece)*SELXSIZE);
#if DEBUGLEV > 5
	errormsg(MAPDEBUG3,"InitSelectGroup: i=%d, SelectGroup->mm_Rows=%x",i,
		 SelectGroup->mm_Rows);
#endif
        if (!SelectGroup->mm_Rows)
        {
            printf("Could not allocate memory for SelectGroup\n");
            CloseAll();
            exit(20);
        }
        SelectGroup->mm_Columns[i] = (gulong)SelectGroup->mm_Rows;

        for(j=0;j<SELXSIZE;j++)
        {
#if DEBUGLEV > 5
	    errormsg(MAPDEBUG6,"InitSelectGroup: j=%d",j);
#endif
            SelectGroup->mm_Rows[j].mp_Coordinates.x = j * 37;
            SelectGroup->mm_Rows[j].mp_Coordinates.y = i * 13;
            SelectGroup->mm_Rows[j].mp_Coordinates.l = 1;
            SelectGroup->mm_Rows[j].mp_PixbufNumber = start+i*SELYSIZE+j;
            SelectGroup->mm_Rows[j].mp_Size = sizeof(struct MapPiece);
        }
    }

    errormsg(MAPDEBUG1,"InitSelectGroup: Finished succesfully");
}
开发者ID:BackupTheBerlios,项目名称:pertergrin-svn,代码行数:54,代码来源:testmapedit.c


示例3: main

int main( int argc, char **argv )
{
#ifdef DELLOG
    {
        FILE *fh;

        fh=fopen(getLogfile(),"w");
	fclose(fh);
    }
#endif
    gtk_init(&argc, &argv);

#if DEBUGLEV > 4
    errormsg(MAPMSG,"\nmain: Trying to load MapPieces Pixbuf...");
#endif
    if (!MapPicLoad())
    {
        printf("Could not load MapPieces Bitmap.\n");
        CloseAll();
        exit(20);
    }
#if DEBUGLEV > 4
    errormsg(MAPMSG,".Done\nmain: Trying to initialize window..");
#endif

    if (!(WO_Window=InitTestMEdWindow()))
    {
        printf("Did not get a Window pointer. Continuing anyway..\n");
        //CloseAll();
        //exit(20);
    }
#if DEBUGLEV > 4
    errormsg(MAPMSG,".Done\nMain Loop\n");
#endif

    /* Main Loop */

    gtk_main();

#if DEBUGLEV > 4
    errormsg(MAPMSG,"Exiting..");
#endif
    CloseAll();
#if DEBUGLEV > 4
    errormsg(MAPMSG,".Done\n");
#endif
    exit(0);
}
开发者ID:BackupTheBerlios,项目名称:pertergrin-svn,代码行数:48,代码来源:testmapedit.c


示例4: MaybeShutdown

void
MessagePortService::CloseAll(const nsID& aUUID)
{
  MessagePortServiceData* data;
  if (!mPorts.Get(aUUID, &data)) {
    MaybeShutdown();
    return;
  }

  if (data->mParent) {
    data->mParent->Close();
  }

  for (const MessagePortServiceData::NextParent& parent : data->mNextParents) {
    parent.mParent->CloseAndDelete();
  }

  nsID destinationUUID = data->mDestinationUUID;
  mPorts.Remove(aUUID);

  CloseAll(destinationUUID);

  // CloseAll calls itself recursively and it can happen that it deletes
  // itself. Before continuing we must check if we are still alive.
  if (!gInstance) {
    return;
  }

#ifdef DEBUG
  mPorts.EnumerateRead(CloseAllDebugCheck, const_cast<nsID*>(&aUUID));
#endif

  MaybeShutdown();
}
开发者ID:Manishearth,项目名称:gecko-dev,代码行数:34,代码来源:MessagePortService.cpp


示例5: MOZ_ASSERT

bool
MessagePortService::ClosePort(MessagePortParent* aParent)
{
  MessagePortServiceData* data;
  if (!mPorts.Get(aParent->ID(), &data)) {
    MOZ_ASSERT(false, "Unknown MessagePortParent should not happend.");
    return false;
  }

  if (data->mParent != aParent) {
    MOZ_ASSERT(false, "ClosePort() should be called just from the correct parent.");
    return false;
  }

  if (!data->mNextParents.IsEmpty()) {
    MOZ_ASSERT(false, "ClosePort() should be called when there are not next parents.");
    return false;
  }

  // We don't want to send a message to this parent.
  data->mParent = nullptr;

  CloseAll(aParent->ID());
  return true;
}
开发者ID:Manishearth,项目名称:gecko-dev,代码行数:25,代码来源:MessagePortService.cpp


示例6: CloseAll

// Destructor
CHtmlHelpControl::~CHtmlHelpControl()
{
	// Shut down the help control
	CloseAll();
	// Unload the control if we have it loaded.
	Unload();
}
开发者ID:jimmccurdy,项目名称:ArchiveGit,代码行数:8,代码来源:hhctrl.cpp


示例7: OnClose

void wxGenericMDIParentFrame::OnClose(wxCloseEvent& event)
{
    if ( !CloseAll() )
        event.Veto();
    else
        event.Skip();
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:7,代码来源:mdig.cpp


示例8: CloseAll

void MainBook::RestoreSession(SessionEntry& session)
{
    if(session.GetTabInfoArr().empty()) return; // nothing to restore

    CloseAll(false);
    size_t sel = session.GetSelectedTab();
    const std::vector<TabInfo>& vTabInfoArr = session.GetTabInfoArr();
    for(size_t i = 0; i < vTabInfoArr.size(); i++) {
        const TabInfo& ti = vTabInfoArr[i];
        m_reloadingDoRaise = (i == vTabInfoArr.size() - 1); // Raise() when opening only the last editor
        LEditor* editor = OpenFile(ti.GetFileName());
        if(!editor) {
            if(i < sel) {
                // have to adjust selected tab number because couldn't open tab
                sel--;
            }
            continue;
        }

        editor->SetFirstVisibleLine(ti.GetFirstVisibleLine());
        editor->SetEnsureCaretIsVisible(editor->PositionFromLine(ti.GetCurrentLine()));
        editor->LoadMarkersFromArray(ti.GetBookmarks());
        editor->LoadCollapsedFoldsFromArray(ti.GetCollapsedFolds());
    }
    m_book->SetSelection(sel);
}
开发者ID:fmestrone,项目名称:codelite,代码行数:26,代码来源:mainbook.cpp


示例9: CloseAll

void BattleScene::CleanupBattle()
{
	stage = 0;
	scroll_timer = 0;

	for (int i = 0; i < 6; i++)
	{
		if (opponent[i] != 0)
		{
			delete opponent[i];
			opponent[i] = 0;
		}
	}

	if (opponent_image)
	{
		//delete opponent_image;
		//opponent_image = 0;
	}
	if (party_status)
	{
		delete party_status;
		party_status = 0;
	}

	CloseAll(); //close all textboxes
}
开发者ID:Lin20,项目名称:projectpmr,代码行数:27,代码来源:BattleScene.cpp


示例10: LOG

bool MediaSourceV4L2::CloseGrabDevice()
{
    bool tResult = false;

    LOG(LOG_VERBOSE, "Going to close");

    if (mMediaType == MEDIA_AUDIO)
    {
        LOG(LOG_ERROR, "Wrong media type");
        return false;
    }

    if (mMediaSourceOpened)
    {
        CloseAll();

        // Free the frames
        av_free(mRGBFrame);
        av_free(mSourceFrame);

        tResult = true;
    }else
        LOG(LOG_INFO, "...wasn't open");

    mGrabbingStopped = false;
    mSupportsMultipleInputChannels = false;
    mMediaType = MEDIA_UNKNOWN;

    ResetPacketStatistic();

    return tResult;
}
开发者ID:nolines,项目名称:Homer-Conferencing,代码行数:32,代码来源:MediaSourceV4L2.cpp


示例11: switch

void wxGenericMDIParentFrame::OnWindowMenu(wxCommandEvent &event)
{
    switch ( event.GetId() )
    {
        case wxWINDOWCLOSE:
            if ( m_currentChild )
                m_currentChild->Close();
            break;

        case wxWINDOWCLOSEALL:
            CloseAll();
            break;

        case wxWINDOWNEXT:
            ActivateNext();
            break;

        case wxWINDOWPREV:
            ActivatePrevious();
            break;

        default:
            event.Skip();
    }
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:25,代码来源:mdig.cpp


示例12: ASSERT

bool CTaiKlineHistorySelect::OpenAll()
{
	ASSERT(FALSE);
	return false;

	CloseAll();

	CTime tm = CTime::GetCurrentTime ();
	CString sTm = tm.Format ("%Y%m%d");

	bool bToday = false;

	for(int i=0;i<m_fileNameArray.GetSize ();i++)
	{
		CString sPathSh;
		CString sPathSz;
		CString filename ;
		CString sTitle = m_fileNameArray[i];
		CString title = sTitle+".hst";
		sPathSh = "data\\historysh\\";
		sPathSz = "data\\historysz\\";
		CTaiKlineFileHS* pFile;
		if(m_fileNameArray[i]>=sTm)
		{
			if(bToday == false)
			{
				sPathSh = "data\\historysh\\";
				sPathSz = "data\\historysz\\";
				title = "buysell.dat";
				sTitle = "buysell";
				bToday = true;
			}
			else
				continue;
		}
		pFile = new CTaiKlineFileHS(true);


		filename =sPathSh + title;
		if(!pFile->Open (filename,0))
		{
			delete pFile;
			continue;
		}
		m_fileHsShArray[sTitle] = (pFile);

		pFile = new CTaiKlineFileHS(false);
		filename =sPathSz + title;
		if(!pFile->Open (filename,0))
		{
			delete pFile;
			continue;
		}
		m_fileHsSzArray[sTitle] = (pFile);

	}
	return true;
}
开发者ID:ifzz,项目名称:yinhustock,代码行数:58,代码来源:CTaiKlineDlgHistorySelect.cpp


示例13: CloseAll

void MainBook::OnWorkspaceClosed(wxCommandEvent& e)
{
    e.Skip();
    CloseAll(false); // make sure no unsaved files
    clStatusBar* sb = clGetManager()->GetStatusBar();
    if(sb) {
        sb->SetSourceControlBitmap(wxNullBitmap, "", "");
    }
}
开发者ID:huan5765,项目名称:codelite-translate2chinese,代码行数:9,代码来源:mainbook.cpp


示例14: Check

///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
//Tests macros and functions.
//If (!aValue) then the test will be panicked, the test data files will be deleted.
static void Check(TInt aValue, TInt aLine)
	{
	if(!aValue)
		{
		CloseAll();
		DeleteFile(TheDatabaseFileName);
		TheTest(EFalse, aLine);
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:13,代码来源:t_dbperf3.cpp


示例15: CloseAll

void CloseAll (int in, int out, struct pipefdlist ** list)
{
	if (*list == NULL)
		return;
	if (((*list)->fd)[0] != in)
		close (((*list)->fd)[0]);
	if (((*list)->fd)[1] != out)
		close (((*list)->fd)[1]);
	CloseAll (in, out, &((*list)->next));
}
开发者ID:abashkirtsev,项目名称:Shell,代码行数:10,代码来源:main.c


示例16: lock

bool V4LHelper::Stop()
{
  CSingleLock lock(m_lock);

  CloseAll();
  m_lastFreq = "";
  m_tuningState = DvbTuner::TUNING_STATE_IDLE;

  return true;
}
开发者ID:Kr0nZ,项目名称:boxee,代码行数:10,代码来源:v4lhelper.cpp


示例17: lock

void COutput::Close()
{
	CAutoLock lock(&m_csecDevice);

	if (!m_fDoubleBuf) {
		CloseAll();
		return;
	}

	Reset();
}
开发者ID:v-zaburdaev,项目名称:Gsplayer2,代码行数:11,代码来源:output.cpp


示例18: CloseAll

void DirectoryFileSystem::DoState(PointerWrap &p) {
	auto s = p.Section("DirectoryFileSystem", 0, 2);
	if (!s)
		return;

	// Savestate layout:
	// u32: number of entries
	// per-entry:
	//     u32:              handle number
	//     std::string       filename (in guest's terms, untranslated)
	//     enum FileAccess   file access mode
	//     u32               seek position
	//     s64               current truncate position (v2+ only)

	u32 num = (u32) entries.size();
	p.Do(num);

	if (p.mode == p.MODE_READ) {
		CloseAll();
		u32 key;
		OpenFileEntry entry;
		for (u32 i = 0; i < num; i++) {
			p.Do(key);
			p.Do(entry.guestFilename);
			p.Do(entry.access);
			u32 err;
			if (!entry.hFile.Open(basePath,entry.guestFilename,entry.access, err)) {
				ERROR_LOG(FILESYS, "Failed to reopen file while loading state: %s", entry.guestFilename.c_str());
				continue;
			}
			u32 position;
			p.Do(position);
			if (position != entry.hFile.Seek(position, FILEMOVE_BEGIN)) {
				ERROR_LOG(FILESYS, "Failed to restore seek position while loading state: %s", entry.guestFilename.c_str());
				continue;
			}
			if (s >= 2) {
				p.Do(entry.hFile.needsTrunc_);
			}
			entries[key] = entry;
		}
	} else {
		for (auto iter = entries.begin(); iter != entries.end(); ++iter) {
			u32 key = iter->first;
			p.Do(key);
			p.Do(iter->second.guestFilename);
			p.Do(iter->second.access);
			u32 position = (u32)iter->second.hFile.Seek(0, FILEMOVE_CURRENT);
			p.Do(position);
			p.Do(iter->second.hFile.needsTrunc_);
		}
	}
}
开发者ID:VOID001,项目名称:ppsspp,代码行数:53,代码来源:DirectoryFileSystem.cpp


示例19: CloseAll

void CXMMTCtrl::OnResetState()
{
	COleControl::OnResetState();  // DoPropExchange を呼び出してデフォルト値にリセット

	CloseAll();
	m_bFftConversion = FALSE;
	m_PortTCP = 10301;
	m_ConnectionCount = 0;
	memset(m_pConnection, 0, sizeof(m_pConnection));
	memset(m_bBusy, TRUE, sizeof(m_bBusy));
	memset(m_bNotify, 0, sizeof(m_bNotify));
}
开发者ID:ja7ude,项目名称:XMMT,代码行数:12,代码来源:XMMTCtl.cpp


示例20: GetLastError

// Habilitacion y programacion del puerto serie
int CComm32::OpenComm()
{
	if (m_OnOpen) return ERROR_ALREADY_INITIALIZED;
	
	m_HPort=CreateFile(m_Name,GENERIC_READ+GENERIC_WRITE,
		0,NULL,OPEN_EXISTING,FILE_FLAG_OVERLAPPED,0);

	if (m_HPort==INVALID_HANDLE_VALUE)
		return GetLastError();
	
	m_OnOpen=true;

	if (GetFileType(m_HPort)!=FILE_TYPE_CHAR)
	{
		CloseHandle(m_HPort);
		return ERROR_OPEN_FAILED;
	}

	m_Read_Overlapped.hEvent=CreateEvent(NULL,true,true,NULL);
	if (m_Read_Overlapped.hEvent==0)
	{
		CloseAll();
		return GetLastError();
	}

	m_Write_Overlapped.hEvent=CreateEvent(NULL,true,true,NULL);
	if (m_Write_Overlapped.hEvent==0)
	{
		CloseAll();
		return GetLastError();
	}
	GetCommProperties(m_HPort,&m_CommProp);
	SetCommMask(m_HPort,m_EvtMask);
	SetCommTimeouts(m_HPort,&m_CommTimeOuts);
	GetCommModemStatus(m_HPort,&m_ModemStat);
	DWORD size=sizeof(COMMCONFIG);
	GetCommConfig(m_HPort,&m_CommConfig,&size);
	return 0;

}
开发者ID:crespo2014,项目名称:cpp-lib,代码行数:41,代码来源:COMM32.CPP



注:本文中的CloseAll函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CloseBlob函数代码示例发布时间:2022-05-30
下一篇:
C++ Close函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap