当前位置: 首页>>代码示例>>C++>>正文


C++ WriteStream类代码示例

本文整理汇总了C++中WriteStream的典型用法代码示例。如果您正苦于以下问题:C++ WriteStream类的具体用法?C++ WriteStream怎么用?C++ WriteStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了WriteStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fp

void ArrayObject::save(const chowstring & filename)
{
    FSFile fp(convert_path(filename).c_str(), "w");
    if (!fp.is_open())
        return;
    WriteStream stream;

    stream.write(CT_ARRAY_MAGIC, sizeof(CT_ARRAY_MAGIC));
    stream.write_int16(ARRAY_MAJOR_VERSION);
    stream.write_int16(ARRAY_MINOR_VERSION);
    stream.write_int32(data.x_size);
    stream.write_int32(data.y_size);
    stream.write_int32(data.z_size);

    int flags = 0;
    if (data.is_numeric)
        flags |= NUMERIC_FLAG;
    if (data.offset != 0)
        flags |= BASE1_FLAG;
    stream.write_int32(flags);

    for (int i = 0; i < data.x_size * data.y_size * data.z_size; i++) {
        if (data.is_numeric) {
            stream.write_int32(int(data.array[i]));
        } else {
            stream.write_int32(data.strings[i].size());
            stream.write_string(data.strings[i]);
        }
    }

    stream.save(fp);
    fp.close();
}
开发者ID:carriercomm,项目名称:anaconda,代码行数:33,代码来源:arrayext.cpp

示例2: writeStringFixed

void writeStringFixed(WriteStream &stream, const Common::UString &str, Encoding encoding, size_t length) {
	if (length == 0)
		return;

	ScopedPtr<MemoryReadStream> data(convertString(str, encoding, false));

	size_t n = stream.writeStream(*data, length);
	while (n++ < length)
		stream.writeByte(0);
}
开发者ID:asr1,项目名称:xoreos-tools,代码行数:10,代码来源:encoding.cpp

示例3: write

void InsetMathAMSArray::write(WriteStream & os) const
{
	MathEnsurer ensurer(os);
	os << "\\begin{" << name_ << '}';
	bool open = os.startOuterRow();
	InsetMathGrid::write(os);
	os << "\\end{" << name_ << '}';
	if (open)
		os.startOuterRow();
}
开发者ID:cburschka,项目名称:lyx,代码行数:10,代码来源:InsetMathAMSArray.cpp

示例4: write

void InsetMathCases::write(WriteStream & os) const
{
	MathEnsurer ensurer(os);
	if (os.fragile())
		os << "\\protect";
	os << "\\begin{cases}\n";
	InsetMathGrid::write(os);
	if (os.fragile())
		os << "\\protect";
	os << "\\end{cases}";
}
开发者ID:apex-hughin,项目名称:LyX,代码行数:11,代码来源:InsetMathCases.cpp

示例5: fp

void AssociateArray::save(const std::string & path, int method)
{
    FSFile fp(path.c_str(), "w");
    if (!fp.is_open()) {
        std::cout << "Could not save associate array: " << path << std::endl;
        return;
    }
    WriteStream stream;
    save_assarray(*this, stream, method);
    stream.save(fp);
    fp.close();
}
开发者ID:mattl,项目名称:anaconda,代码行数:12,代码来源:assarray.cpp

示例6: saveMemos

void FoxPro::saveMemos(WriteStream &fpt) const {
	fpt.writeUint32BE(_memos.size() + 1); // Next free block
	fpt.writeUint16BE(0x0000);        // Reserved
	fpt.writeUint16BE(_memoBlockSize);

	// Reserved
	for (int i = 0; i < 126; i++)
		fpt.writeUint32BE(0x00000000);

	for (size_t i = 0; i < _memos.size(); i++)
		fpt.write(_memos[i], _memoBlockSize);
}
开发者ID:strand,项目名称:xoreos,代码行数:12,代码来源:foxpro.cpp

示例7: saveRecords

void FoxPro::saveRecords(WriteStream &dbf) const {
	// Write the records
	for (size_t i = 0; i < _records.size(); i++) {
		const Record &record = _records[i];

		dbf.writeByte(record.deleted ? '*' : ' ');

		for (size_t j = 0; j < _fields.size(); j++)
			dbf.write(record.fields[j], _fields[j].size);
	}

	dbf.writeByte(0x1A); // Records end marker
}
开发者ID:strand,项目名称:xoreos,代码行数:13,代码来源:foxpro.cpp

