123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- #ifndef REALM_UTIL_SERIALIZER_HPP
- #define REALM_UTIL_SERIALIZER_HPP
- #include <realm/table_ref.hpp>
- #include <realm/util/optional.hpp>
- #include <string>
- #include <sstream>
- #include <vector>
- namespace realm {
- class BinaryData;
- struct ColKey;
- struct null;
- class ObjectId;
- struct ObjKey;
- struct ObjLink;
- class StringData;
- class Timestamp;
- class LinkMap;
- class UUID;
- class TypeOfValue;
- enum class ExpressionComparisonType : unsigned char;
- namespace util {
- namespace serializer {
- template <typename T>
- std::string print_value(T value);
- template <typename T>
- std::string print_value(Optional<T> value);
- const static std::string value_separator = ".";
- template <> std::string print_value<>(BinaryData);
- template <> std::string print_value<>(bool);
- template <>
- std::string print_value<>(float);
- template <>
- std::string print_value<>(double);
- template <> std::string print_value<>(realm::null);
- template <> std::string print_value<>(StringData);
- template <> std::string print_value<>(realm::Timestamp);
- template <>
- std::string print_value<>(realm::ObjectId);
- template <>
- std::string print_value<>(realm::ObjKey);
- template <>
- std::string print_value<>(realm::ObjLink);
- template <>
- std::string print_value<>(realm::UUID);
- template <>
- std::string print_value<>(realm::TypeOfValue);
- template <typename T>
- std::string print_value(T value)
- {
- std::stringstream ss;
- ss << value;
- return ss.str();
- }
- template <typename T>
- std::string print_value(Optional<T> value)
- {
- if (bool(value)) {
- return print_value(*value);
- } else {
- return "NULL";
- }
- }
- StringData get_printable_table_name(StringData name, const std::string& prefix);
- struct SerialisationState {
- SerialisationState(const std::string& prefix)
- : class_prefix(prefix)
- {
- }
- std::string describe_column(ConstTableRef table, ColKey col_key);
- std::string describe_columns(const LinkMap& link_map, ColKey target_col_key);
- std::string describe_expression_type(ExpressionComparisonType type);
- std::string get_column_name(ConstTableRef table, ColKey col_key);
- std::string get_backlink_column_name(ConstTableRef from, ColKey col_key);
- std::string get_variable_name(ConstTableRef table);
- std::vector<std::string> subquery_prefix_list;
- std::string class_prefix;
- };
- }
- }
- }
- #endif
|