本文整理汇总了C++中QUrl::allQueryItemValues方法的典型用法代码示例。如果您正苦于以下问题:C++ QUrl::allQueryItemValues方法的具体用法?C++ QUrl::allQueryItemValues怎么用?C++ QUrl::allQueryItemValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QUrl
的用法示例。
在下文中一共展示了QUrl::allQueryItemValues方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: allQueryItemValues
QStringList QUrlProto::allQueryItemValues(const QString &key) const
{
QUrl *item = qscriptvalue_cast<QUrl*>(thisObject());
if (item)
return item->allQueryItemValues(key);
return QStringList();
}
示例2: allQueryItemValues
int Url::allQueryItemValues ( lua_State * L )// ( const QString & key ) const : QStringList
{
QUrl* lhs = ValueInstaller2<QUrl>::check( L, 1 );
//QString* key = ValueInstaller2<QString>::check( L, 2 );
QStringList* res = ValueInstaller2<QStringList>::create( L );
*res = lhs->allQueryItemValues( Util::toString( L, 2 ) );
return 1;
}
示例3: if
QgsMemoryProvider::QgsMemoryProvider( QString uri )
: QgsVectorDataProvider( uri )
, mSpatialIndex( 0 )
{
// Initialize the geometry with the uri to support old style uri's
// (ie, just 'point', 'line', 'polygon')
QUrl url = QUrl::fromEncoded( uri.toUtf8() );
QString geometry;
if ( url.hasQueryItem( "geometry" ) )
{
geometry = url.queryItemValue( "geometry" );
}
else
{
geometry = url.path();
}
geometry = geometry.toLower();
if ( geometry == "point" )
mWkbType = QGis::WKBPoint;
else if ( geometry == "linestring" )
mWkbType = QGis::WKBLineString;
else if ( geometry == "polygon" )
mWkbType = QGis::WKBPolygon;
else if ( geometry == "multipoint" )
mWkbType = QGis::WKBMultiPoint;
else if ( geometry == "multilinestring" )
mWkbType = QGis::WKBMultiLineString;
else if ( geometry == "multipolygon" )
mWkbType = QGis::WKBMultiPolygon;
else
mWkbType = QGis::WKBUnknown;
if ( url.hasQueryItem( "crs" ) )
{
QString crsDef = url.queryItemValue( "crs" );
mCrs.createFromString( crsDef );
}
mNextFeatureId = 1;
mNativeTypes
<< QgsVectorDataProvider::NativeType( tr( "Whole number (integer)" ), "integer", QVariant::Int, 0, 10 )
// Decimal number from OGR/Shapefile/dbf may come with length up to 32 and
// precision up to length-2 = 30 (default, if width is not specified in dbf is length = 24 precision = 15)
// We know that double (QVariant::Double) has only 15-16 significant numbers,
// but setting that correct limits would disable the use of memory provider with
// data from Shapefiles. In any case, the data are handled as doubles.
// So the limits set here are not correct but enable use of data from Shapefiles.
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (real)" ), "double", QVariant::Double, 0, 32, 0, 30 )
<< QgsVectorDataProvider::NativeType( tr( "Text (string)" ), "string", QVariant::String, 0, 255 )
// date type
<< QgsVectorDataProvider::NativeType( tr( "Date" ), "date", QVariant::Date, -1, -1, -1, -1 )
// integer types
<< QgsVectorDataProvider::NativeType( tr( "Whole number (smallint - 16bit)" ), "int2", QVariant::Int, -1, -1, 0, 0 )
<< QgsVectorDataProvider::NativeType( tr( "Whole number (integer - 32bit)" ), "int4", QVariant::Int, -1, -1, 0, 0 )
<< QgsVectorDataProvider::NativeType( tr( "Whole number (integer - 64bit)" ), "int8", QVariant::LongLong, -1, -1, 0, 0 )
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (numeric)" ), "numeric", QVariant::Double, 1, 20, 0, 20 )
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (decimal)" ), "decimal", QVariant::Double, 1, 20, 0, 20 )
// floating point
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (real)" ), "real", QVariant::Double, -1, -1, -1, -1 )
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (double)" ), "double precision", QVariant::Double, -1, -1, -1, -1 )
// string types
<< QgsVectorDataProvider::NativeType( tr( "Text, unlimited length (text)" ), "text", QVariant::String, -1, -1, -1, -1 )
;
if ( url.hasQueryItem( "field" ) )
{
QList<QgsField> attributes;
QRegExp reFieldDef( "\\:"
"(int|integer|real|double|string|date)" // type
"(?:\\((\\d+)" // length
"(?:\\,(\\d+))?" // precision
"\\))?"
"$", Qt::CaseInsensitive );
QStringList fields = url.allQueryItemValues( "field" );
for ( int i = 0; i < fields.size(); i++ )
{
QString name = fields.at( i );
QVariant::Type type = QVariant::String;
QString typeName( "string" );
int length = 255;
int precision = 0;
int pos = reFieldDef.indexIn( name );
if ( pos >= 0 )
{
name = name.mid( 0, pos );
typeName = reFieldDef.cap( 1 ).toLower();
if ( typeName == "int" || typeName == "integer" )
{
type = QVariant::Int;
typeName = "integer";
length = 10;
}
else if ( typeName == "real" || typeName == "double" )
//.........这里部分代码省略.........
示例4: reFieldDef
QgsMemoryProvider::QgsMemoryProvider( const QString &uri, const ProviderOptions &options )
: QgsVectorDataProvider( uri, options )
{
// Initialize the geometry with the uri to support old style uri's
// (ie, just 'point', 'line', 'polygon')
QUrl url = QUrl::fromEncoded( uri.toUtf8() );
QString geometry;
if ( url.hasQueryItem( QStringLiteral( "geometry" ) ) )
{
geometry = url.queryItemValue( QStringLiteral( "geometry" ) );
}
else
{
geometry = url.path();
}
if ( geometry.toLower() == QLatin1String( "none" ) )
{
mWkbType = QgsWkbTypes::NoGeometry;
}
else
{
mWkbType = QgsWkbTypes::parseType( geometry );
}
if ( url.hasQueryItem( QStringLiteral( "crs" ) ) )
{
QString crsDef = url.queryItemValue( QStringLiteral( "crs" ) );
mCrs.createFromString( crsDef );
}
mNextFeatureId = 1;
setNativeTypes( QList< NativeType >()
<< QgsVectorDataProvider::NativeType( tr( "Whole number (integer)" ), QStringLiteral( "integer" ), QVariant::Int, 0, 10 )
// Decimal number from OGR/Shapefile/dbf may come with length up to 32 and
// precision up to length-2 = 30 (default, if width is not specified in dbf is length = 24 precision = 15)
// We know that double (QVariant::Double) has only 15-16 significant numbers,
// but setting that correct limits would disable the use of memory provider with
// data from Shapefiles. In any case, the data are handled as doubles.
// So the limits set here are not correct but enable use of data from Shapefiles.
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (real)" ), QStringLiteral( "double" ), QVariant::Double, 0, 32, 0, 30 )
<< QgsVectorDataProvider::NativeType( tr( "Text (string)" ), QStringLiteral( "string" ), QVariant::String, 0, 255 )
// date type
<< QgsVectorDataProvider::NativeType( tr( "Date" ), QStringLiteral( "date" ), QVariant::Date, -1, -1, -1, -1 )
<< QgsVectorDataProvider::NativeType( tr( "Time" ), QStringLiteral( "time" ), QVariant::Time, -1, -1, -1, -1 )
<< QgsVectorDataProvider::NativeType( tr( "Date & Time" ), QStringLiteral( "datetime" ), QVariant::DateTime, -1, -1, -1, -1 )
// integer types
<< QgsVectorDataProvider::NativeType( tr( "Whole number (smallint - 16bit)" ), QStringLiteral( "int2" ), QVariant::Int, -1, -1, 0, 0 )
<< QgsVectorDataProvider::NativeType( tr( "Whole number (integer - 32bit)" ), QStringLiteral( "int4" ), QVariant::Int, -1, -1, 0, 0 )
<< QgsVectorDataProvider::NativeType( tr( "Whole number (integer - 64bit)" ), QStringLiteral( "int8" ), QVariant::LongLong, -1, -1, 0, 0 )
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (numeric)" ), QStringLiteral( "numeric" ), QVariant::Double, 1, 20, 0, 20 )
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (decimal)" ), QStringLiteral( "decimal" ), QVariant::Double, 1, 20, 0, 20 )
// floating point
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (real)" ), QStringLiteral( "real" ), QVariant::Double, -1, -1, -1, -1 )
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (double)" ), QStringLiteral( "double precision" ), QVariant::Double, -1, -1, -1, -1 )
// string types
<< QgsVectorDataProvider::NativeType( tr( "Text, unlimited length (text)" ), QStringLiteral( "text" ), QVariant::String, -1, -1, -1, -1 )
);
if ( url.hasQueryItem( QStringLiteral( "field" ) ) )
{
QList<QgsField> attributes;
QRegExp reFieldDef( "\\:"
"(int|integer|long|int8|real|double|string|date|time|datetime)" // type
"(?:\\((\\-?\\d+)" // length
"(?:\\,(\\d+))?" // precision
"\\))?(\\[\\])?" // array
"$", Qt::CaseInsensitive );
QStringList fields = url.allQueryItemValues( QStringLiteral( "field" ) );
for ( int i = 0; i < fields.size(); i++ )
{
QString name = QUrl::fromPercentEncoding( fields.at( i ).toUtf8() );
QVariant::Type type = QVariant::String;
QVariant::Type subType = QVariant::Invalid;
QString typeName( QStringLiteral( "string" ) );
int length = 255;
int precision = 0;
int pos = reFieldDef.indexIn( name );
if ( pos >= 0 )
{
name = name.mid( 0, pos );
typeName = reFieldDef.cap( 1 ).toLower();
if ( typeName == QLatin1String( "int" ) || typeName == QLatin1String( "integer" ) )
{
type = QVariant::Int;
typeName = QStringLiteral( "integer" );
length = -1;
}
else if ( typeName == QLatin1String( "int8" ) || typeName == QLatin1String( "long" ) )
{
type = QVariant::LongLong;
typeName = QStringLiteral( "int8" );
length = -1;
}
//.........这里部分代码省略.........