X-Git-Url: https://git.mdrn.pl/wl-app.git/blobdiff_plain/53b27422d140022594fc241cca91c3183be57bca..48b2fe9f7c2dc3d9aeaaa6dbfb27c7da4f3235ff:/iOS/Pods/Realm/include/core/realm/column_type_traits.hpp diff --git a/iOS/Pods/Realm/include/core/realm/column_type_traits.hpp b/iOS/Pods/Realm/include/core/realm/column_type_traits.hpp new file mode 100644 index 0000000..39a3208 --- /dev/null +++ b/iOS/Pods/Realm/include/core/realm/column_type_traits.hpp @@ -0,0 +1,160 @@ +/************************************************************************* + * + * Copyright 2016 Realm Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + **************************************************************************/ + +#ifndef REALM_COLUMN_TYPE_TRAITS_HPP +#define REALM_COLUMN_TYPE_TRAITS_HPP + +#include +#include +#include +#include + +namespace realm { + +class OldDateTime; +class ArrayBinary; +class ArrayInteger; +class ArrayIntNull; +template +class BasicArray; + +template +struct ColumnTypeTraits; + +template <> +struct ColumnTypeTraits { + using column_type = Column; + using leaf_type = ArrayInteger; + using sum_type = int64_t; + using minmax_type = int64_t; + static const DataType id = type_Int; + static const ColumnType column_id = col_type_Int; + static const ColumnType real_column_type = col_type_Int; +}; + +template <> +struct ColumnTypeTraits> { + using column_type = Column>; + using leaf_type = ArrayIntNull; + using sum_type = int64_t; + using minmax_type = int64_t; + static const DataType id = type_Int; + static const ColumnType column_id = col_type_Int; + static const ColumnType real_column_type = col_type_Int; +}; + +template <> +struct ColumnTypeTraits : ColumnTypeTraits { + static const DataType id = type_Bool; + static const ColumnType column_id = col_type_Bool; +}; + +template <> +struct ColumnTypeTraits> : ColumnTypeTraits> { + static const DataType id = type_Bool; + static const ColumnType column_id = col_type_Bool; +}; + +template <> +struct ColumnTypeTraits { + using column_type = FloatColumn; + using leaf_type = BasicArray; + using sum_type = double; + using minmax_type = float; + static const DataType id = type_Float; + static const ColumnType column_id = col_type_Float; + static const ColumnType real_column_type = col_type_Float; +}; + +template <> +struct ColumnTypeTraits { + using column_type = DoubleColumn; + using leaf_type = BasicArray; + using sum_type = double; + using minmax_type = double; + static const DataType id = type_Double; + static const ColumnType column_id = col_type_Double; + static const ColumnType real_column_type = col_type_Double; +}; + +template <> +struct ColumnTypeTraits : ColumnTypeTraits { + static const DataType id = type_OldDateTime; + static const ColumnType column_id = col_type_OldDateTime; +}; + +template <> +struct ColumnTypeTraits> : ColumnTypeTraits> { + static const DataType id = type_OldDateTime; + static const ColumnType column_id = col_type_OldDateTime; +}; + +template <> +struct ColumnTypeTraits { + static const DataType id = type_String; + static const ColumnType column_id = col_type_String; +}; + +template <> +struct ColumnTypeTraits { + using column_type = BinaryColumn; + using leaf_type = ArrayBinary; + static const DataType id = type_Binary; + static const ColumnType column_id = col_type_Binary; + static const ColumnType real_column_type = col_type_Binary; +}; + +template +struct GetColumnType; +template <> +struct GetColumnType { + using type = IntegerColumn; +}; +template <> +struct GetColumnType { + using type = IntNullColumn; +}; +template +struct GetColumnType { + // FIXME: Null definition + using type = FloatColumn; +}; +template +struct GetColumnType { + // FIXME: Null definition + using type = DoubleColumn; +}; + +// Only purpose is to return 'double' if and only if source column (T) is float and you're doing a sum (A) +template +struct ColumnTypeTraitsSum { + typedef T sum_type; +}; + +template <> +struct ColumnTypeTraitsSum { + typedef double sum_type; +}; + +template +struct ColumnTypeTraitsSum, A> { + using sum_type = int64_t; +}; +} + +#endif // REALM_COLUMN_TYPE_TRAITS_HPP