#include <libsswf.h>
Public Member Functions | |
int | Count (void) const |
Return the size of the vectors. | |
void | Empty (void) |
Make the vectors empty. | |
ItemBase * | Get (int index) const |
Get an item out of the vectors. | |
void | Insert (int index, ItemBase *vector) |
Insert the specified item at the specified index. | |
Vectors & | operator= (const Vectors &vectors) |
Copy a vector in another. | |
void | Set (int index, ItemBase *vector) |
Replace an item in a vector. | |
void | SetSize (int size) |
Change the size of the vectors. | |
Vectors (const Vectors &vector) | |
Copy a vector in another. | |
Vectors (void) | |
Initialize an empty vector. | |
~Vectors () | |
The destructor ensures that the vectors is empty. | |
Private Attributes | |
int | f_count |
int | f_max |
ItemBase ** | f_vectors |
Vectors::Vectors | ( | void | ) |
Vectors::Vectors | ( | const Vectors & | vectors | ) |
Vectors::~Vectors | ( | ) |
sswf::Vectors::Count | ( | void | ) | const [inline] |
This function returns the current size of the vectors.
All the items defined in the vectors can be retrieved using the Get() function. These items have index starting at zero and ending at Count() - 1. If Count() is zero, then one cannot call the Get() function since the vectors is empty.
References f_count.
Referenced by sswf::TagShape::AddEdge(), sswf::SoundInfo::AddEnvelope(), sswf::TagShape::AddStyle(), sswf::TagText::AddText(), sswf::TagText::DefineText(), sswf::ActionWith::Duplicate(), sswf::ActionWaitForFrame::Duplicate(), sswf::ActionTry::Duplicate(), sswf::ActionPushData::Duplicate(), sswf::ActionFunction::Duplicate(), sswf::ActionDictionary::Duplicate(), sswf::TagFont::FindGlyph(), sswf::Action::FindLabel(), sswf::Action::FindLabelAtOffset(), sswf::Action::GetMaximumRegister(), sswf::ActionPushData::GetMaxRegister(), sswf::TagFont::GlyphInfo(), sswf::TagFont::HasGlyph(), sswf::TagImport::HasID(), sswf::TagImport::HasName(), sswf::TagShape::IsEmpty(), sswf::Action::MinimumListVersion(), sswf::TagFont::ParseTag(), sswf::TagText::PreSave(), sswf::TagPlace::PreSave(), sswf::TagFont::PreSave(), sswf::TagExport::PreSave(), sswf::TagButton::PreSave(), sswf::TagFont::PreSave2ndPass(), sswf::TagText::RecordSetup(), sswf::Event::Reset(), sswf::TagText::Save(), sswf::SoundInfo::Save(), sswf::TagShape::Save(), sswf::TagPlace::Save(), sswf::TagImport::Save(), sswf::TagFont::Save(), sswf::TagExport::Save(), sswf::TagDoAction::Save(), sswf::TagButton::Save(), sswf::Edges::Save(), sswf::ActionWaitForFrame::SaveData(), sswf::ActionPushData::SaveData(), sswf::ActionFunction::SaveData(), sswf::ActionDictionary::SaveData(), sswf::Action::SaveList(), sswf::TagShape::SaveShape(), sswf::TagShape::SaveStyles(), sswf::TagShape::SaveWithoutStyles(), sswf::Edges::Set(), and sswf::TagFont::SetUsedGlyphs().
sswf::Vectors::Empty | ( | void | ) | [inline] |
This function marks the vectors as empty.
The vectors buffer is kept so it can be reused avoiding allocating and deallocating it for no reason.
In order for the vectors to lose their buffer, call SetSize() with zero as the size.
References f_count.
Referenced by sswf::TagShape::NewStyles(), and sswf::Event::Reset().
ItemBase * Vectors::Get | ( | int | index | ) | const |
This function is used to read one item out of the vectors.
In debug mode, the function asserts if the index is out of range (i.e. negative or larger or equal to the number if items available.)
[in] | index |
References sswf::assert(), f_count, and f_vectors.
Referenced by sswf::SoundInfo::AddEnvelope(), sswf::TagShape::AddStyle(), sswf::TagText::DefineText(), sswf::ActionWith::Duplicate(), sswf::ActionWaitForFrame::Duplicate(), sswf::ActionTry::Duplicate(), sswf::ActionPushData::Duplicate(), sswf::ActionFunction::Duplicate(), sswf::ActionDictionary::Duplicate(), sswf::TagFont::FindGlyph(), sswf::Action::FindLabel(), sswf::Action::FindLabelAtOffset(), sswf::Action::GetMaximumRegister(), sswf::ActionPushData::GetMaxRegister(), sswf::TagFont::GlyphInfo(), sswf::TagImport::HasID(), sswf::TagImport::HasName(), sswf::Action::MinimumListVersion(), sswf::TagFont::ParseTag(), sswf::TagText::PreSave(), sswf::TagPlace::PreSave(), sswf::TagFont::PreSave(), sswf::TagExport::PreSave(), sswf::TagButton::PreSave(), sswf::TagFont::PreSave2ndPass(), sswf::Event::Reset(), sswf::TagText::Save(), sswf::SoundInfo::Save(), sswf::TagShape::Save(), sswf::TagPlace::Save(), sswf::TagImport::Save(), sswf::TagFont::Save(), sswf::TagExport::Save(), sswf::TagDoAction::Save(), sswf::TagButton::Save(), sswf::Edges::Save(), sswf::ActionPushData::SaveData(), sswf::ActionFunction::SaveData(), sswf::ActionDictionary::SaveData(), sswf::Action::SaveList(), sswf::TagShape::SaveShape(), sswf::TagShape::SaveStyles(), sswf::TagShape::SaveWithoutStyles(), sswf::Edges::Set(), and sswf::TagFont::SetUsedGlyphs().
void Vectors::Insert | ( | int | index, | |
ItemBase * | ptr | |||
) |
This function is used to add an item at the specified index.
If items exist after the specified position, then their index position is incremented by one each before the new item is saved.
[in] | index | The position where the new item is saved |
[in] | ptr | The pointer to be saved at that specific position |
References f_count, f_vectors, and SetSize().
Referenced by sswf::TagFont::AddGlyph(), and sswf::Action::FindLabelAtOffset().
void Vectors::Set | ( | int | index, | |
ItemBase * | ptr | |||
) |
This function sets the specified item at the specified index in the vectors. If another item was defined at that index, it is overwritten.
It is possible to set an item at an index which does not exist yet. If the index is beyond of the last item, the pointers in between are set to all zeroes.
[in] | index | The index (position) where the item is saved |
[in] | ptr | The pointer to save at the specified position |
References f_count, f_vectors, and SetSize().
Referenced by sswf::ActionWith::AddAction(), sswf::ActionWaitForFrame::AddAction(), sswf::ActionFunction::AddAction(), sswf::ActionPushData::AddBoolean(), sswf::ActionTry::AddCatchAction(), sswf::ActionPushData::AddDouble(), sswf::SoundInfo::AddEnvelope(), sswf::TagPlace::AddEvent(), sswf::TagButton::AddEvent(), sswf::ActionTry::AddFinallyAction(), sswf::ActionPushData::AddFloat(), sswf::ActionPushData::AddInteger(), sswf::TagFont::AddKern(), sswf::ActionPushData::AddLookup(), sswf::TagShape::AddMove(), sswf::TagImport::AddName(), sswf::ActionPushData::AddNull(), sswf::ActionFunction::AddParameter(), sswf::ActionPushData::AddRegister(), sswf::ActionPushData::AddString(), sswf::ActionDictionary::AddString(), sswf::TagShape::AddStyle(), sswf::TagText::AddText(), sswf::ActionTry::AddTryAction(), sswf::ActionPushData::AddUndefined(), sswf::TagShape::NewStyles(), sswf::Action::Parse(), sswf::ActionPushData::ParseData(), sswf::ActionDictionary::ParseData(), sswf::TagExport::ParseTag(), sswf::TagShape::RecordEdges(), sswf::TagText::RecordSetup(), sswf::TagShape::RecordSetup(), sswf::TagShape::Save(), sswf::Edges::Set(), sswf::TagDoAction::SetAction(), sswf::TagButton::SetAction(), sswf::TagExport::SetObject(), and sswf::TagButton::SetState().
void Vectors::SetSize | ( | int | size | ) |
This function sets the new size of the vectors internal buffer. If the internal buffer is already large enough, then nothing happens (i.e. the size is not reduced.)
A size of zero (or negative) means that the vectors should be emptied. Thus the array is freed and the counters are reset.
Note that this function does not change the count unless the new size is smaller than the current count or is zero. In the latter case, the count is set to zero also.
[in] | size | The size of the buffer used to save the pointers |
References f_count, f_max, f_vectors, sswf::MemoryManager::MemClean(), and sswf::MemoryManager::MemRealloc().
Referenced by Insert(), operator=(), Set(), Vectors(), and ~Vectors().
int sswf::Vectors::f_count [private] |
int sswf::Vectors::f_max [private] |
ItemBase** sswf::Vectors::f_vectors [private] |