Permalink
Browse files

pgsqltypes refactoring checkpoint.

  • Loading branch information...
rkhaotix committed Dec 18, 2012
1 parent c0c7a41 commit eaa433b7cdbd3f621ffa87bf9c362a6225d6edfc
Showing with 489 additions and 495 deletions.
  1. +8 −8 libpgmodeler/src/aggregate.cpp
  2. +7 −7 libpgmodeler/src/aggregate.h
  3. +4 −4 libpgmodeler/src/cast.cpp
  4. +3 −3 libpgmodeler/src/cast.h
  5. +4 −4 libpgmodeler/src/column.cpp
  6. +3 −3 libpgmodeler/src/column.h
  7. +7 −7 libpgmodeler/src/domain.cpp
  8. +3 −3 libpgmodeler/src/domain.h
  9. +8 −8 libpgmodeler/src/function.cpp
  10. +6 −6 libpgmodeler/src/function.h
  11. +22 −22 libpgmodeler/src/modelobd.cpp
  12. +2 −2 libpgmodeler/src/modelobd.h
  13. +6 −6 libpgmodeler/src/operator.cpp
  14. +3 −3 libpgmodeler/src/operator.h
  15. +4 −4 libpgmodeler/src/operatorclass.cpp
  16. +3 −3 libpgmodeler/src/operatorclass.h
  17. +4 −4 libpgmodeler/src/operatorclasselement.cpp
  18. +3 −3 libpgmodeler/src/operatorclasselement.h
  19. +245 −252 libpgmodeler/src/pgsqltypes.cpp
  20. +66 −65 libpgmodeler/src/pgsqltypes.h
  21. +5 −5 libpgmodeler/src/relationship.cpp
  22. +3 −3 libpgmodeler/src/sequence.cpp
  23. +3 −3 libpgmodeler/src/tabela.cpp
  24. +20 −20 libpgmodeler/src/type.cpp
  25. +8 −8 libpgmodeler/src/type.h
  26. +1 −1 libpgmodeler_ui/src/classeoperadoreswidget.cpp
  27. +1 −1 libpgmodeler_ui/src/colunawidget.cpp
  28. +1 −1 libpgmodeler_ui/src/conversaotipowidget.cpp
  29. +1 −1 libpgmodeler_ui/src/dominiowidget.cpp
  30. +5 −5 libpgmodeler_ui/src/funcaoagregacaowidget.cpp
  31. +5 −5 libpgmodeler_ui/src/funcaowidget.cpp
  32. +1 −1 libpgmodeler_ui/src/objetobasewidget.h
  33. +1 −1 libpgmodeler_ui/src/operadorwidget.cpp
  34. +18 −18 libpgmodeler_ui/src/tipopgsqlwidget.cpp
  35. +3 −3 libpgmodeler_ui/src/tipopgsqlwidget.h
  36. +2 −2 libpgmodeler_ui/src/tipowidget.cpp
