Adobe Systems Incorporated

Layout description assembler/disassembler. More...


typedef pair< forest
< dictionary_t >, vector
< dictionary_t > > 


void assemble_layout (const string_t &layout_name, const layout_assembly_t &assembly, std::ostream &out)
layout_assembly_t disassemble_layout (std::istream &stream, const line_position_t &position)

Detailed Description

This code is useful for parsing a layout description to an intermediate format for later modification and/or formatting back out to a CEL-based layout.

The layout disassembler finds two basic layout components during a parse. The first a forest of view declarations, the second is a set of layout cells.

Each parsed view and cell in the layout is is represented by its own dictionary. Each dictionary contains within it a set of associated values that completely describe the layout cell or view that has been parsed. They are:

keymapped typecell/view/bothdescriptionnotes
cell_type adobe::name_t cell The type of cell parsed Value is one of interface or constant.
comment_brief adobe::string_t both The comment found after the view parsed in C++ "//..." format
comment_detailed adobe::string_t both The comment found before the view parsed in C "/*...*/" format
initializer adobe::array_t cell Parsed token expression Use a virtual_machine_t to evaluate the token vector to get the initial state of the cell
name adobe::name_t both Name of the cell or view
parameters adobe::array_t view Named argument set parsed as the attributes of the view The array is an expression vector that always evaluates to an adobe::dictionary_t. To get the dictionary the expression must be evaluated by an adobe::virtual_machine_t
Source File:
layout sample_dialog
        pi : 355/113; // approximation

        advanced : false;

    view dialog(name: "Sample Dialog")
        edit_text(name: 'Name:', bind: @cell_name); // Maybe full name?
        checkbox(name: 'Advanced Options', bind: @advanced);
View Forest and Cell Set Result:
[ {
	comment_brief: '',
	comment_detailed: '',
	name: @dialog,
	parameters: [ @name, 'Sample Dialog', 1, @.dictionary ]
}, [ {
	comment_brief: ' Maybe full name?',
	comment_detailed: '',
	name: @edit_text,
	parameters: [ @name, 'Name:', @bind, @cell_name, 2, @.dictionary ]
}, {
	comment_brief: '',
	comment_detailed: '',
	name: @checkbox,
	parameters: [ @name, 'Advanced Options', @bind, @advanced, 2, @.dictionary ]
} ] ]

[ {
	cell_type: @constant,
	comment_brief: ' approximation',
	comment_detailed: '',
	initializer: [ 355, 113, @.divide ],
	name: @pi
}, {
	cell_type: @interface,
	comment_brief: '',
	comment_detailed: '',
	initializer: [ false ],
	name: @advanced
} ]
See also:
  • adobe::format_expression

Typedef Documentation

typedef pair<forest<dictionary_t>, vector<dictionary_t> > layout_assembly_t

The result type of adobe::disassemble_layout. first is a forest of dictionaries, each dictionary describing a node parsed in the layout. second is a vector of dictionaries, each representing a layout cell parsed in the layout.

Definition at line 184 of file layout_formatter.hpp.

Function Documentation

void adobe::assemble_layout ( const string_t &  layout_name,
const layout_assembly_t &  assembly,
std::ostream &  out 

Assembles fundamental layout components into a CEL-syntax layout definition.

layout_namethe name to give to the final layout.
assemblythe fundamental layout components to be used in the layout creation
outthe stream to which the final result is to be output
layout_assembly_t adobe::disassemble_layout ( std::istream &  stream,
const line_position_t &  position 

Breaks down a layout definition to its fundamental components.

streamthe layout definition stream
positionan adobe::line_position_t describing the stream
an adobe::layout_assembly_t fully describing the layout components

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google