aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2016-01-07 18:07:54 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2016-02-05 13:25:43 +0100
commit7e7a261de0751bf2361e86761c7eb9fa7dbcdf9a (patch)
treec72ecd01719a3944da407e8f8281a5754fa3e228
parenta47aaa4e7a833ab7ae3a2b995dd533f2402751b1 (diff)
edge: Remove int casting operator from GprsCodingScheme
This convenience operator rather hide implementation bugs and is thus removed. Sponsored-by: On-Waves ehf
-rw-r--r--src/gprs_coding_scheme.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gprs_coding_scheme.h b/src/gprs_coding_scheme.h
index f02ca51..c26d12a 100644
--- a/src/gprs_coding_scheme.h
+++ b/src/gprs_coding_scheme.h
@@ -52,7 +52,6 @@ public:
GprsCodingScheme(Scheme s = UNKNOWN);
operator bool() const {return m_scheme != UNKNOWN;}
- operator int() const {return (int)m_scheme;}
operator Scheme() const {return m_scheme;}
unsigned int to_num() const;
@@ -89,6 +88,8 @@ public:
static const char *modeName(Mode mode);
private:
+ GprsCodingScheme(int s); /* fail on use */
+ GprsCodingScheme& operator =(int s); /* fail on use */
enum Scheme m_scheme;
};
@@ -166,7 +167,7 @@ inline GprsCodingScheme GprsCodingScheme::getEgprsByNum(unsigned num)
/* The coding schemes form a partial ordering */
inline bool operator ==(GprsCodingScheme a, GprsCodingScheme b)
{
- return int(a) == int(b);
+ return GprsCodingScheme::Scheme(a) == GprsCodingScheme::Scheme(b);
}
inline bool operator !=(GprsCodingScheme a, GprsCodingScheme b)
@@ -176,12 +177,13 @@ inline bool operator !=(GprsCodingScheme a, GprsCodingScheme b)
inline bool operator <(GprsCodingScheme a, GprsCodingScheme b)
{
- return a.isCompatible(b) && int(a) < int(b);
+ return a.isCompatible(b) &&
+ GprsCodingScheme::Scheme(a) < GprsCodingScheme::Scheme(b);
}
inline bool operator >(GprsCodingScheme a, GprsCodingScheme b)
{
- return a.isCompatible(b) && int(a) > int(b);
+ return b < a;
}
inline bool operator <=(GprsCodingScheme a, GprsCodingScheme b)