static BOOL ReadTableDatas(const CString& itemName,AcStringArray& names,AcStringArray& datas) { names.removeAll(); datas.removeAll(); ArrayVector dataVector; ReportDataHelper::ReadDatas(itemName,dataVector,2); if(dataVector.empty()) return FALSE; for(int i = 0; i < dataVector.size(); i++) { names.append(dataVector[i][0]); datas.append(dataVector[i][1]); } return TRUE; }
bool IntStrListHelper::GetIntStrList( const CString& name, AcDbIntArray& intList, AcStringArray& strList ) { AcStringArray entries; if( !ArxDictHelper::GetAllEntries( INT_LIST_DICT, name, entries ) ) return false; int len = entries.length(); bool ret = ( len > 0 && len % 2 == 0 ); if( ret ) // 长度必须为偶数 { intList.removeAll(); strList.removeAll(); for( int i = 0; i < len; i++ ) { if( i % 2 == 0 ) // 偶数位置的元素为整数 { intList.append( _ttoi( entries[i].kACharPtr() ) ); } else // 奇数位置的元素为字符串 { strList.append( entries[i] ); } } } return ret; }
static BOOL ReadDataFromFile(const CString& txtName,AcStringArray& names,AcStringArray& isRunings,AcStringArray& resons) { names.removeAll(); isRunings.removeAll(); resons.removeAll(); ArrayVector dataVector; ReportDataHelper::ReadDatas(txtName,dataVector,3); if(dataVector.empty()) return FALSE; for(int i = 0; i < dataVector.size(); i++) { names.append(dataVector[i][0]); isRunings.append(dataVector[i][1]); resons.append(dataVector[i][2]); } return TRUE; }
static bool GetFieldsDatas(const CString& type, const CString& func, const AcDbObjectId& objId,AcStringArray& fields,AcStringArray& datas) { fields.removeAll(); datas.removeAll(); if(!FuncFieldHelper::GetFields(func,type,fields)) return false; fields.remove(_T("钻孔名称")); for(int i = 0; i < fields.length(); i++) { CString strData; if(!DataHelper::GetPropertyData(objId,fields[i].kACharPtr(),strData)) return false; DealIntListDatas(fields[i].kACharPtr(),strData); datas.append(strData); } return true; }
void ArxDictHelper::GetAllKeys( const CString& dictName, AcStringArray& keys ) { keys.removeAll(); ArxDictTool* pDictTool = ArxDictTool::GetDictTool( dictName ); pDictTool->getAllKeys( keys ); delete pDictTool; }
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; }