我的信息模型有 200 多个 Cpp-Provider-Files,我想在其中添加一些代码行。
namespace project {
//Here i want to add a member
// other members
ANDBase::ANDBase(
{
//Constructor Impl
//In the last line of the Constructor i want to add some code
}
}
提供者文件都是以相同的方式构建并具有相同的语义,因此我寻找一个只需要管理相同行为 cpp 文件的解析器。 有没有可以帮助我的软件(pref. Visual studio project include)?
最佳答案
听起来像是 Clang 的 LibTooling 的工作.
您可以在那里解析代码,然后在 AST(抽象语法树)中搜索您关心的结构,进行更改并将修改写回源文件。
关于c++ - 解析 C++ 文件以进行编辑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38263210/