Пример #1
0
 void CheckNesting::invalid_charset_parent(Statement* parent)
 {
   if (!(
       is_root_node(parent)
   )) {
     throw Exception::InvalidSass(
       parent->pstate(),
       "@charset may only be used at the root of a document."
     );
   }
 }
Пример #2
0
  bool CheckNesting::is_transparent_parent(Statement* parent, Statement* grandparent)
  {
    bool parent_bubbles = parent && parent->bubbles();

    bool valid_bubble_node = parent_bubbles &&
                             !is_root_node(grandparent) &&
                             !is_at_root_node(grandparent);

    return dynamic_cast<Import*>(parent) ||
           dynamic_cast<Each*>(parent) ||
           dynamic_cast<For*>(parent) ||
           dynamic_cast<If*>(parent) ||
           dynamic_cast<While*>(parent) ||
           dynamic_cast<Trace*>(parent) ||
           valid_bubble_node;
  }
Пример #3
0
ttree_view_node& ttree_view_node::add_child(
		  const std::string& id
		, const std::map<std::string /* widget id */, string_map>& data
		, const int index)
{

	boost::ptr_vector<ttree_view_node>::iterator itor = children_.end();

	if(static_cast<size_t>(index) < children_.size()) {
		itor = children_.begin() + index;
	}

	itor = children_.insert(itor, new ttree_view_node(
			  id
			, node_definitions_
			, this
			, tree_view()
			, data));

	if(is_folded() || is_root_node()) {
		return *itor;
	}

	if(tree_view().get_size() == tpoint(0, 0)) {
		return *itor;
	}

	assert(tree_view().content_grid());
	const int current_width = tree_view().content_grid()->get_width();

	// Calculate width modification.
	tpoint best_size = itor->get_best_size();
	best_size.x += get_indention_level() * tree_view().indention_step_size_;
	const unsigned width_modification = best_size.x > current_width
			? best_size.x - current_width
			: 0;

	// Calculate height modification.
	const int height_modification = best_size.y;
	assert(height_modification > 0);

	// Request new size.
	tree_view().resize_content(width_modification, height_modification);

	return *itor;
}
Пример #4
0
/* The following routines deal with the black magic of fully naming a
 * node.
 *
 * Certain well known named nodes are just the simple name string.
 *
 * Actual devices have an address specifier appended to the base name
 * string, like this "foo@addr".  The "addr" can be in any number of
 * formats, and the platform plus the type of the node determine the
 * format and how it is constructed.
 *
 * For children of the ROOT node, the naming convention is fixed and
 * determined by whether this is a sun4u or sun4v system.
 *
 * For children of other nodes, it is bus type specific.  So
 * we walk up the tree until we discover a "device_type" property
 * we recognize and we go from there.
 *
 * As an example, the boot device on my workstation has a full path:
 *
 *	/pci@1e,600000/ide@d/disk@0,0:c
 */
static void __init sun4v_path_component(struct device_node *dp, char *tmp_buf)
{
	struct linux_prom64_registers *regs;
	struct property *rprop;
	u32 high_bits, low_bits, type;

	rprop = of_find_property(dp, "reg", NULL);
	if (!rprop)
		return;

	regs = rprop->value;
	if (!is_root_node(dp->parent)) {
		sprintf(tmp_buf, "%s@%x,%x",
			dp->name,
			(unsigned int) (regs->phys_addr >> 32UL),
			(unsigned int) (regs->phys_addr & 0xffffffffUL));
		return;
	}
Пример #5
0
char * __init build_full_name(struct device_node *dp)
{
	int len, ourlen, plen;
	char *n;

	plen = strlen(dp->parent->full_name);
	ourlen = strlen(dp->path_component_name);
	len = ourlen + plen + 2;

	n = prom_early_alloc(len);
	strcpy(n, dp->parent->full_name);
	if (!is_root_node(dp->parent)) {
		strcpy(n + plen, "/");
		plen++;
	}
	strcpy(n + plen, dp->path_component_name);

	return n;
}
Пример #6
0
const ttree_view_node& ttree_view_node::parent_node() const
{
	assert(!is_root_node());
	return *parent_node_;
}
Пример #7
0
	/**
	 * Adds a sibbling for a node at the end of the list.
	 *
	 * @param id                  The id of the node definition to use for the
	 *                            new node.
	 * @param data                The data to send to the set_members of the
	 *                            widgets. If the member id is not an empty
	 *                            string it is only send to the widget that has
	 *                            the wanted id (if any). If the member id is an
	 *                            empty string, it is send to all members.
	 *                            Having both empty and non-empty id's gives
	 *                            undefined behaviour.
	 */
	ttree_view_node& add_sibling(const std::string& id
			, const std::map<std::string /* widget id */, string_map>& data)
	{
		assert(!is_root_node());
		return parent_node().add_child(id, data);
	}