VirtualBox

Changeset 32780 in vbox for trunk/include/VBox/com


Ignore:
Timestamp:
Sep 27, 2010 7:00:22 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
66229
Message:

com/Guid: remove conversion operators to eliminate any compiler surprises. Caught one totally unexpected issue which was indirectly caused by the similar Bstr cleanup, as there still is a Bstr->Guid conversion and thus the Guid magic was triggered

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/com/Guid.h

    r30681 r32780  
    77
    88/*
    9  * Copyright (C) 2006-2007 Oracle Corporation
     9 * Copyright (C) 2006-2010 Oracle Corporation
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    168168    }
    169169
    170     operator bool() const
    171     {
    172         return !isEmpty();
    173     }
    174 
    175170    bool operator==(const Guid &that) const { return ::RTUuidCompare (&uuid, &that.uuid) == 0; }
    176171    bool operator==(const GUID &guid) const { return ::RTUuidCompare (&uuid, (PRTUUID) &guid) == 0; }
     
    180175    bool operator<(const GUID &guid) const { return ::RTUuidCompare (&uuid, (PRTUUID) &guid) < 0; }
    181176
    182     /* to pass instances as IN_GUID parameters to interface methods */
    183     operator const GUID&() const
    184     {
    185         return *(GUID *) &uuid;
    186     }
    187 
    188     /* to directly pass instances to RTPrintf("%RTuuid") */
    189     PRTUUID ptr()
    190     {
    191         return &uuid;
     177    /* to directly copy the contents to a GUID, or for passing it as
     178     * an input parameter of type (const GUID *), the compiler converts */
     179    const GUID &ref() const
     180    {
     181        return *(const GUID *)&uuid;
    192182    }
    193183
    194184    /* to pass instances to printf-like functions */
    195     PCRTUUID raw() const
    196     {
    197         return &uuid;
    198     }
    199 
    200     /* to pass instances to RTUuid*() as a constant argument */
    201     operator const RTUUID*() const
    202     {
    203         return &uuid;
     185    const PCRTUUID raw() const
     186    {
     187        return (PCRTUUID)&uuid;
    204188    }
    205189
     
    311295}
    312296
    313 
    314 /* work around error C2593 of the stupid MSVC 7.x ambiguity resolver */
    315 WORKAROUND_MSVC7_ERROR_C2593_FOR_BOOL_OP (Guid)
    316 
    317297} /* namespace com */
    318298
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette