本文整理汇总了C++中processNode函数的典型用法代码示例。如果您正苦于以下问题:C++ processNode函数的具体用法?C++ processNode怎么用?C++ processNode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了processNode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QString
void IDefReader::processScriptItemNode( P_ITEM madeItem, QDomElement &Node )
{
for( UI16 k = 0; k < Node.childNodes().count(); k++ )
{
QDomElement currChild = Node.childNodes().item( k ).toElement();
if( currChild.nodeName() == "amount" )
{
QString Value = QString();
UI16 i = 0;
if( currChild.hasChildNodes() ) // <random> i.e.
for( i = 0; i < currChild.childNodes().count(); i++ )
{
if( currChild.childNodes().item( i ).isText() )
Value += currChild.childNodes().item( i ).toText().data();
else if( currChild.childNodes().item( i ).isElement() )
Value += processNode( currChild.childNodes().item( i ).toElement() );
}
else
Value = currChild.nodeValue();
if( Value.toInt() < 1 )
Value = QString("1");
if( madeItem->isPileable() )
madeItem->setAmount( Value.toInt() );
else
for( i = 1; i < Value.toInt(); i++ ) //dupe it n-1 times
Commands->DupeItem(-1, madeItem, 1);
}
else if( currChild.nodeName() == "color" ) //process <color> tags
{
QString Value = QString();
if( currChild.hasChildNodes() ) // colorlist or random i.e.
for( UI16 i = 0; i < currChild.childNodes().count(); i++ )
{
if( currChild.childNodes().item( i ).isText() )
Value += currChild.childNodes().item( i ).toText().data();
else if( currChild.childNodes().item( i ).isElement() )
Value += processNode( currChild.childNodes().item( i ).toElement() );
}
else
Value = currChild.nodeValue();
if( Value.toInt() < 0 )
Value = QString("0");
madeItem->setColor( Value.toInt() );
}
else if( currChild.nodeName() == "inherit" && currChild.attributes().contains("id") )
{
QDomElement* derivalSection = DefManager->getSection( WPDT_ITEM, currChild.attribute("id") );
if( !derivalSection->isNull() )
this->applyNodes( madeItem, derivalSection );
}
}
}
示例2: processNode
Path PathCreator::calculatePath(DebugNode* start, DebugNode* end)
{
startNode = start;
endNode = end;
PathingNode* currentParentNode;
for(processNode(start, 0, NULL), currentParentNode=processedNodes[0]; !endNodeHasLowestTEC() && openNodesRemaining(); currentParentNode = getOpenNodeWithLowestTEC())
{
currentParentNode->open=false;
for(int i = 0; i<currentParentNode->node->numConnections; i++)
{
float connectionCostSquared = glm::pow(currentParentNode->node->connections[i]->cost, 2.0f);
float costSoFar = connectionCostSquared + currentParentNode->costSoFar;
processNode(currentParentNode->node->connections[i]->node, costSoFar, currentParentNode);
}
}
Path p = Path(nullptr, 0);
if(openNodesRemaining())//If the end node could actually be reached
{
QList <DebugNode*> reversePath;
bool reachedStartNode = false;
uint numNodesInPath = 0;
PathingNode* currentNode = currentParentNode;//current parent node will be end node
while(!reachedStartNode)
{
reversePath.prepend(currentNode->node);
numNodesInPath++;
if(currentNode->node == startNode)
{
reachedStartNode = true;
}
else
{
currentNode = currentNode->parentNode;
}
}
DebugNode** path = new DebugNode*[numNodesInPath];
for(uint i = 0; i<numNodesInPath; i++)
{
path[i] = reversePath[i];
}
reversePath.clear();
p = Path(path, numNodesInPath);
}
else
{
cout << "IMPOSSIBLE PATH" << endl;
}
processedNodes.clear();
return p;
}
示例3: processLeaf
//-----------------------------------------------------------------------
bool BspRaySceneQuery::processNode(const BspNode* node, const Ray& tracingRay,
RaySceneQueryListener* listener, Real maxDistance, Real traceDistance)
{
if (node->isLeaf())
{
return processLeaf(node, tracingRay, listener, maxDistance, traceDistance);
}
bool res = true;
std::pair<bool, Real> result = tracingRay.intersects(node->getSplitPlane());
if (result.first && result.second < maxDistance)
{
// Crosses the split plane, need to perform 2 queries
// Calculate split point ray
Vector3 splitPoint = tracingRay.getOrigin()
+ tracingRay.getDirection() * result.second;
Ray splitRay(splitPoint, tracingRay.getDirection());
if (node->getSide(tracingRay.getOrigin()) == Plane::NEGATIVE_SIDE)
{
// Intersects from -ve side, so do back then front
res = processNode(
node->getBack(), tracingRay, listener, result.second, traceDistance);
if (!res) return res;
res = processNode(
node->getFront(), splitRay, listener,
maxDistance - result.second,
traceDistance + result.second);
}
else
{
// Intersects from +ve side, so do front then back
res = processNode(node->getFront(), tracingRay, listener,
result.second, traceDistance);
if (!res) return res;
res = processNode(node->getBack(), splitRay, listener,
maxDistance - result.second,
traceDistance + result.second);
}
}
else
{
// Does not cross the splitting plane, just cascade down one side
res = processNode(node->getNextNode(tracingRay.getOrigin()),
tracingRay, listener, maxDistance, traceDistance);
}
return res;
}
示例4: streamFile
/**
* streamFile:
* @filename: the file name to parse
*
* Parse and print information about an XML file.
*/
static void
streamFile(const char *filename) {
xmlTextReaderPtr reader;
int ret;
#define VALIDATEDTD
#ifdef VALIDATEDTD
/*
* Pass some special parsing options to activate DTD attribute defaulting,
* entities substitution and DTD validation
*/
reader = xmlReaderForFile(filename, NULL,
XML_PARSE_DTDATTR | /* default DTD attributes */
XML_PARSE_NOENT | /* substitute entities */
XML_PARSE_DTDVALID); /* validate with the DTD */
#else
reader = xmlReaderForFile(filename, NULL, 0);
#endif
if (reader != NULL) {
ret = xmlTextReaderRead(reader);
while (ret == 1) {
processNode(reader);
ret = xmlTextReaderRead(reader);
}
xmlFreeTextReader(reader);
if (ret != 0) {
fprintf(stderr, "%s : failed to parse\n", filename);
}
} else {
fprintf(stderr, "Unable to open %s\n", filename);
}
}
示例5: main
int main(int argc, char *argv[])
{
xmlTextReaderPtr reader;
int ret;
// Readerの作成
reader = xmlNewTextReaderFilename("./sample.xml");
if ( !reader ) {
printf("Failed to open XML file.\n");
return 1;
}
printf("-----------------------\n");
// 次のノードに移動
ret = xmlTextReaderRead(reader);
while (ret == 1) {
// 現在のノードを処理
processNode(reader);
// 次のノードに移動
ret = xmlTextReaderRead(reader);
}
// Reader のすべてのリソースを開放
xmlFreeTextReader(reader);
// xmlTextReaderRead の戻り値が -1 だった場合はパースエラー
if (ret == -1) {
printf("Parse error.\n");
return 1;
}
return 0;
}
示例6: switch
void Editor_Html2Usfm::processNode (xml_node node)
{
switch (node.type ()) {
case node_element:
{
openElementNode (node);
for (xml_node child : node.children()) {
processNode (child);
}
closeElementNode (node);
break;
}
case node_pcdata:
{
// Add the text to the current USFM line.
string text = node.text ().get ();
currentLine += text;
break;
}
default:
{
string nodename = node.name ();
Database_Logs::log ("Unknown XML node " + nodename + " while saving editor text");
break;
}
}
}
示例7: streamFileXML2
int streamFileXML2(char *filename, int sanitize, struct osmdata_t *osmdata) {
xmlTextReaderPtr reader;
int ret = 0;
if (sanitize)
reader = sanitizerOpen(filename);
else
reader = inputUTF8(filename);
if (reader != NULL) {
ret = xmlTextReaderRead(reader);
while (ret == 1) {
processNode(reader, osmdata);
ret = xmlTextReaderRead(reader);
}
if (ret != 0) {
fprintf(stderr, "%s : failed to parse\n", filename);
return ret;
}
xmlFreeTextReader(reader);
} else {
fprintf(stderr, "Unable to open %s\n", filename);
return 1;
}
return 0;
}
示例8: while
void DotSceneLoader::processNodes(rapidxml::xml_node<>* XMLNode) {
rapidxml::xml_node<>* pElement;
// Process node (*)
pElement = XMLNode->first_node("node");
while (pElement) {
processNode(pElement);
pElement = pElement->next_sibling("node");
}
// Process position (?)
pElement = XMLNode->first_node("position");
if (pElement) {
mAttachNode->setPosition(parseVector3(pElement));
mAttachNode->setInitialState();
}
// Process rotation (?)
pElement = XMLNode->first_node("rotation");
if (pElement) {
mAttachNode->setOrientation(parseQuaternion(pElement));
mAttachNode->setInitialState();
}
// Process scale (?)
pElement = XMLNode->first_node("scale");
if (pElement) {
mAttachNode->setScale(parseVector3(pElement));
mAttachNode->setInitialState();
}
}
示例9: main
int main(int argc, char *argv[]) {
LIBXML_TEST_VERSION
// xmlTextReaderPtr reader = xmlReaderForFile("/run/media/svartalf/storage/wikipedia/ruwiki-20140706-pages-meta-history1.xml", NULL, 0);
xmlTextReaderPtr reader = xmlReaderForFile("/tmp/test.xml", NULL, 0);
FILE *output = fopen("/tmp/output.bin", "w");
output_write_header(output);
Revision *rev = revision_create();
int result = xmlTextReaderRead(reader);
while (result == 1) {
processNode(reader, rev);
result = xmlTextReaderRead(reader);
if (revision_filled(rev)) {
output_write_row(output, rev);
revision_clear(rev);
}
}
output_close(output);
xmlFreeTextReader(reader);
if (result != 0) {
fprintf(stderr, "failed to parse: %d\n", result);
}
xmlCleanupParser();
return 0;
}
示例10: processNode
void processNode(FbxNode *node,GameObject *rootGo)
{
PrintTabs();
const char* nodeName = node->GetName();
FbxDouble3 translation = node->LclTranslation.Get();
FbxDouble3 rotation = node->LclRotation.Get();
FbxDouble3 scaling = node->LclScaling.Get();
std::cout << "Node " << nodeName << " Postion " << translation[0] << " " << translation[1] << " " << translation[2] << " "
<< " Rotation " << rotation[0] << " " << rotation[1] << " " << rotation[2] << " "
<< " Scale " << scaling[0] << " " << scaling[1] << " " << scaling[2] << std::endl;
level++;
GameObject * go = new GameObject();
go->setTransform(new Transform());
rootGo->addChild(go);
// Print the node's attributes.
for (int i = 0; i < node->GetNodeAttributeCount(); i++){
processAttribute(node->GetNodeAttributeByIndex(i), go);
}
// Recursively print the children.
for (int j = 0; j < node->GetChildCount(); j++)
processNode(node->GetChild(j), rootGo);
level--;
PrintTabs();
}
示例11: switch
void fbxLoader2::processNode(FbxNode* node)
{
//FbxNodeAttribute::EType attributeType;
if(node->GetNodeAttribute())
{
switch(node->GetNodeAttribute()->GetAttributeType())
{
case FbxNodeAttribute::eMesh:
processMesh(node);
break;
case FbxNodeAttribute::eSkeleton:
break;
case FbxNodeAttribute::eLight:
break;
case FbxNodeAttribute::eCamera:
break;
}
}
for(int i = 0; i<node->GetChildCount(); i++)
{
processNode(node->GetChild(i));
}
}
示例12: while
void DotSceneLoader::processNodes(TiXmlElement* xmlNode) {
TiXmlElement *element;
// Process node (*)
element = xmlNode->FirstChildElement("node");
while(element) {
processNode(element);
element = element->NextSiblingElement("node");
}
// Process position (?)
element = xmlNode->FirstChildElement("position");
if(element) {
rootNode->setPosition(parseVector3(element));
}
// Process rotation (?)
element = xmlNode->FirstChildElement("rotation");
if(element) {
rootNode->setOrientation(parseQuaternion(element));
}
// Process scale (?)
element = xmlNode->FirstChildElement("scale");
if(element) {
rootNode->setScale(parseVector3(element));
}
}
示例13: addError
void ParticleScriptCompiler::compileAffector(const ScriptNodePtr &node)
{
if(node->children.empty() || node->children.front()->type != SNT_WORD)
return;
// Create the emitter based on the first child
ParticleAffector *affector = 0;
String type = node->children.front()->token;
try{
affector = mSystem->addAffector(type);
}catch(...){
addError(CE_OBJECTALLOCATIONERROR, node->children.front()->file,
node->children.front()->line, node->children.front()->column);
return;
}
// Jump ahead now to the '{' as the emitter does not support other parameters in the header
ScriptNodeList::iterator i = findNode(node->children.begin(), node->children.end(), SNT_LBRACE);
if(i == node->children.end())
return;
ScriptNodeList::iterator j = (*i)->children.begin();
while(j != (*i)->children.end())
{
if(!processNode(j, (*i)->children.end()))
{
String name = (*j)->token,
value = getParameterValue((*j)->children.begin(), (*j)->children.end());
if(!affector->setParameter(name, value))
addError(CE_INVALIDPROPERTY, (*j)->file, (*j)->line, (*j)->column);
++j;
}
}
}
示例14: processAnimations
bool core::ModelLoader::loadModel(const char *fp, Model *m){
Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(fp, aiProcess_Triangulate | aiProcess_OptimizeMeshes | aiProcess_JoinIdenticalVertices | aiProcess_FlipUVs);
if(!scene)
return false;
m->rootPath = (std::string)fp;
for(int x = m->rootPath.size() - 1; x >= 0; x--){
if(m->rootPath[x] == '/' || m->rootPath[x] == '\\'){
m->rootPath = m->rootPath.substr(0, x + 1);
x = -1;
}
}
processAnimations(scene, m);
processNode(scene, scene->mRootNode, m);
if(scene->HasAnimations())
m->animations[m->currentAnim].buildBoneTree(scene, scene->mRootNode, &m->animations[m->currentAnim].root, m);
m->modelTrans = glm::mat4(1.f);
m->modelLoaded = true;
return true;
};
示例15: tryProcessNode
// If it's a leaf, update the lower bound.
// Otherwise, process it.
void tryProcessNode(Knapsack* ks, Heap* h, Node* n) {
int i;
pthread_rwlock_rdlock(&ks->_lblock);
int lb = ks->_lowerBound;
pthread_rwlock_unlock(&ks->_lblock);
if (n->_depth >= (ks->_nbItems-1)) {
if (n->_value > (double)lb) {
pthread_rwlock_wrlock(&ks->_lblock);
// Double checking the value of lowerbound; there's an edge case where
// another thread could update it between these two locks
if (n->_value > ks->_lowerBound) {
printf("tighten LB to %d\n", n->_value);
ks->_lowerBound = n->_value;
pthread_rwlock_unlock(&ks->_lblock);
for (i=0; i<n->_depth+1; i++) {
ks->_bestX[i] = n->_x[i];
}
for (i=n->_depth+1; i<ks->_nbItems; i++) {
ks->_bestX[i] = 0;
}
} else {
pthread_rwlock_unlock(&ks->_lblock);
}
}
destroyNode(n);
pthread_mutex_lock(&ks->_counterMutex);
(ks->_nodesProcessed)++;
pthread_mutex_unlock(&ks->_counterMutex);
} else {
processNode(ks, h, n);
}
}