BibleTime
btmodules.cpp
Go to the documentation of this file.
1 /*********
2 *
3 * In the name of the Father, and of the Son, and of the Holy Spirit.
4 *
5 * This file is part of BibleTime's source code, https://bibletime.info/
6 *
7 * Copyright 1999-2021 by the BibleTime developers.
8 * The BibleTime source code is licensed under the GNU General Public License
9 * version 2.0.
10 *
11 **********/
12 
13 #include "btmodules.h"
14 
15 #include "../backend/drivers/cswordmoduleinfo.h"
16 #include "../backend/drivers/btmodulelist.h"
17 
18 
19 int leftLikeParallelModules(BtModuleList const & modules) {
20  // Count the number of leftmost modules that are of the same category
21  auto const numModules = modules.size();
22  if (numModules <= 0)
23  return 0;
24  int leftLikeModules = 1;
25  if (numModules > 1) {
26  auto it = modules.begin();
27  auto const category = (*it)->category();
28  while ((*++it)->category() == category)
29  if (++leftLikeModules == numModules)
30  break;
31  }
32  return leftLikeModules;
33 }
QList< CSwordModuleInfo * > BtModuleList
Definition: btmodulelist.h:20
int leftLikeParallelModules(BtModuleList const &modules)
Definition: btmodules.cpp:19