void AppendData(const void* data, int dataLength) { EnsureSpace(dataLength); memcpy((char*)dialogTemplate + usedBufferLength, data, dataLength); usedBufferLength += dataLength; }
void Vector<T>::InsertMulti(int ieIns, int ceIns, const T * prgeIns) { AssertObj(this); Assert((uint)ieIns <= (uint)m_ieLim); Assert(ceIns >= 0); if ((uint)ieIns > (uint)m_ieLim) throw std::invalid_argument("ieIns"); if (ceIns < 0) throw std::invalid_argument("ceIns"); // Checks for overflow. Assert(ceIns + m_ieLim >= ceIns); if (!ceIns) return; // Make sure we have enough memory allocated. EnsureSpace(ceIns); MoveItems(m_prge, m_prge + ceIns, m_ieLim - ieIns); m_ieLim += ceIns; T * pe = m_prge + ieIns; T * peLim = pe + ceIns; for ( ; pe < peLim; ++pe, ++prgeIns) { // Call constructor on previously allocated memory. new((void *)pe) T(*prgeIns); } AssertObj(this); }
void AlignData(int size) { int paddingSize = usedBufferLength % size; if(paddingSize != 0) { EnsureSpace(paddingSize); usedBufferLength += paddingSize; } }