Ejemplo n.º 1
0
    virtual void put(const char *key, ResourceValue &value, UBool, UErrorCode &errorCode) {
        ResourceTable dayPeriodData = value.getTable(errorCode);
        if (U_FAILURE(errorCode)) { return; }

        for (int32_t i = 0; dayPeriodData.getKeyAndValue(i, key, value); ++i) {
            if (uprv_strcmp(key, "locales") == 0) {
                ResourceTable locales = value.getTable(errorCode);
                if (U_FAILURE(errorCode)) { return; }

                for (int32_t j = 0; locales.getKeyAndValue(j, key, value); ++j) {
                    UnicodeString setNum_str = value.getUnicodeString(errorCode);
                    int32_t setNum = parseSetNum(setNum_str, errorCode);
                    uhash_puti(data->localeToRuleSetNumMap, const_cast<char *>(key), setNum, &errorCode);
                }
            } else if (uprv_strcmp(key, "rules") == 0) {
                // Allocate one more than needed to skip [0]. See comment in parseSetNum().
                data->rules = new DayPeriodRules[data->maxRuleSetNum + 1];
                if (data->rules == NULL) {
                    errorCode = U_MEMORY_ALLOCATION_ERROR;
                    return;
                }
                ResourceTable rules = value.getTable(errorCode);
                processRules(rules, key, value, errorCode);
                if (U_FAILURE(errorCode)) { return; }
            }
        }
    }
Ejemplo n.º 2
0
void Database::processQueries () {
    std::vector<Predicate*> pred = parser->ql->j;
    for (int i = 0; i < pred.size(); i++) { //Loop through the list of queries
        std::string name = pred.at(i)->first->getTokensValue(); //Get the name of the schema
        
        for (int j = 0; j < relations.size(); j++) { //Loop through the list of relations
            if (name.compare(relations.at(j)->name) == 0) { //If the query's schema matches a relation
                processRules(name);
                Relation* r = relations.at(j)->processQuery(pred.at(i)->parl); //Process the query with that relation
                std::cout << r->print(pred.at(i)->parl);
                break;
            }
        }
    }
    
    //std::cout << "Done!";
}