本文整理汇总了C++中wxString::Freq方法的典型用法代码示例。如果您正苦于以下问题:C++ wxString::Freq方法的具体用法?C++ wxString::Freq怎么用?C++ wxString::Freq使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxString
的用法示例。
在下文中一共展示了wxString::Freq方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoGetBestSize
wxSize wxGridCellStringRenderer::DoGetBestSize(const wxGridCellAttr& attr,
wxDC& dc,
const wxString& text)
{
wxCoord x = 0, y = 0, max_x = 0;
dc.SetFont(attr.GetFont());
wxStringTokenizer tk(text, wxT('\n'));
while ( tk.HasMoreTokens() )
{
dc.GetTextExtent(tk.GetNextToken(), &x, &y);
max_x = wxMax(max_x, x);
}
y *= 1 + text.Freq(wxT('\n')); // multiply by the number of lines.
return wxSize(max_x, y);
}
示例2: HasBrokenInString
bool CRCppEmitter::HasBrokenInString (const wxString &line) const
{
int freq = line.Freq ('"');
return (freq % 2 == 1);
}
示例3: ParseEntry
void DebuggerTree::ParseEntry(WatchTreeEntry& entry, Watch* watch, wxString& text, long array_index)
{
if (text.IsEmpty())
return;
// Manager::Get()->GetLogManager()->DebugLog(F(_T("DebuggerTree::ParseEntry(): %s"), text.c_str()));
while (1)
{
// trim the string from left and right
text.Trim(true);
text.Trim(false);
// find position of '{', '}' and ',' ***outside*** of any quotes.
// decide which is nearer to the start
int braceOpenPos = FindCharOutsideQuotes(text, _T('{'));
if (braceOpenPos == -1) braceOpenPos = 0xFFFFFE;
int braceClosePos = FindCharOutsideQuotes(text, _T('}'));
if (braceClosePos == -1) braceClosePos = 0xFFFFFE;
int commaPos = FindCommaPos(text);
if (commaPos == -1) commaPos = 0xFFFFFE;
int pos = std::min(commaPos, std::min(braceOpenPos, braceClosePos));
if (pos == 0xFFFFFE)
{
// no comma, opening or closing brace
if (text.Right(3).Matches(_T(" = ")))
text.Truncate(text.Length() - 3);
if (!text.IsEmpty())
{
entry.AddChild(text, watch);
text.Clear();
}
break;
}
else
{
// display array on a single line?
// normal (multiple lines) display is taken care below, with array indexing
if (watch &&
watch->is_array &&
braceOpenPos != 0xFFFFFE &&
braceClosePos != 0xFFFFFE)
{
wxString tmp = text.Left(braceClosePos + 1);
// if more than one opening/closing brace, then it's a complex array so
// ignore single-line
if (text.Freq(_T('{')) == 1 && text.Freq(_T('}')) == 1)
{
// array on single line for up to 8 (by default) elements
// if more elements, fall through to the multi-line display
int commas = Manager::Get()->GetConfigManager(_T("debugger"))->ReadInt(_T("/single_line_array_elem_count"), 8);
if (tmp.Freq(_T(',')) < commas)
{
// array watch type
tmp[braceOpenPos] = _T('[');
tmp.Last() = _T(']');
entry.AddChild(tmp, watch);
text.Remove(0, braceClosePos + 1);
continue;
}
}
}
wxString tmp = text.Left(pos);
WatchTreeEntry* newchild = 0;
if (tmp.Right(3).Matches(_T(" = ")))
tmp.Truncate(tmp.Length() - 3); // remove " = " if last in string
if (!tmp.IsEmpty())
{
// take array indexing into account (if applicable)
if (array_index != -1)
{
tmp.Prepend(wxString::Format(_T("[%ld]: "), array_index));
// if array element would occur multiple times, gdb adds as default "<repeated xx times> to the output
// so we have to look for it and increase the array_index correctly
// as default we increase by 1
long incIndex = 1;
if (reRepeatedElements.Matches(tmp))
{
reRepeatedElements.GetMatch(tmp, 1).ToLong(&incIndex);
}
array_index += incIndex;
}
newchild = &entry.AddChild(tmp, watch);
}
text.Remove(0, pos + 1);
if (pos == braceOpenPos)
{
if (!newchild)
newchild = &entry;
// enable array indexing (if applicable)
bool no_indexing = array_index == -1;
if (watch && watch->is_array && no_indexing &&
text.Freq(_T('{')) == 0 && text.Freq(_T('}')) == 1) // don't index complex arrays
{
array_index = 0;
}
//.........这里部分代码省略.........