/[svn]/libgig/trunk/src/gig.cpp
ViewVC logotype

Diff of /libgig/trunk/src/gig.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3935 by schoenebeck, Thu Jun 17 10:09:42 2021 UTC revision 3936 by schoenebeck, Thu Jun 17 10:29:54 2021 UTC
# Line 609  namespace { Line 609  namespace {
609          uint16_t iSampleGroup = 0; // 0 refers to default sample group          uint16_t iSampleGroup = 0; // 0 refers to default sample group
610          File* pFile = static_cast<File*>(pParent);          File* pFile = static_cast<File*>(pParent);
611          if (pFile->pGroups) {          if (pFile->pGroups) {
612              std::list<Group*>::iterator iter = pFile->pGroups->begin();              std::vector<Group*>::iterator iter = pFile->pGroups->begin();
613              std::list<Group*>::iterator end  = pFile->pGroups->end();              std::vector<Group*>::iterator end  = pFile->pGroups->end();
614              for (int i = 0; iter != end; i++, iter++) {              for (int i = 0; iter != end; i++, iter++) {
615                  if (*iter == pGroup) {                  if (*iter == pGroup) {
616                      iSampleGroup = i;                      iSampleGroup = i;
# Line 6286  namespace { Line 6286  namespace {
6286    
6287      File::~File() {      File::~File() {
6288          if (pGroups) {          if (pGroups) {
6289              std::list<Group*>::iterator iter = pGroups->begin();              std::vector<Group*>::iterator iter = pGroups->begin();
6290              std::list<Group*>::iterator end  = pGroups->end();              std::vector<Group*>::iterator end  = pGroups->end();
6291              while (iter != end) {              while (iter != end) {
6292                  delete *iter;                  delete *iter;
6293                  ++iter;                  ++iter;
# Line 6958  namespace { Line 6958  namespace {
6958       */       */
6959      Group* File::GetGroup(size_t index) {      Group* File::GetGroup(size_t index) {
6960          if (!pGroups) LoadGroups();          if (!pGroups) LoadGroups();
6961          GroupsIterator = pGroups->begin();          if (index >= pGroups->size()) return NULL;
6962          for (size_t i = 0; GroupsIterator != pGroups->end(); i++) {          return (*pGroups)[index];
             if (i == index) return *GroupsIterator;  
             ++GroupsIterator;  
         }  
         return NULL;  
6963      }      }
6964    
6965      /**      /**
# Line 7004  namespace { Line 7000  namespace {
7000       */       */
7001      void File::DeleteGroup(Group* pGroup) {      void File::DeleteGroup(Group* pGroup) {
7002          if (!pGroups) LoadGroups();          if (!pGroups) LoadGroups();
7003          std::list<Group*>::iterator iter = find(pGroups->begin(), pGroups->end(), pGroup);          std::vector<Group*>::iterator iter =
7004                find(pGroups->begin(), pGroups->end(), pGroup);
7005          if (iter == pGroups->end()) throw gig::Exception("Could not delete group, could not find given group");          if (iter == pGroups->end()) throw gig::Exception("Could not delete group, could not find given group");
7006          if (pGroups->size() == 1) throw gig::Exception("Cannot delete group, there must be at least one default group!");          if (pGroups->size() == 1) throw gig::Exception("Cannot delete group, there must be at least one default group!");
7007          // delete all members of this group          // delete all members of this group
# Line 7030  namespace { Line 7027  namespace {
7027       */       */
7028      void File::DeleteGroupOnly(Group* pGroup) {      void File::DeleteGroupOnly(Group* pGroup) {
7029          if (!pGroups) LoadGroups();          if (!pGroups) LoadGroups();
7030          std::list<Group*>::iterator iter = find(pGroups->begin(), pGroups->end(), pGroup);          std::vector<Group*>::iterator iter =
7031                find(pGroups->begin(), pGroups->end(), pGroup);
7032          if (iter == pGroups->end()) throw gig::Exception("Could not delete group, could not find given group");          if (iter == pGroups->end()) throw gig::Exception("Could not delete group, could not find given group");
7033          if (pGroups->size() == 1) throw gig::Exception("Cannot delete group, there must be at least one default group!");          if (pGroups->size() == 1) throw gig::Exception("Cannot delete group, there must be at least one default group!");
7034          // move all members of this group to another group          // move all members of this group to another group
# Line 7041  namespace { Line 7039  namespace {
7039      }      }
7040    
7041      void File::LoadGroups() {      void File::LoadGroups() {
7042          if (!pGroups) pGroups = new std::list<Group*>;          if (!pGroups) pGroups = new std::vector<Group*>;
7043          // try to read defined groups from file          // try to read defined groups from file
7044          RIFF::List* lst3gri = pRIFF->GetSubList(LIST_TYPE_3GRI);          RIFF::List* lst3gri = pRIFF->GetSubList(LIST_TYPE_3GRI);
7045          if (lst3gri) {          if (lst3gri) {
# Line 7240  namespace { Line 7238  namespace {
7238                  }                  }
7239              }              }
7240    
7241              std::list<Group*>::iterator iter = pGroups->begin();              std::vector<Group*>::iterator iter = pGroups->begin();
7242              std::list<Group*>::iterator end  = pGroups->end();              std::vector<Group*>::iterator end  = pGroups->end();
7243              for (; iter != end; ++iter) {              for (; iter != end; ++iter) {
7244                  (*iter)->UpdateChunks(pProgress);                  (*iter)->UpdateChunks(pProgress);
7245              }              }

Legend:
Removed from v.3935  
changed lines
  Added in v.3936

  ViewVC Help
Powered by ViewVC