Class TMFString

Unit

Declaration

type TMFString = class(TX3DMultField)

Description

This item has no description. Showing description inherited from TX3DMultField.

X3D field with a list of values.

Hierarchy

Overview

Methods

Public constructor Create(const AParentNode: TX3DFileItem; const AExposed: boolean; const AName: String; const InitialContent: array of string);
Public constructor CreateUndefined(const AParentNode: TX3DFileItem; const AExposed: boolean; const AName: String); override;
Public destructor Destroy; override;
Public function FastEqualsValue(SecondValue: TX3DField): boolean; override;
Public procedure ParseValue(Lexer: TX3DLexer; Reader: TX3DReader); override;
Public class function X3DType: String; override;
Public class function CreateEvent(const AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean): TX3DEvent; override;
Public procedure ParseXMLAttribute(const AttributeValue: String; Reader: TX3DReader); override;
Public function SaveToXmlValue: TSaveToXmlMethod; override;
Public procedure Assign(Source: TPersistent); override;
Public procedure AssignValue(Source: TX3DField); override;
Public procedure AssignDefaultValueFromValue; override;
Public procedure UnassignDefaultValue; override;
Public function Equals(SecondValue: TX3DField): boolean; override;
Public function EqualsDefaultValue: boolean; override;
Public procedure Send(const AValue: array of string); overload;
Public procedure Send(const AValue: TCastleStringList); overload;

Properties

Public property Items: TCastleStringList read FItems write SetItems;
Public property ItemsSafe[Index: Integer]: String read GetItemsSafe write SetItemsSafe;

Description

Methods

Public constructor Create(const AParentNode: TX3DFileItem; const AExposed: boolean; const AName: String; const InitialContent: array of string);

This item has no description.

Public constructor CreateUndefined(const AParentNode: TX3DFileItem; const AExposed: boolean; const AName: String); override;

This item has no description. Showing description inherited from TX3DField.CreateUndefined.

Main constructor that initializes field when default value is not known.

It is virtual, so you can use it to construct field instance when field class is known only at runtime. For example you can have variable like "FieldClass: TX3DFieldClass" and use it to construct the field instance. Such field can be later initialized e.g. using Parse.

Note: Two exceptional VRML 1.0 fields simply cannot work when initialized by this constructor: TSFEnum and TSFBitMask . They simply need to know their TSFEnum.EnumNames, or TSFBitMask.FlagNames + TSFBitMask.NoneString + TSFBitMask.AllString before they can be parsed. Luckily these fields have been removed in VRML 2.0 and X3D so we don't need to support them e.g. in VRML 2.0 and X3D prototypes.

Descendants implementors:

1. Descendants should override this virtual constructor, CreateUndefined, to do all obligatory initialization work (e.g. create some internal TStringList).

Call "inherited" at the beginning of the implementation of this overridden "CreateUndefined".

2. Can Create also a convenience non-virtual constructor Create, that takes as parameter initial value (with type specific to given field, e.g. Integer for TSFInt32).

This convenience constructor should call "CreateUndefined" (not "inherited Create" or "inherited CreateUndefined"!) at the beginning.

TODO: Rename this to just Create, to obscure parent Create. After everything migrated to calling CreateUndefined.

Public destructor Destroy; override;

This item has no description.

Public function FastEqualsValue(SecondValue: TX3DField): boolean; override;

This item has no description. Showing description inherited from TX3DField.FastEqualsValue.

Compare value of this field, with other field, fast.

This compares only the values of the fields, not other properties (it doesn't care about names of the fields or such, or default values; only current values). In other words, it compares only the things copied by AssignValue.

This tries to compare very fast, which means that for large (multi-valued) fields it may give up and answer False even when they are in fact equal. So this is usable only for optimization purposes: when it answers True, it is True. When it answers False, it actually doesn't know.

Default implementation in this class (TX3DField) just returns False.

Public procedure ParseValue(Lexer: TX3DLexer; Reader: TX3DReader); override;

Parse MF field. This class handles parsing fully, usually no need to override this more in descendants. It uses TSingleField.Parse method.

Public class function X3DType: String; override;

This item has no description. Showing description inherited from TX3DField.X3DType.

Field type in X3D, like 'SFString' or 'MFInt32'. As for VRML/X3D interface declaration statements. In base TX3DField class, this returns XFAny (name indicating any type, used by instantreality and us).

Public class function CreateEvent(const AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean): TX3DEvent; override;

This item has no description. Showing description inherited from TX3DField.CreateEvent.

Create TX3DEvent descendant suitable as exposed event for this field.

Public procedure ParseXMLAttribute(const AttributeValue: String; Reader: TX3DReader); override;

This item has no description. Showing description inherited from TX3DField.ParseXMLAttribute.

Parse field value from X3D XML encoded attribute.

Implementation in this class creates a Lexer to parse the string, and calls ParseXMLAttributeLexer.

Public function SaveToXmlValue: TSaveToXmlMethod; override;

This item has no description.

Public procedure Assign(Source: TPersistent); override;

Copy another field value, default value and other properties.

Public procedure AssignValue(Source: TX3DField); override;

This item has no description. Showing description inherited from TX3DField.AssignValue.

Copies the current field value. Contrary to TPersistent.Assign, this doesn't copy the rest of properties.

After setting, our ValueFromIsClause is always changed to False. You can manually change it to True, if this copy indeed was done following "IS" clause.

Descendants implementors notes:

In this class, implementation takes care of setting our ValueFromIsClause to False. In descendants, you should do like

if Source is <appropriate class> then
begin
  inherited;
  Value := Source.value;
end else
  AssignValueRaiseInvalidClass(Source);

Public procedure AssignDefaultValueFromValue; override;

This item has no description. Showing description inherited from TX3DField.AssignDefaultValueFromValue.

Set field's default value from the current value.

Note that for now this doesn't guarantee that every possible field's value can be stored as default value. In case of trouble, it will silently record "no default is known" information, so e.g. EqualsDefaultValue will always return False. Our default value mechanisms are sometimes limited, not every value can be a default value. For example, for multiple-valued nodes, we usually cannot save arrays longer than one as default value. This is not a problem, since X3D specification doesn't specify too long default values. But it may be a problem for prototypes, since then user can assign any value as default value. May be corrected in the future.

Public procedure UnassignDefaultValue; override;

This item has no description. Showing description inherited from TX3DField.UnassignDefaultValue.

Remove default value, recording that "no default is known". In effect EqualsDefaultValue will always return False.

Public function Equals(SecondValue: TX3DField): boolean; override;

Checks equality between this and SecondValue field. In addition to inherited(Equals), this checks the actual contents of the items. Note that floating-point values are compared with some tolerance for errors by this method.

Public function EqualsDefaultValue: boolean; override;

This item has no description. Showing description inherited from TX3DField.EqualsDefaultValue.

Whether the value is equal to default. Returns always False in TX3DField, descendants should override it. It is used when writing the field value to X3D file (values that are default do not have to be written, ever).

Public procedure Send(const AValue: array of string); overload;

Set the field's value in a correct way (by sending X3D event, or at least notifying the parent scene).

Public procedure Send(const AValue: TCastleStringList); overload;

This item has no description.

Properties

Public property Items: TCastleStringList read FItems write SetItems;

This item has no description.

Public property ItemsSafe[Index: Integer]: String read GetItemsSafe write SetItemsSafe;

This item has no description.


Generated by PasDoc 0.16.0-snapshot.