Exemple #1
0
void ArxDictHelper::RemoveAllEntries( const CString& dictName, const CString& key )
{
    if( key.GetLength() == 0 ) return;
    ArxDictTool* pDictTool = ArxDictTool::GetDictTool( dictName );
    pDictTool->removeKey( key );
    delete pDictTool;
}
Exemple #2
0
static bool AddField_Helper( const CString& dictName, const CString& type, const CString& field )
{
    ArxDictTool* pDictTool = ArxDictTool::GetDictTool( dictName );
    int index = pDictTool->addEntry( type, field );
    delete pDictTool;
    return ( index != INVALID_ENTRY );
}
Exemple #3
0
void ArxDictHelper::GetAllKeys( const CString& dictName, AcStringArray& keys )
{
    keys.removeAll();
    ArxDictTool* pDictTool = ArxDictTool::GetDictTool( dictName );
    pDictTool->getAllKeys( keys );
    delete pDictTool;
}
Exemple #4
0
static int CountFields_Helper( const CString& dictName, const CString& type )
{
    ArxDictTool* pDictTool = ArxDictTool::GetDictTool( dictName );
    int count = pDictTool->countEntries( type );
    delete pDictTool;
    return count;
}
bool DataObjectListHelper::IsObjectListType( const CString& name )
{
    ArxDictTool* pDictTool = ArxDictTool::GetDictTool( OBJECT_LIST_DICT );
    bool ret = pDictTool->findKey( name );
    delete pDictTool;
    return ret;
}
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 #7
0
static int FindField_Helper( const CString& dictName, const CString& type, const CString& field )
{
    ArxDictTool* pDictTool = ArxDictTool::GetDictTool( dictName );
    int index = pDictTool->findEntry( type, field );
    delete pDictTool;
    return index;
}
Exemple #8
0
static bool FindKey_Helper( const CString& dictName, const CString& type )
{
    ArxDictTool* pDictTool = ArxDictTool::GetDictTool( dictName );
    bool ret = pDictTool->findKey( type );
    delete pDictTool;
    return ret;
}
Exemple #9
0
bool ArxDictHelper::AddEntry( const CString& dictName, const CString& key, const CString& entry )
{
    ArxDictTool* pDictTool = ArxDictTool::GetDictTool( dictName );
    bool ret = ( INVALID_ENTRY != pDictTool->addEntry( key, entry ) );
    delete pDictTool;
    return ret;
}
Exemple #10
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::GetObjectNameList( const CString& name, AcStringArray& values )
{
    if( name.GetLength() == 0 ) return false;

    ArxDictTool* pDictTool = ArxDictTool::GetDictTool( OBJECT_LIST_DICT );
    pDictTool->getAllEntries( name, values );
    delete pDictTool;
    return true;
}
Exemple #12
0
bool ArxDictHelper::GetAllEntries( const CString& dictName, const CString& key, AcStringArray& entries )
{
    if( key.GetLength() == 0 ) return false;

    entries.removeAll();
    ArxDictTool* pDictTool = ArxDictTool::GetDictTool( dictName );
    bool ret = pDictTool->findKey( key );
    if( ret )
    {
        pDictTool->getAllEntries( key, entries );
    }
    delete pDictTool;
    return ret;
}
bool StringListHelper::AddStringList( const CString& name, const AcStringArray& strList )
{
    if( ( name.GetLength() == 0 ) || strList.isEmpty() ) return false;

    ArxDictTool* pDictTool = ArxDictTool::GetDictTool( STRING_LIST_DICT );
    bool ret = pDictTool->findKey( name );
    if( !ret ) // 如果变量name已存在,则不进行修改
    {
        int len = strList.length();
        for( int i = 0; i < len; i++ )
        {
            pDictTool->addEntry( name, strList[i].kACharPtr() );
        }
    }
    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;
}
bool IntStrListHelper::AddIntStrList( const CString& name, const AcDbIntArray& intList, const AcStringArray& strList )
{
    if( ( name.GetLength() == 0 ) || strList.isEmpty() || intList.isEmpty() ) return false;
    if( intList.length() != strList.length() ) return false;

    ArxDictTool* pDictTool = ArxDictTool::GetDictTool( INT_LIST_DICT );
    bool ret = pDictTool->findKey( name );
    if( !ret )
    {
        int len = intList.length();
        for( int i = 0; i < len; i++ )
        {
            CString intValue;
            intValue.Format( _T( "%d" ), intList[i] );
            pDictTool->addEntry( name, intValue );             // 偶数位置的元素为整数
            pDictTool->addEntry( name, strList[i].kACharPtr() ); // 奇数位置的元素为字符串
        }
    }
    delete pDictTool;
    return !ret;
}
Exemple #16
0
static void GetAllFields_Helper( const CString& dictName, const CString& type, AcStringArray& fields )
{
    ArxDictTool* pDictTool = ArxDictTool::GetDictTool( dictName );
    pDictTool->getAllEntries( type, fields );
    delete pDictTool;
}
Exemple #17
0
static void GetAllKeys_Helper( const CString& dictName, AcStringArray& keys )
{
    ArxDictTool* pDictTool = ArxDictTool::GetDictTool( dictName );
    pDictTool->getAllKeys( keys );
    delete pDictTool;
}
Exemple #18
0
static void RemoveKey_Helper( const CString& dictName, const CString& type )
{
    ArxDictTool* pDictTool = ArxDictTool::GetDictTool( dictName );
    pDictTool->removeKey( type );
    delete pDictTool;
}
Exemple #19
0
void ArxDictHelper::RemoveKey( const CString& dictName, const CString& key )
{
    ArxDictTool* pDictTool = ArxDictTool::GetDictTool( dictName );
    pDictTool->removeKey( key );
    delete pDictTool;
}