本文整理汇总了C++中StringBuffer::Cat方法的典型用法代码示例。如果您正苦于以下问题:C++ StringBuffer::Cat方法的具体用法?C++ StringBuffer::Cat怎么用?C++ StringBuffer::Cat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringBuffer
的用法示例。
在下文中一共展示了StringBuffer::Cat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: String
Report& InvoiceFormatter::formatFullInvoice(InvoiceData& invoice) {
output.Clear();
output.Header(String("[A0> ") + String(t_("Page")) + String(" $$P]"));
StringBuffer buf;
buf.Cat("{{1f4 ");
formatHeader(buf, invoice);
buf.Cat(":: ");
formatCompanyData(buf);
buf.Cat(":: ");
formatClientData(buf, invoice);
buf.Cat(":: ");
formatPatientData(buf, invoice);
buf.Cat(":: ");
formatInvoiceItems(buf, invoice);
buf.Cat("}}");
if (!AsString(invoice.payed_date).IsEmpty() && lang != LANG_CZ)
{
buf.Cat("&&&&");
buf.Cat("{{1f4 ");
formatBillHeader(buf, invoice, false);
buf.Cat(":: ");
formatBillPrice(buf, invoice);
buf.Cat("}}");
}
output << ~buf;
return output;
}
示例2: Ent
void XmlParser::Ent(StringBuffer& out)
{
int outconst = 0;
const char *t = ++term;
if(*t == '#') {
if(*++t == 'X' || *t == 'x') {
for(byte c; (c = ctoi(*++t)) < 16; outconst = 16 * outconst + c)
;
}
else {
while(IsDigit(*t))
outconst = 10 * outconst + *t++ - '0';
}
out.Cat(ToUtf8(outconst));
if(*t == ';')
t++;
term = t;
return;
}
const char *b = t;
while(*t && *t != ';')
t++;
if(*t == ';') {
int q = entity.Find(String(b, t));
if(q >= 0) {
out.Cat(entity[q]);
term = t + 1;
return;
}
}
out.Cat('&');
}
示例3: PackImlData
String PackImlData(const Vector<Image>& image)
{
StringBuffer block;
for(int i = 0; i < image.GetCount(); i++) {
const Image& img = image[i];
StringStream ss;
ss.Put(img.GetResolution() << 6);
Size sz = img.GetSize();
ss.Put16le(sz.cx);
ss.Put16le(sz.cy);
Point p = img.GetHotSpot();
ss.Put16le(p.x);
ss.Put16le(p.y);
p = img.Get2ndSpot();
ss.Put16le(p.x);
ss.Put16le(p.y);
block.Cat(ss.GetResult());
const RGBA *s = img;
const RGBA *e = s + img.GetLength();
while(s < e) {
block.Cat(s->r);
block.Cat(s->g);
block.Cat(s->b);
block.Cat(s->a);
s++;
}
}
return ZCompress(block);
}
示例4: formatPatientData
void InvoiceFormatter::formatPatientData(StringBuffer &buf, InvoiceData &invoice) {
buf.Cat("[*A1 " + AsString(t_("Patient:")) + "] [A1 "
+ invoice.patient_name + ", " + invoice.patient_species);
if (!invoice.patient_breed.IsEmpty())
buf.Cat(" (" + invoice.patient_breed + ")");
buf.Cat("&]");
buf.Cat("[A1 " + escapeText(invoice.rec_text) + "] ");
}
示例5: escapeText
String InvoiceFormatter::escapeText(String& s) {
StringBuffer out;
out.Cat("\1");
out.Cat(s);
out.Cat("\1");
return ~out;
}
示例6: RandomString
String RandomString(int len)
{
StringBuffer r;
for(int i = 0; i < len; i++)
if(Random(30) == 0)
r.Cat("\r\n");
else
r.Cat(Random(64) + 32);
return r;
}
示例7: formatHeader
void InvoiceFormatter::formatHeader(StringBuffer &buf, InvoiceData &invoice) {
buf.Cat("{{1:1~ ");
buf.Cat("[*A3 " + AsString(t_("Invoice")) + "] :: [*A3 " + AsString(t_("invoice num:")) + " " + AsString(invoice.inv_id) + "]:: ");
buf.Cat("[A1 " + AsString(t_("Create date:")) + "-|-|-|" + AsString(invoice.create_date));
if (lang != LANG_CZ) {
buf.Cat("&" + AsString(t_("Delivery date:")) + "-|-|" + AsString(invoice.delivery_date) + "&");
buf.Cat(AsString(t_("Payment date:")) + "-|-|-|" + AsString(invoice.payment_date) );
}
buf.Cat("]:: ");
// no payment type in CZ
if (lang != LANG_CZ) {
String type;
switch (invoice.payment_type)
{
case iptCurrency:
type = t_("currency");
break;
case iptBankTransfer:
type = t_("bank transfer");
break;
default:
type = t_("currency");
}
buf.Cat("[A1 " + AsString(t_("Payment type:")) + "-|-|" + type + "]&");
}
buf.Cat("}}");
}
示例8: formatVetData
void InvoiceFormatter::formatVetData(StringBuffer &buf) {
buf.Cat("[*A1 " + AsString(t_("Doctor:")) + "&]");
buf.Cat("[A1 {{1:1~ ");
buf.Cat("[A1 " + vet_name + "&" + vet_address);
buf.Cat("&" + AsString(t_("pho.")) + " 1:-|" + vet_phone1 + "&" + AsString(t_("pho.")) + " 2:-|" + vet_phone2 +"]:: ");
buf.Cat("[A1 " + AsString(t_("IC:")) + "-|-|-|" + vet_ic + "&" + AsString(t_("DIC:")) + "-|-|-|" );
buf.Cat( vet_dic + "&");
if (lang != LANG_CZ)
buf.Cat(AsString(t_("ICDPH:")) + "-|-|-|" + vet_icdph + "&");
buf.Cat(AsString(t_("Bank account:")) + "-|" + vet_bank_acc +"] ");
buf.Cat("}}] ");
}
示例9: formatCompanyData
void InvoiceList::formatCompanyData(StringBuffer &buf)
{
buf.Cat("[*A1 " + AsString(t_("Supplier:")) + "&]");
buf.Cat("[A1 {{1:1~ ");
buf.Cat("[A1 " + AsString(~inv_data.name) + "&" + AsString(~inv_data.address));
buf.Cat("&" + AsString(t_("pho.")) + " 1:-|" + AsString(~inv_data.phone1) + "&" + AsString(t_("pho.")) + " 2:-|" + AsString(~inv_data.phone2) +"]:: ");
buf.Cat("[A1 " + AsString(t_("IC:")) + "-|-|-|" + AsString(~inv_data.ic) + "&" + AsString(t_("DIC:")) + "-|-|-|" );
buf.Cat( AsString(~inv_data.dic) + "&");
if (lang != LANG_CZ)
buf.Cat(AsString(t_("ICDPH:")) + "-|-|-|" + AsString(~inv_data.icdph) + "&");
buf.Cat(AsString(t_("Bank account:")) + "-|-|" + AsString(~inv_data.acc_num) +"] ");
buf.Cat("}}] ");
}
示例10: prepare
bool InvoiceList::prepare()
{
String sqlStatement = "select r.invoice_id, r.inv_create_date, \
(select sum(ri.item_price) from record_item ri where ri.record_id = r.id) \
from record r \
where r.invoice_id is not null and r.inv_create_date between '"
+ AsString(from) + "' and '" + AsString(to)
+ "' order by r.inv_create_date, r.invoice_id";
SQL.Execute(sqlStatement);
bool found = false;
while (SQL.Fetch()) {
found = true;
VectorMap<int, String> vmap;
vmap.Add(iliInvNum, AsString(SQL[0]));
vmap.Add(iliDate, AsString(SQL[1]));
vmap.Add(iliTotal, fixFuckedLinuxFormating(ConvertMoney().Format(SQL[2])));
inv_list_items.Add(vmap);
}
if (!found) return false;
SQL & Select(SqlSum(ITEM_PRICE.Of(RECORD_ITEM))).From(RECORD_ITEM)
.InnerJoin(RECORD).On(RECORD_ID.Of(RECORD_ITEM) == ID.Of(RECORD))
.Where(NotNull(INVOICE_ID.Of(RECORD)) && (Between(INV_CREATE_DATE.Of(RECORD), from, to)));
if (SQL.Fetch())
summary_price = SQL[0];
invoiceList.Clear();
invoiceList.Header(String("[A0> ") + String(t_("Page")) + String(" $$P"));
StringBuffer buf;
buf.Cat("{{1f4 ");
formatHeader(buf);
buf.Cat(":: ");
formatCompanyData(buf);
buf.Cat(":: ");
formatItems(buf);
buf.Cat("}}");
LOG(~buf);
invoiceList << ~buf;
return true;
}
示例11: EscapeHtml
void EscapeHtml(StringBuffer& out, const String& txt)
{
const char *s = txt;
const char *e = txt.End();
while(s != e) {
if(*s == 31)
out.Cat(" ");
else
if(*s == '<')
out.Cat("<");
else
if(*s == '>')
out.Cat(">");
else
if(*s == '&')
out.Cat("&");
else
if(*s == '\"')
out.Cat(""");
else
if((byte)*s < ' ')
out.Cat(NFormat("&#%d;", (byte)*s));
else
out.Cat(*s);
s++;
}
}
示例12: fixFuckedLinuxFormating
// Fix "space" charactes after 1000 in slovak locale. They weren't printable by default
String fixFuckedLinuxFormating(const String &s) {
StringBuffer out;
#ifdef PLATFORM_LINUX
for (int i=0; i<s.GetCount(); i++)
out.Cat((s[i] == -96) ? ' ' : s[i]);
#endif
#ifdef PLATFORM_WIN32
for (int i=0; i<s.GetCount(); i++)
{
if (s[i] != -62)
out.Cat((s[i] == -96) ? ' ' : s[i]);
}
#endif
return ~out;
}
示例13: ReadString
WString VfkStream::ReadString(const char *b, const char **endptr) const
{
if(*b++ != '\"')
throw Exc("'\"' expected");
StringBuffer out;
for(;;) {
const char *b0 = b;
while(*b && *b != '\"')
b++;
out.Cat(b0, b - b0);
if(*b != '\"' || *++b != '\"')
break;
out.Cat(*b++);
}
if(endptr)
*endptr = b;
return ToUnicode((String)out, charset);
}
示例14: operator
String XmlTag::operator()(const char *text)
{
StringBuffer r;
r << tag << ">";
int fbi = r.GetCount();
const char *s = text;
bool wastag = true;
bool wasslash = true;
bool first = true;
while(*s) {
const char *b = s;
while(*s == ' ' || *s == '\t')
s++;
if(s[0] == '<') {
if(first)
r << "\r\n";
if(wastag && (wasslash || s[1] != '/'))
r.Cat('\t');
}
else
if(first) {
r << text << end;
return r;
}
first = false;
wasslash = false;
char last = 0;
while(*s && *s != '\n' && *s != '\r') {
if(*s == '<')
wasslash = s[1] == '/';
if(*s == '/' && s[1] == '>')
wasslash = true;
last = *s++;
}
wastag = last == '>';
if(*s == '\r')
s++;
if(*s == '\n')
s++;
r.Cat(b, s);
}
r << "\r\n" << end;
return r;
}
示例15: NaturalDeQtf
String NaturalDeQtf(const char *s) {
StringBuffer r;
r.Reserve(256);
bool cm = false;
while(*s) {
if(*s == ' ')
r.Cat(cm ? ' ' : '_');
else {
if((byte)*s > ' ' && !IsDigit(*s) && !IsAlpha(*s) && (byte)*s < 128)
r.Cat('`');
r.Cat(*s);
if(*s == ',')
cm = true;
else
cm = false;
}
s++;
}
return r;
}