Example #1
0
 void
 TerminalDisplay::DisplayInfo(const std::vector<std::string>& Options) {
   char infoColIdx = 0;
   if (GetContext()->GetColorizer()) {
      infoColIdx = GetContext()->GetColorizer()->GetInfoColor();
   }
   WriteRawString("\n", 1);
   for (size_t i = 0, n = Options.size(); i < n; ++i) {
     Text t(Options[i], infoColIdx);
     WriteWrappedElement(t, 0, 0, (size_t) -1);
     WriteRawString("\n", 1);
   }
   // Reset position
   Detach();
   Attach();
 }
Example #2
0
void TaskManager::UpdateProcesses(Uint32 deltaMs)
{
    TaskPtr next;
    for (auto current : task_list) {
        if (current->IsDead()) {
            next = current->GetNext();
            if (next) {
                current->SetNext(TaskPtr(nullptr));
                Attach(next);
            }
            Detach(current);
        } else if (current->IsActive() && !current->IsPaused()) {
            current->OnUpdate(deltaMs);
        }
    }
}
Example #3
0
// ----------------------------------------------------------------------------
void MouseSap::OnWindowClose(wxEvent& event)
// ----------------------------------------------------------------------------
{
    // wxEVT_DESTROY entry

    wxWindow* pWindow = (wxWindow*)(event.GetEventObject());

    if ( (pWindow) && (m_EditorPtrs.Index(pWindow) != wxNOT_FOUND))
    {   // window is one of ours
        Detach(pWindow);
        #ifdef LOGGING
         LOGIT( _T("OnWindowClose Detached %p"), pWindow);
        #endif //LOGGING
    }
    event.Skip();
}//OnWindowClose
Example #4
0
void cEntity::AttachTo(cEntity * a_AttachTo)
{
	if (m_AttachedTo == a_AttachTo)
	{
		// Already attached to that entity, nothing to do here
		return;
	}

	// Detach from any previous entity:
	Detach();

	// Attach to the new entity:
	m_AttachedTo = a_AttachTo;
	a_AttachTo->m_Attachee = this;
	m_World->BroadcastAttachEntity(*this, a_AttachTo);
}
Example #5
0
/// <summary>
/// Create new process and attach to it
/// </summary>
/// <param name="path">Executable path</param>
/// <param name="suspended">Leave process in suspended state. To resume process one should resume its main thread</param>
/// <param name="forceInit">If 'suspended' is true, this flag will enforce process initialization via second thread</param>
/// <param name="cmdLine">Process command line</param>
/// <param name="currentDir">Startup directory</param>
/// <param name="pStartup">Additional startup params</param>
/// <returns>Status code</returns>
NTSTATUS Process::CreateAndAttach( 
    const std::wstring& path, 
    bool suspended /*= false*/,
    bool forceInit /*= true*/,
    const std::wstring& cmdLine /*= L""*/,
    const wchar_t* currentDir /*= nullptr*/,
    STARTUPINFOW* pStartup /*= nullptr*/
    )
{
    Detach();

    STARTUPINFOW si = { 0 };
    PROCESS_INFORMATION pi = { 0 };
    if (!pStartup)
        pStartup = &si;

    if (!CreateProcessW(
        path.c_str(), const_cast<LPWSTR>(cmdLine.c_str()), 
        NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, 
        currentDir, pStartup, &pi
        ))
    {
        return LastNtStatus();
    } 

    // Get handle ownership
    auto status = _core.Open( pi.hProcess );
    if (NT_SUCCESS( status ))
    {
        _nativeLdr.Init();

        // Check if process must be left in suspended mode
        if (suspended)
        {
            // Create new thread to make sure LdrInitializeProcess gets called
            if (forceInit)
                EnsureInit();
        }
        else
            ResumeThread( pi.hThread );
    }

    // Close unneeded handles
    CloseHandle( pi.hThread );

    return status;
}
Example #6
0
int main(int argc, char *argv[])
{
	HIJACK *hijack;
	FUNC *func;
	unsigned long addr;
	PLT *plts, *plt;
	
	if (argc != 2)
		usage(argv[0]);
	
	hijack = InitHijack();
    ToggleFlag(hijack, F_DEBUG);
    ToggleFlag(hijack, F_DEBUG_VERBOSE);
	AssignPid(hijack, atoi(argv[1]));
	
	if (Attach(hijack) != ERROR_NONE)
	{
		fprintf(stderr, "[-] Couldn't attach!\n");
		exit(EXIT_FAILURE);
	}

	if (LocateAllFunctions(hijack) != ERROR_NONE)
	{
		fprintf(stderr, "[-] Couldn't locate all functions!\n");
		exit(EXIT_FAILURE);
	}

    if (LocateSystemCall(hijack) != ERROR_NONE) {
        fprintf(stderr, "[-] Couldn't locate system call!\n");
        exit(EXIT_FAILURE);
    }

    addr = MapMemory(hijack, NULL, 8192, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_SHARED);
    if (GetErrorCode(hijack) != ERROR_NONE) {
        fprintf(stderr, "[-] %s\n", GetErrorString(hijack));
        perror("ptrace");
    }
	
	printf("[*] PLT/GOT @ 0x%016lx\n", hijack->pltgot);
	printf("[*] Baseaddr @ 0x%016lx\n", hijack->baseaddr);
    printf("[*] Syscall @ 0x%016lx\n", hijack->syscalladdr);
    printf("[*] addr @ 0x%016lx\n", addr);

	Detach(hijack);
	
	return 0;
}
Example #7
0
void CInventoryItem::OnEvent (NET_Packet& P, u16 type)
{
	switch (type)
	{
	case GE_ADDON_ATTACH:
		{
			u32 ItemID;
			P.r_u32			(ItemID);
			CInventoryItem*	 ItemToAttach	= smart_cast<CInventoryItem*>(Level().Objects.net_Find(ItemID));
			if (!ItemToAttach) break;
			Attach(ItemToAttach,true);
			CActor* pActor = smart_cast<CActor*>(object().H_Parent());
			if (pActor && pActor->inventory().ActiveItem() == this)
			{
				pActor->inventory().SetPrevActiveSlot(pActor->inventory().GetActiveSlot());
				pActor->inventory().Activate(NO_ACTIVE_SLOT);
				
			}
		}break;
	case GE_ADDON_DETACH:
		{
			string64			i_name;
			P.r_stringZ			(i_name);
			Detach(i_name, true);
			CActor* pActor = smart_cast<CActor*>(object().H_Parent());
			if (pActor && pActor->inventory().ActiveItem() == this)
			{
				pActor->inventory().SetPrevActiveSlot(pActor->inventory().GetActiveSlot());
				pActor->inventory().Activate(NO_ACTIVE_SLOT);
			};
		}break;	
	case GE_CHANGE_POS:
		{
			Fvector p; 
			P.r_vec3(p);
			CPHSynchronize* pSyncObj = NULL;
			pSyncObj = object().PHGetSyncItem(0);
			if (!pSyncObj) return;
			SPHNetState state;
			pSyncObj->get_State(state);
			state.position = p;
			state.previous_position = p;
			pSyncObj->set_State(state);

		}break;
	}
}
Example #8
0
/*----------------------------------------------------------------------------------------------------------------------
|	Sets all data members to their factory default settings: `inf_open', `logf_open' and `quit_now' are set to false;
|	`message' to the null string, and the pointers `data', `characters', `assumptions', `taxa' and `trees'
|	are all set to NULL. The C-string `next_command' is allocated COMMAND_MAXLEN + 1 bytes if it is currently NULL,
|	and its first byte is set to the null character to create an empty `next_command' string.
*/
void GarliReader::FactoryDefaults()
{
    isEmpty = true;
    inf_open = false;
    logf_open = false;
    quit_now = false;
    message.clear();

    if (trees != NULL)
    {
        Detach(trees);
        delete trees;
        trees = NULL;
    }

    if (taxa != NULL)
    {
        Detach(taxa);
        delete taxa;
        taxa = NULL;
    }

    if (assumptions != NULL)
    {
        Detach(assumptions);
        delete assumptions;
        assumptions = NULL;
    }

    if (distances != NULL)
    {
        Detach(distances);
        delete distances;
        distances = NULL;
    }

    if (characters != NULL)
    {
        Detach(characters);
        delete characters;
        characters = NULL;
    }

    if (data != NULL)
    {
        Detach(data);
        delete data;
        data = NULL;
    }

    if (next_command == NULL)
        next_command = new char[COMMAND_MAXLEN + 1];
    next_command[0] = '\0';
}
Example #9
0
/**
 * Windows のウィンドウが破棄されるときに非クライアント領域が破棄されると、最後に呼び出されたメンバー関数は、フレームワークによって呼び出されます
 * @param[in] wParam パラメタ
 * @param[in] lParam パラメタ
 */
