[zypp-devel] Use typedefs - looking up the concrete type is the compilers job....
Example: ByteCount size(str::strtonum<long long>(reader_r->getAttribute("installed").asString()), Unit()); _package->size = size; 1) Class ByteCount typedefs the SizeType. So do not convert to a long long, assuming this is 'big' enough. Use the appropriate type: str::strtonumByteCount::SizeType( .... ) This should be always right. Looking up the concrete type is the compilers job. (If a typedef is missing, ask for it or simply introduce it) _package->size = str::strtonumByteCount::SizeType( reader_r->getAttribute("installed").asString() ); 2) ByteCount's default unit is byte. So you can simply write ByteCount size( str::strtonumByteCount::SizeType( ... ) ); If you want to state the unit explicitly, use the unit constants ByteCount defines for that purpose: B K M G T kB MB GB TB. ByteCount size( ...., ByteCount::B ); ByteCount::K.factor() == 1024 ByteCount::kB.factor() == 1000 -- cu, Michael Andres +------------------------------------------------------------------+ Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4 +------------------------------------------------------------------+ Michael Andres YaST Development ma@novell.com SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0 +------------------------------------------------------------------+ -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
participants (1)
-
Michael Andres