00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00027 #ifndef SHVARIANTFACTORY_HPP
00028 #define SHVARIANTFACTORY_HPP
00029
00030 #include <string>
00031 #include "ShDllExport.hpp"
00032 #include "ShRefCount.hpp"
00033 #include "ShTypeInfo.hpp"
00034
00035 namespace SH {
00036
00037 struct ShVariant;
00038
00039 struct
00040 SH_DLLEXPORT
00041 ShVariantFactory {
00042 virtual ~ShVariantFactory() {}
00043
00045 virtual ShVariant* generate(int N) const = 0;
00046
00048
00049
00050 virtual ShVariant* generate(std::string s) const = 0;
00051
00055
00056 virtual ShVariant* generate(void *data, int N, bool managed = true) const = 0;
00057
00059 virtual ShVariant* generateZero(int N = 1) const = 0;
00060
00062 virtual ShVariant* generateOne(int N = 1) const = 0;
00063 };
00064
00065 template<typename T, ShDataType DT>
00066 struct ShDataVariantFactory: public ShVariantFactory {
00067 ShVariant* generate(int N) const;
00068
00069 ShVariant* generate(std::string s) const;
00070
00071 ShVariant* generate(void *data, int N, bool managed = true) const;
00072
00073 ShVariant* generateZero(int N = 1) const;
00074 ShVariant* generateOne(int N = 1) const;
00075
00076 static const ShDataVariantFactory* instance();
00077
00078 protected:
00079 static ShDataVariantFactory *m_instance;
00080
00081 ShDataVariantFactory();
00082 };
00083
00084
00085 }
00086
00087 #include "ShVariantFactoryImpl.hpp"
00088
00089 #endif