Sha256: 6b4a295bba4d67d0e5f41d64ee6eebb20b5ae571d7dd1c4cce652b3373d73aa3

Contents?: true

Size: 488 Bytes

Versions: 7

Compression:

Stored size: 488 Bytes

Contents

require 'ludy/tasks/common'

module Kernel

# 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 ludy

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ludy-0.1.10 lib/ludy/tasks/preprocess_cpp/header_guard.rb
ludy-0.1.9 lib/ludy/tasks/preprocess_cpp/header_guard.rb
ludy-0.1.4 lib/ludy/tasks/preprocess_cpp/header_guard.rb
ludy-0.1.5 lib/ludy/tasks/preprocess_cpp/header_guard.rb
ludy-0.1.6 lib/ludy/tasks/preprocess_cpp/header_guard.rb
ludy-0.1.7 lib/ludy/tasks/preprocess_cpp/header_guard.rb
ludy-0.1.8 lib/ludy/tasks/preprocess_cpp/header_guard.rb