- Timestamp:
- Apr 12, 2013 12:01:02 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 84995
- Location:
- trunk/src/VBox/Main
- Files:
-
- 6 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/Makefile.kmk
r45497 r45518 45 45 # Construct VBOX_MAIN_DEFS 46 46 ## @todo eliminate or expand VBOX_MAIN_DEFS. 47 VBOX_MAIN_DEFS = 47 VBOX_MAIN_DEFS = 48 48 ifneq ($(KBUILD_TARGET),win) 49 49 ifndef VBOX_WITH_XPCOM … … 162 162 docs: $(PATH_TARGET)/docs.Main 163 163 endif 164 165 166 # 167 # Generate library with API class wrappers from the XIDL file. 168 # 169 LIBRARIES += VBoxAPIWrap 170 VBoxAPIWrap_TEMPLATE = VBOXMAINLIB 171 VBoxAPIWrap_SOURCES = $(VBoxAPIWrap_GENERATEDCPP) 172 VBoxAPIWrap_GENERATEDCPP = $(filter %.cpp,$(VBoxAPIWrap_GENERATEDSOURCES)) 173 VBoxAPIWrap_GENERATEDSOURCES = $(addprefix $(VBoxAPIWrap_0_OUTDIR)/,$(VBoxAPIWrap_VBOX_APIWRAPPERFILES)) 174 VBoxAPIWrap_RAWSRC = \ 175 $(VBoxAPIWrap_0_OUTDIR)/apiwrappers 176 VBoxAPIWrap_XSLT = \ 177 $(VBOX_PATH_MAIN_SRC)/idl/apiwrap-server.xsl 178 VBoxAPIWrap_DEFS.win.x86 += _WIN32_WINNT=0x0500 179 VBoxAPIWrap_DEFS.win.amd64 += _WIN32_WINNT=0x0510 180 VBoxAPIWrap_INCS += \ 181 include 182 VBoxAPIWrap_CLEAN = \ 183 $(wildcard $(VBoxAPIWrap_0_OUTDIR)/*.cpp) \ 184 $(wildcard $(VBoxAPIWrap_0_OUTDIR)/*.h) \ 185 $(VBoxAPIWrap_RAWSRC) 186 VBoxAPIWrap_KMK = $(PATH_OUT)/vboxapiwrap.kmk 187 include $(VBoxAPIWrap_KMK) 164 188 165 189 … … 256 280 VBoxSVC_CXXFLAGS = $(filter-out -Wno-unused,$(TEMPLATE_VBOXMAINEXE_CXXFLAGS)) 257 281 282 VBoxSVC_DEPS = $(filter %.h,$(VBoxAPIWrap_GENERATEDSOURCES)) 283 258 284 VBoxSVC_INCS = \ 259 285 include \ 260 286 $(VBoxSVC_0_OUTDIR) \ 261 287 $(dir $(VBOX_XML_SCHEMADEFS_H)) \ 288 $(VBoxAPIWrap_0_OUTDIR) \ 262 289 . 263 290 VBoxSVC_INCS.win = \ … … 269 296 270 297 VBoxSVC_LIBS += \ 298 $(PATH_STAGE_LIB)/VBoxAPIWrap$(VBOX_SUFF_LIB) \ 271 299 $(PATH_STAGE_LIB)/SSMStandalone$(VBOX_SUFF_LIB) \ 272 300 $(LIB_DDU) … … 544 572 endif 545 573 574 VBoxC_DEPS = $(filter %.h,$(VBoxAPIWrap_GENERATEDSOURCES)) 575 546 576 VBoxC_INCS = \ 547 577 include \ 548 578 $(VBoxC_0_OUTDIR) \ 579 $(VBoxAPIWrap_0_OUTDIR) \ 549 580 $(dir $(VBOX_XML_SCHEMADEFS_H)) 550 581 VBoxC_INCS.win = \ … … 900 931 $(VBOX_PATH_MAIN_SRC)/glue/tests/Makefile=>Makefile 901 932 933 # moved those rules to the end so that VBoxAPIWrap_0_OUTDIR can be expanded without $$ trickery 934 $(VBoxAPIWrap_RAWSRC) \ 935 +| $(VBoxAPIWrap_GENERATEDSOURCES): \ 936 $(VBOX_XIDL_FILE) \ 937 $(VBoxAPIWrap_XSLT) \ 938 $(VBOX_FILESPLIT) \ 939 | $$(dir $$@) 940 $(call MSG_L1,Generating C++ Server API wrapper files from XIDL) 941 $(QUIET)$(RM) -f $(filter-out $(VBoxAPIWrap_GENERATEDSOURCES),$(wildcard $(VBoxAPIWrap_0_OUTDIR)/*.cpp) $(wildcard $(VBoxAPIWrap_0_OUTDIR)/*.h)) 942 $(QUIET)$(VBOX_XSLTPROC) --stringparam filelistonly "" -o $@ $(VBoxAPIWrap_XSLT) $< 943 $(QUIET)$(VBOX_FILESPLIT) $@ $(VBoxAPIWrap_0_OUTDIR) 944 945 $(VBoxAPIWrap_KMK).ts +| $(VBoxAPIWrap_KMK): $(VBOX_XIDL_FILE) $(VBoxAPIWrap_XSLT) 946 $(call MSG_GENERATE,,$(VBoxAPIWrap_KMK)) 947 $(QUIET)$(RM) -f $@ 948 $(QUIET)$(MKDIR) -p $(@D) 949 $(QUIET)$(VBOX_XSLTPROC) --stringparam filelistonly VBoxAPIWrap_VBOX_APIWRAPPERFILES -o $@ $(VBoxAPIWrap_XSLT) $< 950 $(QUIET)$(CP) --changed -fv $@ $(VBoxAPIWrap_KMK) 951 902 952 updatenls:: 903 953 $(VBOX_LUPDATE) $(VBoxSVC_SOURCES) $(VBoxSVC_VBOX_HEADERS) -ts $(VBoxSVC_VBOX_TRANSLATIONS) -
trunk/src/VBox/Main/idl/apiwrap-server.xsl
r45496 r45518 218 218 <xsl:param name="type"/> 219 219 <xsl:param name="dir"/> 220 <xsl:param name="safearray"/> 220 221 221 222 <!-- get C++ wrap type from IDL type from table in typemap-shared.inc.xsl --> … … 223 224 <xsl:choose> 224 225 <xsl:when test="$type='wstring'"> 225 <xsl:if test="$dir='in' ">226 <xsl:if test="$dir='in' and not($safearray='yes')"> 226 227 <xsl:text>const </xsl:text> 227 228 </xsl:if> … … 241 242 </xsl:when> 242 243 <xsl:when test="$type='$unknown'"> 243 <xsl:if test="$dir='in' ">244 <xsl:if test="$dir='in' and not($safearray='yes')"> 244 245 <xsl:text>const </xsl:text> 245 246 </xsl:if> … … 249 250 <xsl:variable name="thatif" select="//interface[@name=$type]"/> 250 251 <xsl:variable name="thatifname" select="$thatif/@name"/> 251 <xsl:if test="$dir='in' ">252 <xsl:if test="$dir='in' and not($safearray='yes')"> 252 253 <xsl:text>const </xsl:text> 253 254 </xsl:if> … … 351 352 <xsl:with-param name="type" select="."/> 352 353 <xsl:with-param name="dir" select="$dir"/> 354 <xsl:with-param name="safearray" select="../@safearray"/> 353 355 </xsl:call-template> 354 356 </xsl:variable> … … 476 478 </xsl:otherwise> 477 479 </xsl:choose> 480 <xsl:if test="../@safearray='yes'"> 481 <xsl:choose> 482 <xsl:when test="$dir='in'"> 483 <xsl:text>ComSafeArrayInArg(</xsl:text> 484 </xsl:when> 485 <xsl:otherwise> 486 <xsl:text>ComSafeArrayOutArg(</xsl:text> 487 </xsl:otherwise> 488 </xsl:choose> 489 </xsl:if> 478 490 </xsl:when> 479 491 <xsl:when test="$thatif"> … … 491 503 </xsl:choose> 492 504 <xsl:value-of select="concat('<', $thatifname, '>(')"/> 505 <xsl:if test="../@safearray='yes'"> 506 <xsl:choose> 507 <xsl:when test="$dir='in'"> 508 <xsl:text>ComSafeArrayInArg(</xsl:text> 509 </xsl:when> 510 <xsl:otherwise> 511 <xsl:text>ComSafeArrayOutArg(</xsl:text> 512 </xsl:otherwise> 513 </xsl:choose> 514 </xsl:if> 493 515 </xsl:when> 494 516 <xsl:when test="$type='wstring'"> … … 504 526 </xsl:otherwise> 505 527 </xsl:choose> 528 <xsl:if test="../@safearray='yes'"> 529 <xsl:choose> 530 <xsl:when test="$dir='in'"> 531 <xsl:text>ComSafeArrayInArg(</xsl:text> 532 </xsl:when> 533 <xsl:otherwise> 534 <xsl:text>ComSafeArrayOutArg(</xsl:text> 535 </xsl:otherwise> 536 </xsl:choose> 537 </xsl:if> 506 538 </xsl:when> 507 539 <xsl:when test="$type='uuid'"> … … 517 549 </xsl:otherwise> 518 550 </xsl:choose> 551 <xsl:if test="../@safearray='yes'"> 552 <xsl:choose> 553 <xsl:when test="$dir='in'"> 554 <xsl:text>ComSafeArrayInArg(</xsl:text> 555 </xsl:when> 556 <xsl:otherwise> 557 <xsl:text>ComSafeArrayOutArg(</xsl:text> 558 </xsl:otherwise> 559 </xsl:choose> 560 </xsl:if> 519 561 </xsl:when> 520 562 <xsl:otherwise> … … 530 572 </xsl:choose> 531 573 <xsl:value-of select="concat('<', $gluetype, '>(')"/> 574 <xsl:choose> 575 <xsl:when test="$dir='in'"> 576 <xsl:text>ComSafeArrayInArg(</xsl:text> 577 </xsl:when> 578 <xsl:otherwise> 579 <xsl:text>ComSafeArrayOutArg(</xsl:text> 580 </xsl:otherwise> 581 </xsl:choose> 532 582 </xsl:if> 533 583 </xsl:otherwise> … … 541 591 <xsl:choose> 542 592 <xsl:when test="../@safearray='yes'"> 543 <xsl:text>) .array()</xsl:text>593 <xsl:text>)).array()</xsl:text> 544 594 </xsl:when> 545 595 <xsl:otherwise> … … 551 601 <xsl:choose> 552 602 <xsl:when test="../@safearray='yes'"> 553 <xsl:text>) .array()</xsl:text>603 <xsl:text>)).array()</xsl:text> 554 604 </xsl:when> 555 605 <xsl:otherwise> … … 561 611 <xsl:choose> 562 612 <xsl:when test="../@safearray='yes'"> 563 <xsl:text>) .array()</xsl:text>613 <xsl:text>)).array()</xsl:text> 564 614 </xsl:when> 565 615 <xsl:otherwise> … … 570 620 <xsl:otherwise> 571 621 <xsl:if test="../@safearray='yes'"> 572 <xsl:text>) .array()</xsl:text>622 <xsl:text>)).array()</xsl:text> 573 623 </xsl:if> 574 624 </xsl:otherwise> -
trunk/src/VBox/Main/include/MediumFormatImpl.h
r45497 r45518 3 3 /** @file 4 4 * 5 * VirtualBoxCOM class implementation5 * MediumFormat COM class implementation 6 6 */ 7 7 … … 18 18 */ 19 19 20 #ifndef ____H_MEDIUMFORMAT21 #define ____H_MEDIUMFORMAT20 #ifndef MEDIUMFORMAT_IMPL_H_ 21 #define MEDIUMFORMAT_IMPL_H_ 22 22 23 #include " VirtualBoxBase.h"23 #include "MediumFormatWrap.h" 24 24 25 #include <VBox/com/array.h>26 27 #include <list>28 25 29 26 struct VDBACKENDINFO; … … 39 36 */ 40 37 class ATL_NO_VTABLE MediumFormat : 41 public VirtualBoxBase, 42 VBOX_SCRIPTABLE_IMPL(IMediumFormat) 38 public MediumFormatWrap 43 39 { 44 40 public: … … 53 49 }; 54 50 55 typedef std::list<Utf8Str> StrList; 56 typedef std::list<DeviceType_T> DeviceTypeList; 57 typedef std::list<Property> PropertyList; 58 59 struct Data 60 { 61 Data() : capabilities((MediumFormatCapabilities_T)0) {} 62 63 const Utf8Str strId; 64 const Utf8Str strName; 65 const StrList llFileExtensions; 66 const DeviceTypeList llDeviceTypes; 67 const MediumFormatCapabilities_T capabilities; 68 const PropertyList llProperties; 69 }; 70 71 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(MediumFormat, IMediumFormat) 72 73 DECLARE_NOT_AGGREGATABLE(MediumFormat) 74 75 DECLARE_PROTECT_FINAL_CONSTRUCT() 76 77 BEGIN_COM_MAP(MediumFormat) 78 VBOX_DEFAULT_INTERFACE_ENTRIES(IMediumFormat) 79 END_COM_MAP() 51 typedef std::vector<Property> PropertyArray; 52 typedef std::vector<com::Utf8Str> StrArray; 80 53 81 54 DECLARE_EMPTY_CTOR_DTOR(MediumFormat) … … 88 61 void uninit(); 89 62 90 // IMediumFormat properties91 STDMETHOD(COMGETTER(Id))(BSTR *aId);92 STDMETHOD(COMGETTER(Name))(BSTR *aName);93 STDMETHOD(COMGETTER(Capabilities))(ComSafeArrayOut(MediumFormatCapabilities_T, aCaps));94 95 // IMediumFormat methods96 STDMETHOD(DescribeFileExtensions)(ComSafeArrayOut(BSTR, aFileExtensions),97 ComSafeArrayOut(DeviceType_T, aDeviceTypes));98 STDMETHOD(DescribeProperties)(ComSafeArrayOut(BSTR, aNames),99 ComSafeArrayOut(BSTR, aDescriptions),100 ComSafeArrayOut(DataType_T, aTypes),101 ComSafeArrayOut(ULONG, aFlags),102 ComSafeArrayOut(BSTR, aDefaults));103 104 // public methods only for internal purposes105 106 63 // public methods for internal purposes only 107 64 // (ensure there is a caller and a read lock before calling them!) 108 65 109 66 /** Const, no need to lock */ 110 const Utf8Str &getId() const { return m.strId; }67 const Utf8Str &i_getId() const { return m.strId; } 111 68 /** Const, no need to lock */ 112 const Str List& getFileExtensions() const { return m.llFileExtensions; }69 const StrArray &i_getFileExtensions() const { return m.maFileExtensions; } 113 70 /** Const, no need to lock */ 114 MediumFormatCapabilities_T getCapabilities() const { return m.capabilities; }71 MediumFormatCapabilities_T i_getCapabilities() const { return m.capabilities; } 115 72 /** Const, no need to lock */ 116 const Property List& getProperties() const { return m.llProperties; }73 const PropertyArray &i_getProperties() const { return m.maProperties; } 117 74 118 75 private: 76 77 // wrapped IMediumFormat properties 78 HRESULT getId(com::Utf8Str &aId); 79 HRESULT getName(com::Utf8Str &aName); 80 HRESULT getCapabilities(std::vector<MediumFormatCapabilities_T> &aCapabilities); 81 82 // wrapped IMediumFormat methods 83 HRESULT describeFileExtensions(std::vector<com::Utf8Str> &aExtensions, 84 std::vector<DeviceType_T> &aTypes); 85 HRESULT describeProperties(std::vector<com::Utf8Str> &aNames, 86 std::vector<com::Utf8Str> &aDescriptions, 87 std::vector<DataType_T> &aTypes, 88 std::vector<ULONG> &aFlags, 89 std::vector<com::Utf8Str> &aDefaults); 90 91 // types 92 typedef std::vector<DeviceType_T> DeviceTypeArray; 93 94 // data 95 struct Data 96 { 97 Data() : capabilities((MediumFormatCapabilities_T)0) {} 98 99 const Utf8Str strId; 100 const Utf8Str strName; 101 const StrArray maFileExtensions; 102 const DeviceTypeArray maDeviceTypes; 103 const MediumFormatCapabilities_T capabilities; 104 const PropertyArray maProperties; 105 }; 119 106 120 107 Data m; 121 108 }; 122 109 123 #endif // ____H_MEDIUMFORMAT110 #endif // MEDIUMFORMAT_IMPL_H_ 124 111 125 112 /* vi: set tabstop=4 shiftwidth=4 expandtab: */ -
trunk/src/VBox/Main/include/Wrapper.h
r45496 r45518 60 60 return mStr; 61 61 } 62 62 63 63 private: 64 64 com::Utf8Str mStr; … … 85 85 return mSrc; 86 86 } 87 87 88 88 private: 89 89 const com::Utf8Str mSrc; … … 128 128 return mArray; 129 129 } 130 130 131 131 private: 132 132 std::vector<com::Utf8Str> mArray; … … 148 148 ArrayBSTRInConverter(ComSafeArrayIn(IN_BSTR, aSrc)) 149 149 { 150 com::SafeArray< BSTR> inArray(ComSafeArrayInArg(aSrc));150 com::SafeArray<IN_BSTR> inArray(ComSafeArrayInArg(aSrc)); 151 151 mArray.resize(inArray.size()); 152 152 for (size_t i = 0; i < inArray.size(); i++) … … 158 158 } 159 159 160 const std::vector<co nst com::Utf8Str> &array()161 { 162 return mArray; 163 } 164 165 private: 166 std::vector<co nst com::Utf8Str> mArray;160 const std::vector<com::Utf8Str> &array() 161 { 162 return mArray; 163 } 164 165 private: 166 std::vector<com::Utf8Str> mArray; 167 167 }; 168 168 … … 188 188 return mUuid; 189 189 } 190 190 191 191 private: 192 192 com::Guid mUuid; … … 213 213 return mSrc; 214 214 } 215 215 216 216 private: 217 217 const com::Guid mSrc; … … 256 256 return mArray; 257 257 } 258 258 259 259 private: 260 260 std::vector<com::Guid> mArray; … … 289 289 return mPtr; 290 290 } 291 291 292 292 private: 293 293 ComPtr<A> mPtr; … … 315 315 return mSrc; 316 316 } 317 317 318 318 private: 319 319 const ComPtr<A> mSrc; … … 334 334 } 335 335 336 ArrayComTypeOutConverter(ComSafeArrayOut(A , aDst)) :336 ArrayComTypeOutConverter(ComSafeArrayOut(A *, aDst)) : 337 337 #ifdef VBOX_WITH_XPCOM 338 338 mDstSize(aDstSize), … … 359 359 return mArray; 360 360 } 361 361 362 362 private: 363 363 std::vector<ComPtr<A> > mArray; 364 364 #ifdef VBOX_WITH_XPCOM 365 365 PRUint32 *mDstSize; 366 A ** mDst;366 A ***mDst; 367 367 #else // !VBOX_WITH_XPCOM 368 368 SAFEARRAY **mDst; … … 378 378 } 379 379 380 ArrayComTypeInConverter(ComSafeArrayIn(A , aSrc))380 ArrayComTypeInConverter(ComSafeArrayIn(A *, aSrc)) 381 381 { 382 382 com::SafeIfaceArray<A> inArray(ComSafeArrayInArg(aSrc)); … … 390 390 } 391 391 392 const std::vector< constComPtr<A> > &array()393 { 394 return mArray; 395 } 396 397 private: 398 std::vector< constComPtr<A> > mArray;392 const std::vector<ComPtr<A> > &array() 393 { 394 return mArray; 395 } 396 397 private: 398 std::vector<ComPtr<A> > mArray; 399 399 }; 400 400 … … 438 438 return mArray; 439 439 } 440 440 441 441 private: 442 442 std::vector<A> mArray; … … 473 473 return mArray; 474 474 } 475 475 476 476 private: 477 477 std::vector<A> mArray; -
trunk/src/VBox/Main/src-server/MediumFormatImpl.cpp
r45497 r45518 2 2 /** @file 3 3 * 4 * VirtualBoxCOM class implementation4 * MediumFormat COM class implementation 5 5 */ 6 6 … … 76 76 DeviceType_T devType; 77 77 78 unconst(m. llFileExtensions).push_back(papExtension->pszExtension);78 unconst(m.maFileExtensions).push_back(papExtension->pszExtension); 79 79 80 80 switch(papExtension->enmType) … … 94 94 } 95 95 96 unconst(m. llDeviceTypes).push_back(devType);96 unconst(m.maDeviceTypes).push_back(devType); 97 97 ++papExtension; 98 98 } … … 157 157 flags, 158 158 defaultValue }; 159 unconst(m. llProperties).push_back(prop);159 unconst(m.maProperties).push_back(prop); 160 160 ++pa; 161 161 } … … 181 181 return; 182 182 183 unconst(m. llProperties).clear();184 unconst(m. llFileExtensions).clear();185 unconst(m. llDeviceTypes).clear();183 unconst(m.maProperties).clear(); 184 unconst(m.maFileExtensions).clear(); 185 unconst(m.maDeviceTypes).clear(); 186 186 unconst(m.capabilities) = (MediumFormatCapabilities_T)0; 187 187 unconst(m.strName).setNull(); … … 192 192 ///////////////////////////////////////////////////////////////////////////// 193 193 194 STDMETHODIMP MediumFormat::COMGETTER(Id)(BSTR *aId) 195 { 196 CheckComArgOutPointerValid(aId); 197 198 AutoCaller autoCaller(this); 199 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 200 201 /* this is const, no need to lock */ 202 m.strId.cloneTo(aId); 203 204 return S_OK; 205 } 206 207 STDMETHODIMP MediumFormat::COMGETTER(Name)(BSTR *aName) 208 { 209 CheckComArgOutPointerValid(aName); 210 211 AutoCaller autoCaller(this); 212 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 213 214 /* this is const, no need to lock */ 215 m.strName.cloneTo(aName); 216 217 return S_OK; 218 } 219 220 STDMETHODIMP MediumFormat::COMGETTER(Capabilities)(ComSafeArrayOut(MediumFormatCapabilities_T, aCaps)) 221 { 222 CheckComArgOutSafeArrayPointerValid(aCaps); 223 224 AutoCaller autoCaller(this); 225 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 226 227 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 228 229 SafeArray<MediumFormatCapabilities_T> capabilities(sizeof(MediumFormatCapabilities_T)*8); 230 231 for (ULONG i = 0; i < capabilities.size(); ++i) 232 { 233 ULONG temp = m.capabilities; 234 temp &= 1<<i; 235 capabilities [i] = (MediumFormatCapabilities_T)temp; 236 } 237 238 capabilities.detachTo(ComSafeArrayOutArg(aCaps)); 239 240 return S_OK; 241 } 242 243 STDMETHODIMP MediumFormat::DescribeFileExtensions(ComSafeArrayOut(BSTR, aFileExtensions), 244 ComSafeArrayOut(DeviceType_T, aDeviceTypes)) 245 { 246 CheckComArgOutSafeArrayPointerValid(aFileExtensions); 247 248 AutoCaller autoCaller(this); 249 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 250 251 /* this is const, no need to lock */ 252 com::SafeArray<BSTR> fileExtentions(m.llFileExtensions.size()); 253 int i = 0; 254 for (StrList::const_iterator it = m.llFileExtensions.begin(); 255 it != m.llFileExtensions.end(); 256 ++it, ++i) 257 (*it).cloneTo(&fileExtentions[i]); 258 fileExtentions.detachTo(ComSafeArrayOutArg(aFileExtensions)); 259 260 com::SafeArray<DeviceType_T> deviceTypes(m.llDeviceTypes.size()); 261 i = 0; 262 for (DeviceTypeList::const_iterator it = m.llDeviceTypes.begin(); 263 it != m.llDeviceTypes.end(); 264 ++it, ++i) 265 deviceTypes[i] = (*it); 266 deviceTypes.detachTo(ComSafeArrayOutArg(aDeviceTypes)); 267 268 return S_OK; 269 } 270 271 STDMETHODIMP MediumFormat::DescribeProperties(ComSafeArrayOut(BSTR, aNames), 272 ComSafeArrayOut(BSTR, aDescriptions), 273 ComSafeArrayOut(DataType_T, aTypes), 274 ComSafeArrayOut(ULONG, aFlags), 275 ComSafeArrayOut(BSTR, aDefaults)) 276 { 277 CheckComArgOutSafeArrayPointerValid(aNames); 278 CheckComArgOutSafeArrayPointerValid(aDescriptions); 279 CheckComArgOutSafeArrayPointerValid(aTypes); 280 CheckComArgOutSafeArrayPointerValid(aFlags); 281 CheckComArgOutSafeArrayPointerValid(aDefaults); 282 283 AutoCaller autoCaller(this); 284 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 285 286 /* this is const, no need to lock */ 287 size_t c = m.llProperties.size(); 288 com::SafeArray<BSTR> propertyNames(c); 289 com::SafeArray<BSTR> propertyDescriptions(c); 290 com::SafeArray<DataType_T> propertyTypes(c); 291 com::SafeArray<ULONG> propertyFlags(c); 292 com::SafeArray<BSTR> propertyDefaults(c); 293 294 int i = 0; 295 for (PropertyList::const_iterator it = m.llProperties.begin(); 296 it != m.llProperties.end(); 297 ++it, ++i) 298 { 299 const Property &prop = (*it); 300 prop.strName.cloneTo(&propertyNames[i]); 301 prop.strDescription.cloneTo(&propertyDescriptions[i]); 302 propertyTypes[i] = prop.type; 303 propertyFlags[i] = prop.flags; 304 prop.strDefaultValue.cloneTo(&propertyDefaults[i]); 305 } 306 307 propertyNames.detachTo(ComSafeArrayOutArg(aNames)); 308 propertyDescriptions.detachTo(ComSafeArrayOutArg(aDescriptions)); 309 propertyTypes.detachTo(ComSafeArrayOutArg(aTypes)); 310 propertyFlags.detachTo(ComSafeArrayOutArg(aFlags)); 311 propertyDefaults.detachTo(ComSafeArrayOutArg(aDefaults)); 194 HRESULT MediumFormat::getId(com::Utf8Str &aId) 195 { 196 /* this is const, no need to lock */ 197 aId = m.strId; 198 199 return S_OK; 200 } 201 202 HRESULT MediumFormat::getName(com::Utf8Str &aName) 203 { 204 /* this is const, no need to lock */ 205 aName = m.strName; 206 207 return S_OK; 208 } 209 210 HRESULT MediumFormat::getCapabilities(std::vector<MediumFormatCapabilities_T> &aCapabilities) 211 { 212 /* m.capabilities is const, no need to lock */ 213 214 aCapabilities.resize(sizeof(MediumFormatCapabilities_T) * 8); 215 size_t cCapabilities = 0; 216 for (size_t i = 0; i < aCapabilities.size(); i++) 217 { 218 uint64_t tmp = m.capabilities; 219 tmp &= 1ULL << i; 220 if (tmp) 221 aCapabilities[cCapabilities] = (MediumFormatCapabilities_T)tmp; 222 } 223 aCapabilities.resize(RT_MIN(cCapabilities, 1)); 312 224 313 225 return S_OK; … … 317 229 ///////////////////////////////////////////////////////////////////////////// 318 230 231 HRESULT MediumFormat::describeFileExtensions(std::vector<com::Utf8Str> &aExtensions, 232 std::vector<DeviceType_T> &aTypes) 233 { 234 /* this is const, no need to lock */ 235 aExtensions = m.maFileExtensions; 236 aTypes = m.maDeviceTypes; 237 238 return S_OK; 239 } 240 241 HRESULT MediumFormat::describeProperties(std::vector<com::Utf8Str> &aNames, 242 std::vector<com::Utf8Str> &aDescriptions, 243 std::vector<DataType_T> &aTypes, 244 std::vector<ULONG> &aFlags, 245 std::vector<com::Utf8Str> &aDefaults) 246 { 247 /* this is const, no need to lock */ 248 size_t c = m.maProperties.size(); 249 aNames.resize(c); 250 aDescriptions.resize(c); 251 aTypes.resize(c); 252 aFlags.resize(c); 253 aDefaults.resize(c); 254 for (size_t i = 0; i < c; i++) 255 { 256 const Property &prop = m.maProperties[i]; 257 aNames[i] = prop.strName; 258 aDescriptions[i] = prop.strDescription; 259 aTypes[i] = prop.type; 260 aFlags[i] = prop.flags; 261 aDefaults[i] = prop.strDefaultValue; 262 } 263 264 return S_OK; 265 } 266 319 267 // public methods only for internal purposes 320 268 ///////////////////////////////////////////////////////////////////////////// -
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r45497 r45518 959 959 if (FAILED(rc)) return rc; 960 960 961 if (!(m->formatObj-> getCapabilities() & ( MediumFormatCapabilities_CreateFixed961 if (!(m->formatObj->i_getCapabilities() & ( MediumFormatCapabilities_CreateFixed 962 962 | MediumFormatCapabilities_CreateDynamic)) 963 963 ) … … 1240 1240 1241 1241 Utf8Str strFull; 1242 if (m->formatObj-> getCapabilities() & MediumFormatCapabilities_File)1242 if (m->formatObj->i_getCapabilities() & MediumFormatCapabilities_File) 1243 1243 { 1244 1244 // compose full path of the medium, if it's not fully qualified... … … 2517 2517 2518 2518 if ( !(mediumVariantFlags & MediumVariant_Fixed) 2519 && !(m->formatObj-> getCapabilities() & MediumFormatCapabilities_CreateDynamic))2519 && !(m->formatObj->i_getCapabilities() & MediumFormatCapabilities_CreateDynamic)) 2520 2520 throw setError(VBOX_E_NOT_SUPPORTED, 2521 2521 tr("Medium format '%s' does not support dynamic storage creation"), … … 2523 2523 2524 2524 if ( (mediumVariantFlags & MediumVariant_Fixed) 2525 && !(m->formatObj-> getCapabilities() & MediumFormatCapabilities_CreateDynamic))2525 && !(m->formatObj->i_getCapabilities() & MediumFormatCapabilities_CreateDynamic)) 2526 2526 throw setError(VBOX_E_NOT_SUPPORTED, 2527 2527 tr("Medium format '%s' does not support fixed storage creation"), … … 3194 3194 { 3195 3195 if ( m->formatObj 3196 && (m->formatObj-> getCapabilities() & MediumFormatCapabilities_File)3196 && (m->formatObj->i_getCapabilities() & MediumFormatCapabilities_File) 3197 3197 ) 3198 3198 return true; … … 4137 4137 4138 4138 /* check that our own format supports diffs */ 4139 if (!(m->formatObj-> getCapabilities() & MediumFormatCapabilities_Differencing))4139 if (!(m->formatObj->i_getCapabilities() & MediumFormatCapabilities_Differencing)) 4140 4140 { 4141 4141 /* use the default format if not */ … … 4270 4270 LogFlowThisFunc(("aWait=%RTbool locationFull=%s\n", aWait, getLocationFull().c_str() )); 4271 4271 4272 if ( !(m->formatObj-> getCapabilities() & ( MediumFormatCapabilities_CreateDynamic4272 if ( !(m->formatObj->i_getCapabilities() & ( MediumFormatCapabilities_CreateDynamic 4273 4273 | MediumFormatCapabilities_CreateFixed))) 4274 4274 throw setError(VBOX_E_NOT_SUPPORTED, … … 5676 5676 } 5677 5677 5678 if (formatObj-> getCapabilities() & MediumFormatCapabilities_Uuid)5678 if (formatObj->i_getCapabilities() & MediumFormatCapabilities_Uuid) 5679 5679 { 5680 5680 /* Modify the UUIDs if necessary. The associated fields are … … 6204 6204 6205 6205 if ( isImport 6206 || ( (m->formatObj-> getCapabilities() & MediumFormatCapabilities_File)6206 || ( (m->formatObj->i_getCapabilities() & MediumFormatCapabilities_File) 6207 6207 && !m->hostDrive)) 6208 6208 { … … 6214 6214 { 6215 6215 /* must be a file (formatObj must be already known) */ 6216 Assert(m->formatObj-> getCapabilities() & MediumFormatCapabilities_File);6216 Assert(m->formatObj->i_getCapabilities() & MediumFormatCapabilities_File); 6217 6217 6218 6218 if (RTPathFilename(aLocation.c_str()) == NULL) … … 6222 6222 * this */ 6223 6223 6224 ComAssertMsgRet(!m->formatObj-> getFileExtensions().empty(),6224 ComAssertMsgRet(!m->formatObj->i_getFileExtensions().empty(), 6225 6225 ("Must be at least one extension if it is MediumFormatCapabilities_File\n"), 6226 6226 E_FAIL); 6227 6227 6228 Utf8Str strExt = m->formatObj-> getFileExtensions().front();6228 Utf8Str strExt = m->formatObj->i_getFileExtensions().front(); 6229 6229 ComAssertMsgRet(!strExt.isEmpty(), 6230 6230 ("Default extension must not be empty\n"), … … 6240 6240 // we must always have full paths now (if it refers to a file) 6241 6241 if ( ( m->formatObj.isNull() 6242 || m->formatObj-> getCapabilities() & MediumFormatCapabilities_File)6242 || m->formatObj->i_getCapabilities() & MediumFormatCapabilities_File) 6243 6243 && !RTPathStartsWithRoot(locationFull.c_str())) 6244 6244 return setError(VBOX_E_FILE_ERROR, … … 6326 6326 6327 6327 /* is it still a file? */ 6328 if ( (m->formatObj-> getCapabilities() & MediumFormatCapabilities_File)6328 if ( (m->formatObj->i_getCapabilities() & MediumFormatCapabilities_File) 6329 6329 && (m->state == MediumState_NotCreated) 6330 6330 ) … … 6374 6374 Assert(m->mapProperties.empty()); 6375 6375 6376 for (MediumFormat::Property List::const_iterator it = m->formatObj->getProperties().begin();6377 it != m->formatObj-> getProperties().end();6376 for (MediumFormat::PropertyArray::const_iterator it = m->formatObj->i_getProperties().begin(); 6377 it != m->formatObj->i_getProperties().end(); 6378 6378 ++it) 6379 6379 { … … 6764 6764 Utf8Str format(m->strFormat); 6765 6765 Utf8Str location(m->strLocationFull); 6766 uint64_t capabilities = m->formatObj-> getCapabilities();6766 uint64_t capabilities = m->formatObj->i_getCapabilities(); 6767 6767 ComAssertThrow(capabilities & ( MediumFormatCapabilities_CreateFixed 6768 6768 | MediumFormatCapabilities_CreateDynamic), E_FAIL); … … 6904 6904 Utf8Str targetFormat(pTarget->m->strFormat); 6905 6905 Utf8Str targetLocation(pTarget->m->strLocationFull); 6906 uint64_t capabilities = pTarget->m->formatObj-> getCapabilities();6906 uint64_t capabilities = pTarget->m->formatObj->i_getCapabilities(); 6907 6907 ComAssertThrow(capabilities & MediumFormatCapabilities_CreateDynamic, E_FAIL); 6908 6908 … … 7442 7442 Utf8Str targetFormat(pTarget->m->strFormat); 7443 7443 Utf8Str targetLocation(pTarget->m->strLocationFull); 7444 uint64_t capabilities = pTarget->m->formatObj-> getCapabilities();7444 uint64_t capabilities = pTarget->m->formatObj->i_getCapabilities(); 7445 7445 7446 7446 Assert( pTarget->m->state == MediumState_Creating … … 8125 8125 } 8126 8126 8127 Utf8Str targetFormat(task.mFormat-> getId());8127 Utf8Str targetFormat(task.mFormat->i_getId()); 8128 8128 Utf8Str targetLocation(task.mFilename); 8129 uint64_t capabilities = task.mFormat-> getCapabilities();8129 uint64_t capabilities = task.mFormat->i_getCapabilities(); 8130 8130 8131 8131 Assert(m->state == MediumState_LockedRead); … … 8238 8238 /* Open source medium. */ 8239 8239 vrc = VDOpen(hdd, 8240 task.mFormat-> getId().c_str(),8240 task.mFormat->i_getId().c_str(), 8241 8241 task.mFilename.c_str(), 8242 8242 VD_OPEN_FLAGS_READONLY | VD_OPEN_FLAGS_SEQUENTIAL | m->uOpenFlagsDef, … … 8250 8250 Utf8Str targetFormat(m->strFormat); 8251 8251 Utf8Str targetLocation(m->strLocationFull); 8252 uint64_t capabilities = task.mFormat-> getCapabilities();8252 uint64_t capabilities = task.mFormat->i_getCapabilities(); 8253 8253 8254 8254 Assert( m->state == MediumState_Creating -
trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
r45497 r45518 1106 1106 /* MediumFormat is all const, no need to lock */ 1107 1107 1108 if ((*it)-> getId().compare(aFormat, Utf8Str::CaseInsensitive) == 0)1108 if ((*it)->i_getId().compare(aFormat, Utf8Str::CaseInsensitive) == 0) 1109 1109 { 1110 1110 format = *it; … … 1139 1139 { 1140 1140 /* MediumFormat is all const, no need to lock */ 1141 MediumFormat::Str List aFileList = (*it)->getFileExtensions();1142 for (MediumFormat::Str List::const_iterator it1 = aFileList.begin();1141 MediumFormat::StrArray aFileList = (*it)->i_getFileExtensions(); 1142 for (MediumFormat::StrArray::const_iterator it1 = aFileList.begin(); 1143 1143 it1 != aFileList.end(); 1144 1144 ++it1) -
trunk/src/VBox/Main/src-server/xpcom/server.cpp
r45138 r45518 128 128 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Medium, IMedium) 129 129 130 NS_DECL_CLASSINFO(MediumFormat)131 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(MediumFormat, IMediumFormat)132 133 130 NS_DECL_CLASSINFO(MediumAttachment) 134 131 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(MediumAttachment, IMediumAttachment)
Note:
See TracChangeset
for help on using the changeset viewer.