remove typedef enums and inline methods.

This commit is contained in:
Pedro 2017-02-08 02:02:30 +01:00
parent 02b7b880ed
commit 8582c7f901
4 changed files with 26 additions and 47 deletions

View File

@ -5,7 +5,7 @@
#include <vector>
namespace hsql {
typedef enum {
enum StatementType {
kStmtError, // unused
kStmtSelect,
kStmtImport,
@ -19,7 +19,7 @@ namespace hsql {
kStmtExport,
kStmtRename,
kStmtAlter
} StatementType;
};
/**
* Base struct for every SQL statement

View File

@ -6,10 +6,10 @@
#include "Table.h"
namespace hsql {
typedef enum {
enum OrderType {
kOrderAsc,
kOrderDesc
} OrderType;
};
/**
* Description of the order by clause within a select statement

View File

@ -11,23 +11,15 @@ namespace hsql {
struct JoinDefinition;
struct TableRef;
/**
* @enum TableRefType
* Types table references
*/
typedef enum {
// Possible table reference types.
enum TableRefType {
kTableName,
kTableSelect,
kTableJoin,
kTableCrossProduct
} TableRefType;
};
/**
* @struct TableRef
* @brief Holds reference to tables. Can be either table names or a select statement.
*/
// Holds reference to tables. Can be either table names or a select statement.
struct TableRef {
TableRef(TableRefType type);
virtual ~TableRef();
@ -42,37 +34,22 @@ namespace hsql {
std::vector<TableRef*>* list;
JoinDefinition* join;
// Returns true if a schema is set.
bool hasSchema();
/**
* Convenience accessor methods
*/
inline bool hasSchema() {
return schema != NULL;
}
inline char* getName() {
if (alias != NULL) return alias;
else return name;
}
// Returns the alias, if it is set. Otherwise the name.
char* getName();
};
/**
* @enum JoinType
* Types of joins
*/
typedef enum {
// Possible types of joins.
enum JoinType {
kJoinInner,
kJoinOuter,
kJoinLeft,
kJoinRight,
} JoinType;
};
/**
* @struct JoinDefinition
* @brief Definition of a join table
*/
// Definition of a join construct.
struct JoinDefinition {
JoinDefinition();
virtual ~JoinDefinition();
@ -84,7 +61,5 @@ namespace hsql {
JoinType type;
};
} // namespace hsql
#endif

View File

@ -180,9 +180,6 @@ namespace hsql {
delete where;
}
// TableRef
TableRef::TableRef(TableRefType type) :
type(type),
@ -200,6 +197,15 @@ namespace hsql {
delete list;
}
bool TableRef::hasSchema() {
return schema != NULL;
}
char* TableRef::getName() {
if (alias != NULL) return alias;
else return name;
}
// JoinDefinition
JoinDefinition::JoinDefinition() :
left(NULL),
@ -213,6 +219,4 @@ namespace hsql {
delete condition;
}
} // namespace hsql