File indexing completed on 2024-12-29 04:51:06

0001 /*
0002     SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
0003     SPDX-License-Identifier: LGPL-2.0-or-later
0004 */
0005 
0006 #ifndef KITINERARY_ADDRESSPARSER_H
0007 #define KITINERARY_ADDRESSPARSER_H
0008 
0009 #include <KItinerary/Place>
0010 
0011 namespace KContacts {
0012 class AddressFormat;
0013 }
0014 
0015 namespace KItinerary {
0016 
0017 /** Country-specific address parsing utilities. */
0018 class AddressParser
0019 {
0020 public:
0021     explicit AddressParser();
0022     ~AddressParser();
0023 
0024     /** The assumed country when no other country information is known. */
0025     void setFallbackCountry(const QString &countryCode);
0026 
0027     /** Parse an already partially split address further. */
0028     void parse(PostalAddress addr);
0029 
0030     PostalAddress result() const;
0031 
0032 private:
0033     void splitPostalCode();
0034     KContacts::AddressFormat addressFormat() const;
0035 
0036     PostalAddress m_address;
0037     QString m_fallbackCountry;
0038 };
0039 
0040 }
0041 
0042 #endif // KITINERARY_ADDRESSPARSER_H