gov.llnl.babel.backend.writers

Class LanguageWriterForCxx

Implemented Interfaces:
CodeConstants, LineRedirector

public class LanguageWriterForCxx
extends LanguageWriterForC
implements CodeConstants

Class LanguageWriterForCxx extends the generic language writer to provide additional capabilities for writing C++ code. This class manages writing comment blocks as well as include files.

Field Summary

Fields inherited from class gov.llnl.babel.backend.writers.LanguageWriterForC

d_lcfw, d_skipIncludeGuard

Fields inherited from class gov.llnl.babel.backend.writers.LanguageWriter

d_context

Fields inherited from interface gov.llnl.babel.backend.CodeConstants

C_AUTO_GEN_SPLICER, C_AUTO_GEN_WARNING, C_BACKSLASH, C_BEGIN_UNREFERENCED_METHODS, C_COMMENT_CLOSE, C_COMMENT_DOC_OPEN, C_COMMENT_F77, C_COMMENT_F90, C_COMMENT_HASH, C_COMMENT_OPEN, C_COMMENT_SLASH, C_COMMENT_SUBSEQUENT, C_DEFINE, C_DESC_CJNI_PREFIX, C_DESC_HEADER_PREFIX, C_DESC_IMPL_PREFIX, C_DESC_IOR_PREFIX, C_DESC_SJNI_PREFIX, C_DESC_SKEL_PREFIX, C_DESC_STUB_PREFIX, C_END_UNREFERENCED_METHODS, C_F7731_IMPL_EXTENSION, C_F77_IMPL_EXTENSION, C_F77_IMPL_METHOD_SUFFIX, C_F77_METHOD_SUFFIX, C_F77_VERSION, C_F90_ALT_SUFFIX, C_F90_IMPL_EXTENSION, C_F90_IMPL_METHOD_SUFFIX, C_F90_METHOD_SUFFIX, C_F90_VERSION, C_FORTRAN_DESC_STUB_PREFIX, C_FORTRAN_IMPL_MODULE_PREFIX, C_FORTRAN_MODULE_PREFIX, C_FORTRAN_TYPE_MODULE_PREFIX, C_GUARD_CLOSE, C_GUARD_OPEN, C_HASH, C_IFDEFINE_CLOSE, C_IFDEFINE_CXX, C_IFDEFINE_OPEN, C_INCLUDE, C_INSERT_HERE, C_INT_BACKSLASH, C_IS_IMPL, C_IS_NOT_IMPL, C_SLASH, C_UNREFERENCED_COMMENT1, C_UNREFERENCED_COMMENT2, C_UNREFERENCED_COMMENT3, MATLAB_COMMENT_OPEN

Constructor Summary

LanguageWriterForCxx(PrintWriter writer, Context context)
Create a LanguageWriterForCxx instance that will send output to the specified print writer object.
LanguageWriterForCxx(PrintWriter writer, LineCountingFilterWriter lcfw, Context context)
Create a LanguageWriterForCxx instance that will send output to the specified print writer object.

Method Summary

void
beginBlockComment(boolean is_doc)
Begin a block comment.
void
beginBoldComment()
Start a comment that is made visually prominent
void
endBlockComment(boolean is_doc)
End a block comment.
void
endBoldComment()
String
getIncludeGuard(String file)
Generate the include guard from the specified file name.
void
writeCommentLine(String comment)
Output a single-line comment to the pretty writer stream.
void
writeSplicerTagLine(String tagLine)
Write the splicer tag as a language-specific comment.

Methods inherited from class gov.llnl.babel.backend.writers.LanguageWriterForC

beginBlockComment, closeCxxExtern, closeHeaderGuard, endBlockComment, generateInclude, generateSystemInclude, getIncludeGuard, getLineCount, openCxxExtern, openHeaderGuard, redirectBegin, redirectEnd, safeCommentString, skipIncludeGuard, toSafeComment, toSafeString, writeCommentLine, writeSplicerTagLine

Methods inherited from class gov.llnl.babel.backend.writers.LanguageWriter

beginBlockComment, endBlockComment, safeCommentString, writeBanner, writeComment, writeComment, writeComment, writeComment, writeComment, writeComment, writeComment, writeCommentLine, writeSplicerTagLine

Methods inherited from class gov.llnl.babel.backend.writers.PrettyWriter

backTab, changeTabLevel, close, defineBlockComment, disableBlockComment, disableLineBreak, enableBlockComment, enableLineBreak, enableLineBreak, flushPrintWriter, getPrintWriter, popLineBreak, print, printAligned, printSpaces, printUnformatted, println, println, printlnUnformatted, pushLineBreak, restoreFirstTabStop, setFirstTabStop, setLineBreakString, setStrictBreaking, setTabSpacing, setTemporaryFirstTabStop, tab

Constructor Details

LanguageWriterForCxx

public LanguageWriterForCxx(PrintWriter writer,
                            Context context)
Create a LanguageWriterForCxx instance that will send output to the specified print writer object. Set up the output properties of the language writer for C++, which sets the first tab stop at zero, a tab spacing of three, and line breaking at column eighty.

LanguageWriterForCxx

public LanguageWriterForCxx(PrintWriter writer,
                            LineCountingFilterWriter lcfw,
                            Context context)
Create a LanguageWriterForCxx instance that will send output to the specified print writer object. Set up the output properties of the language writer for C++, which sets the first tab stop at zero, a tab spacing of three, and line breaking at column eighty.

Method Details

beginBlockComment

public void beginBlockComment(boolean is_doc)
Begin a block comment. The beginning of comment string is output to the pretty writer stream and the block comment mode is enabled. The comment block is closed by calling the end comment block method. Documentation comments use traditional slash-asterisk-asterisk method, but regular comments use C++ slash-slash
Overrides:
beginBlockComment in interface LanguageWriterForC

beginBoldComment

public void beginBoldComment()
Start a comment that is made visually prominent

endBlockComment

public void endBlockComment(boolean is_doc)
End a block comment. This method disables comment block output and prints a blank comment string. The end of a cocumentation comment also signifies resetting to the tradtional slash-slash approach for C++
Overrides:
endBlockComment in interface LanguageWriterForC

endBoldComment

public void endBoldComment()

getIncludeGuard

public String getIncludeGuard(String file)
Generate the include guard from the specified file name. The guard is the file name (without extension, if it exists) with an "included_" prefix.
Overrides:
getIncludeGuard in interface LanguageWriterForC

writeCommentLine

public void writeCommentLine(String comment)
Output a single-line comment to the pretty writer stream. The comment should not contain any new line characters. If the comment is null, then nothing is output.
Overrides:
writeCommentLine in interface LanguageWriterForC

writeSplicerTagLine

public void writeSplicerTagLine(String tagLine)
Write the splicer tag as a language-specific comment.
Overrides:
writeSplicerTagLine in interface LanguageWriterForC