Finale PDK Framework 0.77
Power Up Your Finale Music Software
Loading...
Searching...
No Matches
ff_basecollection.h
1/*
2 * File: ff_basecollection.h
3 * Author: Jari Williamsson
4 *
5 * Created on den 22 november 2010, 19:35
6 */
7
8#ifndef FF_BASECOLLECTION_H
9#define FF_BASECOLLECTION_H
10
11#include "ff_base.h"
12
13
14
26{
27#ifndef DOXYGEN_SHOULD_IGNORE_THIS
31 int _counter;
32
36 int _arraysize;
37
38
43 void _RequireElement(int no_of_required_elements);
44
49 void _FreeElements();
50
53 {
54 assert(false); // do not allow copy constructor on collections.
55 }
56
58 __FCCollection& operator=(const __FCCollection&)
59 {
60 assert(false); // do not allow operator= on collections.
61 return *this;
62 }
63
64protected:
68 __FCBase** _pDataArray;
69#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
70public:
71 const char* ClassName() const override { return "__FCCollection"; }
72
75 {
76 _arraysize = 0;
77 _counter = 0;
78 _pDataArray = NULL;
79 }
80
89 {
90 _FreeElements();
91 if (_pDataArray) delete [] _pDataArray;
92 _pDataArray = NULL;
93 _counter = 0;
94 }
95
102 int GetCount() const { return _counter; }
103
110 void Add(__FCBase *pNewItem);
111
117 bool UniqueAdd(__FCBase *pNewItem)
118 {
119 if (!ElementExists(pNewItem))
120 {
121 Add(pNewItem);
122 return true;
123 }
124 return false;
125 }
126
133 void InsertItemAt(__FCBase *pNewItem, int index);
134
139 bool ElementExists(__FCBase* pQueryItem);
140
151 void ClearAll()
152 {
153 _FreeElements();
154 _counter = 0;
155 }
156
163 {
164 _counter = 0;
165 }
166
171 __FCBase* GetItemAt(int index) const;
172
175 {
176 return GetItemAt(GetCount() - 1);
177 }
178
180 __FCBase* operator [] (int index) const
181 {
182 return GetItemAt(index);
183 }
184
191 int GetIndexOf(__FCBase* pObject) const;
192
200 __FCBase* DetachItemAt(int index);
201
212 bool ClearItemAt(int index);
213
221 int ToEndFrom(int index, FCIteratorHandler* pIterator);
222
229 int ForEach(FCIteratorHandler* pIterator) override;
230
233 virtual int ForEachIndex(FCIteratorHandler* pIterator);
234
243 __FCBase* FindFirst(FCIteratorHandler* pIterator) override;
244
253 __FCBase* FindUserData(void* data_to_find);
254
264 bool Sort(FCIteratorHandler* pIterator);
265
270 bool Swap(int index1, int index2)
271 {
272 if (index1 == index2) return false;
273 if (index1 < 0 || index2 < 0) return false;
274 if (index1 >= _counter || index2 >= _counter) return false;
275 __FCBase* pObjectTemp = _pDataArray[index1];
276 _pDataArray[index1] = _pDataArray[index2];
277 _pDataArray[index2] = pObjectTemp;
278 return true;
279 }
280
285 bool IsEmpty() const { return (GetCount() == 0); }
286
295 int MoveFrom(__FCCollection* pOtherCollection, bool unique = false)
296 {
297 int counter = 0;
298 while (pOtherCollection->GetCount() > 0)
299 {
300 if (unique)
301 counter += UniqueAdd(pOtherCollection->GetItemAt(0)) ? 1 : 0;
302 else
303 {
304 Add(pOtherCollection->GetItemAt(0));
305 counter ++;
306 }
307 pOtherCollection->DetachItemAt(0);
308 }
309 return counter;
310 }
311
320 bool IsIdentical(const __FCBase* pCompareObject) const override
321 {
322 const __FCCollection* pCompareCollection = dynamic_cast<const __FCCollection *>(pCompareObject);
323 if (pCompareCollection->GetCount() != GetCount()) return false;
324 for (int i = 0; i < GetCount(); i++)
325 {
326 __FCBase* pCurrent = GetItemAt(i);
327 __FCBase* pCompare = pCompareCollection->GetItemAt(i);
328 if (!pCurrent->IsIdentical(pCompare)) return false;
329 }
330 return true;
331 }
332
333#ifdef PDK_FRAMEWORK_DEBUG
334 void DebugDump() override
335 {
337 DebugOutInt("Array size: ", _arraysize);
338 DebugOutInt("Number of items: ", GetCount());
339 for (int i = 0; i < GetCount(); i++)
340 {
341 __FCBase* pObject = GetItemAt(i);
342 DebugOutInt("===> Object item: ", i);
343 pObject->DebugDump();
344 }
345 }
346#endif
347};
348
349
357{
358 template<typename NUMTYPE>
359 std::vector<NUMTYPE> _GetNumberTable() const
360 {
361 static_assert(std::is_floating_point<NUMTYPE>::value || std::is_integral<NUMTYPE>::value, "NUMTYPE must be either an integer or floating point type");
362 std::vector<NUMTYPE> retval(GetCount());
363 for (int i = 0; i < GetCount(); i++)
364 {
365 if constexpr(std::is_floating_point<NUMTYPE>::value)
366 retval[i] = static_cast<NUMTYPE>(GetItemAt(i)->GetFloat());
367 else if constexpr(std::is_integral<NUMTYPE>::value)
368 retval[i] = static_cast<NUMTYPE>(GetItemAt(i)->GetInt());
369 else
370 assert(false); // should never get here due to static_assert above, but piece o' the rock.
371 }
372 return retval;
373 }
374
375 template<typename NUMTYPE>
376 void _SetNumberTable(const std::vector<NUMTYPE>& table)
377 {
378 static_assert(std::is_floating_point<NUMTYPE>::value || std::is_integral<NUMTYPE>::value, "NUMTYPE must be either an integer or floating point type");
379 ClearAll();
380 for (int i = 0; i < table.size(); i++)
381 {
382 if constexpr(std::is_floating_point<NUMTYPE>::value)
383 AddFloat(table[i]);
384 else if constexpr(std::is_integral<NUMTYPE>::value)
385 AddInt(table[i]);
386 else
387 assert(false); // should never get here due to static_assert above, but piece o' the rock.
388 }
389 }
390
391 public:
392 const char* ClassName() const override { return "FCNumbers"; }
393
399
404 FCNumber* GetItemAt(int index) const { return (FCNumber*) __FCCollection::GetItemAt(index); }
405
407 FCNumber* FindInt(int intvalue)
408 {
409 for (int i = 0; i < GetCount(); i++)
410 {
411 FCNumber* pNumber = GetItemAt(i);
412 if (pNumber->GetInt() == intvalue) return pNumber;
413 }
414 return NULL;
415 }
416
425 FCNumber* AddUniqueInt(int intvalue)
426 {
427 FCNumber* pNumber = FindInt(intvalue);
428 if (pNumber) return pNumber;
429 pNumber = new FCNumber(intvalue);
430 Add(pNumber);
431 return pNumber;
432 }
433
438 void AddInt(int intvalue)
439 {
440 Add(new FCNumber(intvalue));
441 }
442
447 void ClearInt(int intvalue)
448 {
449 while (true)
450 {
451 FCNumber* pNumber = FindInt(intvalue);
452 if (!pNumber) return;
453 ClearItemAt(GetIndexOf(pNumber));
454 }
455 }
456
461 void ClearInts(FCNumbers* pNumbers)
462 {
463 if (!pNumbers) return;
464 for (int i = 0; i < pNumbers->GetCount(); i++)
465 {
466 ClearInt(pNumbers->GetItemAt(i)->GetInt());
467 }
468 }
469
474 void AddFloat(double afloat)
475 {
476 Add(new FCNumber(afloat));
477 }
478
483 void CopyFrom(FCNumbers* pNumbers);
484
487 void SortNumerically(bool upwards);
488
490 bool HasIntDuplicates();
491
498 std::vector<int> GetIntTable() const
499 {
500 return _GetNumberTable<int>();
501 }
502
509 void SetIntTable(const std::vector<int>& table)
510 {
511 _SetNumberTable<int>(table);
512 }
513
520 std::vector<double> GetFloatTable() const
521 {
522 return _GetNumberTable<double>();
523 }
524
531 void SetFloatTable(const std::vector<double>& table)
532 {
533 _SetNumberTable<double>(table);
534 }
535};
536
537
538#ifdef PDK_FRAMEWORK_TINYXML
544{
545public:
546#ifdef PDK_FRAMEWORK_TINYXML
549 virtual __FCBase* CreateElement() = 0;
550#endif
551
557 void StoreCollectionToXML(tinyxml2::XMLElement* pParentNode, const char* pszNameString)
558 {
559 pParentNode->DeleteChildren();
560 for (int i = 0; i < GetCount(); i++)
561 {
562 tinyxml2::XMLElement* pItemNode = pParentNode->GetDocument()->NewElement(pszNameString);
563 pParentNode->InsertEndChild(pItemNode);
564 pItemNode->SetAttribute("CollectionIdx", i + 1);
565 __FCBase* pObject = GetItemAt(i);
566 pObject->StoreToXML(pItemNode); /* Call virtual method to store object data */
567 }
568 }
569
578 void ReadCollectionFromXML(tinyxml2::XMLElement* pParentNode, const char* pszNameString)
579 {
580 ClearAll();
581
582 tinyxml2::XMLElement* pChildNode = pParentNode->FirstChildElement(pszNameString);
583 while (pChildNode)
584 {
585 __FCBase* pObject = CreateElement();
586
587 /* Call virtual method to read object data */
588 if (pObject->ReadFromXML(pChildNode))
589 {
590 Add(pObject);
591 }
592 else
593 delete pObject;
594
595 pChildNode = pChildNode->NextSiblingElement(pszNameString);
596 }
597 }
598};
599#endif
600
606{
607#ifndef DOXYGEN_SHOULD_IGNORE_THIS
608 EXTAG _customtag;
609protected:
613 virtual __FCBaseData* CreateElement() = 0;
614#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
615
618 EXTAG GetCustomTag() const { return _customtag; }
619public:
620
626 {
627 _customtag = 0;
628 }
629
630 const char* ClassName() const override { return "__FCCollectionData"; }
631
638 virtual int LoadAll();
639
646 virtual bool SaveAll()
647 {
648 for (int i = 0; i < GetCount(); i++)
649 {
650 __FCBaseData* pObject = (__FCBaseData*) _pDataArray[i];
651 pObject->SetCustomTag(_customtag);
652 if (!pObject->Save()) return false;
653 }
654 return true;
655 }
656
664 void SetCustomTag(EXTAG tag) { _customtag = tag; }
665};
666
667#ifdef PDK_FRAMEWORK_ENTRIES
668class FCNoteEntry;
669
679{
680#ifndef DOXYGEN_SHOULD_IGNORE_THIS
681protected:
682 FCNoteEntry* _pNoteEntry; /* Used for LoadAll */
683#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
684public:
685 const char* ClassName() const override { return "__FCCollectionEntryDetail"; }
686
692 {
693 SetNoteEntry(pConnectEntry);
694 }
695
697 void SetNoteEntry(FCNoteEntry* pEntry) { _pNoteEntry = pEntry; }
698
708 int LoadAll() override;
709
717 virtual void SaveNew();
718
723 int LoadAllForEntryNumber(ENTNUM entnum);
724
725
739 bool DestroyItemAt(int index);
740};
741#endif // #ifdef PDK_FRAMEWORK_ENTRIES
742
743
744class __FCInciOther;
745
754{
755public:
756 const char* ClassName() const override { return "__FCCollectionInciOther"; }
757
769 virtual bool DeleteDataForItem(CMPER cmper);
770
786 bool SaveDataAs(CMPER cmperfrom,
787 CMPER cmperto);
788
798 virtual int LoadAllForItem(CMPER cmper);
799
811 virtual bool SaveAllForItem(CMPER cmper);
812
821 CMPER SaveAllAsNew();
822
829 __FCInciOther* FindItemNo(CMPER cmper, twobyte inci);
830};
831
832
833class __FCNoInciOther;
834
843{
844public:
845 const char* ClassName() const override { return "__FCCollectionNoInciOther"; }
846
852 __FCNoInciOther* FindItemNo(CMPER cmper);
853
854};
855
856
864{
865public:
866 const char* ClassName() const override { return "__FCCollectionGlobal"; }
867};
868
869
870
871
880{
881public:
882 const char* ClassName() const override { return "__FCCollectionDetail"; }
883
889};
890
899{
900public:
901 const char* ClassName() const override { return "__FCCollectionPrefs"; }
902
908
909};
910
911
912
919{
920public:
921 const char* ClassName() const override { return "__FCCollectionNoInciDetail"; }
922
928
936 virtual int LoadAllForItem(CMPER cmper1, CMPER cmper2base = 1);
937};
938
946{
947public:
948 const char* ClassName() const override { return "FCSettingsPairs"; }
949
957 FCSettingsPair* FindPrefixedKey(const char* pszPrefix, int indexnumber)
958 {
959 FCString trystring;
960 trystring.SetCString(pszPrefix);
961 trystring.AppendInteger(indexnumber);
962 for (int i = 0; i < GetCount(); i++)
963 {
965 if (trystring.CompareNoCase(*pPair->GetKeyString()) == 0)
966 {
967 return pPair;
968 }
969 }
970 return NULL;
971 }
972
979 {
980 for (int i = 0; i < GetCount(); i++)
981 {
983 if (pKeyString->CompareNoCase(*pPair->GetKeyString()) == 0)
984 {
985 return pPair;
986 }
987 }
988 return NULL;
989 }
990
998 FCSettingsPair* AddKeyValue(FCString* pKeyString, FCString* pValueString)
999 {
1000 FCSettingsPair* pFoundPair = FindKey(pKeyString);
1001 if (pFoundPair)
1002 {
1003 pFoundPair->SetValueString(pValueString);
1004 return pFoundPair;
1005 }
1006 FCSettingsPair* pNewPair = new FCSettingsPair(pKeyString, pValueString);
1007 Add(pNewPair);
1008 return pNewPair;
1009 }
1010
1011
1021 bool RetrieveBoolValue(FCString* pKeyString, bool* pValue)
1022 {
1023 FCSettingsPair* pKey = FindKey(pKeyString);
1024 if (!pKey) return false;
1025 *pValue = pKey->GetValueString()->IsEqual("1");
1026 return true;
1027 }
1028
1044 bool RetrieveIntValue(FCString* pKeyString, int* pValue, int min = -1, int max = -1)
1045 {
1046 FCSettingsPair* pKey = FindKey(pKeyString);
1047 if (!pKey) return false;
1048 int value = pKey->GetValueString()->GetInteger();
1049 if (min < max)
1050 {
1051 /* Check for max/min values */
1052 if (value < min) value = min;
1053 if (value > max) value = max;
1054 }
1055 *pValue = value;
1056 return true;
1057 }
1058
1060 void StoreBoolValue(FCString* pKeyString, bool boolvalue)
1061 {
1062 FCString valuestring;
1063 valuestring.SetInteger(boolvalue ? 1 : 0);
1064 AddKeyValue(pKeyString, &valuestring);
1065 }
1066
1068 void StoreIntValue(FCString* pKeyString, int intvalue)
1069 {
1070 FCString valuestring;
1071 valuestring.SetInteger(intvalue);
1072 AddKeyValue(pKeyString, &valuestring);
1073 }
1074};
1075
1076
1085{
1086public:
1092 {
1093 }
1094
1103 bool AddCopy(const FCString* pString)
1104 {
1105 if (!pString) return false;
1106 FCString* pNewString = new FCString();
1107 pNewString->SetString(pString);
1108 Add(pNewString);
1109 return true;
1110 }
1111
1112 const char* ClassName() const override { return "FCStrings"; }
1113
1118 FCString* GetItemAt(int index) const { return (FCString*) __FCCollection::GetItemAt(index); }
1119
1133 void InsertStringAt(const FCString *pNewString, int index)
1134 {
1135 if (!pNewString) return;
1136 if (index < 0) return;
1137 FCString* pString = new FCString(*pNewString);
1138 __FCCollection::InsertItemAt(pString, index);
1139 }
1140
1141#ifdef PDK_FRAMEWORK_ENIGMASTRINGS
1147 {
1148 for (int i = 0; i < GetCount(); i++)
1149 {
1150 FCString* pString = (FCString*) GetItemAt(i);
1151 if (pString->IsEnigmaFont()) return true;
1152 }
1153 return false;
1154 }
1155#endif
1156
1171 {
1172 FCSettingsPairs* pSettingsPairs = new FCSettingsPairs();
1173 for (int i = 0; i < GetCount(); i++)
1174 {
1175 FCString* pString = (FCString*) GetItemAt(i);
1176 int separatorposition = pString->FindFirst("=");
1177 if (separatorposition < 1) continue;
1178 FCString keystring, valuestring;
1179 keystring.SetString(pString);
1180 valuestring.SetString(pString);
1181 keystring.TruncateAt(separatorposition);
1182 valuestring.DeleteCharactersAt(0, separatorposition + 1);
1183
1184 FCSettingsPair* pPair = new FCSettingsPair(&keystring, &valuestring);
1185 pSettingsPairs->Add(pPair);
1186 }
1187 return pSettingsPairs;
1188 }
1189
1201 FCString* CreateString(const char* pszSeparator = NULL)
1202 {
1203 FCString* pReturnString = new FCString;
1204 for (int i = 0; i < GetCount(); i++)
1205 {
1206 FCString* pString = (FCString*) GetItemAt(i);
1207 if (!pString) continue;
1208 pReturnString->AppendString(pString);
1209 if (pszSeparator && (i < (GetCount() - 1)))
1210 {
1211 pReturnString->AppendCString(pszSeparator);
1212 }
1213 }
1214 return pReturnString;
1215 }
1216
1217#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
1219 luabridge::RefCountedPtr<FCString> CreateString_GC(const char* pszSeparator = NULL)
1220 { return makeLuaSharedPtr(CreateString(pszSeparator)); }
1221#endif
1222
1238 FCString* CreateRowsString(bool bNewLineAtEnd)
1239 {
1240 FCString* pReturnString = new FCString;
1241 for (int i = 0; i < GetCount(); i++)
1242 {
1243 FCString* pString = (FCString*) GetItemAt(i);
1244 if (pString) pReturnString->AppendString(pString);
1245 if (i < (GetCount() - 1))
1246 {
1247 pReturnString->AppendCString(pReturnString->GetEOL());
1248 }
1249 }
1250 if (bNewLineAtEnd) pReturnString->AppendCString(pReturnString->GetEOL());
1251 return pReturnString;
1252 }
1253
1254#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
1256 luabridge::RefCountedPtr<FCString> CreateRowsString_GC(bool bNewLineAtEnd)
1257 { return makeLuaSharedPtr(CreateRowsString(bNewLineAtEnd)); }
1258#endif
1259
1266 FCString* Find(FCString* pFindString)
1267 {
1268 if (!pFindString) return NULL;
1269 for (int i = 0; i < GetCount(); i++)
1270 {
1271 FCString* pString = (FCString*) GetItemAt(i);
1272 if (!pString) continue;
1273 if (pString->IsEqualString(*pFindString)) return pString;
1274 }
1275 return NULL;
1276 }
1277
1288 {
1289 if (!pFindString) return NULL;
1290 FCString findstring;
1291 findstring.SetString(pFindString);
1292 findstring.ToLowerCase();
1293 for (int i = 0; i < GetCount(); i++)
1294 {
1295 if (!GetItemAt(i)) continue;
1296 FCString string;
1297 string.SetString(GetItemAt(i));
1298 string.ToLowerCase();
1299 if (string.IsEqualString(findstring)) return GetItemAt(i);
1300 }
1301 return NULL;
1302 }
1303
1309 void CopyFrom(FCStrings* pSourceStrings)
1310 {
1311 if (!pSourceStrings) return;
1312 ClearAll();
1313 for (int i = 0; i < pSourceStrings->GetCount(); i++)
1314 {
1315 FCString* pSourceString = pSourceStrings->GetItemAt(i);
1316 if (pSourceString)
1317 {
1318 FCString* pNewString = new FCString();
1319 pNewString->SetString(pSourceString);
1320 Add(pNewString);
1321 }
1322 else
1323 Add(NULL);
1324 }
1325 }
1326
1335 void CopyFromStringTable(const std::vector<std::string> &strings)
1336 {
1337 ClearAll();
1338 for (int i = 0; i < strings.size(); i++)
1339 {
1340 FCString* pNewString = new FCString(strings[i].c_str());
1341 Add(pNewString);
1342 }
1343 }
1344
1351 {
1352 for (int i = 0; i < GetCount(); i++)
1353 {
1354 FCString* pString = GetItemAt(i);
1355 if (pString) pString->TrimWhitespace();
1356 }
1357 }
1358
1366 {
1367 for (int i = GetCount() - 1; i >= 0; i--)
1368 {
1369 FCString* pString = GetItemAt(i);
1370 if (!pString)
1371 {
1372 ClearItemAt(i);
1373 }
1374 else if (pString->IsEmpty())
1375 {
1376 ClearItemAt(i);
1377 }
1378 }
1379 }
1380
1387 void SortAlphabetical();
1388
1399 void ParseEnigmaFontInfo(int index, FCFontInfo* pFontInfo);
1400
1401#ifdef PDK_FRAMEWORK_STREAMS
1411 bool LoadSymbolFonts();
1412#endif
1413
1422 bool LoadFolderFiles(FCString* pFolderString);
1423
1430 bool LoadSubfolders(FCString* pFolderString);
1431
1441 bool LoadSystemFontNames();
1442};
1443
1444
1447{
1448 public:
1449 const char* ClassName() const override { return "FCNumberCollection"; }
1450};
1451
1452
1453#ifdef PDK_FRAMEWORK_ENTRIES
1454
1455class FCNoteEntryCell;
1456
1463{
1464 bool _loaded;
1465
1466 // This value remains global because it is a global condition in Finale. Whichever concurrently
1467 // running script sets it, the next internal call to metrics will rebuild them.
1468 static bool _updatemetrics;
1469
1470
1471public:
1472 const char* ClassName() const override { return "FCNoteEntryCellMetrics"; }
1473
1478
1479 virtual ~FCNoteEntryCellMetrics()
1480 {
1481 }
1482
1484 bool Load(FCNoteEntryCell* pEntryCell);
1485
1488
1489
1492};
1493#endif
1494
1495
1503{
1504public:
1505 /* The constructor */
1507
1510 {
1511 if (!pObject) return NULL;
1512 __FCCollection::Add(pObject);
1513 return pObject;
1514 }
1515};
1516
1517
1525{
1526public:
1527 const char* ClassName() const override { return "FCRanges"; }
1528
1534
1539 FCRange* GetItemAt(int index) const { return (FCRange*) __FCCollection::GetItemAt(index); }
1540};
1541
1549{
1550 CMPER _cmper;
1551
1552public:
1553 const char* ClassName() const override { return "FCChordSuffixKeyNumberOffsets"; }
1554
1560
1568 bool Load(CMPER suffixno);
1569
1578 bool Save();
1579
1591 bool SaveAs(CMPER suffixno)
1592 {
1593 _cmper = suffixno;
1594 return Save();
1595 }
1596
1601 CMPER GetChordSuffixID() const { return _cmper; }
1602};
1603
1604#endif /* FF_BASECOLLECTION_H */
1605
Base class for all data-related classes (that handles Finale data).
Definition ff_base.h:676
void SetCustomTag(EXTAG tag)
Sets the custom Enigma tag, for classes that support multiple Enigma tags.
Definition ff_base.h:882
virtual bool Save()
Saves the currently loaded to its current location.
Definition finaleframework.cpp:951
Base class for the Finale Framework classes.
Definition ff_base.h:71
virtual bool IsIdentical(const __FCBase *pCompareObject) const
Returns true if the data in the passed object is considered to be identical to the current object,...
Definition ff_base.h:539
static void DebugOutInt(const char *pszPrefixText, int i)
Static method that outputs a line for debugging purposes. The text appears with the extra digit (in d...
Definition finaleframework.cpp:335
virtual void DebugDump()
Outputs the class data/information for debugging purposes.
Definition finaleframework.cpp:609
virtual bool ReadFromXML(tinyxml2::XMLElement *pParentNode)
Virtual method that is used to read object data.
Definition ff_base.h:663
virtual void StoreToXML(tinyxml2::XMLElement *pParentNode)
Virtual method that is used to store an object's data.
Definition ff_base.h:596
Base class for all collections based on decendants from __FCBaseData.
Definition ff_basecollection.h:606
__FCCollectionData()
The constructor.
Definition ff_basecollection.h:625
virtual int LoadAll()
Loads all available data into the collection.
Definition finaleframework.cpp:13964
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_basecollection.h:630
void SetCustomTag(EXTAG tag)
Sets a custom Enigma tag for the elements of the collection.
Definition ff_basecollection.h:664
virtual bool SaveAll()
Saves all data in the collection.
Definition ff_basecollection.h:646
Base class specially designed for collections of detail classes.
Definition ff_basecollection.h:880
__FCCollectionDetail()
The constructor.
Definition ff_basecollection.h:886
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_basecollection.h:882
Base class specially designed for collections of entry detail classes.
Definition ff_basecollection.h:679
int LoadAllForEntryNumber(ENTNUM entnum)
Loads all elements for a specific entry number.
Definition finaleframework.cpp:14029
void SetNoteEntry(FCNoteEntry *pEntry)
Assigns the entry number that should be used for LoadAll, etc.
Definition ff_basecollection.h:697
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_basecollection.h:685
virtual void SaveNew()
Saving all note entry details as new records to the destination entry.
Definition finaleframework.cpp:14015
bool DestroyItemAt(int index)
Deletes the data associated with the object and deletes the item from the collection.
Definition finaleframework.cpp:14049
int LoadAll() override
Overloaded version of LoadAll. It will load all elements for the current entry number.
Definition finaleframework.cpp:13984
__FCCollectionEntryDetail(FCNoteEntry *pConnectEntry=NULL)
The constructor.
Definition ff_basecollection.h:691
Base class for "Global" data.
Definition ff_basecollection.h:864
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_basecollection.h:866
Base class for all collection classes. A collection is a storage that can store multiple objects of s...
Definition ff_basecollection.h:26
__FCBase * FindFirst(FCIteratorHandler *pIterator) override
Process elements until a match is found.
Definition finaleframework.cpp:13851
int GetIndexOf(__FCBase *pObject) const
Returns the 0-based order index for the object within the collection.
Definition finaleframework.cpp:13775
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_basecollection.h:71
virtual ~__FCCollection()
The virtual destructor, which deallocates the array and also all its elements.
Definition ff_basecollection.h:88
void Add(__FCBase *pNewItem)
Adds an element to the end of the collection.
Definition finaleframework.cpp:13726
int MoveFrom(__FCCollection *pOtherCollection, bool unique=false)
Moves elements from another collection into this collection. The other will be empty after the operat...
Definition ff_basecollection.h:295
void DetachAll()
Removes all the objects from the collection, without freeing/destroying the objects.
Definition ff_basecollection.h:162
__FCBase * FindUserData(void *data_to_find)
Returns the first element in the collection that has the indicated userdata.
Definition finaleframework.cpp:13864
bool ClearItemAt(int index)
Deletes the object at the index position and disposes the object. Index is 0-based.
Definition finaleframework.cpp:13791
void ClearAll()
Destroys all the objects in the collection and empties the collection.
Definition ff_basecollection.h:151
__FCBase * GetLastItem() const
Returns the last item in the collection.
Definition ff_basecollection.h:174
int ForEach(FCIteratorHandler *pIterator) override
Processes all elements in the collection (starting with item 0), or until the iterator Iterate() retu...
Definition finaleframework.cpp:13819
void DebugDump() override
Outputs the class data/information for debugging purposes.
Definition ff_basecollection.h:334
__FCBase * operator[](int index) const
Identical to the GetItemAt method.
Definition ff_basecollection.h:180
int ToEndFrom(int index, FCIteratorHandler *pIterator)
Processes one element after another and iterates from one specific index to the end of the collection...
Definition finaleframework.cpp:13802
bool IsEmpty() const
Returns true if the collection contains no elements.
Definition ff_basecollection.h:285
bool Sort(FCIteratorHandler *pIterator)
Sorts the elements of.
Definition finaleframework.cpp:13877
bool Swap(int index1, int index2)
Swaps to items in the collection.
Definition ff_basecollection.h:270
__FCBase * DetachItemAt(int index)
Removes the object at the index position. Index is 0-based.
Definition finaleframework.cpp:13781
virtual int ForEachIndex(FCIteratorHandler *pIterator)
Same as ForEach, but the IterateIndex callback of the iterator handler is used instead.
Definition finaleframework.cpp:13835
int GetCount() const
Returns the number of elements of the collection.
Definition ff_basecollection.h:102
__FCBase * GetItemAt(int index) const
Returns the object at the index position. Index is 0-based.
Definition finaleframework.cpp:13767
__FCCollection()
The constructor.
Definition ff_basecollection.h:74
bool ElementExists(__FCBase *pQueryItem)
Returns true if the element is found in the collection, otherwise false.
Definition finaleframework.cpp:13746
bool UniqueAdd(__FCBase *pNewItem)
Adds an element to the end of the collection, but only if it doesn't exist in the collection before.
Definition ff_basecollection.h:117
void InsertItemAt(__FCBase *pNewItem, int index)
Inserts an item into the collection.
Definition finaleframework.cpp:13733
bool IsIdentical(const __FCBase *pCompareObject) const override
Returns true if two collections are considered to be identical.
Definition ff_basecollection.h:320
Base class for "other" data with incis of the __FCInciOther class (where it's common to collect all i...
Definition ff_basecollection.h:754
virtual int LoadAllForItem(CMPER cmper)
Loads all subrecords (incis) for a specific item (cmper) and adds them as items to the collection.
Definition finaleframework.cpp:14141
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_basecollection.h:756
bool SaveDataAs(CMPER cmperfrom, CMPER cmperto)
Resaves all subrecords (incis) from the Finale database for a specific item (cmper) to another item (...
Definition finaleframework.cpp:14088
virtual bool DeleteDataForItem(CMPER cmper)
Deletes all subrecords (incis) from the Finale database for a specific item (cmper).
Definition finaleframework.cpp:14067
__FCInciOther * FindItemNo(CMPER cmper, twobyte inci)
Returns the (first) item that has the indicated item number (CMPER) and inci.
Definition finaleframework.cpp:14182
virtual bool SaveAllForItem(CMPER cmper)
Saves the whole collection to a specific item (cmper).
Definition finaleframework.cpp:14157
CMPER SaveAllAsNew()
Saves the whole collection with a new cmper.
Definition finaleframework.cpp:14169
Base class specially designed for collections of detail classes that doesn't use the inci.
Definition ff_basecollection.h:919
virtual int LoadAllForItem(CMPER cmper1, CMPER cmper2base=1)
Loads all subrecords (cmper2's) for a specific item (cmper1).
Definition finaleframework.cpp:14212
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_basecollection.h:921
__FCCollectionNoInciDetail()
The constructor.
Definition ff_basecollection.h:925
Base class for "other" data without incis (inci always 0.)
Definition ff_basecollection.h:843
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_basecollection.h:845
__FCNoInciOther * FindItemNo(CMPER cmper)
Returns the (first) item in the collection that has the indicated item number (CMPER).
Definition finaleframework.cpp:14198
Base class specially designed for collections of prefs classes.
Definition ff_basecollection.h:899
__FCCollectionPrefs()
The constructor.
Definition ff_basecollection.h:905
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_basecollection.h:901
Base class for all collections that are streamable to XML.
Definition ff_basecollection.h:544
void ReadCollectionFromXML(tinyxml2::XMLElement *pParentNode, const char *pszNameString)
Reads the objects to the collection from the XML.
Definition ff_basecollection.h:578
void StoreCollectionToXML(tinyxml2::XMLElement *pParentNode, const char *pszNameString)
Stores the objects in the collection to the XML.
Definition ff_basecollection.h:557
virtual __FCBase * CreateElement()=0
If XML streaming of objects are enabled, override in all __FCCollection base classes.
Base class for "other" (ot_*) data with incis.
Definition ff_other.h:63
The base class for both browser and collection classes.
Definition ff_iterator.h:209
Base class for the "Other" (ot_*) Enigma structures that don't use the inci parameter.
Definition ff_other.h:231
A number collection of key offsets for playback of chord suffixes.
Definition ff_basecollection.h:1549
bool SaveAs(CMPER suffixno)
Saves the key offsets for the input ID. The current contents of the collection completely replace any...
Definition ff_basecollection.h:1591
CMPER GetChordSuffixID() const
Returns the suffix id of the collection, if loaded, or zero if not loaded.
Definition ff_basecollection.h:1601
bool Save()
Saves the key offsets for the previously loaded ID. The current contents of the collection completely...
Definition finaleframework.cpp:4098
FCChordSuffixKeyNumberOffsets()
The constructor.
Definition ff_basecollection.h:1559
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_basecollection.h:1553
bool Load(CMPER suffixno)
Loads the key offsets for the input ID.
Definition finaleframework.cpp:4079
Very simple garbage collection for C++. Use the GC_Add method to add items.
Definition ff_basecollection.h:1503
__FCBase * GC_Add(__FCBase *pObject)
Returns the pointer to the object. Also, only adds non-NULL objects to the collection.
Definition ff_basecollection.h:1509
Class that encapsulate the entry metrics data.
Definition ff_base.h:4118
Class for document-independent font information.
Definition ff_base.h:1138
Class for iterator handlers.
Definition ff_iterator.h:26
Class that encapsulate a cell of note entries.
Definition ff_noteframe.h:3133
Class that encapsulate ALL the entry metrics data in a note entry cell, as well as the cell metrics....
Definition ff_basecollection.h:1463
FCNoteEntryCellMetrics()
The constructor.
Definition finaleframework.cpp:3993
bool Load(FCNoteEntryCell *pEntryCell)
Loads all the entry metrics and the cell metrics for the note entry cell.
Definition finaleframework.cpp:3998
FCEntryMetrics * GetItemAt(int index) const
Overridden method. Returns the item at the index.
Definition ff_basecollection.h:1491
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_basecollection.h:1472
FCEntryMetrics * FindMetricsForEntry(FCNoteEntry *pEntry)
Returns the entry metrics object connected with a specific note entry.
Definition finaleframework.cpp:4058
Encapsulates a note entry from an owner class (for example FCNoteEntryCell, FCNoteEntryLayer) class.
Definition ff_noteframe.h:940
Collection class for FCNumber instances.
Definition ff_basecollection.h:1447
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_basecollection.h:1449
Simple class to put numbers into collections.
Definition ff_base.h:4821
int GetInt() const
Returns the integer value version of the number.
Definition ff_base.h:4865
Simple collection class for FCNumber class objects.
Definition ff_basecollection.h:357
bool HasIntDuplicates()
Returns true if the numerical collection has integer duplicates.
Definition finaleframework.cpp:13945
void ClearInt(int intvalue)
Deletes all items in the collection that have a specific integer value.
Definition ff_basecollection.h:447
void SortNumerically(bool upwards)
Sorts the numbers in numerical order, upwards or downwards.
Definition finaleframework.cpp:13939
FCNumber * FindInt(int intvalue)
Returns the first object that contains the integer value.
Definition ff_basecollection.h:407
std::vector< double > GetFloatTable() const
Returns the floating point values as a vector of floating point values.
Definition ff_basecollection.h:520
void AddInt(int intvalue)
Appends an integer number to the collection.
Definition ff_basecollection.h:438
void CopyFrom(FCNumbers *pNumbers)
Copies all number objects from one collection to another. The old numbers are cleared.
Definition finaleframework.cpp:13904
void AddFloat(double afloat)
Appends an floating point number to the collection.
Definition ff_basecollection.h:474
FCNumber * AddUniqueInt(int intvalue)
Adds (appends) an integer number to the collection, but only if it doesn't already exist.
Definition ff_basecollection.h:425
FCNumbers()
The constructor.
Definition ff_basecollection.h:398
FCNumber * GetItemAt(int index) const
Overridden GetItemAt method.
Definition ff_basecollection.h:404
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_basecollection.h:392
void SetIntTable(const std::vector< int > &table)
Sets the integer values to match those of the input vector or Lua table.
Definition ff_basecollection.h:509
void ClearInts(FCNumbers *pNumbers)
Deletes all integers that are found in the supplied collection.
Definition ff_basecollection.h:461
std::vector< int > GetIntTable() const
Returns the integer values as a vector of integer values.
Definition ff_basecollection.h:498
void SetFloatTable(const std::vector< double > &table)
Sets the floating point values to match those of the input vector or Lua table.
Definition ff_basecollection.h:531
Class that encapsulates a range (start, length)
Definition ff_base.h:5570
Simple collection class for FCRange class objects.
Definition ff_basecollection.h:1525
FCRange * GetItemAt(int index) const
Overridden GetItemAt method.
Definition ff_basecollection.h:1539
FCRanges()
The constructor.
Definition ff_basecollection.h:1533
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_basecollection.h:1527
Class for storing a "key"+"value" pair of values.
Definition ff_base.h:3761
void SetValueString(FCString *pString)
Sets the "value" string.
Definition ff_base.h:3788
FCString * GetValueString()
Returns the "value" string.
Definition ff_base.h:3785
FCString * GetKeyString()
Returns the "key" string.
Definition ff_base.h:3782
Collection class for FCSettingsPair objects.
Definition ff_basecollection.h:946
void StoreBoolValue(FCString *pKeyString, bool boolvalue)
Stores a bool value to a settings pair in the collection.
Definition ff_basecollection.h:1060
FCSettingsPair * AddKeyValue(FCString *pKeyString, FCString *pValueString)
Adds or changes a value to the settings collection.
Definition ff_basecollection.h:998
bool RetrieveBoolValue(FCString *pKeyString, bool *pValue)
Gets a bool value from the settings pair and store it at the data location.
Definition ff_basecollection.h:1021
void StoreIntValue(FCString *pKeyString, int intvalue)
Stores an integer to a settings pair in the collection.
Definition ff_basecollection.h:1068
FCSettingsPair * FindKey(FCString *pKeyString)
Finds the pair that contains the key. The search is case insensitive.
Definition ff_basecollection.h:978
bool RetrieveIntValue(FCString *pKeyString, int *pValue, int min=-1, int max=-1)
Gets an integer value from the settings pair and store it at the data location.
Definition ff_basecollection.h:1044
FCSettingsPair * FindPrefixedKey(const char *pszPrefix, int indexnumber)
Finds the pair that contains the key, based on the index number. The search is case insensitive.
Definition ff_basecollection.h:957
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_basecollection.h:948
Class that provides storage for text. This is to achieve platform-transparent text handling,...
Definition ff_base.h:1877
void ToLowerCase()
Transforms the string to lower case.
Definition finaleframework.cpp:2859
void TrimWhitespace()
Trims whitespace at both ends of the string.
Definition finaleframework.cpp:1543
const char * GetEOL() const
Returns the platform-specific end-of-line character(s) as a C-string.
Definition finaleframework.cpp:1704
void SetCString(const char *pszBuffer, int maxchars=-1)
Sets the string, using a C-string version of the string.
Definition finaleframework.cpp:1234
bool IsEnigmaFont() const
Returns true if the string is an Enigma font command.
Definition finaleframework.cpp:1601
int GetInteger(int index=0) const
Converts the decimal string contents to an integer value.
Definition finaleframework.cpp:2056
void AppendString(const FCString *pOtherString)
Appends another string object to the string.
Definition finaleframework.cpp:1849
void SetInteger(int i)
Sets the string to an integer.
Definition finaleframework.cpp:2141
int CompareNoCase(const FCString &value) const
Case insensitive version of Compare.
Definition ff_base.h:2411
void SetString(const FCString *pString)
Copies a string.
Definition finaleframework.cpp:2398
bool TruncateAt(int newlength)
Truncates the string at the indicated position.
Definition ff_base.h:3670
void AppendCString(const char *pOtherString)
Appends a C-style string to the string.
Definition finaleframework.cpp:1861
bool IsEmpty() const
Returns true if the string is empty.
Definition ff_base.h:3179
int FindFirst(const char *pszSubStr) const
Returns the 0-based index for the first occurence of the substring.
Definition ff_base.h:2778
bool IsEqualString(const FCString &value) const
Returns true if the string is identical with the parameter. (FCString string version....
Definition ff_base.h:3142
bool IsEqual(const char *pszString) const
Returns true if the string is identical with the parameter.
Definition ff_base.h:3135
bool DeleteCharactersAt(int index, int count)
Removes a range of characters, starting at the 0-based index position.
Definition finaleframework.cpp:1491
void AppendInteger(int value)
Appends an integer value (decimal) to the string.
Definition finaleframework.cpp:1877
Collection class for FCString class objects.
Definition ff_basecollection.h:1085
void ClearEmptyStrings()
Removes all empty strings and all NULL pointers from the collection. The objects are disposed from th...
Definition ff_basecollection.h:1365
bool ContainEnigmaFont()
Returns true if any of the strings in the collection is an Enigma font command.
Definition ff_basecollection.h:1146
FCString * CreateString(const char *pszSeparator=NULL)
Creates a FCString object by concatenating all strings in the collection into one.
Definition ff_basecollection.h:1201
void TrimWhitespaceAll()
Trims leading and trailing whitespace in all the collection's strings.
Definition ff_basecollection.h:1350
FCString * FindNocase(FCString *pFindString)
Finds the string contents in the collection, in a case-insensitive search.
Definition ff_basecollection.h:1287
FCString * CreateRowsString(bool bNewLineAtEnd)
Creates a FCString object based on the string collection "rows". It's created by concatenating all st...
Definition ff_basecollection.h:1238
bool AddCopy(const FCString *pString)
Adds a copy of the FCString object to the string collection.
Definition ff_basecollection.h:1103
void ParseEnigmaFontInfo(int index, FCFontInfo *pFontInfo)
Browses the font info available in the strings from the start of the file up until (but not including...
Definition finaleframework.cpp:14233
bool LoadSymbolFonts()
Loads the user's macsymbolfonts.txt file into the string collection. The string collection will be so...
Definition finaleframework.cpp:14270
FCString * GetItemAt(int index) const
Overridden GetItemAt() method.
Definition ff_basecollection.h:1118
void SortAlphabetical()
Makes a "non-intelligent" simple alphabetical sort of the string collection.
Definition finaleframework.cpp:14263
bool LoadSubfolders(FCString *pFolderString)
Gets all subfolder names in a specific folder.
Definition finaleframework.cpp:14351
void CopyFromStringTable(const std::vector< std::string > &strings)
Replaces the contents of the collection from the input vector of std::string.
Definition ff_basecollection.h:1335
FCSettingsPairs * CreateSettingsPairs()
Create settings pairs based on the strings in the collection. The created collection must be deleted ...
Definition ff_basecollection.h:1170
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_basecollection.h:1112
void InsertStringAt(const FCString *pNewString, int index)
Inserts FCString at given index.
Definition ff_basecollection.h:1133
bool LoadSystemFontNames()
Gets all the font names on the system.
Definition finaleframework.cpp:14414
void CopyFrom(FCStrings *pSourceStrings)
Recreates a string collection. Any existing strings in the collection are cleared....
Definition ff_basecollection.h:1309
bool LoadFolderFiles(FCString *pFolderString)
Gets all files names in a specific folder.
Definition finaleframework.cpp:14300
FCStrings()
The constructor.
Definition ff_basecollection.h:1091
FCString * Find(FCString *pFindString)
Finds the exact string content in the collection.
Definition ff_basecollection.h:1266