Esempio n. 1
0
void DeleteSame( DbNode *pHeadA, DbNode *pHeadB )
{
    if( pHeadA != NULL && pHeadB != NULL )
    {
        DbNode *pa = pHeadA;
        while( pa->next != pHeadA )
        {
            //如果B中含有pa->data,并且已经删除
            if( DeleteValue( pHeadB, pa->data ) )
            {
                //在A中删除pa->data
                DbNode *tmp = pa->next;
                DeleteValue( pHeadA, pa->data );
                pa = tmp;
            }
            else
                pa = pa->next;
        }
        //只有一个元素或最后一个元素
        if( DeleteValue( pHeadB, pa->data ) )
        {
            DeleteValue( pHeadA, pa->data );
        }         
    }  
}
Esempio n. 2
0
int main()
{
    printf("Enter the queue size: ");
    scanf("%d", &iMax);
    int iChoice;
    while(1)
    {
        printf("\n1. Enqueue\n2. Dequeue\n3. Display\n4. Exit\nEnter your choice:");
        scanf("%d", &iChoice);
        switch(iChoice)
        {
            case 1:
                InsertData();
                break;
            case 2:
                DeleteValue();
                break;
            case 3:
                DisplayQueue();
                break;
            case 4:
                return 0;
        }
    }
    return 0;
}
Esempio n. 3
0
int _tmain(int argc, _TCHAR* argv[])
{
	if( argc<2 ) {
		Usage();
		return 1;
	}

	if( 0 == strncmp(argv[1], "-g", 2)  )
	{
		// generate test files and registry values
		return Generate();
	}
	else if( 0 == strncmp(argv[1], "-c", 2) )
	{
		// check generated files
		return Check();
	}
	else if( 0 == strncmp(argv[1], "-s", 2) )
	{
		//
		return ShowRegValue();
	}
	else if( 0 == strncmp(argv[1], "-d", 2) )
	{
		return DeleteValue();
	}
	else
	{
		Usage();
		return 1;
	}

	return 0;
}
Esempio n. 4
0
BOOL WatchDog::WriteAutoRun(bool bAutoRun)
{
	char pFileName[MAX_PATH] = {0};   
	//得到程序自身的全路径   
	DWORD dwRet				  = GetModuleFileName(NULL, pFileName, MAX_PATH); 
	HKEY RootKey			  = HKEY_LOCAL_MACHINE;									//注册表主键名称   
	char szSubKey[MAX_PATH]	  = "Software\\Microsoft\\Windows\\CurrentVersion\\Run";//欲打开注册表值的地址   
	char szValueName[MAX_PATH]= "BayonetServer.exe";										//欲设置值的名称 	

	if (bAutoRun)
	{
		if (!SetValue(RootKey, szSubKey, szValueName, (BYTE*)pFileName))   
		{
			return FALSE;
		}
	}else
	{
		if(!DeleteValue(RootKey, szSubKey, szValueName))   
		{
			return FALSE;   
		}
	}



	return TRUE;
}
Esempio n. 5
0
LONG CKey::DeleteValue(LPCWSTR name)
{
  MYASSERT(_object != NULL);
  if (g_IsNT)
    return ::RegDeleteValueW(_object, name);
  return DeleteValue(name == 0 ? 0 : (LPCSTR)GetSystemString(name));
}
Esempio n. 6
0
void ff::Value::Release()
{
	if (_refCount != -1 && !InterlockedDecrement(&_refCount))
	{
		DeleteValue(this);
	}
}
Esempio n. 7
0
/*
	subKey を指定した場合は subkey を含むキー以下を削除
	subkey が NULL の場合、カレント の配下を削除
*/
BOOL TRegistry::DeleteChildTree(LPSTR subKey)
{
	char	buf[100];
	BOOL	ret = TRUE;

	if (subKey != NULL && OpenKey(subKey) != TRUE)
		return	FALSE;

	while (EnumKey(0, buf, sizeof(buf)))
	{
		if ((ret = DeleteChildTree(buf)) != TRUE)
			break;
	}
	if (subKey != NULL)
	{
		CloseKey();
		ret = DeleteKey(subKey) ? ret : FALSE;
	}
	else {
		while (EnumValue(0, buf, sizeof(buf)))
		{
			if (DeleteValue(buf) != TRUE)
			{
				ret = FALSE;
				break;
			}
		}
	}
	return	ret;
}
Esempio n. 8
0
// Opens a key, deletes a value from the key and makes key active if required
bool RegKey::DeleteKeyValue(LPCTSTR pszKeyName, LPCTSTR pszValueName, bool bActive /* = false */, HKEY hBaseKey /* = HKEY_CURRENT_USER */, LPCTSTR pszMachineName /* = NULL */)
{
	if (pszValueName == NULL || pszKeyName == NULL)
	{
		iLastErrorCode_ = ERROR_BAD_ARGUMENTS;
		return false;
	}

	CloseKey(); // Close current active key and base key if remote

	// Open the key
	if (!OpenKey(pszKeyName, false, hBaseKey, pszMachineName))
		return false;

	if (!DeleteValue(pszValueName))
	{
		if (!bActive)
			CloseKey();
		return false;
	}

	if (!bActive)
		CloseKey(); // Close current active key and base key if remote

	iLastErrorCode_ = ERROR_SUCCESS;
	return true;
}
Esempio n. 9
0
layer_c::~layer_c()
{
  DeleteValue(value);
  if (strlen(data) > 0) {
    SetValue(value,data);
  }
  CloseKey();
}
Esempio n. 10
0
void CWizXmlRpcStructValue::Clear()
{
    std::map<QString, CWizXmlRpcValue*>::const_iterator it;
    for (it = m_map.begin(); it != m_map.end(); it++) {
		DeleteValue(it->second);
	}

	m_map.clear();
}
Esempio n. 11
0
void CWizXmlRpcStructValue::RemoveValue(const QString& strName)
{
    std::map<QString, CWizXmlRpcValue*>::iterator it = m_map.find(strName);
	if (it == m_map.end())
		return;

	DeleteValue(it->second);
	m_map.erase(it);
}
////////
// Copy
void VariableData::operator= (const VariableData &param) {
	switch(param.GetType()) {
		case VARDATA_INT: SetInt(param.AsInt()); break;
		case VARDATA_FLOAT: SetFloat(param.AsFloat()); break;
		case VARDATA_TEXT: SetText(param.AsText()); break;
		case VARDATA_BOOL: SetBool(param.AsBool()); break;
		case VARDATA_COLOUR: SetColour(param.AsColour()); break;
		case VARDATA_BLOCK: SetBlock(param.AsBlock()); break;
		default: DeleteValue();
	}
}
Esempio n. 13
0
bool Sudoku::ScreenPossibility(int pos_x, int pos_y)
{
    bool Modification = false;
    GridLimits Lim;
    int i,j;
    Lim.SetLimits(pos_x, pos_y);
    int possib = possibilities[pos_y-1][pos_x-1];
    //int possib = POS_ALL;
    // for variation in +ve x
    for(i= pos_y - 1, j = pos_x - 1; j < 9; ++j  )
        if(DeleteValue(Grid[i][j], possib))  Modification = true;

    // for variation in -ve x
    for(i= pos_y - 1, j = pos_x - 1; j >= 0; --j )
        if(DeleteValue(Grid[i][j], possib))  Modification = true;

    // for variation in +ve y
    for(i= pos_y - 1, j = pos_x - 1; i < 9; ++i  )
        if(DeleteValue(Grid[i][j], possib))  Modification = true;

    // for variation in -ve y
    for(i= pos_y - 1, j = pos_x - 1; i >= 0; --i )
        if(DeleteValue(Grid[i][j], possib))  Modification = true;

    for(i = Lim.Y_Top; i  <= Lim.Y_End; ++i  )
        for(j = Lim.X_Top; j  <= Lim.X_End; ++j  )
                DeleteValue(Grid[i][j], possib);

    possibilities[pos_y-1][pos_x-1] = possib;

    if (possib == 0x0) // sets the trigger for zero possibilities
        ZeroPossibilities = true;
    //(possibilityCount[pos_y - 1][pos_x -1] -= count);
    //std::cout<<possibilityCount[pos_y - 1][pos_x -1];
    if(SinglePossibilityElement(possib))
        {
            Grid[pos_y-1][pos_x-1] = BitValue(possibilities[pos_y - 1][pos_x -1]);
            //std::cout<<"\n\n Got You!" <<  possibilities[pos_y - 1][pos_x -1]<<"\n";
        }
    return Modification;
}
Esempio n. 14
0
bool Property::SetValue( const int i_value )
{
	if ( IsIntValue() )
	{
		DeleteValue();
		int* value = new int(i_value);
		m_value = value;
		return true;
	}

	return false;
}
Esempio n. 15
0
bool Property::SetValue( const float i_value )
{
	if ( IsFloatValue() )
	{
		DeleteValue();
		float* value = new float(i_value);
		m_value = value;
		return true;
	}

	return false;
}
Esempio n. 16
0
bool Property::SetValue( const glm::vec4& i_value )
{
	if ( IsVector4FValue() )
	{
		DeleteValue();
		glm::vec4* value = new glm::vec4(i_value);
		m_value = value;
		return true;
	}

	return false;
}
Esempio n. 17
0
bool Property::SetValue( const glm::quat& i_value )
{
	if ( IsQuaternionValue() )
	{
		DeleteValue();
		glm::quat* value = new glm::quat(i_value);
		m_value = value;
		return true;
	}

	return false;
}
Esempio n. 18
0
bool Property::SetValue( const std::string& i_value )
{
	if ( IsStringValue() )
	{
		DeleteValue();
		std::string* value = new std::string(i_value);
		m_value = value;
		return true;
	}

	return false;
}
Esempio n. 19
0
bool Property::SetValue( const bool i_value )
{
	if ( IsBoolValue() )
	{
		DeleteValue();
		bool* value = new bool(i_value);
		m_value = value;
		return true;
	}

	return false;
}
Esempio n. 20
0
bool Property::SetValue( const double i_value )
{
	if ( IsDoubleValue() )
	{
		DeleteValue();
		double* value = new double(i_value);
		m_value = value;
		return true;
	}

	return false;
}
////////
// Copy
void AssOverrideParameter::CopyFrom (const AssOverrideParameter &param) {
	switch(param.GetType()) {
		case VARDATA_INT: SetInt(param.AsInt()); break;
		case VARDATA_FLOAT: SetFloat(param.AsFloat()); break;
		case VARDATA_TEXT: SetText(param.AsText()); break;
		case VARDATA_BOOL: SetBool(param.AsBool()); break;
		case VARDATA_COLOUR: SetColour(param.AsColour()); break;
		case VARDATA_BLOCK: SetBlock(param.AsBlock()); break;
		default: DeleteValue();
	}
	classification = param.classification;
	ommited = param.ommited;
}
void THierarchicalStorage::ClearValues()
{
  std::unique_ptr<TStrings> Names(new TStringList());
  try__finally
  {
    GetValueNames(Names.get());
    for (intptr_t Index = 0; Index < Names->GetCount(); ++Index)
    {
      DeleteValue(Names->GetString(Index));
    }
  }
  __finally
  {
/*
    delete Names;
*/
  };
}
Esempio n. 23
0
bool
wxRegKey::RenameValue(const wxString& szValueOld, const wxString& szValueNew)
{
    bool ok = true;
    if ( HasValue(szValueNew) ) {
        wxLogError(_("Registry value '%s' already exists."), szValueNew);

        ok = false;
    }

    if ( !ok ||
         !CopyValue(szValueOld, *this, szValueNew) ||
         !DeleteValue(szValueOld) ) {
        wxLogError(_("Failed to rename registry value '%s' to '%s'."),
                   szValueOld, szValueNew);

        return false;
    }

    return true;
}
////////////////////
// Sets to a colour
void VariableData::SetColour(wxColour param) {
	DeleteValue();
	type = VARDATA_COLOUR;
	value_colour = new wxColour (param);
}
////////////////////
// Sets to a block
void VariableData::SetBlock(AssDialogueBlockOverride *param) {
	DeleteValue();
	type = VARDATA_BLOCK;
	value_block = param;
}
//////////////
// Destructor
VariableData::~VariableData () {
	DeleteValue ();
}
//////////////////////
// Sets to an integer
void VariableData::SetInt(int param) {
	DeleteValue();
	type = VARDATA_INT;
	value_int = new int(param);
}
///////////////////
// Sets to a float
void VariableData::SetFloat(double param) {
	DeleteValue();
	type = VARDATA_FLOAT;
	value_float = new double(param);
}
Esempio n. 29
0
Property::~Property()
{
	DeleteValue();
}
/////////////////////
// Sets to a boolean
void VariableData::SetBool(bool param) {
	DeleteValue();
	type = VARDATA_BOOL;
	value_bool = new bool(param);
}