Skip to content

Instantly share code, notes, and snippets.

View qingfengxia's full-sized avatar

Qingfeng Xia qingfengxia

View GitHub Profile
###########################################################################
# Copyright (c) 2020 Qingfeng Xia <qingfeng.xia_ukaea.uk> #
# #
# This file is part of the FreeCAD CAx development system. #
# #
# This library is free software; you can redistribute it and/or #
# modify it under the terms of the GNU Library General Public #
# License as published by the Free Software Foundation; either #
# version 2 of the License, or (at your option) any later version. #
# #
@qingfengxia
qingfengxia / enum_class_json_conversion.cpp
Last active April 23, 2023 18:11
example code to show c++ enum class to NLOHMANN json conversion
/*
NLOHMANN_JSON_SERIALIZE_ENUM expanded to inline functions, so this macro should be placed in header where enum class is declared
also this macro must be declared within enum type's namespace
```
// include loguru header here, declear enum NamedVerbosity
// this code injection happen in your project header file, no need to modify loguru.hpp
namespace loguru
{
// this macro must be called in the enum declaring namespace
@qingfengxia
qingfengxia / python_defensive_programming.ipynb
Last active November 1, 2019 10:22
python_defensive_programming.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.