using namespace std;
-#include <iostream>
-
static Model_Session* myImpl = new Model_Session();
// t oredirect all calls to the root document
}
return aCreated;
} else {
- Events_InfoMessage("Model_Session","Can not load plugin '%1'").arg(myCurrentPluginName).send();
+ Events_InfoMessage("Model_Session",
+ "Can not load plugin '%1'").arg(myCurrentPluginName).send();
}
} else {
- Events_InfoMessage("Model_Session","Feature '%1' not found in any plugin").arg(theFeatureID).send();
+ Events_InfoMessage("Model_Session",
+ "Feature '%1' not found in any plugin").arg(theFeatureID).send();
}
return FeaturePtr(); // return nothing
Handle(Model_Application) anApp = Model_Application::getApplication();
bool aFirstCall = !anApp->hasRoot();
if (aFirstCall) {
- // to be sure that plugins are loaded, even before the first "createFeature" call (in unit tests)
+ // to be sure that plugins are loaded,
+ // even before the first "createFeature" call (in unit tests)
LoadPluginsInfo();
// creation of the root document is always outside of the transaction, so, avoid checking it
setCheckTransactions(false);
std::dynamic_pointer_cast<Config_FeatureMessage>(theMessage);
if (aMsg) {
-// std::cout << "Feature: " << aMsg->id() << std::endl;
-
// process the plugin info, load plugin
if (myPlugins.find(aMsg->id()) == myPlugins.end()) {
myPlugins[aMsg->id()] = std::pair<std::string, std::string>(
std::dynamic_pointer_cast<Config_AttributeMessage>(theMessage);
if (aMsgAttr) {
-// std::cout << "Feature: " << aMsgAttr->featureId()
-// << ", Attribute: " << aMsgAttr->attributeId() << std::endl;
-
if (!aMsgAttr->isObligatory()) {
validators()->registerNotObligatory(aMsgAttr->featureId(), aMsgAttr->attributeId());
- } else {
- std::cout << "F: " << aMsgAttr->featureId()
- << ", V: Model_FeatureValidator"
- << ", A: " << aMsgAttr->attributeId()
- << std::endl;
}
if(aMsgAttr->isConcealment()) {
validators()->registerConcealment(aMsgAttr->featureId(), aMsgAttr->attributeId());
}
- if (!aMsgAttr->caseId().empty()) {
- validators()->registerCase(aMsgAttr->featureId(), aMsgAttr->attributeId(),
- aMsgAttr->switchId(), aMsgAttr->caseId());
+ const std::list<std::pair<std::string, std::string> >& aCases = aMsgAttr->getCases();
+ if (!aCases.empty()) {
+ validators()->registerCase(aMsgAttr->featureId(), aMsgAttr->attributeId(), aCases);
}
}
}
// plugins information was started to load, so, it will be loaded
myPluginsInfoLoaded = true;
} else if (theMessage->eventID() == kValidatorEvent) {
-
- static bool done = false;
- if (!done) {
- std::set<std::string> aPlugins;
- for (auto it = myPlugins.begin(); it != myPlugins.end(); ++it) {
- std::string aPluginName = it->second.first;
- aPlugins.insert(aPluginName);
- }
-
- for (auto it = aPlugins.begin(); it != aPlugins.end(); ++it) {
- myCurrentPluginName = *it;
- Config_ModuleReader::loadPlugin(*it);
- }
-
- done = true;
- }
-
std::shared_ptr<Config_ValidatorMessage> aMsg =
std::dynamic_pointer_cast<Config_ValidatorMessage>(theMessage);
if (aMsg) {
if (aMsg->attributeId().empty()) { // feature validator
-
- std::cout << "F: " << aMsg->featureId()
- << ", V: " << aMsg->validatorId() << std::endl;
-
validators()->assignValidator(aMsg->validatorId(), aMsg->featureId(), aMsg->parameters());
} else { // attribute validator
-
- std::cout << "F: " << aMsg->featureId()
- << ", A: " << aMsg->attributeId()
- << ", V: " << aMsg->validatorId() << std::endl;
-
validators()->assignValidator(aMsg->validatorId(), aMsg->featureId(), aMsg->attributeId(),
aMsg->parameters());
}
}
} else { // create/update/delete
if (myCheckTransactions && !isOperation())
- Events_InfoMessage("Model_Session", "Modification of data structure outside of the transaction").send();
+ Events_InfoMessage("Model_Session",
+ "Modification of data structure outside of the transaction").send();
// if part is deleted, make the root as the current document (on undo of Parts creations)
static const Events_ID kDeletedEvent = Events_Loop::eventByName(EVENT_OBJECT_DELETED);
if (theMessage->eventID() == kDeletedEvent) {