Пример #1
0
void GaduEmoticonParser::parse()
{
	QChar c = peek();
	if (c.isNull())
		return;

	if (c == '*') // ignore first *, I don't know why
		eat();

	QStringList aliases = parseAliases();
	eat(); // ,
	QString animatedPath = parseQuoted();
	eat(); // ,
	QString staticPath = parseQuoted();

	if (aliases.isEmpty() || animatedPath.isEmpty())
		return;

	animatedPath = ThemePath + fixFileName(ThemePath, animatedPath);
	if (staticPath.isEmpty())
		staticPath = animatedPath;
	else
		staticPath = ThemePath + fixFileName(ThemePath, staticPath);

	Result = Emoticon(aliases.at(0), staticPath, animatedPath);
	foreach (const QString &alias, aliases)
		Aliases.append(Emoticon(alias, staticPath, animatedPath));
}
Пример #2
0
bool	ColladaConverter::load(const char* orgfilename)
{

	const char* filename = fixFileName(orgfilename);

	int res = m_collada->load(filename);//,docBuffer);

	if (res != DAE_OK)
	{
		//some platforms might require different path, try two additional locations
		char newname[256];
		sprintf(newname,"../../%s",orgfilename);
		filename = fixFileName(newname);
		res = m_collada->load(filename);
		if (res != DAE_OK)
		{
			printf("DAE/Collada-m_dom: Couldn't load %s\n",filename);
			return false;
		}
	}

	if (res == DAE_OK)
	{

		m_dom = m_collada->getDom(filename);
		if ( !m_dom )
		{
			printf("COLLADA File loaded to the m_dom, but query for the m_dom assets failed \n" );
			printf("COLLADA Load Aborted! \n" );
			delete m_collada;
			return false;
		}
	}
	return true;
}
Пример #3
0
bool EmoticonsManager::loadGGEmoticonThemePart(const QString &themeSubDirPath)
{
	QString dir = themeSubDirPath;

	if (!dir.isEmpty() && !dir.endsWith('/'))
		dir += '/';

	QFile theme_file(dir + "emots.txt");
	if (!theme_file.open(QIODevice::ReadOnly))
	{
		kdebugm(KDEBUG_FUNCTION_END|KDEBUG_WARNING, "Error opening %s file\n",
			qPrintable(theme_file.fileName()));
		return false;
	}
	QTextStream theme_stream(&theme_file);
	theme_stream.setCodec(codec_cp1250);
	while (!theme_stream.atEnd())
	{
		EmoticonsListItem item;
		QString line = theme_stream.readLine();
		kdebugm(KDEBUG_DUMP, "> %s\n", qPrintable(line));
		unsigned int lineLength = line.length();
		unsigned int i = 0;
		bool multi = false;
		QStringList aliases;
		if (i < lineLength && line.at(i) == '*')
			++i; // eat '*'
		if (i < lineLength && line.at(i) == '(')
		{
			multi = true;
			++i;
		}
		for (;;)
		{
			aliases.append(getQuoted(line, i));
			if (!multi || i >= lineLength || line.at(i) == ')')
				break;
			++i; // eat ','
		}
		if (multi)
			++i; // eat ')'
		++i; // eat ','
		item.anim = themeSubDirPath + '/' + fixFileName(themeSubDirPath, getQuoted(line, i));
		if (i < lineLength && line.at(i) == ',')
		{
			++i; // eat ','
			item.stat = themeSubDirPath + '/' + fixFileName(themeSubDirPath, getQuoted(line, i));
		}
		else
			item.stat = item.anim;

		foreach (const QString &alias, aliases)
		{
			item.alias = alias;
			Aliases.push_back(item);
		}

		item.alias = aliases.at(0);
		Selector.append(item);
	}
Пример #4
0
int main()
{
    std::string catalog("./");
    std::string indFileName("ind.sba");
    std::string crdFileName("crd.sba");
    std::string mtrFileName("mtr001.sba");
    std::string fixFileName("fix.sba");
    std::string forceFileName("force.sba");

   // std::unique_ptr<sbfMesh> =

    return 0;
}
Пример #5
0
void CVirtualFS::mount(const string &mpoint, const string &target){
	CFileCollection fileCol;

	if(mpoint == "" || target == "")
		return;
	
	fileCol.mMountPoint = fixFileName(mpoint);
	if(target[target.size() - 1] == '/'){
		fileCol.colPath = target;
	} else {
		fileCol.colPath = target + "/";
	}
	fileCol.col_type = CFileCollection::Directory;
	addCollection(fileCol);

	if(getDebug())
		gcon.printf("CVirtualFS::mount(%s, %s)\n", fileCol.mMountPoint.c_str(), fileCol.colPath.c_str());
}
Пример #6
0
bool xncv::VideoSource::startRecording(const std::string& fileName, 
	ImageCompression imageCompression, DepthCompression depthCompression)
{
	if (isFile)
		return false;

	if (isRecording())
		stopRecording();


	createRecorder(fixFileName(fileName));		
	if (imageCompression != IMG_DONT_CAPTURE)
		recorder->AddNodeToRecording(imgGen, imageCompression == IMG_NONE ?
			XN_CODEC_UNCOMPRESSED : XN_CODEC_JPEG);	

	if (depthCompression != DEPTH_DONT_CAPTURE)
		recorder->AddNodeToRecording(depthGen, depthCompression == DEPTH_NONE ?
		XN_CODEC_UNCOMPRESSED : XN_CODEC_16Z_EMB_TABLES);	

	return true;
}
Пример #7
0
void CFile::setName(const string &fname){
    name = fixFileName(fname);
    if(name[name.size() - 1] == '/'){
        name.erase(name.size()-1, 1);
    }
}
Пример #8
0
void CVirtualFS::findFiles(const string &path, const string &extension, FindResult &fr){
	S32 i;
#ifdef _WIN32
	struct	_finddata_t fileinfo;
#else
	struct	dirent **entlist, *ent;
#endif

	CollectionList::iterator col;

	for(col = fileCollections.begin() ; col != fileCollections.end() ; col++){
		if(col->col_type == CFileCollection::QuakePAK){		
		} else 
		if(col->col_type == CFileCollection::NativeCollection){
            string fullPath = path;
            {S32 i=0;
				while((i = fullPath.find('\\', i)) != string::npos){
					fullPath.replace(i, 1, "/");
			}}
			Unz_GetStringForDir((unzFile*)col->zh, fullPath, extension, fr);
		} else 
			if(col->col_type == CFileCollection::Directory){
				string fullPath = fixFileName(path);
				i = fullPath.find(col->mMountPoint, 0);
				if(i != 0){
					return;
				}
				fullPath.replace(0, col->mMountPoint.size(), "");
				if(fullPath[0] == '/')
					fullPath.replace(0, 1, "");

				fullPath = col->colPath + fullPath;
#ifdef _WIN32	
				fullPath += "*." + extension;
				{S32 i=0;
				while((i = fullPath.find('/', i)) != string::npos){
					fullPath.replace(i, 1, "\\");
				}}
				S32 hd;
				hd = _findfirst(fullPath.c_str(), &fileinfo);
				if(hd != -1){
					do {
						fr.push_back(CFile(path + fileinfo.name));
					} while (_findnext(hd, &fileinfo) != -1);
					_findclose(hd);
				}
#else
				S32 numfiles = scandir(fullPath.c_str(), &entlist, NULL, NULL);
				for(S32 i = 0 ; i < numfiles ; i++){
					ent = entlist[i];
					// Skip hidden
					if(ent->d_name[0]=='.')continue;

					// Keep requested files
					if(strncmp(extension.c_str(),
						ent->d_name + strlen(ent->d_name) - extension.length(),
						extension.length()))continue;

					fr.push_back(CFile(path + ent->d_name));
				}
#endif		
			}
	}
}