// Copyright (C) 2011 The Libphonenumber Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Author: George Yakovlev // Philippe Liard // // RegExp adapter to allow a pluggable regexp engine. It has been introduced // during the integration of the open-source version of this library into // Chromium to be able to use the ICU Regex engine instead of RE2, which is not // officially supported on Windows. // Since RE2 was initially used in this library, the interface of this adapter // is very close to the subset of the RE2 API used in phonenumberutil.cc. #ifndef I18N_PHONENUMBERS_REGEXP_ADAPTER_H_ #define I18N_PHONENUMBERS_REGEXP_ADAPTER_H_ #include <cstddef> #include <string> namespace i18n { namespace phonenumbers { string; // RegExpInput is the interface that abstracts the input that feeds the // Consume() method of RegExp which may differ depending on its various // implementations (StringPiece for RE2, UnicodeString for ICU Regex). class RegExpInput { … }; // The regular expression abstract class. It supports only functions used in // phonenumberutil.cc. Consume(), Match() and Replace() methods must be // implemented. class RegExp { … }; // Abstract factory class that lets its subclasses instantiate the classes // implementing RegExp and RegExpInput. class AbstractRegExpFactory { … }; } // namespace phonenumbers } // namespace i18n #endif // I18N_PHONENUMBERS_REGEXP_ADAPTER_H_