Browse Source

add trans

merge-requests/365/head
Jørgen Lien Sellæg 11 years ago
parent
commit
3313af46a5
  1. 4
      juci/CMakeLists.txt
  2. 9
      juci/source.cc
  3. 6
      juci/source.h

4
juci/CMakeLists.txt

@ -127,8 +127,8 @@ link_directories(
${LIBCLANG_LIBRARY_DIRS} ${LIBCLANG_LIBRARY_DIRS}
) )
#module: #module:
#set_target_properties(${module} PROPERTIES PREFIX "" set_target_properties(${module} PROPERTIES PREFIX ""
# LIBRARY_OUTPUT_DIRECTORY "/usr/lib/python2.7/dist-packages/") LIBRARY_OUTPUT_DIRECTORY "/usr/lib/python2.7/dist-packages/")
target_link_libraries(${module} ${PYTHON_LIBRARIES} ${Boost_LIBRARIES}) target_link_libraries(${module} ${PYTHON_LIBRARIES} ${Boost_LIBRARIES})
#executable: #executable:
target_link_libraries(${project_name} ${LIVCLANG_LIBRARIES} ${LCL_LIBRARIES} ${GTKMM_LIBRARIES} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES}) target_link_libraries(${project_name} ${LIVCLANG_LIBRARIES} ${LCL_LIBRARIES} ${GTKMM_LIBRARIES} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})

9
juci/source.cc

@ -38,9 +38,9 @@ void Source::View::ApplyConfig(const Source::Config &config) {
} }
} }
void Source::View::OnOpenFile(std::vector<Clang::SourceLocation> &locations, void Source::View::OnOpenFile(std::vector<clang::SourceLocation> &locations,
const Source::Config &config) { const Source::Config &config) {
ApplyConfig(config); /* ApplyConfig(config);
Glib::RefPtr<Gtk::TextBuffer> buffer = get_buffer(); Glib::RefPtr<Gtk::TextBuffer> buffer = get_buffer();
for (auto &loc : locations) { for (auto &loc : locations) {
string type = std::to_string(loc.kind()); string type = std::to_string(loc.kind());
@ -71,6 +71,7 @@ void Source::View::OnOpenFile(std::vector<Clang::SourceLocation> &locations,
begin_iter, end_iter); begin_iter, end_iter);
} }
} }
*/
} }
@ -194,10 +195,7 @@ void Source::Controller::OnOpenFile(const string &filepath) {
arguments.emplace_back(lol[a].c_str()); arguments.emplace_back(lol[a].c_str());
} }
} }
boost::timer::auto_cpu_timer timer;
clang::TranslationUnit tu(true, filepath, arguments); clang::TranslationUnit tu(true, filepath, arguments);
timer.~auto_cpu_timer();
boost::timer::auto_cpu_timer timer2;
clang::SourceLocation start(&tu, filepath, start_offset); clang::SourceLocation start(&tu, filepath, start_offset);
clang::SourceLocation end(&tu, filepath, end_offset); clang::SourceLocation end(&tu, filepath, end_offset);
clang::SourceRange range(&start, &end); clang::SourceRange range(&start, &end);
@ -211,7 +209,6 @@ void Source::Controller::OnOpenFile(const string &filepath) {
loc.get_location_info(NULL, &line, &column, NULL); loc.get_location_info(NULL, &line, &column, NULL);
} }
timer2.~auto_cpu_timer();
// std::cout << t.elapsed().user << std::endl; // std::cout << t.elapsed().user << std::endl;
// model().SetSourceLocations(tu.getSourceLocations()); // model().SetSourceLocations(tu.getSourceLocations());
// view().OnOpenFile(model().getSourceLocations(), model().theme()); // view().OnOpenFile(model().getSourceLocations(), model().theme());

6
juci/source.h

@ -52,7 +52,7 @@ namespace Source {
View(); View();
string UpdateLine(); string UpdateLine();
void ApplyConfig(const Config &config); void ApplyConfig(const Config &config);
void OnOpenFile(std::vector<Clang::SourceLocation> &locations, void OnOpenFile(std::vector<clang::SourceLocation> &locations,
const Config &config); const Config &config);
private: private:
string GetLine(const Gtk::TextIter &begin); string GetLine(const Gtk::TextIter &begin);
@ -65,8 +65,8 @@ namespace Source {
Config& config(); Config& config();
const string filepath(); const string filepath();
void SetFilePath(const string &filepath); void SetFilePath(const string &filepath);
void SetSourceLocations( const std::vector<Clang::SourceLocation> &locations); void SetSourceLocations( const std::vector<clang::SourceLocation> &locations);
std::vector<Clang::SourceLocation>& getSourceLocations() { std::vector<clang::SourceLocation>& getSourceLocations() {
return locations_; return locations_;
} }

Loading…
Cancel
Save