• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ WriteStream类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: write

void InsetMathSymbol::write(WriteStream & os) const
{
	unique_ptr<MathEnsurer> ensurer;
	if (currentMode() != TEXT_MODE)
		ensurer = make_unique<MathEnsurer>(os);
	else
		ensurer = make_unique<MathEnsurer>(os, false, true, true);
	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:cburschka,项目名称:lyx,代码行数:17,代码来源:InsetMathSymbol.cpp


示例17: write

void InsetMathPhantom::write(WriteStream & os) const
{
	MathEnsurer ensurer(os);
	if (os.fragile())
		os << "\\protect";
	switch (kind_) {
	case phantom:
		os << "\\phantom{";
		break;
	case vphantom:
		os << "\\vphantom{";
		break;
	case hphantom:
		os << "\\hphantom{";
		break;
	case smash:
		os << "\\smash{";
		break;
	case smasht:
		os << "\\smash[t]{";
		break;
	case smashb:
		os << "\\smash[b]{";
		break;
	case mathclap:
		os << "\\mathclap{";
		break;
	case mathllap:
		os << "\\mathllap{";
		break;
	case mathrlap:
		os << "\\mathrlap{";
		break;
	}
	os << cell(0) << '}';
}
开发者ID:cburschka,项目名称:lyx,代码行数:36,代码来源:InsetMathPhantom.cpp


示例18: write

void InsetMathChar::write(WriteStream & os) const
{
	os.os().put(char_);
}
开发者ID:rpavlik,项目名称:lyx-lucid-backport,代码行数:4,代码来源:InsetMathChar.cpp


示例19: writeDomain

void ConfigManager::writeDomain(WriteStream &stream, const String &name, const Domain &domain) {
	if (domain.empty())
		return;     // Don't bother writing empty domains.

	// WORKAROUND: Fix for bug #1972625 "ALL: On-the-fly targets are
	// written to the config file": Do not save domains that came from
	// the command line
	if (domain.contains("id_came_from_command_line"))
		return;

	String comment;

	// Write domain comment (if any)
	comment = domain.getDomainComment();
	if (!comment.empty())
		stream.writeString(comment);

	// Write domain start
	stream.writeByte('[');
	stream.writeString(name);
	stream.writeByte(']');
#ifdef _WIN32
	stream.writeByte('\r');
	stream.writeByte('\n');
#else
	stream.writeByte('\n');
#endif

	// Write all key/value pairs in this domain, including comments
	Domain::const_iterator x;
	for (x = domain.begin(); x != domain.end(); ++x) {
		if (!x->_value.empty()) {
			// Write comment (if any)
			if (domain.hasKVComment(x->_key)) {
				comment = domain.getKVComment(x->_key);
				stream.writeString(comment);
			}
			// Write the key/value pair
			stream.writeString(x->_key);
			stream.writeByte('=');
			stream.writeString(x->_value);
#ifdef _WIN32
			stream.writeByte('\r');
			stream.writeByte('\n');
#else
			stream.writeByte('\n');
#endif
		}
	}
#ifdef _WIN32
	stream.writeByte('\r');
	stream.writeByte('\n');
#else
	stream.writeByte('\n');
#endif
}
开发者ID:Templier,项目名称:residual,代码行数:56,代码来源:config-manager.cpp


示例20: save

void ConfigFile::save(WriteStream &stream) const {
	// Write file prologue
	if (!_prologue.empty()) {
		stream.writeString(_prologue);
		stream.writeByte('\n');
		stream.writeByte('\n');
	}

	// Domains
	for (DomainList::const_iterator domain = _domainList.begin(); domain != _domainList.end(); ++domain) {
		// Write domain prologue
		if (!(*domain)->_prologue.empty()) {
			stream.writeString((*domain)->_prologue);
			stream.writeByte('\n');
		}

		// Write domain name
		stream.writeByte('[');
		stream.writeString((*domain)->_name);
		stream.writeByte(']');

		// Write domain comment
		if (!(*domain)->_comment.empty()) {
			stream.writeByte(' ');
			stream.writeString((*domain)->_comment);
		}

		stream.writeByte('\n');

		// Lines
		for (ConfigDomain::LineList::const_iterator line = (*domain)->_lines.begin(); line != (*domain)->_lines.end(); ++line) {
			// Write key
			if (line->key != (*domain)->_keys.end()) {
				stream.writeString(line->key->first);
				stream.writeByte('=');
				stream.writeString(line->key->second);
				if (!line->comment.empty())
					stream.writeByte(' ');
			}

			// Write comment
			if (!line->comment.empty())
				stream.writeString(line->comment);

			stream.writeByte('\n');
		}

		stream.writeByte('\n');
	}

	// Write the epilogue
	if (!_epilogue.empty()) {
		stream.writeString(_epilogue);
		stream.writeByte('\n');
	}

	stream.flush();
}
开发者ID:bsmr-games,项目名称:xoreos,代码行数:58,代码来源:configfile.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ WriteUserLog类代码示例发布时间:2022-05-31
下一篇:
C++ WriteOpResult类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap