VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
rwPropertiesStructure.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2025 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
10 
11 #pragma once
12 
14 
22 {
23 public:
24  // Implement so can be used in a map
26 
27  DtRwPropertiesStructure(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0);
29  DtReaderWriterRegistry* parentRegistry = 0);
31  DtReaderWriterRegistry* parentRegistry = 0);
33  virtual ~DtRwPropertiesStructure() override;
34 
41  inline const DtPropertyInterface* findFieldPropertyInterface(const DtString& fieldName) const
42  {
43  return findPropertyInterface(fieldName);
44  }
45 
47  {
48  return findPropertyInterface(fieldName);
49  }
51 
59  template <typename SpecificPropType>
60  const SpecificPropType* findField(const DtString& fieldName) const
61  {
62  return findProperty<SpecificPropType>(fieldName);
63  }
64 
65  template <typename SpecificPropType>
66  SpecificPropType* findField(const DtString& fieldName)
67  {
68  return findProperty<SpecificPropType>(fieldName);
69  }
71 
74 
81  template <typename ValueType>
82  boost::optional<ValueType> findFieldValue(const DtString& fieldName) const
83  {
84  return findPropertyValue<ValueType>(fieldName);
85  }
86 
93  template <typename ValueType>
94  bool findAndSetFieldValue(const DtString& fieldName, ValueType val)
95  {
96  return findAndSetPropertyValue<ValueType>(fieldName, val);
97  }
99 
103 
108  virtual bool addField(DtPropertyInterface* field)
109  {
110  return addProperty(field);
111  }
112 
118  template <typename SpecificPropType>
119  SpecificPropType* addNewField(const DtString& fieldName)
120  {
121  return addNewProperty<SpecificPropType>(fieldName);
122  }
124 
131  virtual bool removeField(const DtString& propertyName)
132  {
133  return removeProperty(propertyName);
134  }
135 
136  virtual bool removeField(const DtPropertyInterface* property)
137  {
138  return removeProperty(property);
139  }
141 
149  DtPropertyInterface& operator[](const DtString& fieldName);
150 
151  const DtPropertyInterface& operator[](const DtString& fieldName) const;
153 
154  virtual void putSelf(std::string &fp, int indentLevel, bool writeUnspecified,
155  const DtFilename &path) override;
156 
157  virtual const char *readerWriterType() const override;
158 
160  static const char* theXmlType();
161 
162  virtual const char *xmlType() const override {
163  return theXmlType();
164  }
165 
167  virtual void copyVariables(const DtRwVariableBindings &other) override;
168 
170  virtual bool isSimilarProperty(const DtPropertyInterface *rhs,
171  bool strict = true) const override;
172 
173 protected:
174  virtual void getData(const DtEnvironmentSP env, const DtEnvValueSP root,
175  const DtReaderWriter::SearchPaths &searchPaths,
176  const DtVariableBindingsList &varBindings) override;
177  virtual void putData(DtEnvironmentSP, DtEnvValueSP value) const override;
178 
179 protected:
180 
182 };
183 
DtRwProperties & operator=(const DtRwProperties &orig)
#define DT_DLL_readerWriter
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: readerWriterDefines.h:34
const DtPropertyInterface * findFieldPropertyInterface(const DtString &fieldName) const
Definition: rwPropertiesStructure.h:41
DtPropertyInterface * findFieldPropertyInterface(const DtString &fieldName)
Definition: rwPropertiesStructure.h:46
virtual void putData(std::string &, int indentLevel=0) override
Deriving class overrides these to get/put class specific data.
bool findAndSetFieldValue(const DtString &fieldName, ValueType val)
This is a convenience function that combines the functionality of findField and setPropertyValue to i...
Definition: rwPropertiesStructure.h:94
Definition: readerWriterRegistry.h:39
virtual bool removeField(const DtString &propertyName)
Definition: rwPropertiesStructure.h:131
virtual void copyVariables(const DtRwVariableBindings &other) override
Clones variables using the property factory.
SpecificPropType * addNewField(const DtString &fieldName)
Adds a new property of the specified type as a field to the structure and returns pointer to the new ...
Definition: rwPropertiesStructure.h:119
Interface class used to define minimal interface for a property. The DtPropertyInterface class provid...
Definition: propertyInterface.h:53
virtual const char * xmlType() const override
Definition: rwPropertiesStructure.h:162
ReaderWriter object that maintains a list of reader-writer variable bindings. It keeps a list of name...
Definition: rwVariableBindings.h:27
virtual bool addField(DtPropertyInterface *field)
Adds an existing property as a field to the structure. The structure will take ownership of the given...
Definition: rwPropertiesStructure.h:108
A structure composed of distinct fields, each of which is itself a property. The DtRwPropertiesStruct...
Definition: rwPropertiesStructure.h:21
virtual bool removeProperty(const DtString &propertyName) override
std::list< const DtRwVariableBindings * > DtVariableBindingsList
Definition: readerWriterRegistry.h:29
virtual bool removeField(const DtPropertyInterface *property)
Definition: rwPropertiesStructure.h:136
std::vector< DtFilename > SearchPaths
Definition: readerWriter.h:92
const SpecificPropType * findField(const DtString &fieldName) const
Definition: rwPropertiesStructure.h:60
virtual void putSelf(std::string &fp, int indentLevel=0, bool writeUnspecified=false, const DtFilename &path=DtFilename::nullFilename())
Top level call to write itself to file. If write unspecified is true, will write entries that are uns...
DtPropertyInterface * myScratchItem
Definition: rwPropertiesStructure.h:181
virtual const char * readerWriterType() const override
Used to supply a string type that this reader writer type is. This can be used in place of dynamic-ca...
A list of properties. A DtPropertyInterface object that is a specialized version of DtRwVariableBindi...
Definition: rwProperties.h:122
static const char * theXmlType()
The type that is used when archiving to an XML stream.
DT_DLL_readerWriter std::shared_ptr< DtEnvironment > DtEnvironmentSP
Definition: readerWriter.h:30
virtual bool isSimilarProperty(const DtPropertyInterface *rhs, bool strict=true) const
Returns true if the readerWriterType is the same. Subclasses can do extra checking. If strict is true, some property types will do extra checking and fail if the types do not exactly match. If false, these types will do a basic check, which can be useful when the the types are similar enough to perform a merge.
boost::optional< ValueType > findFieldValue(const DtString &fieldName) const
This is a convenience function that combines the functionality of findField and propertyValue to imme...
Definition: rwPropertiesStructure.h:82
virtual bool addProperty(DtPropertyInterface *) override
Adds an existing property to this list. This class will then take ownership of the property...
virtual const DtPropertyInterface * findPropertyInterface(const DtString &propertyName) const override
virtual DtlObjPtr getData(DtlObjPtr args, const DtReaderWriter::SearchPaths &searchPaths=SearchPaths(), const DtVariableBindingsList &variableBindings=nullVariableReference()) override
Override to allow a variable to be assigned to a property of derived type.
SpecificPropType * findField(const DtString &fieldName)
Definition: rwPropertiesStructure.h:66

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)