[locale] Fix interpretation of configured selector
- In GeoIP handler constructors that take a string (to configure the selector to use), interpret the empty string (which generally isn't a meaningful selector) as meaning "use the default". - Drop the no-argument constructors in favor of a default-argument which is empty.
This commit is contained in:
parent
352b385b12
commit
fa5d40006c
@ -27,16 +27,10 @@
|
||||
#include <yaml-cpp/yaml.h>
|
||||
|
||||
GeoIPJSON::GeoIPJSON(const QString& attribute)
|
||||
: GeoIP( attribute )
|
||||
: GeoIP( attribute.isEmpty() ? QLatin1String( "time_zone" ) : attribute )
|
||||
{
|
||||
}
|
||||
|
||||
GeoIPJSON::GeoIPJSON()
|
||||
: GeoIPJSON( QLatin1Literal( "time_zone" ) )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
GeoIP::RegionZonePair
|
||||
GeoIPJSON::processReply( const QByteArray& data )
|
||||
{
|
||||
|
@ -31,8 +31,12 @@
|
||||
class GeoIPJSON : public GeoIP
|
||||
{
|
||||
public:
|
||||
explicit GeoIPJSON( const QString& attribute );
|
||||
explicit GeoIPJSON();
|
||||
/** @brief Configure the attribute name which is selected.
|
||||
*
|
||||
* If an empty string is passed in (not a valid attribute name),
|
||||
* then "time_zone" is used.
|
||||
*/
|
||||
explicit GeoIPJSON( const QString& attribute = QString() );
|
||||
|
||||
virtual RegionZonePair processReply( const QByteArray& );
|
||||
} ;
|
||||
|
@ -24,16 +24,10 @@
|
||||
#include <QtXml/QDomDocument>
|
||||
|
||||
GeoIPXML::GeoIPXML( const QString& element )
|
||||
: GeoIP( element )
|
||||
: GeoIP( element.isEmpty() ? QLatin1String( "TimeZone" ) : element )
|
||||
{
|
||||
}
|
||||
|
||||
GeoIPXML::GeoIPXML()
|
||||
: GeoIPXML( QLatin1Literal( "TimeZone" ) )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
GeoIP::RegionZonePair
|
||||
GeoIPXML::processReply( const QByteArray& data )
|
||||
{
|
||||
|
@ -31,10 +31,12 @@
|
||||
class GeoIPXML : public GeoIP
|
||||
{
|
||||
public:
|
||||
/** @brief Configure the element name which is selected. */
|
||||
explicit GeoIPXML( const QString& element );
|
||||
/** @brief Use default TimeZone element. */
|
||||
explicit GeoIPXML();
|
||||
/** @brief Configure the element tag which is selected.
|
||||
*
|
||||
* If an empty string is passed in (not a valid element tag),
|
||||
* then "TimeZone" is used.
|
||||
*/
|
||||
explicit GeoIPXML( const QString& element = QString() );
|
||||
|
||||
virtual RegionZonePair processReply( const QByteArray& );
|
||||
} ;
|
||||
|
Loading…
Reference in New Issue
Block a user