VirtualBox

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

Last change on this file since 34575 was 31539, checked in by vboxsync, 14 years ago

Main: use settings struct for machine user data; remove iprt::MiniString::raw() and change all occurences to c_str()

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 KB
Line 
1/* $Id: SnapshotImpl.h 31539 2010-08-10 15:40:18Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox COM class implementation
6 */
7
8/*
9 * Copyright (C) 2006-2010 Oracle Corporation
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 */
19
20#ifndef ____H_SNAPSHOTIMPL
21#define ____H_SNAPSHOTIMPL
22
23#include "VirtualBoxBase.h"
24
25#include <iprt/time.h>
26
27class SnapshotMachine;
28
29namespace settings
30{
31 struct Snapshot;
32}
33
34class ATL_NO_VTABLE Snapshot :
35 public VirtualBoxBase,
36 VBOX_SCRIPTABLE_IMPL(ISnapshot)
37{
38public:
39 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Snapshot, ISnapshot)
40
41 DECLARE_NOT_AGGREGATABLE(Snapshot)
42
43 DECLARE_PROTECT_FINAL_CONSTRUCT()
44
45 BEGIN_COM_MAP(Snapshot)
46 COM_INTERFACE_ENTRY (ISupportErrorInfo)
47 COM_INTERFACE_ENTRY (ISnapshot)
48 COM_INTERFACE_ENTRY2 (IDispatch, ISnapshot)
49 END_COM_MAP()
50
51 Snapshot()
52 : m(NULL)
53 { };
54 ~Snapshot()
55 { };
56
57 HRESULT FinalConstruct();
58 void FinalRelease();
59
60 // public initializer/uninitializer only for internal purposes
61 HRESULT init(VirtualBox *aVirtualBox,
62 const Guid &aId,
63 const Utf8Str &aName,
64 const Utf8Str &aDescription,
65 const RTTIMESPEC &aTimeStamp,
66 SnapshotMachine *aMachine,
67 Snapshot *aParent);
68 void uninit();
69
70 void beginSnapshotDelete();
71
72 void deparent();
73
74 // ISnapshot properties
75 STDMETHOD(COMGETTER(Id)) (BSTR *aId);
76 STDMETHOD(COMGETTER(Name)) (BSTR *aName);
77 STDMETHOD(COMSETTER(Name)) (IN_BSTR aName);
78 STDMETHOD(COMGETTER(Description)) (BSTR *aDescription);
79 STDMETHOD(COMSETTER(Description)) (IN_BSTR aDescription);
80 STDMETHOD(COMGETTER(TimeStamp)) (LONG64 *aTimeStamp);
81 STDMETHOD(COMGETTER(Online)) (BOOL *aOnline);
82 STDMETHOD(COMGETTER(Machine)) (IMachine **aMachine);
83 STDMETHOD(COMGETTER(Parent)) (ISnapshot **aParent);
84 STDMETHOD(COMGETTER(Children)) (ComSafeArrayOut (ISnapshot *, aChildren));
85
86 // ISnapshot methods
87
88 // public methods only for internal purposes
89
90 /**
91 * Override of the default locking class to be used for validating lock
92 * order with the standard member lock handle.
93 */
94 virtual VBoxLockingClass getLockingClass() const
95 {
96 return LOCKCLASS_SNAPSHOTOBJECT;
97 }
98
99 const ComObjPtr<Snapshot>& getParent() const;
100 const ComObjPtr<Snapshot> getFirstChild() const;
101
102 const Utf8Str& stateFilePath() const;
103 HRESULT deleteStateFile();
104
105 ULONG getChildrenCount();
106 ULONG getAllChildrenCount();
107 ULONG getAllChildrenCountImpl();
108
109 const ComObjPtr<SnapshotMachine>& getSnapshotMachine() const;
110
111 Guid getId() const;
112 const Utf8Str& getName() const;
113 RTTIMESPEC getTimeStamp() const;
114
115 ComObjPtr<Snapshot> findChildOrSelf(IN_GUID aId);
116 ComObjPtr<Snapshot> findChildOrSelf(const Utf8Str &aName);
117
118 void updateSavedStatePaths(const Utf8Str &strOldPath,
119 const Utf8Str &strNewPath);
120 void updateSavedStatePathsImpl(const Utf8Str &strOldPath,
121 const Utf8Str &strNewPath);
122
123 HRESULT saveSnapshot(settings::Snapshot &data, bool aAttrsOnly);
124 HRESULT saveSnapshotImpl(settings::Snapshot &data, bool aAttrsOnly);
125
126 HRESULT uninitRecursively(AutoWriteLock &writeLock,
127 CleanupMode_T cleanupMode,
128 MediaList &llMedia,
129 std::list<Utf8Str> &llFilenames);
130
131private:
132 struct Data; // opaque, defined in SnapshotImpl.cpp
133 Data *m;
134};
135
136#endif // ____H_SNAPSHOTIMPL
137
138/* 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