VR-Forces 4.5 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtDeSettings.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2012 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
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 
34  virtual ~DtDeSettings();
35 
37  const std::string& name() const;
38 
40  const std::string& extension() const;
41 
43  template <typename RecordType>
44  bool readDefaultRecord(RecordType& r);
45 
47  template <typename RecordType>
48  bool readBackupRecord(RecordType& r);
49 
50  template <typename RecordType>
51  bool readFactoryDefaultRecord(RecordType& r);
52 
54  template <typename RecordType>
55  bool writeDefaultRecord(const RecordType& r);
56 
58  template <typename RecordType>
59  bool writeBackupRecord(const RecordType& r);
60 
62  template <typename RecordType>
63  bool readRecordFrom(RecordType& r, const std::string& importFileName);
64 
66  template <typename RecordType>
67  bool readRecordFromBinary(RecordType& r, const std::string& importFileName);
68 
70  template <typename RecordType>
71  bool writeRecordTo( const RecordType& r, const std::string& exportFileName ) const;
72 
74  template <typename RecordType>
75  bool writeRecordToBinary( const RecordType& r, const std::string& exportFileName ) const;
76 
79  inline void setAutoSave( bool b )
80  {
81  myAutoSave = b;
82  }
83 
84  inline bool autoSave() const
85  {
86  return myAutoSave;
87  }
88 
91  bool defaultFileExists() const;
92  virtual std::string defaultFilePath() const;
93 
94  bool defaultBinaryFileExists() const;
95  virtual std::string defaultBinaryFilePath() const;
96 
98 
101  bool factoryFileExists() const;
102  virtual std::string factoryFilePath() const;
104 
107  bool backupFileExists() const;
108  virtual std::string backupFilePath() const;
110 
111  static std::string binaryFileExtension(void);
112 
115  bool defaultDirExists() const;
116  virtual std::string defaultDirPath() const;
118 
121  bool factoryDirExists() const;
122  virtual std::string factoryDirPath() const;
124 
127  bool backupDirExists() const;
128  virtual std::string backupDirPath() const;
130 
133  bool userEntityElementDefinitionDirExists() const;
134  virtual std::string userEntityElementDefinitionDirPath() const;
136 
138  template <typename RecordType>
139  bool readDefaultRecords(std::vector<RecordType>& recVec);
140 
142  template <typename RecordType>
143  bool readRecordsFromDir(std::vector<RecordType>& recVec,
144  const std::string& importDirName);
145 
146  protected:
147 
148  friend class DtDeSettingsManager;
149 
150  DtDeSettings( DtDe& de, const std::string& name,const std::string& ext );
151 
152  protected:
153 
155  std::string myName;
156  std::string myExtension;
158 
159  static const std::string myBinaryFileExtension;
160 
161  };
162 
163 }
164 
165 #define DtDeSettings_INL_
166 #include <vrvCore/DtDeSettings.inl>
167 #undef DtDeSettings_INL_

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)