[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[oMetah-devel] ometah/common itsSet.hpp
From: |
NoJhan |
Subject: |
[oMetah-devel] ometah/common itsSet.hpp |
Date: |
Sun, 12 Jun 2005 12:09:59 -0400 |
CVSROOT: /cvsroot/ometah
Module name: ometah
Branch:
Changes by: NoJhan <address@hidden> 05/06/12 16:09:59
Modified files:
common : itsSet.hpp
Log message:
* the key list is now returned via iterators
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/common/itsSet.hpp.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
Patches:
Index: ometah/common/itsSet.hpp
diff -u ometah/common/itsSet.hpp:1.13 ometah/common/itsSet.hpp:1.14
--- ometah/common/itsSet.hpp:1.13 Tue Jun 7 15:33:29 2005
+++ ometah/common/itsSet.hpp Sun Jun 12 16:09:59 2005
@@ -1,5 +1,5 @@
/***************************************************************************
- * $Id: itsSet.hpp,v 1.13 2005/06/07 15:33:29 jpa Exp $
+ * $Id: itsSet.hpp,v 1.14 2005/06/12 16:09:59 nojhan Exp $
* Copyright : Université Paris 12 Val-de-Marne
* (61 avenue du Général de Gaulle, 94010, Créteil, France)
* Author: Walid TFAILI <address@hidden>, Jean-Philippe Aumasson
<address@hidden>
@@ -52,8 +52,6 @@
//! The current choice
string currentItem;
- //! List of keys
- vector<string> keyList;
public:
//! Add an object
@@ -66,7 +64,6 @@
{
// key is based on a const char*, so we take the c_str
collection[anItem->getKey().c_str()] = anItem;
- keyList.push_back(anItem->getKey());
};
//! Remove an object
@@ -93,11 +90,21 @@
{
return collection[currentItem.c_str()];
};
-
- vector<string> getKeyList()
+
+ //! Return a list of the available keys
+ vector<string> getKeyList()
{
- return keyList;
+ vector<string> list;
+ typename hash_map< const char*, T, hash<const char*>, eqstr > ::iterator
current = collection.begin();
+ typename hash_map< const char*, T, hash<const char*>, eqstr > ::iterator
end = collection.end();
+ while ( current != end ) {
+ string s = (*current).first;
+ list.push_back(s);
+ current++;
+ }
+ return list;
}
+
};
#endif