本文整理汇总了C++中StringStream::GetResult方法的典型用法代码示例。如果您正苦于以下问题:C++ StringStream::GetResult方法的具体用法?C++ StringStream::GetResult怎么用?C++ StringStream::GetResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringStream
的用法示例。
在下文中一共展示了StringStream::GetResult方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: Save
void OutMode::Save()
{
ide.SetMethod(~method);
ide.targetmode = ~mode;
ide.export_dir = ~export_dir;
debug.Save(ide.debug);
StoreToWorkspace(debug, "outputmode-debug");
release.Save(ide.release);
StoreToWorkspace(release, "outputmode-release");
StringStream ss;
ide.SerializeOutputMode(ss);
ide.recent_buildmode.GetAdd(ide.method) = ss.GetResult();
}
示例3: CoLZ4Decompress
String CoLZ4Decompress(const void *data, int64 len, Gate<int64, int64> progress)
{
StringStream out;
MemReadStream in(data, len);
return CoLZ4Decompress(out, in, progress) < 0 ? String::GetVoid() : out.GetResult();
}
示例4: SaveIml
String SaveIml(const Array<ImlImage>& iml, int format) {
StringStream out;
if(format == 1) {
for(int i = 0; i < iml.GetCount(); i++) {
const ImlImage& c = iml[i];
if(c.exp)
out << "IMAGE_META(\"exp\", \"\")\r\n";
String name = c.name;
Image buffer = c.image;
if(IsNull(name))
name = "im__" + IntStr(i);
out.PutLine(NFormat("IMAGE_BEGIN(%s)", name));
int last = 0;
for(int i = 0; i < buffer.GetHeight(); i++) {
String scan = PackRLE(buffer[i], buffer.GetWidth());
if(!scan.IsEmpty() || i == 0) // force at least 1 scan
{
for(; last < i; last++)
out.PutLine("\tIMAGE_SCAN(\"\")");
out.Put("\tIMAGE_SCAN(");
PutOctalString(out, scan.Begin(), scan.End(), true);
out.Put(")\r\n");
last = i + 1;
}
}
out.Put("IMAGE_PACKED(");
out.Put(name);
out.Put(", ");
StringStream datastrm;
Size size = buffer.GetSize();
Point hotspot = buffer.GetHotSpot();
int encoding = AlphaImageInfo::COLOR_RLE;
int version = 1;
datastrm / version;
datastrm % size % hotspot % encoding;
ASSERT(!datastrm.IsError());
String s = datastrm.GetResult();
PutOctalString(out, s.Begin(), s.End());
out.Put(")\r\n");
}
}
else {
out << "PREMULTIPLIED\r\n";
for(int i = 0; i < iml.GetCount(); i++) {
const ImlImage& c = iml[i];
out << "IMAGE_ID(" << c.name << ")";
if(c.exp)
out << " IMAGE_META(\"exp\", \"\")\r\n";
out << "\r\n";
}
int ii = 0;
while(ii < iml.GetCount()) {
int bl = 0;
int bn = 0;
Vector<Image> bimg;
while(bl < 4096 && ii < iml.GetCount()) {
const ImlImage& c = iml[ii++];
bimg.Add(c.image);
bl += c.image.GetLength();
bn++;
}
String bs = PackImlData(bimg);
out << "\r\nIMAGE_BEGIN_DATA\r\n";
bs.Cat(0, ((bs.GetCount() + 31) & ~31) - bs.GetCount());
const byte *s = bs;
for(int n = bs.GetCount() / 32; n--;) {
out << "IMAGE_DATA(";
for(int j = 0; j < 32; j++) {
if(j) out << ',';
out << (int)*s++;
}
out << ")\r\n";
}
out << "IMAGE_END_DATA(" << bs.GetCount() << ", " << bn << ")\r\n";
}
}
return out.GetResult();
}