QT6 源(82):阅读与注释日历类型 QCalendar,本类并未完结,儒略历,格里高利历原来就是公历,

(1)本代码来自于头文件 qcalendar . h

#ifndef QCALENDAR_H
#define QCALENDAR_H#include <limits>#include <QtCore/qglobal.h>
#include <QtCore/qlocale.h>
#include <QtCore/qstring.h>
#include <QtCore/qstringview.h>/* Suggested enum names for other calendars known to CLDR (v33.1)Not yet implemented - see QCalendar::System - contributions welcome:* Buddhist -- Thai Buddhist, to be specific* Chinese* Coptic* Dangi -- Korean* Ethiopic (Amete Mihret - epoch approx. 8 C.E.)* EthiopicAmeteAlem (Amete Alem - epoch approx. 5493 B.C.E; data fromtype="ethiopic-amete-alem", an alias for type="ethioaa")* Hebrew* Indian -- National* Islamic -- Based on astronomical observations, not predictions, so hard toimplement. CLDR's data for type="islamic" apply, unless overridden, to theother Islamic calendar variants, i.e. IslamicCivil, above, and the threefollowing. See QHijriCalendar, a common base to provide that data.* IslamicTabular -- tabular, astronomical epoch (same as IslamicCivil, exceptfor epoch), CLDR type="islamic-tbla"* Saudi -- Saudi Arabia, sighting; CLDR type="islamic-rgsa"* UmmAlQura -- Umm al-Qura, Saudi Arabia, calculated; CLDR type="islamic-umalqura"* Iso8601 -- as Gregorian, but treating ISO 8601 weeks as "months"* Japanese -- Imperial calendar* Minguo -- Republic of China, Taiwan; CLDR type="roc"See:http://www.unicode.org/repos/cldr/tags/latest/common/bcp47/calendar.xmlThese can potentially be supported, as features, using CLDR's data; anyothers shall need hand-crafted localization data; it would probably be bestto do that by contributing data for them to CLDR.
*/QT_BEGIN_NAMESPACEclass QCalendarBackend;
class QDate;/*
The QCalendar class describes calendar systems.QCalendar对象使用特定系统的规则将年、月和日数映射到特定的日期(最终由其儒略日数标识).默认的 QCalendar()是一个推算的格里高利历,没有零年。
通过启用合适的功能或加载插件,可以支持其他日历。
作为功能支持的日历可以通过将QCalendar:System 枚举传递给构造函数来构建。
所有支持过的日历在构建后都可以通过名称来构建。
(因此插件会实例化它们的日历后端以进行注册。)通过 QCalendar::System 可访问的内置后端也总是可以通过名称获取。使用自定义后端的时间表也可以在构建时使用分配给后端的-个唯-ID来构建。QCalendar值是不可变的。
*/class Q_CORE_EXPORT QCalendar
{Q_GADGETprivate:// Always supplied by QCalendarBackend and expected to be a singleton// Note that the calendar registry destroys all backends when it is itself// destroyed. The code should check if the registry is destroyed before// dereferencing this pointer.const QCalendarBackend * d_ptr;public:// (Extra parentheses to suppress bogus reading of min() as a macro.)enum : int { Unspecified = (std::numeric_limits<int>::min)() };struct YearMonthDay{YearMonthDay() = default;YearMonthDay(int y, int m = 1, int d = 1) : year(y), month(m), day(d) {}bool isValid() const{ return month != Unspecified && day != Unspecified; }// (The first year supported by QDate has year == Unspecified.)int year = Unspecified;int month = Unspecified;int day = Unspecified;};// Feature (\w+)calendar uses CLDR type="\1" data,// except as noted in type="..." comments belowenum class System{Gregorian, // CLDR: type = "gregory", alias = "gregorian"#ifndef QT_BOOTSTRAPPEDJulian = 8,Milankovic = 9,
#endif // These are Roman-based, so share Gregorian's CLDR data// Feature-controlled calendars:
#if QT_CONFIG(jalalicalendar) // type="persian"Jalali = 10,
#endif// type="islamic-civil", uses data from type="islamic"
#if QT_CONFIG(islamiccivilcalendar)IslamicCivil = 11,// tabular, civil epoch// 30 year cycle, leap on 2, 5, 7, 10, 13, 16, 18, 21, 24, 26 and 29// (Other variants: 2, 5, 8, (10|11), 13, 16, 19, 21, 24, 27 and 29.)
#endifLast = 11, // Highest number of any aboveUser = -1};// New entries must be added to the \enum doc in qcalendar.cpp and// handled in QCalendarBackend::fromEnum()Q_ENUM(System) //接入 Qt 的元对象系统class SystemId{size_t id;friend class QCalendarBackend;constexpr bool isInEnum() const{ return id <= size_t(QCalendar::System::Last); }constexpr explicit SystemId(QCalendar::System e) : id(size_t(e)) { }constexpr explicit SystemId(size_t i) : id(i) { }public:constexpr SystemId() : id(~size_t(0)) {}constexpr size_t index() const noexcept { return id; }constexpr bool isValid() const noexcept { return ~id; }};explicit QCalendar(); // Gregorian, optimisedexplicit QCalendar(System system);// ### Qt 7: removeexplicit QCalendar(QLatin1String name);// ### Qt 7: use QAnyStringViewexplicit QCalendar(QStringView name);explicit QCalendar(SystemId id);// QCalendar is a trivially copyable value type.bool isValid() const { return d_ptr != nullptr; }// Date queries:int    daysInMonth(int month, int year = Unspecified) const;int    daysInYear(int year) const;int  monthsInYear(int year) const;bool isDateValid(int year, int month, int day) const;// Leap years:bool isLeapYear(int year) const;// Properties of the calendar:bool  isGregorian() const;bool  isLunar    () const;bool  isLuniSolar() const;bool  isSolar    () const;bool  isProleptic() const;bool  hasYearZero() const;int   maximumDaysInMonth () const;int   minimumDaysInMonth () const;int   maximumMonthsInYear() const;QString name() const;// QDate conversions:QDate dateFromParts(int year, int month, int day) const;QDate dateFromParts(const YearMonthDay & parts) const;YearMonthDay partsFromDate(QDate date) const;int dayOfWeek(QDate date) const;// Month and week-day names (as in QLocale):QString monthName(          const QLocale & locale,int month, int year = Unspecified ,QLocale::FormatType format = QLocale::LongFormat) const;QString standaloneMonthName(const QLocale & locale,int month, int year = Unspecified ,QLocale::FormatType format = QLocale::LongFormat) const;QString weekDayName(          const QLocale & locale, int day,QLocale::FormatType format = QLocale::LongFormat) const;QString standaloneWeekDayName(const QLocale & locale, int day,QLocale::FormatType format = QLocale::LongFormat) const;// Formatting of date-times:QString dateTimeToString(QStringView format, const QDateTime & datetime,QDate dateOnly, QTime timeOnly,const QLocale & locale) const;// What's available ?static QStringList availableCalendars();}; //完结 class Q_CORE_EXPORT QCalendarQT_END_NAMESPACE#endif // QCALENDAR_H

(2)儒略历,格里高利历原来就是公历

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

(3)现代公历

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

(4)

谢谢

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/80030.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【C/C++】字符函数和字符串函数

文章目录 前言字符函数和字符串函数1.字符分类函数2.字符转换函数3.strlen的使用和模拟实现3.1 代码演示3.2 strlen返回值3.3 strlen的模拟实现 4.strcpy的使用和模拟实现4.1 代码演示4.2 模拟实现 5.strcat的使用和模拟实现5.1 代码演示5.2 模拟实现 6.strcmp的使用和模拟实现…

Spark-core-RDD入门

RDD基本概念 Resilient Distributed Dataset 叫做弹性分布式数据集&#xff0c;是Spark中最基本的数据抽象&#xff0c;是分布式计算的实现载体&#xff0c;代表一个不可变&#xff0c;可分区&#xff0c;里面的元素并行计算的集合。 - Dataset&#xff1a; 一个数据集合&…

缓存套餐-01.Spring Cache介绍和常用注解

一.Spring Cache 要使用直接导入坐标即可。 如何选择底层的缓存实现呢&#xff1f;只要导入对应的缓存坐标即可。如果要使用redis作为缓存实现&#xff0c;那么只需要导入redis的maven坐标。 二.常用注解 Cacheable&#xff1a;不光往缓存中写缓存数据&#xff0c;而且会从缓…

STM32智能空气净化器项目开发

一、项目概述 本空气净化器项目基于STM32F4系列微控制器&#xff0c;整合多传感器数据采集、环境参数显示、网络通信及执行机构控制等功能&#xff0c;实现智能化空气质量管理。项目采用FreeRTOS实时操作系统进行多任务调度&#xff0c;结合TFT触摸屏实现人机交互&#xff0c;…

[数据处理] 6. 数据可视化

&#x1f44b; 你好&#xff01;这里有实用干货与深度分享✨✨ 若有帮助&#xff0c;欢迎&#xff1a;​ &#x1f44d; 点赞 | ⭐ 收藏 | &#x1f4ac; 评论 | ➕ 关注 &#xff0c;解锁更多精彩&#xff01;​ &#x1f4c1; 收藏专栏即可第一时间获取最新推送&#x1f514;…

嵌入式学习笔记 - STM32 SRAM控制器FSMC

一 SRAM控制器内部结构图&#xff1a; 以下以512K SRAM芯片为例 二 SRAM地址矩阵/寻址方式&#xff1a; SRAM的地址寻址方式通过行地址与列地址交互的方式存储数据 三 STM32 地址映射 从STM32的地址映射中可以看出&#xff0c;FSMC控制器支持扩展4块外部存储器区域&#xff0…

python基础:序列和索引-->Python的特殊属性

一.序列和索引 1.1 用索引检索字符串中的元素 # 正向递增 shelloworld for i in range (0,len(s)):# i是索引print(i,s[i],end\t\t) print(\n--------------------------) # 反向递减 for i in range (-10,0):print(i,s[i],end\t\t)print(\n--------------------------) print(…

phpstudy升级新版apache

1.首先下载要升级到的apache版本&#xff0c;这里apache版本为Apache 2.4.63-250207 Win64下载地址&#xff1a;Apache VS17 binaries and modules download 2.将phpstudy中原始apache复制备份Apache2.4.39_origin 3.将1中下载apache解压&#xff0c; 将Apache24复制一份到ph…

开源业务流程:jBPM

一、什么是 jBPM&#xff1f; jBPM 是一个灵活的业务流程管理 (BPM) 套件。它不仅仅是一个流程引擎&#xff0c;而是一个集成了多种功能的平台&#xff0c;旨在帮助企业建模、自动化和监控业务流程。jBPM 遵循业界标准&#xff0c;特别是 BPMN 2.0&#xff08;业务流程模型和标…

JAVA:使用 JMH 进行基准测试的技术指南

1、简述 在性能优化中,写高效代码离不开准确的基准测试。而 Java 的 JIT 编译器会对代码进行优化(如方法内联、死代码消除等),导致简单的测试方法可能得不到真实的性能数据。这时候,JMH(Java Microbenchmark Harness)就派上用场了。 JMH 是 Java 官方提供的基准测试框…

Thinkphp开发自适应职业学生证书查询系统职业资格等级会员证书管理网站

环境&#xff1a;php7.2mysql5.7think伪静态 1.上传压缩包到服务器解压 2.还原数据库 3.配置数据库信息application/database.php 4.后台&#xff1a;http://你的域名/abc.php 用户&#xff1a;admin 密码&#xff1a;123456 程序说明&#xff1a; 【修复版】Thinkphp5开发的自…

(二)毛子整洁架构(CQRS/Dapper/领域事件处理器/垂直切片)

文章目录 项目地址一、Application 层1.1 定义CQRS的接口以及其他服务1. Command2. IQuery查询3. 当前时间服务接口4. 邮件发送服务接口 1.2 ReserveBooking Command1. 处理传入的参数2. ReserveBookingCommandHandler3. BookingReservedDomainEvent 1.3 Query使用Sql查询1. 创…

详解Redis

一.Redis的基本概念 首先&#xff0c;什么是Redis&#xff1f; Redis&#xff08;Remote Dictionary Server&#xff09;是一个开源的、高性能的键值对内存数据库&#xff0c;常被用作缓存、消息队列、分布式锁等。 二.Redis的基本数据类型 1. 字符串&#xff08;String&am…

智慧医院的可视化变革:可视化工具助力数字化转型

在科技飞速发展的当下&#xff0c;智慧医院已从概念逐步落地&#xff0c;深刻改变着传统医疗模式。它借助互联网、数字孪生及人工智能等前沿技术&#xff0c;在医疗服务领域掀起革新&#xff0c;涵盖面向医务人员的“智慧医疗”、面向患者的“智慧服务”以及面向医院的“智慧管…

Ubuntu Linux系统配置账号无密码sudo

在Linux系统中&#xff0c;配置无密码sudo可以通过修改sudoers文件来实现。以下是具体的配置步骤 一、编辑sudoers文件 输入sudo visudo命令来编辑sudo的配置文件。visudo是一个专门用于编辑sudoers文件的命令&#xff0c;它会在保存前检查语法错误&#xff0c;从而防止可能的…

graphviz和dot绘制流程图

graphviz和dot绘制流程图 指令 1.写后端需求文档 2.用中文输出结果 3.必须详细全面 4.必须搭配相关流程图step1:下载graphviz&#xff0c;https://graphviz.org/download/ step2&#xff1a;安装&#xff0c;记得添加环境变量 step3&#xff1a;验证是否安装成功 dot --versio…

MongoDB常用操作示例

以下是基于 MongoDB Shell 的完整操作示例&#xff0c;覆盖数据库管理、集合操作、文档处理、聚合分析、索引管理等核心功能&#xff0c;并结合实际场景说明。所有示例均结合搜索结果中的技术要点整理而成。 一、连接与配置管理 1. 启动 MongoDB Shell 并连接实例 # 默认连接…

C++ 模板方法模式详解与实例

模板方法模式概念​ 模板方法模式(Template Method Pattern)属于行为型设计模式,其核心思想是在一个抽象类中定义一个算法的骨架,而将一些步骤延迟到子类中实现。这样可以使得子类在不改变算法结构的情况下,重新定义算法中的某些步骤。它通过继承机制,实现代码复用和行为…

MySQL基础关键_012_事务

目 录 一、概述 二、ACID 四大特性 三、MySQL 事务 四、事务隔离级别 1.说明 2.现象 &#xff08;1&#xff09;脏读 &#xff08;2&#xff09;不可重复读 &#xff08;3&#xff09;幻读 3.查看隔离级别 4.设置隔离级别 5.隔离级别 &#xff08;1&#xff09;初始…

Hutool中的Pair类详解

1. Pair类概述 Hutool工具库中的Pair类是一个简单的键值对数据结构&#xff0c;用于存储两个相关联的对象。它类似于Map的Entry&#xff0c;但更加轻量级&#xff0c;适用于需要临时存储两个相关联数据的场景。 2. Pair类的主要特点 简单轻量&#xff1a;不依赖复杂的数据结…