C#: //todo

最近在看前辈留下来的祖传代码,发现里面有很多//todo的标记,在此进行一下说明。

简单来说,//todo就类似于我们看书时使用的书签,当我们为了某种功能预留下编程的入口,但是短时间内又没时间完成代码时就可以留下一个//todo标记,它仅仅代表着这里还有坑没填。在VS编程环境下,在视图菜单下会有一个任务列表的选项,我们打开这是视图,可以很方便的管理我们做出的//todo标记,跟书签一样,可以帮助我们快速定位。

 

 

# Cross-platform C++ BaseClass and TypeSystem, UnitSystem, Geometry (FreeCAD Base module) Extracted by Qingfeng Xia, 2019-2021 It is extracted from FreeCAD project, <https://github.com/FreeCAD/FreeCAD>, it has the same license as FreeCAD: LGPL v2.1+ This piece of code extraction personal work is NOT sponsored by Qingfeng Xia's employment. v0.19 master branch, Nov 13, 2021. ## Features Most features from FreeCAD Base module, except for XML related IO. Conversion from PyCxx to pybind11 will be experimented here. - `BaseClass` and TypeSystem for C++: extracted from FreeCAD's Base module if only TypeSystem is needed, this can be configured by cmake `set(FC_TYPESYSTEM_ONLY ON)` - Collection of some header only libraries to catch Python productivity: json, argparse - Design pattern: Factory, Observer - Unit and Quantity System - Fundametnal classes for gometry: Vector3D, Boundbox, Axis, Matrix, Quaternion, VievProjection, 2D Shapes, OpenInventor Builder3D Todo: - `std::shared_ptr<T>` replace all void* - python wrapping helper, using pybind11 ## BaseClass ### Java and C# base class C++ does not have a base/root class for all objects, but lot of other high level languages have. see For a few C++ framework like QT, VTK, GTK, there is base class to provide shared functions see: [QT: `QObject`](https://doc.qt.io/qt-5/qobject.html) [VTK: `vtkObjectBase` and `vtkObject`](https://vtk.org/doc/nightly/html/classvtkObjectBase.html) ### Typical functions of base class 1. type system, implemented by c++ macro 2. reference counting, C++11 shared_pointer<> has this function 3. event/observer/subscription pattern, depends on the design of the framework 4. serialization,`std::to_string` ### help on script wrapping ### Tutorial for C++ TypeSystem 1. header file In each class's header file (inc. header only class), `TYPESYSTEM_HEADER();` must be the first line of that class Just like `Q_CLASS` for Qt meta system. ``` class CClass : public Base::BaseClass { TYPESYSTEM_HEADER(); public: int d = 0; }; ``` 2. source file In very beginnning of the source file for that class, not within class scope. Or any other cpp file for header only class. `TYPESYSTEM_SOURCE(CClass, Base::BaseClass);` header only is not supported for static member data declaration. 3. main source file To use this type system: in `main()` or module initialization function (called in `main()`) ```c++ int main() { using namespace Base; Type::init(); // init the type system // then init each class (actually register this class type), including the BaseClass BaseClass::init(); // this root class must be initialized // user classes init, can be wrap in a module init() CClass::init(); Type::destruct(); return 0; } ``` see the [TypeTest source](TypeTest.cpp) ## Collection of Design pattern - Design Patterns in C++ with Real Examples <https://github.com/ehsangazar/design-patterns-cpp> - <https://github.com/JakubVojvoda/design-patterns-cpp> ### included design patterns - AbstractFactory - Observor ## Collection of some header only libraries - toml11: header only lib: https://github.com/ToruNiina/toml11 https://github.com/skystrife/cpptoml - python style C++17 argparse: https://github.com/p-ranav/argparse - json: https://nlohmann.github.io/json/ see more header-only open source libraries at :https://awesomeopensource.com/projects/header-only ## More doc in doc subfolder <doc/FreeCADBaseChangeLog.md> <doc/PythonBinding.md> <doc/TypeSystem.md>翻译
06-04
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值