00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __libutilxx__sella__variant__Nullable_H__
00010 #define __libutilxx__sella__variant__Nullable_H__
00011
00012 #include "../../common.h"
00013 #include "TypeCastException.h"
00014 #include "UnsupportedOperatorException.h"
00015
00016 #include <stdlib.h>
00017 #include <stdint.h>
00018
00019 #include <boost/regex.hpp>
00020
00021 #include <memory>
00022 #include <vector>
00023
00024 namespace sella {
00025 namespace variant {
00026 class Nullable;
00027 }
00028 }
00029
00030 class sella::variant::Nullable {
00031 public:
00032 static const int Type = 0x00;
00033
00034 public:
00035
00036 Nullable() throw ();
00037 Nullable(std::shared_ptr<void> value) throw ();
00038
00039 Nullable(const Nullable &other) throw ();
00040 virtual ~Nullable() throw ();
00041
00042
00043 Nullable& operator=(const Nullable &other) throw ();
00044
00045
00046 virtual const std::shared_ptr<void> get() const throw ();
00047 virtual std::shared_ptr<void> get() throw ();
00048 virtual void shrink_to_fit() throw ();
00049 virtual const std::string& str() const throw () = 0;
00050 virtual const char* c_str() const throw ();
00051
00052 bool isNull() const throw ();
00053
00054 protected:
00055 std::vector<std::string> tokenize(const std::string &value, const boost::regex &pattern) const throw (TypeCastException);
00056
00057 std::shared_ptr<void> value;
00058 mutable std::string cache;
00059 };
00060
00061 #endif
00062
00063
00064
00065