- Timestamp:
- Jun 5, 2008 1:43:54 PM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/include/COMDefs.h
r9401 r9425 31 31 * @{ 32 32 * 33 * The Qt-COM support layer provides a set of defin tions and smart classes for33 * The Qt-COM support layer provides a set of definitions and smart classes for 34 34 * writing simple, clean and platform-independent code to access COM/XPCOM 35 35 * components through exposed COM interfaces. This layer is based on the 36 * COM/XPCOM Abst arction Layer library (the VBoxCOM glue library defined in36 * COM/XPCOM Abstraction Layer library (the VBoxCOM glue library defined in 37 37 * include/VBox/com and implemented in src/VBox/Main/glue). 38 38 * … … 42 42 * @{ 43 43 * 44 * COM/XPCOM arrays are mapped to QV alueVector objects. QValueVector templates45 * declared with a type that corresponds to the COM type of elements in the46 * array using normal Qt-COM type mapping rules. Here is a code example that47 * demonstrates how to call interface methods that take and return arrays (this48 * example isbased on examples given in @ref grp_COM_arrays):44 * COM/XPCOM arrays are mapped to QVector objects. QVector templates declared 45 * with a type that corresponds to the COM type of elements in the array using 46 * normal Qt-COM type mapping rules. Here is a code example that demonstrates 47 * how to call interface methods that take and return arrays (this example is 48 * based on examples given in @ref grp_COM_arrays): 49 49 * @code 50 50 … … 53 53 // ... 54 54 55 QV alueVector <LONG> in (3);55 QVector <LONG> in (3); 56 56 in [0] = -1; 57 57 in [1] = -2; 58 58 in [2] = -3; 59 59 60 QV alueVector <LONG> out;61 QV alueVector <LONG> ret;60 QVector <LONG> out; 61 QVector <LONG> ret; 62 62 63 63 ret = component.TestArrays (in, out); … … 258 258 { 259 259 aArr.reset (aVec.size()); 260 size_t i = 0; 261 for (typename QVector <T>::const_iterator it = aVec.begin(); 262 it != aVec.end(); ++ it, ++ i) 263 aArr [i] = *it; 260 for (int i = 0; i < aVec.size(); ++i) 261 aArr [i] = aVec.at (i); 264 262 } 265 263 … … 267 265 static void FromSafeArray (const com::SafeArray <T> &aArr, QVector <T> &aVec) 268 266 { 269 aVec = QVector <T> (aArr.size()); 270 size_t i = 0; 271 for (typename QVector <T>::iterator it = aVec.begin(); 272 it != aVec.end(); ++ it, ++ i) 273 *it = aArr [i]; 267 aVec.resize (aArr.size()); 268 for (int i = 0; i < aVec.size(); ++i) 269 aVec [i] = aArr [i]; 274 270 } 275 271 … … 295 291 { 296 292 aArr.reset (aVec.size()); 297 size_t i = 0; 298 for (typename QVector <CI>::const_iterator it = aVec.begin(); 299 it != aVec.end(); ++ it, ++ i) 300 { 301 aArr [i] = (*it).iface(); 293 for (int i = 0; i < aVec.size(); ++i) 294 { 295 aArr [i] = aVec.at (i); 302 296 if (aArr [i]) 303 297 aArr [i]->AddRef(); … … 309 303 QVector <CI> &aVec) 310 304 { 311 aVec = QVector <CI> (aArr.size()); 312 size_t i = 0; 313 for (typename QVector <CI>::iterator it = aVec.begin(); 314 it != aVec.end(); ++ it, ++ i) 315 (*it).attach (aArr [i]); 305 aVec.resize (aArr.size()); 306 for (int i = 0; i < aVec.size(); ++i) 307 aVec [i].attach (aArr [i]); 316 308 } 317 309 … … 525 517 526 518 /** 527 * Returns @c true if the result code rep esents success (with or without519 * Returns @c true if the result code represents success (with or without 528 520 * warnings). 529 521 */ … … 531 523 532 524 /** 533 * Returns @c true if the result code represen ds success with one or more525 * Returns @c true if the result code represents success with one or more 534 526 * warnings. 535 527 */ … … 537 529 538 530 /** 539 * Returns @c true if the result code represen ds success with no warnings.531 * Returns @c true if the result code represents success with no warnings. 540 532 */ 541 533 bool isReallyOk() const { return mRC == S_OK; } … … 647 639 648 640 /** 649 * Returns @c true if the result code rep esents success (with or without641 * Returns @c true if the result code represents success (with or without 650 642 * warnings). 651 643 */ … … 653 645 654 646 /** 655 * Returns @c true if the result code represen ds success with one or more647 * Returns @c true if the result code represents success with one or more 656 648 * warnings. 657 649 */ … … 659 651 660 652 /** 661 * Returns @c true if the result code represen ds success with no warnings.653 * Returns @c true if the result code represents success with no warnings. 662 654 */ 663 655 bool isReallyOk() const { return !isNull() && B::mRC == S_OK; } -
trunk/src/VBox/Frontends/VirtualBox4/src/COMDefs.cpp
r9402 r9425 191 191 { 192 192 aArr.reset (aVec.size()); 193 size_t i = 0; 194 for (QVector <QString>::const_iterator it = aVec.begin(); 195 it != aVec.end(); ++ it, ++ i) 196 aArr [i] = SysAllocString ((const OLECHAR *) (*it).utf16()); 193 for (int i = 0; i < aVec.size(); ++i) 194 aArr [i] = SysAllocString ((const OLECHAR *) aVec.at (i).utf16()); 197 195 } 198 196 … … 201 199 QVector <QString> &aVec) 202 200 { 203 aVec = QVector <QString> (aArr.size()); 204 size_t i = 0; 205 for (QVector <QString>::iterator it = aVec.begin(); 206 it != aVec.end(); ++ it, ++ i) 207 *it = QString::fromUtf16 (aArr [i]); 201 aVec.resize (aArr.size()); 202 for (int i = 0; i < aVec.size(); ++i) 203 aVec [i] = QString::fromUtf16 (aArr [i]); 208 204 } 209 205 … … 226 222 if (info.isOk()) 227 223 mInterfaceName = getInterfaceNameFromIID (mInterfaceID); 224 printf("iface %s\n", qPrintable (mInterfaceName)); 228 225 229 226 mComponent = info.GetComponent(); … … 322 319 #else /* !defined (VBOX_WITH_XPCOM) */ 323 320 321 printf("1\n"); 324 322 nsCOMPtr <nsIExceptionService> es; 325 323 es = do_GetService (NS_EXCEPTIONSERVICE_CONTRACTID, &rc); 326 324 if (NS_SUCCEEDED (rc)) 327 325 { 326 printf("2\n"); 328 327 nsCOMPtr <nsIExceptionManager> em; 329 328 rc = es->GetCurrentExceptionManager (getter_AddRefs (em)); 330 329 if (NS_SUCCEEDED (rc)) 331 330 { 331 printf("3\n"); 332 332 nsCOMPtr <nsIException> ex; 333 333 rc = em->GetCurrentException (getter_AddRefs(ex)); 334 334 if (NS_SUCCEEDED (rc) && ex) 335 335 { 336 printf("4\n"); 336 337 nsCOMPtr <IVirtualBoxErrorInfo> info; 337 338 info = do_QueryInterface (ex, &rc); … … 339 340 init (CVirtualBoxErrorInfo (info)); 340 341 342 printf("5\n"); 341 343 if (!mIsFullAvailable) 342 344 { 345 printf("6\n"); 343 346 bool gotSomething = false; 344 347 … … 351 354 if (NS_SUCCEEDED (rc) && message) 352 355 { 353 mText = QString::fromUtf8 (message); 354 nsMemory::Free (message); 356 printf("7\n"); 357 // mText = QString::fromUtf8 (message); 358 printf ("%s\n", message); 359 mText = "sdafsdf"; 360 // nsMemory::Free (message); 355 361 } 356 362
Note:
See TracChangeset
for help on using the changeset viewer.