mirror of
https://github.com/Ed94/gencpp.git
synced 2024-12-21 23:34:44 -08:00
Update main readme (old example code)
This commit is contained in:
parent
6d551e95b9
commit
04ae75c698
20
Readme.md
20
Readme.md
@ -79,18 +79,18 @@ Example using each construction interface:
|
|||||||
Validation and construction through a functional interface.
|
Validation and construction through a functional interface.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
Code t_uw = def_type( name(usize) );
|
CodeTypename t_uw = def_type( name(usize) );
|
||||||
Code t_allocator = def_type( name(allocator) );
|
CodeTypename t_allocator = def_type( name(allocator) );
|
||||||
Code t_string_const = def_type( name(char), def_specifiers( args( ESpecifier::Const, ESpecifier::Ptr ) ));
|
CodeTypename t_string_const = def_type( name(char), def_specifiers( args( ESpecifier::Const, ESpecifier::Ptr ) ));
|
||||||
|
|
||||||
Code header;
|
CodeStruct header;
|
||||||
{
|
{
|
||||||
Code num = def_variable( t_uw, name(Num) );
|
CodeVar num = def_variable( t_uw, name(Num) );
|
||||||
Code cap = def_variable( t_uw, name(Capacity) );
|
CodeVar cap = def_variable( t_uw, name(Capacity) );
|
||||||
Code mem_alloc = def_variable( t_allocator, name(Allocator) );
|
CodeVar mem_alloc = def_variable( t_allocator, name(Allocator) );
|
||||||
Code body = def_struct_body( args( num, cap, mem_alloc ) );
|
CodeBody body = def_struct_body( args( num, cap, mem_alloc ) );
|
||||||
|
|
||||||
header = def_struct( name(ArrayHeader), __, __, body );
|
header = def_struct( name(ArrayHeader), { body });
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ Code header;
|
|||||||
Validation through ast construction.
|
Validation through ast construction.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
Code header = parse_struct( code(
|
CodeStruct header = parse_struct( code(
|
||||||
struct ArrayHeader
|
struct ArrayHeader
|
||||||
{
|
{
|
||||||
usize Num;
|
usize Num;
|
||||||
|
Loading…
Reference in New Issue
Block a user