@ -11,6 +11,10 @@
# include "google/protobuf/compiler/java/doc_comment.h"
# include "google/protobuf/compiler/java/doc_comment.h"
# include <stddef.h>
# include <algorithm>
# include <cctype>
# include <string>
# include <string>
# include <vector>
# include <vector>
@ -142,14 +146,20 @@ static void WriteDocCommentBodyForLocation(io::Printer* printer,
printer - > Print ( " * <pre> \n " ) ;
printer - > Print ( " * <pre> \n " ) ;
}
}
for ( int i = 0 ; i < lines . size ( ) ; i + + ) {
for ( size_t i = 0 ; i < lines . size ( ) ; i + + ) {
// Most lines should start with a space. Watch out for lines that start
// Lines should start with a single space and any extraneous leading
// with a /, since putting that right after the leading asterisk will
// spaces should be stripped. For lines starting with a /, the leading
// close the comment.
// space will prevent putting it right after the leading asterick from
if ( ! lines [ i ] . empty ( ) & & lines [ i ] [ 0 ] = = ' / ' ) {
// closing the comment.
printer - > Print ( " * $line$ \n " , " line " , lines [ i ] ) ;
std : : string line = lines [ i ] ;
line . erase ( line . begin ( ) ,
std : : find_if ( line . begin ( ) , line . end ( ) , [ ] ( unsigned char ch ) {
return ! std : : isspace ( ch ) ;
} ) ) ;
if ( ! line . empty ( ) ) {
printer - > Print ( " * $line$ \n " , " line " , line ) ;
} else {
} else {
printer - > Print ( " *$line$ \n " , " line " , lines [ i ] ) ;
printer - > Print ( " * \n " ) ;
}
}
}
}