/* clear out production caches */ static void clearCaches(struct Production *production) { production->cachesz = 0; production->cache = NULL; if (production->left) clearCaches(production->left); if (production->right) clearCaches(production->right); }
URegistryKey ICUService::registerFactory(ICUServiceFactory* factoryToAdopt, UErrorCode& status) { if (U_SUCCESS(status) && factoryToAdopt != NULL) { Mutex mutex(&lock); if (factories == NULL) { factories = new UVector(deleteUObject, NULL, status); if (U_FAILURE(status)) { delete factories; return NULL; } } factories->insertElementAt(factoryToAdopt, 0, status); if (U_SUCCESS(status)) { clearCaches(); } else { delete factoryToAdopt; factoryToAdopt = NULL; } } if (factoryToAdopt != NULL) { notifyChanged(); } return (URegistryKey)factoryToAdopt; }
void DataStorePrivate::removeStringInRange(uint index, int length) { uint lineNumber = 0; uint indexInLine = 0; DataStorePrivate::GetPositionInStorageForIndex(_dataStorage, lineNumber, indexInLine, index); _stringLength -= length; while (length) { uint lengthInCurrentLine = _dataStorage[lineNumber]->size(); if (0 == indexInLine && lengthInCurrentLine <= length) { _dataStorage.erase(_dataStorage.begin() + lineNumber); length -= lengthInCurrentLine; } else if (indexInLine + length <= lengthInCurrentLine) { SubBaseTypePtr currentLine = _dataStorage[lineNumber]; currentLine->erase(currentLine->begin()+indexInLine, currentLine->begin()+indexInLine+length); length = 0; } else { SubBaseTypePtr currentLine = _dataStorage[lineNumber]; currentLine->erase(currentLine->begin()+indexInLine, currentLine->end()); length -= lengthInCurrentLine - indexInLine; indexInLine = 0; lineNumber++; } } clearCaches(); }
DataStorePrivate::~DataStorePrivate() { #ifdef SHOW_DEBUG_MESSAGES printf("%p - DataStorePrivate::~DataStorePrivate() called\n", this); #endif clearDataStorage(); clearCaches(); }
ICUService::~ICUService() { { Mutex mutex(&lock); clearCaches(); delete factories; factories = NULL; } }
void ICUService::reset() { { Mutex mutex(&lock); reInitializeFactories(); clearCaches(); } notifyChanged(); }
void DataStorePrivate::insertStringOnThePosition(const char* inString, uint index) { if (0 == index) { insertStringOnTheBegining(inString); } else if (_stringLength == index) { insertStringOnTheEnding(inString); } else { insertStringAtIndex(inString, index); } clearCaches(); }
void DataStorePrivate::insertCharacterAtIndex(char ch, uint index) { if (0 != _stringLength) { uint lineNumber; uint indexInLine; if (!GetPositionInStorageForIndex(_dataStorage, lineNumber, indexInLine, index)) { return; } if (_dataStorage[lineNumber]->size() + 1 <= kMaxCharactersPerLineConteiner) { SubBaseType& currentLine = *_dataStorage[lineNumber]; SubBaseType::iterator iteratorToInsert = currentLine.end(); if (currentLine[indexInLine] == '\0') { iteratorToInsert--; } currentLine.insert(iteratorToInsert, &ch, &ch + 1); } else { SubBaseType& currentLine = *_dataStorage[lineNumber]; SubBaseTypePtr newLine = new SubBaseType(); if (currentLine[indexInLine] == '\0') { currentLine.pop_back(); currentLine.push_back(ch); newLine->push_back(0); } else { currentLine.push_back(ch); } _dataStorage.insert(_dataStorage.begin()+lineNumber+1, newLine); } } else { SubBaseTypePtr line = _dataStorage[0]; line->insert(line->begin(), ch); } _stringLength++; clearCaches(); }
UBool ICUService::unregister(URegistryKey rkey, UErrorCode& status) { ICUServiceFactory *factory = (ICUServiceFactory*)rkey; UBool result = FALSE; if (factory != NULL && factories != NULL) { Mutex mutex(&lock); if (factories->removeElement(factory)) { clearCaches(); result = TRUE; } else { status = U_ILLEGAL_ARGUMENT_ERROR; delete factory; } } if (result) { notifyChanged(); } return result; }
/* parse using the specified production */ struct ParseResult *packratParse(struct ParseContext *ctx, struct Production *production, unsigned char *file, int line, int col, unsigned char *input) { struct ParseResult **pr, *longest; int i; /* parse */ pr = packratParsePrime(ctx, production, file, line, col, input, 0); /* choose the longest */ longest = pr[0]; for (i = 0; pr[i]; i++) { if (pr[i]->consumedTo > longest->consumedTo) longest = pr[i]; } /* then clear out the caches */ clearCaches(productions); return longest; }
GLWrapper::GLWrapper() : initialized(false), infoOutput(NULL), errorOutput(NULL), logEnable(false) { clearCaches(); }
void GLWrapper::UseProgram(GLuint program) { GLLOG(glUseProgram(program));ERROR_CHECK; clearCaches(); }
void DataStorePrivate::setReferenceCount(uint referenceCount) { clearCaches(); _referenceCount = referenceCount; }
void RGraphicsView::setViewportNumber(int n) { viewportNumber = n; // changing the viewport number changes settings variable names (e.g. "Grid/DisplayGrid03"): clearCaches(); }
void GroupCanvasElement::add(CanvasElement* child) { _children.push_back(child); clearCaches(); }