VR-Forces 4.5 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtSettingsBackup.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2009 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 /******************************************************************************
6 ** $RCSfile: DtSettingsBackup.h,v $ $Revision: 1.16 $ $State: Exp $
7 ******************************************************************************/
8 
15 
16 #pragma once
18 #include <boost/archive/xml_iarchive.hpp>
19 #include <boost/archive/xml_oarchive.hpp>
20 
21 namespace makVrv
22 {
23 
27  {
28  public:
30  {
31  RestoreFromFactory = 0x00000001,
32  RestoreFromLocal = 0x00000002,
37  KeepRestoreFromLocal = 0x80000000,
38  RestoreAll = RestoreFromFactory | RestoreFromLocal
39  };
40 
41  typedef std::map<DtSettingsBackup*, int> RestoreWhenRestored;
42 
43  public:
44 
47 
49  virtual ~DtSettingsBackup();
50 
54  virtual bool createAndWriteToBackupFile(const std::ostringstream& str, const std::string& path);
55 
56  virtual bool createAndWriteToBackupFiles(const std::vector<std::ostringstream*> str,
57  const std::string& path, const std::vector<std::string>& fileNames);
58 
60  const std::string& backupFile() const;
61 
63  virtual bool backupFileExists() const;
64 
67  virtual bool backupDirExists() const;
68 
70  virtual bool factoryFileExists() const;
71 
73  virtual bool factoryDirExists() const;
74 
77  virtual void backup();
78 
82  virtual void backupByDir();
83 
86  virtual void deleteBackup();
87 
89  virtual void restore(bool fromFactory = false);
90 
92  virtual void getRestorableNames(NameList& names);
93 
96  virtual void restore(bool fromFactory, bool selectedOnly);
97 
101  virtual void restore(const DtSettingsBackup* from ) = 0;
102 
106  virtual void restoreSelected( const DtSettingsBackup* ) {}
107 
110  virtual std::string backupClassType() const = 0;
111 
114  virtual DtSettingsBackup* create() const = 0;
115 
118  virtual void write(boost::archive::xml_oarchive& ar) = 0;
119 
122  virtual void read(boost::archive::xml_iarchive& ar) = 0;
123 
125  virtual void writeDir(std::vector<std::ostringstream*>& outStreamVec, std::vector<std::string>& fileNames)
126  {
127  // should never be called
128  };
129 
132  virtual void readIncremental(boost::archive::xml_iarchive& ar)
133  {
134  // should never be called
135  };
136 
138  void setManagerDestroyed(bool b)
139  {
140  myManagerDestroyed = b;
141  }
142 
146  virtual void addRestoreWhenRestored(DtSettingsBackup*,
147  const RestoreFlags& f = RestoreAll);
148 
149  const RestoreWhenRestored& restoreWhenRestored() const
150  {
151  return myRestoreWhenRestored;
152  }
153 
156  virtual void cancelRestoreWhenRestored(DtSettingsBackup*,
157  const RestoreFlags& f = RestoreAll);
158 
161  virtual std::string backupName() const;
162 
163  void setBackupsPath(const std::string& s)
164  {
165  myBackupsPath = s;
166  }
167 
168  const std::string& backupsPath() const
169  {
170  return myBackupsPath;
171  }
172 
173  void setFactoryFile(const std::string& s)
174  {
175  myFactoryFile = s;
176  }
177 
178  const std::string& factoryFile() const
179  {
180  return myFactoryFile;
181  }
182 
183  void setFactoryDir(const std::string& dir)
184  {
185  myFactoryDir = dir;
186  }
187 
188  const std::string& factoryDir() const
189  {
190  return myFactoryDir;
191  }
192 
193  void setBackupDir(const std::string& dir)
194  {
195  myBackupDir = dir;
196  }
197 
198  const std::string& backupDir() const
199  {
200  return myBackupDir;
201  }
202 
205  boost::signal<void (const DtSettingsBackup*)> signal_destructing;
206  boost::signal<void (const DtSettingsBackup*)> signal_backupCleared;
207  boost::signal<void (const DtSettingsBackup*)> signal_backedUp;
208  boost::signal<void (const DtSettingsBackup*)> signal_restored;
209 
210  protected:
211 
213  virtual bool restore(bool fromFactory,
214  std::vector<DtSettingsBackup*>& hasBeenRestored, bool selectedOnly);
215 
216  protected:
217 
220  std::string myBackupFile;
221  std::string myFactoryFile;
222  std::string myBackupsPath;
223  std::string myBackupDir;
224  std::string myFactoryDir;
225 
226  };
227 
228 }

Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)