Logo Search packages:      
Sourcecode: highlight version File versions  Download package

void highlight::CodeGenerator::insertLineNumber ( bool  insertNewLine = true  )  [private, virtual]

Insert line number at the beginning of current output line

Reimplemented in highlight::HtmlGenerator.

Definition at line 1447 of file codegenerator.cpp.

References getLineNumberWidth(), getNewLine(), lineNumber, lineNumberFillZeroes, lineNumberOffset, maskString(), showLineNumbers, spacer, styleTagClose, styleTagOpen, and wsBuffer.

Referenced by processDirectiveState(), processEscapeCharState(), processKeywordState(), processMultiLineCommentState(), processNumberState(), processRootState(), processSingleLineCommentState(), processStringState(), and processSymbolState().

      {

            if ( insertNewLine )
            {
                  wsBuffer += getNewLine();
            }

            if ( showLineNumbers )
            {
                  ostringstream os;
                  ostringstream numberPrefix;
                  if ( lineNumberFillZeroes )
                  {
                        os.fill ( '0' );
                  }
                  os <<setw ( getLineNumberWidth() ) << right << lineNumber+lineNumberOffset;

                  numberPrefix << styleTagOpen[LINENUMBER];
                  maskString ( numberPrefix, os.str() );
                  numberPrefix << spacer
                  << styleTagClose[LINENUMBER];

                  wsBuffer += numberPrefix.str();
            }
      }


Generated by  Doxygen 1.6.0   Back to index