⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dir_utils.cpp

📁 Particle filtering implementation and application to people tracking.
💻 CPP
字号:
#include "dir_utils.h"#include <iostream>std::string dirname(const std::string& path){	return path.substr(0,path.length() - std::string(basename(path.c_str())).length()-1);}DirHandle::DirHandle():	pdir(NULL){	path = "";}DirHandle::DirHandle(const std::string& _path){	path = _path;	open(path);}DirHandle::~DirHandle(){	close();}bool DirHandle::isGood(){	return pdir == NULL && pdirent == NULL;}std::string DirHandle::next(const std::string& filter){	std::string name = "";	std::string sub = "";	while (sub != filter)	{		try		{			name = next();			sub = name.substr(name.length() - filter.length());			if (name == "NULL")			{				return "";			}		}		catch (std::out_of_range oor)		{		}	}	return name;}std::string DirHandle::next(){	pdirent = readdir(pdir);	if (pdirent == NULL)		return "NULL";	return pdirent->d_name;}bool DirHandle::open(const std::string& path){	pdir = opendir(path.c_str());	return pdir != NULL;}bool DirHandle::close(){	if (pdir != NULL)	{		closedir(pdir);		return true;	}	return false;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -