susumu.yata
null+****@clear*****
Tue Dec 16 10:46:23 JST 2014
susumu.yata 2014-11-26 17:16:06 +0900 (Wed, 26 Nov 2014) New Revision: 0a6412c55918a1ac17c0d8b15d827bc50a509ff8 https://github.com/groonga/grnxx/commit/0a6412c55918a1ac17c0d8b15d827bc50a509ff8 Message: Add missing static specifiers. Modified files: lib/grnxx/impl/expression.cpp lib/grnxx/impl/expression.hpp Modified: lib/grnxx/impl/expression.cpp (+6 -9) =================================================================== --- lib/grnxx/impl/expression.cpp 2014-11-26 17:05:58 +0900 (9af6d96) +++ lib/grnxx/impl/expression.cpp 2014-11-26 17:16:06 +0900 (e56fba3) @@ -2,8 +2,6 @@ #include <new> -#include "grnxx/impl/column.hpp" - namespace grnxx { namespace impl { namespace expression { @@ -1752,7 +1750,11 @@ void ExpressionBuilder::push_column(const String &name) { if (subexpression_builder_) { subexpression_builder_->push_column(name); } else { - node_stack_.push_back(std::unique_ptr<Node>(create_column_node(name))); + ColumnBase *column = table_->find_column(name); + if (!column) { + throw "Column not found"; // TODO + } + node_stack_.push_back(std::unique_ptr<Node>(create_column_node(column))); } } @@ -1928,12 +1930,7 @@ Node *ExpressionBuilder::create_constant_node( throw "Memory allocation failed"; // TODO } -Node *ExpressionBuilder::create_column_node( - const String &name) try { - ColumnBase *column = table_->find_column(name); - if (!column) { - throw "Column not found"; // TODO - } +Node *ExpressionBuilder::create_column_node(ColumnBase *column) try { switch (column->data_type()) { case BOOL_DATA: { return new ColumnNode<Bool>(column); Modified: lib/grnxx/impl/expression.hpp (+28 -27) =================================================================== --- lib/grnxx/impl/expression.hpp 2014-11-26 17:05:58 +0900 (7fe7a1f) +++ lib/grnxx/impl/expression.hpp 2014-11-26 17:16:06 +0900 (7b33aed) @@ -3,6 +3,7 @@ #include "grnxx/expression.hpp" #include "grnxx/impl/table.hpp" +#include "grnxx/impl/column.hpp" namespace grnxx { namespace impl { @@ -128,78 +129,78 @@ class ExpressionBuilder : public ExpressionBuilderInterface { // Create a node associated with a constant. // // On failure, throws an exception. - Node *create_constant_node(const Datum &datum); + static Node *create_constant_node(const Datum &datum); // Create a node associated with a column. // // On failure, throws an exception. - Node *create_column_node(const String &name); + static Node *create_column_node(ColumnBase *column); // Create a node associated with a unary operator. // // On failure, throws an exception. - Node *create_unary_node(OperatorType operator_type, - std::unique_ptr<Node> &&arg); + static Node *create_unary_node(OperatorType operator_type, + std::unique_ptr<Node> &&arg); // Create a node associated with a binary operator. // // On failure, throws an exception. - Node *create_binary_node(OperatorType operator_type, - std::unique_ptr<Node> &&arg1, - std::unique_ptr<Node> &&arg2); + static Node *create_binary_node(OperatorType operator_type, + std::unique_ptr<Node> &&arg1, + std::unique_ptr<Node> &&arg2); // Create a node associated with an equality test operator. // // On failure, throws an exception. template <typename T> - Node *create_equality_test_node(OperatorType operator_type, - std::unique_ptr<Node> &&arg1, - std::unique_ptr<Node> &&arg2); + static Node *create_equality_test_node(OperatorType operator_type, + std::unique_ptr<Node> &&arg1, + std::unique_ptr<Node> &&arg2); // Create a node associated with a comparison operator. // // On failure, throws an exception. template <typename T> - Node *create_comparison_node(OperatorType operator_type, - std::unique_ptr<Node> &&arg1, - std::unique_ptr<Node> &&arg2); + static Node *create_comparison_node(OperatorType operator_type, + std::unique_ptr<Node> &&arg1, + std::unique_ptr<Node> &&arg2); // Create a node associated with a bitwise binary operator. // // On failure, throws an exception. template <typename T> - Node *create_bitwise_binary_node(OperatorType operator_type, - std::unique_ptr<Node> &&arg1, - std::unique_ptr<Node> &&arg2); + static Node *create_bitwise_binary_node(OperatorType operator_type, + std::unique_ptr<Node> &&arg1, + std::unique_ptr<Node> &&arg2); // Create a node associated with an arithmetic operator. // // On failure, throws an exception. template <typename T> - Node *create_arithmetic_node(OperatorType operator_type, - std::unique_ptr<Node> &&arg1, - std::unique_ptr<Node> &&arg2); + static Node *create_arithmetic_node(OperatorType operator_type, + std::unique_ptr<Node> &&arg1, + std::unique_ptr<Node> &&arg2); // Create a node associated with a search operator. // // On failure, throws an exception. template <typename T> - Node *create_search_node(OperatorType operator_type, - std::unique_ptr<Node> &&arg1, - std::unique_ptr<Node> &&arg2); + static Node *create_search_node(OperatorType operator_type, + std::unique_ptr<Node> &&arg1, + std::unique_ptr<Node> &&arg2); // Create a node associated with a subscript operator. // // On failure, throws an exception. - Node *create_subscript_node(std::unique_ptr<Node> &&arg1, - std::unique_ptr<Node> &&arg2); + static Node *create_subscript_node(std::unique_ptr<Node> &&arg1, + std::unique_ptr<Node> &&arg2); // Create a node associated with a dereference operator. // // On failure, throws an exception. - Node *create_dereference_node(std::unique_ptr<Node> &&arg1, - std::unique_ptr<Node> &&arg2, - const ExpressionOptions &options); + static Node *create_dereference_node(std::unique_ptr<Node> &&arg1, + std::unique_ptr<Node> &&arg2, + const ExpressionOptions &options); }; } // namespace impl -------------- next part -------------- HTML����������������������������... 下載