Mapper  0.9.0
API documentation
Functions
ocad_symbol.c File Reference

(f662771 on 7 Mar 2013)

#include "libocad.h"
Include dependency graph for ocad_symbol.c:

Functions

OCADSymbolIndex * ocad_symidx_first (OCADFile *pfile)
 Returns a pointer to the first symbol index block, or nullptr if the file isn't valid. More...
 
OCADSymbolIndex * ocad_symidx_next (OCADFile *pfile, OCADSymbolIndex *current)
 Returns a pointer to the next symbol index block after the given one, or nullptr if there is none. More...
 
int ocad_symbol_count (OCADFile *pfile)
 Returns the number of symbols defined in the file, or -1 if the file is invalid. More...
 
OCADSymbol * ocad_symbol_new (OCADFile *pfile, int size)
 Adds a new symbol with the given size in bytes to the file and returns a pointer to the new symbol. More...
 
OCADSymbol * ocad_symbol_at (OCADFile *pfile, OCADSymbolIndex *current, int index)
 Returns a pointer to the symbol in the specified location within the index block, or nullptr if there is no such symbol. More...
 
OCADSymbol * ocad_symbol (OCADFile *pfile, word number)
 Finds the symbol with a particular number, or nullptr if no such symbol exists. More...
 
bool ocad_symbol_iterate (OCADFile *pfile, OCADSymbolCallback callback, void *param)
 Iterates over all symbols in the file. More...
 
bool ocad_symbol_uses_color (const OCADSymbol *symbol, s16 number)
 Returns TRUE if the symbol uses the given color number, FALSE otherwise. More...
 
bool ocad_symbol_element_iterate (s16 ngrp, OCADPoint *pts, OCADSymbolElementCallback callback, void *param)
 Iterates over all symbol elements in the given location. More...
 
bool ocad_symbol_elements_use_color (s16 ngrp, OCADPoint *pts, s16 number)
 Returns TRUE if any of the sequence of symbol elements at the given location use the specified color. More...
 

Function Documentation

◆ ocad_symbol()

OCADSymbol* ocad_symbol ( OCADFile pfile,
word  number 
)

Finds the symbol with a particular number, or nullptr if no such symbol exists.

◆ ocad_symbol_at()

OCADSymbol* ocad_symbol_at ( OCADFile pfile,
OCADSymbolIndex *  current,
int  index 
)

Returns a pointer to the symbol in the specified location within the index block, or nullptr if there is no such symbol.

◆ ocad_symbol_count()

int ocad_symbol_count ( OCADFile pfile)

Returns the number of symbols defined in the file, or -1 if the file is invalid.

◆ ocad_symbol_element_iterate()

bool ocad_symbol_element_iterate ( s16  ngrp,
OCADPoint *  pts,
OCADSymbolElementCallback  callback,
void *  param 
)

Iterates over all symbol elements in the given location.

ngrp is the number of 8-byte groups, starting at the pts pointer. Currently this is used in two places; within point objects, and within area objects that have a pattern defined. The callback should return TRUE to continue iteration or FALSE to abort iteration. This function returns TRUE if the iteration completed successfully, FALSE if it was aborted by the callback.

◆ ocad_symbol_elements_use_color()

bool ocad_symbol_elements_use_color ( s16  ngrp,
OCADPoint *  pts,
s16  number 
)

Returns TRUE if any of the sequence of symbol elements at the given location use the specified color.

◆ ocad_symbol_iterate()

bool ocad_symbol_iterate ( OCADFile pfile,
OCADSymbolCallback  callback,
void *  param 
)

Iterates over all symbols in the file.

The extra parameter is passed to the callback function, together with a pointer to the file and a pointer to the current symbol. The callback should return TRUE to continue iteration or FALSE to abort iteration. This function returns TRUE if the iteration completed successfully, FALSE if it was aborted by the callback.

◆ ocad_symbol_new()

OCADSymbol* ocad_symbol_new ( OCADFile pfile,
int  size 
)

Adds a new symbol with the given size in bytes to the file and returns a pointer to the new symbol.

◆ ocad_symbol_uses_color()

bool ocad_symbol_uses_color ( const OCADSymbol *  symbol,
s16  number 
)

Returns TRUE if the symbol uses the given color number, FALSE otherwise.

◆ ocad_symidx_first()

OCADSymbolIndex* ocad_symidx_first ( OCADFile pfile)

Returns a pointer to the first symbol index block, or nullptr if the file isn't valid.

Also returns nullptr if the file contains no symbols.

◆ ocad_symidx_next()

OCADSymbolIndex* ocad_symidx_next ( OCADFile pfile,
OCADSymbolIndex *  current 
)

Returns a pointer to the next symbol index block after the given one, or nullptr if there is none.