$74 GRAYBYTE WORDPRESS FILE MANAGER $21

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.180
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/opt/cpanel/ea-ruby27/src/passenger-release-6.1.2/build/support/vendor/cxxcodebuilder/

HOME
Current File : /opt/cpanel/ea-ruby27/src/passenger-release-6.1.2/build/support/vendor/cxxcodebuilder//README.md
# 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.


Current_dir [ NOT WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
13 Feb 2026 9.30 AM
root / root
0755
.git
--
13 Feb 2026 9.30 AM
root / root
0755
lib
--
13 Feb 2026 9.30 AM
root / root
0755
spec
--
13 Feb 2026 9.30 AM
root / root
0755
.editorconfig
0.308 KB
28 Jul 2020 10.39 PM
root / root
0644
.gitignore
0.038 KB
28 Jul 2020 10.39 PM
root / root
0644
.rspec
0.025 KB
28 Jul 2020 10.39 PM
root / root
0644
CxxCodeBuilder.sublime-project
0.044 KB
28 Jul 2020 10.39 PM
root / root
0644
Gemfile
0.054 KB
28 Jul 2020 10.39 PM
root / root
0644
Gemfile.lock
0.517 KB
28 Jul 2020 10.39 PM
root / root
0644
LICENSE.md
1.039 KB
28 Jul 2020 10.39 PM
root / root
0644
README.md
1.952 KB
28 Jul 2020 10.39 PM
root / root
0644
Rakefile
0.078 KB
28 Jul 2020 10.39 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF