Now also expand intList
parent
11ab035380
commit
1292d324ff
|
|
@ -47,15 +47,17 @@ namespace fs = boost::filesystem;
|
|||
// If a number of template arguments were given, generate a number of expanded
|
||||
// class names, e.g., PriorFactor -> PriorFactorPose2, and add those classes
|
||||
static void handle_possible_template(vector<Class>& classes, const Class& cls,
|
||||
const vector<Qualified>& instantiations) {
|
||||
if (cls.templateArgs.empty() || instantiations.empty()) {
|
||||
const Template& t) {
|
||||
if (cls.templateArgs.empty() || t.empty()) {
|
||||
classes.push_back(cls);
|
||||
} else {
|
||||
if (cls.templateArgs.size() != 1)
|
||||
throw std::runtime_error(
|
||||
"In-line template instantiations only handle a single template argument");
|
||||
vector<Class> classInstantiations = //
|
||||
cls.expandTemplate(cls.templateArgs.front(), instantiations);
|
||||
string arg = cls.templateArgs.front();
|
||||
vector<Class> classInstantiations =
|
||||
(t.nrValues() > 0) ? cls.expandTemplate(arg, t.argValues()) :
|
||||
cls.expandTemplate(arg, t.intList());
|
||||
BOOST_FOREACH(const Class& c, classInstantiations)
|
||||
classes.push_back(c);
|
||||
}
|
||||
|
|
@ -107,7 +109,7 @@ void Module::parseMarkup(const std::string& data) {
|
|||
Rule class_p = class_g //
|
||||
[assign_a(cls.namespaces_, namespaces)]
|
||||
[bl::bind(&handle_possible_template, bl::var(classes), bl::var(cls),
|
||||
bl::var(classTemplate.argValues()))]
|
||||
bl::var(classTemplate))]
|
||||
[clear_a(classTemplate)] //
|
||||
[assign_a(cls,cls0)];
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,9 @@ public:
|
|||
const std::vector<Qualified>& argValues() const {
|
||||
return argValues_;
|
||||
}
|
||||
bool empty() const {
|
||||
return argValues_.empty() && intList_.empty();
|
||||
}
|
||||
size_t nrValues() const {
|
||||
return argValues_.size();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue