From f39f0d2b96b9bf59b7f32991be8f301bb4b9e241 Mon Sep 17 00:00:00 2001
From: Ben Huber
Date: Wed, 31 May 2017 22:55:23 +0200
Subject: [PATCH] faster lookup of doxygen tags and finding version without git
tags
---
doc/jekyll/_plugins/tabs.rb | 2 +-
src/docHelper/findDoxytag.cpp | 27 +++++++++++++++++++++++++++
2 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/doc/jekyll/_plugins/tabs.rb b/doc/jekyll/_plugins/tabs.rb
index 92b76be..407bd58 100644
--- a/doc/jekyll/_plugins/tabs.rb
+++ b/doc/jekyll/_plugins/tabs.rb
@@ -24,7 +24,7 @@ class TabsConverter < Converter
.gsub('__infoEnd
', "")
.gsub('__breakFix1
', "")
.gsub('__breakFix2', "")
- .gsub('__version', %x( git describe --tags --always --abbrev=0 ) )
+ .gsub('__version', %x( cat ../VERSION ) )
.gsub(/__doxyref\(([^\)]+)\)/){ |m| %x( ./findDoxytag #{$1} ) }
end
end
diff --git a/src/docHelper/findDoxytag.cpp b/src/docHelper/findDoxytag.cpp
index fb3a500..6f3e197 100644
--- a/src/docHelper/findDoxytag.cpp
+++ b/src/docHelper/findDoxytag.cpp
@@ -13,6 +13,33 @@ int main(int argc, char *argv[]) {
std::string memberName(argv[1]);
std::ifstream inFile("xerus.tags");
std::string line;
+ std::size_t jumpSize = 100;
+ // seek rough position
+ auto lastPos = inFile.tellg();
+ while (!inFile.eof()) {
+ lastPos = inFile.tellg();
+ for (size_t i=0; i parts;
+ boost::split(parts, line, boost::is_any_of("\t"));
+ if (parts[0] == memberName) {
+ std::cout << parts[1] << std::endl;
+ return 0;
+ }
+ if (parts[0] > memberName) {
+ inFile.seekg(lastPos);
+ jumpSize /= 10;
+ if (jumpSize == 1) {
+ break;
+ }
+ }
+ }
+ if (inFile.eof()) {
+ inFile.clear();
+ inFile.seekg(lastPos);
+ }
+
while (std::getline(inFile, line)) {
std::vector parts;
boost::split(parts, line, boost::is_any_of("\t"));
--
GitLab