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

C++ Writer类代码示例

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

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



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

示例1: Traceback

Trace::Trace(
  Writer &dout,
  const char *function_name,
  int line_mask,
  bool do_trace)
  : Traceback(function_name),
    m_diagWriter(dout),
    m_startCpuTime(0.0),
    m_startMemAlloc(0),
    m_lineMask(line_mask),
    m_do_trace(do_trace),
    m_flags((dout.isTracing()
             || (dout.shouldTrace(m_lineMask)
                 && (s_traceListExists && (s_traceList.empty() || prefix_find(s_traceList, m_functionSpec))))) ? IN_TRACE_LIST : 0)
{
  if (m_do_trace && (m_flags & IN_TRACE_LIST)) {
    m_diagWriter.incTraceDepth();

    m_diagWriter.m(m_lineMask) << m_functionSpec
                               << (std::uncaught_exception() ? " (throw unwinding) " : "")
                               << push << dendl;

    if (dout.shouldPrint(LOG_TRACE_STATS)) {
      m_startCpuTime = sierra::Env::cpu_now();
      m_startMemAlloc = stk::get_heap_used();
    }
  }
}
开发者ID:00liujj,项目名称:trilinos,代码行数:28,代码来源:Trace.cpp


示例2: StreamWriter

void ConsoleTools::listTypes(bool load, bool useNames){
  Writer *writer = null;
  try{
    writer = new StreamWriter(stdout, outputEncodingIndex, bomOutput);
    ParserFactory pf(catalogPath);
    HRCParser *hrcParser = pf.getHRCParser();
    fprintf(stderr, "\nloading file types...\n");
    for(int idx = 0;; idx++){
      FileType *type = hrcParser->enumerateFileTypes(idx);
      if (type == null) break;
      if (useNames){
        writer->write(StringBuffer(type->getName())+"\n");
      }else{
        if (type->getGroup() != null){
          writer->write(StringBuffer(type->getGroup()) + ": ");
        }
        writer->write(type->getDescription());
        writer->write(DString("\n"));
      }

      if (load) type->getBaseScheme();
    }
    delete writer;
  }catch(Exception &e){
    delete writer;
    fprintf(stderr, "%s\n", e.getMessage()->getChars());
  }
}
开发者ID:CS-svnmirror,项目名称:colorer,代码行数:28,代码来源:ConsoleTools.cpp


示例3: Stringify

 virtual StringResultBase* Stringify(const ParseResultBase* parseResult) const {
     const JzonParseResult* pr = static_cast<const JzonParseResult*>(parseResult);
     JzonStringResult* sr = new JzonStringResult;
     Writer writer;
     writer.writeString(pr->root, sr->s);
     return sr;
 }
开发者ID:Lyoko-Jeremie,项目名称:nativejson-benchmark,代码行数:7,代码来源:jzontest.cpp


示例4: Save

void Command::Save (Writer &writer) const
{
    // this will only get used if saved as XML (probably never)
    writer.Stream() << writer.ind() << "<Command "
                    << "gcode=\"" << toGCode() << "\" />";
    writer.Stream()<< std::endl;
}
开发者ID:3DPrinterGuy,项目名称:FreeCAD,代码行数:7,代码来源:Command.cpp


示例5: Save

void Constraint::Save (Writer &writer) const
{
    std::string encodeName = encodeAttribute(Name);
    writer.Stream() << writer.ind()     << "<Constrain "
    << "Name=\""                        <<  encodeName              << "\" "
    << "Type=\""                        <<  (int)Type               << "\" ";
    if(this->Type==InternalAlignment)
        writer.Stream()
        << "InternalAlignmentType=\""   <<  (int)AlignmentType      << "\" "
        << "InternalAlignmentIndex=\""  <<  InternalAlignmentIndex  << "\" ";
    writer.Stream()
    << "Value=\""                       <<  Value                   << "\" "
    << "First=\""                       <<  First                   << "\" "
    << "FirstPos=\""                    <<  (int)  FirstPos         << "\" "
    << "Second=\""                      <<  Second                  << "\" "
    << "SecondPos=\""                   <<  (int) SecondPos         << "\" "
    << "Third=\""                       <<  Third                   << "\" "
    << "ThirdPos=\""                    <<  (int) ThirdPos          << "\" "
    << "LabelDistance=\""               <<  LabelDistance           << "\" "
    << "LabelPosition=\""               <<  LabelPosition           << "\" "
    << "IsDriving=\""                   <<  (int)isDriving          << "\" "
    << "IsInVirtualSpace=\""            <<  (int)isInVirtualSpace   << "\" />"

    << std::endl;
}
开发者ID:lanigb,项目名称:FreeCAD,代码行数:25,代码来源:Constraint.cpp


