comparison Applications/Commands/BaseCommandBuilder.cpp @ 319:daa04d15192c am-2

new SimpleViewer sample that has been split in multiple files to be able to scale it
author am@osimis.io
date Thu, 11 Oct 2018 13:16:54 +0200
parents be2660b6e40a
children b70e9be013e4
comparison
equal deleted inserted replaced
318:3a4ca166fafa 319:daa04d15192c
30 if (!commandJson.isObject() || !commandJson["command"].isString()) 30 if (!commandJson.isObject() || !commandJson["command"].isString())
31 { 31 {
32 throw StoneException(ErrorCode_CommandJsonInvalidFormat); 32 throw StoneException(ErrorCode_CommandJsonInvalidFormat);
33 } 33 }
34 34
35 if (commandJson["commandType"].isString() && commandJson["commandType"].asString() == "simple") 35 if (commandJson["commandType"].isString() && commandJson["commandType"].asString() == "generic-no-arg-command")
36 { 36 {
37 printf("creating a simple command\n"); 37 printf("creating a simple command\n");
38 return new SimpleCommand(commandJson["command"].asString().c_str()); 38 return new GenericNoArgCommand(commandJson["command"].asString().c_str());
39 }
40 else if (commandJson["commandType"].isString() && commandJson["commandType"].asString() == "generic-one-string-arg-command")
41 {
42 printf("creating a simple command\n");
43 return new GenericNoArgCommand(commandJson["command"].asString().c_str());
39 } 44 }
40 45
41 return NULL; 46 return NULL;
42 // std::string commandName = commandJson["command"].asString();
43
44
45
46
47 // CommandCreationFunctions::const_iterator it = commands_.find(commandName);
48 // if (it == commands_.end())
49 // {
50 // throw Orthanc::OrthancException(Orthanc::ErrorCode_UnknownResource); // TODO: use StoneException ?
51 // }
52
53 // // call the CreateCommandFn to build the command
54 // ICommand* command = it->second();
55 // if (commandJson["args"].isObject())
56 // {
57 // command->Configure(commandJson["args"]);
58 // }
59
60 // return command;
61 } 47 }
62 48
63 } 49 }