1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 
6 #ifndef txPatternOptimizer_h__
7 #define txPatternOptimizer_h__
8 
9 #include "txXPathOptimizer.h"
10 
11 class txPattern;
12 
13 class txPatternOptimizer {
14  public:
15   /**
16    * Optimize the given pattern.
17    * @param aInPattern    Pattern to optimize.
18    * @param aOutPattern   Resulting pattern, null if optimization didn't
19    *                      result in a new pattern.
20    */
21   nsresult optimize(txPattern* aInPattern, txPattern** aOutPattern);
22 
23  private:
24   // Helper methods for optimizing specific classes
25   nsresult optimizeStep(txPattern* aInPattern, txPattern** aOutPattern);
26 
27   txXPathOptimizer mXPathOptimizer;
28 };
29 
30 #endif  // txPatternOptimizer_h__
31