コード例 #1
0
BOOL COCSInventoryState::WriteToFile(LPCTSTR lpstrFilename, LPCTSTR lpstrSection)
{
	CMarkup	myXml;
	TiXmlElement *pNode, *pTemp;

	// Load current state file
	if (myXml.LoadFile( lpstrFilename))
	{
		// File already exists, so remove existing section from XML 
		myXml.ResetPos();
		pNode = myXml.FindFirstElem( lpstrSection);
		while (pNode)
		{
			pTemp = pNode;
			pNode = myXml.FindNextElem( lpstrSection, pTemp);
			myXml.DeleteElem( pTemp);
		}
	}
	// Add new section
	myXml.ResetPos();
	if (!FormatXML( &myXml, lpstrSection))
		return FALSE;
	// Save state file
	if (!myXml.SaveFile( lpstrFilename))
		return FALSE;
	return TRUE;
}
コード例 #2
0
void CNCSJP2File::CNCSJP2GMLGeoLocationBox::UpdateXLBox(void)
{
    char buf[1024];

    if(FormatXML(buf,sizeof(buf)) == NCS_SUCCESS)
    {
        CNCSJP2Box::UpdateXLBox();
        m_nXLBox += strlen(buf);
        m_bValid = true;
    }
    else
    {
        m_nXLBox = 0;
        m_bValid = false;
    }
}
コード例 #3
0
// UnParse the box to the stream
CNCSError CNCSJP2File::CNCSJP2GMLGeoLocationBox::UnParse(class CNCSJP2File &JP2File, CNCSJPCIOStream &Stream)
{
#ifdef NCS_BUILD_WITH_STDERR_DEBUG_INFO
    fprintf(stderr,"UnParsing GML box information\n");
#endif


    char buf[1024];
    CNCSError Error = FormatXML(buf, sizeof(buf));

    if(Error == NCS_SUCCESS) {
        Error = CNCSJP2Box::UnParse(JP2File, Stream);
        NCSJP2_CHECKIO_BEGIN(Error, Stream);
        Stream.Write(buf, (UINT32)strlen(buf));
        NCSJP2_CHECKIO_END();
    }
    return(Error);
}