TypeContainer::~TypeContainer()
{
  if (baseContainer_)
    delete baseContainer_;

  /*
    delete all particle containers
  */
  for (std::map < std::string, Containers *>::iterator i = particleContainers_.begin();
       particleContainers_.end() != i; ++i){
    
    delete i->second;
  }
  
  if(tcTable.size()>0) {
    
    /* 
       delete all sub type containers
    */
    for (size_t i = 0; i < tcTable.size(); i++)
      delete tcTable[i];
  
  }
  else {
    /* 
       delete the values if it is an atomic type container
    */
    deleteValue();
  }
}
示例#2
0
文件: RTree.c 项目: javierab/T1Alg
int recDelete(rect *r, node *n, int pos){
    int i,j;
    node *n1, *n2;
    if(n->leaf){
    	for(i = 0; i < n->size; ++i)
    		if(n->values[i]->child == pos){
            	deleteValue(n, i);
            	writeNode(n);
    			return TRUE;
    		}
    	return FALSE;
    }

    for(i = 0; i < n->size; ++i)
        if(intersect(r, n->values[i]->r)){
            n1 = readNode(n->values[i]->child);

            if(recDelete(r, n1, pos)){
            	n->values[i]->r = dupRect(n1->MBR);
                if(n1->size < b )
                	underflow(n, n1, i);
                else{
                	refreshMBR(n);
                	writeNode(n);
    				freeNode(n1);
                }
                return TRUE;
            }
            else
                freeNode(n1);

        }
    return FALSE;

}
示例#3
0
DWORD
TSHReg::DeleteValue(HKEY hkey, LPCTSTR pszSubKey, LPCTSTR pszValue)
{
  static TModuleProc3<DWORD,HKEY,LPCTSTR,LPCTSTR>
         deleteValue(GetModule(), DeleteValueStr);
  return deleteValue(hkey, pszSubKey, pszValue);
}
示例#4
0
void String::setValue(const char value[], int offset, int count) 
{ 
	deleteValue();
	if (!value && (int)strlen(value) < (offset + count)) 
		return;
	mValue = new char[count+1];
	strncpy(mValue, &value[offset], count);
}
示例#5
0
void ValueTinyint::setInt8Value(int8_t value)
{
    deleteValue();
    
    m_value = new int8_t( value );
    
    setValueLen(1);
}
示例#6
0
void String::setValue(const char value[]) 
{
	deleteValue();
	if (!value)
		return;
	if (strlen(value) <= 0)
		return;
	mValue = value;
}
示例#7
0
void WizXmlRpcStructValue::clear()
{
    std::map<QString, WizXmlRpcValue*>::const_iterator it;
    for (it = m_map.begin(); it != m_map.end(); it++) {
		deleteValue(it->second);
	}

	m_map.clear();
}
示例#8
0
void WizXmlRpcStructValue::removeValue(const QString& strName)
{
    std::map<QString, WizXmlRpcValue*>::iterator it = m_map.find(strName);
	if (it == m_map.end())
		return;

	deleteValue(it->second);
	m_map.erase(it);
}
示例#9
0
void String::setValue(const char value[]) 
{
	deleteValue();
	if (!value)
		return;
	if (strlen(value) <= 0)
		return;
	mValue = new char[strlen(value)+1];
	strcpy(mValue, value);
}
示例#10
0
Mixed &Mixed::operator=(const Mixed &v) {

	const Type oldType = m_type;
	ValueType oldValue = m_value;

	copyValue(v);
	deleteValue(oldType, oldValue);

	return *this;
}
示例#11
0
void Procedure::resetReachability()
{
    B3::resetReachability(
        m_blocks,
        [&] (BasicBlock* deleted) {
            // Gotta delete the values in this block.
            for (Value* value : *deleted)
                deleteValue(value);
        });
}
示例#12
0
ValueLongBlock::~ValueLongBlock()
{
    if ( m_raw_data ) delete [] m_raw_data;
    m_raw_data = 0;
    
    deleteValue();
    
   /* if ( m_long_data.raw_data )
    {
        delete [] m_long_data.raw_data;
    }*/
}
示例#13
0
文件: main.c 项目: f2008700/BITS
int main()
{
	int i,size=15;
	ElementList E;
	Element e1;
	e1.id=2000;
	e1.regstatus=0;
	for(i=0;i<size;i++)
	{
			E[i].id=i;
			E[i].regstatus=(i%3); //0= Success, 1 = Conflict, 2 = Deny
	}
	// R containing All (size number) registered student records
	ListHead ks, kd, kc;
	ks=createList();
	kd=createList();
	kc=createList();	 				
	for (i = 0; i < size; i++) {
		if  (E[i].regstatus == 0) {
	  		insertAtTail (E[i], ks);
		} else if  (E[i].regstatus == 1) {
			insertAtHead (E[i], kc);
		} else {
			insertInPos (E[i], kd,2);
		}
	}
	insertAfterValue (e1, ks, 12);
	printf("\n\nSUCCESS LIST\n");
	printList(ks);

	printf("\n\nCONFLICT LIST\n");
	printList(kc);

	printf("\n\nDENY LIST\n");
	printList(kd);


	deleteFromHead(ks);
	deleteFromTail(kc);
	deleteValue(kd,8);
	deletePos(ks,0);

	printf("\n\nSUCCESS LIST After Deletion\n");
	printList(ks);

	printf("\n\nCONFLICT LIST After Deletion\n");
	printList(kc);

	printf("\n\nDENY LIST After Deletion\n");
	printList(kd);
	

}
示例#14
0
void coEditorTextValueWidget::suicide()
{
    // make this a infoWidget
    fType = coEditorValueWidget::Info;
    valueLineEdit->setText(defaultValue);
    valueLineEdit->setModified(false);
    valueLineEdit->setStyleSheet("background-color: aliceblue");
    connect(deleteValueAction, SIGNAL(triggered()), this, SLOT(explainShowInfoButton()));
    //    hide();
    //    delete this;

    emit deleteValue(fvariable);
}
示例#15
0
void ValueTinyint::setRawData(const uint8_t* data, uint16_t len)
{
    deleteValue();
    
    if ( len == 1 )
    {
        int8_t val = ( ( ( int32_t ) ( data[0] ) ) );
        
        setInt8Value(val);
    }
    else
    {
        setValueLen( 0 );
    }
}
示例#16
0
文件: RTree.c 项目: javierab/T1Alg
void underflow(node *n, node *n1, int i){

    int j, sibling;
    node *n2;

	if(n->size == i + 1){
		n2 = readNode(n->values[i-1]->child);
		sibling = i-1;
	}
	else{
		n2 = readNode(n->values[i+1]->child);
		sibling = i+1;
	}
	if(n2->size > b){
		n1->values[n1->size++] = n2->values[--(n2->size)];
		refreshMBR(n1);
		refreshMBR(n2);

		freeRect(n->values[i]->r);
		n->values[i]->r = dupRect(n1->MBR);

		freeRect(n->values[sibling]->r);
		n->values[sibling]->r = dupRect(n2->MBR);

		refreshMBR(n);
		writeNode(n);

		writeNode(n1);
		freeNode(n1);

		writeNode(n2);
		freeNode(n2);

	}
	else{
		n2 = merge(n1,n2);
        freeNodeVal(n->values[i]);
        n->values[i] = new(nodeVal);
		n->values[i]->child = n2->address;
        n->values[i]->r=dupRect(n2->MBR);
		deleteValue(n, sibling);
        writeNode(n);

		freeNode(n2);
	}
}
示例#17
0
void Hashtable::clear(bool deleteValues)
{
    const int buckets = m_size;
    for (int i = 0; i < buckets; ++i) {
        List* list = (List*)m_buckets.itemAtFast(i);
        if (list) {
            const int items = list->countItems();
            for (int j = 0; j < items; ++j) {
                Item* item = (Item*)list->itemAtFast(j);
                if (deleteValues)
                    deleteValue(item->value);
                deleteItem(item);
            }
            delete list;
            m_buckets.replaceItem(i, 0);
        }
    }
}
示例#18
0
void Procedure::deleteOrphans()
{
    IndexSet<Value> valuesInBlocks;
    for (BasicBlock* block : *this)
        valuesInBlocks.addAll(*block);

    // Since this method is not on any hot path, we do it conservatively: first a pass to
    // identify the values to be removed, and then a second pass to remove them. This avoids any
    // risk of the value iteration being broken by removals.
    Vector<Value*, 16> toRemove;
    for (Value* value : values()) {
        if (!valuesInBlocks.contains(value))
            toRemove.append(value);
    }

    for (Value* value : toRemove)
        deleteValue(value);
}
示例#19
0
void Hashtable::put(const void* key, size_t len, void* value)
{
    unsigned int n = bucketNum(key, len);
    List* l = (List*)m_buckets.itemAtFast(n);
    if (! l) {
        bool added = m_buckets.replaceItem(n, l = new List);
        ASSERT(added); (void)added;
    }
    ASSERT(m_buckets.itemAtFast(n));
    Item* i = find(l, key, len);
    if (i) {
        deleteValue(i->value);
        i->value = value;
    } else {
        i = newItem(key, len, value);
        l->add(i);
    }
}
示例#20
0
main()
{
    SkipList_t *list = NULL;
    char buf[256];
    int  choice = 0;
 
    list = SkipListAlloc( myCmp, myFree );
    if ( list == NULL ) {
        printf( "ERROR: Allocation of skip list failed\n" );
        exit(1);
    }

    while (1) {
        displayMenu();
        choice = atoi( gets(buf) );
        switch( choice ) {
            case 1 :
                insertValue( list );
                break;
            case 2 :
                deleteValue( list );
                break;
            case 3 :
                searchValue( list );
                break;
            case 4 :
                getNextValue( list );
                break;
            case 5 :
                printValue( list );
                break;
            case 6 :
                clearList( list );
                break;
            case 7:
                SkipListFree(list);
                exit(0);
            default :
                break;
        }
    }

    exit(0);
}
示例#21
0
void ValueLongBlock::setLongDataInfo(const long_data_info_t& long_data_info)
{
    deleteValue();
    
    m_value = new long_data_info_t;
    
    ( ( long_data_info_t* ) m_value )->page_id = long_data_info.page_id;
    ( ( long_data_info_t* ) m_value )->nr = long_data_info.nr;
    ( ( long_data_info_t* ) m_value )->total_len = long_data_info.total_len;
    
    if (long_data_info.total_len > 0)
    {
        setValueLen( 10 );
    }
    else 
    {
        setValueLen( 0 );
    }
    
}
示例#22
0
ZExport (ZProfile &) ZProfile::setValue (long aValue,
                                         const ZString & aValueName)
{
  ZFUNCTRACE_DEVELOP
    ("ZProfile::setValue(const ZString& aValue, const ZString& aValueName, int aType)");
#ifdef ZC_WIN
  openPath (zTrue);

  if (valueExists (aValueName))
    deleteValue (aValueName);

  if (!RegSetValueEx ((HKEY) iPathHandle, aValueName, 0,
                      4, (LPBYTE) & aValue, 4) == ERROR_SUCCESS)
    throwSysErr (SRegSetValueEx);
#endif
#ifdef ZC_OS2
  setValue (ZString (aValue));
#endif
  return *this;
}                               // setValue
示例#23
0
void CMainWindow::valuesCtxMenu(const QPoint &pos)
{
    QModelIndex uidx = ui->tableValues->indexAt(pos);
    QModelIndex idx = valuesSortModel->mapToSource(uidx);

    QString name = valuesModel->getValueName(idx);

    QMenu cm(ui->tableValues);
    QAction* acm;
    if (idx.isValid()) { // Context menu for value
        acm = cm.addAction(tr("Modify"));
        connect(acm,&QAction::triggered,[this,uidx](){
            valuesModify(uidx);
        });

        cm.addSeparator();

        acm = cm.addAction(tr("Delete"));
        acm->setDisabled(valuesModel->getValue(idx).isDefault());
        connect(acm,&QAction::triggered,[this,idx](){
            deleteValue(idx);
        });

        acm = cm.addAction(tr("Rename"));
        connect(acm,&QAction::triggered,[this,name,idx](){
            QString s = name;
            bool ok;
            s = QInputDialog::getText(this,tr("Registry Editor - Value rename"),
                                                     tr("Rename registry value"),QLineEdit::Normal,s,&ok);
            if (ok && !s.isEmpty())
                valuesModel->renameValue(idx,s);
        });

        cm.exec(ui->tableValues->mapToGlobal(pos));
    } else
        treeCtxMenuPrivate(pos, true);
}
void
CssmDbAttributeData::deleteValues(const CssmDbAttributeData &src, Allocator &inAllocator)
{
	for (uint32 i = 0; i < src.NumberOfValues; i++)
		deleteValue(CssmData::overlay(src.Value[i]), inAllocator);
}
示例#25
0
CMainWindow::CMainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    if (cgl==nullptr)
        cgl = new CGlobal(this);

    ui->setupUi(this);

    setWindowIcon(QIcon(":/icons/regedit"));

    treeModel = new CRegistryModel();
    valuesModel = new CValuesModel();
    groupsModel = new CSAMGroupsModel();
    usersModel = new CSAMUsersModel();

    valuesSortModel = new QSortFilterProxyModel(this);
    valuesSortModel->setSourceModel(valuesModel);
    ui->treeHives->setModel(treeModel);
    ui->tableValues->setModel(valuesSortModel);
    ui->treeGroups->setModel(groupsModel);
    ui->tableUsers->setModel(usersModel);

    ui->treeHives->setContextMenuPolicy(Qt::CustomContextMenu);
    ui->tableValues->setContextMenuPolicy(Qt::CustomContextMenu);

    centerWindow();

    searchProgressDialog = new CProgressDialog(this);

    ui->actionOpenHiveRO->setData(1);
    connect(ui->actionExit,&QAction::triggered,this,&CMainWindow::close);
    connect(ui->actionOpenHive,&QAction::triggered,this,&CMainWindow::openHive);
    connect(ui->actionOpenHiveRO,&QAction::triggered,this,&CMainWindow::openHive);
    connect(ui->actionImport,&QAction::triggered,this,&CMainWindow::importReg);
    connect(ui->actionAbout,&QAction::triggered,this,&CMainWindow::about);
    connect(ui->actionAboutQt,&QAction::triggered,qApp,&QApplication::aboutQt);
    connect(ui->actionSettings,&QAction::triggered,[this](){
       cgl->settingsDialog(this);
    });
    if (cgl->logWindow!=nullptr)
        connect(ui->actionLog,&QAction::triggered,cgl->logWindow,&CLogDisplay::show);

    connect(ui->actionFind,&QAction::triggered,this,&CMainWindow::searchTxt);
    connect(ui->actionFindAgain,&QAction::triggered,
            treeModel->finder,&CFinder::continueSearch,Qt::QueuedConnection);
    connect(treeModel->finder,&CFinder::showProgressDialog,
            searchProgressDialog,&CProgressDialog::show,Qt::QueuedConnection);
    connect(treeModel->finder,&CFinder::hideProgressDialog,
            searchProgressDialog,&CProgressDialog::hide,Qt::QueuedConnection);
    connect(this,&CMainWindow::startSearch,
            treeModel->finder,&CFinder::searchText,Qt::QueuedConnection);
    connect(searchProgressDialog,&CProgressDialog::cancel,[this](){
       treeModel->finder->cancelSearch();
    });

    connect(ui->treeHives,&QTreeView::clicked,this,&CMainWindow::showValues);
    connect(ui->treeHives,&QTreeView::activated,this,&CMainWindow::showValues);
    connect(ui->treeHives,&QTreeView::customContextMenuRequested,
            this,&CMainWindow::treeCtxMenu);

    connect(ui->tableValues,&QTableView::customContextMenuRequested,
            this,&CMainWindow::valuesCtxMenu);
    connect(ui->tableValues,&QTableView::activated,
            this,&CMainWindow::valuesModify);

    connect(ui->tableUsers,&QTableView::activated,
            this,&CMainWindow::editUser);

    connect(treeModel,&CRegistryModel::keyFound,this,&CMainWindow::keyFound);
    connect(treeModel->finder,&CFinder::searchFinished,
            this,&CMainWindow::searchFinished,Qt::QueuedConnection);

    connect(cgl->reg,&CRegController::hiveAboutToClose,this,&CMainWindow::hivePrepareClose);

    QShortcut* sc = new QShortcut(QKeySequence(QKeySequence::Delete),ui->tableValues);
    connect(sc,&QShortcut::activated,[this](){
        deleteValue(ui->tableValues->currentIndex());
    });

    ui->tabSAM->hide();

    QStringList errors;
    QStringList args = QApplication::arguments();
    for (int i=1;i<args.count();i++)
        if (!cgl->reg->openTopHive(args.at(i), HMODE_RW))
            errors << args.at(i);

    if (!errors.isEmpty()) {
        QTimer::singleShot(2500,[errors](){
            QString msg = tr("Failed to open hives:\n");
            msg.append(errors.join('\n'));
            QMessageBox::critical(QApplication::activeWindow(),tr("Registry Editor - Error"),msg);
        });
    }
}
示例#26
0
ZExport (ZProfile &) ZProfile::deleteKey (const ZString & aKeyName)
{
  ZFUNCTRACE_DEVELOP ("ZProfile::deleteKey(const ZString& aKeyName)");
#ifdef ZC_WIN
  // delete all values and subkeys first
  ZString oldPath (iPath);
  try
  {
    setPath (iPath + (char) ZC_PATHSEPARATOR + aKeyName);
    openPath (zFalse);

    ZStringlist list;
    int i;

    // delete all values
    setValue (ZString ());      // just clear out default value
    getValues (list);
    for (i = 0; i < list.count (); i++)
      if (list[i].size ())
          {
            deleteValue (list[i]);
          }                     // if

    // delete all subkeys
    getKeys (list);
    for (i = 0; i < list.count (); i++)
      deleteKey (list[i]);
  }                             // try
  catch (const ZException & exc)
  {
    setPath (oldPath);
    throw;
  }                             // catch

  setPath (oldPath);
  openPath (zFalse);
  RegDeleteKey ((HKEY) iPathHandle, aKeyName);
#endif
#ifdef ZC_OS2
  if (iPath.size () && aKeyName.size ())
    return *this;               // no keys at this level

  openRoot ();

  if (!iPath.size () && !aKeyName.size ())
      {
        // delete all applications:

        // will only do this if not the system- or user profile!
        if (iRootHandle == HINI_SYSTEMPROFILE ||
            iRootHandle == HINI_USERPROFILE)
          return *this;

        ZStringlist apps;
        getKeys (apps);
        for (long i = 0; i < apps.count (); i++)
          if (!PrfWriteProfileString (iRootHandle, apps[i], 0, 0))
            throwSysErr (PrfWriteProfileStringName);
      }
  else
      {
        if (!PrfWriteProfileString (iRootHandle,
                                    iPath.size ()? iPath : aKeyName, 0, 0))
          throwSysErr (PrfWriteProfileStringName);
      }                         // if
#endif
  return *this;
}                               // deleteKey
示例#27
0
ZExport (ZProfile &) ZProfile::setValue (const ZString & aValue,
                                         const ZString & aValueName,
                                         int aType)
{
  ZFUNCTRACE_DEVELOP
    ("ZProfile::setValue(const ZString& aValue, const ZString& aValueName, int aType)");

  // find out type if auto
  if (aType == Auto)
      {
        ZString v (aValue);
        if (ZString (v.strip ().asLong ()) == v)
          aType = Integer;
        else
            {
              if (aValue.isPrintable ())
                aType = String;
              else
                aType = Binary;
            }                   // if
      }                         // if

#ifdef ZC_WIN
  long dataType;
  switch (aType)
      {
      case String:
        dataType = 1;           // String
        break;
      case Integer:
        return setValue (aValue.asLong (), aValueName);
      default:
        dataType = 3;           // Binary
      }                         // switch

  openPath (zTrue);

  if (valueExists (aValueName))
    deleteValue (aValueName);

  if (!RegSetValueEx ((HKEY) iPathHandle, aValueName, 0,
                      dataType, (LPBYTE) (const char *) aValue,
                      aValue.size ()) == ERROR_SUCCESS)
    throwSysErr (SRegSetValueEx);
#endif
#ifdef ZC_OS2
  if (!iPath.size ())
    ZTHROWEXC (MissingPath);
  if (!aValueName.size ())
    ZTHROWEXC (MissingValueName);
  openRoot ();

  switch (aType)
      {
      case String:
        if (!PrfWriteProfileString (iRootHandle, iPath, aValueName,
                                    ZString::exp (aValue)))
          throwSysErr (PrfWriteProfileStringName);
        break;
      case Integer:
        {
          ZString v (aValue);
          if (!PrfWriteProfileString (iRootHandle, iPath, aValueName,
                                      ZString (v.strip ().asLong ())))
            throwSysErr (PrfWriteProfileStringName);
          break;
        }                       // Integer
      default:
        {
          ZString val (aValue);
          if (!PrfWriteProfileData (iRootHandle, iPath, aValueName,
                                    (char *) val, val.size ()))
            throwSysErr (PrfWriteProfileDataName);
        }                       // default
      }                         // switch
#endif
  return *this;
}                               // setValue
示例#28
0
String::~String() 
{
	deleteValue();
}
示例#29
0
Mixed::~Mixed() {

	deleteValue(m_type, m_value);
}
示例#30
0
ValueTinyint::~ValueTinyint()
{
    deleteValue();
}