@@ -64,7 +64,7 @@ bool Aggregate::isValidFunction(unsigned func_idx, Function *func)
else return(true);
}
-void Aggregate::setStateType(TipoPgSQL state_type)
+void Aggregate::setStateType(PgSQLType state_type)
{
this->state_type=state_type;
}
@@ -112,7 +112,7 @@ void Aggregate::setTypesAttribute(unsigned def_type)
str_types+=*(data_types[i]);
if(i < (count-1)) str_types+=",";
}
- else str_types+=data_types[i].obterDefinicaoObjeto(def_type);
+ else str_types+=data_types[i].getObjectDefinition(def_type);
}
/* Caso o usuário não especifique nenhum tipo de entrada para a função
@@ -124,7 +124,7 @@ void Aggregate::setTypesAttribute(unsigned def_type)
attributes[ParsersAttributes::TYPES]=str_types;
}
-void Aggregate::addDataType(TipoPgSQL type)
+void Aggregate::addDataType(PgSQLType type)
{
//Case the data type already exists in the aggregate raise an exception
if(isDataTypeExist(type))
@@ -151,9 +151,9 @@ void Aggregate::removeDataTypes(void)
data_types.clear();
}
-bool Aggregate::isDataTypeExist(TipoPgSQL type)
+bool Aggregate::isDataTypeExist(PgSQLType type)
{
- vector<TipoPgSQL>::iterator itr, itr_end;
+ vector<PgSQLType>::iterator itr, itr_end;
bool enc=false;
itr=data_types.begin();
@@ -182,7 +182,7 @@ Function *Aggregate::getFunction(unsigned func_idx)
return(functions[func_idx]);
}
-TipoPgSQL Aggregate::getStateType(void)
+PgSQLType Aggregate::getStateType(void)
{
return(state_type);
}
@@ -197,7 +197,7 @@ Operator *Aggregate::getSortOperator(void)
return(sort_operator);
}
-TipoPgSQL Aggregate::getDataType(unsigned type_idx)
+PgSQLType Aggregate::getDataType(unsigned type_idx)
{
//Raises an exception if the type index is out of bound
if(type_idx >= data_types.size())
@@ -248,7 +248,7 @@ QString Aggregate::getCodeDefinition(unsigned def_type)
if(def_type==SchemaParser::SQL_DEFINITION)
attributes[ParsersAttributes::STATE_TYPE]=*(state_type);
else
- attributes[ParsersAttributes::STATE_TYPE]=state_type.obterDefinicaoObjeto(def_type,ParsersAttributes::STATE_TYPE);
+ attributes[ParsersAttributes::STATE_TYPE]=state_type.getObjectDefinition(def_type,ParsersAttributes::STATE_TYPE);
return(BaseObject::__getCodeDefinition(def_type));
}
@@ -37,15 +37,15 @@ class Aggregate: public BaseObject {
To declare an aggregate function which works with several
types in the old syntax, the only element of the list must
be of type 'any' */
- vector<TipoPgSQL> data_types;
+ vector<PgSQLType> data_types;
/* Function that defines the aggregate behavior
0 -> Final function
1 -> Transition function */
Function *functions[2];
//Data type used as aggregate's state
- TipoPgSQL state_type;
+ PgSQLType state_type;
//Initial condition for the aggregate
QString initial_condition;
@@ -70,7 +70,7 @@ class Aggregate: public BaseObject {
void setFunction(unsigned func_idx, Function *func);
//Defines the state data type of the aggregate
- void setStateType(TipoPgSQL state_type);
+ void setStateType(PgSQLType state_type);
//Defines the initial condition for the aggregate
void setInitialCondition(const QString &cond);
@@ -79,7 +79,7 @@ class Aggregate: public BaseObject {
void setSortOperator(Operator *sort_op);
//Adds a data type in the group that is accepted by the aggregate
- void addDataType(TipoPgSQL type);
+ void addDataType(PgSQLType type);
//Removes one aggregate accepted data type
void removeDataType(unsigned type_idx);
@@ -88,13 +88,13 @@ class Aggregate: public BaseObject {
void removeDataTypes(void);
//Checks whether the passed type exists in the aggregate's set of data types
- bool isDataTypeExist(TipoPgSQL type);
+ bool isDataTypeExist(PgSQLType type);
Function *getFunction(unsigned func_idx);
- TipoPgSQL getStateType(void);
+ PgSQLType getStateType(void);
QString getInitialCondition(void);
Operator *getSortOperator(void);
- TipoPgSQL getDataType(unsigned type_idx);
+ PgSQLType getDataType(unsigned type_idx);
unsigned getDataTypeCount(void);
//Returns the SQL / XML code definition for the aggregate
@@ -13,7 +13,7 @@ Cast::Cast(void)
attributes[ParsersAttributes::IO_CAST]="";
}
-void Cast::setDataType(unsigned type_idx, TipoPgSQL type)
+void Cast::setDataType(unsigned type_idx, PgSQLType type)
{
//Check if the type index is valid
if(type_idx<=DST_TYPE)
@@ -104,7 +104,7 @@ void Cast::setCastFunction(Function *cast_func)
this->cast_function=cast_func;
}
-TipoPgSQL Cast::getDataType(unsigned type_idx)
+PgSQLType Cast::getDataType(unsigned type_idx)
{
if(type_idx<=DST_TYPE)
return(this->types[type_idx]);
@@ -136,8 +136,8 @@ QString Cast::getCodeDefinition(unsigned def_type)
}
else
{
- attributes[ParsersAttributes::SOURCE_TYPE]=types[SRC_TYPE].obterDefinicaoObjeto(def_type);
- attributes[ParsersAttributes::DEST_TYPE]=types[DST_TYPE].obterDefinicaoObjeto(def_type);
+ attributes[ParsersAttributes::SOURCE_TYPE]=types[SRC_TYPE].getObjectDefinition(def_type);
+ attributes[ParsersAttributes::DEST_TYPE]=types[DST_TYPE].getObjectDefinition(def_type);
}
if(cast_function)
View
@@ -31,7 +31,7 @@ class Cast: public BaseObject {
/* Data types used on the cast:
0 -> Source data type
1 -> Destination data type */
- TipoPgSQL types[2];
+ PgSQLType types[2];
//Conversion type (ASSIGNMENT or IMPLICIT)
unsigned cast_type;
@@ -55,7 +55,7 @@ class Cast: public BaseObject {
/* Defines one of the data types envolved on the cast
(using constants SRC_TYPE | DST_TYPE) */
- void setDataType(unsigned type_idx, TipoPgSQL type);
+ void setDataType(unsigned type_idx, PgSQLType type);
//Defines the cast type (using constants ASSINGMENT | IMPLICIT)
void setCastType(unsigned cast_type);
@@ -69,7 +69,7 @@ class Cast: public BaseObject {
void setInOut(bool value);
//Returns one of the cast envolved data types
- TipoPgSQL getDataType(unsigned type_idx);
+ PgSQLType getDataType(unsigned type_idx);
//Returns the cast type
unsigned getCastType(void);
@@ -32,10 +32,10 @@ void Column::setName(const QString &name)
}
}
-void Column::setType(TipoPgSQL type)
+void Column::setType(PgSQLType type)
{
//An error is raised if the column receive a pseudo-type as data type.
- if(type.pseudoTipo())
+ if(type.isPseudoType())
throw Exception(ERR_ASG_PSDTYPE_COLUMN,__PRETTY_FUNCTION__,__FILE__,__LINE__);
else
this->type=type;
@@ -51,7 +51,7 @@ void Column::setNotNull(bool value)
not_null=value;
}
-TipoPgSQL Column::getType(void)
+PgSQLType Column::getType(void)
{
return(type);
}
@@ -87,7 +87,7 @@ QString Column::getCodeDefinition(unsigned def_type)
if(this->parent_table)
attributes[ParsersAttributes::TABLE]=this->parent_table->getName(true);
- attributes[ParsersAttributes::TYPE]=type.obterDefinicaoObjeto(def_type);
+ attributes[ParsersAttributes::TYPE]=type.getObjectDefinition(def_type);
attributes[ParsersAttributes::DEFAULT_VALUE]=default_value;
attributes[ParsersAttributes::NOT_NULL]=(!not_null ? "" : "1");
return(BaseObject::__getCodeDefinition(def_type));
@@ -35,7 +35,7 @@ class Column: public TableObject{
bool not_null;
//Data type of the column
- TipoPgSQL type;
+ PgSQLType type;
/* Default value of the column.
Note: The user must format the default value in
@@ -51,7 +51,7 @@ class Column: public TableObject{
void setNotNull(bool value);
//Defines the column data type
- void setType(TipoPgSQL type);
+ void setType(PgSQLType type);
/* Sets the default value of the column. Must be informed together with the value
the particularities of each type, such as quotation marks, hyphens, etc. */
@@ -70,7 +70,7 @@ class Column: public TableObject{
bool isNotNull(void);
//Returns the data type of the column
- TipoPgSQL getType(void);
+ PgSQLType getType(void);
//Returns the default value of the column
QString getDefaultValue(void);
@@ -13,7 +13,7 @@ Domain::Domain(void)
Domain::~Domain(void)
{
- TipoPgSQL::removerTipoUsuario(this->getName(true), this);
+ PgSQLType::removeUserType(this->getName(true), this);
}
void Domain::setName(const QString &name)
@@ -25,7 +25,7 @@ void Domain::setName(const QString &name)
new_name=this->getName(true);
//Renames the PostgreSQL type represented by the domain
- TipoPgSQL::renomearTipoUsuario(prev_name, this, new_name);
+ PgSQLType::renameUserType(prev_name, this, new_name);
}
void Domain::setSchema(BaseObject *schema)
@@ -36,7 +36,7 @@ void Domain::setSchema(BaseObject *schema)
BaseObject::setSchema(schema);
//Renames the PostgreSQL type represented by the domain
- TipoPgSQL::renomearTipoUsuario(prev_name, this, this->getName(true));
+ PgSQLType::renameUserType(prev_name, this, this->getName(true));
}
void Domain::setConstraintName(const QString &constr_name)
@@ -63,7 +63,7 @@ void Domain::setNotNull(bool value)
not_null=value;
}
-void Domain::setType(TipoPgSQL type)
+void Domain::setType(PgSQLType type)
{
this->type=type;
}
@@ -88,7 +88,7 @@ bool Domain::isNotNull(void)
return(not_null);
}
-TipoPgSQL Domain::getType(void)
+PgSQLType Domain::getType(void)
{
return(type);
}
@@ -104,7 +104,7 @@ QString Domain::getCodeDefinition(unsigned def_type)
attributes[ParsersAttributes::TYPE]=(*type);
else
{
- attributes[ParsersAttributes::TYPE]=type.obterDefinicaoObjeto(def_type);
+ attributes[ParsersAttributes::TYPE]=type.getObjectDefinition(def_type);
}
return(BaseObject::__getCodeDefinition(def_type));
@@ -120,6 +120,6 @@ void Domain::operator = (Domain &domain)
this->not_null=domain.not_null;
this->default_value=domain.default_value;
this->type=domain.type;
- TipoPgSQL::renomearTipoUsuario(prev_name, this, this->getName(true));
+ PgSQLType::renameUserType(prev_name, this, this->getName(true));
}
@@ -38,7 +38,7 @@ class Domain: public BaseObject{
bool not_null;
//Domain data type
- TipoPgSQL type;
+ PgSQLType type;
public:
Domain(void);
@@ -57,7 +57,7 @@ class Domain: public BaseObject{
void setNotNull(bool value);
//Defines the domain data type
- void setType(TipoPgSQL type);
+ void setType(PgSQLType type);
/* Overloaded BaseObject name definition method.
Updates the reference of the domain as a PostgreSQL data type */
@@ -72,7 +72,7 @@ class Domain: public BaseObject{
QString getExpression(void);
QString getDefaultValue(void);
bool isNotNull(void);
- TipoPgSQL getType(void);
+ PgSQLType getType(void);
//Returns the SQL / XML code definition for the domain
QString getCodeDefinition(unsigned tipo_def);
@@ -6,7 +6,7 @@ Parameter::Parameter(void)
is_in=is_out=false;
}
-void Parameter::setType(TipoPgSQL type)
+void Parameter::setType(PgSQLType type)
{
this->type=type;
}
@@ -50,7 +50,7 @@ QString Parameter::getCodeDefinition(unsigned def_type)
attributes[ParsersAttributes::PARAM_IN]=(is_in ? "1" : "");
attributes[ParsersAttributes::PARAM_OUT]=(is_out ? "1" : "");
attributes[ParsersAttributes::DEFAULT_VALUE]=default_value;
- attributes[ParsersAttributes::TYPE]=type.obterDefinicaoObjeto(def_type);
+ attributes[ParsersAttributes::TYPE]=type.getObjectDefinition(def_type);
return(BaseObject::__getCodeDefinition(def_type));
}
@@ -60,7 +60,7 @@ unsigned Function::function_id=40000;
Function::Function(void)
{
object_id=Function::function_id++;
- return_type=TipoPgSQL("void");
+ return_type=PgSQLType("void");
language=NULL;
returns_setof=false;
is_wnd_function=false;
@@ -129,7 +129,7 @@ void Function::addParameter(Parameter param)
createSignature();
}
-void Function::addReturnedTableColumn(const QString &name, TipoPgSQL type)
+void Function::addReturnedTableColumn(const QString &name, PgSQLType type)
{
//Raises an error if the column name is empty
if(name=="")
@@ -227,7 +227,7 @@ void Function::setSymbol(const QString &symbol)
this->symbol=symbol;
}
-void Function::setReturnType(TipoPgSQL type)
+void Function::setReturnType(PgSQLType type)
{
return_type=type;
}
@@ -279,7 +279,7 @@ void Function::setSourceCode(const QString &src_code)
this->source_code=src_code;
}
-TipoPgSQL Function::getReturnType(void)
+PgSQLType Function::getReturnType(void)
{
return(return_type);
}
@@ -383,7 +383,7 @@ void Function::removeReturnedTableColumns(void)
ret_table_columns.clear();
}
-void Function::removeParameter(const QString &name, TipoPgSQL type)
+void Function::removeParameter(const QString &name, PgSQLType type)
{
vector<Parameter>::iterator itr,itr_end;
@@ -473,7 +473,7 @@ QString Function::getCodeDefinition(unsigned def_type, bool reduced_form)
else
{
attributes[ParsersAttributes::LANGUAGE]=language->getCodeDefinition(def_type,true);
- attributes[ParsersAttributes::RETURN_TYPE]=return_type.obterDefinicaoObjeto(def_type);
+ attributes[ParsersAttributes::RETURN_TYPE]=return_type.getObjectDefinition(def_type);
}
setTableReturnTypeAttribute(def_type);
Oops, something went wrong.

0 comments on commit eaa433b

Please sign in to comment.