diff options
author | Jorge Arellano Cid <jcid@dillo.org> | 2009-02-08 21:16:37 -0300 |
---|---|---|
committer | Jorge Arellano Cid <jcid@dillo.org> | 2009-02-08 21:16:37 -0300 |
commit | 845493306279f446dbac9568a0a1e0f442e615dd (patch) | |
tree | dbf0a36e50a268b456760ce881a802d28979cc5f /lout/container.cc | |
parent | 283a7960e615b14c21b7ce757b0fcbe5c945bb95 (diff) |
's/if(/if (/g' 's/for(/for (/g' 's/while(/while (/g', and indentation.
Diffstat (limited to 'lout/container.cc')
-rw-r--r-- | lout/container.cc | 110 |
1 files changed, 55 insertions, 55 deletions
diff --git a/lout/container.cc b/lout/container.cc index 0b00c195..6c886baa 100644 --- a/lout/container.cc +++ b/lout/container.cc @@ -43,40 +43,40 @@ Iterator::Iterator() Iterator::Iterator(const Iterator &it2) { impl = it2.impl; - if(impl) + if (impl) impl->ref(); } Iterator::Iterator(Iterator &it2) { impl = it2.impl; - if(impl) + if (impl) impl->ref(); } Iterator &Iterator::operator=(const Iterator &it2) { - if(impl) + if (impl) impl->unref(); impl = it2.impl; - if(impl) + if (impl) impl->ref(); return *this; } Iterator &Iterator::operator=(Iterator &it2) { - if(impl) + if (impl) impl->unref(); impl = it2.impl; - if(impl) + if (impl) impl->ref(); return *this; } Iterator::~Iterator() { - if(impl) + if (impl) impl->unref(); } @@ -88,8 +88,8 @@ void Collection::intoStringBuffer(misc::StringBuffer *sb) { sb->append("{ "); bool first = true; - for(Iterator it = iterator(); it.hasNext(); ) { - if(!first) + for (Iterator it = iterator(); it.hasNext(); ) { + if (!first) sb->append(", "); it.getNext()->intoStringBuffer(sb); first = false; @@ -117,27 +117,27 @@ Vector::~Vector() void Vector::put(Object *newElement, int newPos) { - if(newPos == -1) + if (newPos == -1) newPos = numElements; // Old entry is overwritten. - if(newPos < numElements) { - if(ownerOfObjects && array[newPos]) + if (newPos < numElements) { + if (ownerOfObjects && array[newPos]) delete array[newPos]; } // Allocated memory has to be increased. - if(newPos >= numAlloc) { + if (newPos >= numAlloc) { while (newPos >= numAlloc) numAlloc *= 2; array = (Object**)realloc(array, numAlloc * sizeof(Object*)); } // Insert NULL's into possible gap before new position. - for(int i = numElements; i < newPos; i++) + for (int i = numElements; i < newPos; i++) array[i] = NULL; - if(newPos >= numElements) + if (newPos >= numElements) numElements = newPos + 1; array[newPos] = newElement; @@ -146,8 +146,8 @@ void Vector::put(Object *newElement, int newPos) void Vector::clear() { if (ownerOfObjects) { - for(int i = 0; i < numElements; i++) - if(array[i]) + for (int i = 0; i < numElements; i++) + if (array[i]) delete array[i]; } @@ -156,18 +156,18 @@ void Vector::clear() void Vector::insert(Object *newElement, int pos) { - if(pos >= numElements) + if (pos >= numElements) put(newElement, pos); else { numElements++; // Allocated memory has to be increased. - if(numElements >= numAlloc) { + if (numElements >= numAlloc) { numAlloc *= 2; array = (Object**)realloc(array, numAlloc * sizeof(Object*)); } - for(int i = numElements - 1; i > pos; i--) + for (int i = numElements - 1; i > pos; i--) array[i] = array[i - 1]; array[pos] = newElement; @@ -176,10 +176,10 @@ void Vector::insert(Object *newElement, int pos) void Vector::remove(int pos) { - if(ownerOfObjects && array[pos]) + if (ownerOfObjects && array[pos]) delete array[pos]; - for(int i = pos + 1; i < numElements; i++) + for (int i = pos + 1; i < numElements; i++) array[i - 1] = array[i]; numElements--; @@ -220,8 +220,8 @@ List::~List() void List::clear() { - while(first) { - if(ownerOfObjects && first->object) + while (first) { + if (ownerOfObjects && first->object) delete first->object; Node *next = first->next; delete first; @@ -238,7 +238,7 @@ void List::append(Object *element) newLast->next = NULL; newLast->object = element; - if(last) { + if (last) { last->next = newLast; last = newLast; } else @@ -252,21 +252,21 @@ bool List::remove0(Object *element, bool compare, bool doNotDeleteAtAll) { Node *beforeCur, *cur; - for(beforeCur = NULL, cur = first; cur; beforeCur = cur, cur = cur->next) { + for (beforeCur = NULL, cur = first; cur; beforeCur = cur, cur = cur->next) { if (compare ? (cur->object && element->equals(cur->object)) : element == cur->object) { - if(beforeCur) { + if (beforeCur) { beforeCur->next = cur->next; - if(cur->next == NULL) + if (cur->next == NULL) last = beforeCur; } else { first = cur->next; - if(first == NULL) + if (first == NULL) last = NULL; } - if(ownerOfObjects && cur->object && !doNotDeleteAtAll) + if (ownerOfObjects && cur->object && !doNotDeleteAtAll) delete cur->object; delete cur; @@ -282,7 +282,7 @@ Object *List::ListIterator::getNext() { Object *object; - if(current) { + if (current) { object = current->object; current = current->next; } else @@ -313,20 +313,20 @@ HashTable::HashTable(bool ownerOfKeys, bool ownerOfValues, int tableSize) this->tableSize = tableSize; table = new Node*[tableSize]; - for(int i = 0; i < tableSize; i++) + for (int i = 0; i < tableSize; i++) table[i] = NULL; } HashTable::~HashTable() { - for(int i = 0; i < tableSize; i++) { + for (int i = 0; i < tableSize; i++) { Node *n1 = table[i]; - while(n1) { + while (n1) { Node *n2 = n1->next; - if(ownerOfValues && n1->value) + if (ownerOfValues && n1->value) delete n1->value; - if(ownerOfKeys) + if (ownerOfKeys) delete n1->key; delete n1; @@ -342,9 +342,9 @@ void HashTable::intoStringBuffer(misc::StringBuffer *sb) sb->append("{ "); bool first = true; - for(int i = 0; i < tableSize; i++) { - for(Node *node = table[i]; node; node = node->next) { - if(!first) + for (int i = 0; i < tableSize; i++) { + for (Node *node = table[i]; node; node = node->next) { + if (!first) sb->append(", "); node->key->intoStringBuffer(sb); sb->append(" => "); @@ -369,7 +369,7 @@ void HashTable::put(Object *key, Object *value) bool HashTable::contains(Object *key) { int h = calcHashValue(key); - for(Node *n = table[h]; n; n = n->next) { + for (Node *n = table[h]; n; n = n->next) { if (key->equals(n->key)) return true; } @@ -380,7 +380,7 @@ bool HashTable::contains(Object *key) Object *HashTable::get(Object *key) { int h = calcHashValue(key); - for(Node *n = table[h]; n; n = n->next) { + for (Node *n = table[h]; n; n = n->next) { if (key->equals(n->key)) return n->value; } @@ -393,16 +393,16 @@ bool HashTable::remove(Object *key) int h = calcHashValue(key); Node *last, *cur; - for(last = NULL, cur = table[h]; cur; last = cur, cur = cur->next) { + for (last = NULL, cur = table[h]; cur; last = cur, cur = cur->next) { if (key->equals(cur->key)) { - if(last) + if (last) last->next = cur->next; else table[h] = cur->next; - if(ownerOfValues && cur->value) + if (ownerOfValues && cur->value) delete cur->value; - if(ownerOfKeys) + if (ownerOfKeys) delete cur->key; delete cur; @@ -416,7 +416,7 @@ bool HashTable::remove(Object *key) Object *HashTable::getKey (Object *key) { int h = calcHashValue(key); - for(Node *n = table[h]; n; n = n->next) { + for (Node *n = table[h]; n; n = n->next) { if (key->equals(n->key)) return n->key; } @@ -434,11 +434,11 @@ HashTable::HashTableIterator::HashTableIterator(HashTable *table) void HashTable::HashTableIterator::gotoNext() { - if(node) + if (node) node = node->next; - while(node == NULL) { - if(pos >= table->tableSize - 1) + while (node == NULL) { + if (pos >= table->tableSize - 1) return; pos++; node = table->table[pos]; @@ -449,7 +449,7 @@ void HashTable::HashTableIterator::gotoNext() Object *HashTable::HashTableIterator::getNext() { Object *result; - if(node) + if (node) result = node->key; else result = NULL; @@ -492,7 +492,7 @@ void Stack::push (object::Object *object) newTop->prev = top; top = newTop; - if(bottom == NULL) + if (bottom == NULL) bottom = top; numElements++; @@ -503,11 +503,11 @@ void Stack::pushUnder (object::Object *object) Node *newBottom = new Node (); newBottom->object = object; newBottom->prev = NULL; - if(bottom != NULL) + if (bottom != NULL) bottom->prev = newBottom; bottom = newBottom; - if(top == NULL) + if (top == NULL) top = bottom; numElements++; @@ -522,7 +522,7 @@ void Stack::pop () delete top; top = newTop; - if(top == NULL) + if (top == NULL) bottom = NULL; numElements--; @@ -532,7 +532,7 @@ Object *Stack::StackIterator::getNext() { Object *object; - if(current) { + if (current) { object = current->object; current = current->prev; } else |