// 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 // Note that we don't use features of ICU that depend on std::string (e.g. // UnicodeString::toUTF8String()) to support clients that build ICU without // -DU_HAVE_STD_STRING. #include "phonenumbers/regexp_adapter_icu.h" #include <stddef.h> #include <string> #include <unicode/regex.h> #include <unicode/stringpiece.h> #include <unicode/unistr.h> #include "phonenumbers/base/basictypes.h" #include "phonenumbers/base/logging.h" #include "phonenumbers/base/memory/scoped_ptr.h" #include "phonenumbers/default_logger.h" #include "phonenumbers/string_byte_sink.h" namespace i18n { namespace phonenumbers { RegexMatcher; RegexPattern; UnicodeString; namespace { // Converts UnicodeString 'source' to a UTF8-formatted std::string. string UnicodeStringToUtf8String(const UnicodeString& source) { … } // Converts UTF8-formatted std::string 'source' to a UnicodeString. UnicodeString Utf8StringToUnicodeString(const string& source) { … } } // namespace // Implementation of the abstract classes RegExpInput and RegExp using ICU // regular expression capabilities. // ICU implementation of the RegExpInput abstract class. class IcuRegExpInput : public RegExpInput { … }; // ICU implementation of the RegExp abstract class. class IcuRegExp : public RegExp { … }; RegExpInput* ICURegExpFactory::CreateInput(const string& utf8_input) const { … } RegExp* ICURegExpFactory::CreateRegExp(const string& utf8_regexp) const { … } } // namespace phonenumbers } // namespace i18n