Giter Site home page Giter Site logo

clangTools 使用教程

编译状态 build status

build status : C/C++ CI

支持

如果有任何需要,可以联系我:

[email protected]

[email protected]

If you need anything, please contact me :

[email protected]

[email protected]

支持功能

Base64, ConfigTool, http, JSON, logger, memory_share, openssl, Pipe, poll_tool, Popen, SHA1, socket, subprocess, thread_pool, date, xml i2c_tool libusb_1_tool opencv_tool Hzk_tool plthook(here) BMP-C(here) littlefs(here)

date

一个简单的时间格式库

使用方式:testDate.cpp

//
// Created by caesar kekxv on 2024/6/14.
//
#include <date.hpp>
#include <iostream>
#include <regex>

int main(int argc, const char *argv[]) {
  const auto date1 = clangTools::date::parse(1718372061);
  std::cout << __LINE__ << ":" << date1->format() << std::endl;
  const auto date2 = clangTools::date::parseMicroseconds(1718372061000);
  std::cout << __LINE__ << ":" << date2->format() << std::endl;
  const auto date3 = clangTools::date::parse(2024, 06 - 1, 14);
  std::cout << __LINE__ << ":" << date3->format() << std::endl;
  const auto date4 = clangTools::date::parse(2024, 06 - 1, 32, 8, 59);
  std::cout << " " << date4->format("yyyy-MM-dd HH:mm:ss");
  std::cout << "\t" << "yyyy-MM-dd HH:mm:ss" << std::endl;
  std::cout << " " << *date4;
  std::cout << "\t" << "yyyy-MM-dd HH:mm:ss" << std::endl;
  std::cout << " " << date4->format("yyyy+1-MM-1-dd HH:mm:ss");
  std::cout << "\t" << "yyyy+1-MM-1-dd HH:mm:ss" << std::endl;
  std::cout << " " << date4->format("yyyy--06-dd HH:mm:ss");
  std::cout << "\t" << "yyyy--06-dd HH:mm:ss" << std::endl;
  std::cout << " " << date4->clone("yyyy-1-MM+1-dd HH:mm:ss")->format("yyyy-MM-dd HH:mm:ss");
  std::cout << "\t" << "yyyy-1-MM+1-dd HH:mm:ss" << "_" << "yyyy-MM-dd HH:mm:ss" << std::endl;
  std::cout << " " << date4->format("yyyy--07--02 HH:mm:ss");
  std::cout << "\t" << "yyyy--07--02 HH:mm:ss" << std::endl;
  std::cout << "\t" << date1 << std::endl;
  std::cout << "\t" << date2 << std::endl;
  std::cout << "\t" << (date1 == date2) << std::endl;
  return 0;
}

输出:

10:2024-06-14 21:34:21
12:2024-06-14 21:34:21
14:2024-06-14 00:00:00
 2024-07-02 08:59:00	yyyy-MM-dd HH:mm:ss
 2024-07-02 08:59:00	yyyy-MM-dd HH:mm:ss
 2025-06-02 08:59:00	yyyy+1-MM-1-dd HH:mm:ss
 2024-06-02 08:59:00	yyyy--06-dd HH:mm:ss
 2023-08-02 08:59:00	yyyy-1-MM+1-dd HH:mm:ss_yyyy-MM-dd HH:mm:ss
 2024-07-02 08:59:00	yyyy--07--02 HH:mm:ss
	2024-06-14 21:34:21
	2024-06-14 21:34:21
	1

i2c_tool

Linux 接口,用于Linux以及嵌入式设备。需要添加参数 -DENABLE_I2C=ON 开启。

spi_tool

Linux 接口,用于Linux以及嵌入式设备。需要添加参数 -DENABLE_SPI=ON 开启。

引入方式

# 添加 clangTools 模块
add_subdirectory(clangTools)
# 设置模块目录
set(libTools_DIR "${CMAKE_CURRENT_SOURCE_DIR}/clangTools")
# 引入 clangTools 模块变量
include(clangTools/libTools.cmake)
# 设置 Windows 下使用 MT 模式(非MD模式)
include(clangTools/cmake/MSVC.cmake)
# 加入头文件目录
include_directories(${libTools_INCLUDE_DIR})
# 链接 clangTools 模块变量 : ${libTools_LIBRARIES}


option(ENABLE_FILENAME "option for FILENAME" ON)
if (ENABLE_FILENAME)
    #重新定义当前目标的源文件的 __FILENAME__ 宏
    redefine_file_macro(目标)
endif ()

bazel 支持

本项目部分支持 bazel

build status : C/C++ CI

demo

clock oled

编译树莓派 时钟 OLED 程序可以使用以下参数:

cmake -DENABLE_CURL=ON -DENABLE_OPENCV=ON -DENABLE_HZK=ON -DENABLE_I2C=ON -DENABLE_SPI=ON -DENABLE_OLED=ON -DENABLE_FREETYPE=ON -DENABLE_ICONV=ON -DENABLE_OLED_TOOL=ON <cmake-source-dir>
make clock_oled

将会在 ssd1306 oled (128x64) 屏幕上显示日期温度天气时间IP地址

致谢

非常感谢 JetBrains 为本项目提供开源项目授权。

Thank you JetBrains for providing open source project authorization for this project.

ClangTools's Projects

openjpeg icon openjpeg

Official repository of the OpenJPEG project

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.