本文整理汇总了C++中IXMLDOMNode::get_previousSibling方法的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMNode::get_previousSibling方法的具体用法?C++ IXMLDOMNode::get_previousSibling怎么用?C++ IXMLDOMNode::get_previousSibling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IXMLDOMNode
的用法示例。
在下文中一共展示了IXMLDOMNode::get_previousSibling方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: insertFileItem
int DicomImageSet::insertFileItem(IXMLDOMDocument *pDom, IXMLDOMNode * pRoot, const QString &folderName, const QString &fileName)
{
DicomImage * dicomImage = new DicomImage ();
if (!dicomImage->readHeader((QDir(folderName).absoluteFilePath(fileName)).toStdString().c_str()))
{
//fail to resolve header information
return 0;
}
int nElement;
char * patientsName = dicomImage->getCharTag(DicomImage::TAG_PATIENTS_NAME, nElement);
char * patientsId = dicomImage->getCharTag(DicomImage::TAG_PATIENT_ID, nElement);
char * protocolName = dicomImage->getCharTag(DicomImage::TAG_PROTOCOL_NAME, nElement);
double * pInstanceNumber = dicomImage->getNumericTag(DicomImage::TAG_INSTANCE_NUMBER, nElement);
double * pAcquisitionNumber = dicomImage->getNumericTag(DicomImage::TAG_ACQUISITION_NUMBER, nElement);
double * pAcquisitionDate = dicomImage->getNumericTag(DicomImage::TAG_ACQUISITION_DATE, nElement);
int instanceNumber = pInstanceNumber?(int)pInstanceNumber[0]:-1;
int acquisitionNumber = pAcquisitionNumber?(int)pAcquisitionNumber[0]:-1;
int acquisitionDate = pAcquisitionDate?(int)pAcquisitionDate[0]:0;
IXMLDOMNode * pParent = findParentNode(pDom, pRoot, patientsName, patientsId, acquisitionDate, protocolName, acquisitionNumber);
if (!pParent)
{
return 0;
}
HRESULT hr = S_OK;
IXMLDOMElement *pNode = NULL;
CHK_HR(CreateElement(pDom, L"File", &pNode));
CHK_HR(CreateAndAddAttributeNode(pDom, L"path", fileName.toStdWString().c_str(), pNode));
CHK_HR(CreateAndAddAttributeNode(pDom, L"instance_number", QString::number(instanceNumber).toStdWString().c_str(), pNode));
IXMLDOMNode * pSibling = NULL;
CHK_HR(pParent->get_firstChild(&pSibling));
int sibInstanceNumber = -1;
VARIANT varInstanceNumber;
DOMNodeType nodeType;
while (pSibling && instanceNumber >= sibInstanceNumber)
{
CHK_HR(pSibling->get_nodeType(&nodeType));
if(nodeType == NODE_ELEMENT)
{
CHK_HR(GetAttributeFromNode(pSibling, L"instance_number", &varInstanceNumber));
sibInstanceNumber = QString::fromWCharArray(_bstr_t(varInstanceNumber)).toInt();
if (instanceNumber < sibInstanceNumber)
{
break;
}
}
IXMLDOMNode * tmpNode = NULL;
CHK_HR(pSibling->get_nextSibling(&tmpNode));
SAFE_RELEASE(pSibling);
pSibling = tmpNode;
}
if (pSibling)
{
IXMLDOMNode * tmpNode = NULL;
CHK_HR(pSibling->get_previousSibling(&tmpNode));
SAFE_RELEASE(pSibling);
pSibling = tmpNode;
}
CHK_HR(CreateAndAddTextNodeBefore(pDom, L"\n", pParent, pSibling));
CHK_HR(InsertChildToParent(pNode, pSibling, pParent));
CleanUp:
SAFE_RELEASE(pNode);
return 1;
}