utils

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// RegDllName extracts DLL name from markdown spec.
	RegDllName = `req\.dll: (?P<DLL>[\w]+\.dll)`
)

Functions

func Exists

func Exists(name string) bool

Exists reports whether the named file or directory exists.

func FindClosingBracket

func FindClosingBracket(text []byte, openPos int) int

func FindClosingSemicolon

func FindClosingSemicolon(text []byte, pos int) int

func GetDLLName

func GetDLLName(file, apiname, sdkpath string) (string, error)

GetDLLName retrieves the DLL module name that matches an API name.

func ReadAll

func ReadAll(filePath string) ([]byte, error)

ReadAll reads the entire file into memory.

func ReadLines

func ReadLines(path string) (lines []string, err error)

Read a whole file into the memory and store it as array of lines

func RegSubMatchToMapString

func RegSubMatchToMapString(regEx, s string) (paramsMap map[string]string)

func RemoveAnnotations

func RemoveAnnotations(apiPrototype string) string

RemoveAnnotations should only remove function annotations and not function arguments annotations.

func SpaceFieldsJoin

func SpaceFieldsJoin(s string) string

Strip all whitespaces.

func Standardize

func Standardize(s string) string

Standardize calling convention.

func StandardizeSpaces

func StandardizeSpaces(s string) string

Group multi-whitespaces to one whitespace.

func StringInSlice

func StringInSlice(a string, list []string) bool

StringInSlice returns whether or not a string exists in a slice

func StripComments

func StripComments(s string) string

Remove C language comments. Removes both single line and multi-line comments.

func WalkAllFilesInDir

func WalkAllFilesInDir(dir string) ([]string, error)

WalkAllFilesInDir returns list of files in directory.

func WriteBytesFile

func WriteBytesFile(filename string, r io.Reader) (int, error)

WriteBytesFile write Bytes to a File.

func WriteStrSliceToFile

func WriteStrSliceToFile(filename string, data []string) (int, error)

WriteStrSliceToFile writes a slice of string line by line to a file.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL