VirtualBox

Changeset 28689 in vbox for trunk/include


Ignore:
Timestamp:
Apr 24, 2010 6:23:57 PM (15 years ago)
Author:
vboxsync
Message:

XmlFileWrite::write: Added a fSafe argument for safe writing of the xml file. See method description for details.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/cpp/xml.h

    r28199 r28689  
    11/** @file
    2  * VirtualBox XML helper APIs.
     2 * IPRT - XML Helper APIs.
    33 */
    44
    55/*
    6  * Copyright (C) 2007-2009 Sun Microsystems, Inc.
     6 * Copyright (C) 2007-2010 Sun Microsystems, Inc.
    77 *
    88 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2828 */
    2929
    30 #ifndef ___VBox_vboxxml_h
    31 #define ___VBox_vboxxml_h
     30#ifndef ___iprt_xml_h
     31#define ___iprt_xml_h
    3232
    3333#ifndef IN_RING3
     
    288288     * @param aMode     File mode.
    289289     * @param aFileName File name.
    290      */
    291     File(Mode aMode, const char *aFileName);
     290     * @param aFlushIt  Whether to flush a writable file before closing it.
     291     */
     292    File(Mode aMode, const char *aFileName, bool aFlushIt = false);
    292293
    293294    /**
     
    308309     * @param aHandle   Open file handle.
    309310     * @param aFileName File name (for reference).
    310      */
    311     File(RTFILE aHandle, const char *aFileName = NULL);
     311     * @param aFlushIt  Whether to flush a writable file before closing it.
     312     */
     313    File(RTFILE aHandle, const char *aFileName = NULL, bool aFlushIt = false);
    312314
    313315    /**
     
    669671    ~XmlFileWriter();
    670672
    671     void write(const char *pcszFilename);
     673    /**
     674     * Writes the XML document to the specified file.
     675     *
     676     * @param   pcszFilename    The name of the output file.
     677     * @param   fSafe           If @c true, some extra safety precautions will be
     678     *                          taken when writing the file:
     679     *                              -# The file is written with a '-tmp' suffix.
     680     *                              -# It is flushed to disk after writing.
     681     *                              -# Any original file is renamed to '-prev'.
     682     *                              -# The '-tmp' file is then renamed to the
     683     *                                 specified name.
     684     *                              -# The directory changes are flushed to disk.
     685     */
     686    void write(const char *pcszFilename, bool fSafe);
    672687
    673688    static int WriteCallback(void *aCtxt, const char *aBuf, int aLen);
     
    675690
    676691private:
     692    void writeInternal(const char *pcszFilename, bool fSafe);
     693
    677694    /* Obscure class data */
    678695    struct Data;
     
    688705} // end namespace xml
    689706
    690 #endif /* ___VBox_vboxxml_h */
     707#endif /* !___iprt_xml_h */
Note: See TracChangeset for help on using the changeset viewer.

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