本文整理汇总了C++中WString::ToString方法的典型用法代码示例。如果您正苦于以下问题:C++ WString::ToString方法的具体用法?C++ WString::ToString怎么用?C++ WString::ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WString
的用法示例。
在下文中一共展示了WString::ToString方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: AppendClipboardUnicodeText
void AppendClipboardUnicodeText(const WString& s)
{
#ifndef PLATFORM_WINCE
AppendClipboardText(s.ToString());
#endif
AppendClipboard("wtext", (byte *)~s, 2 * s.GetLength());
}
示例3: 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);
///
}
示例4: GetTextClip
String GetTextClip(const WString& text, const String& fmt)
{
if(fmt == "text")
return text.ToString();
if(fmt == "wtext")
return Unicode__(text);
return Null;
}
示例5: CutLine
void LineEdit::CutLine()
{
if(IsReadOnly()) return;
int b, e;
if(GetSelection(b, e) && GetLine(b) != GetLine(e)) {
Cut();
return;
}
int i = GetLine(cursor);
int p = GetPos(i);
WString txt = Get(p, line[i].GetLength() + 1).ToWString();
WriteClipboardUnicodeText(txt);
AppendClipboardText(txt.ToString());
ClearSelection();
DeleteLine();
}
示例6: sCommentLines
static WString sCommentLines(const WString& s)
{
String r;
StringStream ss(s.ToString());
for(;;) {
String line = ss.GetLine();
if(ss.IsError())
return s;
else
if(!line.IsVoid())
r << "//" << line << "\n";
if(ss.IsEof())
break;
}
return r.ToWString();
}
示例7: ScanFile
void VfkStream::ScanFile(int fx)
{
RTIMING("VfkStream::ScanFile");
Stream& strm = streams[fx];
int64 last_line = strm.GetSize();
while(last_line > 0) {
strm.Seek(last_line - 1);
if(strm.Get() == '\n')
break;
last_line--;
}
strm.Seek(0);
try {
int c;
int64 rowpos = strm.GetPos();
while((c = strm.Get()) == '&' && ((c = strm.Get()) == 'H' || c == 'D') && IsAlpha(strm.Term())) {
char type = c;
int64 begin = strm.GetPos();
SkipRow(strm);
rowpos = strm.GetPos();
int len = (int)(strm.GetPos() - begin);
StringBuffer linebuf(len + 1);
strm.Seek(begin);
strm.Get(linebuf, len);
linebuf[len] = 0;
const char *b = linebuf;
const char *id = b;
while(IsIdent(*++b))
;
String ident(id, b);
if(*b++ != ';')
throw Exc(NFormat("';' expected after '%s' (found: '%c', %2:02x)", ident, *b));
if(type == 'D') {
String fident = "X_" + ident;
int f = tables.Find(fident);
if(f < 0)
throw Exc(NFormat("unexpected data for filter table '%s'", ident));
// b = ScanRow(b, tables[f]);
}
else if(IsAlpha(*b)) {
String fident = "X_" + ident;
Table& tbl = tables.GetAdd(fident);
tbl.name = tbl.rawname = fident;
tbl.row_count = 0;
ScanHeader(b, tbl);
}
else {
do {
Vector<Value> row;
row.SetCount(HDR_COUNT);
if(*b == '\"') {
WString text = ReadString(b, &b);
if(IsDateTime(ident) && !IsNull(text)) {
Time dt = VfkReadTime(text.ToString(), NULL);
if(IsNull(dt))
throw Exc(NFormat("invalid date/time value %s", AsCString(text.ToString())));
row[HDR_DTM] = dt;
}
else {
row[HDR_STR] = text;
if(ident == "CODEPAGE")
if(text == WString("EE8MSWIN1250")) charset = CHARSET_WIN1250;
}
}
else {
double num = ScanDouble(b, &b);
if(IsNull(num))
throw Exc("invalid numeric value");
row[HDR_NUM] = num;
}
int l = header.FindLast(ident);
row[HDR_ID] = ident;
row[HDR_ORD] = (l >= 0 ? (int)header[l][HDR_ORD] + 1 : 0);
header.Add(ident) = row;
}
while(*b++ == ';');
b--;
}
}
strm.Seek(rowpos);
while(strm.Get() == '&' && strm.Get() == 'B' && IsAlpha(strm.Term())) {
int64 header_offset = strm.GetPos();
SkipRow(strm);
int64 begin_offset = strm.GetPos();
int len = (int)(begin_offset - header_offset);
Buffer<char> linebuf(len + 1);
strm.Seek(header_offset);
strm.Get(linebuf, len);
linebuf[len] = 0;
const char *b = linebuf;
const char *id = b;
while(IsIdent(*++b))
;
int idlen = b - id;
String ident(id, b);
if(*b++ != ';')
throw Exc(NFormat("';' expected after '%s' (found: '%c', %2:02x)", ident, *b));
String name = ident;
for(const VFKLongName *ln = vfk_long_names; ln->shortname; ln++)
if(name == ln->shortname) {
//.........这里部分代码省略.........
示例8: sCString
static WString sCString(const WString& s)
{
return AsCString(s.ToString()).ToWString();
}
示例9: IsNumber
bool PythonSyntax::IsNumber(const WString& w)
{
RegExp exp("^-?[0-9]+$");
return exp.Match(w.ToString());
}
示例10: IsKeyword
bool PythonSyntax::IsKeyword(const WString& w)
{
return keywords.Find(w.ToString()) > -1;
}
示例11: IsSpecialVar
bool PythonSyntax::IsSpecialVar(const WString& w)
{
return specialVars.Find(w.ToString()) > -1;
}
示例12: InsertFile
void FileTabs::InsertFile(int ix, const WString &file, bool make_active)
{
InsertFile(ix, file, NativePathIcon(file.ToString()), make_active);
}
示例13: AddFile
void FileTabs::AddFile(const WString &file, bool make_active)
{
AddFile(file, NativePathIcon(file.ToString()), make_active);
}
示例14: RenameFile
void FileTabs::RenameFile(const WString &from, const WString &to, Image icon)
{
int n = FindKey(from);
if (n >= 0)
Set(n, to, GetFileName(to.ToString()), IsNull(icon) ? NativePathIcon(to.ToString()) : icon);
}