Пример #1
0
InputField *InputFieldFactory::createField(const QString &name, const QString &typeName, bool isList)
{
    Schema::SimpleType::List simpleTypes = mTypes.simpleTypes();
    Schema::SimpleType::List::ConstIterator simpleIt;
    for(simpleIt = simpleTypes.begin(); simpleIt != simpleTypes.end(); ++simpleIt)
    {
        if((*simpleIt).name() == typeName)
        {
            if(isList)
                return new ListInputField(name, typeName, 0);
            else
                return new SimpleBaseInputField(name, &(*simpleIt));
        }
    }

    Schema::ComplexType::List complexTypes = mTypes.complexTypes();
    Schema::ComplexType::List::ConstIterator complexIt;
    for(complexIt = complexTypes.begin(); complexIt != complexTypes.end(); ++complexIt)
    {
        if((*complexIt).name() == typeName)
        {
            if(isList)
                return new ListInputField(name, typeName, 0);
            else
                return new ComplexBaseInputField(name, &(*complexIt));
        }
    }

    return createBasicField(name, typeName, 0, isList);
}
Пример #2
0
QString TypeMapper::type( const QString &typeName ) const
{
  // check basic types
  QMap<QString, TypeInfo>::ConstIterator it = mMap.find( typeName );
  if ( it != mMap.end() )
    return it.data().type;

  Schema::SimpleType::List simpleTypes = mTypes.simpleTypes();
  Schema::SimpleType::List::ConstIterator simpleIt;
  for ( simpleIt = simpleTypes.begin(); simpleIt != simpleTypes.end(); ++simpleIt ) {
    if ( (*simpleIt).name() == typeName ) {
      return type( &(*simpleIt) );
    }
  }

  Schema::ComplexType::List complexTypes = mTypes.complexTypes();
  Schema::ComplexType::List::ConstIterator complexIt;
  for ( complexIt = complexTypes.begin(); complexIt != complexTypes.end(); ++complexIt ) {
    if ( (*complexIt).name() == typeName ) {
      return type( &(*complexIt) );
    }
  }

  Schema::Element::List elements = mTypes.elements();
  Schema::Element::List::ConstIterator elemIt;
  for ( elemIt = elements.begin(); elemIt != elements.end(); ++elemIt ) {
    if ( (*elemIt).name() == typeName ) {
      return type( &(*elemIt) );
    }
  }

  return QString();
}
Пример #3
0
void Converter::convertTypes( const Schema::Types &types )
{
  Schema::SimpleType::List simpleTypes = types.simpleTypes();
  Schema::SimpleType::List::ConstIterator simpleIt;
  for ( simpleIt = simpleTypes.begin(); simpleIt != simpleTypes.end(); ++simpleIt )
    convertSimpleType( &(*simpleIt) );

  Schema::ComplexType::List complexTypes = types.complexTypes();
  Schema::ComplexType::List::ConstIterator complexIt;
  for ( complexIt = complexTypes.begin(); complexIt != complexTypes.end(); ++complexIt )
    convertComplexType( &(*complexIt) );
}