File indexing completed on 2024-04-28 16:42:51

0001 // SPDX-FileCopyrightText: 2021 Jonah BrĂ¼chert <jbb@kaidan.im>
0002 //
0003 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 
0005 #pragma once
0006 
0007 #include <optional>
0008 #include <string>
0009 #include <variant>
0010 
0011 class QString;
0012 
0013 namespace phoneNumberUtils
0014 {
0015 enum ErrorType {
0016     NoParsingError,
0017     InvalidCountryCodeError,
0018     NotANumber,
0019     TooShortAfterIID,
0020     TooShortNSN,
0021     TooLongNsn,
0022 };
0023 
0024 enum PhoneNumberFormat { E164, International, National, RFC3966 };
0025 
0026 using NormalizeResult = std::variant<std::string, ErrorType>;
0027 
0028 const std::string localeCountryCode();
0029 NormalizeResult normalizeNumber(const std::string &numberString, PhoneNumberFormat format = International, const std::string &country = "");
0030 QString normalizeNumber(const QString &numberString, PhoneNumberFormat format = International, const std::string &country = "");
0031 }