void CWndProc::OnNcDestroy(WPARAM wParam, LPARAM lParam)
{
	LONG_PTR pfnWndProc = ::GetWindowLongPtr(m_hWnd, GWLP_WNDPROC);
	DefWindowProc(WM_NCDESTROY, wParam, lParam);
	if (::GetWindowLong(m_hWnd, GWLP_WNDPROC) == pfnWndProc)
	{
		if (m_pfnSuper != NULL)
		{
			::SetWindowLongPtr(m_hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(m_pfnSuper));
			m_pfnSuper = NULL;
		}
	}
	Detach();

	// call special post-cleanup routine
	PostNcDestroy();
}
Example #10
0
CDataNode& 
CDataNode::operator=( const CDataNode& src )
{GUCEF_TRACE;

    if ( this != &src )
    {
        // detach from our current tree
        Detach();
        DelSubTree();
        
        _name = src._name;
        m_value = src.m_value;
        _atts = src._atts;

    }               
    return *this;
}
Example #11
0
void cLuaState::Attach(lua_State * a_State)
{
	if (m_LuaState != NULL)
	{
		LOGINFO("%s: Already contains a LuaState (0x%p), will be closed / detached.", __FUNCTION__, m_LuaState);
		if (m_IsOwned)
		{
			Close();
		}
		else
		{
			Detach();
		}
	}
	m_LuaState = a_State;
	m_IsOwned = false;
}
Example #12
0
dBaseHierarchy::~dBaseHierarchy () 
{
	dBaseHierarchy *ptr;
	dBaseHierarchy *tmp;

	if (m_parent) {
		Detach();
	}

	for (ptr = m_child; ptr; ptr = tmp) {
		tmp = ptr->m_sibling;
		_ASSERTE (0);
		tmp->m_parent = NULL;
		delete ptr;
	}

}
Example #13
0
 /*
  * Creates a new Mutex object.
  */
  bool Create(LPSECURITY_ATTRIBUTES lpSA = NULL, BOOL bInitialOwn = TRUE,
              const TCHAR *szName = NULL)
  {

    bool r = false;

    Detach();

    if (NULL != (m_hMutex = CreateMutex(lpSA, bInitialOwn, szName))) {

      m_tsName  = szName;
      r         = true;

    }

    return r;
  }
