本文整理汇总了C++中sb函数的典型用法代码示例。如果您正苦于以下问题:C++ sb函数的具体用法?C++ sb怎么用?C++ sb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sb函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VALIDATE_NOT_NULL
ECode WifiP2pServiceResponse::ToString(
/* [out] */ String* string)
{
VALIDATE_NOT_NULL(string);
StringBuilder sb("serviceType:");
sb += mServiceType;
sb += " status:";
sb += StatusToString(mStatus);
String temp;
FAIL_RETURN(mDevice->GetDeviceAddress(&temp));
sb += " srcAddr:";
sb += temp;
sb += " data:";
sb += mData ? (const char*)mData->GetPayload() : "";
*string = sb.ToString();
return NOERROR;
}
示例2: sb
void CTaskModel::RemovePrerequisite(unsigned __int64 prereq)
{
MSXML2::IXMLDOMNode *pNode = 0, *pOld = 0;
StringBuffer sb(_T("prerequisite[@taskid=\""));
StringBuffer buf(32);
sb.append(ModelUtils::toHexString(prereq, buf));
sb.append(_T("\"]"));
BSTR xpath = SysAllocString(sb);
HRESULT hr = m_pNode->selectSingleNode(xpath, &pNode);
SysFreeString(xpath);
if(hr == S_OK && pNode)
{
hr = m_pNode->removeChild(pNode, &pOld);
if(hr == S_OK)
{
pOld->Release();
}
pNode->Release();
}
//TODO: notify?..
}
示例3: sb
bool System::Execute(const String& s)
{
STARTUPINFOW si= {sizeof(STARTUPINFO)};
PROCESS_INFORMATION pi;
StringBuffer<wchar_t> sb(s);
sb.push_back(0);
if(!::CreateProcessW(NULL,sb.data(),NULL,NULL,FALSE,0,NULL,NULL,&si,&pi))
{
System::LogTrace("System::Exectue:%s FAILED",s);
return false;
}
System::LogTrace("System::Exectue:%s",s);
::CloseHandle(pi.hProcess);
::CloseHandle(pi.hThread);
return true;
}
示例4: testShape
void testShape() {
Util util;
FrameBuffer fb;
ShadowBuffer sb(fb.width, fb.height, 0, 0, fb.finfo.line_length);
fb.backgroundColor = Color(0, 20, 30);
sb.backgroundColor = Color(0, 20, 30);
map<string, vector<Point> > point = util.readObject("Peta.txt");
Shape shape(util.convertPoint(point, "Baling", 0, 0, 2, 2)[0]);
for (int i = 0; i < 360; i++) {
Point * tipPoints = shape.getTipPoints();
Point midAxis((tipPoints[0].x + tipPoints[1].x) / 2, (tipPoints[0].y + tipPoints[1].y) / 2, 0 );
shape.rotate(midAxis, 5);
shape.scale(midAxis, 1.005, 1.005);
shape.color = Color(rand() % 255, rand() % 255, rand() % 255);
sb.clear();
shape.draw(sb);
fb.draw(sb);
}
}
示例5: nlassert
//***********************************************************************************************
void CParticleWorkspace::CNode::createEmptyPS()
{
nlassert(_WS);
NL3D::CParticleSystem emptyPS;
NL3D::CParticleSystemShape *pss = new NL3D::CParticleSystemShape;
pss->buildFromPS(emptyPS);
std::auto_ptr<NL3D::CShapeBank> sb(new NL3D::CShapeBank);
std::string shapeName = NLMISC::CFile::getFilename(_RelativePath);
sb->add(shapeName, pss);
NL3D::CShapeBank *oldSB = NL3D::CNELU::Scene->getShapeBank();
NL3D::CNELU::Scene->setShapeBank(sb.get());
NL3D::CParticleSystemModel *psm = NLMISC::safe_cast<NL3D::CParticleSystemModel *>(NL3D::CNELU::Scene->createInstance(shapeName));
nlassert(psm);
NL3D::CNELU::Scene->setShapeBank(oldSB);
setup(*psm);
unload();
// commit new values
_PS = psm->getPS();
_PSM = psm;
_ShapeBank = sb.release();
_Modified = false;
}
示例6: indexAt
void FocusableListView::mouseMoveEvent(QMouseEvent * _e)
{
if (selectByMouseHoverEnabled_)
{
const auto index = indexAt(_e->pos());
if (index.isValid())
{
auto sm = selectionModel();
auto prevSelected = sm->currentIndex();
{
QSignalBlocker sb(sm);
sm->setCurrentIndex(index, QItemSelectionModel::ClearAndSelect);
}
if (prevSelected.isValid())
model()->dataChanged(prevSelected, prevSelected);
}
}
QListView::mouseMoveEvent(_e);
}
示例7: sb
void LengthDoubleSpinBox::setLength(double v)
{
d->m_orgLengthMm = v;
d->m_valueHasChanged = false;
cpp::ScopedBool sb(d->m_isInternalUpdateContext, true);
Q_UNUSED(sb);
switch (this->measurementSystem()) {
case QLocale::MetricSystem:
this->setValue(AbstractLengthEditor::asMetricLength(
v, this->preferredMetricUnit()));
break;
#if QT_VERSION >= 0x050000
case QLocale::ImperialUKSystem:
#endif // QT_VERSION
case QLocale::ImperialSystem:
this->setValue(AbstractLengthEditor::asImperialLength(
v, this->preferredImperialUnit()));
break;
}
}
示例8: VALIDATE_NOT_NULL
ECode WifiTile::CallbackInfo::ToString(
/* [out] */ String* str)
{
VALIDATE_NOT_NULL(str);
StringBuilder sb("CallbackInfo[");
sb.Append("enabled=");
sb.Append(mEnabled);
sb.Append(",connected=");
sb.Append(mConnected);
sb.Append(",wifiSignalIconId=");
sb.Append(mWifiSignalIconId);
sb.Append(",enabledDesc=");
sb.Append(mEnabledDesc);
sb.Append(",activityIn=");
sb.Append(mActivityIn);
sb.Append(",activityOut=");
sb.Append(mActivityOut);
sb.Append(",wifiSignalContentDescription=");
sb.Append(mWifiSignalContentDescription);
sb.Append(']');
return sb.ToString(str);
}
示例9: SkASSERT
bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) {
SkASSERT(NULL == rt->renderTargetPriv().getStencilBuffer());
GrUniqueKey sbKey;
int width = rt->width();
int height = rt->height();
if (this->caps()->oversizedStencilSupport()) {
width = SkNextPow2(width);
height = SkNextPow2(height);
}
GrStencilBuffer::ComputeSharedStencilBufferKey(width, height, rt->numSamples(), &sbKey);
SkAutoTUnref<GrStencilBuffer> sb(static_cast<GrStencilBuffer*>(
this->getContext()->getResourceCache()->findAndRefUniqueResource(sbKey)));
if (sb) {
if (this->attachStencilBufferToRenderTarget(sb, rt)) {
rt->renderTargetPriv().didAttachStencilBuffer(sb);
return true;
}
return false;
}
if (this->createStencilBufferForRenderTarget(rt, width, height)) {
// Right now we're clearing the stencil buffer here after it is
// attached to an RT for the first time. When we start matching
// stencil buffers with smaller color targets this will no longer
// be correct because it won't be guaranteed to clear the entire
// sb.
// We used to clear down in the GL subclass using a special purpose
// FBO. But iOS doesn't allow a stencil-only FBO. It reports unsupported
// FBO status.
this->clearStencil(rt);
GrStencilBuffer* sb = rt->renderTargetPriv().getStencilBuffer();
sb->resourcePriv().setUniqueKey(sbKey);
return true;
} else {
return false;
}
}
示例10: sb
Stringp StackTrace::format(AvmCore* core)
{
if(!stringRep)
{
Stringp s = core->kEmptyString;
int displayDepth = depth;
if (displayDepth > kMaxDisplayDepth) {
displayDepth = kMaxDisplayDepth;
}
const Element *e = elements;
for (int i=0; i<displayDepth; i++, e++)
{
// env will be NULL if the element is from a fake CallStackNode
// omit them since they are only for profiling purposes
if (!e->info())
continue;
if(i != 0)
s = s->appendLatin1("\r\n");
Stringp filename=NULL;
if(e->filename())
{
StringBuffer sb(core->gc);
dumpFilename(e->filename(), sb);
filename = core->newStringUTF8(sb.c_str());
}
s = core->concatStrings(s, getStackTraceLine(e->info(), filename));
if(e->filename())
{
s = core->concatStrings(s, core->intToString(e->linenum()));
s = s->appendLatin1("]");
}
}
stringRep = s;
}
return stringRep;
}
示例11: checker_calc
int checker_calc(t_e *e)
{
char *line;
while (get_next_line(0, &line) != 0)
{
if (ft_strcmp("sa", line) == 0)
sa(e->l_a);
else if (ft_strcmp("sb", line) == 0)
sb(e->l_b);
else if (ft_strcmp("ss", line) == 0)
ss(e->l_a, e->l_b);
else if (ft_strcmp("ra", line) == 0)
ra(e->l_a);
else if (ft_strcmp("rb", line) == 0)
rb(e->l_b);
else if (ft_strcmp("rr", line) == 0)
rr(e->l_a, e->l_b);
else if (ft_strcmp("rra", line) == 0)
rra(e->l_a);
else if (ft_strcmp("rrb", line) == 0)
rrb(e->l_b);
else if (ft_strcmp("rrr", line) == 0)
rrr(e->l_a, e->l_b);
else if (ft_strcmp("pa", line) == 0)
pa(e->l_a, e->l_b);
else if (ft_strcmp("pb", line) == 0)
pb(e->l_a, e->l_b);
else
{
ft_putendl_fd("Error", 2);
ft_memdel((void **)&line);
return (0);
}
ft_memdel((void **)&line);
}
return (1);
}
示例12: testLine
void testLine() {
Util util;
FrameBuffer fb;
ShadowBuffer sb(fb.width, fb.height, 0, 0, fb.finfo.line_length);
fb.backgroundColor = Color(0, 20, 30);
sb.backgroundColor = Color(0, 20, 30);
vector<Point> points;
points.push_back(Point(0, 20,20));
points.push_back(Point(800, 500, 300));
Line line(points);
for (int i = 0; i < 360; i++) {
Point * tipPoints = line.getTipPoints();
Point midAxis((tipPoints[0].x + tipPoints[1].x) / 2, (tipPoints[0].y + tipPoints[1].y) / 2, 0);
line.rotate(midAxis, 5);
line.color = Color(rand() % 255, rand() % 255, rand() % 255);
sb.clear();
line.draw(sb);
fb.draw(sb);
}
}
示例13: sb
void CategoryPage::btOk_Click(Web::HttpConnector& h)
{
Sql::StringBuilder sb(L"category", L"category_id", category_id);
sb.Bind(L"descr", tbxDescr);
Sql::SqlConnection conn;
int rows = 0;
try
{
//conn.OpenSession(DSN, USERNAME, PASSWORD); //Control Panel>Administrative Tools>Data Sources (ODBC)>Create dsn_myDatabase
conn.OpenSession(NULL, CONNECTION_STRING);
rows = conn.ExecuteNonQuery(sb.GetString());
if (rows!=1)
{
this->MessageBox(Sys::Convert::ToString(rows), L"Error -number of rows", MB_OK | MB_ICONERROR);
}
}
catch (Sql::SqlException e)
{
this->MessageBox(e.GetDescription(), L"Error", MB_OK | MB_ICONERROR);
}
h.NavigateTo(L"Index");
}
示例14: sb
String IntentBindRecord::ToString()
{
if (!mStringName.IsNull()) {
return mStringName;
}
StringBuilder sb(128);
sb += "IntentBindRecord{";
sb += StringUtils::ToString(Int32(this), 16);
sb += ' ';
if ((CollectFlags()& IContext::BIND_AUTO_CREATE) != 0) {
sb += "CR ";
}
sb += mService->mShortName;
sb += ':';
if (mIntent != NULL) {
AutoPtr<IIntent> intent;
mIntent->GetIntent((IIntent**)&intent);
intent->ToShortString(&sb, FALSE, FALSE, FALSE, FALSE);
}
sb += '}';
return mStringName = sb.ToString();
}
示例15: IndexError
template< class T > T Correlation< T >::operator () (const vector < T > & a, const vector < T > & b) const
{
static char F_Name[] = "template< class T > T Correlation< T >::operator () (const vector < T > & a, const vector < T > & b) const";
if(a.size() != b.size()) {
TKVPairList kvlist;
kvlist.push_back(TKVPair("Size", a.size()));
kvlist.push_back(TKVPair("Size", b.size()));
throw IndexError(F_Name, kvlist);
}
T av_a, av_b, d_a, d_b, sp(0), sa(0), sb(0);
av_a = average(a);
av_b = average(b);
for(unsigned i=0; i<a.size(); i++) {
d_a = a[i] - av_a;
d_b = b[i] - av_b;
sp += d_a * d_b;
sa += SQR(d_a);
sb += SQR(d_b);
}
return sp / sqrt(sa * sb);
}