示例6: stringify

void stringify(Writer& writer, const std::vector<T>& v) {
    writer.StartArray();
    for (const auto& e : v) {
        stringify(writer, e);
    }
    writer.EndArray();
}
开发者ID:eden57,项目名称:mapbox-gl-native,代码行数:7,代码来源:stringify.hpp


示例7: main

int main(void) {

	char data = ' ';
	int id = 0;

	cout << "pid: " << getpid() << endl;

	cout << "digite id do reader: ";
	cin >> id;
	cout << "id =  " << id << endl;

	Writer *wr = new Writer(id);

	signal(SIGCONT, sigusr);
	kill(id, SIGCONT);

	while (data != '.') {

		cout << "digite o char: ";
		cin >> data;
		wr->Write(data);
	}

	wr->~Writer();
}
开发者ID:kyllercg,项目名称:acmgen,代码行数:25,代码来源:writer_usage.cpp


示例8: write

 bool write(Writer &w) const
 {
     MSS_BEGIN(bool);
     auto fix = 0u;
     //Copy of field is intentional
     for (Range field: fields)
     {
         auto write_field = [&](Writer &w1){
             MSS_BEGIN(bool);
             if (!field.empty())
             {
                 w.text(field.front());
                 field.pop_front();
                 while (!field.empty())
                 {
                     w.text(' ');
                     w.text(field.front());
                     field.pop_front();
                 }
             }
             MSS_END();
         };
         MSS(w(fix, write_field));
         ++fix;
     }
     MSS_END();
 }
开发者ID:gfannes,项目名称:gubg.data,代码行数:27,代码来源:Record.hpp


示例9: forEach

