Mailinglist Archive: yast-commit (819 mails)

< Previous Next >
[yast-commit] r54429 - in /trunk/core/libycp/src: YCPBuiltinMap.cc YCPMap.cc include/ycp/YCPMap.h
  • From: aschnell@xxxxxxxxxxxxxxxx
  • Date: Wed, 07 Jan 2009 13:46:26 -0000
  • Message-id: <E1LKYjr-0005rR-20@xxxxxxxxxxxxxxxx>
Author: aschnell
Date: Wed Jan 7 14:46:26 2009
New Revision: 54429

URL: http://svn.opensuse.org/viewcvs/yast?rev=54429&view=rev
Log:
- removed unused (and in YCPMap forgotton) function findKey
- added hasKey function

Modified:
trunk/core/libycp/src/YCPBuiltinMap.cc
trunk/core/libycp/src/YCPMap.cc
trunk/core/libycp/src/include/ycp/YCPMap.h

Modified: trunk/core/libycp/src/YCPBuiltinMap.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libycp/src/YCPBuiltinMap.cc?rev=54429&r1=54428&r2=54429&view=diff
==============================================================================
--- trunk/core/libycp/src/YCPBuiltinMap.cc (original)
+++ trunk/core/libycp/src/YCPBuiltinMap.cc Wed Jan 7 14:46:26 2009
@@ -62,8 +62,7 @@
return YCPNull ();
}

- YCPValue tmp = map->value (value);
- return YCPBoolean (!tmp.isNull ());
+ return YCPBoolean(map->hasKey(value));
}


@@ -524,7 +523,7 @@

YCPMap ret = map;

- if(map->value (key).isNull ())
+ if (!map->hasKey(key))
{
ycp2error ( "Key %s for remove () does not exist", key->toString
().c_str ());
return ret;

Modified: trunk/core/libycp/src/YCPMap.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libycp/src/YCPMap.cc?rev=54429&r1=54428&r2=54429&view=diff
==============================================================================
--- trunk/core/libycp/src/YCPMap.cc (original)
+++ trunk/core/libycp/src/YCPMap.cc Wed Jan 7 14:46:26 2009
@@ -127,6 +127,13 @@
}


+bool
+YCPMapRep::hasKey(const YCPValue& key) const
+{
+ return stl_map.find(key) != stl_map.end();
+}
+
+
YCPValue
YCPMapRep::value(const YCPValue& key) const
{
@@ -196,13 +203,6 @@
}


-YCPMapIterator
-YCPMapRep::findKey(const YCPValue& key) const
-{
- return stl_map.find( key );
-}
-
-
YCPValueType
YCPMapRep::valuetype() const
{

Modified: trunk/core/libycp/src/include/ycp/YCPMap.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libycp/src/include/ycp/YCPMap.h?rev=54429&r1=54428&r2=54429&view=diff
==============================================================================
--- trunk/core/libycp/src/include/ycp/YCPMap.h (original)
+++ trunk/core/libycp/src/include/ycp/YCPMap.h Wed Jan 7 14:46:26 2009
@@ -92,6 +92,11 @@
long size() const;

/**
+ * Returns true iff the map contains the key.
+ */
+ bool hasKey(const YCPValue& key) const;
+
+ /**
* Looks for a certain key and returns the value assigned
* to that key. Returns 0, if the key is not found.
*/
@@ -140,16 +145,6 @@
* Returns YT_MAP. See @ref YCPValueRep#valuetype.
*/
YCPValueType valuetype() const;
-
-
-private:
- /**
- * Searches the map for a given key and returns
- * an iterator that is positioned at the entry found.
- * If the key can not be found the iterator is positioned
- * at end().
- */
- YCPMapIterator findKey(const YCPValue& key) const;
};

/**
@@ -219,6 +214,7 @@
void remove(const YCPValue& key) { ELEMENT-> remove (key); }
bool isEmpty() const { return CONST_ELEMENT->isEmpty(); }
long size() const { return CONST_ELEMENT-> size (); }
+ bool hasKey(const YCPValue& key) const { return
CONST_ELEMENT->hasKey(key); }
YCPValue value(const YCPValue& key) const { return CONST_ELEMENT-> value
(key); }
YCPMapIterator begin() const { return CONST_ELEMENT-> begin (); }
YCPMapIterator end() const { return CONST_ELEMENT-> end (); }

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages