本文整理汇总了C++中WString::End方法的典型用法代码示例。如果您正苦于以下问题:C++ WString::End方法的具体用法?C++ WString::End怎么用?C++ WString::End使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WString
的用法示例。
在下文中一共展示了WString::End方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Copy
void RichTextView::Copy()
{
if(anchor == cursor)
WriteClipboardUnicodeText(text.GetPlainText());
else {
RefreshSel();
WString h = text.GetPlainText(false).Mid(sell, selh - sell);
WString r;
for(const wchar *s = ~h; s < h.End(); s++) {
if(*s == '\n')
r.Cat('\r');
r.Cat(*s);
}
WriteClipboardUnicodeText(r);
}
}
示例2: GetPos
int LineEdit::GetGPos(int ln, int cl) const {
ln = minmax(ln, 0, line.GetCount() - 1);
WString txt = line[ln];
const wchar *b = txt;
const wchar *e = txt.End();
const wchar *s = b;
int gl = 0;
while(s < e) {
if(*s == '\t')
gl = (gl + tabsize) / tabsize * tabsize;
else
gl += 1 + IsCJKIdeograph(*s);
if(cl < gl) break;
s++;
}
return GetPos(ln, int(s - b));
}
示例3: operator
virtual bool operator()(int pos, const RichPara& para)
{
WString ptext = para.GetText();
if(pos + ptext.GetLength() > cursor && ptext.GetLength() >= len) {
const wchar *q = ptext;
const wchar *e = ptext.End() - len;
if(cursor >= pos)
q += cursor - pos;
while(q <= e) {
if(compare3(q, upperw, lowerw, len) &&
(!ww || (q + len == e || !IsLetter(q[len])) &&
(q == ptext || !IsLetter(q[-1])))) {
fpos = int(q - ~ptext + pos);
return true;
}
q++;
}
}
return false;
}
示例4: SetHBar
void LineEdit::SetHBar()
{
int mpos = 0;
if(!nohbar && !isdrag) {
int m = min(sb.y + sb.GetPage().cy + 2, line.GetCount());
for(int i = sb.y; i < m; i++) {
int pos = 0;
WString l = line[i];
const wchar *s = l;
const wchar *e = l.End();
while(s < e) {
if(*s == '\t')
pos = (pos + tabsize) / tabsize * tabsize;
else
pos += 1 + IsCJKIdeograph(*s);
s++;
}
mpos = max(mpos, pos);
}
}
sb.SetTotalX(mpos + 1);
}
示例5: ScanSyntax
CodeEditor::SyntaxState CodeEditor::ScanSyntax(int line) {
SyntaxState st;
for(int i = 0; i < 4; i++)
if(line >= scache[i].line) {
st = scache[i];
break;
}
if(st.macro != SyntaxState::MACRO_CONT)
st.macro = SyntaxState::MACRO_OFF;
line = min(line, GetLineCount());
while(st.line < line) {
if(st.macro != SyntaxState::MACRO_CONT)
st.macro = SyntaxState::MACRO_OFF;
WString l = GetWLine(st.line);
st.ScanSyntax(l, l.End(), GetTabSize());
st.line++;
static int d[] = { 0, 100, 2000 };
for(int i = 0; i < 3; i++)
if(st.line == cline - d[i])
scache[i] = st;
}
scache[3] = st;
return st;
}
示例6: GetPos
int LineEdit::GetGPos(int ln, int cl) const {
ln = minmax(ln, 0, line.GetCount() - 1);
const String& stxt = line[ln].text;
const char *s = stxt;
const char *e = stxt.End();
const char *b = s;
int gl = 0;
int wpos = 0;
while(s < e) {
if(*s == '\t')
gl = (gl + tabsize) / tabsize * tabsize;
else
if((byte)*s < 128)
gl++;
else {
WString txt = FromUtf8(s, int(e - s));
const wchar *b = txt;
const wchar *e = txt.End();
const wchar *s = b;
while(s < e) {
if(*s == '\t')
gl = (gl + tabsize) / tabsize * tabsize;
else
gl += 1 + IsCJKIdeograph(*s);
if(cl < gl) break;
s++;
}
wpos = int(s - b);
break;
}
if(cl < gl) break;
s++;
}
return GetPos(ln, int(s - b) + wpos);
}
示例7: DrawFileName
void DrawFileName(Draw& ww, int x0, int y, int wcx0, int cy, const WString& mname, bool isdir, Font font,
Color ink, Color extink, const WString& desc, Font descfont, bool justname, Color uln)
{
for(int pass = IsNull(uln); pass < 2; pass++) {
NilDraw nd;
Draw *w = pass ? &ww : &nd;
FontInfo fi = font.Info();
int extpos = (isdir ? -1 : mname.ReverseFind('.'));
int slash = isdir ? -1 : max(mname.ReverseFind('\\'), mname.ReverseFind('/'));
if(extpos < slash)
extpos = -1;
const wchar *ext = extpos >= slash && extpos >= 0 ? mname.Begin() + extpos + 1
: mname.End();
const wchar *name = mname;
if(justname && slash >= 0)
name += slash + 1;
int txtcx = GetTextSize(fi, name);
int x = x0;
int wcx = wcx0;
if(txtcx <= wcx) {
if(pass == 0)
ww.DrawRect(x0, y + fi.GetAscent() + 1, txtcx, 1, uln);
ww.DrawText(x, y, name, font, ink, (int)(ext - name));
ww.DrawText(x + GetTextSize(fi, name, ext), y, ext, font, extink, (int)(mname.End() - ext));
if(!IsEmpty(desc) && pass)
DrawTextEllipsis(ww, x + fi.GetHeight(), y, wcx - txtcx,
desc, "...", descfont, extink);
x += txtcx;
return;
}
else {
int dot3 = 3 * fi['.'];
if(2 * dot3 > wcx) {
int n = GetTextFitCount(fi, name, wcx);
w->DrawText(x, y, name, font, ink, n);
x += GetTextSize(fi, name, name + n);
}
else {
const wchar *end = mname.End();
int dircx = 2 * fi['.'] + fi[DIR_SEP];
const wchar *bk = strdirsep(name);
if(bk) {
wcx -= dircx;
w->DrawText(x, y, ".." DIR_SEPS, font, SColorDisabled, 3);
x += dircx;
do {
txtcx -= GetTextSize(fi, name, bk + 1);
name = bk + 1;
if(txtcx < wcx) {
w->DrawText(x, y, name, font, ink, (int)(ext - name));
x += GetTextSize(fi, name, ext);
w->DrawText(x, y, ext, font, extink, (int)(end - ext));
x += GetTextSize(fi, ext, end);
goto end;
}
bk = strdirsep(name);
}
while(bk);
}
wcx -= dot3;
int extcx = GetTextSize(fi, ext, end);
if(2 * extcx > wcx || ext == end) {
int n = GetTextFitCount(fi, name, wcx);
w->DrawText(x, y, name, font, ink, n);
x += GetTextSize(fi, name, name + n);
w->DrawText(x, y, "...", font, SColorDisabled, 3);
x += dot3;
}
else {
wcx -= extcx;
int n = (int)(GetTextFitLim(fi, name, end, wcx) - name);
w->DrawText(x, y, name, font, ink, n);
x += GetTextSize(fi, name, name + n);
w->DrawText(x, y, "...", font, SColorDisabled, 3);
w->DrawText(x + dot3, y, ext, font, extink, (int)(end - ext));
x += dot3 + extcx;
}
}
}
end:
if(pass == 0)
ww.DrawRect(x0, y + fi.GetAscent() + 1, x - x0, 1, uln);
}
}
示例8: GetTextFitCount
int GetTextFitCount(const FontInfo& fi, const WString& s, int& cx) {
return (int)(GetTextFitLim(fi, s, s.End(), cx) - s.Begin());
}
示例9: GetTextSize
int GetTextSize(const FontInfo& fi, const WString& text) {
return GetTextSize(fi, text, text.End());
}