MCPcopy Create free account
hub / github.com/ImageEngine/cortex / load

Method load

src/IECore/DateTimeData.cpp:75–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73/// Here we specialise the TypedData::load() method to correctly load the data produced by save().
74template<>
75void DateTimeData::load( LoadContextPtr context )
76{
77 Data::load( context );
78 const IndexedIO *container = context->rawContainer();
79
80 std::string t;
81 container->read( g_valueEntry, t );
82
83 try
84 {
85 writable() = boost::posix_time::from_iso_string( t );
86 }
87 catch( const boost::bad_lexical_cast & )
88 {
89 /// Do these checks here instead of first as they're likely to be the least-used cases.
90 if ( t == "not-a-date-time" )
91 {
92 writable() = boost::posix_time::not_a_date_time;
93 }
94 else if ( t == "+infinity" )
95 {
96 writable() = boost::posix_time::pos_infin;
97 }
98 else if ( t == "-infinity" )
99 {
100 writable() = boost::posix_time::neg_infin;
101 }
102 else
103 {
104 throw;
105 }
106 }
107}
108
109template class TypedData< boost::posix_time::ptime >;
110

Callers

nothing calls this directly

Calls 2

rawContainerMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected