VR-Forces 4.0.4 Class Documentation
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
DtReaderWriterFile Class Reference

Using a DtReaderWriterFile allows a DtReaderWriter object to be read in from an MTL stream contained in an external file. More...

Inheritance diagram for DtReaderWriterFile:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtReaderWriterFile ()
 default constructor
 DtReaderWriterFile (const DtString &name, DtReaderWriterRegistry *parentRegistry=NULL)
 real constructor
 DtReaderWriterFile (const DtSymbolString &name, DtReaderWriterRegistry *parentRegistry=NULL)
 DtReaderWriterFile (const DtString &name, const DtReaderWriterFile &orig, DtReaderWriterRegistry *parentRegistry=NULL)
 copy constructor
 DtReaderWriterFile (const DtSymbolString &name, const DtReaderWriterFile &orig, DtReaderWriterRegistry *parentRegistry=NULL)
DtReaderWriterFileoperator= (const DtReaderWriterFile &orig)
 assignment operator
DtReaderWriterFileoperator= (const DtFilename &orig)
virtual ~DtReaderWriterFile ()
 destructor
DtReaderWriterFileclone (const DtString &name, DtReaderWriterRegistry *parentRegistry=NULL)
 clone
DtReaderWriterFileclone (const DtSymbolString &name, DtReaderWriterRegistry *parentRegistry=NULL)
virtual void getSelf (DtlObjPtr args, const DtFilename &searchPath, const DtVariableBindingsList &variableBindings)
 Top level to read itself from an input stream.
virtual void saveFile (const DtFilename &filename)
 Saves contents of file to specified filename.
virtual void loadFile (const DtFilename &searchPath, const DtVariableBindingsList &variableBindings, DtlObjStringMap *commentMap=NULL)
virtual void putSelf (FILE *fp, int indentLevel, bool writeUnspecified, const DtFilename &path)
 Top level call to write itself to file.
virtual void setObjectToReadAndWrite (DtReaderWriter *object)
 Sets the DtReaderWriter to be read from and written to the file.
virtual const DtReaderWriterobjectToReadAndWrite () const
 Returns the DtReaderWriter to be read from and written to the file.
virtual void setFilename (const DtString &filename)
 Name of the file to to write.
virtual void setFilename (const DtString &filename, const DtString &unsubstitutedFilename)
 Sets the filename in the same way as setFilename(const DtString& filename), but additionally sets the unsubstituted filename to the specified string.
virtual const DtStringfilename () const
 If variables are specified in the filename, they will be substituted with their values before being returned by this method.
virtual DtString unsubstitutedFilename () const
virtual void setUnsubstitudedFilename (const DtString &f)
 Sets the unsubsituted filename in the myFileame object.
virtual const DtFilename & filenameLastReadIn () const
 Name of file most recently read in by getSelf()
virtual void setFileReadOnly (bool readOnly=true)
 By default, DtReaderWriterFile reads a file that has been specified, but when it writes itself, it only writes the filename.
virtual bool fileReadOnly () const
virtual const char * readerWriterType () const
 Used to supply a string type that this reader writer type is.
virtual void substitute (const DtVariableBindingsList &variableBindings)
 Substitutes any variables in the list to variable substituted filename.

Static Public Member Functions

static const DtFilename & appPath ()
 Gets the current working directory. Calls DtReaderWriter::appPath().

Protected Member Functions

bool getFilenameToWrite (const DtFilename &path, const DtFilename &filename, DtFilename &filenameToWrite) const
 Get the filename to write, given a path and base filename.

Protected Attributes

DtRwString myFilename
DtReaderWritermyObjectToReadAndWrite
bool myFileReadOnly
DtFilename myFilenameLastReadIn
DtString myVariableSubstitutedFilename

Detailed Description

Using a DtReaderWriterFile allows a DtReaderWriter object to be read in from an MTL stream contained in an external file.

For instance, the signature object sensor uses a DtReaderWriterFile for its "combat-identification-level-table-file" parameter. Once the file is created, setObjectToReadAndWrite must be called before use.


Constructor & Destructor Documentation

default constructor

DtReaderWriterFile::DtReaderWriterFile ( const DtString name,
DtReaderWriterRegistry parentRegistry = NULL 
)

real constructor

DtReaderWriterFile::DtReaderWriterFile ( const DtSymbolString name,
DtReaderWriterRegistry parentRegistry = NULL 
)
DtReaderWriterFile::DtReaderWriterFile ( const DtString name,
const DtReaderWriterFile orig,
DtReaderWriterRegistry parentRegistry = NULL 
)

copy constructor

DtReaderWriterFile::DtReaderWriterFile ( const DtSymbolString name,
const DtReaderWriterFile orig,
DtReaderWriterRegistry parentRegistry = NULL 
)

