1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-26 02:14:22 +00:00

Reduced the memory footprint of the array classes.

This commit is contained in:
Julian Storer 2010-02-06 09:16:20 +00:00
parent ded4826413
commit 31a102008d
11 changed files with 542 additions and 489 deletions

View file

@ -44301,6 +44301,28 @@ void CodeDocument::replaceAllContent (const String& newContent)
insert (newContent, 0, true);
}
bool CodeDocument::loadFromStream (InputStream& stream)
{
replaceAllContent (stream.readEntireStreamAsString());
setSavePoint();
clearUndoHistory();
return true;
}
bool CodeDocument::writeToStream (OutputStream& stream)
{
for (int i = 0; i < lines.size(); ++i)
{
String temp (lines.getUnchecked(i)->line); // use a copy to avoid bloating the memory footprint of the stored string.
const char* utf8 = temp.toUTF8();
if (! stream.write (utf8, strlen (utf8)))
return false;
}
return true;
}
void CodeDocument::setNewLineCharacters (const String& newLine) throw()
{
jassert (newLine == T("\r\n") || newLine == T("\n") || newLine == T("\r"));
@ -68311,7 +68333,7 @@ public:
Desktop::getInstance().removeGlobalMouseListener (this);
jassert (activeSubMenu == 0 || activeSubMenu->isValidComponent());
delete activeSubMenu;
activeSubMenu = 0;
deleteAllChildren();
attachedCompWatcher = 0;
@ -68431,7 +68453,7 @@ public:
{
jassert (activeSubMenu == 0 || activeSubMenu->isValidComponent());
deleteAndZero (activeSubMenu);
activeSubMenu = 0;
currentChild = 0;
exitModalState (item != 0 ? item->itemId : 0);
@ -68749,7 +68771,7 @@ public:
private:
Window* owner;
PopupMenu::ItemComponent* currentChild;
Window* activeSubMenu;
ScopedPointer <Window> activeSubMenu;
Component* menuBarComponent;
ApplicationCommandManager** managerOfChosenCommand;
Component* componentAttachedTo;
@ -69111,7 +69133,7 @@ private:
bool showSubMenuFor (PopupMenu::ItemComponent* const childComp)
{
jassert (activeSubMenu == 0 || activeSubMenu->isValidComponent());
deleteAndZero (activeSubMenu);
activeSubMenu = 0;
if (childComp->isValidComponent() && childComp->itemInfo.hasActiveSubMenu())
{