/*!
    Returns the connection types associated with a signal or slot \a member
    specification.  The array of types is returned from this function,
    and the number of arguments is returned in \a nargs.  Returns null
    if \a member is invalid.  The return value must be freed with qFree().
*/
int *QSignalIntercepter::connectionTypes( const QByteArray& member, int& nargs )
{
    // Based on Qt's internal queuedConnectionTypes function.
    nargs = 0;
    int *types = 0;
    const char *s = member.constData();
    while (*s != '\0' && *s != '(') { ++s; }
    if ( *s == '\0' )
        return 0;
    ++s;
    const char *e = s;
    while (*e != ')') {
        ++e;
        if (*e == ')' || *e == ',')
            ++nargs;
    }

    types = (int *) qMalloc((nargs+1)*sizeof(int));
    types[nargs] = 0;
    for (int n = 0; n < nargs; ++n) {
        e = s;
        while (*s != ',' && *s != ')')
            ++s;
        QByteArray type(e, s-e);
        ++s;

        types[n] = typeFromName(type);
        if (!types[n]) {
            qWarning("QSignalIntercepter::connectionTypes: Cannot marshal arguments of type '%s'", type.data());
            qFree(types);
            return 0;
        }
    }
    return types;
}
ParameterList::ParameterList(Miro::CFG::Parameter const& _param,
			     QDomNode const& _node,
			     QListView * _list,
			     QListViewItem * _pre,
			     QObject * _parent, const char * _name) :
  Super(_node, _list, _pre, _parent, _name),
  param_(_param),
  type_(typeFromName(_param.type_))
{
  MIRO_ASSERT(type_ != NONE);

  if (listViewItem()->listView()->columns() == 2)
    listViewItem()->setText(2, param_.type_);


  // get the nested parameter type
  int len = param_.type_.length();
  int vlen = (type_ == VECTOR)? 
    QString("std::vector<").length() :
    QString("std::set<").length();
  len --; // tailing >
  len -= vlen;
  nestedTypeName_ = param_.type_.mid(vlen, len);
}