本文整理汇总了C++中String::Cat方法的典型用法代码示例。如果您正苦于以下问题:C++ String::Cat方法的具体用法?C++ String::Cat怎么用?C++ String::Cat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String
的用法示例。
在下文中一共展示了String::Cat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VFKParsePolvz
static String VFKParsePolvz(const char *text)
{
for(; *text; text++)
if(text[0] == 'P' && text[1] == 'O' && text[2] == 'L' && text[3] == 'V' && text[4] == 'Z' && text[5] == ':') {
text += 6;
while(*text && (byte)*text <= ' ')
text++;
const char *b = text;
bool slash = false;
while(*text && (byte)*text > ' ')
if(*text++ == '/')
slash = true;
String out;
int len = text - b;
if(slash || len <= 4)
out = String(b, text);
else {
out.Cat(b, len - 4);
out.Cat('/');
out.Cat(text - 4, 4);
}
return out;
}
return Null;
}
示例2: Load
void TextSettings::Load(const char *filename)
{
FileIn in(filename);
int themei = 0;
settings.Add("");
while(!in.IsEof()) {
String ln = in.GetLine();
const char *s = ln;
if(*s == '[') {
s++;
String theme;
while(*s && *s != ']')
theme.Cat(*s++);
themei = settings.FindAdd(theme);
}
else {
if(themei >= 0) {
String key;
while(*s && *s != '=') {
key.Cat(*s++);
}
if(*s == '=') s++;
String value;
while(*s) {
value.Cat(*s++);
}
if(!IsEmpty(key))
settings[themei].GetAdd(TrimBoth(key)) = TrimBoth(value);
}
}
}
}
示例3: if
bool ODBCPerformScript(const String& text, StatementExecutor& executor, Gate2<int, int> progress_canceled)
{
const char *p = text;
while(*p) {
String cmd;
while(*p && *p != ';')
if(*p == '\'') {
const char *s = p;
while(*++p && (*p != '\'' || *++p == '\''))
;
cmd.Cat(s, int(p - s));
}
else {
if(*p > ' ')
cmd.Cat(*p);
else if(!cmd.IsEmpty() && *cmd.Last() != ' ')
cmd.Cat(' ');
p++;
}
if(progress_canceled(int(p - text.Begin()), text.GetLength()))
return false;
if(!IsNull(cmd) && !executor.Execute(cmd))
return false;
if(*p == ';')
p++;
}
return true;
}
示例4: BenchNTL
void BenchNTL(const char *file, Stream& out) {
FileIn in(file);
if (!in) {
out << "Cannot open input file.\n";
return;
}
C map;
for(;;) {
int c = in.Get();
if(c < 0) break;
if(IsAlpha(c) || c == '_') {
String id;
id.Cat(c);
c = in.Get();
while(c >= 0 && (IsAlNum(c) || c == '_')) {
id.Cat(c);
c = in.Get();
}
map.GetAdd(id, 0)++;
}
else
if(IsDigit(c))
do c = in.Get();
while(c >= 0 && (IsAlNum(c) || c == '.'));
}
for(int i = 0; i < map.GetCount(); i++)
out << ~map.GetKey(i) << ": " << map[i] << '\n';
}
示例5: GetAddFileName
String DocDir::GetAddFileName(const String& package, const DocKey& key, int type)
{
Entry& w = dir.GetAdd(package).GetAdd(key);
String& fn = w.text;
w.type = type;
if(!IsEmpty(fn)) return fn;
String nm = key.nameing + '_' + key.nesting + '_' + key.item;
String n;
const char *s = nm;
while(*s && n.GetLength() < 30)
if(iscid(*s))
n.Cat(*s++);
else {
n.Cat('_');
while(*s && !iscid(*s))
s++;
}
n << '_' << LNGAsText(key.lang);
int i = 0;
for(;;) {
fn = n + FormatIntAlpha(i) + ".dpp";
if(!FindFile(DocFile(package, fn)))
return fn;
i++;
}
}
示例6: BenchNTL2
void BenchNTL2(const char *file, Stream& out) {
FileIn in(file);
if (!in) {
out << "Cannot open input file.\n";
return;
}
VectorMap<String, int> map;
for(;;) {
int c = in.Get();
if(c < 0) break;
if(IsAlpha(c) || c == '_') {
String id;
id.Cat(c);
c = in.Get();
while(c >= 0 && (IsAlNum(c) || c == '_')) {
id.Cat(c);
c = in.Get();
}
map.GetAdd(id, 0)++;
}
else
if(IsDigit(c))
do c = in.Get();
while(c >= 0 && (IsAlNum(c) || c == '.'));
}
Vector<int> order = GetSortOrder(map.GetKeys());
for(int i = 0; i < order.GetCount(); i++)
out << ~map.GetKey(order[i]) << ": " << map[order[i]] << '\n';
}
示例7: ParseUnquotedString
// we can hava a non-quoted string... so we read up
// to terminator, which can be '}', ']' or ','
int MIValue::ParseUnquotedString(String const &s, int i)
{
String valStr;
int aCount = 0;
bool inQuote = false;
while(s[i] && ((s[i] != '=' && s[i] != '}' && s[i] != ']' && !comma(s, i)) || inQuote || aCount))
{
valStr.Cat(s[i]);
if(s[i] == '\\')
{
i++;
if(s[i])
valStr.Cat(s[i++]);
continue;
}
if(s[i] == '<' && !inQuote)
aCount++;
else if(s[i] == '>' && !inQuote)
aCount--;
else if(s[i] == '"' && !aCount)
inQuote = !inQuote;
i++;
}
type = MIString;
string = valStr;
return i;
}
示例8: DeAmp
String DeAmp(const char *s)
{
String out;
for(; *s; out.Cat(*s++))
if(*s == '&')
out.Cat('&');
return out;
}
示例9: sMergeWith
static void sMergeWith(String& dest, const char *delim, const String& s)
{
if(s.GetLength()) {
if(dest.GetCount())
dest.Cat(delim);
dest.Cat(s);
}
}
示例10: QualifyIds
String QualifyIds(ScopeInfo& nf, const String& k, const String& usings, bool all)
{
LTIMING("QualifyIds");
String r;
const char *s = k;
Vector<String> empty;
while(*s) {
int c = *s;
if(c == ':') {
const char *b = s++;
while(*s == ':' || iscid(*s)) s++;
/* if(all) {
if(iscid(*r.Last()))
r << ' ';
ScopeInfo nnf(nf.GetScope(), nf.base);
Qualify(r, nnf, b, s, usings);
}
else*/
r.Cat(b, s);
}
else
if(iscid(c)) {
if(iscid(*r.Last()))
r << ' ';
if(s[0] == 'c' && s[1] == 'o' && s[2] == 'n' && s[3] == 's' && s[4] == 't' && !iscid(s[5])) {
r << s_const;
s += 5;
}
else
if(s[0] == 'm' && s[1] == 'u' && s[2] == 't' && s[3] == 'a' && s[4] == 'b' && s[5] == 'l' && s[6] == 'e' && !iscid(s[7])) {
r << "mutable";
s += 7;
}
else
if(s[0] == 'v' && s[1] == 'o' && s[2] == 'l' && s[3] == 'a' && s[4] == 't' && s[5] == 'i' && s[6] == 'l' && s[7] == 'e' && !iscid(s[8])) {
r << "volatile";
s += 8;
}
else {
const char *b = s++;
while(*s == ':' || iscid(*s)) s++;
if(all)
Qualify(r, nf, b, s, usings);
else
r.Cat(b, s);
}
}
else {
if(c == '(')
all = true;
if(c != ' ')
r.Cat(c);
s++;
}
}
return r;
}
示例11: Gather
String Gather(const Array<OptItem>& set, const Vector<String>& conf, bool nospace) {
String s;
for(int i = 0; i < set.GetCount(); i++)
if(MatchWhen(set[i].when, conf)) {
if(!nospace && !s.IsEmpty()) s.Cat(' ');
s.Cat(set[i].text);
}
return s;
}
示例12: AlphaToRLE
String AlphaToRLE(const Image& aa)
{
String result;
for(int y = 0; y < aa.GetHeight(); y++) {
result.Cat(PackRLE(aa[y], aa.GetWidth()));
result.Cat(0x80);
}
return result;
}
示例13: Create
bool WinMetaFileDraw::Create(HDC hdc, int cx, int cy, const char *app, const char *name, const char *file) {
if(handle) Close();
String s;
if(app) s.Cat(app);
s.Cat('\0');
if(name) s.Cat(name);
s.Cat('\0');
bool del = false;
if(!hdc) {
hdc = ::GetWindowDC((HWND) NULL);
del = true;
}
size = Size(iscale(cx, 2540, 600), iscale(cy, 2540, 600));
Rect r = size;
HDC mfdc = ::CreateEnhMetaFile(hdc, file, r, name || app ? (const char *)s : NULL);
if(!mfdc)
return false;
Size px(max(1, ::GetDeviceCaps(mfdc, HORZRES)), max(1, ::GetDeviceCaps(mfdc, VERTRES)));
Size mm(max(1, ::GetDeviceCaps(mfdc, HORZSIZE)), max(1, ::GetDeviceCaps(mfdc, VERTSIZE)));
Attach(mfdc);
Init();
pixels = false;
::SetMapMode(handle, MM_ANISOTROPIC);
::SetWindowOrgEx(handle, 0, 0, 0);
::SetWindowExtEx(handle, 600, 600, 0);
::SetViewportOrgEx(handle, 0, 0, 0);
::SetViewportExtEx(handle, px.cx * 254 / (10 * mm.cx), px.cy * 254 / (10 * mm.cy), 0);
::SelectClipRgn(mfdc, NULL);
::IntersectClipRect(mfdc, 0, 0, cx, cy);
if(del) {
::ReleaseDC((HWND) NULL, hdc);
hdc = NULL;
}
actual_offset = Point(0, 0);
printer = false;
pixels = false;
actual_offset = Point(0, 0);
device = -1;
aborted = false;
palette = false;
backdraw = true;
return true;
}
示例14: CatAnyPath
String CatAnyPath(String path, const char *more)
{
if(!more || !*more)
return path;
if(!path.IsEmpty() && *path.Last() != '\\' && *path.Last() != '/' &&
*more != '\\' && *more != '/')
#ifdef PLATFORM_WIN32
path.Cat('\\');
#else
path.Cat('/');
#endif
path.Cat(more);
return path;
}
示例15: NormalizePath
String NormalizePath(const char *path, const char *currdir)
{
String join_path;
if(!IsFullPath(path))
path = join_path = AppendFileName(currdir, path);
String out;
if(*path && path[1] == ':') {
out << path[0] << ":\\";
path += 3;
}
else
if(path[0] == '\\' && path[1] == '\\') {
out = "\\\\";
path += 2;
}
else
if(sDirSep(*path)) {
if(*currdir)
out << *currdir << ':';
out.Cat(DIR_SEP);
path++;
}
int outstart = out.GetLength();
while(*path) {
if(sDirSep(*path)) {
while(sDirSep(*path))
path++;
if(*path == '\0')
break;
if(out.IsEmpty() || *out.Last() != DIR_SEP)
out.Cat(DIR_SEP);
}
const char *b = path;
while(*path && !sDirSep(*path))
path++;
if(path - b == 1 && *b == '.')
; //no-op
else if(path - b == 2 && *b == '.' && b[1] == '.') {
const char *ob = ~out + outstart, *oe = out.End();
if(oe - 1 > ob && oe[-1] == DIR_SEP)
oe--;
while(oe > ob && oe[-1] != DIR_SEP)
oe--;
out.Trim((int)(oe - out.Begin()));
}
else
out.Cat(b, (int)(path - b));
}
return out;
}