Skip to content

Commit

Permalink
Simplify include file
Browse files Browse the repository at this point in the history
  • Loading branch information
MKleusberg committed Jan 23, 2017
1 parent 00ac4aa commit 649f2b8
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 49 deletions.
42 changes: 42 additions & 0 deletions src/sqlitetypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,48 @@ QStringList fieldVectorToFieldNames(const FieldVector& vector)
return result;
}

/**
* @brief The CreateTableWalker class
* Goes trough the createtable AST and returns
* Table object.
*/
class CreateTableWalker
{
public:
explicit CreateTableWalker(antlr::RefAST r)
: m_root(r)
{}

TablePtr table();

private:
void parsecolumn(Table* table, antlr::RefAST c);

private:
antlr::RefAST m_root;
};

/**
* @brief The CreateIndexWalker class
* Goes trough the createtable AST and returns
* Index object.
*/
class CreateIndexWalker
{
public:
explicit CreateIndexWalker(antlr::RefAST r)
: m_root(r)
{}

IndexPtr index();

private:
void parsecolumn(Index* index, antlr::RefAST c);

private:
antlr::RefAST m_root;
};

ObjectPtr Object::parseSQL(Object::ObjectTypes type, const QString& sSQL)
{
// Parse SQL statement according to type
Expand Down
52 changes: 3 additions & 49 deletions src/sqlitetypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@
#ifndef SQLITETYPES_H
#define SQLITETYPES_H

#include "antlr/ASTRefCount.hpp"

#include <QString>
#include <QSharedPointer>
#include <QVector>
#include <QStringList>
#include <QPair>
#include <QMultiHash>

namespace sqlb {
Expand All @@ -29,6 +26,9 @@ typedef QSharedPointer<Constraint> ConstraintPtr;
typedef QVector<FieldPtr> FieldVector;
typedef QSharedPointer<IndexedColumn> IndexedColumnPtr;
typedef QVector<IndexedColumnPtr> IndexedColumnVector;
typedef QMultiHash<FieldVector, ConstraintPtr> ConstraintMap;

QStringList fieldVectorToFieldNames(const sqlb::FieldVector& vector);

class Object
{
Expand Down Expand Up @@ -217,8 +217,6 @@ class Field
bool m_unique;
};

typedef QMultiHash<FieldVector, ConstraintPtr> ConstraintMap;

class Table : public Object
{
public:
Expand Down Expand Up @@ -289,29 +287,6 @@ class Table : public Object
QString m_virtual;
};

/**
* @brief The CreateTableWalker class
* Goes trough the createtable AST and returns
* Table object.
*/
class CreateTableWalker
{
public:
explicit CreateTableWalker(antlr::RefAST r)
: m_root(r)
{}

TablePtr table();

private:
void parsecolumn(Table* table, antlr::RefAST c);

private:
antlr::RefAST m_root;
};

QStringList fieldVectorToFieldNames(const sqlb::FieldVector& vector);

class IndexedColumn
{
public:
Expand Down Expand Up @@ -390,27 +365,6 @@ class Index : public Object
IndexedColumnVector m_columns;
};

/**
* @brief The CreateIndexWalker class
* Goes trough the createtable AST and returns
* Index object.
*/
class CreateIndexWalker
{
public:
explicit CreateIndexWalker(antlr::RefAST r)
: m_root(r)
{}

IndexPtr index();

private:
void parsecolumn(Index* index, antlr::RefAST c);

private:
antlr::RefAST m_root;
};

} //namespace sqlb

#endif // SQLITETYPES_H

0 comments on commit 649f2b8

Please sign in to comment.