KContacts

addressformatscript.cpp
1/*
2 SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
3 SPDX-License-Identifier: LGPL-2.0-or-later
4*/
5
6#include "address.h"
7#include "addressformatscript_p.h"
8
9using namespace KContacts;
10
11AddressFormatScript::ScriptType AddressFormatScript::detect(const QString &s)
12{
13 for (auto c : s) {
14 switch (c.script()) {
16 return AddressFormatScript::ArabicLikeScript;
18 return AddressFormatScript::HanLikeScript;
21 return AddressFormatScript::HangulLikeScript;
22 default:
23 break;
24 }
25 }
26 return AddressFormatScript::LatinLikeScript;
27}
28
29AddressFormatScript::ScriptType AddressFormatScript::detect(const Address &addr)
30{
31 return std::max(detect(addr.street()), detect(addr.locality()));
32}
Postal address information.
Definition address.h:31
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:10 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.