Subversion Repositories spk

Rev

Rev 112 | Rev 114 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 112 Rev 113
Line 6... Line 6...
6
#define ADDSECTIONLIST(T, L) for(CListNode<T> *node = L.Front(); node; node = node->next()) \
6
#define ADDSECTIONLIST(T, L) for(CListNode<T> *node = L.Front(); node; node = node->next()) \
7
		_addSection(list, node->Data()->sSection, node->Data()->sData);
7
		_addSection(list, node->Data()->sSection, node->Data()->sData);
8
 
8
 
9
#define GENERATESECTION(F, T, L) if ( !L.empty() ) {						\
9
#define GENERATESECTION(F, T, L) if ( !L.empty() ) {						\
10
									type = F;								\
10
									type = F;								\
11
									std::vector<STypesSection *> list;		\
11
									Utils::CList<STypesSection> list;		\
12
									ADDSECTIONLIST(T, L);					\
12
									ADDSECTIONLIST(T, L);					\
13
									data = CXspFile::TypesListToString(list, true); \
13
									data = CXspFile::TypesListToString(list, true); \
14
								}
14
								}
15
 
15
 
16
#define GENERATESTRINGSECTION(F, L) if ( !L.Empty() ) {						\
16
#define GENERATESTRINGSECTION(F, L, FIRST) if ( !L.Empty() ) {				\
17
									type = F;								\
17
									type = F;								\
18
									std::vector<STypesSection *> list;		\
18
									Utils::CList<STypesSection> list;		\
19
									_addDataSection(L, list);				\
19
									_addDataSection(L, list, FIRST);		\
20
									data = CXspFile::TypesListToString(list, true); \
20
									data = CXspFile::TypesListToString(list, true); \
21
								}
21
								}
22
 
22
 
23
 
23
 
24
CXspFile::CXspFile () : CBaseFile()
24
CXspFile::CXspFile () : CBaseFile()
Line 902... Line 902...
902
	}
902
	}
903
 
903
 
904
	return true;
904
	return true;
905
}
905
}
906
 
906
 
907
void CXspFile::_addSection(std::vector<STypesSection *> &list, const Utils::String &section, const Utils::String &data)
907
void CXspFile::_addSection(Utils::CList<STypesSection> &list, const Utils::String &section, const Utils::String &data)
908
{
908
{
909
	STypesSection *currentSubSection = NULL;
909
	STypesSection *currentSubSection = NULL;
910
	for(std::vector<STypesSection *>::iterator itr = list.begin(); itr != list.end(); itr++) {
910
	for(Utils::CList<STypesSection>::iterator itr = list.begin(); itr != list.end(); itr++) {
911
		if ( (*itr)->sSection.Compare(section) ) {
911
		if ( (*itr)->sSection.Compare(section) ) {
912
			currentSubSection = *itr;
912
			currentSubSection = *itr;
913
			break;
913
			break;
914
		}
914
		}
915
	}
915
	}
Line 921... Line 921...
921
	}
921
	}
922
 
922
 
923
	currentSubSection->lEntries.pushBack(data, "");
923
	currentSubSection->lEntries.pushBack(data, "");
924
}
924
}
925
 
925
 
926
void CXspFile::_addDataSection(CyStringList &list, std::vector<STypesSection *&gt; &sectionList)
926
void CXspFile::_addDataSection(CyStringList &list, Utils::CList<STypesSection&gt; &sectionList, bool bUseFirst)
927
{
927
{
928
	for(SStringList *str = list.Head(); str; str = str->next) {
928
	for(SStringList *str = list.Head(); str; str = str->next) {
-
 
929
		if ( bUseFirst ) {
-
 
930
			Utils::String data = str->str.ToString();
-
 
931
			_addSection(sectionList, data.token(";", 1), data.tokens(";", 2));
-
 
932
		}
-
 
933
		else {
929
		_addSection(sectionList, str->str.ToString(), str->data.ToString());
934
			_addSection(sectionList, str->str.ToString(), str->data.ToString());
-
 
935
		}
930
	}
936
	}
931
}
937
}
932
 
938
 
933
void CXspFile::addDummiesToList(std::vector<STypesSection *> &list)
939
void CXspFile::addDummiesToList(Utils::CList<STypesSection> &list)
934
{
940
{
935
	ADDSECTIONLIST(SDummy, m_lDummy);
941
	ADDSECTIONLIST(SDummy, m_lDummy);
936
}
942
}
937
 
943
 
938
void CXspFile::addComponentsToList(CLinkList<SComponentEntry> &componentList)
944
void CXspFile::addComponentsToList(CLinkList<SComponentEntry> &componentList)
Line 954... Line 960...
954
 
960
 
955
		_addSection(currentSection->lEntries, node->Data()->sSection2, node->Data()->sData);
