2006-03-31 10:32:02 +00:00
|
|
|
/*****************************************************************************
|
2012-02-02 01:53:35 +00:00
|
|
|
*
|
2006-03-31 10:32:02 +00:00
|
|
|
* This file is part of Mapnik (c++ mapping toolkit)
|
2005-06-14 15:06:59 +00:00
|
|
|
*
|
2015-06-16 10:49:16 +00:00
|
|
|
* Copyright (C) 2015 Artem Pavlenko
|
2005-06-14 15:06:59 +00:00
|
|
|
*
|
2006-03-31 10:32:02 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
2005-06-14 15:06:59 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2006-03-31 10:32:02 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2005-06-14 15:06:59 +00:00
|
|
|
*
|
2006-03-31 10:32:02 +00:00
|
|
|
*****************************************************************************/
|
2005-06-14 15:06:59 +00:00
|
|
|
|
2011-10-23 14:09:47 +00:00
|
|
|
#ifndef MAPNIK_ATTRIBUTE_DESCRIPTOR_HPP
|
|
|
|
#define MAPNIK_ATTRIBUTE_DESCRIPTOR_HPP
|
2005-06-14 15:06:59 +00:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2006-10-04 11:22:18 +00:00
|
|
|
namespace mapnik {
|
2011-07-11 21:03:39 +00:00
|
|
|
|
|
|
|
enum eAttributeType {
|
|
|
|
Integer=1,
|
|
|
|
Float =2,
|
|
|
|
Double =3,
|
|
|
|
String =4,
|
2011-07-11 22:34:08 +00:00
|
|
|
Boolean =5,
|
|
|
|
Geometry=6,
|
2012-02-02 01:53:35 +00:00
|
|
|
Object=7
|
2011-07-11 21:03:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class attribute_descriptor
|
2010-06-02 11:03:30 +00:00
|
|
|
{
|
2011-07-11 21:03:39 +00:00
|
|
|
public:
|
|
|
|
attribute_descriptor(std::string const& name,unsigned type,
|
|
|
|
bool primary_key=false,
|
|
|
|
int size=-1,
|
|
|
|
int precision=-1)
|
|
|
|
: name_(name),
|
|
|
|
type_(type),
|
|
|
|
size_(size),
|
2015-01-23 02:44:56 +00:00
|
|
|
precision_(precision),
|
2015-10-16 11:46:24 +00:00
|
|
|
primary_key_(primary_key) {}
|
2012-02-02 01:53:35 +00:00
|
|
|
|
2011-07-11 21:03:39 +00:00
|
|
|
attribute_descriptor(attribute_descriptor const& other)
|
|
|
|
: name_(other.name_),
|
|
|
|
type_(other.type_),
|
|
|
|
size_(other.size_),
|
2015-01-23 02:44:56 +00:00
|
|
|
precision_(other.precision_),
|
|
|
|
primary_key_(other.primary_key_) {}
|
2011-07-11 21:03:39 +00:00
|
|
|
|
2015-10-16 11:46:24 +00:00
|
|
|
attribute_descriptor& operator=(attribute_descriptor rhs)
|
2011-07-11 21:03:39 +00:00
|
|
|
{
|
2015-10-16 11:46:24 +00:00
|
|
|
using std::swap;
|
|
|
|
std::swap(name_, rhs.name_);
|
|
|
|
std::swap(type_, rhs.type_);
|
|
|
|
std::swap(size_, rhs.size_);
|
|
|
|
std::swap(precision_, rhs.precision_);
|
|
|
|
std::swap(primary_key_, rhs.primary_key_);
|
|
|
|
return *this;
|
2011-07-11 21:03:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string const& get_name() const
|
|
|
|
{
|
|
|
|
return name_;
|
|
|
|
}
|
|
|
|
|
2013-01-02 21:45:06 +00:00
|
|
|
unsigned int get_type() const
|
2011-07-11 21:03:39 +00:00
|
|
|
{
|
|
|
|
return type_;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool is_primary_key() const
|
|
|
|
{
|
|
|
|
return primary_key_;
|
|
|
|
}
|
|
|
|
|
|
|
|
int get_size() const
|
|
|
|
{
|
|
|
|
return size_;
|
2012-02-02 01:53:35 +00:00
|
|
|
}
|
|
|
|
|
2011-07-11 21:03:39 +00:00
|
|
|
int get_precision() const
|
|
|
|
{
|
|
|
|
return precision_;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::string name_;
|
2013-01-02 21:45:06 +00:00
|
|
|
unsigned int type_;
|
2011-07-11 21:03:39 +00:00
|
|
|
int size_;
|
|
|
|
int precision_;
|
2015-01-23 02:44:56 +00:00
|
|
|
bool primary_key_;
|
2010-06-02 11:03:30 +00:00
|
|
|
};
|
2012-02-02 01:53:35 +00:00
|
|
|
|
2005-06-14 15:06:59 +00:00
|
|
|
}
|
|
|
|
|
2011-10-23 14:09:47 +00:00
|
|
|
#endif // MAPNIK_ATTRIBUTE_DESCRIPTOR_HPP
|