Sha256: 929f1bb07f2b94496e796218306875ba077b0ca299449a22ba10ed393780718e

Contents?: true

Size: 497 Bytes

Versions: 4

Compression:

Stored size: 497 Bytes

Contents

require 'ludy/tasks/common'

module Kernel
private
# C/C++ header guard generator, you shold provide the final #endif yourself,
# and you should provide PROJ name for header guard prefix
def header_guard random_suffix = nil, &block
  defined = "_#{Project.name.upcase}_#{@dir.upcase}_#{@class.upcase}_#{random_suffix.nil? ? '' : rand.to_s[2..-1]+'_'}"

  Ludy::erbout "#ifndef #{defined}
#define #{defined}", block.binding
  block.call
  Ludy::erbout '#endif', block.binding
end

end # of Kernel

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
godfat-ludy-0.1.13 lib/ludy/tasks/preprocess_cpp/header_guard.rb
ludy-0.1.15 lib/ludy/tasks/preprocess_cpp/header_guard.rb
ludy-0.1.11 lib/ludy/tasks/preprocess_cpp/header_guard.rb
ludy-0.1.13 lib/ludy/tasks/preprocess_cpp/header_guard.rb