Example #14
0
void Node::AttachChild(Node * c)
{
 Detach();

 if (child)
 {
  c->next = child;
  c->last = child->last;
  child = c;
 
  child->next->last = child;
  child->last->next = child;  
 }
 else child = c;
 
 child->parent = this;
}
Example #15
0
HRESULT fsShellBrowsersEvents::Attach(SHDocVw::IShellWindowsPtr& spSHWnds)
{
	if (m_bDetaching)
		return S_FALSE;

	if (is_Attached ())
		Detach ();

	LONG cItems = spSHWnds->GetCount ();
	HRESULT hr;

	
	for (LONG i = 0; i < cItems; i++)
	{
		try {
		IDispatchPtr spDisp;
		_variant_t va (i, VT_I4);
		
		spDisp = spSHWnds->Item (va);

		SHDocVw::IWebBrowser2Ptr spBrowser (spDisp);

		if (spBrowser == NULL)
			continue;

		
		fsShellBrowsersEvents* pBrowser = new fsShellBrowsersEvents;
		
		hr = pBrowser->Attach (spBrowser);

		if (FAILED (hr))
		{
			delete pBrowser;
			return hr;
		}

		pBrowser->SetEventFunc (m_pfnEvents, m_lpEventsParam);

		m_vBrowsers.add (pBrowser);
		}
		catch (...) {}
	}
	
	return S_OK;
}
Example #16
0
void ControlToolBar::ReCreateButtons()
{
   bool playDown = false;
   bool playShift = false;
   bool pauseDown = false;
   bool recordDown = false;
   bool recordShift = false;

   // ToolBar::ReCreateButtons() will get rid of its sizer and
   // since we've attached our sizer to it, ours will get deleted too
   // so clean ours up first.
   if( mSizer )
   {
      playDown = mPlay->IsDown();
      playShift = mPlay->WasShiftDown();
      pauseDown = mPause->IsDown();
      recordDown = mRecord->IsDown();
      recordShift = mRecord->WasShiftDown();
      Detach( mSizer );

      delete mSizer;
      mSizer = NULL;
   }

   ToolBar::ReCreateButtons();

   if (playDown)
   {
      SetPlay(playDown, playShift, false);
   }

   if (pauseDown)
   {
      mPause->PushDown();
   }

   if (recordDown)
   {
      SetRecord(recordDown, recordShift);
   }

   EnableDisableButtons();

   RegenerateToolsTooltips();
}
Example #17
0
BOOL COXAutoComplete::Attach(HWND hWnd, LPCTSTR lpszStorageName, DWORD dwOptions)
{
	ASSERT(hWnd);

	if (!m_hkMsg || !m_hkKbrd)
		return FALSE;

	if (::IsWindow(hWnd))
	{
		if (!m_hParent)
			m_hParent=::GetParent(hWnd);
		COXAutoStorage* pStorage;
		if (m_mpStorage.Lookup(hWnd,pStorage))
			Detach(hWnd);

		pStorage=NULL;

		//try to find COXAutoStorage
		POSITION pos=m_mpStorage.GetStartPosition();
		while (pos)
		{
			HWND hwnd;
			COXAutoStorage* pMappedStorage=NULL;
			m_mpStorage.GetNextAssoc(pos, hwnd, pMappedStorage);
			if (pMappedStorage && pMappedStorage->GetName()==lpszStorageName)
			{
				pStorage=pMappedStorage;
				break;
			}
		}

		if (pStorage)
		{
			m_mpStorage.SetAt(hWnd,pStorage);
			m_mpOptions.SetAt(hWnd,dwOptions);
			return TRUE;
		}
		pStorage=new COXAutoStorage(lpszStorageName);
		m_mpStorage.SetAt(hWnd,pStorage);
		m_mpOptions.SetAt(hWnd,dwOptions);
		return TRUE;
	}
	return FALSE;

}
Example #18
0
void COXDateTimeCtrl::PreSubclassWindow() 
{
	// TODO: Add your specialized code here and/or call the base class
	
	_AFX_THREAD_STATE* pThreadState=AfxGetThreadState();
	// hook not already in progress
	if(pThreadState->m_pWndInit==NULL)
	{
		DWORD dwStyle=GetStyle();
		// check if subclassed window has WS_CHILD style
		VERIFY((dwStyle&WS_CHILD)!=0);

		BOOL bRecreate=FALSE;
		TCHAR buffer[254];
		if(::GetClassName(GetSafeHwnd(),buffer,254)>0)
		{
			CString sClassName=buffer;
			bRecreate=(sClassName!=_T("SysDateTimePick32"));
		}

		if(bRecreate)
		{
			int nCtrlID=GetDlgCtrlID();
			CWnd* pWndParent=GetParent();
			ASSERT(pWndParent!=NULL);
			CRect rcWnd;
			GetWindowRect(rcWnd);
			HWND hSubclassedWnd=Detach();
			::DestroyWindow(hSubclassedWnd);
			pWndParent->ScreenToClient(rcWnd);
			VERIFY(Create(WS_TABSTOP|WS_CHILD|
				((dwStyle&WS_VISIBLE)!=0 ? WS_VISIBLE : 0),
				rcWnd,pWndParent,nCtrlID));
		}

		if(!InitDateTimeCtrl())
			TRACE(_T("COXDateTimeCtrl::PreSubclassWindow: failed to initialize date time control"));
	}

#if _MFC_VER<=0x0421
	CWnd::PreSubclassWindow();
#else
	CDateTimeCtrl::PreSubclassWindow();
#endif	//	_MFC_VER<=0x0421
}
Example #19
0
/*----------------------------------------------------------------------------------------------------------------------
|	Closes `logf' if it is open and deletes memory allocated to `next_command'.
*/
GarliReader::~GarliReader()
	{
	//this is a little odd, since ClearContent will reallocate a few things, but 
	//it also ensures that a bunch of other things are deleted
	ClearContent();

	assert(next_command != NULL);
	delete [] next_command;

	if (logf_open)
		logf.close();
	
	if(garliBlock != NULL){
		Detach(garliBlock);
		delete garliBlock;
		garliBlock = NULL;
		}
	}
