本文整理汇总了C++中line::end方法的典型用法代码示例。如果您正苦于以下问题:C++ line::end方法的具体用法?C++ line::end怎么用?C++ line::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类line
的用法示例。
在下文中一共展示了line::end方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Thd_Match
DWORD WINAPI Thd_Match(PVOID lParam)
{
UNREFERENCED_PARAMETER(lParam);
XLIB_TRY
{
const DWORD start_time = GetTickCount();
mlog << "\r\n\r\n------------------------匹配工作开始------------------------\r\n";
if(g_file_sig)
{
ifstream file(g_filename.c_str(), ios::in | ios::binary);
if(!file)
{
file.close();
mlog << "无法打开或读取指定的特征码文件:" << g_filename;
return 0;
}
file.seekg(0, ios::end);
const unsigned int filelen = file.tellg();
if(filelen == 0)
{
file.close();
mlog << "指定的特征码文件:" << g_filename << "内容为空";
return 0;
}
file.seekg(0, ios::beg);
g_signature.clear();
g_signature.reserve(filelen);
file.read((char*)g_signature.end()._Ptr, filelen);
g_signature.append(g_signature.end()._Ptr, filelen);
file.close();
if(g_create_atom)
{
const DWORD atom_start_time = GetTickCount();
line sig(g_signature);
const line atoms(signaturematcher::create_atom_by_script(sig));
if(!atoms.empty())
{
string atomname(g_filename);
const size_t pos = atomname.find_last_of('.');
if(pos != string::npos)
{
atomname.erase(pos);
}
atomname.append(".atom");
ofstream of(atomname.c_str(), ios::out | ios::binary);
of.write((const char*)atoms.c_str(), atoms.size());
of.close();
mlog << "成功解析并写入中间原子文件("
<< (int)(GetTickCount() - atom_start_time)
<< "ms):"<< atomname << "\r\n";
}
}
}
if(g_blk.start() == nullptr)
{
pe tmppe(GetModuleHandle(nullptr));
g_blk = tmppe.GetImage();
}
g_blks.clear();
g_blks.push_back(g_blk);
g_report.clear();
signaturematcher::analy_script(g_signature, match_routine, nullptr);
if(g_file_sig && !g_report.empty())
{
const DWORD h_start_time = GetTickCount();
xmsg s64, s32, s16, s8, sp;
const size_t max_name_len = 46;
for(auto rep : g_report)
{
signaturematcher::REPORT_VALUE& rv = rep.second.values;
xmsg* lpmsg = nullptr;
xmsg var;
switch(rv.t)
{
case 'q': lpmsg = &s64; var << rv.q; break;
case 'd': lpmsg = &s32; var << rv.d; break;
case 'w': lpmsg = &s16; var << rv.w; break;
case 'b': lpmsg = &s8; var << rv.b; break;
case 'p': lpmsg = &sp; var << rv.p; break;
default: lpmsg = &s64; var << rv.q; break;
}
if(!(*lpmsg).empty()) (*lpmsg) << "\r\n";
(*lpmsg) << " " << rep.first;
if(rep.first.size() < max_name_len)
{
(*lpmsg).append(max_name_len - rep.first.size(),' ');
}
(*lpmsg) << " = 0x" << var << ",";
if(!rep.second.note.empty()) (*lpmsg) << " //" << rep.second.note;
}
//.........这里部分代码省略.........
示例2: if
__HOST____DEVICE__
scalar line<point2D, const point2D&>::nearestDist
(
const line<point2D, const point2D&>& e,
point2D& thisPt,
point2D& edgePt
) const
{
vector2D u = end()-start();
vector2D v = e.end()-e.start();
vector2D w = start()-e.start();
scalar d = u.perp(v);
if (Foam::mag(d) > VSMALL)
{
scalar s = v.perp(w) / d;
if (s <= SMALL)
{
thisPt = start();
}
else if (s >= (1-SMALL))
{
thisPt = end();
}
else
{
thisPt = start()+s*u;
}
scalar t = u.perp(w) / d;
if (t <= SMALL)
{
edgePt = e.start();
}
else if (t >= (1-SMALL))
{
edgePt = e.end();
}
else
{
edgePt = e.start()+t*v;
}
}
else
{
// Parallel lines. Find overlap of both lines by projecting onto
// direction vector (now equal for both lines).
scalar edge0 = e.start() & u;
scalar edge1 = e.end() & u;
bool edgeOrder = edge0 < edge1;
scalar minEdge = (edgeOrder ? edge0 : edge1);
scalar maxEdge = (edgeOrder ? edge1 : edge0);
const point2D& minEdgePt = (edgeOrder ? e.start() : e.end());
const point2D& maxEdgePt = (edgeOrder ? e.end() : e.start());
scalar this0 = start() & u;
scalar this1 = end() & u;
bool thisOrder = this0 < this1;
scalar minThis = min(this0, this1);
scalar maxThis = max(this1, this0);
const point2D& minThisPt = (thisOrder ? start() : end());
const point2D& maxThisPt = (thisOrder ? end() : start());
if (maxEdge < minThis)
{
// edge completely below *this
edgePt = maxEdgePt;
thisPt = minThisPt;
}
else if (maxEdge < maxThis)
{
// maxEdge inside interval of *this
edgePt = maxEdgePt;
thisPt = nearestDist(edgePt).rawPoint();
}
else
{
// maxEdge outside. Check if minEdge inside.
if (minEdge < minThis)
{
// Edge completely envelops this. Take any this point and
// determine nearest on edge.
thisPt = minThisPt;
edgePt = e.nearestDist(thisPt).rawPoint();
}
else if (minEdge < maxThis)
{
// minEdge inside this interval.
edgePt = minEdgePt;
thisPt = nearestDist(edgePt).rawPoint();
}
else
{
//.........这里部分代码省略.........