IASDataTypeDeclaration* /*CTypeDefinition* */ CASXMLSchemaModel::FindTypeElementByName(ILDOMNode* parent, BSTR btypename) { _bstr_t targetNamespace = GetTargetNamespace(); _bstr_t uri; _bstr_t local; ExtractURILocal(parent, btypename, uri, local); // Find a 'complexType'/'simpleType element with name attribute belLocalName for (int i = 0; i < m_globalDefs.m_defs.GetSize(); i++) { IASDeclaration* pDef = /*(CTypeDefinition*)*/m_globalDefs.m_defs[i]; CComBSTR type; pDef->GetDefType(&type); if (!wcscmp(type, L"complexType") || !wcscmp(type, L"simpleType")) { CComQIPtr<IASDataTypeDeclaration> typedecl = pDef; CComBSTR name; typedecl->GetName(&name); if (!wcscmp(name, local)) { return typedecl.p; } } } return NULL; }
HRESULT AsdkSheetSet::List(IAcSmDatabase *pDb) { // List the contents of the sheet set at the command line HRESULT hr; if(!pDb) return E_FAIL; CComPtr<IAcSmEnumPersist> pEnum; CComPtr<IAcSmPersist> pItem; pDb->GetEnumerator(&pEnum); pEnum->Reset(); acutPrintf("\n ******** BEGIN ************** "); acutPrintf("\n"); while(SUCCEEDED(hr=pEnum->Next(&pItem)) && pItem) { CComQIPtr<IAcSmSubset> pSubSet = pItem; CComQIPtr<IAcSmSheet> pSheet = pItem; CComQIPtr<IAcSmCustomPropertyBag> pPropertyBag = pItem; CComBSTR bstrTypeName; char name[80]; char desc[255]; if (pSubSet != NULL) { BSTR bstrSubsetName; BSTR bstrSubSetDesc; pSubSet->GetName(&bstrSubsetName); pSubSet->GetDesc(&bstrSubSetDesc); strcpy(name, _bstr_t(bstrSubsetName).operator char*()); strcpy(desc, _bstr_t(bstrSubSetDesc).operator char*()); acutPrintf("\n -------------------------------"); acutPrintf("\n SubSet Name : %s", name); acutPrintf("\n Description : %s", desc); acutPrintf("\n -------------------------------"); } else if(pSheet != NULL) { BSTR bstrSheetName; BSTR bstrSheetDesc; BSTR bstrLayoutName; BSTR bstrFileName; char layout[80]; char fileName[255]; CComPtr<IAcSmAcDbLayoutReference> pLayoutRef; pSheet->GetName(&bstrSheetName); pSheet->GetDesc(&bstrSheetDesc); pSheet->GetLayout(&pLayoutRef); if (pLayoutRef) { pLayoutRef->GetName(&bstrLayoutName); pLayoutRef->GetFileName(&bstrFileName); } strcpy(name, _bstr_t(bstrSheetName).operator char*()); strcpy(desc, _bstr_t(bstrSheetDesc).operator char*()); strcpy(layout, _bstr_t(bstrLayoutName).operator char*()); strcpy(fileName, _bstr_t(bstrFileName).operator char*()); acutPrintf("\n Sheet : %s", name); acutPrintf("\n Sheet Description : %s", desc); acutPrintf("\n Layout Name : %s", layout); acutPrintf("\n FileName Name : %s", fileName); acutPrintf("\n"); } else if(pPropertyBag != NULL) { CComVariant val; CComQIPtr<IAcSmEnumProperty> pEnumProp; pPropertyBag->GetPropertyEnumerator(&pEnumProp); HRESULT hr; BSTR propName; BSTR propValue; pEnumProp->Reset(); CComQIPtr<IAcSmCustomPropertyValue> pValue; while(pEnumProp->Next(&propName,&pValue)== S_OK) { strcpy(name, _bstr_t(propName).operator char*()); acutPrintf("\n Property Name : %s", name); pValue->GetValue(&val); if(V_VT(&val)==VT_BSTR) { // This Value is never VT_BSTR so what is wrong here??? _bstr_t propValue = val; strcpy(desc, _bstr_t(propValue).operator char*()); acutPrintf("\n Property Value : %s", desc); } } } } acutPrintf("\n"); acutPrintf("\n ******** END ************** "); return S_OK; }