This unit maintains and stores all standard Lazarus resources in the global LazarusResources list and provides methods and types for component streaming.

A Lazarus resource is streamed as an UTF-8 string, with a name, value and valuetype.

Lazarus resources are normally included via an include directive in the initialization part of a unit. To create such include files use the BinaryToLazarusResourceCode procedure.

To create an LRS file from an LFM file use the LFMtoLRSfile function which transforms the LFM text to binary format and stores it as Lazarus resource include file.

Text of the "automatically generated..." warning in resource files. ? The Lazarus resource descriptor class. The resource name. The resource type, always uppercase. The resource value. The container class for all Lazarus resources. Main list with all resource pointers. List needed for mergesort. 0 .. FSortedCount-1 resources are sorted Returns the index of the named resource, -1 if not found. The list is sorted, if required. Sorts the list by resource name. MergeSort sorting part. MergeSort merge part. Adds a resource. ValueType is stored in uppercase. A sinlge value string. The value splitted into an string array. Returns the resource of the given name (and type). Should be uppercase, if present. The number of listed resources. Indexed access to the resource list. Helper class for streaming resources (read only). Resource in FPC format. Initializes the resource descriptor. The descriptor must already exist. EResNotFound if the resource does not yet exist. The resource name. The resource type, can be Nil. Creates an resource stream for a named resource. The resource name. The resource type, can be Nil. Creates an resource stream for a resource ID. The resource ID. The resource type. Creates an resource stream from an resource descriptor. Raises an error on an attempt to write to the stream. The stream data must be provided by the implemented constructors and methods. EStreamError SCantWriteResourceStreamError. The resource descriptor, owned by the global resource list. ? Abstract base class for translators what's this?implemented where? The base class for an TReader.OnReadStringProperty handler. do what? The default translator instance to use in . Stack item type for the nested resource reader/writer. A list terminated by an EndList. empty entry? A component has two lists: properties and children. A list with a known (stored) number of entries. Stack item for the nested resource reader. The number of contained collections, needing an EndList. Reader for resource streams. Uses an stack for reading nested objects. The input stream buffer. Size of the input buffer. Current position in the input buffer. The number of bytes in the buffer. The object stack. The Length of the allocated stack. Skip the property name, then the property value. Skips until the next empty string. EndList? Push a new resource item. The Component whose properties follow. The number of contained lists, which need an EndList. Pop an item, or decrement its PushCount. Called on EndList (vaNull) encounterd ? Destroys the stack, during reader destrucion. Reads the 1-byte value type. Terminate reading a Component list (properties or children). Reads an 4 byte integer value. The input stream. The stream buffer size to allocate. Peek the next byte (value type indicator). Reads the next ValueType. Pops or pushes a stack item if required (for list or collection). Reads the filer signature from the input. EReadError 'Invalid Filer Signature' on filer signature mismatch. Returns the qualified current item name. Read a number of bytes from the input stream. Reads binary data, stored with a Length prefix. Reads an Extended value (10 Bytes). The result may have less bytes, when Extended is not a 10 byte value. Reads an Single value (4 bytes). Reads an Currency value (8 bytes). Reads an Date value (8 bytes). Reads an identifier, maybe a name or a standard key (which is not stored). GDB error on an unexpected ValueType. The expected type: vaIdent for an stored name, or vaNil, vaFalse, vaTrue, vaNull for an standard string. Reads enum member names, until an empty string is read. The constructed set, as an Integer. The expected set type. Reads an ShortString. Skips an entire Component. If True: skip prefix, component class name and component object name. Skips the next value. The input stream. The root component reader ? Tracking what already has been stored or written. now writing header header saved on stack, not yet written to stream, waiting for data header written to stream, data written Stack item for the nested resource writer. waiting for this number of Pops Index in a collection or list. Object writer for Lazarus Resource Streams. The TLRSObjectWriter can find empty entries and omit writing them to stream. Writes multiples words (WideChar) with reversed byte order. ? ? Sort the items by LFM or LRS position. True for sorting by LFM position. Searches for an item by LFM or LRS position. True for searching an LFM position. Find a random item within an position range. First acceptable position. First position after the range (exclude) True for searching LFM positions. Change the position of an item within the given position range. First acceptable position. First position after the range (exclude) The new position. True for using LFM positions. Indexed access to the LFM positions. Indexed access to the LRS positions. Indexed access to the Data pointers. Parser for identifiers, and string and number literals.

