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

C++ TextOutput类代码示例

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

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



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

示例1:

void Vector2::serialize(TextOutput& t) const {
   t.writeSymbol("(");
   t.writeNumber(x);
   t.writeSymbol(",");
   t.writeNumber(y);
   t.writeSymbol(")");
}
开发者ID:Akenyshka,项目名称:MythCore,代码行数:7,代码来源:Vector2.cpp


示例2: describeSystem

void NetworkDevice::describeSystem(
    std::string&        s) {

    TextOutput t;
    describeSystem(t);
    t.commitString(s);
}
开发者ID:090809,项目名称:TrinityCore,代码行数:7,代码来源:NetworkDevice.cpp


示例3: write_connolly_surface

IMPMULTIFIT_BEGIN_NAMESPACE

void write_connolly_surface(atom::Atoms atoms, TextOutput fn,
                            float density, float probe_radius) {

  algebra::Sphere3Ds spheres;
  for (unsigned int i = 0; i < atoms.size(); ++i) {
    spheres.push_back(core::XYZR(atoms[i]).get_sphere());
  }

  algebra::ConnollySurfacePoints sps =
      algebra::get_connolly_surface(spheres, density, probe_radius);

  for (unsigned int i = 0; i < sps.size(); ++i) {
    fn.get_stream() << std::setw(5) << sps[i].get_atom(0) + 1 << std::setw(5)
                    << sps[i].get_atom(1) + 1 << std::setw(5)
                    << sps[i].get_atom(2) + 1 << std::fixed << std::setw(8)
                    << std::setprecision(3) << sps[i].get_surface_point()[0]
                    << std::setw(8) << std::setprecision(3)
                    << sps[i].get_surface_point()[1] << std::setw(8)
                    << std::setprecision(3) << sps[i].get_surface_point()[2]
                    << std::setw(8) << std::setprecision(3) << sps[i].get_area()
                    << std::setw(7) << std::setprecision(3)
                    << sps[i].get_normal()[0] << std::setw(7)
                    << std::setprecision(3) << sps[i].get_normal()[1]
                    << std::setw(7) << std::setprecision(3)
                    << sps[i].get_normal()[2] << "  0.500" << std::endl;
  }
}
开发者ID:AljGaber,项目名称:imp,代码行数:29,代码来源:connolly_surface.cpp


示例4: serialize

void XML::serialize(TextOutput& t) const {
    if (m_type == VALUE) {
        // Raw string; no quotes
        t.writeSymbol(m_value);
    } else {
        t.printf("<%s", m_name.c_str());
        for (AttributeTable::Iterator it = m_attribute.begin(); it.hasMore(); ++it) {
            t.printf(" %s=\"%s\"", it->key.c_str(), it->value.m_value.c_str());
        }
        t.printf(">");
        t.writeNewline();
        t.pushIndent();
        for (int i = 0; i < m_child.size(); ++i) {
            m_child[i].serialize(t);
            if (m_child[i].m_type == VALUE) {
                // Only tags know to append a newline
                t.writeNewline();
            }
        }
        t.popIndent();
        t.printf("</%s>", m_name.c_str());
        t.writeNewline();
    }
}
开发者ID:Blumfield,项目名称:TBCPvP,代码行数:24,代码来源:XML.cpp


示例5: describeSystem

void NetworkDevice::describeSystem(
    TextOutput& t) {

    t.writeSymbols("Network", "{");
    t.writeNewline();
    t.pushIndent();

    t.popIndent();
    t.writeSymbols("}");
    t.writeNewline();
    t.writeNewline();
}
开发者ID:luaman,项目名称:g3d-cpp,代码行数:12,代码来源:NetworkDevice.cpp


示例6: serialize

void serialize(const double& b, TextOutput& to) {
    to.writeNumber(b);
}
开发者ID:Blumfield,项目名称:ptc2,代码行数:3,代码来源:TextOutput.cpp


示例7: formatIP

void NetworkDevice::EthernetAdapter::describe(TextOutput& t) const {
    t.writeSymbol("{");
    t.pushIndent();
    t.writeNewline();
    
    t.writeSymbols("hostname", "=");
    t.writeString(hostname + ";");
    t.writeNewline();

    t.writeSymbols("name", "=");
    t.writeString(name + ";");
    t.writeNewline();    

    t.writeSymbols("ip", "=");
    t.writeSymbol("\"" + formatIP(ip) + "\";");
    t.writeNewline();    

    t.writeSymbols("subnet", "=");
    t.writeSymbol("\"" + formatIP(subnet) + "\";");
    t.writeNewline();    

    t.writeSymbols("broadcast", "=");
    t.writeSymbol("\"" + formatIP(broadcast) + "\";");
    t.writeNewline();    

    t.writeSymbols("mac", "=");
    t.writeSymbol("\"" + formatMAC(mac) + "\";");
    t.writeNewline();    

    t.popIndent();
    t.writeSymbol("};");
    t.writeNewline();
}
开发者ID:090809,项目名称:TrinityCore,代码行数:33,代码来源:NetworkDevice.cpp


示例8: write_pdb

