Simple vector template class. More...
#include <smallvec_type.hpp>
Public Member Functions | |
template<uint X> | |
SmallVector (const SmallVector< T, X > &other) | |
Copy constructor. | |
template<uint X> | |
SmallVector & | operator= (const SmallVector< T, X > &other) |
Assignment. | |
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. | |
T * | Append (uint to_add=1) |
Append an item and return it. | |
const T * | Find (const T &item) const |
Search for the first occurrence of an item. | |
T * | Find (const T &item) |
Search for the first occurrence of an item. | |
int | FindIndex (const T &item) |
Search for the first occurrence of an item. | |
bool | Contains (const T &item) const |
Tests whether a item is present in the vector. | |
void | Erase (T *item) |
Removes given item from this vector. | |
bool | Include (const T &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 T * | Begin () const |
Get the pointer to the first item (const). | |
T * | Begin () |
Get the pointer to the first item. | |
const T * | End () const |
Get the pointer behind the last valid item (const). | |
T * | End () |
Get the pointer behind the last valid item. | |
const T * | Get (uint index) const |
Get the pointer to item "number" (const). | |
T * | Get (uint index) |
Get the pointer to item "number". | |
const T & | operator[] (uint index) const |
Get item "number" (const). | |
T & | operator[] (uint index) |
Get item "number". | |
Protected Attributes | |
T * | data |
The pointer to the first item. | |
uint | items |
The number of items stored. | |
uint | capacity |
The available space for storing items. |
Simple vector template class.
T | The type of the items stored | |
S | The steps of allocation |
Definition at line 29 of file smallvec_type.hpp.
SmallVector< T, S >::SmallVector | ( | const SmallVector< T, X > & | other | ) | [inline] |
Copy constructor.
other | The other vector to copy. |
Definition at line 43 of file smallvec_type.hpp.
T* SmallVector< T, S >::Append | ( | uint | to_add = 1 |
) | [inline] |
Append an item and return it.
to_add | the number of items to append |
Definition at line 104 of file smallvec_type.hpp.
Referenced by OutputStore::Add(), NetworkClientListPopupWindow::AddAction(), AddChildSpriteScreen(), LanguageScanner::AddFile(), FiosFileScanner::AddFile(), AddNearbyStation(), AddSortableSpriteToDraw(), AddTileSpriteToDraw(), CompanyLeagueWindow::BuildCompanyList(), NetworkContentListWindow::BuildContentList(), BuildDepotVehicleList(), VehicleGroupWindow::BuildGroupList(), NetworkGameWindow::BuildNetworkGameList(), IndustryDirectoryWindow::BuildSortIndustriesList(), CompanyStationsWindow::BuildStationsList(), CheckCaches(), CheckFlatLandRailStation(), CmdBuildRailStation(), CmdConvertRail(), GameStrings::Compile(), IndustryCargoesWindow::ComputeCargoDisplay(), IndustryCargoesWindow::ComputeIndustryDisplay(), ClientNetworkContentSocketHandler::DownloadContentInfo(), ClientNetworkContentSocketHandler::DownloadSelectedContent(), DrawString(), FindIndustryToDeliver(), FindStationsNearby(), FiosGetFileList(), ReplaceVehicleWindow::GenerateReplaceVehList(), GenerateVehicleSortList(), GetBindAddresses(), GetCargoSummaryOfArticulatedVehicle(), GetGRFPresetList(), GetLanguageList(), GetNewEngine(), GlobalVarChangeInfo(), GRFConfig::GRFConfig(), HandleParameterInfo(), SmallVector< RefitOption, 32 >::Include(), IniLoadSettingList(), InitNewGRFFile(), Window::InvalidateData(), NewGRFTextfileWindow::LoadTextfile(), LoadTranslations(), MakeTrainBackup(), NetworkFindBroadcastIPsInternal(), NetworkHTTPSocketHandler::NetworkHTTPSocketHandler(), NetworkServerKickOrBanIP(), NetworkUDPSocketHandler::NetworkUDPSocketHandler(), AfterNewGRFScan::OnNewGRFsScanned(), ClientNetworkContentSocketHandler::OnReceiveData(), SmallVector< RefitOption, 32 >::operator=(), PoolBase::PoolBase(), NewGRFSpriteLayout::PrepareLayout(), ReadRawLanguageStrings(), RefitVehicle(), ClientNetworkContentSocketHandler::RequestContentList(), ClientNetworkContentSocketHandler::ReverseLookupDependency(), ClientNetworkContentSocketHandler::ReverseLookupTreeDependency(), ShowBuildBridgeWindow(), ShowMissingContentWindow(), SmallVector< RefitOption, 32 >::SmallVector(), StationChangeInfo(), TCPConnecter::TCPConnecter(), TranslationWriter::Write(), MemoryDumper::WriteByte(), and StringNameWriter::WriteStringID().
const T* SmallVector< T, S >::Begin | ( | ) | const [inline] |
Get the pointer to the first item (const).
Definition at line 211 of file smallvec_type.hpp.
Referenced by TCPListenHandler< ServerNetworkGameSocketHandler, PACKET_SERVER_FULL, PACKET_SERVER_BANNED >::AcceptClient(), FiosFileScanner::AddFile(), ClientNetworkContentSocketHandler::Begin(), TCPConnecter::CheckCallbacks(), ClientNetworkContentSocketHandler::CheckDependencyState(), CheckSubsidised(), PoolBase::Clean(), ClientNetworkContentSocketHandler::Clear(), LoadCheckData::Clear(), NetworkUDPSocketHandler::Close(), TCPListenHandler< ServerNetworkGameSocketHandler, PACKET_SERVER_FULL, PACKET_SERVER_BANNED >::CloseListeners(), CmdConvertRail(), CmdRemoveFromRailStation(), GameStrings::Compile(), ClientNetworkContentSocketHandler::DownloadSelectedContent(), ClientNetworkContentSocketHandler::DownloadSelectedContentFallback(), ClientNetworkContentSocketHandler::DownloadSelectedContentHTTP(), NetworkContentListWindow::DrawDetails(), DrawString(), NetworkClientListPopupWindow::DrawWidget(), EngList_Sort(), SmallVector< RefitOption, 32 >::Erase(), NetworkContentListWindow::FilterContentList(), FinaliseAirportsArray(), FinaliseHouseArray(), FinaliseIndustriesArray(), FinaliseObjectsArray(), FinalisePriceBaseMultipliers(), SmallVector< RefitOption, 32 >::Find(), FindClearedObject(), SmallVector< RefitOption, 32 >::FindIndex(), FiosGetFileList(), GetBindAddresses(), ClientNetworkContentSocketHandler::GetContent(), BaseSet< GraphicsSet, MAX_GFT, true >::GetDescription(), GetFileByFilename(), GetFileByGRFID(), GetLanguage(), NewGRFSpriteLayout::GetLayout(), LanguageMap::GetMapping(), LanguageMap::GetReverseMapping(), HasScenario(), HouseGetVariable(), NetworkHTTPSocketHandler::HTTPReceive(), IniSaveSettingList(), InitializeLanguagePacks(), TCPConnecter::KillAll(), NetworkUDPSocketHandler::Listen(), LoadUnloadStation(), MoveWaypointsToBaseStations(), NetworkFindBroadcastIPs(), NetworkUDPBroadCast(), NetworkUDPSocketHandler::NetworkUDPSocketHandler(), NetworkContentListWindow::OnInvalidateData(), ClientNetworkContentSocketHandler::OnReceiveData(), SmallVector< RefitOption, 32 >::operator=(), NewGRFSpriteLayout::PrepareLayout(), NewGRFSpriteLayout::ProcessRegisters(), Window::ProcessScheduledInvalidations(), TCPListenHandler< ServerNetworkGameSocketHandler, PACKET_SERVER_FULL, PACKET_SERVER_BANNED >::Receive(), NetworkUDPSocketHandler::ReceivePackets(), ReconsiderGameScriptLanguage(), RefitVehicle(), RegisterGameTranslation(), RemoveFromRailBaseStation(), ClientNetworkContentSocketHandler::RequestContentList(), ResetCustomAirports(), ResetCustomHouses(), ResetCustomIndustries(), ResetCustomObjects(), ResetCustomStations(), ResetNewGRF(), RestoreTrainBackup(), ClientNetworkContentSocketHandler::ReverseLookupDependency(), ClientNetworkContentSocketHandler::ReverseLookupTreeDependency(), ClientNetworkContentSocketHandler::SelectAll(), ClientNetworkContentSocketHandler::SelectUpgrade(), NetworkUDPSocketHandler::SendPacket(), SetupEngines(), ShowNetworkContentListWindow(), SmallVector< RefitOption, 32 >::SmallVector(), NetworkContentListWindow::SortContentList(), StationChangeInfo(), ClientNetworkContentSocketHandler::UnselectAll(), UpdateWaypointOrder(), NetworkClientListPopupWindow::UpdateWidgetSize(), ViewportDrawBoundingBoxes(), ViewportSortParentSprites(), OutputStore::Write(), LanguageWriter::WriteLang(), BaseSet< GraphicsSet, MAX_GFT, true >::~BaseSet(), ClientNetworkContentSocketHandler::~ClientNetworkContentSocketHandler(), NetworkContentDownloadStatusWindow::~NetworkContentDownloadStatusWindow(), and UnmappedChoiceList::~UnmappedChoiceList().
T* SmallVector< T, S >::Begin | ( | ) | [inline] |
Get the pointer to the first item.
Definition at line 221 of file smallvec_type.hpp.
bool SmallVector< T, S >::Contains | ( | const T & | item | ) | const [inline] |
Tests whether a item is present in the vector.
The '!=' operator of T is used for comparison.
item | Item to test for |
Definition at line 169 of file smallvec_type.hpp.
Referenced by AddNearbyStation(), RefitWindow::BuildRefitList(), CheckHotkeyMatch(), ClientNetworkContentSocketHandler::DownloadContentInfo(), RefitWindow::DrawWidget(), BuildVehicleWindow::FilterEngineList(), FindIndustryToDeliver(), GetBestFittingSubType(), SmallVector< RefitOption, 32 >::Include(), NetworkFindBroadcastIPsInternal(), RefitVehicle(), and WhoCanServiceIndustry().
T* SmallVector< T, S >::End | ( | ) | [inline] |
Get the pointer behind the last valid item.
Definition at line 241 of file smallvec_type.hpp.
const T* SmallVector< T, S >::End | ( | ) | const [inline] |
Get the pointer behind the last valid item (const).
Definition at line 231 of file smallvec_type.hpp.
Referenced by TCPListenHandler< ServerNetworkGameSocketHandler, PACKET_SERVER_FULL, PACKET_SERVER_BANNED >::AcceptClient(), AddCombinedSprite(), FiosFileScanner::AddFile(), ChangeGRFParamValueNames(), TCPConnecter::CheckCallbacks(), ClientNetworkContentSocketHandler::CheckDependencyState(), CheckSubsidised(), PoolBase::Clean(), ClientNetworkContentSocketHandler::Clear(), LoadCheckData::Clear(), NetworkUDPSocketHandler::Close(), TCPListenHandler< ServerNetworkGameSocketHandler, PACKET_SERVER_FULL, PACKET_SERVER_BANNED >::CloseListeners(), CmdConvertRail(), CmdRemoveFromRailStation(), GameStrings::Compile(), SmallVector< RefitOption, 32 >::Contains(), ClientNetworkContentSocketHandler::DownloadSelectedContent(), ClientNetworkContentSocketHandler::DownloadSelectedContentHTTP(), NetworkContentListWindow::DrawDetails(), NetworkContentListWindow::DrawMatrix(), DrawString(), NetworkClientListPopupWindow::DrawWidget(), ClientNetworkContentSocketHandler::End(), SmallVector< RefitOption, 32 >::Erase(), NetworkContentListWindow::FilterContentList(), FinaliseAirportsArray(), FinaliseHouseArray(), FinaliseIndustriesArray(), FinaliseObjectsArray(), FinalisePriceBaseMultipliers(), SmallVector< RefitOption, 32 >::Find(), FindClearedObject(), SmallVector< RefitOption, 32 >::FindIndex(), GamelogPrint(), GetBindAddresses(), GetCargoSummaryOfArticulatedVehicle(), ClientNetworkContentSocketHandler::GetContent(), BaseSet< GraphicsSet, MAX_GFT, true >::GetDescription(), GetFileByFilename(), GetFileByGRFID(), GetLanguage(), LanguageMap::GetMapping(), LanguageMap::GetReverseMapping(), HasScenario(), HouseGetVariable(), NetworkHTTPSocketHandler::HTTPReceive(), IniSaveSettingList(), InitializeLanguagePacks(), TCPConnecter::KillAll(), NetworkUDPSocketHandler::Listen(), LoadUnloadStation(), MoveWaypointsToBaseStations(), NetworkFindBroadcastIPs(), NetworkUDPBroadCast(), NetworkUDPSocketHandler::NetworkUDPSocketHandler(), NetworkContentListWindow::OnInvalidateData(), Window::ProcessScheduledInvalidations(), TCPListenHandler< ServerNetworkGameSocketHandler, PACKET_SERVER_FULL, PACKET_SERVER_BANNED >::Receive(), NetworkUDPSocketHandler::ReceivePackets(), ReconsiderGameScriptLanguage(), RefitVehicle(), RegisterGameTranslation(), RemoveFromRailBaseStation(), ClientNetworkContentSocketHandler::RequestContentList(), ResetCustomAirports(), ResetCustomHouses(), ResetCustomIndustries(), ResetCustomObjects(), ResetCustomStations(), ResetNewGRF(), RestoreTrainBackup(), ClientNetworkContentSocketHandler::ReverseLookupDependency(), ClientNetworkContentSocketHandler::ReverseLookupTreeDependency(), ClientNetworkContentSocketHandler::SelectAll(), ClientNetworkContentSocketHandler::SelectUpgrade(), NetworkUDPSocketHandler::SendPacket(), SetupEngines(), ShowNetworkContentListWindow(), NetworkContentListWindow::SortContentList(), ClientNetworkContentSocketHandler::UnselectAll(), UpdateWaypointOrder(), NetworkClientListPopupWindow::UpdateWidgetSize(), ViewportDrawBoundingBoxes(), ViewportSortParentSprites(), OutputStore::Write(), BaseSet< GraphicsSet, MAX_GFT, true >::~BaseSet(), ClientNetworkContentSocketHandler::~ClientNetworkContentSocketHandler(), NetworkContentDownloadStatusWindow::~NetworkContentDownloadStatusWindow(), and UnmappedChoiceList::~UnmappedChoiceList().
void SmallVector< T, S >::Erase | ( | T * | item | ) | [inline] |
Removes given item from this vector.
item | item to remove |
Reimplemented in SmallMap< uint, CompanyProperties * >, SmallMap< byte, char * >, and SmallMap< NetworkAddress, SOCKET, 4 >.
Definition at line 179 of file smallvec_type.hpp.
Referenced by AddNearbyStation(), TCPConnecter::CheckCallbacks(), NetworkHTTPSocketHandler::HTTPReceive(), ClientNetworkContentSocketHandler::RemoveCallback(), and PoolBase::~PoolBase().
const T* SmallVector< T, S >::Find | ( | const T & | item | ) | const [inline] |
Search for the first occurrence of an item.
The '!=' operator of T is used for comparison.
item | Item to search for |
Definition at line 123 of file smallvec_type.hpp.
Referenced by SmallVector< RefitOption, 32 >::Contains(), GetCargoSummaryOfArticulatedVehicle(), ClientNetworkContentSocketHandler::RemoveCallback(), and PoolBase::~PoolBase().
T* SmallVector< T, S >::Find | ( | const T & | item | ) | [inline] |
Search for the first occurrence of an item.
The '!=' operator of T is used for comparison.
item | Item to search for |
Definition at line 137 of file smallvec_type.hpp.
int SmallVector< T, S >::FindIndex | ( | const T & | item | ) | [inline] |
Search for the first occurrence of an item.
The '!=' operator of T is used for comparison.
item | Item to search for |
Definition at line 151 of file smallvec_type.hpp.
Referenced by FinalisePriceBaseMultipliers().
const T* SmallVector< T, S >::Get | ( | uint | index | ) | const [inline] |
Get the pointer to item "number" (const).
index | the position of the item |
Definition at line 252 of file smallvec_type.hpp.
Referenced by AddNearbyStation(), CheckCaches(), NetworkContentListWindow::DrawMatrix(), BuildBridgeWindow::DrawWidget(), EngList_SortPartial(), FiosGetFileList(), ClientNetworkContentSocketHandler::Get(), GetNewEngine(), GRFParameterInfo::GRFParameterInfo(), BuildBridgeWindow::UpdateWidgetSize(), and GRFParameterInfo::~GRFParameterInfo().
T* SmallVector< T, S >::Get | ( | uint | index | ) | [inline] |
Get the pointer to item "number".
index | the position of the item |
Definition at line 265 of file smallvec_type.hpp.
bool SmallVector< T, S >::Include | ( | const T & | item | ) | [inline] |
Tests whether a item is present in the vector, and appends it to the end if not.
The '!=' operator of T is used for comparison.
item | Item to test for |
Definition at line 191 of file smallvec_type.hpp.
Referenced by ClientNetworkContentSocketHandler::AddCallback(), Hotkey< TerraformToolbarWindow >::AddKeycode(), RefitWindow::BuildRefitList(), CheckSubsidised(), DeliverGoodsToIndustry(), FindStationsAroundTiles(), GetBestFittingSubType(), NetworkContentDownloadStatusWindow::OnDownloadProgress(), RemoveFromRailBaseStation(), ClientNetworkContentSocketHandler::ReverseLookupTreeDependency(), and UpdateTrainPowerProc().
SmallVector& SmallVector< T, S >::operator= | ( | const SmallVector< T, X > & | other | ) | [inline] |
const T& SmallVector< T, S >::operator[] | ( | uint | index | ) | const [inline] |
Get item "number" (const).
index | the position of the item |
Definition at line 278 of file smallvec_type.hpp.
T& SmallVector< T, S >::operator[] | ( | uint | index | ) | [inline] |
Get item "number".
index | the position of the item |
Definition at line 290 of file smallvec_type.hpp.