Exemple #1
0
static int RemoveField_Helper( const CString& dictName, const CString& type, const CString& field )
{
    ArxDictTool* pDictTool = ArxDictTool::GetDictTool( dictName );
    int index = pDictTool->removeEntry( type, field );
    delete pDictTool;
    return index;
}
bool DataObjectListHelper::AddObject( const CString& name, const CString& value )
{
    if( name.GetLength() == 0 || value.GetLength() == 0 ) return false;

    ArxDictTool* pDictTool = ArxDictTool::GetDictTool( OBJECT_LIST_DICT );
    bool ret = ( INVALID_ENTRY != pDictTool->addEntry( name, value ) );
    if( ret )
    {
        ArxDictTool2* pDictTool2 = ArxDictTool2::GetDictTool( OBJECT_LIST_DATA_DICT );
        CString key;
        key.Format( _T( "%s_%s" ), name, value );

        DataObject* pDO = new DataObject();
        pDO->setType( name );
        pDO->initData();  // 初始化数据
        ret = pDictTool2->addEntry( key, pDO );
        if( !ret ) // 添加Object失败
        {
            delete pDO;
            pDictTool->removeEntry( name, value );
        }
        delete pDictTool2;
    }
    delete pDictTool;

    return ret;
}
Exemple #3
0
bool ArxDictHelper::RemoveEntry( const CString& dictName, const CString& key, const CString& entry )
{
    if( key.GetLength() == 0 ) return false;
    ArxDictTool* pDictTool = ArxDictTool::GetDictTool( dictName );
    bool ret = ( INVALID_ENTRY != pDictTool->removeEntry( key, entry ) );
    delete pDictTool;
    return ret;
}
bool DataObjectListHelper::RemoveObject( const CString& name, const CString& value )
{
    if( name.GetLength() == 0 || value.GetLength() == 0 ) return false;

    ArxDictTool* pDictTool = ArxDictTool::GetDictTool( OBJECT_LIST_DICT );
    bool ret = ( INVALID_ENTRY != pDictTool->removeEntry( name, value ) );
    delete pDictTool;

    if( ret )
    {
        ArxDictTool2* pDictTool2 = ArxDictTool2::GetDictTool( OBJECT_LIST_DATA_DICT );
        CString key;
        key.Format( _T( "%s_%s" ), name, value );
        ret = pDictTool2->removeEntry( key );
        delete pDictTool2;
    }
    return ret;
}