Documentation
¶
Index ¶
- Constants
- func CppImp(pkg string) string
- func CppPkg(cf *CodeFile, pkg string)
- func GoImp(pkg string) string
- func GoPkg(cf *CodeFile, pkg string)
- func JavaImp(pkg string) string
- func LocalImportable(goPath string) map[string]string
- func LocalImptTarget(goPath string, targetPaths ...string) map[string]string
- type BlockContainer
- type CFBImpFunc
- type CFBPkgFunc
- type CodeBlock
- func (cb *CodeBlock) AddBlock(format string, a ...interface{}) *CodeBlock
- func (cb *CodeBlock) Imports(imports ...string)
- func (cb *CodeBlock) IndentationAdd(n int)
- func (cb *CodeBlock) Output(oup io.Writer) (int, error)
- func (cb *CodeBlock) Write(format string, a ...interface{})
- func (cb *CodeBlock) WriteLine(format string, a ...interface{})
- func (cb *CodeBlock) WriteToNewLine(format string, a ...interface{})
- type CodeFile
- func (cf *CodeFile) AddBlock(format string, a ...interface{}) *CodeBlock
- func (cf *CodeFile) AddImports(imp map[string]string)
- func (cf *CodeFile) Import(str string) bool
- func (cf *CodeFile) Imports(imps ...string)
- func (cf *CodeFile) Output() (int, error)
- func (cf *CodeFile) Write(str string)
- func (cf *CodeFile) WriteLine(str string)
Constants ¶
View Source
const (
//ErrRepeatParse TODO maybe no use.
ErrRepeatParse = "ErrRepeatParse"
)
Variables ¶
This section is empty.
Functions ¶
func LocalImportable ¶
Types ¶
type BlockContainer ¶
BlockContainer who can create/add block.
type CFBImpFunc ¶
CFBImpFunc write import. pkg is package name. for C/C++ is include file name. result is all include(import) line e.g. In C++: pkg = "cstdio" , out is "#include<cstdio>"
type CFBPkgFunc ¶
CFBPkgFunc about pkg's declear, for cpp is namespace.
type CodeBlock ¶
type CodeBlock struct { smn_muti_write_cache.FileMutiWriteCacheItf BlockStart string // start of Block such as for cpp/go/java code is "{" BlockEnd string //end of block, for cpp class is "};" BlockDef string // block def such as in "for(){}" "for()"is def // contains filtered or unexported fields }
CodeBlock {}.
func (*CodeBlock) IndentationAdd ¶
IndentationAdd for code format.
func (*CodeBlock) WriteToNewLine ¶
WriteToNewLine .
type CodeFile ¶
type CodeFile struct { smn_muti_write_cache.FileMutiWriteCacheItf // contains filtered or unexported fields }
CodeFile create a lang's code file.
func NewCodeFile ¶
func NewCodeFile(pkg string, w io.Writer, impFunc CFBImpFunc, pkgFunc CFBPkgFunc, comments ...string) *CodeFile
NewCodeFile create a new CodeFile.
func (*CodeFile) AddImports ¶
AddImports sometimes maybe can't give package's full-path.
Click to show internal directories.
Click to hide internal directories.