不完全确定您要问什么,但是您可以使用几乎任何程序语言来解析 source.cpp 和 source.h 以查找函数声明/定义并inline
根据某些规则添加。
基本上,您会将 source.cpp 视为 .txt 并使用您喜欢的任何 api 将文件获取为 .txt 文件char *
。让它搜索(
然后搜索参数和关闭)
。
// FindFunctions.cpp
#include "..."
...
char * AddFuncDecChars( _In_ char * file, char * stringToBeInserted)
{
//Find possible functions with `()`.
int[] PossFuncs = FindParenths(File);
// Check to see if space delimited block followed by another block or
// multiple space delimited blocks with commas.
int[] VerifiedParens HasSpaceDelimWithPossibleCommas( PossFuncs,
File);
char * Change InsertStringToFunc( File, VerifiedParen,
stringToBeInserted);
return Change;
}
还必须在标头而不是 cpp 中有定义,因此可能必须通过采用and对inline
来将其添加到标头中。.h
.cpp