JezK
Edit File: page-ConfigurationFields_hpp_cxxcodebuilder.ri
U:RDoc::TopLevel[ i I">src/apache2_module/ConfigurationFields.hpp.cxxcodebuilder:ETcRDoc::Parser::Simpleo:RDoc::Markup::Document:@parts[ o:RDoc::Markup::Paragraph;[I"># Phusion Passenger - https://www.phusionpassenger.com/ ;TI"5# Copyright (c) 2010-2016 Phusion Holding B.V. ;TI"# ;TI"L# "Passenger", "Phusion Passenger" and "Union Station" are registered ;TI"+# trademarks of Phusion Holding B.V. ;TI"# ;TI"U# Permission is hereby granted, free of charge, to any person obtaining a copy ;TI"V# of this software and associated documentation files (the "Software"), to deal ;TI"U# in the Software without restriction, including without limitation the rights ;TI"R# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ;TI"N# copies of the Software, and to permit persons to whom the Software is ;TI"A# furnished to do so, subject to the following conditions: ;TI"# ;TI"S# The above copyright notice and this permission notice shall be included in ;TI"<# all copies or substantial portions of the Software. ;TI"# ;TI"S# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;TI"Q# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;TI"T# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ;TI"O# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ;TI"V# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ;TI"R# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ;TI"# THE SOFTWARE.;To:RDoc::Markup::BlankLine o; ;[I"=# This file uses the cxxcodebuilder API. Learn more at: ;TI"0# https://github.com/phusion/cxxcodebuilder;T@$o; ;[I"7require 'phusion_passenger/apache2/config_options';T@$o; ;[I" def main;To:RDoc::Markup::Verbatim;[!I"/comment copyright_header_for(__FILE__), 1 ;TI" ;TI"separator ;TI" ;TI"comment %q{ ;TI"g ConfigurationFields.hpp is automatically generated from ConfigurationFields.hpp.cxxcodebuilder, ;TI"_ using definitions from src/ruby_supportlib/phusion_passenger/apache2/config_options.rb. ;TI"6 Edits to ConfigurationFields.hpp will be lost. ;TI" ;TI"* To update ConfigurationFields.hpp: ;TI" rake apache2 ;TI" ;TI"9 To force regeneration of ConfigurationFields.hpp: ;TI": rm -f src/apache2_module/ConfigurationFields.hpp ;TI"9 rake src/apache2_module/ConfigurationFields.hpp ;TI"} ;TI" ;TI"separator ;TI" ;TI"(struct 'GeneratedDirConfigPart' do ;TI"> add_code 'enum Threeway { ENABLED, DISABLED, UNSET };' ;TI" ;TI"( definitions.each do |definition| ;TI" separator ;TI" comment(definition[3]) ;TI" field(definition[0]) ;TI" end ;TI" end ;T:@format0o; ;[I"end;T@$o; ;[I")def filter_eligible_options(options);To;;[ I" options.reject do |option| ;TI" option[:alias_for] || ;TI", option.fetch(:field, true).nil? || ;TI"% option[:field].to_s =~ /\./ ;TI" end ;T;0o; ;[I"end;T@$o; ;[I"!def struct_field_for(option);To;;[I" if option.has_key?(:field) ;TI" option[:field] ;TI" else ;TI"4 result = option[:name].sub(/^Passenger/, '') ;TI") result[0] = result[0..0].downcase ;TI" result ;TI" end ;T;0o; ;[I"end;T@$o; ;[I"J# Returns [definition_source, estimated_size_on_x86_64, description] ;TI"def definition_for(option);To;;[I"&field = struct_field_for(option) ;TI"case option[:type] ;TI"when :string ;TI"F result = ["const char *#{field}", 8 + 4, field, option[:desc]] ;TI"when :integer ;TI": result = ["int #{field}", 4, field, option[:desc]] ;TI"when :flag ;TI"? result = ["Threeway #{field}", 1, field, option[:desc]] ;TI" else ;TI"X raise "Unknown option type #{option[:type].inspect} for option #{option[:name]}" ;TI" end ;TI"result + [option[:desc]] ;T;0o; ;[I"end;T@$o; ;[I"def definitions;To;;[I"@definitions ||= begin ;TI"[ eligible_options = filter_eligible_options(APACHE2_DIRECTORY_CONFIGURATION_OPTIONS) ;TI"D definitions = eligible_options.map { |o| definition_for(o) } ;TI"K # Sort the definitions by size in order to make the struct smaller. ;TI"T # It's possible to make it even smaller with a smarter algorithm but for now ;TI" # I don't bother. ;TI"% definitions.sort! do |d1, d2| ;TI" if d1[1] == d2[1] ;TI"9 # After sorting on size, sort alphabetically. ;TI" d1[2] <=> d2[2] ;TI" else ;TI" d1[1] <=> d2[1] ;TI" end ;TI" end ;TI" end ;T;0o; ;[I"end;T@$o; ;[I" main;T: @file@:0@omit_headings_from_table_of_contents_below0