void Peer::onConnection(Exception& ex, Writer& writer,DataReader& parameters,DataWriter& response) {
	if(!connected) {
		_pWriter = &writer;

		// reset default protocol parameters
		_parameters.clear();
		Parameters::ForEach forEach([this](const string& key,const string& value) {
			_parameters.setString(key,value);
		});
		string buffer;
		_handler.iterate(String::Format(buffer,protocol,"."), forEach);

		ParameterWriter parameterWriter(_parameters);
		SplitWriter parameterAndResponse(parameterWriter,response);

		_handler.onConnection(ex, *this,parameters,parameterAndResponse);
		if (!ex) {
			(bool&)connected = ((Entities<Client>&)_handler.clients).add(*this);
			if (!connected) {
				ex.set(Exception::PROTOCOL, "Client ", Util::FormatHex(id, ID_SIZE, buffer), " exists already");
				ERROR(ex.error());
				_handler.onDisconnection(*this);
			}
		}
		if (!connected) {
			writer.abort();
			_pWriter = NULL;
		} else {
			OnInitParameters::raise(_parameters);
			DEBUG("Client ",address.toString()," connection")
		}
		writer.open(); // open even if "ex" to send error messages!
	} else
开发者ID:fxlt,项目名称:MonaServer,代码行数:33,代码来源:Peer.cpp


示例10: _mtk_header_update_size

static oc::result<void>
_mtk_header_update_size(Writer &writer, File &file,
                        uint64_t offset, uint32_t size)
{
    uint32_t le32_size = mb_htole32(size);

    if (offset > SIZE_MAX - offsetof(MtkHeader, size)) {
        writer.set_fatal();
        return MtkError::MtkHeaderOffsetTooLarge;
    }

    auto seek_ret = file.seek(
            static_cast<int64_t>(offset + offsetof(MtkHeader, size)), SEEK_SET);
    if (!seek_ret) {
        if (file.is_fatal()) { writer.set_fatal(); }
        return seek_ret.as_failure();
    }

    auto ret = file_write_exact(file, &le32_size, sizeof(le32_size));
    if (!ret) {
        if (file.is_fatal()) { writer.set_fatal(); }
        return ret.as_failure();
    }

    return oc::success();
}
开发者ID:Nonta72,项目名称:DualBootPatcher,代码行数:26,代码来源:mtk_writer.cpp


示例11: writeFormatted

string
WKTWriter::writeFormatted(const Geometry* geometry)
{
    Writer sw;
    writeFormatted(geometry, true, &sw);
    return sw.toString();
}
开发者ID:libgeos,项目名称:libgeos,代码行数:7,代码来源:WKTWriter.cpp


示例12: main

int main(int argc, char* argv[])
{

  if (argc < 7) {
    usage(argv[0]);
  }

  std::string h5file = argv[1];
  std::string immfile = argv[2];
  std::string dataset = argv[3];
  unsigned int buffer_count = atoi(argv[4]);
  unsigned int frames = atoi(argv[5]);
  unsigned int frames_per_buffer = atoi(argv[6]);

  BufferPool *pool = new BufferPool(buffer_count, 1024, 1024, frames_per_buffer);
  Queue<FrameBuffer*> *readconvert = new Queue<FrameBuffer*>();
  Queue<FrameBuffer*> *convertwrite = new Queue<FrameBuffer*>();

  Reader *reader = new Reader(h5file, dataset, 1024, 1024, frames, frames_per_buffer, pool, readconvert);
  Converter *converter = new Converter(readconvert, convertwrite, frames);
  Writer *writer = new Writer(immfile, convertwrite, pool, frames);

  writer->start();
  converter->start();
  reader->start();


  reader->join();
  converter->join();
  writer->join();

  printf("Done\n");
}
开发者ID:n-log-n,项目名称:h52imm,代码行数:33,代码来源:xfer.cpp


示例13: produce_response

 void produce_response(Writer& out, const int result) {
     out.write("{\"scans\":[");
     bool first = true;
     ScanEntry& entry = read_;
     while (!result && !wiced_rtos_pop_from_queue(&queue_, &entry, WICED_NEVER_TIMEOUT)) {
         if (entry.done)
             break;
         if (!*entry.ssid)
             continue;
         if (first)
             first = false;
         else
             write_char(out, ',');
         write_char(out, '{');
         write_json_string(out, "ssid", entry.ssid);
         write_char(out, ',');
         write_json_int(out, "rssi", entry.rssi);
         write_char(out, ',');
         write_json_int(out, "sec", entry.security);
         write_char(out, ',');
         write_json_int(out, "ch", entry.channel);
         write_char(out, ',');
         write_json_int(out, "mdr", entry.max_data_rate);
         write_char(out, '}');
     }
     out.write("]}");
     wiced_rtos_deinit_queue(&queue_);
 }
开发者ID:elcojacobs,项目名称:brewpi-firmware,代码行数:28,代码来源:softap.cpp


示例14: Serialize

	void Serialize(Writer& writer) const {
		// This base class just write out name-value pairs, without wrapping within an object.
		writer.String("name");
		writer.String(name_.c_str(), (SizeType)name_.length());	// Suppling length of string is faster.

		writer.String("age");
		writer.Uint(age_);
	}
开发者ID:ALfuhrmann,项目名称:glTF,代码行数:8,代码来源:serialize.cpp


示例15: write_data

void MsgBuf::write_data(const std::vector<TradeMsg> messages, Writer& out) {
    for(std::vector<TradeMsg>::const_iterator it = messages.begin(); it != messages.end(); ++it) {
        out.save_binary((*it).get_type());
        out.save_binary((*it).get_time());
        out.save_binary((*it).get_len());
        out.save_string((*it).get_msg());
    }
}
开发者ID:Aljaksandr,项目名称:cpp_craft_1013,代码行数:8,代码来源:msg.cpp


示例16: writeTo

void MatSerializableAdapter::writeTo(Writer& writer) const {
    assert(_cmat);
    writer.write("type", _cmat->type());
    writer.write("cols", _cmat->cols);
    writer.write("rows", _cmat->rows);
    std::vector<double> data(_cmat->begin<double>(), _cmat->end<double>());
    writer.write("data", data);
}
开发者ID:komackaj,项目名称:samko,代码行数:8,代码来源:matserializableadapter.cpp


示例17: getPlaylistPath

bool XSPF::write(const Entries &list)
{
	Writer *writer = ioCtrl.rawPtr<Writer>();
	const QString playlistPath = getPlaylistPath(writer->getUrl());

	QByteArray buffer;
	QXmlStreamWriter xmlWriter(&buffer);
	xmlWriter.setAutoFormatting(true);
	xmlWriter.setAutoFormattingIndent(-1);

	xmlWriter.writeStartDocument();
	xmlWriter.writeStartElement("playlist");
	xmlWriter.writeStartElement("trackList");

	for (const Entry &entry : list)
	{
		xmlWriter.writeStartElement("track");

		if (entry.GID)
			startExtension(xmlWriter);

		QString url = entry.url;
		if (url.startsWith("file://") && url.mid(7, playlistPath.length()) == playlistPath)
			url.remove(0, playlistPath.length() + 7);
		xmlWriter.writeTextElement("location", url);

		if (!entry.name.isEmpty())
			xmlWriter.writeTextElement("title", entry.name);
		if (entry.length >= 0.0)
			xmlWriter.writeTextElement("duration", QString::number(1000.0 * entry.length, 'f', 0));

		if (entry.flags || entry.queue || entry.GID || entry.parent)
		{
			if (!entry.GID)
				startExtension(xmlWriter);

			if (entry.flags)
				xmlWriter.writeTextElement("f", QString::number(entry.flags));
			if (entry.queue)
				xmlWriter.writeTextElement("q", QString::number(entry.queue));
			if (entry.GID)
				xmlWriter.writeTextElement("g", QString::number(entry.GID));
			if (entry.parent)
				xmlWriter.writeTextElement("p", QString::number(entry.parent));

			xmlWriter.writeEndElement(); // extension
		}

		xmlWriter.writeEndElement(); // track
	}

	xmlWriter.writeEndElement(); // trackList
	xmlWriter.writeEndElement(); // playlist
	xmlWriter.writeEndDocument();

	writer->write(buffer);
	return true;
}
开发者ID:arthurzam,项目名称:QMPlay2,代码行数:58,代码来源:XSPF.cpp


示例18: Write

void TemplateParameterNodeList::Write(Writer& writer)
{
    uint32_t n = static_cast<uint32_t>(templateParameterNodes.size());
    writer.Write(n);
    for (uint32_t i = 0; i < n; ++i)
    {
        writer.Write(templateParameterNodes[i].get());
    }
}
开发者ID:slaakko,项目名称:cmajor,代码行数:9,代码来源:Template.cpp


示例19: getJsonLoader

void Skin::save (const gdx_cpp::files::FileHandle& skinFile) {
    String text = getJsonLoader(null).prettyPrint(this, true);
    Writer writer = skinFile.writer(false);
    try {
        writer.write(text);
        writer.close();
    } catch (IOException ex) {
    }
}
开发者ID:NoiSek,项目名称:libgdx-cpp,代码行数:9,代码来源:Skin.cpp


示例20: writer

bool medDataReaderWriter::write(const QString& path,medAbstractData* data) {
    Writer dwriter = writer(path,data);
    if (!dwriter.isNull()) {
        dwriter->setData(data);
        dwriter->write(path);
        return true;
    }
    return false;
}
开发者ID:medInria,项目名称:medInria-public,代码行数:9,代码来源:medDataReaderWriter.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ WritingMode类代码示例发布时间:2022-05-31
下一篇:
C++ WriteUserLog类代码示例发布时间: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