Skip to content

Commit

Permalink
Add QLocale
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasfella committed Oct 1, 2024
1 parent 64b8257 commit 7a3503e
Show file tree
Hide file tree
Showing 7 changed files with 639 additions and 5 deletions.
2 changes: 2 additions & 0 deletions crates/cxx-qt-lib-extras/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ fn main() {
"core/qelapsedtimer",
"core/qcommandlineoption",
"core/qcommandlineparser",
"core/qlocale",
"gui/qapplication",
];

Expand All @@ -67,6 +68,7 @@ fn main() {
"core/qelapsedtimer",
"core/qcommandlineoption",
"core/qcommandlineparser",
"core/qlocale",
"gui/qapplication",
];

Expand Down
28 changes: 28 additions & 0 deletions crates/cxx-qt-lib-extras/include/core/qlocale.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// clang-format off
// SPDX-FileCopyrightText: 2024 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
// clang-format on
// SPDX-FileContributor: Nicolas Fella <[email protected]>
//
// SPDX-License-Identifier: MIT OR Apache-2.0
#pragma once

#include <QtCore/QLocale>

#include "rust/cxx.h"

namespace rust {

template<>
struct IsRelocatable<QLocale> : ::std::true_type
{};

namespace cxxqtlib1 {

using QLocaleTagSeparator = QLocale::TagSeparator;
using QLocaleCurrencySymbolFormat = QLocale::CurrencySymbolFormat;
using QLocaleFormatType = QLocale::FormatType;
using QLocaleLanguage = QLocale::Language;
using QLocaleMeasurementSystem = QLocale::MeasurementSystem;

}
}
6 changes: 6 additions & 0 deletions crates/cxx-qt-lib-extras/src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ pub use qcommandlineoption::QCommandLineOption;

mod qcommandlineparser;
pub use qcommandlineparser::QCommandLineParser;

mod qlocale;
pub use qlocale::{
QLocale, QLocaleCurrencySymbolFormat, QLocaleFormatType, QLocaleLanguage,
QLocaleMeasurementSystem, QLocaleTagSeparator,
};
17 changes: 17 additions & 0 deletions crates/cxx-qt-lib-extras/src/core/qlocale.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// clang-format off
// SPDX-FileCopyrightText: 2024 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
// clang-format on
// SPDX-FileContributor: Nicolas Fella <[email protected]>
//
// SPDX-License-Identifier: MIT OR Apache-2.0
#include "cxx-qt-lib-extras/qlocale.h"
#include <cxx-qt-lib/assertion_utils.h>

assert_alignment_and_size(QLocale, { ::std::size_t a0; });

static_assert(!::std::is_trivially_copy_assignable<QLocale>::value);
static_assert(!::std::is_trivially_copy_constructible<QLocale>::value);

static_assert(!::std::is_trivially_destructible<QLocale>::value);

static_assert(QTypeInfo<QLocale>::isRelocatable);
Loading

0 comments on commit 7a3503e

Please sign in to comment.