aboutsummaryrefslogtreecommitdiff
path: root/xsde/cxx/hybrid/serializer-name-processor.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'xsde/cxx/hybrid/serializer-name-processor.cxx')
-rw-r--r--xsde/cxx/hybrid/serializer-name-processor.cxx33
1 files changed, 31 insertions, 2 deletions
diff --git a/xsde/cxx/hybrid/serializer-name-processor.cxx b/xsde/cxx/hybrid/serializer-name-processor.cxx
index 784a2af..63d64b6 100644
--- a/xsde/cxx/hybrid/serializer-name-processor.cxx
+++ b/xsde/cxx/hybrid/serializer-name-processor.cxx
@@ -25,6 +25,8 @@ namespace CXX
//
typedef Cult::Containers::Set<String> NameSet;
+ struct Failed {};
+
class Context: public CXX::Context
{
public:
@@ -502,6 +504,7 @@ namespace CXX
// See if this serializer is being customized.
//
+ Boolean custom (false);
CustomSerializerMap::ConstIterator i (
custom_serializer_map.find (name));
@@ -511,10 +514,28 @@ namespace CXX
? find_name (i->second.base, set_)
: i->second.base);
+ custom = i->second.base.empty ();
+
if (i->second.include)
tc.set ("s:impl-include", i->second.include);
}
+ // If this type is completely customized then we cannot generate
+ // a serializer implementation for it.
+ //
+ if (!custom && tc.count ("name-base") && !tc.get<String> ("name-base"))
+ {
+ os << t.file () << ":" << t.line () << ":" << t.column ()
+ << ": error: unable to generate serializer implementation for "
+ << "customized object model type '" << t.name () << "'" << endl;
+
+ os << t.file () << ":" << t.line () << ":" << t.column ()
+ << ": info: provide custom serializer implementation for this "
+ << "type with the --custom-serializer option" << endl;
+
+ throw Failed ();
+ }
+
if (aggregate)
{
typedef Cult::Containers::Vector<NarrowString> Names;
@@ -780,13 +801,21 @@ namespace CXX
}
}
- Void SerializerNameProcessor::
+ Boolean SerializerNameProcessor::
process (CLI::Options const& ops,
SemanticGraph::Schema& tu,
SemanticGraph::Path const& file,
Boolean deep)
{
- process_impl (ops, tu, file, deep);
+ try
+ {
+ process_impl (ops, tu, file, deep);
+ return true;
+ }
+ catch (Failed const&)
+ {
+ return false;
+ }
}
}
}