Index

Package: Catalogs

Description

private package Tiles.Catalogs is
Copyright (c) 2012 Kevin Wellwood All rights reserved. This source code is distributed under the Modified BSD License. For terms and conditions, see license.txt.

Classes

Catalog

type Catalog is new Object with private;

Ancestors:

Primitive operations:

Adjust (overriding Objects.Adjust)
Delete (overriding Objects.Delete)
Object_Input
Object_Output
Object_Read (overriding Objects.Object_Read)
Object_Write (overriding Objects.Object_Write)
Objects.Construct (Inherited)
Objects.To_String (Inherited)
A Catalog indexes and organizes all the Tiles in a Tile_Library. It is stored inside a tile library as a catalog file, alongside all the bitmap files. In addition to indexing tiles, it indexes tile matrices for repeated tile patterns and large, multi-tile objects.

Types

A_Catalog

type A_Catalog is access all Catalog'Class;

Constants & Global variables

DUPLICATE_TILE

DUPLICATE_TILE : exception;
raised on attempt to add a tile with a duplicate id

Subprograms & Entries

Create_Catalog

function Create_Catalog return A_Catalog;
Creates a new empty tile catalog.

Add_Matrix

procedure Add_Matrix
( this: not null access Catalog'Class;
matrix: in out A_Tile_Matrix );
Adds a new tile matrix to the catalog. 'matrix' will be consumed.

Add_Tile

procedure Add_Tile
( this: not null access Catalog'Class;
tile: in out A_Tile );
Adds a new tile to the catalog. 'tile' is consumed. If 'tile' is passed as null, an empty tile slot is added to the tile list as a place holder. The exception DUPLICATE_TILE will be raised if a tile with the same id already exists in the catalog.

Find_Tile

function Find_Tile
( this: not null access Catalog'Class;
name: String ) return A_Tile;
Finds a tile with a name matching 'name' and returns a reference. The tile with the first matching name will be returned. If 'name' does not include a file extension, a matching .png file will be searched first, then a matching .bmp file. Do not modify the tile; it belongs to the catalog. Null will be returned if no tile is not found.

Get_Matrix

function Get_Matrix
( this: not null access Catalog'Class;
index: Natural ) return A_Tile_Matrix;
Returns a reference to a matrix in the catalog by index, base 1. The index is determined by the order in which the matrices were added. If there is no matrix at 'index' then null will be returned.

Get_Matrix_Count

function Get_Matrix_Count
( this: not null access Catalog'Class ) return Natural;
Returns the number of matrices in the catalog.

Get_Tile

function Get_Tile
( this: not null access Catalog'Class;
id: Natural ) return A_Tile;
Returns a tile reference by id, base 1. Do not modify the tile; it belongs to the catalog. Null will be returned if the id is not found.

Iterate_By_Id

procedure Iterate_By_Id
( this: not null access Catalog'Class;
examine: not null access procedure( tile : not null A_Tile ) );
Iterates across all the tiles in the catalog by order of ascending id.

Iterate_By_Slot

procedure Iterate_By_Slot
( this: not null access Catalog'Class;
examine: not null access procedure( slot : Positive;
tile: A_Tile ) );
Iterates across all the tile slots in the catalog, beginning with 1. Not every slot contains a tile, so the 'tile' argument of 'examine' may be null.

Object_Input

function Object_Input
( stream: access Root_Stream_Type'Class ) return Catalog;

Object_Output

procedure Object_Output
( stream: access Root_Stream_Type'Class;
obj: Catalog );

Delete

procedure Delete
( this: in out A_Catalog );
Deletes the Catalog and all the Tiles it currently contains.

Catalog_Format_Version

function Catalog_Format_Version return Natural;
Returns the version number of the tile catalog's stream format. Different version numbers are incompatible.