예제 #1
0
void FileList::addDir(const std::string &dir_)
{
	string dir = dir_;
	if(!data->caseSensitive)
		convertLower(dir);

	haxFile(dir);
	data->addDir(dir);
}
예제 #2
0
void getAllDirs(IFileList &list, const std::string &root_, std::vector<std::string> &result, bool recurse, bool caseSensitive)
{
	string root = root_;
	if(!caseSensitive)
		convertLower(root);
	haxFile(root);

	getAllDirsImp(list, root, result, recurse);
	std::sort(result.begin(), result.end());
}
예제 #3
0
 bool isPalindrome(string s) {
     if(s.size() < 1) {
         return true;
     }
     int start = 0, end = s.size()-1;
     while(start < end) {
         while(start < end && !isValid(s[start])) {
             start++;
         }
         while(start < end && !isValid(s[end])) {
             end--;
         }
         if(convertLower(s[start]) != convertLower(s[end])) {
             return false;
         }
         start++;
         end--;
     }
     return true;
 }
예제 #4
0
const std::string &FileList::getFileName(const std::string &root_, int index) const
{
	string root = root_;
	if(!data->caseSensitive)
		convertLower(root);
	haxFile(root);

	DirList::iterator it;
	if(!data->findDir(it, root))
		return empty;

	return it->second.files[index];
}
예제 #5
0
int FileList::getFileAmount(const std::string &root_) const
{
	string root = root_;
	if(!data->caseSensitive)
		convertLower(root);
	haxFile(root);

	DirList::iterator it;
	if(!data->findDir(it, root))
		return 0;

	return it->second.files.size();
}
예제 #6
0
void FileList::addFile(const std::string &file_)
{
	string file = file_;
	if(!data->caseSensitive)
		convertLower(file);
	haxFile(file);

	string dir;
	getDirPart(file, dir);
	data->addDir(dir);

	DirList::iterator it;
	data->findDir(it, dir);
	it->second.addFile(file);
}
예제 #7
0
std::string FileList::getDirName(const std::string &root_, int index) const
{
	string root = root_;
	if(!data->caseSensitive)
		convertLower(root);

	haxFile(root);
	DirList::iterator it;
	if(!data->findDir(it, root))
		return empty;

	string result;
	getDirNameImp(it->second.subDirs, result, 0, index);

	return result;
}