Example #1
0
/* 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);
}
Example #2
0
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;
}
Example #3
0
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();
}
Example #4
0
DataStorePrivate::~DataStorePrivate()
{
#ifdef SHOW_DEBUG_MESSAGES
    printf("%p - DataStorePrivate::~DataStorePrivate() called\n", this);
#endif
    clearDataStorage();
    clearCaches();
}
Example #5
0
ICUService::~ICUService()
{
    {
        Mutex mutex(&lock);
        clearCaches();
        delete factories;
        factories = NULL;
    }
}
Example #6
0
void 
ICUService::reset() 
{
    {
        Mutex mutex(&lock);
        reInitializeFactories();
        clearCaches();
    }
    notifyChanged();
}
Example #7
0
void DataStorePrivate::insertStringOnThePosition(const char* inString, uint index)
{
    if (0 == index)
    {
        insertStringOnTheBegining(inString);
    }
    else if (_stringLength == index)
    {
        insertStringOnTheEnding(inString);
    }
    else
    {
        insertStringAtIndex(inString, index);
    }
    clearCaches();
}
Example #8
0
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();
}
Example #9
0
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;
}
Example #10
0
/* 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;
}
Example #11
0
GLWrapper::GLWrapper() : initialized(false), infoOutput(NULL), errorOutput(NULL), logEnable(false)
{
	clearCaches();
}
Example #12
0
void GLWrapper::UseProgram(GLuint program)
{
	GLLOG(glUseProgram(program));ERROR_CHECK;
	clearCaches();
}
Example #13
0
void DataStorePrivate::setReferenceCount(uint referenceCount)
{
    clearCaches();
    _referenceCount = referenceCount;
}
Example #14
0
void RGraphicsView::setViewportNumber(int n) {
    viewportNumber = n;

    // changing the viewport number changes settings variable names (e.g. "Grid/DisplayGrid03"):
    clearCaches();
}
Example #15
0
void GroupCanvasElement::add(CanvasElement* child) {
  _children.push_back(child);
  clearCaches();
}