Ejemplo n.º 1
0
                        ODSPropPath :: ODSPropPath (const ODSPropPath &rcODSPropPath )
                     :   path(NULL),
  struct_name(NULL),
  order(NULL),
  filter(NULL),
  acc_mode(PI_undefined),
  type(PT_undefined),
  collection(NO),
  selection(NO)
{

  SetPath(rcODSPropPath);
  SetAccessMode(rcODSPropPath.acc_mode);
  SetCollection(rcODSPropPath.collection);
  SetFilter(rcODSPropPath.filter,rcODSPropPath.selection);

}
Ejemplo n.º 2
0
ALERROR CMultiverseModel::SetCollection (const CJSONValue &Data, CString *retsResult)

//	SetCollection
//
//	Sets the collection from a JSON value. Caller should have called
//	OnCollectionLoading.

	{
	CSmartLock Lock(m_cs);
	int i;

	//	Try to load the collection into a temporary array. If we get any errors
	//	then we abort without damage.

	bool bErrors = false;
	TArray<CMultiverseCatalogEntry *> NewCollection;
	for (i = 0; i < Data.GetCount(); i++)
		{
		const CJSONValue &Entry = Data.GetElement(i);

		//	If this is a game engine entry then see if it tells us to upgrade
		//	our engine.

		if (strEquals(TYPE_GAME_ENGINE, Entry.GetElement(FIELD_TYPE).AsString()))
			{
			SetUpgradeVersion(Entry);
			continue;
			}

		//	Create a catalog entry and add to our collection

		CMultiverseCatalogEntry *pNewEntry;
		if (CMultiverseCatalogEntry::CreateFromJSON(Entry, &pNewEntry, retsResult) != NOERROR)
			{
			bErrors = true;
			continue;
			}

		//	If this entry is not valid (perhaps because it is still in
		//	development) then ignore it.

		if (!pNewEntry->IsValid())
			{
			delete pNewEntry;
			continue;
			}

		//	Add to the new collection

		NewCollection.Insert(pNewEntry);
		}

	//	If we had errors while loading, and we didn't load anything then abort.
	//	Otherwise we assume that only a couple of entries were bad (possibly
	//	because they are under development).

	if (bErrors && NewCollection.GetCount() == 0)
		{
		m_fLoadingCollection = false;
		return ERR_FAIL;
		}

	//	Otherwise, replace our collection.

	return SetCollection(NewCollection);
	}