summaryrefslogtreecommitdiff
path: root/datetime.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2006-02-15 20:10:49 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:41:21 -0400
commitce3491c99f089874725999ca6d8b1fb6a15c9e5e (patch)
treec48a2bf19a954c8103a02e26f9a1a490b8095268 /datetime.cc
parent2eafddc91b8d7f0b7bdfd991acdc9e0b2295e304 (diff)
downloadfork-ledger-ce3491c99f089874725999ca6d8b1fb6a15c9e5e.tar.gz
fork-ledger-ce3491c99f089874725999ca6d8b1fb6a15c9e5e.tar.bz2
fork-ledger-ce3491c99f089874725999ca6d8b1fb6a15c9e5e.zip
Removed Python integration support.
Diffstat (limited to 'datetime.cc')
-rw-r--r--datetime.cc79
1 files changed, 0 insertions, 79 deletions
diff --git a/datetime.cc b/datetime.cc
index 07d19624..e26ddf98 100644
--- a/datetime.cc
+++ b/datetime.cc
@@ -373,82 +373,3 @@ bool quick_parse_date(const char * date_str, std::time_t * result)
}
} // namespace ledger
-
-#ifdef USE_BOOST_PYTHON
-
-#include <boost/python.hpp>
-
-using namespace boost::python;
-using namespace ledger;
-
-unsigned int interval_len(interval_t& interval)
-{
- int periods = 1;
- std::time_t when = interval.first();
- while (interval.end && when < interval.end) {
- when = interval.increment(when);
- if (when < interval.end)
- periods++;
- }
- return periods;
-}
-
-std::time_t interval_getitem(interval_t& interval, int i)
-{
- static std::time_t last_index = 0;
- static std::time_t last_moment = 0;
-
- if (i == 0) {
- last_index = 0;
- last_moment = interval.first();
- }
- else {
- last_moment = interval.increment(last_moment);
- if (interval.end && last_moment >= interval.end) {
- PyErr_SetString(PyExc_IndexError, "Index out of range");
- throw_error_already_set();
- }
- }
- return last_moment;
-}
-
-std::time_t py_parse_date(const char * date_str)
-{
- std::time_t temp;
- if (parse_date(date_str, &temp))
- return temp;
- return 0;
-}
-
-std::time_t py_parse_date_yr(const char * date_str, const int year)
-{
- std::time_t temp;
- if (parse_date(date_str, &temp, year))
- return temp;
- return 0;
-}
-
-void export_datetime()
-{
- class_< interval_t >
- ("Interval", init<optional<int, int, int, std::time_t, std::time_t> >())
- .def(init<std::string>())
- .def(! self)
-
- .def_readwrite("years", &interval_t::years)
- .def_readwrite("months", &interval_t::months)
- .def_readwrite("seconds", &interval_t::seconds)
- .def_readwrite("begin", &interval_t::begin)
- .def_readwrite("end", &interval_t::end)
-
- .def("__len__", interval_len)
- .def("__getitem__", interval_getitem)
-
- .def("increment", &interval_t::increment)
- ;
-
- def("parse_date", py_parse_date);
- def("parse_date", py_parse_date_yr);
-}
-
-#endif // USE_BOOST_PYTHON