本文整理汇总了C++中Right函数的典型用法代码示例。如果您正苦于以下问题:C++ Right函数的具体用法?C++ Right怎么用?C++ Right使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Right函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetClientRect
void CMemoryViewMIPSWnd::RefreshLayout()
{
auto rc = GetClientRect();
const int addressEditHeight = Framework::Win32::PointsToPixels(21);
m_addressEdit->SetSize(rc.Right(), addressEditHeight);
m_memoryView->SetPosition(0, addressEditHeight);
m_memoryView->SetSize(rc.Right(), rc.Bottom() - addressEditHeight);
}
示例2: display
App::PointInt Viewer::calculateWindowTopLeft(ResizePositionMethod method, const SizeInt &newSize ) {
wxDisplay display(DisplayFromPointFallback(PositionScreen()));
auto rtDesktop = wxToRect(display.GetClientArea());
switch (method) {
case ResizePositionMethod::PositionToScreen:
return rtDesktop.TopLeft() + RoundCast((rtDesktop.Dimensions() - newSize) * 0.5f);
case ResizePositionMethod::PositionToCurrent:
{
auto pt = AnchorCenter() + RoundCast(newSize * -0.5f);
if ((pt.X + newSize.Width) > rtDesktop.Right()) {
pt.X = rtDesktop.Right() - newSize.Width;
}
else if (pt.X < rtDesktop.Left()) {
pt.X = rtDesktop.Left();
}
if (pt.Y + newSize.Height > rtDesktop.Bottom()) {
pt.Y = rtDesktop.Bottom() - newSize.Height;
}
else if (pt.Y < rtDesktop.Top()) {
pt.Y = rtDesktop.Top();
}
AnchorTL(pt);
return pt;
}
case ResizePositionMethod::PositionNothing:
{
// Cap to screen
PointInt pt = AnchorTL();
if ((pt.X + newSize.Width) > rtDesktop.Right())
pt.X=rtDesktop.Right()-newSize.Width;
else if (pt.X < rtDesktop.Left())
pt.X = rtDesktop.Left();
if ((pt.Y + newSize.Height) > rtDesktop.Bottom())
pt.Y=rtDesktop.Bottom()-newSize.Height;
else if (pt.Y < rtDesktop.Top())
pt.Y=rtDesktop.Top();
AnchorCenter(pt + RoundCast(newSize * 0.5f));
return pt;
}
default:
DO_THROW(Err::InvalidParam, "Invalid reposition method: " + ToAString(method));
}
}
示例3: IR5
void IR5(void *p)
{
while(1)
{
UpdateLeftPWM(400); //Velocity Setting
UpdateRightPWM(400); //Velocity Setting
if( sen_dat[2]<170) //IR 5
{
Stop();
vTaskSuspend(xforward);
if( ADC_Data[2]<180)
{
//DelaymSec(200);
Soft_Left();
DelaymSec(50);
}
else if(sen_dat[0]<190)
{
Right();
DelaymSec(50);
}
else
{
Back();
DelaymSec(50);
}
if(sen_dat[2]>170)
{
vTaskResume(xforward);
}
}
}
}
示例4: return
bool Rectangle::Intersect(const Rectangle& other) const
{
return (Left() < other.Right())
&& (Right() > other.Left())
&& (Top() < other.Bottom())
&& (Bottom() > other.Top());
}
示例5: Left
bool BoundConjunctiveConstraint::Subsume(BoundConstraint* that) const
{
BoundConstraint* left = Left();
BoundConstraint* right = Right();
if (that->IsBinaryConstraint())
{
BoundBinaryConstraint* thatBinaryConstraint = static_cast<BoundBinaryConstraint*>(that);
BoundConstraint* thatLeft = thatBinaryConstraint->Left();
BoundConstraint* thatRight = thatBinaryConstraint->Right();
bool leftSubsumeThatLeft = left->Subsume(thatLeft);
bool rightSubsumeThatLeft = right->Subsume(thatLeft);
bool leftSubsumeThatRight = left->Subsume(thatRight);
bool rightSubsumeThatRight = right->Subsume(thatRight);
bool leftOrRightSubsumeThatLeft = leftSubsumeThatLeft || rightSubsumeThatLeft;
bool leftOrRightSubsumeThatRight = leftSubsumeThatRight || rightSubsumeThatRight;
if (that->IsConjunctiveConstraint())
{
return leftOrRightSubsumeThatLeft && leftOrRightSubsumeThatRight;
}
else if (that->IsDisjunctiveConstraint())
{
return leftOrRightSubsumeThatLeft || leftOrRightSubsumeThatRight;
}
else // assert(false)
{
return false;
}
}
else
{
bool leftSubsumeThat = left->Subsume(that);
bool righSubsumeThat = right->Subsume(that);
return leftSubsumeThat || righSubsumeThat;
}
}
示例6: main
main ()
{
freopen ("os.in", "r", stdin);
// freopen ("os.out", "w", stdout);
FILE *out = fopen("os.out", "w");
int m, n, a, b;
item *T, *R, *A, *B, *C;
scanf("%ld%ld", &m, &n);
for (int i = 0; i < n; i++)
{
scanf ("%ld%ld", &a, &b);
process(beg, end, a, b);
process(end, beg, a, b);
split(beg, B, C, b);
T = Right(B, a, b);
if(T)remove(end, T->pr->x, T->pr),
remove(B, T->x, T);
merge(beg, B, C);
T = new item(a, b, 0);
R = new item(b, a, T);
T->pr = R;
insert(beg, T);
insert(end, R);
}
int res = gocount(beg);
fprintf(out, "%ld\n", res);
return 0;
}
示例7: SwapContents
void LeftistHeap::Merge (MergeablePriorityQueue& queue)
{
LeftistHeap& arg = dynamic_cast<LeftistHeap&> (queue);
if (IsEmpty ())
SwapContents (arg);
else if (!arg.IsEmpty ())
{
if (*key > *arg.key)
SwapContents (arg);
Right ().Merge (arg);
if (Left ().nullPathLength < Right ().nullPathLength)
Swap (left, right);
nullPathLength = 1 + Min (Left ().nullPathLength,
Right ().nullPathLength);
}
}
示例8: UPtoLP
void CText::DrawHotPoints(CDC *pDC)
{
LOGPEN tLogPen;
tLogPen.lopnColor=RGB(0,0,0);
tLogPen.lopnStyle=PS_DOT;
tLogPen.lopnWidth.x=1;
CPen tPen;
tPen.CreatePenIndirect(&tLogPen);
CPen *pOldPen=(CPen *)pDC->SelectObject(&tPen);
CBrush *pOldBrush=(CBrush *)pDC->SelectStockObject(NULL_BRUSH);
pDC->SetROP2(R2_NOTXORPEN);
long x1,y1,x2,y2;
UPtoLP(Left()-DELTA,Top()-DELTA,&x1,&y1);
UPtoLP(Right()+DELTA,Bottom()+DELTA,&x2,&y2);
pDC->Rectangle(x1,y1,x2,y2);
/*
pDC->SelectStockObject(GRAY_BRUSH);
pDC->SelectStockObject(NULL_PEN);
pDC->SetROP2(R2_NOT);
long x5,y5,x6,y6;
UPtoLP((m_lx1+m_lx2)/2,m_ly1-DELTA,&x5,&y5);
UPtoLP((m_lx1+m_lx2)/2,m_ly2+DELTA,&x6,&y6);
DrawHotPoint(pDC,x5,y5);
DrawHotPoint(pDC,x6,y6);
*/
pDC->SetROP2(R2_COPYPEN);
pDC->SelectObject(pOldBrush);
pDC->SelectObject(pOldPen);
pDC->SelectObject(pOldBrush);
}
示例9: drawObject
/**
Function that takes in vector of Trash objects and openCV Mat image
@param trash std::vector<Trash>
@param &frame cv::Mat
@return void
*/
void drawObject(std::vector<Trash> trash, Mat &frame)
{
for (int i = 0; i < trash.size(); i++)
{
int distance = trash.at(i).getDistance();
int angle = trash.at(i).getAngle();
cv::circle(frame,cv::Point(trash.at(i).getXPos(),trash.at(i).getYPos()),5,cv::Scalar(0,0,255));
cv::putText(frame,intToString(trash.at(i).getXPos())+ " , "
+ intToString(trash.at(i).getYPos()),cv::Point(trash.at(i).getXPos(), trash.at(i).getYPos()+20),1,1,Scalar(0,255,0));
cv::putText(frame,"Distance: "+ intToString(trash.at(i).getDistance())
+ " cm",cv::Point(trash.at(i).getXPos()+10,trash.at(i).getYPos()-10),1,1,trash.at(i).getColor());
cv::putText(frame,trash.at(i).getType(),cv::Point(trash.at(i).getXPos(),trash.at(i).getYPos()-30),1,2,trash.at(i).getColor());
cv::putText(frame,"Angle: "+ intToString(trash.at(i).getAngle())
+ " degrees",cv::Point(trash.at(i).getXPos()+5,trash.at(i).getYPos()+10),1,1,trash.at(i).getColor());
ROS_INFO("\n\n\t\t\t\tDistance: %i Angle: %i", distance, angle);
if (pickupZone(trash.at(i).getXPos()))
{
ROS_INFO("Trash in pickup zone");
}
else if (Left(trash.at(i).getXPos()))
{
ROS_INFO("Trash detected to the left of pickup zone");
}
else if (Right(trash.at(i).getXPos()))
{
ROS_INFO("Trash detected to the right of pickup zone");
}
}
}
示例10: MaxHeapify
/**
* @function MaxHeapify
*/
void MaxHeapify( std::vector<int> &_A,
int _i ) {
int heapSize = _A.size();
int largest;
int temp;
int l = Left(_i);
int r = Right(_i);
if( l < heapSize && _A[l] > _A[_i] ) {
largest = l;
}
else {
largest = _i;
}
if( r < heapSize && _A[r] > _A[largest] ) {
largest = r;
}
if( largest != _i ) {
// Exchange
temp = _A[_i];
_A[_i] = _A[largest];
_A[largest] = temp;
MaxHeapify( _A, largest );
}
}
示例11: Find
bool WString::ReplaceOnce(const WString &findWhat,const WString &replaceWith)
{
int pos = Find(findWhat);
if (pos == -1) return false;
(*this) = Left(pos)+replaceWith+Right(pos+replaceWith.GetLength());
return true;
}
示例12: GetString
WString WString::TrimLeft(wchar_t *trimChars) const
{
const wchar_t *proStr = GetString();
int p = 0;
while (proStr[p] && wcschr(trimChars,proStr[p]!= NULL)) p++;
return Right(p);
}
示例13: Left
void TextDisplay::ShowCaret () {
if (Interactor::ValidCanvas(canvas) &&
caretline >= topline && caretline <= bottomline
) {
IntCoord l = Left(caretline, caretindex);
IntCoord r = Right(caretline, caretindex);
IntCoord b = Base(caretline);
IntCoord t = Top(caretline);
if (l >= xmin && r <= xmax) {
switch (caretstyle) {
case NoCaret:
break;
case DefaultCaret:
case BarCaret:
painter->FillRect(canvas, l, b, l, t);
break;
case UnderscoreCaret:
painter->FillRect(canvas, l, b, r, b+1);
break;
case OutlineCaret:
painter->Rect(canvas, l, b, r, t);
break;
}
}
}
}
示例14: linGrad
void VUMeter::drawBorder(QPainter *painter)
{
painter->save();
QColor light = Qt::white;
QColor dark = colorBg.darker(140);
painter->setPen(QPen(colorBg, 3, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
QLinearGradient linGrad(5, 250, 10, 250);
linGrad.setColorAt(0, light);
linGrad.setColorAt(1, colorBg);
linGrad.setSpread(QGradient::PadSpread);
painter->setBrush(linGrad);
QRectF border(5, 5, 90, 530);
painter->drawRoundRect(border, 30, 5);
QLinearGradient linGrad1(85, 250, 95, 250);
linGrad1.setColorAt(0, colorBg);
linGrad1.setColorAt(1, dark);
linGrad1.setSpread(QGradient::PadSpread);
painter->setBrush(linGrad1);
QRectF border1(20, 5, 75, 530);
painter->drawRoundRect(border1, 30, 5);
//绘制左右文字
painter->setPen(QPen(colorValue, 2));
QRectF Left(20, 505, 25, 20);
QRectF Right(55, 505, 25, 20);
QFont valFont("Arial", 12, QFont::Bold);
painter->setFont(valFont);
painter->drawText(Left, Qt::AlignCenter, "左");
painter->drawText(Right, Qt::AlignCenter, "右");
painter->restore();
}
示例15: IsCollidedRect
inline bool IsCollidedRect(const cRectf& rect)
{
return (!((Right()<rect.Left())
||(Left()>rect.Right())
||(Top()>rect.Bottom())
||(Bottom()<rect.Top())));
}