本文整理汇总了C++中QValueStack::top方法的典型用法代码示例。如果您正苦于以下问题:C++ QValueStack::top方法的具体用法?C++ QValueStack::top怎么用?C++ QValueStack::top使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QValueStack
的用法示例。
在下文中一共展示了QValueStack::top方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isLast
bool QExp::isLast(QValueStack<char> opr){
int ins=0;
bool b=true;
while(b && !opr.empty()){
if(opr.top()==tLpr){
if(ins == 0)
b= true;
else
ins--;
} else if(opr.top()==tLpr)
ins++;
else if(opr.top()==tComa)
b= false;
else if(opr.top()==tEof)
b= false;
opr.pop();
}
return b;
}
示例2: paintData
/**
Paints the actual data area.
\param painter the QPainter onto which the chart should be painted
\param data the data that will be displayed as a chart
\param paint2nd specifies whether the main chart or the additional chart is to be drawn now
\param regions a pointer to a list of regions that will be filled
with regions representing the data segments, if not null
*/
void KDChartPiePainter::paintData( QPainter* painter,
KDChartTableDataBase* data,
bool paint2nd,
KDChartDataRegionList* regions )
{
//bHelp=true;
uint chart = paint2nd ? 1 : 0;
QRect ourClipRect( _dataRect );
ourClipRect.addCoords( -1,-1,1,1 );
const QWMatrix & world = painter->worldMatrix();
ourClipRect =
#if COMPAT_QT_VERSION >= 0x030000
world.mapRect( ourClipRect );
#else
world.map( ourClipRect );
#endif
painter->setClipRect( ourClipRect );
// find which dataset to paint
uint dataset;
if ( !params()->findDataset( KDChartParams::DataEntry
,
dataset, dataset ) ) {
return ; // nothing to draw
}
if ( dataset == KDCHART_ALL_DATASETS )
// setChartSourceMode() has not been used (or all datasets have been
// configured to be used); use the first dataset by
// default
dataset = 0;
// Number of values: If -1, use all values, otherwise use the
// specified number of values.
if ( params()->numValues() != -1 )
_numValues = params()->numValues();
else
_numValues = data->usedCols();
_startAngles.resize( _numValues );
_angleLens.resize( _numValues );
// compute position
_size = QMIN( _dataRect.width(), _dataRect.height() ); // initial size
// if the pies explode, we need to give them additional space =>
// make the basic size smaller
if ( params()->explode() ) {
double doubleSize = ( double ) _size;
doubleSize /= ( 1.0 + params()->explodeFactor() * 2 );
_size = ( int ) doubleSize;
}
int sizeFor3DEffect = 0;
if ( !params()->threeDPies() ) {
int x = ( _dataRect.width() == _size ) ? 0 : ( ( _dataRect.width() - _size ) / 2 );
int y = ( _dataRect.height() == _size ) ? 0 : ( ( _dataRect.height() - _size ) / 2 );
_position = QRect( x, y, _size, _size );
_position.moveBy( _dataRect.left(), _dataRect.top() );
} else {
// threeD: width is the maximum possible width; height is 1/2 of that
int x = ( _dataRect.width() == _size ) ? 0 : ( ( _dataRect.width() - _size ) / 2 );
int height = _size;
// make sure that the height plus the threeDheight is not more than the
// available size
if ( params()->threeDPieHeight() >= 0 ) {
// positive pie height: absolute value
sizeFor3DEffect = params()->threeDPieHeight();
height = _size - sizeFor3DEffect;
} else {
// negative pie height: relative value
sizeFor3DEffect = -( int ) ( ( ( double ) params()->threeDPieHeight() / 100.0 ) * ( double ) height );
height = _size - sizeFor3DEffect;
}
int y = ( _dataRect.height() == height ) ? 0 : ( ( _dataRect.height() - height - sizeFor3DEffect ) / 2 );
_position = QRect( _dataRect.left() + x, _dataRect.top() + y,
_size, height );
// _position.moveBy( _dataRect.left(), _dataRect.top() );
}
double sum = data->rowAbsSum( dataset );
if( sum==0 ) //nothing to draw
return;
double sectorsPerValue = 5760.0 / sum; // 5760 == 16*360, number of sections in Qt circle
int currentValue = params()->pieStart() * 16;
//.........这里部分代码省略.........
示例3: getToken
//.........这里部分代码省略.........
while ( beta ) {
#else
while ( gamma ) {
#endif
delta;
}
The code contains, indeed, two opening braces for
one closing brace; yet there's no reason to panic.
The solution is to remember yyBraceDepth as it was
when #if, #ifdef or #ifndef was met, and to set
yyBraceDepth to that value when meeting #elif or
#else.
*/
do {
yyCh = getChar();
} while ( isspace(yyCh) && yyCh != '\n' );
switch ( yyCh ) {
case 'i':
yyCh = getChar();
if ( yyCh == 'f' ) {
// if, ifdef, ifndef
yySavedBraceDepth.push( yyBraceDepth );
yySavedParenDepth.push( yyParenDepth );
}
break;
case 'e':
yyCh = getChar();
if ( yyCh == 'l' ) {
// elif, else
if ( !yySavedBraceDepth.isEmpty() ) {
yyBraceDepth = yySavedBraceDepth.top();
yyParenDepth = yySavedParenDepth.top();
}
} else if ( yyCh == 'n' ) {
// endif
if ( !yySavedBraceDepth.isEmpty() ) {
yySavedBraceDepth.pop();
yySavedParenDepth.pop();
}
}
}
while ( isalnum(yyCh) || yyCh == '_' )
yyCh = getChar();
break;
case '/':
yyCh = getChar();
if ( yyCh == '/' ) {
do {
yyCh = getChar();
} while ( yyCh != EOF && yyCh != '\n' );
} else if ( yyCh == '*' ) {
bool metAster = FALSE;
bool metAsterSlash = FALSE;
while ( !metAsterSlash ) {
yyCh = getChar();
if ( yyCh == EOF ) {
fprintf( stderr,
"%s: Unterminated C++ comment starting at"
" line %d\n",
(const char *) yyFileName, yyLineNo );
yyComment[yyCommentLen] = '\0';
return Tok_Comment;