Exemplo n.º 1
0
bool wxRegConfig::RenameEntry(const wxString& oldName, const wxString& newName)
{
    // check that the old entry exists...
    if ( !HasEntry(oldName) )
        return false;

    // and that the new one doesn't
    if ( HasEntry(newName) )
        return false;

    return m_keyLocal.RenameValue(oldName, newName);
}
Exemplo n.º 2
0
std::string TransferTable::GetPort(std::string pSourceName, std::string pDestName){
	if ( HasEntry(pSourceName , pDestName) ) {
		std::pair<std::string,std::string> Key(pSourceName, pDestName);
		return mTable[Key] ;
	}
	return "" ;
}
Exemplo n.º 3
0
std::string ObjectGuid::GetString() const
{
    std::ostringstream str;
    str << GetTypeName() << " (";
    if (HasEntry())
        str << "Entry: " << GetEntry() << " ";
    str << "Guid: " << GetCounter() << ")";
    return str.str();
}
Exemplo n.º 4
0
std::string ObjectGuid::ToString() const
{
    std::ostringstream str;
    str << "GUID Full: 0x" << std::hex << std::setw(16) << std::setfill('0') << _guid << std::dec;
    str << " Type: " << GetTypeName();
    if (HasEntry())
        str << (IsPet() ? " Pet number: " : " Entry: ") << GetEntry() << " ";

    str << " Low: " << GetCounter();
    return str.str();
}
Exemplo n.º 5
0
// Attempt to insert an entry into the table
// Will fail if no room or a duplicate key is found.
RETURN_TYPE AE_LoadImage( IMAGE *image )
{
  // Retrieve hashed index from string
  unsigned index = UHashMod( image->ID );
  unsigned indexStart = index;

  // Search for empty or deleted location in table with linear probing
  while(!CanPlace( IMABE_TABLE, index ))
  {
    // Break from the loop if a duplicate is found
    if(strcmp( IMABE_TABLE[index]->ID, image->ID ) == 0)
      break;

    ++index;

    // wraparound to beginning of table instead of index beyond table
    if(index == TABLESIZE)
    {
      index = 0;
    }

    // If searched entire table (means table is full)
    if(indexStart == index)
    {
      isTableFull = TRUE; // set the isTableFull flag
      break;
    }
  }

  // Skip the allocation process if a duplicate entry is found
  if(HasEntry( IMABE_TABLE, index ))
  {
    if(strcmp( IMABE_TABLE[index]->ID, image->ID ) == 0)
    {
      return RETURN_FAILURE;
    }
  }

  // Skip the alloction process if there's no room in the table.
  if(isTableFull == TRUE)
    return RETURN_FAILURE;

  IMABE_TABLE[index] = image;
  return RETURN_SUCCESS;
}
Exemplo n.º 6
0
std::string ObjectGuid::GetString() const
{
    std::ostringstream str;
    str << GetTypeName();

    if (IsPlayer())
    {
        std::string name;
        if (sObjectMgr.GetPlayerNameByGUID(*this, name))
            str << " " << name;
    }

    str << " (";
    if (HasEntry())
        str << (IsPet() ? "Petnumber: " : "Entry: ") << GetEntry() << " ";
    str << "Guid: " << GetCounter() << ")";
    return str.str();
}
Exemplo n.º 7
0
Arquivo: HDD.cpp Projeto: ss23/rpcs3
bool vfsHDD::Create(vfsHDD_EntryType type, const std::string& name)
{
	if (HasEntry(name))
	{
		return false;
	}

	u64 new_block = FindFreeBlock();
	if (!new_block)
	{
		return false;
	}

	LOG_NOTICE(HLE, "CREATING ENTRY AT 0x%llx", new_block);
	WriteBlock(new_block, g_used_block);

	{
		vfsHDD_Entry new_entry;
		vfsHDDManager::CreateEntry(new_entry);
		new_entry.next_block = 0;
		new_entry.type = type;

		if (type == vfsHDD_Entry_Dir)
		{
			u64 block_cur = FindFreeBlock();

			if (!block_cur)
			{
				return false;
			}

			WriteBlock(block_cur, g_used_block);

			u64 block_last = FindFreeBlock();

			if (!block_last)
			{
				return false;
			}

			WriteBlock(block_last, g_used_block);

			vfsHDD_Entry entry_cur, entry_last;
			vfsHDDManager::CreateEntry(entry_cur);
			vfsHDDManager::CreateEntry(entry_last);

			entry_cur.type = vfsHDD_Entry_Dir;
			entry_cur.data_block = block_cur;
			entry_cur.next_block = block_last;

			entry_last.type = vfsHDD_Entry_Dir;
			entry_last.data_block = m_cur_dir_block;
			entry_last.next_block = 0;

			new_entry.data_block = block_cur;

			WriteEntry(block_cur, entry_cur, ".");
			WriteEntry(block_last, entry_last, "..");
		}

		WriteEntry(new_block, new_entry, name);
	}

	{
		u64 block = m_cur_dir_block;

		vfsHDD_Block tmp;
		while (block)
		{
			ReadBlock(block, tmp);

			if (!tmp.next_block)
				break;

			block = tmp.next_block;
		}

		tmp.next_block = new_block;
		WriteBlock(block, tmp);
	}

	return true;
}