Example #20
0
CBufferDC::~CBufferDC()
{
	//메모리 DC의 내용을 대상 윈도우에 출력한다.
	//내부적으로 비트맵에 출력한 것이므로 해당 비트맵을 1:1로 복사한다.
	m_pTarget->BitBlt(
		m_PaintStruct.rcPaint.left,
		m_PaintStruct.rcPaint.top, 
		m_PaintStruct.rcPaint.right - m_PaintStruct.rcPaint.left, 
		m_PaintStruct.rcPaint.bottom - m_PaintStruct.rcPaint.top, 
		&m_MemoryDC,
		m_PaintStruct.rcPaint.left,
		m_PaintStruct.rcPaint.top, SRCCOPY);

	m_MemoryDC.SelectObject(m_pOldMemoryBmp);
	m_pParent->EndPaint(&m_PaintStruct);

	Detach();
}
Example #21
0
		bool ICodaScriptSyntaxTreeNode::Attach(ICodaScriptSyntaxTreeNode* NewParent)
		{
			bool Result = false;

			SME_ASSERT(NewParent && NewParent != this);

			if (Parent != NewParent)
			{
				Detach();

				Parent = NewParent;
				Parent->Children.push_back(this);

				Result = true;
			}

			return Result;
		}
Example #22
0
/**
 * CWndProc オブジェクトに関連付けられた Windows のウィンドウを破棄します
 * @return ウィンドウが破棄された場合は 0 以外を返します。それ以外の場合は 0 を返します
 */
