csv: use braces in all cases
This commit is contained in:
parent
6dbb12e52c
commit
16ab2ba895
1 changed files with 16 additions and 0 deletions
|
@ -586,7 +586,9 @@ void csv_datasource::parse_csv(T& stream,
|
|||
{
|
||||
boost::put(*feature,fld_name,mapnik::value_null());
|
||||
if (feature_count == 1)
|
||||
{
|
||||
desc_.add_descriptor(mapnik::attribute_descriptor(fld_name,mapnik::String));
|
||||
}
|
||||
}
|
||||
// only true strings are this long
|
||||
else if (value_length > 20)
|
||||
|
@ -594,7 +596,9 @@ void csv_datasource::parse_csv(T& stream,
|
|||
UnicodeString ustr = tr.transcode(value.c_str());
|
||||
boost::put(*feature,fld_name,ustr);
|
||||
if (feature_count == 1)
|
||||
{
|
||||
desc_.add_descriptor(mapnik::attribute_descriptor(fld_name,mapnik::String));
|
||||
}
|
||||
|
||||
}
|
||||
else if ((value[0] >= '0' && value[0] <= '9') || value[0] == '-')
|
||||
|
@ -609,14 +613,18 @@ void csv_datasource::parse_csv(T& stream,
|
|||
{
|
||||
boost::put(*feature,fld_name,float_val);
|
||||
if (feature_count == 1)
|
||||
{
|
||||
desc_.add_descriptor(mapnik::attribute_descriptor(fld_name,mapnik::Double));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int val = static_cast<int>(float_val);
|
||||
boost::put(*feature,fld_name,val);
|
||||
if (feature_count == 1)
|
||||
{
|
||||
desc_.add_descriptor(mapnik::attribute_descriptor(fld_name,mapnik::Integer));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -625,7 +633,9 @@ void csv_datasource::parse_csv(T& stream,
|
|||
UnicodeString ustr = tr.transcode(value.c_str());
|
||||
boost::put(*feature,fld_name,ustr);
|
||||
if (feature_count == 1)
|
||||
{
|
||||
desc_.add_descriptor(mapnik::attribute_descriptor(fld_name,mapnik::String));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -635,13 +645,17 @@ void csv_datasource::parse_csv(T& stream,
|
|||
{
|
||||
boost::put(*feature,fld_name,true);
|
||||
if (feature_count == 1)
|
||||
{
|
||||
desc_.add_descriptor(mapnik::attribute_descriptor(fld_name,mapnik::Boolean));
|
||||
}
|
||||
}
|
||||
else if(value_lower == "false")
|
||||
{
|
||||
boost::put(*feature,fld_name,false);
|
||||
if (feature_count == 1)
|
||||
{
|
||||
desc_.add_descriptor(mapnik::attribute_descriptor(fld_name,mapnik::Boolean));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -649,7 +663,9 @@ void csv_datasource::parse_csv(T& stream,
|
|||
UnicodeString ustr = tr.transcode(value.c_str());
|
||||
boost::put(*feature,fld_name,ustr);
|
||||
if (feature_count == 1)
|
||||
{
|
||||
desc_.add_descriptor(mapnik::attribute_descriptor(fld_name,mapnik::String));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue