Changeset 42176 in vbox for trunk/src/VBox/Frontends/VBoxManage
- Timestamp:
- Jul 17, 2012 12:23:50 PM (13 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h
r41347 r42176 24 24 #include <VBox/com/VirtualBox.h> 25 25 #include <VBox/com/string.h> 26 #include <VBox/com/array.h> 26 27 #endif /* !VBOX_ONLY_DOCS */ 27 28 … … 171 172 172 173 /* VBoxManageModifyVM.cpp */ 174 #ifndef VBOX_ONLY_DOCS 175 void parseGroups(const char *pcszGroups, com::SafeArray<BSTR> *pGroups); 176 #endif 173 177 int handleModifyVM(HandlerArg *a); 174 178 -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r42129 r42176 137 137 RTStrmPrintf(pStrm, 138 138 "VBoxManage createvm --name <name>\n" 139 " [--groups <group>, ...]\n" 139 140 " [--ostype <ostype>]\n" 140 141 " [--register]\n" … … 148 149 "VBoxManage modifyvm <uuid|name>\n" 149 150 " [--name <name>]\n" 151 " [--groups <group>, ...]\n" 150 152 " [--ostype <ostype>]\n" 151 153 " [--memory <memorysize in MB>]\n" … … 355 357 " keepdisknames]\n" 356 358 " [--name <name>]\n" 359 " [--groups <group>, ...]\n" 357 360 " [--basefolder <basefolder>]\n" 358 361 " [--uuid <uuid>]\n" -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
r42131 r42176 191 191 Bstr bstrBaseFolder; 192 192 Bstr bstrName; 193 Bstr bstrGroups;194 193 Bstr bstrOsTypeId; 195 194 Bstr bstrUuid; 196 195 bool fRegister = false; 196 com::SafeArray<BSTR> groups; 197 197 198 198 int c; … … 211 211 212 212 case 'g': // --groups 213 bstrGroups = ValueUnion.psz; 214 /// @todo implement group string parsing to safearray 213 parseGroups(ValueUnion.psz, &groups); 215 214 break; 216 215 … … 242 241 do 243 242 { 243 Bstr bstrPrimaryGroup; 244 if (groups.size()) 245 bstrPrimaryGroup = groups[0]; 244 246 Bstr bstrSettingsFile; 245 247 CHECK_ERROR_BREAK(a->virtualBox, 246 248 ComposeMachineFilename(bstrName.raw(), 247 NULL /* aGroup */,249 bstrPrimaryGroup.raw(), 248 250 bstrBaseFolder.raw(), 249 251 bstrSettingsFile.asOutParam())); 250 252 ComPtr<IMachine> machine; 251 com::SafeArray<BSTR> groups; /* no groups */252 253 CHECK_ERROR_BREAK(a->virtualBox, 253 254 CreateMachine(bstrSettingsFile.raw(), … … 347 348 com::SafeArray<CloneOptions_T> options; 348 349 const char *pszTrgName = NULL; 349 const char *pszTrgGroups = NULL;350 350 const char *pszTrgBaseFolder = NULL; 351 351 bool fRegister = false; 352 352 Bstr bstrUuid; 353 com::SafeArray<BSTR> groups; 353 354 354 355 int c; … … 371 372 372 373 case 'g': // --groups 373 pszTrgGroups = ValueUnion.psz; 374 /// @todo implement group string parsing to safearray 374 parseGroups(ValueUnion.psz, &groups); 375 375 break; 376 376 … … 435 435 pszTrgName = RTStrAPrintf2("%s Clone", pszSrcName); 436 436 437 Bstr bstrPrimaryGroup; 438 if (groups.size()) 439 bstrPrimaryGroup = groups[0]; 437 440 Bstr bstrSettingsFile; 438 441 CHECK_ERROR_RET(a->virtualBox, 439 442 ComposeMachineFilename(Bstr(pszTrgName).raw(), 440 NULL /* aGroup */,443 bstrPrimaryGroup.raw(), 441 444 Bstr(pszTrgBaseFolder).raw(), 442 445 bstrSettingsFile.asOutParam()), … … 444 447 445 448 ComPtr<IMachine> trgMachine; 446 com::SafeArray<BSTR> groups; /* no groups */447 449 CHECK_ERROR_RET(a->virtualBox, CreateMachine(bstrSettingsFile.raw(), 448 450 Bstr(pszTrgName).raw(), -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
r41925 r42176 53 53 { 54 54 MODIFYVM_NAME = 1000, 55 MODIFYVM_GROUPS, 55 56 MODIFYVM_OSTYPE, 56 57 MODIFYVM_MEMORY, … … 196 197 { 197 198 { "--name", MODIFYVM_NAME, RTGETOPT_REQ_STRING }, 199 { "--groups", MODIFYVM_GROUPS, RTGETOPT_REQ_STRING }, 198 200 { "--ostype", MODIFYVM_OSTYPE, RTGETOPT_REQ_STRING }, 199 201 { "--memory", MODIFYVM_MEMORY, RTGETOPT_REQ_UINT32 }, … … 364 366 } 365 367 368 void parseGroups(const char *pcszGroups, com::SafeArray<BSTR> *pGroups) 369 { 370 while (pcszGroups) 371 { 372 char *pComma = RTStrStr(pcszGroups, ","); 373 if (pComma) 374 { 375 Bstr(pcszGroups, pComma - pcszGroups).detachTo(pGroups->appendedRaw()); 376 pcszGroups = pComma + 1; 377 } 378 else 379 { 380 Bstr(pcszGroups).detachTo(pGroups->appendedRaw()); 381 pcszGroups = NULL; 382 } 383 } 384 } 385 366 386 int handleModifyVM(HandlerArg *a) 367 387 { … … 405 425 { 406 426 CHECK_ERROR(machine, COMSETTER(Name)(Bstr(ValueUnion.psz).raw())); 427 break; 428 } 429 case MODIFYVM_GROUPS: 430 { 431 com::SafeArray<BSTR> groups; 432 parseGroups(ValueUnion.psz, &groups); 433 CHECK_ERROR(machine, COMSETTER(Groups)(ComSafeArrayAsInParam(groups))); 407 434 break; 408 435 }
Note:
See TracChangeset
for help on using the changeset viewer.