本文整理汇总了C++中WString::Cat方法的典型用法代码示例。如果您正苦于以下问题:C++ WString::Cat方法的具体用法?C++ WString::Cat怎么用?C++ WString::Cat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WString
的用法示例。
在下文中一共展示了WString::Cat方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sMergeWith
static void sMergeWith(WString& dest, const wchar *delim, const WString& s)
{
if(s.GetLength()) {
if(dest.GetCount())
dest.Cat(delim);
dest.Cat(s);
}
}
示例2: GetText
WString RichPara::GetText() const
{
WString r;
for(int i = 0; i < part.GetCount(); i++)
if(part[i].IsText())
r.Cat(part[i].text);
else
r.Cat(127);
return r;
}
示例3: Cat
void RichQtfParser::Cat(int chr)
{
if(accesskey && ToUpper(ToAscii(chr)) == LOBYTE(accesskey)) {
Flush();
format.Underline(!format.IsUnderline());
text.Cat(chr);
Flush();
format.Underline(!format.IsUnderline());
accesskey = 0;
}
else if(chr >= ' ') {
text.Cat(chr);
}
}
示例4: 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);
}
}
示例5: SaveFormat
void RichTxt::SaveFormat(Formating& r, int p1, int p2, const RichStyles& style) const
{
Array<RichObject> dummy;
for(int i = p1; i <= p2; i++)
if(IsTable(i)) {
const RichTable& tab = part[i].Get<RichTable>();
for(int i = 0; i < tab.GetRows(); i++)
for(int j = 0; j < tab.GetColumns(); j++)
if(tab(i, j)) {
const RichTxt& txt = tab[i][j].text;
txt.SaveFormat(r, 0, txt.GetPartCount() - 1, style);
}
}
else {
RichPara pa = Get(i, style);
for(int i = 0; i < pa.GetCount(); i++) {
RichPara::Part& p = pa[i];
int q = p.GetLength();
p.field = Id();
p.object = RichObject();
WString h;
while(q) {
int c = min(q, 50000);
h.Cat(c + 32);
q -= c;
}
p.text = h;
}
r.styleid.Add(pa.format.styleid);
r.format.Add(pa.Pack(GetStyle(style, pa.format.styleid).format, dummy));
}
}
示例6: GetClipFiles
Vector<String> GetClipFiles(const String& data)
{
GuiLock __;
Vector<String> f;
if((unsigned)data.GetCount() < sizeof(sDROPFILES) + 2)
return f;
const sDROPFILES *df = (const sDROPFILES *)~data;
const char *s = ((const char *)df + df->offset);
if(df->unicode) {
const wchar *ws = (wchar *)s;
while(*ws) {
WString fn;
while(*ws)
fn.Cat(*ws++);
f.Add(fn.ToString());
ws++;
}
}
else
while(*s) {
String fn;
while(*s)
fn.Cat(*s++);
f.Add(fn.ToString());
s++;
}
return f;
}
示例7: WStringTutorial
void WStringTutorial()
{
/// .WString
/// String works with 8 bit characters. For 16-bit character encoding use `WString`. Both
/// classes are closely related and share most of interface methods. U++ also provides
/// conversions between `String` and `WString` and you can also use 8 bit string literals with
/// `WString`. Conversion is ruled by current default character set. Default value of default
/// character set is `CHARSET_UTF8`. This conversion is also used in `WString::ToString`,
/// e.g. when putting `WString` to log:
WString x = "characters 280-300: "; // you can assign 8-bit character literal to WString
for(int i = 280; i < 300; i++)
x.Cat(i);
DUMP(x);
/// `ToString` converts `WString` to `String`:
String y = x.ToString();
DUMP(y);
/// `ToWString` converts `String` to `WString`:
y.Cat(" (appended)"); // you can use 8-bit character literals in most WString operations
x = y.ToWString();
DUMP(x);
///
}
示例8: CopyRectSelection
WString LineEdit::CopyRectSelection()
{
WString txt;
Rect rect = GetRectSelection();
for(int i = rect.top; i <= rect.bottom; i++) {
int l, h;
CacheLinePos(i);
int pos = GetPos(i);
GetRectSelection(rect, i, l, h);
txt.Cat(GetWLine(i).Mid(l - pos, h - l));
#ifdef PLATFORM_WIN32
txt.Cat('\r');
#endif
txt.Cat('\n');
}
return txt;
}
示例9: Paint
virtual void Paint(Draw& w) {
WString h = "Hello ěščřžýáíéúů ";
for(int i = 0; i < 10; i++)
h.Cat(20000 + i);
w.DrawRect(GetSize(), White());
Font fnt;
fnt.FaceName("Bitstream Vera Sans Mono");
fnt.Height(13);
DoDrawText(w, 100, 100, 0, h, fnt, Black(), h.GetCount(), NULL);
DoDrawText(w, 100, 300, 300, h, fnt, Black(), h.GetCount(), NULL);
}
示例10: RemoveRectSelection
int LineEdit::RemoveRectSelection()
{
Rect rect = GetRectSelection();
WString txt;
for(int i = rect.top; i <= rect.bottom; i++) {
int l, h;
CacheLinePos(i);
GetRectSelection(rect, i, l, h);
WString s = GetWLine(i);
s.Remove(l - GetPos(i), h - l);
txt.Cat(s);
txt.Cat('\n');
}
int l = GetPos(rect.top);
int h = GetPos(rect.bottom) + GetLineLength(rect.bottom);
if(h < GetLength())
h++;
Remove(l, h - l);
Insert(l, txt);
return GetGPos(rect.bottom, rect.left);
}
示例11: GetPlainText
WString RichTxt::GetPlainText() const {
WString clip;
for(int pi = 0; pi < GetPartCount(); pi++) {
if(pi) {
clip.Cat('\r');
clip.Cat('\n');
}
if(IsTable(pi)) {
const RichTable& tab = part[pi].Get<RichTable>();
for(int i = 0; i < tab.GetRows(); i++)
for(int j = 0; j < tab.GetColumns(); j++)
if(tab(i, j)) {
if(i || j) {
clip.Cat('\r');
clip.Cat('\n');
}
clip << tab[i][j].text.GetPlainText();
}
}
else
clip.Cat(Get(pi, RichStyle::GetDefault()).GetText());
}
return clip;
}
示例12: if
Vector<WString> SplitCmdLine__(const char *cmd)
{
Vector<WString> out;
while(*cmd)
if((byte)*cmd <= ' ')
cmd++;
else if(*cmd == '\"') {
WString quoted;
while(*++cmd && (*cmd != '\"' || *++cmd == '\"'))
quoted.Cat(FromSystemCharset(String(cmd, 1)).ToWString());
out.Add(quoted);
}
else {
const char *begin = cmd;
while((byte)*cmd > ' ')
cmd++;
out.Add(String(begin, cmd).ToWString());
}
return out;
}
示例13: Parse
//.........这里部分代码省略.........
case '{': {
String cs = GetText('}');
if(cs.GetLength() == 1) {
int c = *cs;
if(c == '_')
format.charset = CHARSET_UTF8;
if(c >= '0' && c <= '8')
format.charset = c - '0' + CHARSET_WIN1250;
if(c >= 'A' && c <= 'Z')
format.charset = c - '0' + CHARSET_ISO8859_1;
}
else {
for(int i = 0; i < CharsetCount(); i++)
if(stricmp(CharsetName(i), cs) == 0) {
format.charset = i;
break;
}
}
break;
}
case '%': {
String h;
if(*term == '-') {
format.language = 0;
term++;
}
else
if(*term == '%') {
format.language = LNG_ENGLISH;
term++;
}
else {
while(*term && h.GetLength() < 5)
h.Cat(*term++);
format.language = LNGFromText(h);
}
break;
}
case 'g':
format.Face(Font::STDFONT);
format.Height(GetRichTextScreenStdFontHeight());
break;
default:
if(c >= '0' && c <= '9') {
format.Height(QTFFontHeight[c - '0']);
break;
}
switch(c) {
case ':': format.label = GetText(':'); break;
case '<': format.align = ALIGN_LEFT; break;
case '>': format.align = ALIGN_RIGHT; break;
case '=': format.align = ALIGN_CENTER; break;
case '#': format.align = ALIGN_JUSTIFY; break;
case 'l': format.lm = GetNumber(); break;
case 'r': format.rm = GetNumber(); break;
case 'i': format.indent = GetNumber(); break;
case 'b': format.before = GetNumber(); break;
case 'a': format.after = GetNumber(); break;
case 'P': format.newpage = !format.newpage; break;
case 'k': format.keep = !format.keep; break;
case 'K': format.keepnext = !format.keepnext; break;
case 'H': format.ruler = GetNumber(); break;
case 'h': format.rulerink = GetColor(); break;
case 'L': format.rulerstyle = GetNumber(); break;
case 'Q': format.orphan = !format.orphan; break;
case 'n': format.before_number = GetText(';'); break;