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); }
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(); }
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) ); }