本文整理汇总了C++中qstring::constPtr方法的典型用法代码示例。如果您正苦于以下问题:C++ qstring::constPtr方法的具体用法?C++ qstring::constPtr怎么用?C++ qstring::constPtr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qstring
的用法示例。
在下文中一共展示了qstring::constPtr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doStateExpectKeyword
// Expecting a MapInfo keyword
bool XLEMapInfoParser::doStateExpectKeyword(XLTokenizer &tokenizer)
{
int tokenType = tokenizer.getTokenType();
switch(tokenType)
{
case XLTokenizer::TOKEN_BRACKETSTR:
// if we find a bracketed string instead, it's actually the start of a new
// section; process it through the header state handler immediately
return doStateExpectHeader(tokenizer);
case XLTokenizer::TOKEN_KEYWORD:
case XLTokenizer::TOKEN_STRING:
// record as the current key and expect potential = to follow
key = tokenizer.getToken();
value = "";
state = STATE_EXPECTEQUAL;
if(E_StrToNumLinear(multiValKeywords, MVKW_NUMKEYWORDS, key.constPtr()) != MVKW_NUMKEYWORDS)
allowMultiValue = true;
else
allowMultiValue = false;
break;
default:
// if we see anything else, keep scanning
break;
}
return true;
}
示例2: WriteCenteredText
//
// WriteCenteredText
//
// Local routine to draw centered messages. Candidate for
// absorption into future generalized font code. Rewritten
// 02/22/04 to use qstring module.
//
static void WriteCenteredText(char *message)
{
static qstring qstr;
char *rover;
const char *buffer;
int x, y;
int w, h;
qstr.clearOrCreate(128);
// rather than reallocate memory every time we draw it,
// use one buffer and increase the size as neccesary
// haleyjd 02/22/04: qstring handles this for us now
w = V_FontStringWidth(menu_font_normal, popup_message);
h = V_FontStringHeight(menu_font_normal, popup_message);
x = (SCREENWIDTH - w) / 2;
y = (SCREENHEIGHT - h) / 2;
qstr.clear();
rover = message;
if(popup_widget.prev) // up over another widget?
V_DrawBox(x - 8, y - 8, w + 16, h + 16);
while(*rover)
{
if(*rover == '\n')
{
buffer = qstr.constPtr();
x = (SCREENWIDTH - V_FontStringWidth(menu_font_normal, buffer)) / 2;
V_FontWriteText(menu_font_normal, buffer, x, y, &subscreen43);
qstr.clear(); // clear buffer
y += menu_font_normal->absh; // next line
}
else // add next char
qstr += *rover;
++rover;
}
// dont forget the last line.. prob. not \n terminated
buffer = qstr.constPtr();
x = (SCREENWIDTH - V_FontStringWidth(menu_font_normal, buffer)) / 2;
V_FontWriteText(menu_font_normal, buffer, x, y, &subscreen43);
}