From f6f9a1fa91985062a04a56bda8b834abfc4a7bfd Mon Sep 17 00:00:00 2001 From: ankur0904 Date: Tue, 26 Dec 2023 22:16:37 +0530 Subject: [PATCH 1/3] docs: adds cplusplus constraint docs --- docs/constraints/Cplusplus.md | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 docs/constraints/Cplusplus.md diff --git a/docs/constraints/Cplusplus.md b/docs/constraints/Cplusplus.md new file mode 100644 index 0000000000..db8d5c7cd4 --- /dev/null +++ b/docs/constraints/Cplusplus.md @@ -0,0 +1,41 @@ +# C++ Constraints + +These are the C++ specific constraints applied to the MetaModel before reaching the presets. [Read here to get a more general idea on the overall process](../input-processing.md) of converting a MetaModel to a ConstrainedMetaModel. + +## Model Naming +These are the constraints that is applied to model naming. The `Rule key` is what you can use in the options to overwrite the default behavior. See [constraint customization](./README.md#Customization). + +|Rule key|Rule|Resolution| +|---|---|---| +|NO_SPECIAL_CHAR|No special characters| Special characters are replaced by their name, for example `!` is replaced with `exclamation`. For C++ `_` and `$` are an exception to this rule. | +|NO_NUMBER_START_CHAR|No numbers as starting characters|Default behavior is pre pending `number_` in front of the first character| +|NO_EMPTY_VALUE|No empty values|Default behavior is to use `empty` as name. | +|NO_RESERVED_KEYWORDS|No reserved keywords|C++ has a list of reserved keywords ([see the full list here](../../src/generators/cplusplus/Constants.ts))| +|NAMING_FORMATTER|Must be formatted equally|Model name is formatted using pascal case| + +## Property naming +These are the constraints that is applied to object properties and the naming of them. The `Rule key` is what you can use in the options to overwrite the default behavior. See [constraint customization](./README.md#Customization). +|Rule key|Rule|Resolution| +|---|---|---| +|NO_SPECIAL_CHAR|No special characters| Special characters are replaced by their name, for example `!` is replaced with `exclamation`. For C++ `_` and `$` are an exception to this rule. | +|NO_NUMBER_START_CHAR|No numbers as starting characters|Default behavior is pre pending `number_` in front of the first character| +|NO_EMPTY_VALUE|No empty values|Default behavior is to use `empty` as name. | +|NO_RESERVED_KEYWORDS|No reserved keywords|C++ has a list of reserved keywords ([see the full list here](../../src/generators/cplusplus/Constants.ts))| +|NAMING_FORMATTER|Must be formatted equally|Model name is formatted using pascal case| +|NO_DUPLICATE_PROPERTIES|No duplicate properties|If any of the above constraints changes the property name, we must make sure that no duplicates exist within the same object. If any is encountered `reserved_` is pre-pended. This is done recursively until no duplicates are found.| + + +## Enum key constraints +These are the constraints that is applied to enum keys. The `Rule key` is what you can use in the options to overwrite the default behavior. See [constraint customization](./README.md#Customization). + +|Rule key|Rule|Resolution| +|---|---|---| +|NO_SPECIAL_CHAR|No special characters| Special characters are replaced by their name, for example `!` is replaced with `exclamation`. For C++ `_` and `$` are an exception to this rule. | +|NO_NUMBER_START_CHAR|No numbers as starting characters|Default behavior is pre pending `number_` in front of the first character| +|NO_EMPTY_VALUE|No empty values|Default behavior is to use `empty` as name. | +|NO_RESERVED_KEYWORDS|No reserved keywords|C++ has a list of reserved keywords ([see the full list here](../../src/generators/cplusplus/Constants.ts))| +|NAMING_FORMATTER|Must be formatted equally|Model name is formatted using pascal case| +|NO_DUPLICATE_KEYS|No duplicate enum keys|If any of the above constraints changes the enum key, we must make sure that no duplicates exist within the same enum. If any is encountered `reserved_` is pre-pended. This is done recursively until no duplicates are found.| + +## Constant +These are the constraints that are applied to constants. Currently, there are no hooks one can overwrite inside it. From 5b84b03673061b6f2a5507f61ef23b28369a9061 Mon Sep 17 00:00:00 2001 From: Jonas Lagoni Date: Tue, 26 Dec 2023 19:48:04 -1000 Subject: [PATCH 2/3] Apply suggestions from code review --- docs/constraints/Cplusplus.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/constraints/Cplusplus.md b/docs/constraints/Cplusplus.md index db8d5c7cd4..108d724ced 100644 --- a/docs/constraints/Cplusplus.md +++ b/docs/constraints/Cplusplus.md @@ -21,7 +21,7 @@ These are the constraints that is applied to object properties and the naming of |NO_NUMBER_START_CHAR|No numbers as starting characters|Default behavior is pre pending `number_` in front of the first character| |NO_EMPTY_VALUE|No empty values|Default behavior is to use `empty` as name. | |NO_RESERVED_KEYWORDS|No reserved keywords|C++ has a list of reserved keywords ([see the full list here](../../src/generators/cplusplus/Constants.ts))| -|NAMING_FORMATTER|Must be formatted equally|Model name is formatted using pascal case| +|NAMING_FORMATTER|Must be formatted equally|Property naming is formatted using pascal case| |NO_DUPLICATE_PROPERTIES|No duplicate properties|If any of the above constraints changes the property name, we must make sure that no duplicates exist within the same object. If any is encountered `reserved_` is pre-pended. This is done recursively until no duplicates are found.| @@ -34,7 +34,7 @@ These are the constraints that is applied to enum keys. The `Rule key` is what y |NO_NUMBER_START_CHAR|No numbers as starting characters|Default behavior is pre pending `number_` in front of the first character| |NO_EMPTY_VALUE|No empty values|Default behavior is to use `empty` as name. | |NO_RESERVED_KEYWORDS|No reserved keywords|C++ has a list of reserved keywords ([see the full list here](../../src/generators/cplusplus/Constants.ts))| -|NAMING_FORMATTER|Must be formatted equally|Model name is formatted using pascal case| +|NAMING_FORMATTER|Must be formatted equally|Enum key is formatted using pascal case| |NO_DUPLICATE_KEYS|No duplicate enum keys|If any of the above constraints changes the enum key, we must make sure that no duplicates exist within the same enum. If any is encountered `reserved_` is pre-pended. This is done recursively until no duplicates are found.| ## Constant From e04ed20563fedb5a3acb2a38a0b1951d1c10b034 Mon Sep 17 00:00:00 2001 From: ankur0904 Date: Thu, 28 Dec 2023 00:03:39 +0530 Subject: [PATCH 3/3] Made changes from code review --- docs/constraints/Cplusplus.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/constraints/Cplusplus.md b/docs/constraints/Cplusplus.md index 108d724ced..e95c1e484e 100644 --- a/docs/constraints/Cplusplus.md +++ b/docs/constraints/Cplusplus.md @@ -7,22 +7,22 @@ These are the constraints that is applied to model naming. The `Rule key` is wha |Rule key|Rule|Resolution| |---|---|---| -|NO_SPECIAL_CHAR|No special characters| Special characters are replaced by their name, for example `!` is replaced with `exclamation`. For C++ `_` and `$` are an exception to this rule. | +|NO_SPECIAL_CHAR|No special characters| Special characters are replaced by their name, for example `!` is replaced with `exclamation`. For C++ `_` are an exception to this rule. | |NO_NUMBER_START_CHAR|No numbers as starting characters|Default behavior is pre pending `number_` in front of the first character| |NO_EMPTY_VALUE|No empty values|Default behavior is to use `empty` as name. | |NO_RESERVED_KEYWORDS|No reserved keywords|C++ has a list of reserved keywords ([see the full list here](../../src/generators/cplusplus/Constants.ts))| -|NAMING_FORMATTER|Must be formatted equally|Model name is formatted using pascal case| +|NAMING_FORMATTER|Must be formatted equally|Model name is formatted using snake case| ## Property naming These are the constraints that is applied to object properties and the naming of them. The `Rule key` is what you can use in the options to overwrite the default behavior. See [constraint customization](./README.md#Customization). |Rule key|Rule|Resolution| |---|---|---| -|NO_SPECIAL_CHAR|No special characters| Special characters are replaced by their name, for example `!` is replaced with `exclamation`. For C++ `_` and `$` are an exception to this rule. | +|NO_SPECIAL_CHAR|No special characters| Special characters are replaced by their name, for example `!` is replaced with `exclamation`. For C++ `_` are an exception to this rule. | |NO_NUMBER_START_CHAR|No numbers as starting characters|Default behavior is pre pending `number_` in front of the first character| |NO_EMPTY_VALUE|No empty values|Default behavior is to use `empty` as name. | |NO_RESERVED_KEYWORDS|No reserved keywords|C++ has a list of reserved keywords ([see the full list here](../../src/generators/cplusplus/Constants.ts))| -|NAMING_FORMATTER|Must be formatted equally|Property naming is formatted using pascal case| -|NO_DUPLICATE_PROPERTIES|No duplicate properties|If any of the above constraints changes the property name, we must make sure that no duplicates exist within the same object. If any is encountered `reserved_` is pre-pended. This is done recursively until no duplicates are found.| +|NAMING_FORMATTER|Must be formatted equally|Property naming is formatted using snake case| +|NO_DUPLICATE_PROPERTIES|No duplicate properties|If any of the above constraints changes the property name, we must make sure that no duplicates exist within the same object. If any is encountered `reserved_` is pre-pended. This is done recursively until no duplicates are found.| ## Enum key constraints @@ -30,11 +30,11 @@ These are the constraints that is applied to enum keys. The `Rule key` is what y |Rule key|Rule|Resolution| |---|---|---| -|NO_SPECIAL_CHAR|No special characters| Special characters are replaced by their name, for example `!` is replaced with `exclamation`. For C++ `_` and `$` are an exception to this rule. | +|NO_SPECIAL_CHAR|No special characters| Special characters are replaced by their name, for example `!` is replaced with `exclamation`. For C++ `_` are an exception to this rule. | |NO_NUMBER_START_CHAR|No numbers as starting characters|Default behavior is pre pending `number_` in front of the first character| |NO_EMPTY_VALUE|No empty values|Default behavior is to use `empty` as name. | |NO_RESERVED_KEYWORDS|No reserved keywords|C++ has a list of reserved keywords ([see the full list here](../../src/generators/cplusplus/Constants.ts))| -|NAMING_FORMATTER|Must be formatted equally|Enum key is formatted using pascal case| +|NAMING_FORMATTER|Must be formatted equally|Enum key is formatted using snake case| |NO_DUPLICATE_KEYS|No duplicate enum keys|If any of the above constraints changes the enum key, we must make sure that no duplicates exist within the same enum. If any is encountered `reserved_` is pre-pended. This is done recursively until no duplicates are found.| ## Constant