instruction::instruction() { this->classes << "JsonExe" << "SqlQuery" << "SqlDiscount" << "SqlCart"; this->jsonMethods << "GetJson" << "JudgeJson" << "EditJson" << "AppendJson"; this->queryMethod << "Selectdb" << "Insertdb" << "Updatedb" << "Deletedb" << "SelectStoredb" << "Searchdb" << "UpdateResetDb" << "OutPut"; this->discountMethods << "Selectdb" << "Insertdb" << "Updatedb"; this->cartMethods << "Selectdb" << "Insertdb" << "Updatedb" << "Deletedb"; json = new jsonexe(); sqlQ = new sqlQuery(); sqlD = new sqlDiscount(); sqlC = new sqlCart(); }
时间: 2023-06-16 08:02:27 浏览: 34
这是一个 C++ 类的构造函数,初始化了一些私有成员变量:classes、jsonMethods、queryMethod、discountMethods、cartMethods,并实例化了四个对象:jsonexe、sqlQuery、sqlDiscount 和 sqlCart。
这个类可能是用来处理与数据库相关的操作,其中 classes 变量包含了要访问的四个表格名,jsonMethods 包含了与 JSON 格式数据相关的方法名,queryMethod 包含了与查询相关的方法名,discountMethods 包含了与折扣信息相关的方法名,cartMethods 包含了与购物车相关的方法名。
这个类的实例化对象可以调用它的公有方法来执行相应的操作。
相关问题
<template> <div class="container"> <!-- 第一题#Vue路由 --> <nav> <ul> <li> <router-link to="/function">奖学金评选资格功能</router-link> </li> <li> <router-link to="/instruction">奖学金评选资格功能说明</router-link> </li> </ul> </nav> <router-view></router-view> </div> </template>
这段代码是一个 Vue 组件的模板,它包含了一个容器 div,其中包含一个 nav 元素和一个 router-view 元素。nav 元素中包含一个无序列表,其中有两个列表项,每个列表项都是一个 router-link 组件,分别指向路径为 /function 和 /instruction 的路由。router-view 组件则用于渲染当前路由所匹配的组件。这段代码使用了 Vue 的路由功能,通过路由来实现页面的跳转和组件的切换。
/// TODO: print each path once this method is called, and /// (1) add each path (a sequence of node IDs) as a string into std::set<std::string> paths /// in the format "START: 1->2->4->5->END", where -> indicate an ICFGEdge connects two ICFGNode IDs /// bonus: dump and append each program path to a `ICFGPaths.txt` in the form of /// ‘{ln: number cl: number, fl:name} -> {ln: number, cl: number, fl: name} -> {ln:number, cl: number, fl: name} /// ln : line number cl: column number fl:file name for further learning, you can review the code in SVF, SVFUtil void TaintGraphTraversal::printICFGPath(std::vector<const ICFGNode *> &path){ } // TODO: Implement your code to parse the two lines from `SrcSnk.txt` in the form of // line 1 for sources "{ api1 api2 api3 }" // line 2 for sinks "{ api1 api2 api3 }" void TaintGraphTraversal::readSrcSnkFromFile(const string& filename){ } /// TODO: Checking aliases of the two variables at source and sink. For example: /// src instruction: actualRet = source(); /// snk instruction: sink(actualParm,...); /// return true if actualRet is aliased with any parameter at the snk node (e.g., via ander->alias(..,..)) bool TaintGraphTraversal::aliasCheck(const CallICFGNode *src, const CallICFGNode *snk) { return true; } 这三个空分别应该填什么代码
第一个空:
```c++
void TaintGraphTraversal::printICFGPath(std::vector<const ICFGNode *> &path){
std::stringstream ss;
ss << "START: ";
for(auto node: path){
ss << node->getId();
if(node->getOutDegree() > 0){
ss << "->";
}
}
ss << "END";
std::string pathStr = ss.str();
paths.insert(pathStr);
std::ofstream file("ICFGPaths.txt", std::ios_base::app);
if(file.is_open()){
file << "{ln:" << path.front()->getInst()->getLine()
<< " cl:" << path.front()->getInst()->getColumn()
<< " fl:" << path.front()->getInst()->getFilename() << "}";
for(auto node: path){
file << " -> ";
file << "{ln:" << node->getInst()->getLine()
<< " cl:" << node->getInst()->getColumn()
<< " fl:" << node->getInst()->getFilename() << "}";
}
file << "\n";
file.close();
}
}
```
第二个空:
```c++
void TaintGraphTraversal::readSrcSnkFromFile(const string& filename){
std::ifstream file(filename);
if(file.is_open()){
std::string line1, line2;
std::getline(file, line1);
std::getline(file, line2);
std::regex re("\\{([^\\}]*)\\}");
std::smatch match;
std::vector<std::string> srcVec, snkVec;
while(std::regex_search(line1, match, re)){
srcVec.push_back(match[1]);
line1 = match.suffix().str();
}
while(std::regex_search(line2, match, re)){
snkVec.push_back(match[1]);
line2 = match.suffix().str();
}
file.close();
}
}
```
第三个空:
```c++
bool TaintGraphTraversal::aliasCheck(const CallICFGNode *src, const CallICFGNode *snk) {
const SVFFunction *srcFunc = src->getCallee();
const SVFFunction *snkFunc = snk->getCallee();
const SVFVariable *retVar = srcFunc->getRetVar();
std::vector<const SVFVariable *> paramVars = snkFunc->getParamVars();
for(auto paramVar: paramVars){
if(paramVar->alias(retVar)){
return true;
}
}
return false;
}
```