Mailinglist Archive: yast-commit (819 mails)

< Previous Next >
[yast-commit] r54433 - in /trunk/core/libycp/src: Type.cc YCPBuiltinMap.cc YCPMap.cc YExpression.cc
  • From: aschnell@xxxxxxxxxxxxxxxx
  • Date: Wed, 07 Jan 2009 14:10:43 -0000
  • Message-id: <E1LKZ7M-000631-0M@xxxxxxxxxxxxxxxx>
Author: aschnell
Date: Wed Jan 7 15:10:43 2009
New Revision: 54433

URL: http://svn.opensuse.org/viewcvs/yast?rev=54433&view=rev
Log:
- use YCPMap::const_iterator

Modified:
trunk/core/libycp/src/Type.cc
trunk/core/libycp/src/YCPBuiltinMap.cc
trunk/core/libycp/src/YCPMap.cc
trunk/core/libycp/src/YExpression.cc

Modified: trunk/core/libycp/src/Type.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libycp/src/Type.cc?rev=54433&r1=54432&r2=54433&view=diff
==============================================================================
--- trunk/core/libycp/src/Type.cc (original)
+++ trunk/core/libycp/src/Type.cc Wed Jan 7 15:10:43 2009
@@ -21,7 +21,7 @@
#include "ycp/Type.h"
#include "ycp/Bytecode.h"
#include "ycp/Xmlcode.h"
-#include "ycp/YCPMap.h" // for YCPMapIterator
+#include "ycp/YCPMap.h"
#include "ycp/YCPCode.h" // for YT_Code in matchvalue()

#ifndef DO_DEBUG
@@ -455,10 +455,10 @@