Use to get the next token. The token type also is available in Token.

Allowed whitespace is newline (CR,LF), tab and space.

Allowed identifiers consist of ASCII letters, digits or underscore.

Strings are a sequence of quoted strings or #nn characters.

Numbers are parsed as integer or floating point values, with toFloat values subdivided into number, single, date or currency, according to FloatType.

All other characters are returned literally.

The input stream. The allocated buffer. Number of valid chars (bytes) in the buffer. Current position (index) in the buffer. Buffer-relative begin of the current line. column = fPos - fLineStart + 1 True when reached the end of the input stream. Holds the last parsed token text ? The name of a token, maybe the Token character itself. Fills the buffer from the input stream. Skips to the next non-null character ? Add the current character to the token string. True when the current character is a digit. True when the current character is a hex digit. True when the current character is an ASCII character (or underscore). Should mean: all allowed characters in an identifier. [To be updated for Unicode identifiers] True when the current character is a digit or IsAlpha. Returns the value of a hex digit. Parses and returns an identifier. EParserError when the current character is not valid for an identifier. Skip CR/LF, adjust SourceLine. Skip space and tab chars. Skip all whitespace characters. Marks end of input reached (fEofReached). Parse an identifier. Parse a number, recognizing trailing floating point format specifiers. Parse a hex number, prefix the token string with '$'. EParserError when no valid hex digit was found. Parse an quoted string, excluding the leading and trailing quotes. EParserError on an unterminated string literal. Parse an decimal Unicode codepoint, return it as an UTF-8 string. Is set to False on a non-ASCII character. Parses a string literal.

The string can consist of quoted strings and Unicode codepoints. Surrounding quote characters are removed.

The result is stored in fLastTokenStr, in UTF-8 encoding.

The resulting token is toString for all-ASCII strings, else toWString.

Tries to parse a negative number, or a single '-' character. Sets Token to the unrecognized character (no error). Asserts that Token is of the expected type. EParserError when Token doesn't match the expected type. The expected token type. Asserts that the given name was parsed (case insensitive). EParserError when Token doesn't match the expected type or name. The expected identifier. Raises an EParserError with the given message. The message text. Raises an EParserError with the formatted message. The Format string. The arguments to be formatted. Raises an EParserError with the given message, adding source position information. Writes an hex value into the output stream.

The hex digits must occur in pairs, for every byte.

The binary bytes are written in input order (highest first).

EParserError on unpaired hex digits.
The output stream. Parses the next token. The token type. Returns the current position in the input stream. Parses an (possibly) qualified identifer, after a symbol has been parsed. EParserError when Token is not toSymbol. Returns the binary value of a floating point number. EParserError on an invalid number. Returns the binary value of an integral number. Returns the last parsed token as an string. Compares the parsed symbol with the given string (case-insensitive). True when a matching symbol has been parsed. The type of the parsed floating point number. (number, date...) The current line number in the input stream. The current column number in the source line. The last parsed token type. A queue to stream components, used for multithreading or network.

The function ConvertComponentAsString converts a component to binary format with a leading size information (using WriteLRSInt64MB).

When streaming components over network, they will arrive in chunks.

TCustomLazComponentQueue tells you, if a whole component has arrived.

Converts a component to binary format with a leading size information (using WriteLRSInt64MB). ? ? Item of TPropertiesToSkip ? ? The list of all loaded standard resources. ? FPC is not optimized for building a constant string out of thousands of lines. It needs huge amounts of memory and becomes very slow. Therefore big files are split into several strings. Writes an integer value, using the smallest possible representation. Registers the component TLazComponentQueue. Raises an EReadError exception. Raises an InvalidPropertyValue EReadError.