当前位置: 首页>>代码示例>>C++>>正文


C++ CloseAll函数代码示例

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


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


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