class Clangc::Module
CXModule class and method
Public Instance Methods
Clangc::Module#ast_file → CLangc::File or nil
click to toggle source
Get the module file where the provided module object came from.
VALUE c_Module_get_ast_file(VALUE self) { Module_t *m; Data_Get_Struct(self, Module_t, m); VALUE ast_file; File_t *f; R_GET_CLASS_DATA("Clangc", File, ast_file, f); f->data = clang_Module_getASTFile(m->data); if (f->data) return ast_file; else return Qnil; }
Clangc::Module#full_name → String
click to toggle source
Returns the full name of the module, e.g. “std.vector”.
VALUE c_Module_get_full_name(VALUE self) { Module_t *m; Data_Get_Struct(self, Module_t, m); return CXSTR_2_RVAL(clang_Module_getFullName(m->data)); }
Clangc::Module#is_system → true/false
click to toggle source
Returns non-zero if the module is a system one.
VALUE c_Module_is_system(VALUE self) { Module_t *m; Data_Get_Struct(self, Module_t, m); return NOT_0_2_RVAL(clang_Module_isSystem(m->data)); }
Clangc::Module#name → String
click to toggle source
Get the name of the module, e.g. for the 'std.vector' sub-module it will return “vector”.
VALUE c_Module_get_name(VALUE self) { Module_t *m; Data_Get_Struct(self, Module_t, m); return CXSTR_2_RVAL(clang_Module_getName(m->data)); }
Clangc::Module#num_top_level_headers(Clangc::TranslationUnit) → Integer
click to toggle source
The number of top level headers associated with this module.
VALUE c_Module_get_num_top_level_headers(VALUE self, VALUE translation_unit) { Module_t *m; Data_Get_Struct(self, Module_t, m); TranslationUnit_t *t; CHECK_ARG_TYPE(translation_unit, TranslationUnit); Data_Get_Struct(translation_unit, TranslationUnit_t, t); return CUINT_2_NUM(clang_Module_getNumTopLevelHeaders(t->data, m->data)); }
Clangc::Module#parent → Clangc::Module
click to toggle source
the parent of a sub-module or NULL if the given module is top-level, e.g. for 'std.vector' it will return the 'std' module.
VALUE c_Module_get_parent(VALUE self) { Module_t *m; Data_Get_Struct(self, Module_t, m); VALUE parent; Module_t *p; R_GET_CLASS_DATA("Clangc", Module, parent, p); p->data = clang_Module_getParent(m->data); return parent; }
Clangc::Module#top_level_header(Clangc::TranslationUnit, Integer) →
click to toggle source
Clangc::File
Index top level header index (zero-based).
Returns the specified top level header associated with the module.
VALUE c_Module_get_top_level_header(VALUE self, VALUE translation_unit, VALUE index) { Module_t *m; Data_Get_Struct(self, Module_t, m); TranslationUnit_t *t; CHECK_ARG_TYPE(translation_unit, TranslationUnit); Data_Get_Struct(translation_unit, TranslationUnit_t, t); unsigned int c_index = NUM2UINT(index); VALUE header; File_t *f; R_GET_CLASS_DATA("Clangc", File, header, f); f->data = clang_Module_getTopLevelHeader(t->data, m->data, c_index); if (f->data) return header; else return Qnil; }
Clangc::Module#top_level_headers(Clangc::TranslationUnit) → Array
click to toggle source
Return an array that contains all the Clangc::File corresponding to the related toplevel headers. If the current cursor is not a module, it returns an empty array.
# File lib/clangc.rb, line 231 def top_level_headers(tu) num = num_top_level_headers(tu) headers = [] return headers if num < 1 for i in 0..(num - 1) do headers << top_level_header(tu, i) end headers end