REDROOM
PHP 8.3.31
Path:
Logout
Edit File
Size: 1.95 KB
Close
//opt/cpanel/ea-ruby27/src/passenger-release-6.1.2/build/support/vendor/cxxcodebuilder/README.md
Text
Base64
# cxxcodebuilder: generate C/C++ code with a Builder-style DSL Cxxcodebuilder gives you a simple Ruby API for programmatically outputting C/C++ code with proper indenting and formatting. Code using this API is much more readable than code building raw strings. Cxxcodebuilder is similar to [Jbuilder](https://github.com/rails/jbuilder), which is for outputting JSON. ## Use cases This library is useful in build systems for automatically generating C/C++ code. It is much cleaner compared to using ERB or other generic text templating systems for the job. ## Example Suppose that you want to write the following piece of code: ~~~c++ #include <stdio.h> static int limit = 0; static int magicNumbers[] = [1, 2, 3]; static Foo foos[] = [ { "hello", 1 }, { "world", 2 } ]; /* * This is an awesome model * for a futuristic car. */ struct Car { unsigned int seats; }; static int modifyLimit(int diff) { int oldLimit = limit; limit += diff; printf("The new limit is: %s\n", limit); return oldLimit; } ~~~ Use Cxxcodebuilder as follows: ~~~ruby require 'cxxcodebuilder' builder = CxxCodeBuilder::Builder.new do include '<stdio.h>' separator field 'static int limit', 0 field 'static int magicNumbers[]' do array_initializer do element 1 element 2 element 3 end end field 'static Foo foo[]' do array_initializer do struct_element do string_element 'hello' element 1 end struct_element do string_element 'world' element 2 end end end separator comment %q{ This is an awesome model for a futuristic car. } struct 'Car' do field 'unsigned int seats' end separator function('static int modifyLimit(int diff)', %q{ int oldLimit = limit; limit += diff; printf("The new limit is: %s\n", limit); return oldLimit; }) end puts(builder) ~~~ ## API See the comments in lib/cxxcodebuilder/builder.rb for the full API.
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 3 × Files: 9
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
.git
DIR
-
drwxr-xr-x
2026-02-11 07:32:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
lib
DIR
-
drwxr-xr-x
2026-02-11 07:32:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
spec
DIR
-
drwxr-xr-x
2026-02-11 07:32:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
.editorconfig
315 B
lrw-r--r--
2020-07-28 22:39:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
.gitignore
39 B
lrw-r--r--
2020-07-28 22:39:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
.rspec
26 B
lrw-r--r--
2020-07-28 22:39:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
CxxCodeBuilder.sublime-project
45 B
lrw-r--r--
2020-07-28 22:39:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Gemfile
55 B
lrw-r--r--
2020-07-28 22:39:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Gemfile.lock
529 B
lrw-r--r--
2020-07-28 22:39:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
LICENSE.md
1.04 KB
lrw-r--r--
2020-07-28 22:39:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Rakefile
80 B
lrw-r--r--
2020-07-28 22:39:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
README.md
1.95 KB
lrw-r--r--
2020-07-28 22:39:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).