BOOL CWndProc::DestroyWindow()
{
	if (m_hWnd == NULL)
	{
		return FALSE;
	}

	CWndProc* pWnd = FromHandlePermanent(m_hWnd);

	const BOOL bResult = ::DestroyWindow(m_hWnd);

	if (pWnd == NULL)
	{
		Detach();
	}

	return bResult;
}
Example #23
0
//	linking objects.. the caller object will be child
//	the called object is the parent
//	the caller will be put on top of the called
bool VDSBuildingBlock::PutOn( VDSBuildingBlock& _parent )
{
	//	detach if linked somewhere else
	Detach();

	//	return if linking is not possible
	if ( !_parent.m_UpSlots.CanLink( m_DownSlots ) )
	{
		return false;
	}

	//	make the proximity check
	if ( ProximityCheck( _parent, true ) != true )
	{
		return false;
	}

	//	linking sets the slot maps in both places
	_parent.m_UpSlots.Link( m_DownSlots );

	//	now we will adjust the matrix of us according to data in the parent
	//	usually this is in the y direction
	_parent.AddChild( this );
	//AttachTo();

	//	attach the bounding box tree to the other tree in the parent
	//m_pLowerBox->AttachTo(*Parent.m_pUpperBox);

	_parent.m_pUpperBox->AddChild( m_pLowerBox );

	//	compute the new bounding boxe translation on Y
	m_pLowerBox->m_Transform._42 = ( m_pLowerBox->m_Dimensions.y + _parent.m_pUpperBox->m_Dimensions.y ) / 2.0f;

	//	the parent is down
	m_bParentIsUp	=	false;

	//	compute the new bounding box after linking
	ComputeBBox();

    _parent.RecreateMesh();

	//	return success !
	return true;
}
Example #24
0
BOOL COXTabClientWnd::LoadState(LPCTSTR lpszProfileName)
{
#ifndef _MAC
	CWinApp* pApp=AfxGetApp();
	ASSERT(pApp!=NULL);

	ASSERT(!IsAttached() || GetTabCtrl()!=NULL);

	BOOL bIsAttached=(BOOL)pApp->GetProfileInt(lpszProfileName,_T("IsAttached"),TRUE);
	if(bIsAttached && !IsAttached())
	{
		TRACE(_T("COXTabClientWnd::LoadState: fail to load state\n"));
		return FALSE;
	}

	if(!bIsAttached && !IsAttached())
		return TRUE;

	DWORD dwOffset=(DWORD)pApp->GetProfileInt(lpszProfileName,
		_T("Offset"),ID_TABOFFSET);
	DWORD dwStyle=(DWORD)pApp->GetProfileInt(lpszProfileName,
		_T("Style"),DEFAULT_TABCTRLSTYLE);

	if(GetTabCtrl()->GetOffset()==dwOffset && 
		GetTabCtrl()->GetStyle()==dwStyle && bIsAttached==IsAttached())
		return TRUE;

	CMDIFrameWnd* pParentFrame=GetParentFrame();
	ASSERT(pParentFrame!=NULL);

	VERIFY(Detach());

	if(!bIsAttached)
		return TRUE;

	VERIFY(Attach(pParentFrame,dwStyle));
	ASSERT(IsAttached() && GetTabCtrl()!=NULL);
	GetTabCtrl()->SetOffset(dwOffset);

	return TRUE;
#else
	return FALSE;
#endif
}
Example #25
0
static int gl_Display_input(ListData *ldata, char **inp, size_t *len)
{
	Display *cd = display;
	unsigned char ch;

	if (!ldata->selected)
		return 0;

	ch = (unsigned char)**inp;
	++*inp;
	--*len;

	switch (ch) {
	case '\f':		/* ^L to refresh */
		glist_remove_rows(ldata);
		gl_Display_rebuild(ldata);
		break;

	case '\r':
	case '\n':
		glist_abort();
		*len = 0;
		break;

	case 'd':		/* Detach */
	case 'D':		/* Power detach */
		display = ldata->selected->data;
		if (display == cd)	/* We do not allow detaching the current display */
			break;
		Detach(ch == 'D' ? D_REMOTE_POWER : D_REMOTE);
		display = cd;
		glist_remove_rows(ldata);
		gl_Display_rebuild(ldata);
		break;

	default:
		/* We didn't actually process the input. */
		--*inp;
		++*len;
		return 0;
	}
	return 1;
}
Example #26
0
cLiveStreamer::~cLiveStreamer()
{
  DEBUGLOG("Started to delete live streamer");

  cTimeMs t;

  DEBUGLOG("Stopping streamer thread ...");
  Cancel(5);
  DEBUGLOG("Done.");

  cMutexLock lock(&m_FilterMutex);

  DEBUGLOG("Detaching");

  if(m_PatFilter != NULL && m_Device != NULL) {
    m_Device->Detach(m_PatFilter);
    delete m_PatFilter;
    m_PatFilter = NULL;
  }

  if (IsAttached()) {
    Detach();
  }

  for (std::list<cTSDemuxer*>::iterator i = m_Demuxers.begin(); i != m_Demuxers.end(); i++) {
    if ((*i) != NULL) {
      DEBUGLOG("Deleting stream demuxer for pid=%i and type=%i", (*i)->GetPID(), (*i)->GetType());
      delete (*i);
    }
  }
  m_Demuxers.clear();

  delete m_Queue;

  m_uid = 0;

  {
    cMutexLock lock(&m_DeviceMutex);
    m_Device = NULL;
  }

  DEBUGLOG("Finished to delete live streamer (took %llu ms)", t.Elapsed());
}
 inline void LocalServiceLocatorDataStore::Delete(
     const DirectoryEntry& entry) {
   std::vector<DirectoryEntry> children = LoadChildren(entry);
   if(!children.empty()) {
     BOOST_THROW_EXCEPTION(ServiceLocatorDataStoreException(
       "Directory entry is not empty."));
   }
   auto permissionsIterator = m_permissions.begin();
   while(permissionsIterator != m_permissions.end()) {
     const auto& permissionsPair = permissionsIterator->first;
     if(boost::get<0>(permissionsPair) == entry ||
         boost::get<1>(permissionsPair) == entry) {
       permissionsIterator = m_permissions.erase(permissionsIterator);
     } else {
       ++permissionsIterator;
     }
   }
   auto parentsIterator = m_parents.find(entry);
   if(parentsIterator != m_parents.end()) {
     std::vector<DirectoryEntry> parents = parentsIterator->second;
     for(const DirectoryEntry& parent : parents) {
       Detach(entry, parent);
     }
     m_parents.erase(parentsIterator);
   }
   if(entry.m_type == DirectoryEntry::Type::ACCOUNT) {
     for(auto i = m_accounts.begin(); i != m_accounts.end(); ++i) {
       if(*i == entry) {
         m_accounts.erase(i);
         m_passwords.erase(entry);
         break;
       }
     }
   } else {
     for(auto i = m_directories.begin(); i != m_directories.end(); ++i) {
       if(*i == entry) {
         m_directories.erase(i);
         break;
       }
     }
   }
 }
