KTextAddons

languageinfo.cpp
1/*
2 SPDX-FileCopyrightText: 2019-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "languageinfo.h"
8using namespace Qt::Literals::StringLiterals;
9
10#include <QJsonObject>
11
12using namespace TextGrammarCheck;
13
14LanguageInfo::LanguageInfo() = default;
15
16LanguageInfo::~LanguageInfo() = default;
17
18QString LanguageInfo::name() const
19{
20 return mName;
21}
22
23void LanguageInfo::setName(const QString &name)
24{
25 mName = name;
26}
27
28QString LanguageInfo::longCode() const
29{
30 return mLongCode;
31}
32
33void LanguageInfo::setLongCode(const QString &longCode)
34{
35 mLongCode = longCode;
36}
37
38QString LanguageInfo::code() const
39{
40 return mCode;
41}
42
43void LanguageInfo::setCode(const QString &code)
44{
45 mCode = code;
46}
47
48bool LanguageInfo::isValid() const
49{
50 // We need code and name
51 return !mName.isEmpty() && !mCode.isEmpty();
52}
53
54void LanguageInfo::parse(const QJsonObject &obj)
55{
56 mName = obj["name"_L1].toString();
57 mCode = obj["code"_L1].toString();
58 mLongCode = obj["longCode"_L1].toString();
59}
60
61bool LanguageInfo::operator==(const LanguageInfo &other) const
62{
63 return mName == other.name() && mCode == other.code() && mLongCode == other.longCode();
64}
QString name(StandardAction id)
bool isEmpty() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:19:49 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.