VirtualBox

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


Ignore:
Timestamp:
Sep 23, 2010 2:31:31 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
66161
Message:

com/string: Windows build fixes

File:
1 edited

Legend:

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

    r32718 r32727  
    77
    88/*
    9  * Copyright (C) 2006-2009 Oracle Corporation
     9 * Copyright (C) 2006-2010 Oracle Corporation
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3838#endif
    3939
    40 #if defined (VBOX_WITH_XPCOM)
     40#if defined(VBOX_WITH_XPCOM)
    4141# include <nsMemory.h>
    4242#endif
     
    107107    }
    108108
    109 #if defined (VBOX_WITH_XPCOM)
     109#if defined(VBOX_WITH_XPCOM)
    110110    Bstr(const wchar_t *that)
    111111    {
     
    144144    }
    145145
    146 #if defined (VBOX_WITH_XPCOM)
     146#if defined(VBOX_WITH_XPCOM)
    147147    Bstr& operator=(const wchar_t *that)
    148148    {
     
    212212    size_t length() const { return isEmpty() ? 0 : ::RTUtf16Len((PRTUTF16)m_bstr); }
    213213
     214#if defined(VBOX_WITH_XPCOM)
    214215    /**
    215216     *  Returns a pointer to the raw member UTF-16 string. If the member string is empty,
     
    224225        return g_bstrEmpty;
    225226    }
     227#else
     228    /**
     229     *  Windows-only hack, as the automatically generated headers use BSTR.
     230     *  So if we don't want to cast like crazy we have to be more loose than
     231     *  on XPCOM.
     232     *
     233     *  Returns a pointer to the raw member UTF-16 string. If the member string is empty,
     234     *  returns a pointer to a global variable containing an empty BSTR with a proper zero
     235     *  length prefix so that Windows is happy.
     236     */
     237    BSTR raw() const
     238    {
     239        if (m_bstr)
     240            return m_bstr;
     241
     242        return g_bstrEmpty;
     243    }
     244#endif
    226245
    227246    /**
     
    438457    }
    439458
    440 #if defined (VBOX_WITH_XPCOM)
     459#if defined(VBOX_WITH_XPCOM)
    441460    /**
    442461     * Intended to assign instances to |char *| out parameters from within the
     
    537556 *  The usage of this class is like the following:
    538557 *  <code>
    539  *      Utf8StrFmt string ("program name = %s", argv[0]);
     558 *      Utf8StrFmt string("program name = %s", argv[0]);
    540559 *  </code>
    541560 */
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