From: konrad Date: Sun, 8 Feb 2009 15:31:41 +0000 (+0000) Subject: preparations for woc integration X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=37baa668b3b99f2c8bf309bb4dd2c8d057d7a561;p=web%2Fkonrad%2Fsmoke.git preparations for woc integration git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@266 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- diff --git a/src/smoke.pro b/src/smoke.pro index 27f8108..83deff3 100644 --- a/src/smoke.pro +++ b/src/smoke.pro @@ -96,4 +96,6 @@ TRANSLATIONS = \ include(../zip/zip.pri) +include(wbase/wbase.pri) + LIBS += -lgmp diff --git a/src/wbase/nullable.h b/src/wbase/nullable.h new file mode 100644 index 0000000..7a802eb --- /dev/null +++ b/src/wbase/nullable.h @@ -0,0 +1,45 @@ +// +// C++ Interface: nullable +// +// Description: +// +// +// Author: Konrad Rosenbaum , (C) 2009 +// +// Copyright: See README/COPYING files that come with this distribution +// +// + + +#ifndef WOLF_NULLABLE_H +#define WOLF_NULLABLE_H + +templateclass Nullable +{ + public: + Nullable(){isnull=true;} + Nullable(const T&t){isnull=false;elem=t;} + Nullable(const Nullable&t){isnull=t.isnull;elem=t.elem;} + + Nullable& operator=(const T&t){isnull=false;elem=t;} + Nullable& operator=(const Nullable&t){isnull=t.isnull;elem=t.elem;} + + bool isNull()const{return isnull;} + + operator T()const{if(isnull)return T();else return elem;} + + T& value(){return elem;} + T value()const{if(isnull)return T();else return elem;} + private: + bool isnull; + T elem; +}; + +typedef Nullable Int; +typedef Nullable Int32; +typedef Nullable Int64; +typedef Nullable UInt32; +typedef Nullable UInt64; +typedef Nullable NString; + +#endif diff --git a/src/wbase/wbase.pri b/src/wbase/wbase.pri new file mode 100644 index 0000000..cb96ee1 --- /dev/null +++ b/src/wbase/wbase.pri @@ -0,0 +1 @@ +HEADERS += wbase/nullable.h