VCCModuel / VCCProjectGenerator / VCCProjectGenerator VSCode ExtensionVersioning Common Codebase Project / Versioning Coding Cooperation ProjectCross plaform project to handle Any Interface with C++ dll. Maintain those standard already stable long time ago. No reason to implement twice. Current Stage Objective: Start VCC Project Manager (Multi Project Handling), including Java Interface, Thread, Form, Action, Git. Note: Still in initialize version, will have full review when official release Sample Program: To get sample, can download this project from github, then 1. go to vpg_vcc_generation_manager_test.cpp 2. change GETSET(bool, IsCopyDebugFolderToTestFolder, false); to GETSET(bool, IsCopyDebugFolderToTestFolder, true; 3. make unittest -j10 4. file will be generated to TestFolder mensioned in vpg_vcc_generation_manager_test.cpp What's newGenerate Java Enum according to C++ Enum Class under Type Workspace Note: vcc.json description is outdated, will update after generate java bridge What's nextGenerate Java Class according to C++ Enum Class under Type Workspace Features
Options
Pre-RequirementMust already install following before execute VCCProjectGenerator and VCCProjectGenerator VSCode Extension. Or can download the template from git directly.
Procedcure of Extension
If dont want to download extra project, please download following git manually and follow instruction listed in Makefile to adjust.
Build C++ projectFollow the instruction listed in Makefile when compile enter following command in terminal: To build debug
To build unittest only
To build release
To clean project
Other command can be refer to Makefile Debug program is built in bin/Debug Release program is built in bin/Release Optional
Execute C++ project in VScode
Compare to AI Code Generation
VCCModule FeatureStatus:
Core:
Common:
Module:
UI:
Pending
Known Issue
Versioning Common Codebase Project / Versioning Coding Cooperation Project IntroductionDocument versioning are highly expected but seems no solution at the moment. Also, current existing document processors have straight behavior, such as auto creating style which make characters disappeared, saving whole document for each save, lagging for large document, etc. Unfortunately, seems that those behaviors are not bug. Enhancement cannot be expected. So, Versioning Coding Cooperation Project is introducted to develop a document versioning system. In order to implement versioning document program, document processor and git manager are need to be implemented at the same time. To speed up, a generator is required to manage those projects. So, there are totally 3 programs need to be written at the same times. When starting a new project, it is time consuming to create basic structure. And rewrite codebase is time consuming. In fact, all projects have similar structure and lots of similar functions. Versioning Common Codebase Project is raised to extract common factor to enhance development efficience. Versioning Common Codebase Project MembersVCC Module is a combination of Interface + C++ DLL. Most process are included in C++ DLL to minimize effort for cross-platform. At the moment, only consider to support Java UI (Window, Linux and Android) and Swift UI (Mac OS and iOS). For view object details, please visit corresponding Git response to check ReadMe.md Template
Features
Expected Features
Manager
Expected Features
Features
Expected Features
Versioning Coding Cooperation Project Members
Versioning Coding Cooperation Project / Versioning Common Codebase Project Common Members
Versionin Common Codebase Project - Project Generator Feature
Versionin Common Codebase Project GeneratorSample Program: To get sample, can download this project from github, then 1. go to vpg_vcc_generation_manager_test.cpp 2. change GETSET(bool, IsCopyDebugFolderToTestFolder, false); to GETSET(bool, IsCopyDebugFolderToTestFolder, true; 3. make unittest -j10 4. file will be generated to TestFolder mensioned in vpg_vcc_generation_manager_test.cpp Pre-Requirement
Compile
Procedure for Add or Update
Command - Versionvpg -Version Description: Get Current Version of Generator. Command - Addvpg -Add -interface [-project-prefix ] [-project-name ] [-exe-name ] [-dll-name ] [-workspace-destination ] [-plugins ] [--ExcludeUnitTest] [--ExcludeExternalUnitTest] -project-prefix : CPPDLL, CPPEXE, CPPCOMPLEX, VCCDLL, VCCEXE, VCCCOMPLEX CPPDLL: C++ DLL CPPEXE: C++ EXE CPPCOMPLEX: C++ DLL + EXE VCCDLL: VCC DLL VCCEXE: VCC EXE VCCCOMPLEX: VCC DLL + EXE -project-name Recommand. If not state, need to modify vcc.json and Makefile manually. -exe-name Recommand. Only for EXE and Complex mode. If not state, need to modify vcc.json and Makefile manually. -dll-name Recommand. Only for DLL and Complex mode. If not state, need to modify vcc.json and Makefile manually. -workspace-destination Target workspace. If not state, then current workspace. -plugins Can state multiple times. It is the same as the list in vcc.json. --ExcludeUnitTest Exclude gtest. --ExcludeExternalUnitTest Exclude VCC unitest. If full trust VCC git source, then can skip to speed up. If need to customize, recommand to keep it. Description: Generate project from template. Command - Updatevpg -Update [-workspace-destination ]workspace -workspace-destination Target workspace. If not state, then current workspace. Description: Only for VCC Module. Other properties are overriden by vcc.json. First update template to the version that same as VCCProjectGenerator. Then compare different and update the files in workspace. Details: vcc.json, Update Rule. Command - Generatevpg -Generate [-workspace-destination ]workspace Description: Only for VCC Module. Other properties are overriden by vcc.json. Details: vcc.json, Generate Rule. vcc.jsonFor VCCModule, there is vcc.json. Update Mode and Generate Mode fully depends on vcc.json. Can include this to .gitignore file. ProperiesVersion Current VCCModule Version. Please manaully update while manually update Project from git source. ProjectType VCCModule. Reserve for other project type, such as Java and Swift. WorkspaceSourceGitUrl Git source. WorkspaceDestination Current workspace. Just for referece. ProjectPrefix In generation mode, generator only read file with that prefix and generate class with that prefix. It is used to distinguish different project if having multi dll. E.g. "ProjectPrefix": "VPG" Generator only read file have prefix vpg_* and generate class as VPGObject ProjectName Project name. ProjectNameDll DLL name. If does not compile dll, keep it empty. Will auto update Makefile and related files (Enhancement in next version). ProjectNameExe EXE name. If does not compile exe, keep it empty. Will auto update Makefile and related files (Enhancement in next version). ProjectNameGtest gtest folder name. Although can have rename to the other name, but keep it unittest is advise. If does not compile unittest, keep it empty. Will auto update Makefile and related files (Enhancement in next version). IsGit If true, then generate .gitignore. IsExcludeVCCUnitTest If true, then skip update unittest/External/VCC/ TypeWorkspace In Generation mode, generator will search file with suffix *_property.hpp to create Class, Property Accessor etc. Detail: Generation Rule. ActionTypeDirectory, ExceptionTypeDirectory, ManagerTypeDirectory, ObjectTypeDirectory The location to export action_type.hpp, exception_type.hpp, manager_type.hpp, object_type.hpp All are used to export to interface. Cannot delete those files. action_type may be moved to External/VCC/Form/Action/ in the future such that action can be optional. ModelDirectory In Generation mode, class files are generated here. PropertyAccessorDirectoryHpp In Generation mode, property accessor hpp files are generated here. Not support in current version. PropertyAccessorDirectoryCpp In Generation mode, property accessor cpp files are generated here. Not support in current version. Plugins In Update mode, generator will copy folders under include/External, src/External, unittest/External to workspace. Option: VCC/Versioning/Git Update RuleProcedure:
Generate RuleThe final objective is that user only need to handle enum class like sql table and logic in service and manager only. Other thing will be auto generate. Note:
Definition of Program Structure Class: C++ Class. Data storage. Structure: C++ Structure. Used to support huge data process. Not support at the moment. PropertyAccessor: Bridge between Control and model. Provide thread safe access, validation, trigger etc. Not support at the moment. Service: Class with static function only. It is used to provide logic. Manager: Class with model. Call service to modify model. Form: Class with Manager. Call Manager to do action. Definition of Enum Class Class Property file: file name with format projectPrefix_objectName_property.hpp If project prefix is defined in vcc.json, then all files and classes that not having project prefix will be skipped. Enum Class file: file name with format projectPrefix_enumName.hpp; If project prefix is defined in vcc.json, then all files and classes that not having project prefix will be skipped. All enum that used in class must be defined in TypeWorkspace. Otherwise will have compile error. Restriction
Procedure 1. Read all files in TypeWorkspace. 2. For all Class Property file, will generate Class file etc. 3. All Enum Class File will export to interface like java etc. (Not implement yet) Documentation// {Class Attribute} enum class EnumClassName { EnumA, // {Field Attribute} EnumB, // {Field Attribute} EnumC, // {Field Attribute} }; Class Attribute// [@@Json { "Key.NamingStyle" : "PascalCase", "Value.DecimalPlaces":2 }] []: Optional @@: Key for attributes. Need to state for attribute {}: Json format to describe Json file [@@Json { "Key.NamingStyle" : "PascalCase", "Value.DecimalPlaces":2 }] Generate Class as Json Object. Class will have attribute ToJson, SerializeJson and DeserializeJson Attribute: Key.NamingStyle Value can be following | Value | Result | | --- | --- | | CamelCase | camelCase | | ConstantCase | CONSTANT_CASE | | DotSeparatedLowercase | dot.seperated.lowercase | | KebabCase | kebab-case | | Lowercase | lowercase | | PascalCase | PascalCase | | ScreamingSnakeCase | SCREAMING_SNAKE_CASE | | SnakeCase | snake_case | | Uppercase | UPPERCASE |
Field AttributeEnum // {ClassMacro} [@@AccessMode] {...}: Compulsory []: Optional @@: Key for attributes. Need to state for attribute {Enum} Enum class enum. Used in property Accessor {ClassMacro} Getter, Setter stated in class_macro.hpp. If it is not match with any class macro in class_macro.hpp, the rest will be ignored [@@AccessMode] Default is @@ReadWrite. Option: @@ReadWrite Allow Read and Write through Property Accessor @@ReadOnly Allow Read Only via Property Accessor @@WriteOnly Allow Write Only via Property Accessor @@NoAccess Cannot Access via Property Accessor Example
Export to JavaAssume that using Maven Java Project. The library will be compiled to resources folder. For MacOS, only test with M Chips. Please put following code to Pom. Only test for version >= 5.14.0.
Note: NetBeans cannot find net.java.dev.jna, It can only find old version com.sun.jna. After verison 3.0.0, con.sun.jna has been renamed as net.java.dev.jna but the import files still called com.sun.jna. For the com.sun.jna version, it does not support Mac M Chips and throw linkage error. Note: When using jna, when we put "vpg" as dll name, it will auto searh with the libaray with name libvpg.dylib under src/main/resources Please having lib name with libxxx.dylib format
Java Type MappingAccording to JNA (Java Native Access), here is the map of types between c++ and Java. Better to use below type only. If not using below type, generator will use static cast. | C++ Type | Java Type | | --- | --- | | char | byte | | short | short | | wchart_t | char | | int | int | | bool | boolean | | long | NativeLong | | long long | long | | float | float | | double | double | | char* | String | | void* | pointer | Versioning Common Codebase Project Generator VSCode ExtensionPre-RequirementSame as Versionin Common Codebase Project Generator Clone from gitAfter download from git please enter following to terminal
Procedure
OptionsThere are serveral options. (workspace means first workspace shown in project tree of VSCode) Details refer to Versionin Common Codebase Project Generator.
HistoryThe project is start from 2022-06-22. As Document Versioning is needed but no solution can be found. Also, existing document processors have some interesting behaviour, such as When save, will save from beginning. Auto create new style which will make charactors hiden. When press Enter at Title, the new line will have new style that make the content disappear. When having outline then save, document cannot save correctly. The Index cannot recognize item number. When save, item numbers disappear. When handling thousand pages document, it lags. Some will hang and quit. Docx cannot save as docx by default. Cannot save in local storage by default. Security Problem. etc. As those problems have not been solve until 2022-06-22, I believe that they are properties instead of bugs. I better to write a document processor myself. When I try to write a document processor with versioning, I find that I should write a git application instead of document processor. But I need to write a document processor before creating a git application project. As most codes are mechanical work, I write a code generator to write those projects instead of writing one by one. So, I need to write 3 applications. Firstly, I try to use SwiftUI + dynamic library first as I don’t need to create website and handle payment progess. But I can find no way to create virtual ListView. Secondly, as SwiftUI seems difficult to me, I try to use C# + dynamic library as I am experienced in C#. But I found that Linux and MacOS does not support C# and Visual Studio does not support multi-platform, then I give up. Thirdly, I try to use Java + dynamic library as Java is multiplatform. But I find that NetBeans has not supported C++ long time ago. Finally, I try to use VSCode with g++. Then I try about one month to setup the makefile. In fact, there are no templates for multiplatform with gtest. I need to study and write makefiles (both library and executable) from the beginning. In fact, I have used about 6 months to investigate. I think I better write a program to skip one year effort. In fact, the first release is 2024-05-05, I have used one and a half year (although I can only write the code at weekend and after work) to write basic structure, which is not complete yet. Hope everyone can skip at least 2 years effort and dont need to ask same question again and again. How to ContributeIt is my first git opensource project. In fact, I don't know what to do. If you want to have new feature or report bugs, please tell me via GitHub or X(Twitter). If you want to contribute, please create branch and tell me to merge when finished. I may need to modify the code to fit the style Note that it is open source no license coorporation project, code will be modified without notification. ContactX(Twitter) @VCCProject Release Log[v0.1.4] - 2024-08-25: Java Bridge: Generation - Java Bridege for Enum
[v0.1.3] - 2024-07-28: Generation - Dll Interface for Property Accessor
[v0.1.2] - 2024-07-14: Java Bridge: Generation - Create Class as Json Object with
[v0.1.1] - 2024-07-08: Java Bridge: Self Writing
[v0.1.0] - 2024-07-07: Java Bridge: Prepare for generate Java Bridge
[v0.0.5] - 2024-06-02: Basic Strucute: Property Accessor and Thread safe
[v0.0.4] - 2024-05-19: Basic Strucute: Merge XML and Improve Try Catch
[v0.0.3] 2024-05-06: Basic Strucute: Update project according to vcc.json
[v0.0.2] 2024-05-05: Basic Strucute: Urgent Fix
[v0.0.1] 2024-05-05: Basic Strucute: Initialize
|