github.com/turingchain2020/turingchain@v1.1.21/cmd/tools/gencode/base/base.go (about)

     1  // Copyright Turing Corp. 2018 All Rights Reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package base
     6  
     7  var (
     8  	//CodeFileManager 类型文件
     9  	CodeFileManager = map[string][]ICodeFile{}
    10  )
    11  
    12  // ICodeFile code file interface
    13  type ICodeFile interface {
    14  	GetCodeType() string
    15  	GetDirName() string
    16  	GetFiles() map[string]string //key:filename, val:file content
    17  	GetDirReplaceTags() []string
    18  	GetFileReplaceTags() []string
    19  }
    20  
    21  //RegisterCodeFile regeister code file
    22  func RegisterCodeFile(filer ICodeFile) {
    23  
    24  	codeType := filer.GetCodeType()
    25  	fileArr := CodeFileManager[codeType]
    26  	fileArr = append(fileArr, filer)
    27  	CodeFileManager[codeType] = fileArr
    28  }
    29  
    30  // CodeFile 基础类
    31  type CodeFile struct {
    32  }
    33  
    34  //GetCodeType get cody type
    35  func (CodeFile) GetCodeType() string {
    36  	return ""
    37  }
    38  
    39  //GetDirName get directory name
    40  func (CodeFile) GetDirName() string {
    41  
    42  	return ""
    43  }
    44  
    45  //GetFiles get files
    46  func (CodeFile) GetFiles() map[string]string {
    47  
    48  	return nil
    49  }
    50  
    51  //GetDirReplaceTags get directory replace tags
    52  func (CodeFile) GetDirReplaceTags() []string {
    53  
    54  	return nil
    55  }
    56  
    57  //GetFileReplaceTags get file replace tags
    58  func (CodeFile) GetFileReplaceTags() []string {
    59  
    60  	return nil
    61  }