#ifndef __UT_DIRECTORY_HPP__ #define __UT_DIRECTORY_HPP__ #include namespace unitree { namespace common { typedef std::pair DIRENT_INFO; typedef std::pair SYMLNK_INFO; class Directory { public: Directory(); Directory(const std::string& dirName); ~Directory(); void Open(); void Open(const std::string& dirName); bool IsOpen(); void ListFile(std::vector& fileNameList, const std::string& regExpress); void ListFile(std::vector& fileNameList, bool recurse = true, bool absolute = true); void ListDir(std::vector& dirNameList, bool recurse = true, bool absolute = true); void List(std::list& fileNameList, std::list& dirNameList, std::list& symlinkList); void Cleanup(); bool CopyTo(const std::string& dirName, bool deeply = false); void Close(); private: void CheckOpen(); void OpenInner(); private: DIR *mDIR; std::string mDirName; }; typedef std::shared_ptr DirectoryPtr; bool ExistDirectory(const std::string& dirName); void CreateDirectory(const std::string& dirName, bool recurse = true, uint32_t mode = UT_OPEN_MODE_RWX); void ListDirectory(const std::string& dirName, std::vector& fileNameList, const std::string& regExpress); void ListDirectory(const std::string& dirName, std::vector& fileNameList, bool recurse = true, bool absolute = true); void ListChildDirectory(const std::string& dirName, std::vector& dirNameList, bool recurse = true, bool absolute = true); void RemoveDirectory(const std::string& dirName, bool recurse = true); void CopyDirectory(const std::string& dirName, const std::string& destDirName, bool deeply); } } #endif//__UT_DIRECTORY_HPP__