inline void Type_::Decode(TheConsumer & theConsumer) const { Om::Source::CodePointSource<std::string::const_iterator> theCodePointSource( this->thisString.begin(), this->thisString.end() ); Reader theReader(theCodePointSource); theConsumer.ParseElements(theReader); }
void setMissingPropertiesToDefault( RepXNode* topNode, RepXReaderWriter& editor, const RepXDefaultEntry* defaults, PxU32 numDefaults, TNameOffsetMap& map ) { for ( RepXNode* child = topNode->mFirstChild; child != NULL; child = child->mNextSibling ) setMissingPropertiesToDefault( child, editor, defaults, numDefaults, map ); const TNameOffsetMap::Entry* entry( map.find( topNode->mName ) ); if ( entry ) { RepXReaderWriter& theReader( editor ); theReader.setNode( *topNode ); char nameBuffer[512] = {0}; size_t nameLen = strlen( topNode->mName ); //For each default property entry for this node type. for ( const RepXDefaultEntry* item = defaults + entry->second; strncmp( item->name, topNode->mName, nameLen ) == 0; ++item ) { bool childAdded = false; const char* nameStart = item->name + nameLen; ++nameStart; theReader.pushCurrentContext(); const char* str = nameStart; while( *str ) { const char *period = nextPeriod( str ); size_t len = PxMin( period - str, ptrdiff_t(1023) ); //can't be too careful these days. memcpy( nameBuffer, str, len ); nameBuffer[len] = 0; if ( theReader.gotoChild( nameBuffer ) == false ) { childAdded = true; theReader.addOrGotoChild( nameBuffer ); } if (*period ) str = period + 1; else str = period; } if ( childAdded ) theReader.setCurrentItemValue( item->value ); theReader.popCurrentContext(); } } }