Example #28
0
void cLuaState::Close(void)
{
	if (m_LuaState == NULL)
	{
		LOGWARNING("%s: Trying to close an invalid LuaState, ignoring.", __FUNCTION__);
		return;
	}
	if (!m_IsOwned)
	{
		LOGWARNING(
			"%s: Detected mis-use, calling Close() on an attached state (0x%p). Detaching instead.",
			__FUNCTION__, m_LuaState
		);
		Detach();
		return;
	}
	lua_close(m_LuaState);
	m_LuaState = NULL;
	m_IsOwned = false;
}
Example #29
0
bool    plTextGenerator::MsgReceive( plMessage *msg )
{
#ifdef MCN_DO_REFS
    plGenRefMsg *refMsg = plGenRefMsg::ConvertNoRef( msg );
    if( refMsg != nil )
    {
        if( refMsg->GetContext() & ( plRefMsg::kOnCreate | plRefMsg::kOnRequest ) )
        {
            // Don't do anything--already did an attach
        }
        else if( refMsg->GetContext() & ( plRefMsg::kOnDestroy | plRefMsg::kOnRemove ) )
        {
            Detach();
        }
        return true;
    }
#endif

    return hsKeyedObject::MsgReceive( msg );
}
Example #30
0
//	linking objects.. the caller object will be child
//	the called object is the parent
//	the caller will be put on top of the called
bool VDSBuildingBlock::PutBelow( VDSBuildingBlock& Parent )
{
	//	detach if linked
	Detach();

	//	return if linking is not possible
	if ( !Parent.m_DownSlots.CanLink( m_UpSlots ) )
	{
		return false;
	}

	//	make the proximity check
	if ( ProximityCheck( Parent, false ) != true )
	{
		return false;
	}

	//	linking sets the slot maps in both places
	Parent.m_DownSlots.Link( m_UpSlots );

	Parent.AddChild( this );

	//	attach the bounding box tree to the other tree in the parent
	//m_pUpperBox->AttachTo(*Parent.m_pLowerBox);
	Parent.m_pLowerBox->AddChild( m_pUpperBox );


	//	compute the new bounding box translation on Y
	m_pUpperBox->m_Transform._42 = - ( m_pUpperBox->m_Dimensions.y + Parent.m_pLowerBox->m_Dimensions.y ) / 2.0f;

	//	the parent is now up
	m_bParentIsUp	=	true;

	//	compute the new bounding box after linking
	ComputeBBox();

    RecreateMesh();

	//	return success !
	return true;
}