本文整理汇总了C++中Matcher::setString方法的典型用法代码示例。如果您正苦于以下问题:C++ Matcher::setString方法的具体用法?C++ Matcher::setString怎么用?C++ Matcher::setString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matcher
的用法示例。
在下文中一共展示了Matcher::setString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadD3DAPICallsCSVFile
//
// Load the D3DAPICalls benchmark report:
//
// benchmarkable_call_number,frame_time_ms,time_difference,call_type,draw_call_number,calls_skipped,calls_executed,ps_text,vs_text,vdecl_text
//
bool loadD3DAPICallsCSVFile(const char *name, const char *fname, const std::vector<std::string> &keywordTable, bool bDiffGraph, bool bCollapse)
{
char tmpstr[1024];
int graphDiff = -1;
std::ifstream fs(fname);
if(!fs.is_open())
{
if(g_pLog) g_pLog->AddMessage("no>>Failure...");
return false;
}
// for size of the file so we can display a progress bar
fs.seekg( -1, std::ios_base::end );
int bSize = (int)fs.tellg();
fs.seekg( 0, std::ios_base::beg );
g_pProgressBar->SetTitle("Loading D3DAPICalls benchmark data...");
if(g_pLog) g_pLog->AddMessage("Loading D3DAPICalls benchmark data %s", fname);
fs.getline(tmpstr, 1023); //Dummy line
if(*tmpstr == '\0')
{
if(g_pLog) g_pLog->AddMessage("no>>Failure...");
return false;
}
g_apiCall.clear();
int disp = (int)g_pDisplays.size();
IWindowFolding *pWFold;
if(disp == 0)
{
TLDisplay *pDisp = new TLDisplay(g_hwnd);
pDisp->name = "API Calls Benchmark";
g_pDisplays.push_back(pDisp);
//UI:
pWFold = g_pwinHandler->CreateWindowFolding((LPCSTR)(1<<16), "API Calls Benchmark", g_pMainContainer);
}
else
{
pWFold = (IWindowFolding *)g_pwinHandler->Get((LPCSTR)(1<<16))->QueryInterface("IWindowFolding");
}
// LET's ASSUME that this is always done in display #0 :
disp = 0;
int graphTime = g_pDisplays[disp]->addGraph(name);
//Create a second graph for time difference...
if(bDiffGraph)
{
TLDisplay *pDisp = new TLDisplay(g_hwnd);
pDisp->name = "API Calls time difference";
g_pDisplays.push_back(pDisp);
graphDiff = g_pDisplays[1]->addGraph(name);
}
//UI:
g_pwinHandler->CreateCtrlCheck((LPCSTR)graphTime, name, pWFold)->SetChecked(true);
//Examples:
//-1,2.40242,2.40242,first_call_was_skipped,,1999,0
//0,2.4076,0.005188,Clear,,1998,1
//Examples2:
//-1,2.10559,2.10559,first_call_was_skipped,,4147,0,,,
//0,2.42992,0.32433,Clear,,4146,1,,,
//2,2.66265,0.215147,Draw,0,4144,3,ps_ea97b1f6b1cbfb27_1,vs_text_1,vdecl_text_1
//Fill in the graph
Pattern::registerPattern("int", "\\s*([\\-0-9]*)\\s*");
Pattern::registerPattern("float", "\\s*([\\-0-9\\.eE]*)\\s*");
Pattern::registerPattern("text", "\\s*(\\w*)\\s*");
Pattern *p = Pattern::compile("{int},{float},{float},(\\w+),?{int},?{int},?{int},?{text},?{text},?{text}");
Matcher *m = p->createMatcher("");
int benchmarkable_call_number_collapsed = 0;
do {
int benchmarkable_call_number;
float frame_time_ms;
float time_difference;
std::string call_type;
int draw_call_number;
int calls_skipped;
int calls_executed;
std::string ps_text;
std::string vs_text;
std::string vdecl_text;
std::string comment;
fs.getline(tmpstr, 1023);
if(fs.eof())
break;
m->setString(tmpstr);
if(m->findFirstMatch())
{
benchmarkable_call_number = atoi(m->getGroup(1).c_str());
frame_time_ms = (float)atof(m->getGroup(2).c_str());
time_difference = (float)atof(m->getGroup(3).c_str());
call_type = m->getGroup(4);
draw_call_number = atoi(m->getGroup(5).c_str());
calls_skipped = atoi(m->getGroup(6).c_str());
//.........这里部分代码省略.........
示例2: loadOGLAPICallsCSVFile
//.........这里部分代码省略.........
//Pattern *pInst = Pattern::compile(",?([\\w\\s]*),?{int},?{int},?{int},?{int},?{int},?{int},?{int},?{int},?{int},?{int},?{text}"); // we still need to gather the comments at the end
//Matcher *m = p->createMatcher("");
//Matcher *mInst = pInst->createMatcher("");
int benchmarkable_call_number_collapsed = 0;
int prevFBO = 0;
int nEltsTotal = 0;
int nGLCalls_total = 0;
unsigned int nPointsTotal=0, nLinesTotal=0, nTrisTotal=0, nQuadsTotal=0;
do {
int benchmarkable_call_number;
int nGLCalls;
float frame_time_ms;
std::string call_type;
std::string prim_type;
unsigned int nElts, curFBO;
unsigned int nPoints, nLines, nTris, nQuads;
std::string comment;
// PerfKit Signals
int IDX_Bottleneck
,IDX_SOL
,GEOM_Bottleneck
,GEOM_SOL
,SHD_Bottleneck
,SHD_SOL
,FB_Bottleneck
,FB_SOL
,ROP_Bottleneck
,ROP_SOL;
std::string GPU_Bottleneck;
fs.getline(tmpstr, 1023);
if(fs.eof())
break;
matchNames->setString(tmpstr);
if(matchNames->findFirstMatch())
{
// We know in advance what to read...
benchmarkable_call_number = atoi(matchNames->getGroup(1).c_str()); matchNames->findNextMatch();
nGLCalls = atoi(matchNames->getGroup(1).c_str()); matchNames->findNextMatch();
nGLCalls_total += nGLCalls;
frame_time_ms = (float)atof(matchNames->getGroup(1).c_str()); matchNames->findNextMatch();
call_type = matchNames->getGroup(1); matchNames->findNextMatch();
prim_type = matchNames->getGroup(1); matchNames->findNextMatch();
nElts = atoi(matchNames->getGroup(1).c_str()); matchNames->findNextMatch();
nEltsTotal += nElts;
nPoints = atoi(matchNames->getGroup(1).c_str()); matchNames->findNextMatch();
nPointsTotal += nPoints;
nLines = atoi(matchNames->getGroup(1).c_str()); matchNames->findNextMatch();
nLinesTotal += nLines;
nTris = atoi(matchNames->getGroup(1).c_str()); matchNames->findNextMatch();
nTrisTotal += nTris;
nQuads = atoi(matchNames->getGroup(1).c_str()); matchNames->findNextMatch();
nQuadsTotal += nQuads;
curFBO = atoi(matchNames->getGroup(1).c_str()); matchNames->findNextMatch();
comment = matchNames->getGroup(1); matchNames->findNextMatch();
// If we have the bottleneck analysis
if(bHasAnalysis)
{
GPU_Bottleneck = matchNames->getGroup(1); matchNames->findNextMatch();
IDX_Bottleneck = atoi(matchNames->getGroup(1).c_str()); matchNames->findNextMatch();
IDX_SOL = atoi(matchNames->getGroup(1).c_str()); matchNames->findNextMatch();
GEOM_Bottleneck = atoi(matchNames->getGroup(1).c_str()); matchNames->findNextMatch();
GEOM_SOL = atoi(matchNames->getGroup(1).c_str()); matchNames->findNextMatch();
SHD_Bottleneck = atoi(matchNames->getGroup(1).c_str()); matchNames->findNextMatch();
SHD_SOL = atoi(matchNames->getGroup(1).c_str()); matchNames->findNextMatch();
FB_Bottleneck = atoi(matchNames->getGroup(1).c_str()); matchNames->findNextMatch();