A C++ DAL / ORM code generation framework
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

744 lines
22 KiB

  1. // Search script generated by doxygen
  2. // Copyright (C) 2009 by Dimitri van Heesch.
  3. // The code in this file is loosly based on main.js, part of Natural Docs,
  4. // which is Copyright (C) 2003-2008 Greg Valure
  5. // Natural Docs is licensed under the GPL.
  6. var indexSectionsWithContent =
  7. {
  8. 0: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010111111111111111111111110100001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  9. 1: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  10. 2: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  11. 3: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  12. 4: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101111111011111111111110000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  13. 5: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010001000000010010001010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  14. 6: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  15. 7: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111001101110010111110100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  16. 8: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  17. 9: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000100101000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
  18. };
  19. var indexSectionNames =
  20. {
  21. 0: "all",
  22. 1: "classes",
  23. 2: "namespaces",
  24. 3: "files",
  25. 4: "functions",
  26. 5: "variables",
  27. 6: "enums",
  28. 7: "enumvalues",
  29. 8: "related",
  30. 9: "defines"
  31. };
  32. function convertToId(search)
  33. {
  34. var result = '';
  35. for (i=0;i<search.length;i++)
  36. {
  37. var c = search.charAt(i);
  38. var cn = c.charCodeAt(0);
  39. if (c.match(/[a-z0-9]/))
  40. {
  41. result+=c;
  42. }
  43. else if (cn<16)
  44. {
  45. result+="_0"+cn.toString(16);
  46. }
  47. else
  48. {
  49. result+="_"+cn.toString(16);
  50. }
  51. }
  52. return result;
  53. }
  54. function getXPos(item)
  55. {
  56. var x = 0;
  57. if (item.offsetWidth)
  58. {
  59. while (item && item!=document.body)
  60. {
  61. x += item.offsetLeft;
  62. item = item.offsetParent;
  63. }
  64. }
  65. return x;
  66. }
  67. function getYPos(item)
  68. {
  69. var y = 0;
  70. if (item.offsetWidth)
  71. {
  72. while (item && item!=document.body)
  73. {
  74. y += item.offsetTop;
  75. item = item.offsetParent;
  76. }
  77. }
  78. return y;
  79. }
  80. /* A class handling everything associated with the search panel.
  81. Parameters:
  82. name - The name of the global variable that will be
  83. storing this instance. Is needed to be able to set timeouts.
  84. resultPath - path to use for external files
  85. */
  86. function SearchBox(name, resultsPath, inFrame, label)
  87. {
  88. if (!name || !resultsPath) { alert("Missing parameters to SearchBox."); }
  89. // ---------- Instance variables
  90. this.name = name;
  91. this.resultsPath = resultsPath;
  92. this.keyTimeout = 0;
  93. this.keyTimeoutLength = 500;
  94. this.closeSelectionTimeout = 300;
  95. this.lastSearchValue = "";
  96. this.lastResultsPage = "";
  97. this.hideTimeout = 0;
  98. this.searchIndex = 0;
  99. this.searchActive = false;
  100. this.insideFrame = inFrame;
  101. this.searchLabel = label;
  102. // ----------- DOM Elements
  103. this.DOMSearchField = function()
  104. { return document.getElementById("MSearchField"); }
  105. this.DOMSearchSelect = function()
  106. { return document.getElementById("MSearchSelect"); }
  107. this.DOMSearchSelectWindow = function()
  108. { return document.getElementById("MSearchSelectWindow"); }
  109. this.DOMPopupSearchResults = function()
  110. { return document.getElementById("MSearchResults"); }
  111. this.DOMPopupSearchResultsWindow = function()
  112. { return document.getElementById("MSearchResultsWindow"); }
  113. this.DOMSearchClose = function()
  114. { return document.getElementById("MSearchClose"); }
  115. this.DOMSearchBox = function()
  116. { return document.getElementById("MSearchBox"); }
  117. // ------------ Event Handlers
  118. // Called when focus is added or removed from the search field.
  119. this.OnSearchFieldFocus = function(isActive)
  120. {
  121. this.Activate(isActive);
  122. }
  123. this.OnSearchSelectShow = function()
  124. {
  125. var searchSelectWindow = this.DOMSearchSelectWindow();
  126. var searchField = this.DOMSearchSelect();
  127. if (this.insideFrame)
  128. {
  129. var left = getXPos(searchField);
  130. var top = getYPos(searchField);
  131. left += searchField.offsetWidth + 6;
  132. top += searchField.offsetHeight;
  133. // show search selection popup
  134. searchSelectWindow.style.display='block';
  135. left -= searchSelectWindow.offsetWidth;
  136. searchSelectWindow.style.left = left + 'px';
  137. searchSelectWindow.style.top = top + 'px';
  138. }
  139. else
  140. {
  141. var left = getXPos(searchField);
  142. var top = getYPos(searchField);
  143. top += searchField.offsetHeight;
  144. // show search selection popup
  145. searchSelectWindow.style.display='block';
  146. searchSelectWindow.style.left = left + 'px';
  147. searchSelectWindow.style.top = top + 'px';
  148. }
  149. // stop selection hide timer
  150. if (this.hideTimeout)
  151. {
  152. clearTimeout(this.hideTimeout);
  153. this.hideTimeout=0;
  154. }
  155. return false; // to avoid "image drag" default event
  156. }
  157. this.OnSearchSelectHide = function()
  158. {
  159. this.hideTimeout = setTimeout(this.name +".CloseSelectionWindow()",
  160. this.closeSelectionTimeout);
  161. }
  162. // Called when the content of the search field is changed.
  163. this.OnSearchFieldChange = function(evt)
  164. {
  165. if (this.keyTimeout) // kill running timer
  166. {
  167. clearTimeout(this.keyTimeout);
  168. this.keyTimeout = 0;
  169. }
  170. var e = (evt) ? evt : window.event; // for IE
  171. if (e.keyCode==40 || e.keyCode==13)
  172. {
  173. if (e.shiftKey==1)
  174. {
  175. this.OnSearchSelectShow();
  176. var win=this.DOMSearchSelectWindow();
  177. for (i=0;i<win.childNodes.length;i++)
  178. {
  179. var child = win.childNodes[i]; // get span within a
  180. if (child.className=='SelectItem')
  181. {
  182. child.focus();
  183. return;
  184. }
  185. }
  186. return;
  187. }
  188. else if (window.frames.MSearchResults.searchResults)
  189. {
  190. var elem = window.frames.MSearchResults.searchResults.NavNext(0);
  191. if (elem) elem.focus();
  192. }
  193. }
  194. else if (e.keyCode==27) // Escape out of the search field
  195. {
  196. this.DOMSearchField().blur();
  197. this.DOMPopupSearchResultsWindow().style.display = 'none';
  198. this.DOMSearchClose().style.display = 'none';
  199. this.lastSearchValue = '';
  200. this.Activate(false);
  201. return;
  202. }
  203. // strip whitespaces
  204. var searchValue = this.DOMSearchField().value.replace(/ +/g, "");
  205. if (searchValue != this.lastSearchValue) // search value has changed
  206. {
  207. if (searchValue != "") // non-empty search
  208. {
  209. // set timer for search update
  210. this.keyTimeout = setTimeout(this.name + '.Search()',
  211. this.keyTimeoutLength);
  212. }
  213. else // empty search field
  214. {
  215. this.DOMPopupSearchResultsWindow().style.display = 'none';
  216. this.DOMSearchClose().style.display = 'none';
  217. this.lastSearchValue = '';
  218. }
  219. }
  220. }
  221. this.SelectItemCount = function(id)
  222. {
  223. var count=0;
  224. var win=this.DOMSearchSelectWindow();
  225. for (i=0;i<win.childNodes.length;i++)
  226. {
  227. var child = win.childNodes[i]; // get span within a
  228. if (child.className=='SelectItem')
  229. {
  230. count++;
  231. }
  232. }
  233. return count;
  234. }
  235. this.SelectItemSet = function(id)
  236. {
  237. var i,j=0;
  238. var win=this.DOMSearchSelectWindow();
  239. for (i=0;i<win.childNodes.length;i++)
  240. {
  241. var child = win.childNodes[i]; // get span within a
  242. if (child.className=='SelectItem')
  243. {
  244. var node = child.firstChild;
  245. if (j==id)
  246. {
  247. node.innerHTML='&bull;';
  248. }
  249. else
  250. {
  251. node.innerHTML='&#160;';
  252. }
  253. j++;
  254. }
  255. }
  256. }
  257. // Called when an search filter selection is made.
  258. // set item with index id as the active item
  259. this.OnSelectItem = function(id)
  260. {
  261. this.searchIndex = id;
  262. this.SelectItemSet(id);
  263. var searchValue = this.DOMSearchField().value.replace(/ +/g, "");
  264. if (searchValue!="" && this.searchActive) // something was found -> do a search
  265. {
  266. this.Search();
  267. }
  268. }
  269. this.OnSearchSelectKey = function(evt)
  270. {
  271. var e = (evt) ? evt : window.event; // for IE
  272. if (e.keyCode==40 && this.searchIndex<this.SelectItemCount()) // Down
  273. {
  274. this.searchIndex++;
  275. this.OnSelectItem(this.searchIndex);
  276. }
  277. else if (e.keyCode==38 && this.searchIndex>0) // Up
  278. {
  279. this.searchIndex--;
  280. this.OnSelectItem(this.searchIndex);
  281. }
  282. else if (e.keyCode==13 || e.keyCode==27)
  283. {
  284. this.OnSelectItem(this.searchIndex);
  285. this.CloseSelectionWindow();
  286. this.DOMSearchField().focus();
  287. }
  288. return false;
  289. }
  290. // --------- Actions
  291. // Closes the results window.
  292. this.CloseResultsWindow = function()
  293. {
  294. this.DOMPopupSearchResultsWindow().style.display = 'none';
  295. this.DOMSearchClose().style.display = 'none';
  296. this.Activate(false);
  297. }
  298. this.CloseSelectionWindow = function()
  299. {
  300. this.DOMSearchSelectWindow().style.display = 'none';
  301. }
  302. // Performs a search.
  303. this.Search = function()
  304. {
  305. this.keyTimeout = 0;
  306. // strip leading whitespace
  307. var searchValue = this.DOMSearchField().value.replace(/^ +/, "");
  308. var code = searchValue.toLowerCase().charCodeAt(0);
  309. var hexCode;
  310. if (code<16)
  311. {
  312. hexCode="0"+code.toString(16);
  313. }
  314. else
  315. {
  316. hexCode=code.toString(16);
  317. }
  318. var resultsPage;
  319. var resultsPageWithSearch;
  320. var hasResultsPage;
  321. if (indexSectionsWithContent[this.searchIndex].charAt(code) == '1')
  322. {
  323. resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + '.html';
  324. resultsPageWithSearch = resultsPage+'?'+escape(searchValue);
  325. hasResultsPage = true;
  326. }
  327. else // nothing available for this search term
  328. {
  329. resultsPage = this.resultsPath + '/nomatches.html';
  330. resultsPageWithSearch = resultsPage;
  331. hasResultsPage = false;
  332. }
  333. window.frames.MSearchResults.location.href = resultsPageWithSearch;
  334. var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow();
  335. if (domPopupSearchResultsWindow.style.display!='block')
  336. {
  337. var domSearchBox = this.DOMSearchBox();
  338. this.DOMSearchClose().style.display = 'inline';
  339. if (this.insideFrame)
  340. {
  341. var domPopupSearchResults = this.DOMPopupSearchResults();
  342. domPopupSearchResultsWindow.style.position = 'relative';
  343. domPopupSearchResultsWindow.style.display = 'block';
  344. var width = document.body.clientWidth - 8; // the -8 is for IE :-(
  345. domPopupSearchResultsWindow.style.width = width + 'px';
  346. domPopupSearchResults.style.width = width + 'px';
  347. }
  348. else
  349. {
  350. var domPopupSearchResults = this.DOMPopupSearchResults();
  351. var left = getXPos(domSearchBox) + 150; // domSearchBox.offsetWidth;
  352. var top = getYPos(domSearchBox) + 20; // domSearchBox.offsetHeight + 1;
  353. domPopupSearchResultsWindow.style.display = 'block';
  354. left -= domPopupSearchResults.offsetWidth;
  355. domPopupSearchResultsWindow.style.top = top + 'px';
  356. domPopupSearchResultsWindow.style.left = left + 'px';
  357. }
  358. }
  359. this.lastSearchValue = searchValue;
  360. this.lastResultsPage = resultsPage;
  361. }
  362. // -------- Activation Functions
  363. // Activates or deactivates the search panel, resetting things to
  364. // their default values if necessary.
  365. this.Activate = function(isActive)
  366. {
  367. if (isActive || // open it
  368. this.DOMPopupSearchResultsWindow().style.display == 'block'
  369. )
  370. {
  371. this.DOMSearchBox().className = 'MSearchBoxActive';
  372. var searchField = this.DOMSearchField();
  373. if (searchField.value == this.searchLabel) // clear "Search" term upon entry
  374. {
  375. searchField.value = '';
  376. this.searchActive = true;
  377. }
  378. }
  379. else if (!isActive) // directly remove the panel
  380. {
  381. this.DOMSearchBox().className = 'MSearchBoxInactive';
  382. this.DOMSearchField().value = this.searchLabel;
  383. this.searchActive = false;
  384. this.lastSearchValue = ''
  385. this.lastResultsPage = '';
  386. }
  387. }
  388. }
  389. // -----------------------------------------------------------------------
  390. // The class that handles everything on the search results page.
  391. function SearchResults(name)
  392. {
  393. // The number of matches from the last run of <Search()>.
  394. this.lastMatchCount = 0;
  395. this.lastKey = 0;
  396. this.repeatOn = false;
  397. // Toggles the visibility of the passed element ID.
  398. this.FindChildElement = function(id)
  399. {
  400. var parentElement = document.getElementById(id);
  401. var element = parentElement.firstChild;
  402. while (element && element!=parentElement)
  403. {
  404. if (element.nodeName == 'DIV' && element.className == 'SRChildren')
  405. {
  406. return element;
  407. }
  408. if (element.nodeName == 'DIV' && element.hasChildNodes())
  409. {
  410. element = element.firstChild;
  411. }
  412. else if (element.nextSibling)
  413. {
  414. element = element.nextSibling;
  415. }
  416. else
  417. {
  418. do
  419. {
  420. element = element.parentNode;
  421. }
  422. while (element && element!=parentElement && !element.nextSibling);
  423. if (element && element!=parentElement)
  424. {
  425. element = element.nextSibling;
  426. }
  427. }
  428. }
  429. }
  430. this.Toggle = function(id)
  431. {
  432. var element = this.FindChildElement(id);
  433. if (element)
  434. {
  435. if (element.style.display == 'block')
  436. {
  437. element.style.display = 'none';
  438. }
  439. else
  440. {
  441. element.style.display = 'block';
  442. }
  443. }
  444. }
  445. // Searches for the passed string. If there is no parameter,
  446. // it takes it from the URL query.
  447. //
  448. // Always returns true, since other documents may try to call it
  449. // and that may or may not be possible.
  450. this.Search = function(search)
  451. {
  452. if (!search) // get search word from URL
  453. {
  454. search = window.location.search;
  455. search = search.substring(1); // Remove the leading '?'
  456. search = unescape(search);
  457. }
  458. search = search.replace(/^ +/, ""); // strip leading spaces
  459. search = search.replace(/ +$/, ""); // strip trailing spaces
  460. search = search.toLowerCase();
  461. search = convertToId(search);
  462. var resultRows = document.getElementsByTagName("div");
  463. var matches = 0;
  464. var i = 0;
  465. while (i < resultRows.length)
  466. {
  467. var row = resultRows.item(i);
  468. if (row.className == "SRResult")
  469. {
  470. var rowMatchName = row.id.toLowerCase();
  471. rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_'
  472. if (search.length<=rowMatchName.length &&
  473. rowMatchName.substr(0, search.length)==search)
  474. {
  475. row.style.display = 'block';
  476. matches++;
  477. }
  478. else
  479. {
  480. row.style.display = 'none';
  481. }
  482. }
  483. i++;
  484. }
  485. document.getElementById("Searching").style.display='none';
  486. if (matches == 0) // no results
  487. {
  488. document.getElementById("NoMatches").style.display='block';
  489. }
  490. else // at least one result
  491. {
  492. document.getElementById("NoMatches").style.display='none';
  493. }
  494. this.lastMatchCount = matches;
  495. return true;
  496. }
  497. // return the first item with index index or higher that is visible
  498. this.NavNext = function(index)
  499. {
  500. var focusItem;
  501. while (1)
  502. {
  503. var focusName = 'Item'+index;
  504. focusItem = document.getElementById(focusName);
  505. if (focusItem && focusItem.parentNode.parentNode.style.display=='block')
  506. {
  507. break;
  508. }
  509. else if (!focusItem) // last element
  510. {
  511. break;
  512. }
  513. focusItem=null;
  514. index++;
  515. }
  516. return focusItem;
  517. }
  518. this.NavPrev = function(index)
  519. {
  520. var focusItem;
  521. while (1)
  522. {
  523. var focusName = 'Item'+index;
  524. focusItem = document.getElementById(focusName);
  525. if (focusItem && focusItem.parentNode.parentNode.style.display=='block')
  526. {
  527. break;
  528. }
  529. else if (!focusItem) // last element
  530. {
  531. break;
  532. }
  533. focusItem=null;
  534. index--;
  535. }
  536. return focusItem;
  537. }
  538. this.ProcessKeys = function(e)
  539. {
  540. if (e.type == "keydown")
  541. {
  542. this.repeatOn = false;
  543. this.lastKey = e.keyCode;
  544. }
  545. else if (e.type == "keypress")
  546. {
  547. if (!this.repeatOn)
  548. {
  549. if (this.lastKey) this.repeatOn = true;
  550. return false; // ignore first keypress after keydown
  551. }
  552. }
  553. else if (e.type == "keyup")
  554. {
  555. this.lastKey = 0;
  556. this.repeatOn = false;
  557. }
  558. return this.lastKey!=0;
  559. }
  560. this.Nav = function(evt,itemIndex)
  561. {
  562. var e = (evt) ? evt : window.event; // for IE
  563. if (e.keyCode==13) return true;
  564. if (!this.ProcessKeys(e)) return false;
  565. if (this.lastKey==38) // Up
  566. {
  567. var newIndex = itemIndex-1;
  568. var focusItem = this.NavPrev(newIndex);
  569. if (focusItem)
  570. {
  571. var child = this.FindChildElement(focusItem.parentNode.parentNode.id);
  572. if (child && child.style.display == 'block') // children visible
  573. {
  574. var n=0;
  575. var tmpElem;
  576. while (1) // search for last child
  577. {
  578. tmpElem = document.getElementById('Item'+newIndex+'_c'+n);
  579. if (tmpElem)
  580. {
  581. focusItem = tmpElem;
  582. }
  583. else // found it!
  584. {
  585. break;
  586. }
  587. n++;
  588. }
  589. }
  590. }
  591. if (focusItem)
  592. {
  593. focusItem.focus();
  594. }
  595. else // return focus to search field
  596. {
  597. parent.document.getElementById("MSearchField").focus();
  598. }
  599. }
  600. else if (this.lastKey==40) // Down
  601. {
  602. var newIndex = itemIndex+1;
  603. var focusItem;
  604. var item = document.getElementById('Item'+itemIndex);
  605. var elem = this.FindChildElement(item.parentNode.parentNode.id);
  606. if (elem && elem.style.display == 'block') // children visible
  607. {
  608. focusItem = document.getElementById('Item'+itemIndex+'_c0');
  609. }
  610. if (!focusItem) focusItem = this.NavNext(newIndex);
  611. if (focusItem) focusItem.focus();
  612. }
  613. else if (this.lastKey==39) // Right
  614. {
  615. var item = document.getElementById('Item'+itemIndex);
  616. var elem = this.FindChildElement(item.parentNode.parentNode.id);
  617. if (elem) elem.style.display = 'block';
  618. }
  619. else if (this.lastKey==37) // Left
  620. {
  621. var item = document.getElementById('Item'+itemIndex);
  622. var elem = this.FindChildElement(item.parentNode.parentNode.id);
  623. if (elem) elem.style.display = 'none';
  624. }
  625. else if (this.lastKey==27) // Escape
  626. {
  627. parent.searchBox.CloseResultsWindow();
  628. parent.document.getElementById("MSearchField").focus();
  629. }
  630. else if (this.lastKey==13) // Enter
  631. {
  632. return true;
  633. }
  634. return false;
  635. }
  636. this.NavChild = function(evt,itemIndex,childIndex)
  637. {
  638. var e = (evt) ? evt : window.event; // for IE
  639. if (e.keyCode==13) return true;
  640. if (!this.ProcessKeys(e)) return false;
  641. if (this.lastKey==38) // Up
  642. {
  643. if (childIndex>0)
  644. {
  645. var newIndex = childIndex-1;
  646. document.getElementById('Item'+itemIndex+'_c'+newIndex).focus();
  647. }
  648. else // already at first child, jump to parent
  649. {
  650. document.getElementById('Item'+itemIndex).focus();
  651. }
  652. }
  653. else if (this.lastKey==40) // Down
  654. {
  655. var newIndex = childIndex+1;
  656. var elem = document.getElementById('Item'+itemIndex+'_c'+newIndex);
  657. if (!elem) // last child, jump to parent next parent
  658. {
  659. elem = this.NavNext(itemIndex+1);
  660. }
  661. if (elem)
  662. {
  663. elem.focus();
  664. }
  665. }
  666. else if (this.lastKey==27) // Escape
  667. {
  668. parent.searchBox.CloseResultsWindow();
  669. parent.document.getElementById("MSearchField").focus();
  670. }
  671. else if (this.lastKey==13) // Enter
  672. {
  673. return true;
  674. }
  675. return false;
  676. }
  677. }