本文整理汇总了C++中WString::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ WString::Clear方法的具体用法?C++ WString::Clear怎么用?C++ WString::Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WString
的用法示例。
在下文中一共展示了WString::Clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Flush
void RichQtfParser::Flush() {
if(text.GetLength()) {
ASSERT(!istable);
paragraph.Cat(text, format);
text.Clear();
}
}
示例2: EndPart
void RichQtfParser::EndPart()
{
if(istable) {
if(paragraph.GetCount() == 0 && text.GetCount() == 0)
if(table.GetCount())
table.Top().text.CatPick(pick(tablepart));
else
target.CatPick(pick(tablepart));
else {
paragraph.part.Clear();
text.Clear();
}
}
else {
Flush();
bool b = paragraph.format.newpage;
if(breakpage)
paragraph.format.newpage = true;
if(table.GetCount())
table.Top().text.Cat(paragraph, target.GetStyles());
else
target.Cat(paragraph);
paragraph.part.Clear();;
paragraph.format.newpage = b;
SetFormat();
breakpage = false;
}
istable = false;
}
示例3: GenerateLine
// Generates a line of text rendered from this element
bool ElementTextDefault::GenerateLine(WString& line, int& line_length, float& line_width, int line_begin, float maximum_line_width, float right_spacing_width, bool trim_whitespace_prefix)
{
FontFaceHandle* font_face_handle = GetFontFaceHandle();
// Initialise the output variables.
line.Clear();
line_length = 0;
line_width = 0;
// Bail if we don't have a valid font face.
if (font_face_handle == NULL)
return true;
// Determine how we are processing white-space while formatting the text.
int white_space_property = GetProperty< int >(WHITE_SPACE);
bool collapse_white_space = white_space_property == WHITE_SPACE_NORMAL ||
white_space_property == WHITE_SPACE_NOWRAP ||
white_space_property == WHITE_SPACE_PRE_LINE;
bool break_at_line = maximum_line_width >= 0 &&
(white_space_property == WHITE_SPACE_NORMAL ||
white_space_property == WHITE_SPACE_PRE_WRAP ||
white_space_property == WHITE_SPACE_PRE_LINE);
bool break_at_endline = white_space_property == WHITE_SPACE_PRE ||
white_space_property == WHITE_SPACE_PRE_WRAP ||
white_space_property == WHITE_SPACE_PRE_LINE;
// Determine what (if any) text transformation we are putting the characters through.
int text_transform_property = GetProperty< int >(TEXT_TRANSFORM);
// Starting at the line_begin character, we generate sections of the text (we'll call them tokens) depending on the
// white-space parsing parameters. Each section is then appended to the line if it can fit. If not, or if an
// endline is found (and we're processing them), then the line is ended. kthxbai!
const word* token_begin = text.CString() + line_begin;
const word* string_end = text.CString() + text.Length();
while (token_begin != string_end)
{
WString token;
const word* next_token_begin = token_begin;
// Generate the next token and determine its pixel-length.
bool break_line = BuildToken(token, next_token_begin, string_end, line.Empty() && trim_whitespace_prefix, collapse_white_space, break_at_endline, text_transform_property);
int token_width = font_face_handle->GetStringWidth(token, line.Empty() ? 0 : line[line.Length() - 1]);
// If we're breaking to fit a line box, check if the token can fit on the line before we add it.
if (break_at_line)
{
if (!line.Empty() &&
(line_width + token_width > maximum_line_width ||
LastToken(next_token_begin, string_end, collapse_white_space, break_at_endline) && line_width + token_width > maximum_line_width - right_spacing_width))
{
return false;
}
}
// The token can fit on the end of the line, so add it onto the end and increment our width and length
// counters.
line += token;
line_length += (next_token_begin - token_begin);
line_width += token_width;
// Break out of the loop if an endline was forced.
if (break_line)
return false;
// Set the beginning of the next token.
token_begin = next_token_begin;
}
return true;
}