ShareManager::getInstance()->getDirectories();

Technical discussion about the NMDC and <a href="http://dcpp.net/ADC.html">ADC</A> protocol. The NMDC protocol is documented in the <a href="http://dcpp.net/wiki/">Wiki</a>, so feel free to refer to it.

Moderator: Moderators

Locked
Xerpher
Posts: 9
Joined: 2003-06-02 09:34
Location: Canada
Contact:

ShareManager::getInstance()->getDirectories();

Post by Xerpher » 2003-06-09 00:39

Basically what I would like to understand, is how DC++ gets all the directories shared from the xml file using...

Code: Select all

ShareManager::getInstance()->getDirectories();
I traced it to this...

Code: Select all

StringList ShareManager::getDirectories() {
	RLock l(cs);

	StringList tmp;
	tmp.reserve(directories.size());
	for(Directory::MapIter i = directories.begin(); i != directories.end(); ++i) {
		tmp.push_back(i->first);
	}
	return tmp;
}
But I don't understand how that returns a list of the directories from the xml file, I understand how it returns the data, just not how Directory::MapIter works.

So if anyone can explain to me how ShareManager::getInstance()->getDirectories(); gets the directories, not the actual data, just the directory list from the xml file, I'd be greatful. Thanks.

sarf
Posts: 382
Joined: 2003-01-24 05:43
Location: Sweden
Contact:

Post by sarf » 2003-06-09 08:04

Well, ummm... the ShareManager retrieves the shared directories from the DCPlusPlus.xml file when the file have been loaded. It then creates a list which contains the directories and files in the shared directories.

The MapIter is a Map Iterator, and it goes through all the "base" shared directories and adds them to the StringList.

Ehh... I hope this clarifies things a bit (but I expect that it will not).

Sarf
---
Dating processes are dependent on the analysis of rocks.

Xerpher
Posts: 9
Joined: 2003-06-02 09:34
Location: Canada
Contact:

Post by Xerpher » 2003-06-11 09:07

It did partially help me, but now, may I ask what exactly is a Map Iterator? I'm fairly new to programming and am very curious :D

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2003-06-13 15:19

Xerpher wrote:It did partially help me, but now, may I ask what exactly is a Map Iterator? I'm fairly new to programming and am very curious :D
Exactly? Well, an iterator is a term from the Standard Template Library. (STL). SGI has a good reference here: http://www.sgi.com/tech/stl/stl_index.html

Xerpher
Posts: 9
Joined: 2003-06-02 09:34
Location: Canada
Contact:

Post by Xerpher » 2003-06-13 15:26

Thanks, that helps :)

Locked