destructor


Member Function Documentation

DtReaderWriterFile& DtReaderWriterFile::operator= ( const DtReaderWriterFile orig)

assignment operator

Reimplemented in DtReaderWriterFileExtensible.

DtReaderWriterFile& DtReaderWriterFile::operator= ( const DtFilename &  orig)

Reimplemented in DtReaderWriterFileExtensible.

DtReaderWriterFile* DtReaderWriterFile::clone ( const DtString name,
DtReaderWriterRegistry parentRegistry = NULL 
)

clone

DtReaderWriterFile* DtReaderWriterFile::clone ( const DtSymbolString name,
DtReaderWriterRegistry parentRegistry = NULL 
)
virtual void DtReaderWriterFile::getSelf ( DtlObjPtr  args,
const DtFilename &  searchPath,
const DtVariableBindingsList variableBindings 
) [virtual]

Top level to read itself from an input stream.

searchPath is the name of the directory in which to locate it's filename to load.

virtual void DtReaderWriterFile::saveFile ( const DtFilename &  filename) [virtual]

Saves contents of file to specified filename.

virtual void DtReaderWriterFile::loadFile ( const DtFilename &  searchPath,
const DtVariableBindingsList variableBindings,
DtlObjStringMap commentMap = NULL 
) [virtual]

Reimplemented in DtReaderWriterFileExtensible.

virtual void DtReaderWriterFile::putSelf ( FILE *  fp,
int  indentLevel,
bool  writeUnspecified,
const DtFilename &  path 
) [virtual]

Top level call to write itself to file.

The path prepended to the filename before writing the entry to file.

Reimplemented from DtReaderWriter.

virtual void DtReaderWriterFile::setObjectToReadAndWrite ( DtReaderWriter object) [virtual]

Sets the DtReaderWriter to be read from and written to the file.

virtual const DtReaderWriter& DtReaderWriterFile::objectToReadAndWrite ( ) const [virtual]

Returns the DtReaderWriter to be read from and written to the file.

static const DtFilename& DtReaderWriterFile::appPath ( ) [static]

Gets the current working directory. Calls DtReaderWriter::appPath().

Reimplemented from DtReaderWriter.

virtual void DtReaderWriterFile::setFilename ( const DtString filename) [virtual]

Name of the file to to write.

If path is absolute, this is the filename that will be written in putSelf(). If filename is relative, it will be combined with the path passed into putSelf(). If variables are specified in the filename, they will be substituted with their values before being returned by this method. This sets both the full filename and the unsubstituted filename to this string, essentially removing any variables.

virtual void DtReaderWriterFile::setFilename ( const DtString filename,
const DtString unsubstitutedFilename 
) [virtual]

Sets the filename in the same way as setFilename(const DtString& filename), but additionally sets the unsubstituted filename to the specified string.

Note:
Use this method with caution. You must set the filename and unsubstituted filename to equivalent values if they are to be read in correctly.
virtual const DtString& DtReaderWriterFile::filename ( ) const [virtual]

If variables are specified in the filename, they will be substituted with their values before being returned by this method.

Use unsubstitutedFilename() to get the string with variables still in it.

Returns:
The filename of the file without any variable substitutions.
virtual void DtReaderWriterFile::setUnsubstitudedFilename ( const DtString f) [virtual]

Sets the unsubsituted filename in the myFileame object.

virtual const DtFilename& DtReaderWriterFile::filenameLastReadIn ( ) const [virtual]

Name of file most recently read in by getSelf()

virtual void DtReaderWriterFile::setFileReadOnly ( bool  readOnly = true) [virtual]

By default, DtReaderWriterFile reads a file that has been specified, but when it writes itself, it only writes the filename.

If you want it to write not only the filename but also write the 'objectToReadAndWrite', call setFileReadOnly(false).

virtual bool DtReaderWriterFile::fileReadOnly ( ) const [virtual]
virtual const char* DtReaderWriterFile::readerWriterType ( ) const [virtual]

Used to supply a string type that this reader writer type is.

This can be used in place of dynamic-casting. Also used by the opd editor to determine which type of control to create

Reimplemented from DtReaderWriter.

virtual void DtReaderWriterFile::substitute ( const DtVariableBindingsList variableBindings) [virtual]

Substitutes any variables in the list to variable substituted filename.

Reimplemented in DtReaderWriterFileExtensible.

bool DtReaderWriterFile::getFilenameToWrite ( const DtFilename &  path,
const DtFilename &  filename,
DtFilename &  filenameToWrite 
) const [protected]

Get the filename to write, given a path and base filename.

If filename is absolute, sets filenameToWrite to filename and returns true. If filename is relative, combines the path with the filename, creating the directory if necessary.


Member Data Documentation


The documentation for this class was generated from the following file:

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)