void write_pdb(const ParticlesTemp& ps, TextOutput out) {
  IMP_FUNCTION_LOG;
  int last_index = 0;
  bool use_input_index = true;
  for (unsigned int i = 0; i < ps.size(); ++i) {
    if (Atom(ps[i]).get_input_index() != last_index + 1) {
      use_input_index = false;
      break;
    } else {
      ++last_index;
    }
  }
  for (unsigned int i = 0; i < ps.size(); ++i) {
    if (Atom::get_is_setup(ps[i])) {
      Atom ad(ps[i]);
      Residue rd = get_residue(ad);
      // really dumb and slow, fix later
      char chain;
      Chain c = get_chain(rd);
      if (c) {
        chain = c.get_id()[0];
      } else {
        chain = ' ';
      }
      int inum = i+1;
      if (i>=99999) inum=99999;
      out.get_stream() << get_pdb_string(
                              core::XYZ(ps[i]).get_coordinates(),
                              use_input_index ? ad.get_input_index()
                                              : static_cast<int>(inum),
                              ad.get_atom_type(), rd.get_residue_type(), chain,
                              rd.get_index(), rd.get_insertion_code(),
                              ad.get_occupancy(), ad.get_temperature_factor(),
                              ad.get_element());

      if (!out) {
        IMP_THROW("Error writing to file in write_pdb", IOException);
      }
    }
    else if (Residue::get_is_setup(ps[i])) {    // if C-alpha residue is available
      Residue rd = IMP::atom::Residue(ps[i]);
      // comment 1 by SJ - TODO: How to retrieve the correct chain information without an hierarchy?
      char chain;
      Chain c = get_chain(rd);
      if (c) {
        chain = c.get_id()[0];
      } else {
        chain = ' ';
      }

      // comment 2 by SJ - TODO: The C-alpha residues are not sorted yet. We need to sort the residues similarly to what PMI does.
      out.get_stream() << get_pdb_string(
                              core::XYZ(ps[i]).get_coordinates(),
                              static_cast<int>(i + 1),
                              IMP::atom::AT_CA, rd.get_residue_type(), chain,
                              rd.get_index(), ' ',
                              1.0, IMP::core::XYZR(ps[i]).get_radius());
    }
    else {  // if a coarse-grained BEAD is available
      Ints resindexes = IMP::atom::Fragment(ps[i]).get_residue_indexes();
      int resindex = (int)resindexes.front() + (int)(resindexes.size()/2);
      // comment 1 by SJ - TODO: How to retrieve the correct chain information without an hierarchy?
      char chain = ' ';

      // comment 3 by SJ - TODO: The BEADs are not sorted yet. We need to sort the residues similarly to what PMI does.
      // comment 4 by SJ - TODO: currently IMP does not allow "BEA" as a residue name, while PMI allows it. Thus "UNK" was used instead.
      out.get_stream() << get_pdb_string(
                              core::XYZ(ps[i]).get_coordinates(),
                              static_cast<int>(i + 1),
                              IMP::atom::AT_CA, IMP::atom::UNK, chain,
                              (int)resindex, ' ',
                              1.0, IMP::core::XYZR(ps[i]).get_radius());
    }
  }
}
开发者ID:salilab,项目名称:imp,代码行数:75,代码来源:pdb.cpp


示例9: Writer

TextWriter::TextWriter(TextOutput fn) : Writer(fn.get_name()), out_(fn) {
  set_was_used(true);
}
开发者ID:j-ma-bu-l-l-ock,项目名称:imp,代码行数:3,代码来源:Writer.cpp


示例10: serialize

	// TODO: if the output will fit on one line, compress tables and arrays into a single line
	void Any::serialize(TextOutput& to) const {
		beforeRead();
		if (m_data && !m_data->comment.empty()) {
			to.printf("\n/* %s */\n", m_data->comment.c_str());
		}

		switch (m_type) {
		case NONE:
			to.writeSymbol("NONE");
			break;

		case BOOLEAN:
			to.writeBoolean(m_simpleValue.b);
			break;

		case NUMBER:
			to.writeNumber(m_simpleValue.n);
			break;

		case STRING:
			debugAssert(m_data != NULL);
			to.writeString(*(m_data->value.s));
			break;

		case TABLE: {
			debugAssert(m_data != NULL);
			if (!m_data->name.empty()) {
				if (needsQuotes(m_data->name)) {
					to.writeString(m_data->name);
				}
				else {
					to.writeSymbol(m_data->name);
				}
			}
			to.writeSymbol("{");
			to.writeNewline();
			to.pushIndent();
			AnyTable& table = *(m_data->value.t);
			Array<std::string> keys;
			table.getKeys(keys);
			keys.sort();

			for (int i = 0; i < keys.size(); ++i) {
				to.writeSymbol(keys[i]);
				to.writeSymbol("=");
				table[keys[i]].serialize(to);

				if (i < keys.size() - 1) {
					to.writeSymbol(",");
				}
				to.writeNewline();

				// Skip a line between table entries
				to.writeNewline();
			}

			to.popIndent();
			to.writeSymbol("}");
			break;
		}

		case ARRAY: {
			debugAssert(m_data != NULL);
			if (!m_data->name.empty()) {
				// For arrays, leave no trailing space between the name and the paren
				to.writeSymbol(format("%s(", m_data->name.c_str()));
			}
			else {
				to.writeSymbol("(");
			}
			to.writeNewline();
			to.pushIndent();
			Array<Any>& array = *(m_data->value.a);
			for (int ii = 0; ii < size(); ++ii) {
				array[ii].serialize(to);
				if (ii < size() - 1) {
					to.writeSymbol(",");
					to.writeNewline();
				}

				// Put the close paren on an array right behind the last element
			}
			to.popIndent();
			to.writeSymbol(")");
			break;
		}
		}
	}
开发者ID:lev1976g,项目名称:easywow,代码行数:89,代码来源:Any.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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