Fix build on macOS

This commit is contained in:
Oleg Korshul
2018-04-19 16:10:29 +03:00
parent 89d7eb559d
commit 51569b626f
9 changed files with 57 additions and 37 deletions

View File

@ -92,15 +92,15 @@ namespace XmlUtils
bool ReadTillEnd(int nDepth = -2);
std::wstring GetName();
std::string GetNameA();
int GetDepth();
bool IsEmptyNode();
std::string GetNameA();
int GetDepth();
bool IsEmptyNode();
std::wstring GetText();
std::string GetTextA();
std::string GetTextA();
std::wstring GetText2();
std::string GetText2A();
std::string GetText2A();
std::wstring GetText3();
@ -112,7 +112,11 @@ namespace XmlUtils
bool MoveToNextAttribute();
bool MoveToElement();
bool IsEmptyElement();
bool IsEmptyElement();
std::wstring GetNamespacePrefix();
XmlNodeType GetNodeType();
bool IsDefaultAttribute();
};
class KERNEL_DECL IXmlDOMDocument

View File

@ -187,4 +187,17 @@ namespace XmlUtils
{
return m_pInternal->IsEmptyElement();
}
std::wstring CXmlLiteReader::GetNamespacePrefix()
{
return m_pInternal->GetNamespacePrefix();
}
XmlNodeType CXmlLiteReader::GetNodeType()
{
return m_pInternal->GetNodeType();
}
bool CXmlLiteReader::IsDefaultAttribute()
{
return m_pInternal->IsDefaultAttribute();
}
}

View File

@ -36,6 +36,7 @@
#include "../libxml2/libxml.h"
#include "../libxml2/include/libxml/xmlreader.h"
#include "../include/xmlutils.h"
namespace XmlUtils
{
@ -429,6 +430,25 @@ namespace XmlUtils
return 1 == xmlTextReaderIsEmptyElement(reader) ? true : false;
}
std::wstring GetNamespacePrefix()
{
xmlChar* pName = xmlTextReaderPrefix(reader);
if (NULL == pName)
return L"";
std::wstring sTemp = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)pName, (LONG)strlen((const char*)pName));
free(pName);
return sTemp;
}
XmlNodeType GetNodeType()
{
return (XmlUtils::XmlNodeType)xmlTextReaderNodeType(reader);
}
bool IsDefaultAttribute()
{
return (0 != xmlTextReaderIsDefault(reader)) ? true : false;
}
private:
inline std::wstring GetXml(bool bInner)
{