X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fstlplus%2Fpersistence%2Fpersistent_bool.cpp;fp=src%2Fstlplus%2Fpersistence%2Fpersistent_bool.cpp;h=dde1828120fc933e3f7e9604b02976ccefa4bc60;hb=6b0a0d0efafe34d48ab344fca3b479553bd4e62c;hp=0000000000000000000000000000000000000000;hpb=85783316365181491a3e3c0c63659972477cebba;p=chaz%2Fyoink diff --git a/src/stlplus/persistence/persistent_bool.cpp b/src/stlplus/persistence/persistent_bool.cpp new file mode 100644 index 0000000..dde1828 --- /dev/null +++ b/src/stlplus/persistence/persistent_bool.cpp @@ -0,0 +1,24 @@ +//////////////////////////////////////////////////////////////////////////////// + +// Author: Andy Rushton +// Copyright: (c) Southampton University 1999-2004 +// (c) Andy Rushton 2004-2009 +// License: BSD License, see ../docs/license.html + +//////////////////////////////////////////////////////////////////////////////// +#include "persistent_bool.hpp" + +//////////////////////////////////////////////////////////////////////////////// + +// bool is dumped and restored as an unsigned char +void stlplus::dump_bool(stlplus::dump_context& context, const bool& data) throw(stlplus::persistent_dump_failed) +{ + context.put((unsigned char)data); +} + +void stlplus::restore_bool(restore_context& context, bool& data) throw(stlplus::persistent_restore_failed) +{ + data = context.get() != 0; +} + +////////////////////////////////////////////////////////////////////////////////