27 #include "../../core/translator/Translator.h" 28 #include "../../dataaccess/dataset/PrimaryKey.h" 29 #include "../datasource/DataSourceCapabilities.h" 30 #include "../Exception.h" 39 : m_inDataSetType(dynamic_cast<
DataSetType*>(type->clone())),
45 for(std::size_t i = 0; i != type->
size(); ++i)
60 for(std::size_t i = 0; i != type->
size(); ++i)
70 const std::vector<te::dt::Property*> properties = type->
getProperties();
71 for(std::size_t i = 0; i < properties.size(); ++i)
76 if(dtCapabilities.supports(p->
getType()))
89 int hintDataType = dtCapabilities.getHint(p->
getType());
103 std::vector<te::dt::Property*> pkProps = pk->
getProperties();
104 std::vector<te::dt::Property*> outPkProps;
105 for(std::size_t i = 0; i < pkProps.size(); ++i)
137 propertyPos.push_back(i);
144 assert(pos != std::string::npos);
155 for(std::size_t i = 0; i < indexes.size(); ++i)
158 convertedPropertyPos.push_back(indexes[i]);
175 assert(propertyPos >= 0 && propertyPos < m_outDataSetType->size());
186 for(std::size_t i = 0; i < indexes.size(); ++i)
204 std::vector<std::size_t> indexes;
205 indexes.push_back(propertyPos);
206 add(indexes, p, attributeConverterName);
211 std::vector<std::size_t> indexes;
212 indexes.push_back(propertyPos);
213 add(indexes, p, conv);
218 std::vector<std::size_t> indexes;
220 for(std::size_t i = 0; i < propertyNames.size(); ++i)
223 add(indexes, p, attributeConverterName);
228 assert(!propertyPos.empty());
243 for(std::size_t i = 0; i < propertyPos.size(); ++i)
251 assert(!propertyPos.empty());
264 for(std::size_t i = 0; i < propertyPos.size(); ++i)
281 for (std::size_t i = 0; i < properties.size(); ++i)
300 const std::vector<te::dt::Property*> properties = type->
getProperties();
301 for(std::size_t i = 0; i < properties.size(); ++i)
DataSetType * m_outDataSetType
The converted DataSetType.
void setTitle(const std::string &title)
It sets a human descriptive title for the DataSetType.
Property * getProperty(std::size_t i) const
It returns the i-th property.
const std::vector< std::vector< std::size_t > > & getConvertedPropertyIndexes() const
te::core::EncodingType m_encondingType
The enconding type used.
void setEncodingType(te::core::EncodingType et)
It changes all encoding types from m_converters property that are CharEncodingConverter type...
An converter for DataSetType.
A class that models the description of a dataset.
bool isConverted(std::size_t i) const
std::vector< std::vector< std::size_t > > m_propertyIndexes
A vector that stores the converted property indexes.
DataSetType * getResult() const
void getNonConvertedProperties(std::vector< std::string > &propertyNames) const
This method returns the name of the properties that have not yet been converted.
PrimaryKey * getPrimaryKey() const
It returns the primary key associated to the dataset type.
const DataTypeCapabilities & getDataTypeCapabilities() const
A singleton to keep all the registered Attribute Converter.
A class that represents the known capabilities of a specific data source, i.e. this class informs all...
virtual Property * clone() const =0
It returns a clone of the object.
std::string getConverterName(std::size_t propertyPos)
This method tells which Attribute Converter was used in the porperty position.
It models a property definition.
DataSetType * getConvertee()
This method returns the pointer to the DataSetType that is handled by the converter.
const std::vector< te::dt::Property * > & getProperties() const
It returns the properties that take part of the primary key.
EncodingType
Supported character encodings.
const std::vector< AttributeConverter > & getConverters() const
A class that represents the supported data types of a specific data source.
void remove(Constraint *c)
It removes the constraint.
const std::vector< Property * > & getProperties() const
It returns the list of properties describing the CompositeProperty.
static AttributeConverterManager & getInstance()
It returns a reference to the singleton instance.
te::da::DataSourceCapabilities capabilities
void getConvertedProperties(const std::string &propertyName, std::vector< std::size_t > &convertedPropertyPos)
This method tells which properties of the input data set type that have been converted based on the g...
boost::function3< te::dt::AbstractData *, DataSet *, const std::vector< std::size_t > &, int > AttributeConverter
The type of attribute converter functions.
void setProperties(const std::vector< te::dt::Property * > &properties)
It sets the properties that form the primary key.
DataSetTypeConverter(DataSetType *type)
Constructor.
std::size_t size() const
It returns the number of properties of the CompositeProperty.
std::vector< std::size_t > m_convertedProperties
Internal vector to count the references to converted properties.
std::vector< AttributeConverter > m_converters
A vector that stores the attribute converters functions.
int getType() const
It returns the property data type.
void add(Constraint *c)
It adds a new constraint.
static bool needConverter(DataSetType *type, const DataSourceCapabilities &capabilities)
Static method that verifies if the given data set type need an converter based on given data source c...
bool supports(const int &type) const
~DataSetTypeConverter()
Destructor.
A class that models the description of a dataset.
It describes a primary key (pk) constraint.
void remove(const std::string &propertyName)
This method removes a property of DataSetTypeConverter.
te::core::EncodingType getEncodingType()
It gets the encoding type used to convert.
std::size_t getPropertyPosition(const std::string &name) const
It returns the property position based on its name.
DataSetType * m_inDataSetType
A pointer to DataSetType that will be converted.
void add(const std::string &propertyName, te::dt::Property *p, const std::string &attributeConverterName="GenericAttributeConverter")
It adds a conversions to the given property of the input data set type.
virtual const std::string & getName() const
It returns the constraint name.
unsigned int getId() const
It returns the property identifier.
std::vector< std::string > m_functionsNames
A vector that stores the attribute converters functions names.
const std::string & getName() const
It returns the property name.