示例8: writeStringFixed

void writeStringFixed(WriteStream &stream, const Common::UString &str, Encoding encoding, size_t length) {
	MemoryReadStream *data = 0;
	try {
		data = convertString(str, encoding, false);

		size_t n = stream.writeStream(*data, length);
		while (n++ < length)
			stream.writeByte(0);

	} catch (...) {
		delete data;
		throw;
	}

	delete data;
}
开发者ID:vincele,项目名称:xoreos,代码行数:16,代码来源:encoding.cpp

示例9: writeString

size_t writeString(WriteStream &stream, const Common::UString &str, Encoding encoding, bool terminate) {
	ScopedPtr<MemoryReadStream> data(convertString(str, encoding, terminate));

	const size_t n = stream.writeStream(*data);

	return n;
}
开发者ID:asr1,项目名称:xoreos-tools,代码行数:7,代码来源:encoding.cpp

示例10: write

void InsetMathBig::write(WriteStream & os) const
{
	MathEnsurer ensurer(os);
	os << '\\' << name_ << delim_;
	if (delim_[0] == '\\')
		os.pendingSpace(true);
}
开发者ID:apex-hughin,项目名称:LyX,代码行数:7,代码来源:InsetMathBig.cpp

示例11: write

void InsetMathSplit::write(WriteStream & ws) const
{
	MathEnsurer ensurer(ws);
	if (ws.fragile())
		ws << "\\protect";
	docstring suffix;
	if (!numbered_ && name_ == "align")
		suffix = from_ascii("*");
	ws << "\\begin{" << name_ << suffix << '}';
	if (name_ != "split" && name_ != "align" && verticalAlignment() != 'c')
		ws << '[' << verticalAlignment() << ']';
	if (name_ == "alignedat")
		ws << '{' << static_cast<unsigned int>((ncols() + 1)/2) << '}';
	InsetMathGrid::write(ws);
	if (ws.fragile())
		ws << "\\protect";
	ws << "\\end{" << name_ << suffix << "}\n";
}
开发者ID:315234,项目名称:lyx-retina,代码行数:18,代码来源:InsetMathSplit.cpp

示例12: write

void InsetMathDecoration::write(WriteStream & os) const
{
	MathEnsurer ensurer(os);
	if (os.fragile() && protect())
		os << "\\protect";
	os << '\\' << key_->name << '{';
	ModeSpecifier specifier(os, currentMode());
	os << cell(0) << '}';
}
开发者ID:apex-hughin,项目名称:LyX,代码行数:9,代码来源:InsetMathDecoration.cpp

示例13: write

void InsetMathSymbol::write(WriteStream & os) const
{
	MathEnsurer ensurer(os);
	os << '\\' << name();

	// $,#, etc. In theory the restriction based on catcodes, but then
	// we do not handle catcodes very well, let alone cat code changes,
	// so being outside the alpha range is good enough.
	if (name().size() == 1 && !isAlphaASCII(name()[0]))
		return;

	os.pendingSpace(true);
}
开发者ID:bsjung,项目名称:Lyx,代码行数:13,代码来源:InsetMathSymbol.cpp

示例14: write

void InsetMathTabular::write(WriteStream & os) const
{
	ModeSpecifier specifier(os, TEXT_MODE);

	if (os.fragile())
		os << "\\protect";
	os << "\\begin{" << name_ << '}';
	bool open = os.startOuterRow();

	char const v = verticalAlignment();
	if (v == 't' || v == 'b')
		os << '[' << v << ']';
	os << '{' << horizontalAlignments() << "}\n";

	InsetMathGrid::write(os);

	if (os.fragile())
		os << "\\protect";
	os << "\\end{" << name_ << '}';
	if (open)
		os.startOuterRow();
	// adding a \n here is bad if the tabular is the last item
	// in an \eqnarray...
}
开发者ID:cburschka,项目名称:lyx,代码行数:24,代码来源:InsetMathTabular.cpp

示例15: writeString

size_t writeString(WriteStream &stream, const Common::UString &str, Encoding encoding, bool terminate) {
	size_t n = 0;

	MemoryReadStream *data = 0;
	try {
		data = convertString(str, encoding, terminate);

		n = stream.writeStream(*data);
	} catch (...) {
		delete data;
		throw;
	}

	delete data;

	return n;
}
开发者ID:vincele,项目名称:xoreos,代码行数:17,代码来源:encoding.cpp


注:本文中的WriteStream类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。