mapnik/include/mapnik/attribute_descriptor.hpp

107 lines
2.6 KiB
C++
Raw Normal View History

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
#ifndef MAPNIK_ATTRIBUTE_DESCRIPTOR_HPP
#define MAPNIK_ATTRIBUTE_DESCRIPTOR_HPP
2005-06-14 15:06:59 +00:00
#include <string>
namespace mapnik {
enum eAttributeType {
Integer=1,
Float =2,
Double =3,
String =4,
Boolean =5,
Geometry=6,
2012-02-02 01:53:35 +00:00
Object=7
};
class attribute_descriptor
2010-06-02 11:03:30 +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),
precision_(precision),
primary_key_(primary_key) {}
2012-02-02 01:53:35 +00:00
attribute_descriptor(attribute_descriptor const& other)
: name_(other.name_),
type_(other.type_),
size_(other.size_),
precision_(other.precision_),
primary_key_(other.primary_key_) {}
attribute_descriptor& operator=(attribute_descriptor rhs)
{
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;
}
std::string const& get_name() const
{
return name_;
}
unsigned int get_type() const
{
return type_;
}
bool is_primary_key() const
{
return primary_key_;
}
int get_size() const
{
return size_;
2012-02-02 01:53:35 +00:00
}
int get_precision() const
{
return precision_;
}
private:
std::string name_;
unsigned int type_;
int size_;
int precision_;
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
}
#endif // MAPNIK_ATTRIBUTE_DESCRIPTOR_HPP