Exemplo n.º 1
0
static void write_internal(config const &cfg, std::ostream &out, std::string& textdomain, size_t tab = 0)
{
	if (tab > max_recursion_levels)
		throw config::error("Too many recursion levels in config write");

	foreach (const config::attribute &i, cfg.attribute_range()) {
		write_key_val(out, i.first, i.second, tab, textdomain);
	}

	foreach (const config::any_child &item, cfg.all_children_range())
	{
		write_open_child(out, item.key, tab);
		write_internal(item.cfg, out, textdomain, tab + 1);
		write_close_child(out, item.key, tab);
	}
}
Exemplo n.º 2
0
    void write_operator(disk_stream *inflight)
    {
      if(inflight->request == NULL) {
	flush(inflight);
	inflight->flush_complete = true;
      }
      else {
	if(inflight->compressed) {
	  compress_and_write_internal(inflight);
	}
	else {
	  write_internal(inflight);
	}
	inflight->request->dirty    = false;
	inflight->request->uptodate = true;
	inflight->flush_complete    = true;
      }
    }
Exemplo n.º 3
0
static void write_internal(config const &cfg, std::ostream &out, std::string& textdomain, size_t tab = 0)
{
	if (tab > max_recursion_levels)
		throw config::error("Too many recursion levels in config write");

	for (const config::attribute &i : cfg.attribute_range()) {
		if (!config::valid_id(i.first)) {
			ERR_CF << "Config contains invalid attribute name '" << i.first << "', skipping...\n";
			continue;
		}
		write_key_val(out, i.first, i.second, tab, textdomain);
	}

	for (const config::any_child &item : cfg.all_children_range())
	{
		if (!config::valid_id(item.key)) {
			ERR_CF << "Config contains invalid tag name '" << item.key << "', skipping...\n";
			continue;
		}
		write_open_child(out, item.key, tab);
		write_internal(item.cfg, out, textdomain, tab + 1);
		write_close_child(out, item.key, tab);
	}
}
Exemplo n.º 4
0
void write(std::ostream &out, config const &cfg, unsigned int level)
{
	std::string textdomain = PACKAGE;
	write_internal(cfg, out, textdomain, level);
}
Exemplo n.º 5
0
	ssize_t write(char* buffer, size_t size) {
		ssize_t bytes = write_internal(buffer, size, _pos);
		_pos += bytes;
		return bytes;
	}
Exemplo n.º 6
0
SCM_EXPORT void
scm_display(ScmObj port, ScmObj obj)
{
    write_internal(port, obj, AS_DISPLAY);
}
Exemplo n.º 7
0
SCM_EXPORT void
scm_write(ScmObj port, ScmObj obj)
{
    write_internal(port, obj, AS_WRITE);
}