本文整理汇总了C++中qstring::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ qstring::clear方法的具体用法?C++ qstring::clear怎么用?C++ qstring::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qstring
的用法示例。
在下文中一共展示了qstring::clear方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HU_CenterMessage
//
// HU_CenterMessage
//
// haleyjd 04/27/04: rewritten to use qstring
//
void HU_CenterMessage(const char *s)
{
static qstring qstr(128);
int st_height = GameModeInfo->StatusBar->height;
qstr.clear();
// haleyjd 02/28/06: colored center message
if(centermsg_color)
{
qstr += centermsg_color;
centermsg_color = NULL;
}
qstr += s;
centermessage_widget.setMessage(qstr.constPtr(),
(SCREENWIDTH - V_FontStringWidth(hud_font, s)) / 2,
(SCREENHEIGHT - V_FontStringHeight(hud_font, s) -
((scaledwindow.height == SCREENHEIGHT) ? 0 : st_height - 8)) / 2,
leveltime + (message_timer * 35) / 1000);
// print message to console also
C_Printf("%s\n", s);
}
示例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);
}
示例3: startLump
//
// XLMapInfoParser::startLump
//
// Start parsing a new MAPINFO lump.
//
void XLMapInfoParser::startLump()
{
state = STATE_EXPECTCMD; // scanning for global command
globalKW = KW_NUMGLOBAL; // no current global keyword
curInfo = NULL; // not in a current info definition
kwd = NULL; // no current keyword data
mapName.clear();
}
示例4: E_CfgListToCommaString
//
// E_CfgListToCommaString
//
// Concatenates all values in a CFGF_LIST CFG_STR option into a single
// string of comma-delimited values.
//
void E_CfgListToCommaString(cfg_t *sec, const char *optname, qstring &output)
{
unsigned int numopts = cfg_size(sec, optname);
output.clear();
for(unsigned int i = 0; i < numopts; i++)
{
const char *str = cfg_getnstr(sec, optname, i);
if(str)
output += str;
size_t len = output.length();
if(i != numopts - 1 && len && output[len - 1] != ',')
output += ',';
}
}
示例5: find_var
bool idaapi find_var(cfuncptr_t cfunc, const qstring& vtbl_name, qstring &var_name)
{
var_name.clear();
obj_fint_t obj_find;
obj_find.vtbl_name = vtbl_name;
if (obj_find.vtbl_name.find("const ") == 0)
obj_find.vtbl_name.remove(0, 6);
// traverse the ctree structure
obj_find.apply_to(&cfunc->body, NULL);
if (!obj_find.bFound) {
logmsg(DEBUG, "Failed to find variable...\n");
return false;
}
var_name = obj_find.var_name;
reset_pointer_type(cfunc, var_name);
return true;
}
示例6: MakeCSVValue
static void MakeCSVValue(qstring &qstr, const char *input, bool comma)
{
qstr.clear() << '"' << input << '"';
if(comma)
qstr << ',';
}