Exemple #1
0
void mainWindow::startPublish()
{
	if (publishEnabled)
		return;
	publishEnabled = 1;
	zeroConf.startServicePublish(buildName().toUtf8(), "_qtzeroconf_test._tcp", "local", 11437);
}
Exemple #2
0
bool TTileL3Cache::checkTile(const TTileRef &ref)
{
	QString filename = buildName(ref);

	QMutexLocker locker(&_mutex);

	return QFile::exists(filename);
}
Exemple #3
0
Logic_Relation::Logic_Relation(LTerm h, QList<LTerm> b, Logic::LOGIC_QUALIFIER q, bool n):
    qualifier(q),
    negation(n)
{
    head = Logic_Term::clone(h);
    body = Logic_Term::cloneList(b);
    buildName();
    buildFreeVariables();
}
GDL_RelationalSentence::GDL_RelationalSentence(PConstant h, QVector<PTerm> b, GDL_TYPE t, PConstant skolemH):
    head(h),
    body(b),
    type(t),
    skolemHead(skolemH)
{
    buildName();
    buildSkolemName();
    dependentConstants.insert(h);
}
Exemple #5
0
GDL_Rule::GDL_Rule(PRelation h, QList<PSentence> b):
    head(h),
    body(b)
{
    buildName();

    buildRelationList();
    for(PSentence s : b){
        dependentConstants = dependentConstants.unite(s->getDependentConstants());
        dependentConstantsNegative = dependentConstantsNegative.unite(s->getDependentConstantsNegative());
    }

}
Exemple #6
0
void TTileL3Cache::addTile(TTileCompressed *tile)
{
	createDir(tile->ref());
	QString filename = buildName(tile->ref());

	QMutexLocker locker(&_mutex);

	QFile file(filename);
	if(!file.open(QIODevice::WriteOnly)) {
		qDebug() << "Error opening file for write: " << filename;
	} else {
		file.write(*tile);
	}
}
Exemple #7
0
void Logic_Relation::substitute(LTerm v, LTerm t){
    Q_ASSERT(v->getType() == LOGIC_TERM_TYPE::VARIABLE);
    QString variableName = v->toString();
    if(freeVariables.contains(variableName)){
        //qDebug() << "Logic_Relation::substitutewith term " << t->toString() << " and var "  << variableName << " in relation " << toString();
        for(LTerm bodyTerm : body){
            bodyTerm->substitute(v, t);
        }

        // Update name
        buildName();

        // Update free variables
        freeVariables.remove(variableName);
        addFreeVariables(t);
    }
}
Exemple #8
0
TTileCompressed *TTileL3Cache::getTile(const TTileRef &ref)
{
	TTileCompressed *tile = NULL;
	QString filename = buildName(ref);

	QMutexLocker locker(&_mutex);

	if(QFile::exists(filename)) {
		QFile file(filename);
		if(!file.open(QIODevice::ReadOnly)) {
			qDebug() << "Error opening file for read: " << filename;
		} else {
			tile = new TTileCompressed(file.readAll());
			tile->setRef(ref);
		}
	}

	return tile;
}
SecPwd::SecPwd(const char *dir, const char* fileName,
               const char* activeFileName,
               const char* serverName) throw (SecurityException)
    : m_sec(NULL), certFile(NULL), activeCertFile(NULL)
{
    char* dir_from_env = NULL;
    char  certDir[MAX_SQL_IDENTIFIER_LEN + 1];

    if (serverName == NULL)
        throw SecurityException (INPUT_PARAMETER_IS_NULL, " - serverName.");

    dir = (dir != NULL) ? dir : getenv("HOME");

    if (dir == NULL)
    {
        //Check HOMEDRIVE (or HOMEDRIVE + HOMEPATH ) for interix
        char *hmdrive=getenv("HOMEDRIVE");
        char *hmpath=getenv("HOMEPATH");
        if (hmdrive != NULL && hmpath != NULL)
        {
            // Fix solution #10-090803-8661
            TrimLeft(hmdrive);
            TrimRight(hmdrive);
            TrimLeft(hmpath);
            TrimRight(hmpath);
            dir_from_env = new char[strlen(hmdrive) + strlen(hmpath) + 1];
            sprintf((char *)dir_from_env, "%s%s\0", hmdrive, hmpath);
        }
        else
            throw SecurityException (HOME_ENVIRONMENT_VAR_IS_NULL, NULL);
    }
    else
    {
        TrimLeft((char *)dir);
        TrimRight((char *)dir);
    }
    if(dir != NULL)
        strncpy(certDir, dir, sizeof(certDir));
    else
    {
        strncpy(certDir, dir_from_env, sizeof(certDir));
        certDir[sizeof(certDir) -1] = '\0';
        delete[] dir_from_env;
    }

    struct stat st;
    if(stat(certDir,&st) != 0)
        throw SecurityException(DIR_NOTFOUND, (char *)certDir);

    certFile = buildName(certDir, fileName, serverName, CER);
    activeCertFile = buildName(certDir, activeFileName, serverName, ACTIVE_CER);

    // If activeCertFile does not exist and certFile exist, create activeCertFile
    // by from copying certFile to activeCertFile
    struct stat certStats;
    struct stat aCertStats;

    if ( (stat(certFile, &certStats) == 0 ) &&
            (stat(activeCertFile, &aCertStats) != 0 ))
        copyFile(certFile, activeCertFile);
}
Exemple #10
0
void Logic_Relation::setNegation(bool b){
    negation = b;
    buildName();
}
Exemple #11
0
void Logic_Relation::setQualifier(Logic::LOGIC_QUALIFIER q){
    qualifier = q;
    buildName();
}