操纵功能变量在doxygen中
Manipulate Function Variables in Doxygen
这是可能的吗?
以此代码
为例class LuaCamera
{
public:
LuaCamera(lua_State* L);
static bool defaultControls;
bool FPSCam;
int lookAt(lua_State* L);
int getRotation(lua_State* L);
int setRotation(lua_State* L);
// ...
virtual ~LuaCamera();
static const char className[];
static const Luna<LuaCamera>::RegType Register[];
protected:
private:
};
您可以看到,我正在使用LUA,所以我想记录Lua-usage。我希望看到void setRotation(int x, int y, int z)
,而不是在Doxygen输出中获得int setRotation(lua_State* L)
。同样,我希望该类在输出而不是LuaCamera
中命名为Camera
。
我意识到我可以重命名课程并创建未使用的功能以做到这一点,但是我的程序具有大量的LUA功能,这将是一种糟糕的方法。
有什么想法?
我决定只是制作一个非常简单的脚本来完成我需要的任务。
对于任何可能正在寻找类似解决方案的人,这里是Python文件的来源:
import os;
path = "include/";
output = "doxygen/src/";
modOutput = False;
srcFiles = os.listdir(path);
def writeFile(fileName, cont):
f = open(fileName, "w");
f.write(cont);
f.close();
def readFile(fileName):
cont = open(fileName, "r");
return cont;
def readFileLines(fileName):
return readFile(fileName).readlines();
# creates the original files without the mod option.
def outputNormalSrc():
for srcFile in srcFiles:
fileLines = readFileLines(path + srcFile);
newFile = "";
# We want everything in the original src files except for mod lines.
for line in fileLines:
if line.find("mod") >= 0:
line = line[ : line.find("mod")] + "n";
newFile += line;
writeFile(output + srcFile, newFile);
# creates the modded files for Lua doxygen output.
def outputModdedSrc():
for srcFile in srcFiles:
fileLines = readFileLines(path + srcFile);
newFile = "";
foundClass = "";
for line in fileLines:
if foundClass == "" and line.find("class") >= 0:
foundClass = line[line.find("class")+6 : -1];
break;
if foundClass == "":
print "WARNING: couldn't find class in src file " + srcFile + ". Skipping.";
continue;
newFile = "class " + foundClass + "n{n";
getLines = False;
writeBeforeClass = False;
inMod = False;
whiteSpaces = "";
for line in fileLines:
# We want everything in the block quote.
# If the block quote is for the class, put it before the class definition.
if line.find("/**") >= 0:
getLines = True;
if line.find("class") >= 0:
writeBeforeClass = "";
# Store the mod function name.
if line.find("mod") >= 0 and getLines:
inMod = line[line.find("mod")+5 : -1];
line = line[ : line.find("mod")] + "n";
# Here we start storing the necessary lines we need for the output.
if getLines or line.find("public:") >= 0 or line.find("private:") >= 0 or line.find("protected:") >= 0 or line.find("}") >= 0:
if writeBeforeClass != False:
writeBeforeClass += line;
else:
newFile += line;
# The end of the block quote.
if line.find("*/") >= 0 and getLines:
getLines = False;
# If we are writing the block quote before the class.
if writeBeforeClass != False:
newFile = writeBeforeClass + newFile;
writeBeforeClass = False;
# Add our modded function in place of the normal function.
if inMod != False:
newFile += whiteSpaces + inMod + ";n";
inMod = False;
# Used to append whitespaces the beginning of modded functions
# based on the previous line's whitespaces.
whiteSpaces = "";
for i in range(len(line)):
if line[i].isspace() == False:
break;
whiteSpaces += line[i];
# Create the files.
writeFile(output + srcFile, newFile);
def main():
# Choice: Create the original output without the mod command,
# or with the mod command to overwrite function definitions.
if modOutput:
outputModdedSrc();
else:
outputNormalSrc();
main();
相关文章:
- 如何创建一个CMake变量,除非显式重写,否则使用默认值
- 将成员变量添加到共享库中的类中,不会破坏二进制兼容性吗
- 将数组的地址分配给变量并删除
- 为"adjacent"变量赋值时出现问题
- enum是C++中的宏变量还是整数变量
- 在全局变量中保存类的实例以重新创建类(创建"backup")
- 用C++中的一个变量定义一个常量
- 具有奇怪重复模板模式的派生类中的成员变量已损坏
- 你能重载对象变量名本身返回的内容吗
- 内置函数可查看CPP中的成员变量
- 是否可以初始化不可复制类型的成员变量(或基类)
- 尝试通过多个向量访问变量时,向量下标超出范围
- 试图让变量检查数组中的某些内容
- Cpp-Tuple使用带有变量的get
- 将包含C样式数组的对象初始化为成员变量(C++)
- 如何从doxygen输出中排除类的无证件成员函数/变量
- doxygen:将静态变量文档移入函数中
- 操纵功能变量在doxygen中
- 变量后的Doxygen多行注释
- 如何使用 Doxygen 记录C++函数中的局部变量