diff options
Diffstat (limited to 'odb/context.hxx')
-rw-r--r-- | odb/context.hxx | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/odb/context.hxx b/odb/context.hxx index ac83736..b8a33c5 100644 --- a/odb/context.hxx +++ b/odb/context.hxx @@ -32,15 +32,33 @@ public: typedef std::string string; typedef ::options options_type; - // Database names and types. + // Predicates. // public: - // Cleaned-up member name that can be used in public interfaces - // such as queries, column names, etc. + + // Composite value type is a class type that was explicitly marked + // as value type and there was no SQL type mapping provided for it + // by the user (specifying the SQL type makes the value type simple). // - string - public_name (semantics::data_member&) const; + static bool + comp_value (semantics::class_& c) + { + return c.count ("value") && !c.count ("type"); + } + // Return the class object if this type is a composite value type + // and NULL otherwise. + // + static semantics::class_* + comp_value (semantics::type& t) + { + semantics::class_* c (dynamic_cast<semantics::class_*> (&t)); + return c != 0 && t.count ("value") && !t.count ("type") ? c : 0; + } + + // Database names and types. + // +public: string table_name (semantics::type&) const; @@ -50,12 +68,25 @@ public: virtual string column_type (semantics::data_member&) const; + // C++ names. + // public: + // Cleaned-up member name that can be used in public interfaces. + // + string + public_name (semantics::data_member&) const; + // Escape C++ keywords, reserved names, and illegal characters. // string escape (string const&) const; + // Counts and other information. + // +public: + static size_t + column_count (semantics::class_&); + protected: struct data; typedef cutl::shared_ptr<data> data_ptr; |