Assimp  v3.1.1 (June 2014)
AMFImporter_Macro.hpp File Reference

Useful macrodefines. More...

Macros

#define AMFIMPORTER_MACRO_HPP_INCLUDED
 
#define MACRO_ATTRREAD_CHECK_REF(pAttrName, pVarName, pFunction)
 Check curent attribute name and if it equal to requested then read value. More...
 
#define MACRO_ATTRREAD_CHECK_RET(pAttrName, pVarName, pFunction)
 Check curent attribute name and if it equal to requested then read value. More...
 
#define MACRO_ATTRREAD_LOOPBEG
 Begin of loop that read attributes values. More...
 
#define MACRO_ATTRREAD_LOOPEND
 End of loop that read attributes values. More...
 
#define MACRO_ATTRREAD_LOOPEND_WSKIP
 End of loop that read attributes values. More...
 
#define MACRO_NODECHECK_LOOPBEGIN(pNodeName)
 Begin of loop of parsing child nodes. More...
 
#define MACRO_NODECHECK_LOOPEND(pNodeName)
 End of loop of parsing child nodes. More...
 
#define MACRO_NODECHECK_READCOMP_F(pNodeName, pReadFlag, pVarName)
 Check curent node name and if it equal to requested then read value. More...
 
#define MACRO_NODECHECK_READCOMP_U32(pNodeName, pReadFlag, pVarName)
 Check curent node name and if it equal to requested then read value. More...
 

Detailed Description

Useful macrodefines.

Date
2016
Author
smal..nosp@m.root.nosp@m.@gmai.nosp@m.l.co.nosp@m.m

Macro Definition Documentation

◆ AMFIMPORTER_MACRO_HPP_INCLUDED

#define AMFIMPORTER_MACRO_HPP_INCLUDED

◆ MACRO_ATTRREAD_CHECK_REF

#define MACRO_ATTRREAD_CHECK_REF (   pAttrName,
  pVarName,
  pFunction 
)
Value:
if(an == pAttrName) \
{ \
pFunction(idx, pVarName); \
continue; \
}

Check curent attribute name and if it equal to requested then read value.

Result write to output variable by reference. If result was read then "continue" will called.

Parameters
[in]pAttrName- attribute name.
[out]pVarName- output variable name.
[in]pFunction- function which read attribute value and write it to pVarName.

◆ MACRO_ATTRREAD_CHECK_RET

#define MACRO_ATTRREAD_CHECK_RET (   pAttrName,
  pVarName,
  pFunction 
)
Value:
if(an == pAttrName) \
{ \
pVarName = pFunction(idx); \
continue; \
}

Check curent attribute name and if it equal to requested then read value.

Result write to output variable using return value of pFunction. If result was read then "continue" will called.

Parameters
[in]pAttrName- attribute name.
[out]pVarName- output variable name.
[in]pFunction- function which read attribute value and write it to pVarName.

◆ MACRO_ATTRREAD_LOOPBEG

#define MACRO_ATTRREAD_LOOPBEG
Value:
for(int idx = 0, idx_end = mReader->getAttributeCount(); idx < idx_end; idx++) \
{ \
std::string an(mReader->getAttributeName(idx));
::std::string string
Definition: gtest-port.h:1097

Begin of loop that read attributes values.

◆ MACRO_ATTRREAD_LOOPEND

#define MACRO_ATTRREAD_LOOPEND
Value:
Throw_IncorrectAttr(an); \
}

End of loop that read attributes values.

◆ MACRO_ATTRREAD_LOOPEND_WSKIP

#define MACRO_ATTRREAD_LOOPEND_WSKIP
Value:
continue; \
}

End of loop that read attributes values.

Difference from MACRO_ATTRREAD_LOOPEND in that: current macro skip unknown attributes, but MACRO_ATTRREAD_LOOPEND throw an exception.

◆ MACRO_NODECHECK_LOOPBEGIN

#define MACRO_NODECHECK_LOOPBEGIN (   pNodeName)
Value:
do { \
bool close_found = false; \
\
while(mReader->read()) \
{ \
if(mReader->getNodeType() == irr::io::EXN_ELEMENT) \
{
A xml element, like <foo>
Definition: irrXML.h:186

Begin of loop of parsing child nodes.

Do not add ';' at end.

Parameters
[in]pNodeName- current node name.

◆ MACRO_NODECHECK_LOOPEND

#define MACRO_NODECHECK_LOOPEND (   pNodeName)
Value:
XML_CheckNode_SkipUnsupported(pNodeName); \
}/* if(mReader->getNodeType() == irr::io::EXN_ELEMENT) */ \
else if(mReader->getNodeType() == irr::io::EXN_ELEMENT_END) \
{ \
if(XML_CheckNode_NameEqual(pNodeName)) \
{ \
close_found = true; \
\
break; \
} \
}/* else if(mReader->getNodeType() == irr::io::EXN_ELEMENT_END) */ \
}/* while(mReader->read()) */ \
\
if(!close_found) Throw_CloseNotFound(pNodeName); \
\
} while(false)
End of an xml element, like </foo>
Definition: irrXML.h:189

End of loop of parsing child nodes.

Parameters
[in]pNodeName- current node name.

◆ MACRO_NODECHECK_READCOMP_F

#define MACRO_NODECHECK_READCOMP_F (   pNodeName,
  pReadFlag,
  pVarName 
)
Value:
if(XML_CheckNode_NameEqual(pNodeName)) \
{ \
/* Check if field already read before. */ \
if(pReadFlag) Throw_MoreThanOnceDefined(pNodeName, "Only one component can be defined."); \
/* Read color component and assign it to object. */ \
pVarName = XML_ReadNode_GetVal_AsFloat(); \
pReadFlag = true; \
continue; \
}

Check curent node name and if it equal to requested then read value.

Result write to output variable of type "float". If result was read then "continue" will called. Also check if node data already read then raise exception.

Parameters
[in]pNodeName- node name.
[in,out]pReadFlag- read flag.
[out]pVarName- output variable name.

◆ MACRO_NODECHECK_READCOMP_U32

#define MACRO_NODECHECK_READCOMP_U32 (   pNodeName,
  pReadFlag,
  pVarName 
)
Value:
if(XML_CheckNode_NameEqual(pNodeName)) \
{ \
/* Check if field already read before. */ \
if(pReadFlag) Throw_MoreThanOnceDefined(pNodeName, "Only one component can be defined."); \
/* Read color component and assign it to object. */ \
pVarName = XML_ReadNode_GetVal_AsU32(); \
pReadFlag = true; \
continue; \
}

Check curent node name and if it equal to requested then read value.

Result write to output variable of type "uint32_t". If result was read then "continue" will called. Also check if node data already read then raise exception.

Parameters
[in]pNodeName- node name.
[in,out]pReadFlag- read flag.
[out]pVarName- output variable name.