Mailinglist Archive: zypp-commit (232 mails)

< Previous Next >
[zypp-commit] <libzypp> master : ByteCount: add KiB,..,TiB units (same as K,...T)
  • From: Michael Andres <ma@xxxxxxx>
  • Date: Thu, 26 Nov 2009 16:50:30 +0100
  • Message-id: <E1NDgc6-0002uO-0J@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit 9d2b8ae9b409d20f93240fde9e7a76c6c3895962
Author: Michael Andres <ma@xxxxxxx>
Date: Thu Nov 26 16:50:30 2009 +0100

ByteCount: add KiB,..,TiB units (same as K,...T)
---
zypp/ByteCount.cc | 5 +++++
zypp/ByteCount.h | 8 +++++++-
2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/zypp/ByteCount.cc b/zypp/ByteCount.cc
index 138693f..bae1e7d 100644
--- a/zypp/ByteCount.cc
+++ b/zypp/ByteCount.cc
@@ -20,10 +20,15 @@ namespace zypp
{ /////////////////////////////////////////////////////////////////

const ByteCount::Unit ByteCount::B( 1LL, "B", 0 );
+
const ByteCount::Unit ByteCount::K( 1024LL, "KiB", 1 );
+ const ByteCount::Unit ByteCount::KiB( K );
const ByteCount::Unit ByteCount::M( 1048576LL, "MiB", 1 );
+ const ByteCount::Unit ByteCount::MiB( M );
const ByteCount::Unit ByteCount::G( 1073741824LL, "GiB", 2 );
+ const ByteCount::Unit ByteCount::GiB( G );
const ByteCount::Unit ByteCount::T( 1099511627776LL, "TiB", 3 );
+ const ByteCount::Unit ByteCount::TiB( T );

const ByteCount::Unit ByteCount::kB( 1000LL, "kB", 1 );
const ByteCount::Unit ByteCount::MB( 1000000LL, "MB", 1 );
diff --git a/zypp/ByteCount.h b/zypp/ByteCount.h
index 753ff9c..657c5f5 100644
--- a/zypp/ByteCount.h
+++ b/zypp/ByteCount.h
@@ -40,14 +40,20 @@ namespace zypp
//@{
/** 1 Byte */
static const Unit B;
+
/** 1024 Byte */
static const Unit K;
+ static const Unit KiB;
/** 1024^2 Byte */
static const Unit M;
+ static const Unit MiB;
/** 1024^3 Byte */
static const Unit G;
+ static const Unit GiB;
/** 1024^4 Byte */
static const Unit T;
+ static const Unit TiB;
+
/** 1000 Byte */
static const Unit kB;
/** 1000^2 Byte */
@@ -73,7 +79,7 @@ namespace zypp
: _count( count_r * unit_r.factor() )
{}

- public:
+ public:

/** Conversion to SizeType. */
operator SizeType() const
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages