Class TX3DInterfaceDeclaration

Unit

Declaration

type TX3DInterfaceDeclaration = class(TX3DFileItem)

Description

Interface declaration, used in VRML/X3D (exposed) prototypes and for nodes with dynamic fields (Script, ComposedShader). See VRML 2.0 and X3D specs.

Each interface specification is a field or an event, stored in FieldOrEvent. FieldOrEvent is Nil before parsing.

Field value is not initialized if you passed FieldValue = False to Parse (although IsClauseNames will always be initialized). FieldValue = True is used for prototype (not external) declarations and nodes with interface declarations (Script, ComposedShader etc.). In the future maybe some property like FieldValueInitialized will be exposed here, if needed at some point.

Interface declaration doesn't have much properties, since all the information is contained within FieldOrEvent instance, like Name, field class type, out or in (in case of event), exposed or not (in case of field), IsClauseNames.

Hierarchy

Overview

Methods

Public constructor Create(AParentNode: TX3DNode);
Public destructor Destroy; override;
Public procedure AddFieldOrEvent(Node: TX3DNode);
Public procedure Parse(Lexer: TX3DLexer; Reader: TX3DReaderNames; FieldValue, IsClauseAllowed: boolean);
Public procedure ParseXML(Element: TDOMElement; Reader: TX3DReaderNames; FieldValue: boolean);
Public procedure IDeclSaveToStream(Writer: TX3DWriter; FieldValue: boolean);
Public procedure SaveToStream(Writer: TX3DWriter); override;
Public function AccessType: TX3DAccessType;
Public function DeepCopy(const NewParentNode: TX3DNode; const CopyState: TX3DNodeDeepCopyState): TX3DInterfaceDeclaration;

Properties

Public property ParentNode: TX3DNode read FParentNode;
Public property FieldOrEvent: TX3DFieldOrEvent read FFieldOrEvent write SetFieldOrEvent;
Public property Field: TX3DField read FField;
Public property Event: TX3DEvent read FEvent;

Description

Methods

Public constructor Create(AParentNode: TX3DNode);
 
Public destructor Destroy; override;
 
Public procedure AddFieldOrEvent(Node: TX3DNode);

Copies only reference to FieldOrEvent, adding it to Node.Fields or Node.Events.

Public procedure Parse(Lexer: TX3DLexer; Reader: TX3DReaderNames; FieldValue, IsClauseAllowed: boolean);
 
Public procedure ParseXML(Element: TDOMElement; Reader: TX3DReaderNames; FieldValue: boolean);

Parse interface declaration encoded in XML.

Note that classic VRML parser has here IsClauseAllowed: boolean parameter, this was set to True when parsing InterfaceDeclarations of special nodes (Script, ComposedShader etc.), since they could have IS clause (at least, as far as I understood the spec). But for X3D XML encoding, it's not available, since (AFAI understand the X3D XML encoding spec) the <IS> element inside node body may point from nodeField to any interface field of this node, including InterfaceDeclarations. So ParseISStatement handles this.

Public procedure IDeclSaveToStream(Writer: TX3DWriter; FieldValue: boolean);

Save this interface declaration to stream. This assumes that it starts at the beginning of the line, and at the end always writes NL, so at the end it's also at the beginning of some line.

For XML encoding, IS clauses are not saved here. They must be saved by containing node.

Parameters
FieldValue
If True then we will always save Field value or (if classic encoding) IS clauses to stream, along with this interface declaration (if this interface declaration has the Field set). Otherwise, field's value will not be saved, only IS clauses if present.
Public procedure SaveToStream(Writer: TX3DWriter); override;

Save this interface declaration to stream.

See also
IDeclSaveToStream
Save this interface declaration to stream.
Public function AccessType: TX3DAccessType;

Returns access type, corresponding to current Event and Field values.

Result is undefined if both Event and Field are Nil (which may happen when it's not initialized (e.g. parsed) yet) or when both are non-nil (which should never happen).

Public function DeepCopy(const NewParentNode: TX3DNode; const CopyState: TX3DNodeDeepCopyState): TX3DInterfaceDeclaration;
 

Properties

Public property ParentNode: TX3DNode read FParentNode;

Containing node, if any, for this VRML interface declaration. This must also be set to FieldOrEvent.ParentNode created for this interface declaration.

Public property FieldOrEvent: TX3DFieldOrEvent read FFieldOrEvent write SetFieldOrEvent;

Field or event of this interface declaration. Is non-nil after parsing.

You can assign to this property, to constructs interface declarations (and so also prototypes) in your own code (e.g. this is used X3D XML reader). Just be careful, and remember that this object owns FieldOrEvent (that is, will free it at destruction).

Public property Field: TX3DField read FField;

Return FieldOrEvent casted as appropriate class. Nil if such cast is not possible, for example when FieldOrEvent is an event and you try to use Field method.

Public property Event: TX3DEvent read FEvent;
 

Generated by PasDoc 0.16.0.