Class: Ritsu::SrcFiles::HeaderFile

Inherits:
Ritsu::SrcFile show all
Defined in:
lib/ritsu/src_files/header_file.rb,
lib/ritsu/ext/qt/src_files/header_file.rb

Instance Attribute Summary

Attributes inherited from Ritsu::SrcFile

#owner, #src_path

Instance Method Summary collapse

Methods inherited from Ritsu::SrcFile

#abs_path, #base_name, find_by_src_path, #include_in_source_files?, is_valid_src_path?, #project, #remove, #update, #update_content, validate_instance

Methods included from Utility

platform

Methods included from Utility::InstanceSet

included, #initialize_instance

Constructor Details

#initialize(src_path, owner, options = {}) ⇒ HeaderFile

Returns a new instance of HeaderFile.



9
10
11
# File 'lib/ritsu/src_files/header_file.rb', line 9

def initialize(src_path, owner)
  super(src_path, owner)
end

Instance Method Details

#cpp_file?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/ritsu/src_files/header_file.rb', line 33

def cpp_file?
  false
end

#createObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ritsu/src_files/header_file.rb', line 13

def create
  Ritsu::Utility::FileRobot.create_file(abs_path,
    "#ifndef #{include_guard}\n" +
    "#define #{include_guard}\n" +
    "\n" +
    "////////////////////\n" +
    "// YOUR CODE HERE //\n" +
    "////////////////////\n" +
    "\n" +
    "#endif\n")
end

#header_file?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/ritsu/src_files/header_file.rb', line 29

def header_file?
  true
end

#include_guardObject



25
26
27
# File 'lib/ritsu/src_files/header_file.rb', line 25

def include_guard
  '__' + project.name.underscore.upcase + '_' + src_path.gsub(/[.\/]+/,'_').upcase + '__'
end

#initialize_target_before_qtHeaderFile

Returns a new instance of HeaderFile.

Returns:



6
7
8
# File 'lib/ritsu/ext/qt/src_files/header_file.rb', line 6

def initialize(src_path, owner)
  super(src_path, owner)
end

#qt_header_file?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/ritsu/ext/qt/src_files/header_file.rb', line 14

def qt_header_file?
  @qt_header_file
end