next step.s

This commit is contained in:
Kim Kulling
2020-08-18 20:44:06 +02:00
parent 394651e640
commit 554ed1bf91
6 changed files with 34 additions and 171 deletions

View File

@@ -133,7 +133,7 @@ struct WordIterator {
const char *operator*() const { return mStart; }
};
static const char *WordIterator::whitespace = ", \t\r\n";
const char *WordIterator::whitespace = ", \t\r\n";
X3DImporter::X3DImporter() :
mNodeElementCur(nullptr), mReader(nullptr) {
@@ -231,11 +231,14 @@ bool X3DImporter::FindNodeElement(const std::string &pID, const X3DNodeElementBa
/************************************************************* Functions: XML set ************************************************************/
/*********************************************************************************************************************************************/
void X3DImporter::XML_CheckNode_MustBeEmpty() {
if (!mReader->isEmptyElement()) throw DeadlyImportError(std::string("Node <") + mReader->getNodeName() + "> must be empty.");
void X3DImporter::XML_CheckNode_MustBeEmpty(XmlNode &node) {
if (!node.empty()) {
throw DeadlyImportError(std::string("Node <") + node.name() + "> must be empty.");
}
//if (!mReader->isEmptyElement()) throw DeadlyImportError(std::string("Node <") + mReader->getNodeName() + "> must be empty.");
}
void X3DImporter::XML_CheckNode_SkipUnsupported(const std::string &pParentNodeName) {
void X3DImporter::XML_CheckNode_SkipUnsupported(XmlNode &node, const std::string &pParentNodeName) {
static const size_t Uns_Skip_Len = 192;
const char *Uns_Skip[Uns_Skip_Len] = {
// CAD geometry component
@@ -313,26 +316,26 @@ void X3DImporter::XML_CheckNode_SkipUnsupported(const std::string &pParentNodeNa
"VolumeData"
};
const std::string nn(mReader->getNodeName());
const std::string nn = node.name();
bool found = false;
bool close_found = false;
for (size_t i = 0; i < Uns_Skip_Len; i++) {
if (nn == Uns_Skip[i]) {
found = true;
if (mReader->isEmptyElement()) {
if (node.empty()) {
close_found = true;
goto casu_cres;
}
while (mReader->read()) {
/*while (mReader->read()) {
if ((mReader->getNodeType() == irr::io::EXN_ELEMENT_END) && (nn == mReader->getNodeName())) {
close_found = true;
goto casu_cres;
}
}
}*/
}
}
@@ -346,12 +349,13 @@ casu_cres:
Throw_CloseNotFound(nn);
}
bool X3DImporter::XML_SearchNode(const std::string &pNodeName) {
while (mReader->read()) {
bool X3DImporter::XML_SearchNode(XmlNode &node, const std::string &pNodeName) {
return XmlParser::hasNode(node, pNodeName.c_str());
/*while (mReader->read()) {
if ((mReader->getNodeType() == irr::io::EXN_ELEMENT) && XML_CheckNode_NameEqual(pNodeName)) return true;
}
return false;
return false;*/
}
bool X3DImporter::XML_ReadNode_GetAttrVal_AsBool(const int pAttrIdx) {

View File

@@ -374,7 +374,7 @@ private:
/***********************************************/
/// Check if current node is empty: <node />. If not then exception will throwed.
void XML_CheckNode_MustBeEmpty();
void XML_CheckNode_MustBeEmpty(XmlNode &node);
/// Check if current node name is equal to pNodeName.
/// \param [in] pNodeName - name for checking.
@@ -383,12 +383,12 @@ private:
/// Skip unsupported node and report about that. Depend on node name can be skipped begin tag of node all whole node.
/// \param [in] pParentNodeName - parent node name. Used for reporting.
void XML_CheckNode_SkipUnsupported(const std::string& pParentNodeName);
void XML_CheckNode_SkipUnsupported(XmlNode &node, const std::string &pParentNodeName);
/// Search for specified node in file. XML file read pointer(mReader) will point to found node or file end after search is end.
/// \param [in] pNodeName - requested node name.
/// return true - if node is found, else - false.
bool XML_SearchNode(const std::string& pNodeName);
bool XML_SearchNode(XmlNode &node, const std::string &pNodeName);
/// Read attribute value.
/// \param [in] pAttrIdx - attribute index (\ref mReader->getAttribute* set).

View File

@@ -48,7 +48,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/BaseImporter.h>
#include <assimp/XmlParser.h>
#include <assimp/LogAux.h>
#include <assimp/irrXMLWrapper.h>
#include <assimp/light.h>
#include <assimp/material.h>
#include <assimp/mesh.h>