OpenTTD
SQConvert::SQAutoFreePointers Struct Reference

Pointers assigned to this class will be free'd when this instance comes out of scope. More...

#include <squirrel_helper.hpp>

Inheritance diagram for SQConvert::SQAutoFreePointers:
SmallVector< void *, 1 >

Additional Inherited Members

- Public Member Functions inherited from SmallVector< void *, 1 >
 SmallVector (const SmallVector &other)
 Copy constructor.
 SmallVector (const SmallVector< void *, X > &other)
 Generic copy constructor.
SmallVectoroperator= (const SmallVector &other)
 Assignment.
SmallVectoroperator= (const SmallVector< void *, X > &other)
 Generic assignment.
void Assign (const SmallVector< void *, X > &other)
 Assign items from other vector.
void Clear ()
 Remove all items from the list.
void Reset ()
 Remove all items from the list and free allocated memory.
void Compact ()
 Compact the list down to the smallest block size boundary.
void ** Append (uint to_add=1)
 Append an item and return it.
void Resize (uint num_items)
 Set the size of the vector, effectively truncating items from the end or appending uninitialised ones.
const void ** Find (const void *&item) const
 Search for the first occurrence of an item.
void ** Find (const void *&item)
 Search for the first occurrence of an item.
int FindIndex (const void *&item) const
 Search for the first occurrence of an item.
bool Contains (const void *&item) const
 Tests whether a item is present in the vector.
void Erase (void **item)
 Removes given item from this vector.
void ErasePreservingOrder (uint pos, uint count=1)
 Remove items from the vector while preserving the order of other items.
bool Include (const void *&item)
 Tests whether a item is present in the vector, and appends it to the end if not.
uint Length () const
 Get the number of items in the list.
const void ** Begin () const
 Get the pointer to the first item (const)
void ** Begin ()
 Get the pointer to the first item.
const void ** End () const
 Get the pointer behind the last valid item (const)
void ** End ()
 Get the pointer behind the last valid item.
const void ** Get (uint index) const
 Get the pointer to item "number" (const)
void ** Get (uint index)
 Get the pointer to item "number".
const void *& operator[] (uint index) const
 Get item "number" (const)
void *& operator[] (uint index)
 Get item "number".
- Protected Attributes inherited from SmallVector< void *, 1 >
void ** data
 The pointer to the first item.
uint items
 The number of items stored.
uint capacity
 The available space for storing items.

Detailed Description

Pointers assigned to this class will be free'd when this instance comes out of scope.

Useful to make sure you can use stredup(), without leaking memory.

Definition at line 32 of file squirrel_helper.hpp.


The documentation for this struct was generated from the following file: