You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kev/Drawer/Module/GeoSigmaDraw/InterfaceMathFind.cpp

48 lines
1.1 KiB
C++

1 month ago
#include "StdAfx.h"
#include "SigmaView.h"
#include "sigmadoc.h"
#include "ItemMathFind.h"
#include "TinyXml\tinyxml.h"
extern "C" __declspec(dllexport)
int Sigma_MathFind(CSigmaView * pView, int kind, double step, double remainder, int start, char ** elementsContentBuffer)
{
if (pView->m_pDoc == 0)
{
return -1;
}
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>XML<4D><4C><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TiXmlDocument *xmlDocument = new TiXmlDocument();
//TiXmlDeclaration * decl = new TiXmlDeclaration("1.0", "UTF-8", "");
//xmlDocument->LinkEndChild(decl);
// <20><>Ԫ<EFBFBD>ء<EFBFBD>
TiXmlElement *rootElement = new TiXmlElement("ROOT");
xmlDocument->LinkEndChild(rootElement);
CItemMathFind find(pView->m_pDoc);
find.MathFind(kind, step, remainder, start, rootElement);
TiXmlPrinter printer;
xmlDocument->Accept(&printer);
const char * xmlstr = printer.CStr();
size_t len = strlen(xmlstr);
if (len <= 0)
{
return -1;
}
char * dest = (char *)malloc(len + 1);
strcpy(dest, xmlstr);
*elementsContentBuffer = dest;
xmlDocument->Clear();
delete xmlDocument;
return (int)len;
}
extern "C" __declspec(dllexport)
void Sigma_ReleaseNativeMemory(void * nativeMemory)
{
delete nativeMemory;
}