diff options
Diffstat (limited to 'sources/shiboken2/ApiExtractor/abstractmetalang.cpp')
-rw-r--r-- | sources/shiboken2/ApiExtractor/abstractmetalang.cpp | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp index 8e1f0d7e5..9d770284a 100644 --- a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp +++ b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2019 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt for Python. @@ -88,6 +88,49 @@ const AbstractMetaClass *recurseClassHierarchy(const AbstractMetaClass *klass, } /******************************************************************************* + * Documentation + */ + +Documentation::Documentation(const QString &value, Documentation::Type t, Documentation::Format fmt) +{ + setValue(value, t, fmt); +} + +bool Documentation::isEmpty() const +{ + for (int i = 0; i < Type::Last; i++) { + if (!m_data.value(static_cast<Type>(i)).isEmpty()) + return false; + } + return true; +} + +QString Documentation::value(Documentation::Type t) const +{ + return m_data.value(t); +} + +void Documentation::setValue(const QString &value, Documentation::Type t, Documentation::Format fmt) +{ + const QString v = value.trimmed(); + if (v.isEmpty()) + m_data.remove(t); + else + m_data[t] = value.trimmed(); + m_format = fmt; +} + +Documentation::Format Documentation::format() const +{ + return m_format; +} + +void Documentation::setFormat(Documentation::Format f) +{ + m_format = f; +} + +/******************************************************************************* * AbstractMetaVariable */ |