VR-Forces 5.0.2 Developer's Guide
 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 mergedFilesExist() const;
157  virtual const std::vector<std::string>& mergedFiles() const;
158  virtual void addMergedFile(std::string fileName);
160 
163  bool userEntityElementDefinitionDirExists() const;
164  virtual std::string userEntityElementDefinitionDirPath() const;
166 
169  template <typename RecordType>
170  bool readDefaultRecords(std::map<std::string, RecordType>& recordMap);
171 
173  template <typename RecordType>
174  bool readRecordFromFile(RecordType& record,
175  const std::string& importFileName);
176 
179  template <typename RecordType>
180  bool readRecordsFromDir(std::map<std::string, RecordType>& recordMap,
181  const std::string& importDirName);
182 
183  protected:
184 
185  friend class DtDeSettingsManager;
186 
187  DtDeSettings(DtDe& de, const std::string& name, const std::string& ext);
188 
189  protected:
190 
192  std::string myName;
193  std::string myExtension;
195  std::vector<std::string> myMergedFiles;
196 
197  static const std::string myBinaryFileExtension;
198 
199  };
200 
201 }
202 
203 #define DtDeSettings_INL_
204 #include <vrvCore/DtDeSettings.inl>
205 #undef DtDeSettings_INL_
Contains makVrv::DtDeError class.
bool myAutoSave
Definition: DtDeSettings.h:194
std::vector< std::string > myMergedFiles
Definition: DtDeSettings.h:195
DtDe & myDe
Definition: DtDeSettings.h:191
std::string myName
Definition: DtDeSettings.h:192
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:197
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
Contains makVrv::DtVrvFilesystem class.
std::string myExtension
Definition: DtDeSettings.h:193
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. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:70
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 Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)