git.stg.codes
/
stg.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e560693
)
Ticket. InToTraffType() function declaration and definition added.
author
Elena Mamontova
<helenh463@gmail.com>
Sun, 17 Jul 2016 16:48:24 +0000
(19:48 +0300)
committer
Elena Mamontova
<helenh463@gmail.com>
Sun, 17 Jul 2016 16:48:24 +0000
(19:48 +0300)
include/stg/tariff.h
patch
|
blob
|
history
diff --git
a/include/stg/tariff.h
b/include/stg/tariff.h
index 1b6413b302f3c56417d32683d530850dcc6eb5f9..5d01cba08886be4087aced98c1305b072e16ef05 100644
(file)
--- a/
include/stg/tariff.h
+++ b/
include/stg/tariff.h
@@
-41,6
+41,7
@@
public:
static std::string TraffTypeToString(TRAFF_TYPE type);
static TRAFF_TYPE StringToTraffType(const std::string& value);
+ static TRAFF_TYPE IntToTraffType(int value);
virtual ~TARIFF() {}
virtual double GetPriceWithTraffType(uint64_t up,
@@
-117,4
+118,12
@@
std::istream & operator>>(std::istream & stream, TARIFF::TRAFF_TYPE & traffType)
return stream;
}
+inline
+TARIFF::TRAFF_TYPE TARIFF::IntToTraffType(int value)
+{
+ if (value < 0 || value > TRAFF_MAX)
+ return TRAFF_UP_DOWN;
+ return static_cast<TRAFF_TYPE>(value);
+}
+
#endif