shuisheng wrote:
I'd like to build a structure similar to the folder tree which
1. Has a root.
2. Nodes can be folder or files.
3. Folder can contain folders and files.
4. Name of folders and files under a folder can not be same.
Anybody can give me some hint?
class FolderEntry
{
std::string name;
public:
FolderEntry(std::string const&);
};
class Folder : public FolderEntry
{
std::vector<FolderEntry*entries; // can be empty
...
void fillEntries(); // scanning the file system
};
class File : public FolderEntry
{
...
};
What other hints do you expect? Scanning folders and filling in
the 'entries' for any 'Folder' is platform-specific.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask