diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2020-11-01 15:43:31 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2020-11-01 15:43:31 +0000 |
commit | 01b963dd311b37418722d2a1d0c685478ffea06c (patch) | |
tree | 89325f8e3c5868a04b8b63663457c33c9f7f3c49 | |
parent | Pass clang-tidy and cppcheck (diff) | |
download | slicer-01b963dd311b37418722d2a1d0c685478ffea06c.tar.bz2 slicer-01b963dd311b37418722d2a1d0c685478ffea06c.tar.xz slicer-01b963dd311b37418722d2a1d0c685478ffea06c.zip |
Wrap boost::posix_time string conversions
They're oddly big and inlined.
-rw-r--r-- | slicer/test/conversions.cpp | 14 | ||||
-rw-r--r-- | slicer/test/conversions.h | 4 | ||||
-rw-r--r-- | slicer/test/optionals.ice | 2 | ||||
-rw-r--r-- | slicer/test/types.ice | 4 |
4 files changed, 21 insertions, 3 deletions
diff --git a/slicer/test/conversions.cpp b/slicer/test/conversions.cpp index 8af0f0f..8b0f0ab 100644 --- a/slicer/test/conversions.cpp +++ b/slicer/test/conversions.cpp @@ -106,6 +106,20 @@ namespace Slicer { } return std::to_string(*i); } + + DLL_PUBLIC + std::string + ptimeToString(const boost::posix_time::ptime & pt) + { + return boost::posix_time::to_iso_extended_string(pt); + } + + DLL_PUBLIC + boost::posix_time::ptime + stringToPtime(const std::string & s) + { + return boost::posix_time::from_iso_string(s); + } } namespace TestModule { diff --git a/slicer/test/conversions.h b/slicer/test/conversions.h index dfb18d6..8bd376f 100644 --- a/slicer/test/conversions.h +++ b/slicer/test/conversions.h @@ -32,6 +32,10 @@ namespace Slicer { Ice::optional<Ice::Int> str2int(const std::string &); DLL_PUBLIC std::string int2str(const Ice::optional<Ice::Int> &); + DLL_PUBLIC + std::string ptimeToString(const boost::posix_time::ptime &); + DLL_PUBLIC + boost::posix_time::ptime stringToPtime(const std::string &); } #endif diff --git a/slicer/test/optionals.ice b/slicer/test/optionals.ice index c4c7436..7831cf6 100644 --- a/slicer/test/optionals.ice +++ b/slicer/test/optionals.ice @@ -12,7 +12,7 @@ module TestModule { optional(2) DateTimeContainer optClass; optional(3) Classes optSeq; optional(4) ClassMap optDict; - [ "slicer:conversion:boost.posix_time.ptime:boost.posix_time.to_iso_extended_string:boost.posix_time.time_from_string:nodeclare" ] + [ "slicer:conversion:boost.posix_time.ptime:ptimeToString:stringToPtime:nodeclare" ] optional(5) string optConverted; }; class Optionals2 { diff --git a/slicer/test/types.ice b/slicer/test/types.ice index a48f380..ac050b4 100644 --- a/slicer/test/types.ice +++ b/slicer/test/types.ice @@ -30,11 +30,11 @@ module TestModule2 { TestModule::Base base; }; class Conv { - [ "slicer:conversion:boost.posix_time.ptime:boost.posix_time.to_iso_extended_string:boost.posix_time.time_from_string:nodeclare" ] + [ "slicer:conversion:boost.posix_time.ptime:ptimeToString:stringToPtime:nodeclare" ] string conv; }; class MissingConv { - [ "slicer:conversion:boost.posix_time.ptime:boost.posix_time.to_iso_extended_string:boost.posix_time.time_from_string:nodeclare", + [ "slicer:conversion:boost.posix_time.ptime:ptimeToString:stringToPtime:nodeclare", "slicer:nodefaultconversion" ] string conv; }; |