// check every map element
YCPMap mvalue = value->asMap();
- for (YCPMapIterator i = mvalue->begin(); i != mvalue->end(); i++)
+ for (YCPMap::const_iterator i = mvalue->begin(); i !=
mvalue->end(); ++i)
{
- YCPValue kvalue = i.key(); // get map key
value
- YCPValue evalue = i.value(); // get map
element value
+ YCPValue kvalue = i->first; // get map key
value
+ YCPValue evalue = i->second; // get map
element value
y2debug ("kvalue '%s', evalue '%s'",
kvalue->toString().c_str(), evalue->toString().c_str());
if (key_type->matchvalue (kvalue) < 0)
{

Modified: trunk/core/libycp/src/YCPBuiltinMap.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libycp/src/YCPBuiltinMap.cc?rev=54433&r1=54432&r2=54433&view=diff
==============================================================================
--- trunk/core/libycp/src/YCPBuiltinMap.cc (original)
+++ trunk/core/libycp/src/YCPBuiltinMap.cc Wed Jan 7 15:10:43 2009
@@ -95,10 +95,10 @@
SymbolEntryPtr k = key->asEntry()->entry();
SymbolEntryPtr v = value->asEntry()->entry();

- for (YCPMapIterator pos = map->begin (); pos != map->end (); ++pos)
+ for (YCPMap::const_iterator pos = map->begin(); pos != map->end(); ++pos)
{
- k->setValue (pos.key());
- v->setValue (pos.value());
+ k->setValue (pos->first);
+ v->setValue (pos->second);

YCPValue v = expr->evaluate ();

@@ -119,7 +119,7 @@
}
if (v->asBoolean ()->value ())
{
- ret->add (pos.key (), pos.value ());
+ ret->add(pos->first, pos->second);
}
}

@@ -164,10 +164,10 @@
SymbolEntryPtr k = key->asEntry()->entry();
SymbolEntryPtr v = value->asEntry()->entry();

- for (YCPMapIterator pos = map->begin (); pos != map->end (); ++pos)
+ for (YCPMap::const_iterator pos = map->begin (); pos != map->end (); ++pos)
{
- k->setValue (pos.key());
- v->setValue (pos.value());
+ k->setValue (pos->first);
+ v->setValue (pos->second);

YCPValue curr_value = expr->evaluate ();

@@ -179,8 +179,8 @@
}

expr_map = curr_value->asMap();
- YCPMapIterator it = expr_map->begin();
- ret->add (it.key(), it.value());
+ YCPMap::const_iterator it = expr_map->begin();
+ ret->add(it->first, it->second);
}
else
{
@@ -226,10 +226,10 @@
SymbolEntryPtr k = key->asEntry()->entry();
SymbolEntryPtr v = value->asEntry()->entry();

- for (YCPMapIterator pos = map->begin (); pos != map->end (); pos++)
+ for (YCPMap::const_iterator pos = map->begin(); pos != map->end(); ++pos)
{
- k->setValue (pos.key());
- v->setValue (pos.value());
+ k->setValue (pos->first);
+ v->setValue (pos->second);

YCPValue v = expr->evaluate();

@@ -279,9 +279,9 @@
{
YCPMap map = (m == 0 ? map1 : map2);

- for (YCPMapIterator pos = map->begin (); pos != map->end (); pos++)
+ for (YCPMap::const_iterator pos = map->begin(); pos != map->end();
++pos)
{
- newmap->add (pos.key (), pos.value ());
+ newmap->add(pos->first, pos->second);
}
}

@@ -438,10 +438,10 @@
SymbolEntryPtr v = val->asEntry()->entry();
YCPValue ret = YCPVoid();

- for (YCPMapIterator pos = map->begin(); pos != map->end(); ++pos)
+ for (YCPMap::const_iterator pos = map->begin(); pos != map->end(); ++pos)
{
- k->setValue (pos.key());
- v->setValue (pos.value());
+ k->setValue (pos->first);
+ v->setValue (pos->second);

ret = expr->evaluate ();
if (ret.isNull())

Modified: trunk/core/libycp/src/YCPMap.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libycp/src/YCPMap.cc?rev=54433&r1=54432&r2=54433&view=diff
==============================================================================
--- trunk/core/libycp/src/YCPMap.cc (original)
+++ trunk/core/libycp/src/YCPMap.cc Wed Jan 7 15:10:43 2009
@@ -88,9 +88,9 @@

YCPMap newmap;

- for (YCPMapIterator pos = begin(); pos != end(); ++pos )
+ for (YCPMap::const_iterator pos = begin(); pos != end(); ++pos)
{
- newmap->add( pos.key(), pos.value() );
+ newmap->add(pos->first, pos->second);
}

newmap->add( key, value );
@@ -115,8 +115,8 @@
{
YCPMapRep* newmap = new YCPMapRep ();

- for (YCPMapIterator pos = begin(); pos != end(); ++pos )
- newmap->add (pos.key(), pos.value());
+ for (YCPMap::const_iterator pos = begin(); pos != end(); ++pos)
+ newmap->add(pos->first, pos->second);

return newmap;
}
@@ -146,10 +146,12 @@
YCPValue
YCPMapRep::value(const YCPValue& key) const
{
- YCPMapIterator pos = stl_map.find( key );
+ YCPMap::const_iterator pos = stl_map.find(key);

- if ( pos != end() ) return pos.value();
- else return YCPNull();
+ if (pos != end())
+ return pos->second;
+ else
+ return YCPNull();
}


@@ -174,16 +176,16 @@
else
{
// equal length ==> pairwise comparison
- for( YCPMapIterator pos_this = begin(), pos_m = m->begin();
+ for( YCPMap::const_iterator pos_this = begin(), pos_m = m->begin();
pos_this != end(), pos_m != m->end();
++pos_this, ++pos_m )
{
// compare keys
- order = pos_this.key()->compare( pos_m.key() );
+ order = pos_this->first->compare(pos_m->first);
if ( order == YO_LESS || order == YO_GREATER ) return order;

// equal keys ==> compare values
- order = pos_this.value()->compare( pos_m.value() );
+ order = pos_this->second->compare(pos_m->second);
if ( order == YO_LESS || order == YO_GREATER ) return order;
}

@@ -200,12 +202,12 @@
{
string s = "$[";

- for(YCPMapIterator pos = begin(); pos != end(); ++pos )
+ for (YCPMap::const_iterator pos = begin(); pos != end(); ++pos)
{
if ( pos != begin() ) s += ", ";
- s += pos.key()->toString()
+ s += pos->first->toString()
+ ":"
- + ((pos.value().isNull()) ? "(null)" : pos.value()->toString());
+ + ((pos->second.isNull()) ? "(null)" : pos->second->toString());
}

return s + "]";
@@ -226,11 +228,11 @@
YCPMapRep::toStream (std::ostream & str) const
{
Bytecode::writeInt32 (str, stl_map.size());
- for(YCPMapIterator pos = begin(); pos != end(); ++pos )
+ for (YCPMap::const_iterator pos = begin(); pos != end(); ++pos)
{
- if (!Bytecode::writeValue (str, pos.key()))
+ if (!Bytecode::writeValue (str, pos->first))
break;
- if (!Bytecode::writeValue (str, pos.value()))
+ if (!Bytecode::writeValue (str, pos->second))
break;
}
return str;
@@ -241,11 +243,11 @@
YCPMapRep::toXml (std::ostream & str, int indent ) const
{
str << "<map size=\"" << stl_map.size() << "\">";
- for(YCPMapIterator pos = begin(); pos != end(); ++pos )
+ for (YCPMap::const_iterator pos = begin(); pos != end(); ++pos)
{
str << "<element>";
- str << "<key>"; pos.key()->toXml( str, 0 ); str << "</key>";
- str << "<value>"; pos.value()->toXml( str, 0 ); str << "</value>";
+ str << "<key>"; pos->first->toXml( str, 0 ); str << "</key>";
+ str << "<value>"; pos->second->toXml( str, 0 ); str << "</value>";
str << "</element>";
}
return str << "</map>";

Modified: trunk/core/libycp/src/YExpression.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libycp/src/YExpression.cc?rev=54433&r1=54432&r2=54433&view=diff
==============================================================================
--- trunk/core/libycp/src/YExpression.cc (original)
+++ trunk/core/libycp/src/YExpression.cc Wed Jan 7 15:10:43 2009
@@ -1116,13 +1116,13 @@

YCPMap map = value->asMap ();

- for (YCPMapIterator pos = map->begin (); pos != map->end (); pos++)
+ for (YCPMap::const_iterator pos = map->begin(); pos != map->end();
++pos)
{
- if (! canPropagate (pos.key (), key) )
+ if (! canPropagate (pos->first, key) )
{
return false;
}
- if (! canPropagate (pos.value (), elem) )
+ if (! canPropagate (pos->second, elem) )
{
return false;
}

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

< Previous Next >
This Thread
  • No further messages