VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtDeSettings.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2020 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
6 #pragma once
7 
11 
12 #include <vrvCore/vrvCore.h>
13 
15 #include <vrvUtil/DtDeError.h>
17 
18 #include <vrvCore/DtDe.h>
19 
20 #include <string>
21 
22 #define DT_DE_SETTINGS_USE_BINARY_FILES 0
23 
24 namespace makVrv
25 {
26 
30  {
31  public:
32 
33 
35  virtual ~DtDeSettings();
36 
37  private:
39  DtDeSettings(const DtDeSettings& copy);
42  DtDeSettings();
45  DtDeSettings& operator=(const DtDeSettings&);
46 
47  public:
49  const std::string& name() const;
50 
52  const std::string& extension() const;
53 
55  template <typename RecordType>
56  bool readDefaultRecord(RecordType& r);
57 
61  template <typename RecordType>
62  bool readDefaultRecordAndName(RecordType& r, std::string& fName);
63 
65  template <typename RecordType>
66  bool readBackupRecord(RecordType& r);
67 
68  template <typename RecordType>
69  bool readFactoryDefaultRecord(RecordType& r);
70 
72  template <typename RecordType>
73  bool writeDefaultRecord(const RecordType& r);
74 
76  template <typename RecordType>
77  bool writeBackupRecord(const RecordType& r);
78 
81  template <typename RecordType>
82  bool readRecordsFrom(std::map<std::string, RecordType>& r, const std::string& importFileName);
83 
85  template <typename RecordType>
86  bool readRecordFrom(RecordType& r, const std::string& importFileName);
87 
89  template <typename RecordType>
90  bool readRecordFromBinary(RecordType& r, const std::string& importFileName);
91 
93  template <typename RecordType>
94  bool writeRecordTo(const RecordType& r, const std::string& exportFileName) const;
95 
97  template <typename RecordType>
98  bool writeRecordToBinary(const RecordType& r, const std::string& exportFileName) const;
99 
102  inline void setAutoSave(bool b)
103  {
104  myAutoSave = b;
105  }
106 
107  inline bool autoSave() const
108  {
109  return myAutoSave;
110  }
111 
114  bool defaultFileExists() const;
115  virtual std::string defaultFilePath() const;
116 
117  bool defaultBinaryFileExists() const;
118  virtual std::string defaultBinaryFilePath() const;
119 
121 
124  bool factoryFileExists() const;
125  virtual std::string factoryFilePath() const;
127 
130  bool backupFileExists() const;
131  virtual std::string backupFilePath() const;
133 
134  static std::string binaryFileExtension(void);
135 
138  bool defaultDirExists() const;
139  virtual std::string defaultDirPath() const;
141 
144  bool factoryDirExists() const;
145  virtual std::string factoryDirPath() const;
147 
150  bool backupDirExists() const;
151  virtual std::string backupDirPath() const;
153 
156  bool userEntityElementDefinitionDirExists() const;
157  virtual std::string userEntityElementDefinitionDirPath() const;
159 
162  template <typename RecordType>
163  bool readDefaultRecords(std::map<std::string, RecordType>& recordMap);
164 
166  template <typename RecordType>
167  bool readRecordFromFile(RecordType& record,
168  const std::string& importFileName);
169 
172  template <typename RecordType>
173  bool readRecordsFromDir(std::map<std::string, RecordType>& recordMap,
174  const std::string& importDirName);
175 
176  protected:
177 
178  friend class DtDeSettingsManager;
179 
180  DtDeSettings(DtDe& de, const std::string& name, const std::string& ext);
181 
182  protected:
183 
185  std::string myName;
186  std::string myExtension;
188 
189  static const std::string myBinaryFileExtension;
190 
191  };
192 
193 }
194 
195 #define DtDeSettings_INL_
196 #include <vrvCore/DtDeSettings.inl>
197 #undef DtDeSettings_INL_
Contains makVrv::DtDeError class.
bool myAutoSave
Definition: DtDeSettings.h:187
DtDe & myDe
Definition: DtDeSettings.h:184
std::string myName
Definition: DtDeSettings.h:185
Contains makVrv::DtDe class.
void setAutoSave(bool b)
Save the record after each change in the GUI (as opposed to hitting the export button to save) ...
Definition: DtDeSettings.h:102
static const std::string myBinaryFileExtension
Definition: DtDeSettings.h:189
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
Contains makVrv::DtVrvFilesystem class.
std::string myExtension
Definition: DtDeSettings.h:186
Settings class for reading and writing settings to/from files.
Definition: DtDeSettings.h:29
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
A manager of all of the settings.
Definition: DtDeSettingsManager.h:25
bool autoSave() const
Definition: DtDeSettings.h:107
Contains DLL export macros.

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)