VirtualBox

source: vbox/trunk/src/VBox/Main/include/SnapshotImpl.h@ 22178

Last change on this file since 22178 was 22173, checked in by vboxsync, 15 years ago

Main: the big XML settings rework. Move XML reading/writing out of interface implementation code into separate layer so it can handle individual settings versions in the future.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 KB
Line 
1/** @file
2 *
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22#ifndef ____H_SNAPSHOTIMPL
23#define ____H_SNAPSHOTIMPL
24
25#include "VirtualBoxBase.h"
26
27#include <iprt/time.h>
28
29class SnapshotMachine;
30class VirtualBox;
31
32namespace settings
33{
34 class Snapshot;
35}
36
37class ATL_NO_VTABLE Snapshot :
38 public VirtualBoxSupportErrorInfoImpl<Snapshot, ISnapshot>,
39 public VirtualBoxSupportTranslation<Snapshot>,
40 public VirtualBoxBase, // WithTypedChildren<Snapshot>,
41 VBOX_SCRIPTABLE_IMPL(ISnapshot)
42{
43public:
44 DECLARE_NOT_AGGREGATABLE(Snapshot)
45
46 DECLARE_PROTECT_FINAL_CONSTRUCT()
47
48 BEGIN_COM_MAP(Snapshot)
49 COM_INTERFACE_ENTRY (ISupportErrorInfo)
50 COM_INTERFACE_ENTRY (ISnapshot)
51 COM_INTERFACE_ENTRY2 (IDispatch, ISnapshot)
52 END_COM_MAP()
53
54 NS_DECL_ISUPPORTS
55
56 Snapshot()
57 : m(NULL)
58 { };
59 ~Snapshot()
60 { };
61
62 HRESULT FinalConstruct();
63 void FinalRelease();
64
65 // public initializer/uninitializer only for internal purposes
66 HRESULT init(VirtualBox *aVirtualBox,
67 const Guid &aId,
68 const Utf8Str &aName,
69 const Utf8Str &aDescription,
70 const RTTIMESPEC &aTimeStamp,
71 SnapshotMachine *aMachine,
72 Snapshot *aParent);
73 void uninit();
74
75 void beginDiscard();
76
77 // ISnapshot properties
78 STDMETHOD(COMGETTER(Id)) (BSTR *aId);
79 STDMETHOD(COMGETTER(Name)) (BSTR *aName);
80 STDMETHOD(COMSETTER(Name)) (IN_BSTR aName);
81 STDMETHOD(COMGETTER(Description)) (BSTR *aDescription);
82 STDMETHOD(COMSETTER(Description)) (IN_BSTR aDescription);
83 STDMETHOD(COMGETTER(TimeStamp)) (LONG64 *aTimeStamp);
84 STDMETHOD(COMGETTER(Online)) (BOOL *aOnline);
85 STDMETHOD(COMGETTER(Machine)) (IMachine **aMachine);
86 STDMETHOD(COMGETTER(Parent)) (ISnapshot **aParent);
87 STDMETHOD(COMGETTER(Children)) (ComSafeArrayOut (ISnapshot *, aChildren));
88
89 // ISnapshot methods
90
91 // public methods only for internal purposes
92
93 const Bstr &stateFilePath() const;
94
95 ComObjPtr<Snapshot> parent() const
96 {
97 return (Snapshot*)mParent;
98 }
99
100 ULONG getChildrenCount();
101 ULONG getAllChildrenCount();
102 ULONG getAllChildrenCountImpl();
103
104 ComPtr<SnapshotMachine> getSnapshotMachine();
105
106 Guid getId() const;
107 const Utf8Str& getName() const;
108 RTTIMESPEC getTimeStamp() const;
109
110 ComObjPtr<Snapshot> findChildOrSelf(IN_GUID aId);
111 ComObjPtr<Snapshot> findChildOrSelf(const Utf8Str &aName);
112
113 void updateSavedStatePaths(const char *aOldPath,
114 const char *aNewPath);
115 void updateSavedStatePathsImpl(const char *aOldPath,
116 const char *aNewPath);
117
118 HRESULT saveSnapshot(settings::Snapshot &data, bool aAttrsOnly);
119 HRESULT saveSnapshotImpl(settings::Snapshot &data, bool aAttrsOnly);
120
121 // for VirtualBoxSupportErrorInfoImpl
122 static const wchar_t *getComponentName()
123 {
124 return L"Snapshot";
125 }
126
127private:
128
129 /** weak VirtualBox parent */
130 const ComObjPtr<VirtualBox, ComWeakRef> mVirtualBox;
131
132 ComObjPtr<Snapshot, ComWeakRef> mParent;
133
134 struct Data; // opaque, defined in SnapshotImpl.cpp
135 Data *m;
136};
137
138#endif // ____H_SNAPSHOTIMPL
139
140/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

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