43 lines
965 B
C++
43 lines
965 B
C++
#pragma once
|
|
#ifndef __PATHNAME_H__
|
|
#define __PATHNAME_H__
|
|
|
|
#ifndef _STRING_
|
|
#include <string>
|
|
#endif
|
|
|
|
#ifndef _VECTOR_
|
|
#include <vector>
|
|
#endif
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// CPathName
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class CPathName : public std::string
|
|
{
|
|
protected:
|
|
|
|
public:
|
|
std::string Path() const;
|
|
std::string FullName() const;
|
|
std::string Name() const;
|
|
std::string Ext() const;
|
|
|
|
CPathName& Set(const char* p, const char* n, const char* e);
|
|
CPathName& SetPath(const char* p);
|
|
CPathName& SetName(const char* n);
|
|
CPathName& SetExt(const char* e);
|
|
bool IsFile() const;
|
|
bool IsDirectory() const;
|
|
size_t List(std::vector<CPathName>& files) const;
|
|
|
|
CPathName() {}
|
|
CPathName(const char* pathname) : std::string(pathname) {}
|
|
};
|
|
|
|
std::string& operator<<(std::string& str, int n);
|
|
std::string& operator<<(std::string& str, char c);
|
|
|
|
#endif
|