[Groonga-commit] groonga/grnxx at 5d3a190 [master] Make Expression::create() private.

Zurück zum Archiv-Index

susumu.yata null+****@clear*****
Tue Aug 12 10:11:26 JST 2014


susumu.yata	2014-08-12 10:11:26 +0900 (Tue, 12 Aug 2014)

  New Revision: 5d3a190539aed4bbc34078e55ad27e6b8188e69c
  https://github.com/groonga/grnxx/commit/5d3a190539aed4bbc34078e55ad27e6b8188e69c

  Message:
    Make Expression::create() private.

  Modified files:
    include/grnxx/expression.hpp
    lib/grnxx/expression.cpp

  Modified: include/grnxx/expression.hpp (+11 -9)
===================================================================
--- include/grnxx/expression.hpp    2014-08-11 19:00:14 +0900 (abefb44)
+++ include/grnxx/expression.hpp    2014-08-12 10:11:26 +0900 (9e6f17d)
@@ -58,15 +58,6 @@ enum OperatorType {
 
 class Expression {
  public:
-  // Create an expression.
-  //
-  // Returns a poitner to the builder on success.
-  // On failure, returns nullptr and stores error information into "*error" if
-  // "error" != nullptr.
-  static unique_ptr<Expression> create(Error *error,
-                                       const Table *table,
-                                       unique_ptr<ExpressionNode> &&root);
-
   ~Expression();
 
   // Return the associated table.
@@ -135,12 +126,23 @@ class Expression {
   const Table *table_;
   unique_ptr<ExpressionNode> root_;
 
+  // Create an expression.
+  //
+  // On success, returns a poitner to the expression.
+  // On failure, returns nullptr and stores error information into "*error" if
+  // "error" != nullptr.
+  static unique_ptr<Expression> create(Error *error,
+                                       const Table *table,
+                                       unique_ptr<ExpressionNode> &&root);
+
   Expression(const Table *table, unique_ptr<ExpressionNode> &&root);
 
   template <typename T>
   bool evaluate_block(Error *error,
                       const ArrayRef<Record> &records,
                       ArrayRef<T> *results);
+
+  friend ExpressionBuilder;
 };
 
 class ExpressionBuilder {

  Modified: lib/grnxx/expression.cpp (+12 -12)
===================================================================
--- lib/grnxx/expression.cpp    2014-08-11 19:00:14 +0900 (8bdbb79)
+++ lib/grnxx/expression.cpp    2014-08-12 10:11:26 +0900 (281e606)
@@ -732,18 +732,6 @@ bool LogicalOrNode::evaluate(Error *error, const ArrayRef<Record> &records) {
 
 // -- Expression --
 
-unique_ptr<Expression> Expression::create(Error *error,
-                                          const Table *table,
-                                          unique_ptr<ExpressionNode> &&root) {
-  unique_ptr<Expression> expression(
-      new (nothrow) Expression(table, std::move(root)));
-  if (!expression) {
-    GRNXX_ERROR_SET(error, NO_MEMORY, "Memory allocation failed");
-    return nullptr;
-  }
-  return expression;
-}
-
 Expression::~Expression() {}
 
 DataType Expression::data_type() const {
@@ -851,6 +839,18 @@ bool Expression::evaluate(Error *error,
   return evaluate_block(error, input, &output);
 }
 
+unique_ptr<Expression> Expression::create(Error *error,
+                                          const Table *table,
+                                          unique_ptr<ExpressionNode> &&root) {
+  unique_ptr<Expression> expression(
+      new (nothrow) Expression(table, std::move(root)));
+  if (!expression) {
+    GRNXX_ERROR_SET(error, NO_MEMORY, "Memory allocation failed");
+    return nullptr;
+  }
+  return expression;
+}
+
 Expression::Expression(const Table *table, unique_ptr<ExpressionNode> &&root)
     : table_(table),
       root_(std::move(root)) {}
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Zurück zum Archiv-Index