BSDL Device Tree Compiler
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
dtc::fdt::node Class Reference

Public Types

typedef std::vector< node * >
::iterator 
child_iterator
 
typedef std::vector< property * >
::iterator 
property_iterator
 

Public Member Functions

void sort ()
 
child_iterator child_begin ()
 
child_iterator child_end ()
 
property_iterator property_begin ()
 
property_iterator property_end ()
 
 ~node ()
 
propertyget_property (string key)
 
void add_property (property *p)
 
void merge_node (node *other)
 
void write (dtb::output_writer &writer, string_table &strings)
 
void write_dts (FILE *file, int indent)
 

Static Public Member Functions

static nodeparse (input_buffer &input, string name, string label=string(), string address=string())
 
static nodeparse_dtb (input_buffer &structs, input_buffer &strings)
 

Public Attributes

string label
 
string name
 
string unit_address
 

Detailed Description

Class encapsulating a device tree node. Nodes may contain properties and other nodes.

Member Typedef Documentation

typedef std::vector<node*>::iterator dtc::fdt::node::child_iterator

Iterator type for child nodes.

typedef std::vector<property*>::iterator dtc::fdt::node::property_iterator

Iterator type for properties of a node.

Constructor & Destructor Documentation

dtc::fdt::node::~node ( )
inline

Destroys the node, recursively deleting all of its properties and children.

Member Function Documentation

void dtc::fdt::node::add_property ( property p)
inline

Adds a new property to this node.

child_iterator dtc::fdt::node::child_begin ( )
inline

Returns an iterator for the first child of this node.

child_iterator dtc::fdt::node::child_end ( )
inline

Returns an iterator after the last child of this node.

property* dtc::fdt::node::get_property ( string  key)
inline

Returns a property corresponding to the specified key, or 0 if this node does not contain a property of that name.

void dtc::fdt::node::merge_node ( node other)
inline

Merges a node into this one. Any properties present in both are overridden, any properties present in only one are preserved.

static node* dtc::fdt::node::parse ( input_buffer input,
string  name,
string  label = string(),
string  address = string() 
)
inlinestatic

Factory method for constructing a new node. Attempts to parse a node in DTS format from the input, and returns it on success. On any parse error, this will return 0. This should be called with the cursor on the open brace of the property, after the name and so on have been parsed.

static node* dtc::fdt::node::parse_dtb ( input_buffer structs,
input_buffer strings 
)
inlinestatic

Factory method for constructing a new node. Attempts to parse a node in DTB format from the input, and returns it on success. On any parse error, this will return 0. This should be called with the cursor on the open brace of the property, after the name and so on have been parsed.

property_iterator dtc::fdt::node::property_begin ( )
inline

Returns an iterator after the last property of this node.

property_iterator dtc::fdt::node::property_end ( )
inline

Returns an iterator for the first property of this node.

void dtc::fdt::node::sort ( )
inline

Sorts the node's properties and children into alphabetical order and recursively sorts the children.

void dtc::fdt::node::write ( dtb::output_writer writer,
string_table strings 
)
inline

Write this node to the specified output. Although nodes do not refer to a string table directly, their properties do. The string table passed as the second argument is used for the names of properties within this node and its children.

void dtc::fdt::node::write_dts ( FILE *  file,
int  indent 
)
inline

Writes the current node as DTS to the specified file. The second parameter is the indent level. This function will start every line with this number of tabs.

Member Data Documentation

string dtc::fdt::node::label

The label for this node, if any. Node labels are used as the targets for cross references.

string dtc::fdt::node::name

The name of the node.

string dtc::fdt::node::unit_address

The unit address of the node, which is optionally written after the name followed by an at symbol.


The documentation for this class was generated from the following file: