Simple vector template class. More...
#include <smallvec_type.hpp>
Public Member Functions | |
FORCEINLINE void | Clear () |
Remove all items from the list. | |
FORCEINLINE void | Reset () |
Remove all items from the list and free allocated memory. | |
FORCEINLINE void | Compact () |
Compact the list down to the smallest block size boundary. | |
FORCEINLINE T * | Append (uint to_add=1) |
Append an item and return it. | |
FORCEINLINE const T * | Find (const T &item) const |
Search for the first occurence of an item. | |
FORCEINLINE T * | Find (const T &item) |
Search for the first occurence of an item. | |
FORCEINLINE int | FindIndex (const T &item) |
Search for the first occurence of an item. | |
FORCEINLINE bool | Contains (const T &item) const |
Tests whether a item is present in the vector. | |
FORCEINLINE void | Erase (T *item) |
Removes given item from this vector. | |
FORCEINLINE bool | Include (const T &item) |
Tests whether a item is present in the vector, and appends it to the end if not. | |
FORCEINLINE uint | Length () const |
Get the number of items in the list. | |
FORCEINLINE const T * | Begin () const |
Get the pointer to the first item (const). | |
FORCEINLINE T * | Begin () |
Get the pointer to the first item. | |
FORCEINLINE const T * | End () const |
Get the pointer behind the last valid item (const). | |
FORCEINLINE T * | End () |
Get the pointer behind the last valid item. | |
FORCEINLINE const T * | Get (uint index) const |
Get the pointer to item "number" (const). | |
FORCEINLINE T * | Get (uint index) |
Get the pointer to item "number". | |
FORCEINLINE const T & | operator[] (uint index) const |
Get item "number" (const). | |
FORCEINLINE 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 avalible 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.
FORCEINLINE 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 82 of file smallvec_type.hpp.
Referenced by NetworkClientListPopupWindow::AddAction(), AddChildSpriteScreen(), FiosFileScanner::AddFile(), AddNearbyStation(), AddSortableSpriteToDraw(), AddTileSpriteToDraw(), CompanyLeagueWindow::BuildCompanyList(), NetworkContentListWindow::BuildContentList(), BuildDepotVehicleList(), NewGRFAddWindow::BuildGrfList(), VehicleGroupWindow::BuildGroupList(), NetworkGameWindow::BuildNetworkGameList(), IndustryDirectoryWindow::BuildSortIndustriesList(), CompanyStationsWindow::BuildStationsList(), CmdBuildRailStation(), CmdConvertRail(), ClientNetworkContentSocketHandler::DownloadContentInfo(), DrawString(), FindIndustryToDeliver(), FindStationsNearby(), FiosGetFileList(), ReplaceVehicleWindow::GenerateReplaceVehList(), GenerateVehicleSortList(), GetBindAddresses(), GetCargoSummaryOfArticulatedVehicle(), GetNewEngine(), SmallVector< RefitOption, 32 >::Include(), ini_load_setting_list(), MakeTrainBackup(), NetworkFindBroadcastIPsInternal(), NetworkHTTPSocketHandler::NetworkHTTPSocketHandler(), NetworkUDPSocketHandler::NetworkUDPSocketHandler(), NewGRFWindow::OnClick(), ClientNetworkContentSocketHandler::OnReceiveData(), ClientNetworkContentSocketHandler::ReverseLookupDependency(), ClientNetworkContentSocketHandler::ReverseLookupTreeDependency(), ShowBuildBridgeWindow(), and TCPConnecter::TCPConnecter().
FORCEINLINE T* SmallVector< T, S >::Begin | ( | ) | [inline] |
Get the pointer to the first item.
Definition at line 199 of file smallvec_type.hpp.
FORCEINLINE const T* SmallVector< T, S >::Begin | ( | ) | const [inline] |
Get the pointer to the first item (const).
Definition at line 189 of file smallvec_type.hpp.
Referenced by FiosFileScanner::AddFile(), ClientNetworkContentSocketHandler::Begin(), TCPConnecter::CheckCallbacks(), ClientNetworkContentSocketHandler::CheckDependencyState(), CheckSubsidised(), ClientNetworkContentSocketHandler::Clear(), NetworkUDPSocketHandler::Close(), CmdRemoveFromRailStation(), NetworkContentListWindow::DrawDetails(), DrawString(), NetworkClientListPopupWindow::DrawWidget(), EngList_Sort(), SmallVector< RefitOption, 32 >::Erase(), NetworkContentListWindow::FilterContentList(), FinaliseHouseArray(), FinaliseIndustriesArray(), FinalisePriceBaseMultipliers(), SmallVector< RefitOption, 32 >::Find(), SmallVector< RefitOption, 32 >::FindIndex(), FiosGetFileList(), GetBindAddresses(), ClientNetworkContentSocketHandler::GetContent(), BaseSet< MusicSet, NUM_SONGS_AVAILABLE, GM_DIR >::GetDescription(), HasScenario(), NetworkHTTPSocketHandler::HTTPReceive(), ini_save_setting_list(), TCPConnecter::KillAll(), NetworkUDPSocketHandler::Listen(), LoadUnloadStation(), MoveWaypointsToBaseStations(), NetworkFindBroadcastIPs(), NetworkUDPSocketHandler::NetworkUDPSocketHandler(), ClientNetworkContentSocketHandler::OnConnect(), ClientNetworkContentSocketHandler::OnDisconnect(), ClientNetworkContentSocketHandler::OnDownloadComplete(), ClientNetworkContentSocketHandler::OnDownloadProgress(), NetworkGameWindow::OnInvalidateData(), NetworkContentListWindow::OnInvalidateData(), ClientNetworkContentSocketHandler::OnReceiveContentInfo(), ClientNetworkContentSocketHandler::OnReceiveData(), NetworkUDPSocketHandler::ReceivePackets(), RemoveFromRailBaseStation(), RestoreTrainBackup(), ClientNetworkContentSocketHandler::ReverseLookupDependency(), ClientNetworkContentSocketHandler::ReverseLookupTreeDependency(), ClientNetworkContentSocketHandler::SelectAll(), ClientNetworkContentSocketHandler::SelectUpgrade(), NetworkUDPSocketHandler::SendPacket(), ShowNetworkContentListWindow(), NetworkContentListWindow::SortContentList(), ClientNetworkContentSocketHandler::UnselectAll(), UpdateWaypointOrder(), NetworkClientListPopupWindow::UpdateWidgetSize(), ViewportDrawBoundingBoxes(), ViewportSortParentSprites(), BaseSet< MusicSet, NUM_SONGS_AVAILABLE, GM_DIR >::~BaseSet(), ClientNetworkContentSocketHandler::~ClientNetworkContentSocketHandler(), and NetworkContentDownloadStatusWindow::~NetworkContentDownloadStatusWindow().
FORCEINLINE 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 147 of file smallvec_type.hpp.
Referenced by AddNearbyStation(), ClientNetworkContentSocketHandler::DownloadContentInfo(), BuildVehicleWindow::FilterEngineList(), FindIndustryToDeliver(), SmallVector< RefitOption, 32 >::Include(), NetworkFindBroadcastIPsInternal(), and WhoCanServiceIndustry().
FORCEINLINE T* SmallVector< T, S >::End | ( | ) | [inline] |
Get the pointer behind the last valid item.
Definition at line 219 of file smallvec_type.hpp.
FORCEINLINE const T* SmallVector< T, S >::End | ( | ) | const [inline] |
Get the pointer behind the last valid item (const).
Definition at line 209 of file smallvec_type.hpp.
Referenced by AddCombinedSprite(), FiosFileScanner::AddFile(), AIInfo::AddLabels(), TCPConnecter::CheckCallbacks(), ClientNetworkContentSocketHandler::CheckDependencyState(), CheckSubsidised(), ClientNetworkContentSocketHandler::Clear(), NetworkUDPSocketHandler::Close(), CmdRemoveFromRailStation(), SmallVector< RefitOption, 32 >::Contains(), NetworkContentListWindow::DrawDetails(), DrawString(), NetworkClientListPopupWindow::DrawWidget(), ClientNetworkContentSocketHandler::End(), SmallVector< RefitOption, 32 >::Erase(), NetworkContentListWindow::FilterContentList(), FinaliseHouseArray(), FinaliseIndustriesArray(), FinalisePriceBaseMultipliers(), SmallVector< RefitOption, 32 >::Find(), SmallVector< RefitOption, 32 >::FindIndex(), GetBindAddresses(), GetCargoSummaryOfArticulatedVehicle(), ClientNetworkContentSocketHandler::GetContent(), BaseSet< MusicSet, NUM_SONGS_AVAILABLE, GM_DIR >::GetDescription(), HasScenario(), NetworkHTTPSocketHandler::HTTPReceive(), ini_save_setting_list(), TCPConnecter::KillAll(), NetworkUDPSocketHandler::Listen(), LoadUnloadStation(), MoveWaypointsToBaseStations(), NetworkFindBroadcastIPs(), NetworkUDPSocketHandler::NetworkUDPSocketHandler(), ClientNetworkContentSocketHandler::OnConnect(), ClientNetworkContentSocketHandler::OnDisconnect(), ClientNetworkContentSocketHandler::OnDownloadComplete(), ClientNetworkContentSocketHandler::OnDownloadProgress(), NetworkGameWindow::OnInvalidateData(), NetworkContentListWindow::OnInvalidateData(), ClientNetworkContentSocketHandler::OnReceiveContentInfo(), NetworkUDPSocketHandler::ReceivePackets(), RemoveFromRailBaseStation(), NetworkAddress::Resolve(), RestoreTrainBackup(), ClientNetworkContentSocketHandler::ReverseLookupDependency(), ClientNetworkContentSocketHandler::ReverseLookupTreeDependency(), ClientNetworkContentSocketHandler::SelectAll(), ClientNetworkContentSocketHandler::SelectUpgrade(), NetworkUDPSocketHandler::SendPacket(), ShowNetworkContentListWindow(), NetworkContentListWindow::SortContentList(), ClientNetworkContentSocketHandler::UnselectAll(), UpdateWaypointOrder(), NetworkClientListPopupWindow::UpdateWidgetSize(), ViewportDrawBoundingBoxes(), ViewportSortParentSprites(), BaseSet< MusicSet, NUM_SONGS_AVAILABLE, GM_DIR >::~BaseSet(), ClientNetworkContentSocketHandler::~ClientNetworkContentSocketHandler(), and NetworkContentDownloadStatusWindow::~NetworkContentDownloadStatusWindow().
FORCEINLINE void SmallVector< T, S >::Erase | ( | T * | item | ) | [inline] |
Removes given item from this vector.
item | item to remove |
Reimplemented in SmallMap< NetworkAddress, SOCKET, 4 >.
Definition at line 157 of file smallvec_type.hpp.
Referenced by AddNearbyStation(), TCPConnecter::CheckCallbacks(), NetworkHTTPSocketHandler::HTTPReceive(), and ClientNetworkContentSocketHandler::RemoveCallback().
FORCEINLINE T* SmallVector< T, S >::Find | ( | const T & | item | ) | [inline] |
Search for the first occurence of an item.
The '!=' operator of T is used for comparison.
item | Item to search for |
Definition at line 115 of file smallvec_type.hpp.
FORCEINLINE const T* SmallVector< T, S >::Find | ( | const T & | item | ) | const [inline] |
Search for the first occurence of an item.
The '!=' operator of T is used for comparison.
item | Item to search for |
Definition at line 101 of file smallvec_type.hpp.
Referenced by SmallVector< RefitOption, 32 >::Contains(), GetCargoSummaryOfArticulatedVehicle(), and ClientNetworkContentSocketHandler::RemoveCallback().
FORCEINLINE int SmallVector< T, S >::FindIndex | ( | const T & | item | ) | [inline] |
Search for the first occurence of an item.
The '!=' operator of T is used for comparison.
item | Item to search for |
Definition at line 129 of file smallvec_type.hpp.
Referenced by FinalisePriceBaseMultipliers(), and NewGRFAddWindow::UpdateListPosition().
FORCEINLINE T* SmallVector< T, S >::Get | ( | uint | index | ) | [inline] |
Get the pointer to item "number".
index | the position of the item |
Definition at line 243 of file smallvec_type.hpp.
FORCEINLINE 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 230 of file smallvec_type.hpp.
Referenced by AddNearbyStation(), BuildBridgeWindow::DrawWidget(), EngList_SortPartial(), FiosGetFileList(), ClientNetworkContentSocketHandler::Get(), GetNewEngine(), NetworkContentListWindow::OnClick(), NetworkContentListWindow::OnKeyPress(), and BuildBridgeWindow::UpdateWidgetSize().
FORCEINLINE 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 169 of file smallvec_type.hpp.
Referenced by ClientNetworkContentSocketHandler::AddCallback(), BuildRefitList(), CheckSubsidised(), DeliverGoodsToIndustry(), FindStationsAroundTiles(), NetworkContentDownloadStatusWindow::OnDownloadProgress(), RemoveFromRailBaseStation(), and ClientNetworkContentSocketHandler::ReverseLookupTreeDependency().
FORCEINLINE T& SmallVector< T, S >::operator[] | ( | uint | index | ) | [inline] |
Get item "number".
index | the positon of the item |
Definition at line 268 of file smallvec_type.hpp.
FORCEINLINE const T& SmallVector< T, S >::operator[] | ( | uint | index | ) | const [inline] |
Get item "number" (const).
index | the positon of the item |
Definition at line 256 of file smallvec_type.hpp.