//-------------------------------------------------------------------- bool RawUnknownElementHandler::elementBegin( const ParserChar* elementName, const xmlChar** attributes ) { prepareToAddContents(); mRawData.append( "<" ); mRawData.append( elementName ); mOpenTags.push( OpenTag() ); /* OpenTag& currentOpenTag = mOpenTags.top(); */ /* UNUSED */ if ( attributes ) { const xmlChar** currentAttribute = attributes; while ( *currentAttribute ) { const xmlChar* attributeName = *currentAttribute; currentAttribute++; if ( !currentAttribute ) { // should never occur, but we want to make sure break; } const xmlChar* attributeValue = *currentAttribute; mRawData.append( " " ); mRawData.append( attributeName ); mRawData.append( "=\"" ); mRawData.append( attributeValue ); mRawData.append( "\"" ); currentAttribute++; } } return true; }
//--------------------------------------------------------------- void StreamWriter::appendValues ( unsigned long long number ) { prepareToAddContents(); if ( mOpenTags.back().mHasText ) appendChar ( ' ' ); appendNumber ( number ); mOpenTags.back().mHasText = true; }
//--------------------------------------------------------------- void StreamWriter::appendValues ( int number, int number2 ) { prepareToAddContents(); if ( mOpenTags.back().mHasText ) appendChar ( ' ' ); appendNumber ( number ); appendChar ( ' ' ); appendNumber ( number2 ); mOpenTags.back().mHasText = true; }
//--------------------------------------------------------------- void StreamWriter::appendTextBlock ( const String &text ) { if ( text.empty () ) return; prepareToAddContents(); appendNewLine(); addWhiteSpace ( mLevel * mIndent ); appendString ( text ); }
//-------------------------------------------------------------------- bool RawUnknownElementHandler::textData( const ParserChar* text, size_t textLength ) { prepareToAddContents(); mRawData.append( text, textLength ); mOpenTags.top().mHasText = true; return true; }
//--------------------------------------------------------------- void StreamWriter::appendValues ( const char* text, size_t length ) { prepareToAddContents(); if ( mOpenTags.back().mHasText ) appendChar ( ' ' ); appendString ( text, length ); mOpenTags.back().mHasText = true; }
//--------------------------------------------------------------- void StreamWriter::appendValues ( const String& text ) { prepareToAddContents(); if ( mOpenTags.back().mHasText ) appendChar ( ' ' ); appendString ( text ); mOpenTags.back().mHasText = true; }
//--------------------------------------------------------------- void StreamWriter::appendValues ( bool value ) { prepareToAddContents(); if ( mOpenTags.back().mHasText ) appendChar ( ' ' ); appendBoolean ( value ); mOpenTags.back().mHasText = true; }
//--------------------------------------------------------------- TagCloser StreamWriter::openElement ( const String & name ) { prepareToAddContents(); appendNewLine(); addWhiteSpace ( mLevel * mIndent ); mLevel++; appendChar ( '<' ); appendNCNameString ( name ); ElementIndexType nextElementIndex = mNextElementIndex++; mOpenTags.push_back( OpenTag ( &name, nextElementIndex ) ); return TagCloser ( this, nextElementIndex ); }
//--------------------------------------------------------------- void StreamWriter::appendValues ( const double values[], const size_t length ) { prepareToAddContents(); if ( mOpenTags.back().mHasText ) appendChar ( ' ' ); for ( size_t i=0; i<length; ++i ) { appendNumber ( values[i] ); appendChar ( ' ' ); } mOpenTags.back().mHasText = true; }
//--------------------------------------------------------------- void StreamWriter::appendValues ( long long number1, long long number2, long long number3 ) { prepareToAddContents(); if ( mOpenTags.back().mHasText ) appendChar ( ' ' ); appendNumber ( number1 ); appendChar ( ' ' ); appendNumber ( number2 ); appendChar ( ' ' ); appendNumber ( number3 ); mOpenTags.back().mHasText = true; }
//--------------------------------------------------------------- void StreamWriter::appendValues ( const std::vector<unsigned long> &values ) { prepareToAddContents(); if ( mOpenTags.back().mHasText ) appendChar ( ' ' ); std::vector<unsigned long>::const_iterator it = values.begin(); for ( ; it!=values.end(); ++it ) { appendNumber ( *it ); appendChar ( ' ' ); } mOpenTags.back().mHasText = true; }
//--------------------------------------------------------------- void StreamWriter::appendValues( const Color& val ) { prepareToAddContents(); if ( mOpenTags.back().mHasText ) appendChar ( ' ' ); appendNumber ( val.getRed() ); appendChar ( ' ' ); appendNumber ( val.getGreen() ); appendChar ( ' ' ); appendNumber ( val.getBlue() ); appendChar ( ' ' ); appendNumber ( val.getAlpha() ); mOpenTags.back().mHasText = true; }
//--------------------------------------------------------------- void StreamWriter::appendValues ( const double number1, const double number2, const double number3, const double number4 ) { prepareToAddContents(); if ( mOpenTags.back().mHasText ) appendChar ( ' ' ); appendNumber ( number1 ); appendChar ( ' ' ); appendNumber ( number2 ); appendChar ( ' ' ); appendNumber ( number3 ); appendChar ( ' ' ); appendNumber ( number4 ); mOpenTags.back().mHasText = true; }
//--------------------------------------------------------------- void StreamWriter::appendValues ( const double matrix[4][4] ) { prepareToAddContents(); if ( mOpenTags.back().mHasText ) appendChar ( ' ' ); appendNumber ( matrix[0][0] ); appendChar ( ' ' ); appendNumber ( matrix[0][1] ); appendChar ( ' ' ); appendNumber ( matrix[0][2] ); appendChar ( ' ' ); appendNumber ( matrix[0][3] ); appendChar ( ' ' ); appendNumber ( matrix[1][0] ); appendChar ( ' ' ); appendNumber ( matrix[1][1] ); appendChar ( ' ' ); appendNumber ( matrix[1][2] ); appendChar ( ' ' ); appendNumber ( matrix[1][3] ); appendChar ( ' ' ); appendNumber ( matrix[2][0] ); appendChar ( ' ' ); appendNumber ( matrix[2][1] ); appendChar ( ' ' ); appendNumber ( matrix[2][2] ); appendChar ( ' ' ); appendNumber ( matrix[2][3] ); appendChar ( ' ' ); appendNumber ( matrix[3][0] ); appendChar ( ' ' ); appendNumber ( matrix[3][1] ); appendChar ( ' ' ); appendNumber ( matrix[3][2] ); appendChar ( ' ' ); appendNumber ( matrix[3][3] ); mOpenTags.back().mHasText = true; }
//--------------------------------------------------------------- void StreamWriter::appendText ( const String &text ) { prepareToAddContents(); appendString ( text ); mOpenTags.back().mHasText = true; }