961
		_addSection(currentSection->lEntries, node->Data()->sSection2, node->Data()->sData);
956
	}
962
	}
957
}
963
}
958
 
964
 
959
void CXspFile::addCutDataToList(std::vector<STypesSection *> &list)
965
void CXspFile::addCutDataToList(Utils::CList<STypesSection> &list)
960
{
966
{
961
	_addDataSection(this->m_lCutData, list);
967
	_addDataSection(this->m_lCutData, list, false);
962
}
968
}
963
 
969
 
964
void CXspFile::addBodiesToList(std::vector<STypesSection *> &list)
970
void CXspFile::addBodiesToList(Utils::CList<STypesSection> &list)
965
{
971
{
966
	_addDataSection(this->m_lBodies, list);
972
	_addDataSection(this->m_lBodies, list, true);
967
}
973
}
968
 
974
 
969
void CXspFile::addAnimationsToList(std::vector<STypesSection *> &list)
975
void CXspFile::addAnimationsToList(Utils::CList<STypesSection> &list)
970
{
976
{
971
	_addDataSection(this->m_lAnimations, list);
977
	_addDataSection(this->m_lAnimations, list, false);
972
}
978
}
973
 
979
 
974
 
980
 
975
void CXspFile::addGeneratedFiles(HZIP &hz)
981
void CXspFile::addGeneratedFiles(HZIP &hz)
976
{
982
{
Line 1001... Line 1007...
1001
					CLinkList<SComponentEntry> componentList;
1007
					CLinkList<SComponentEntry> componentList;
1002
					this->addComponentsToList(componentList);
1008
					this->addComponentsToList(componentList);
1003
					for(CListNode<SComponentEntry> *node = componentList.Front(); node; node = node->next()) {
1009
					for(CListNode<SComponentEntry> *node = componentList.Front(); node; node = node->next()) {
1004
						data += node->Data()->sSection + "; " + (long)node->Data()->lEntries.size() + ";\r\n";
1010
						data += node->Data()->sSection + "; " + (long)node->Data()->lEntries.size() + ";\r\n";
1005
						data += CXspFile::TypesListToString(node->Data()->lEntries, true);
1011
						data += CXspFile::TypesListToString(node->Data()->lEntries, true);
1006
						delete node->Data();
-
 
1007
					}
1012
					}
1008
				}
1013
				}
1009
				break;
1014
				break;
1010
			case 3:
1015
			case 3:
1011
				GENERATESECTION("Dummies", SDummy, this->m_lDummy);
1016
				GENERATESECTION("Dummies", SDummy, this->m_lDummy);
1012
				break;
1017
				break;
1013
			case 4:
1018
			case 4:
1014
				GENERATESTRINGSECTION("Bodies", this->m_lBodies);
1019
				GENERATESTRINGSECTION("Bodies", this->m_lBodies, true);
1015
				break;
1020
				break;
1016
		}
1021
		}
1017
 
1022
 
1018
		if ( type.empty() ) continue;
1023
		if ( type.empty() ) continue;
1019
 
1024
 
Line 1404... Line 1409...
1404
		return TAT_3;
1409
		return TAT_3;
1405
 
1410
 
1406
	return TAT_NONE;
1411
	return TAT_NONE;
1407
}
1412
}
1408
 
1413
 
1409
Utils::String CXspFile::TypesListToString(std::vector<STypesSection *> &list, bool deleteAfter)
1414
Utils::String CXspFile::TypesListToString(Utils::CList<STypesSection> &list, bool deleteAfter)
1410
{
1415
{
1411
	Utils::String data;
1416
	Utils::String data;
1412
 
1417
 
1413
	for(std::vector<STypesSection *>::iterator itr = list.begin(); itr != list.end(); itr++) {
1418
	for(Utils::CList<STypesSection>::iterator itr = list.begin(); itr != list.end(); itr++) {
1414
		data += (*itr)->sSection + "; " + (long)(*itr)->lEntries.size() + ";\r\n";
1419
		data += (*itr)->sSection + "; " + (long)(*itr)->lEntries.size() + ";\r\n";
1415
		for(Utils::SStringList *str = (*itr)->lEntries.first(); str; str = (*itr)->lEntries.next()) {
1420
		for(Utils::SStringList *str = (*itr)->lEntries.first(); str; str = (*itr)->lEntries.next()) {
1416
			data += str->str + "\r\n";
1421
			data += str->str + "\r\n";
1417
		}
1422
		}
1418
 
1423
 
1419
		if ( deleteAfter ) {
1424
		if ( deleteAfter ) {
1420
			(*itr)->lEntries.clear();
1425
			(*itr)->lEntries.clear();
1421
			delete *itr;
-
 
1422
		}
1426
		}
1423
	}
1427
	}
1424
 
1428
 
1425
	return data;
1429
	return data;
1426
}
1430
}