ns/dev/performance-3.0.5/source/textrep/TRFactory.h
2005-06-29 13:51:58 +00:00

48 lines
No EOL
2.1 KiB
C++

//======== (C) Copyright 2002 Charles G. Cleveland All rights reserved. =========
//
// The copyright to the contents herein is the property of Charles G. Cleveland.
// The contents may be used and/or copied only with the written permission of
// Charles G. Cleveland, or in accordance with the terms and conditions stipulated in
// the agreement/contract under which the contents have been supplied.
//
// Purpose:
//
// $Workfile: TRFactory.h $
// $Date: 2002/08/16 02:28:25 $
//
//-------------------------------------------------------------------------------
// $Log: TRFactory.h,v $
// Revision 1.5 2002/08/16 02:28:25 Flayra
// - Added document headers
//
//===============================================================================
#ifndef TRFACTORY_H
#define TRFACTORY_H
#include <strstream>
#include "textrep/TRDescription.h"
#include "string.h"
// Build a list of text description from a file. The filename is relative to the mod's base directory.
// This exists outside of TRDescription because it is conceptually different, but is closely coupled with it.
class TRFactory
{
public:
// Read all the descriptions from the file
static bool ReadDescriptions(strstream& trstream, TRDescriptionList& outDescriptionList);
static bool WriteDescriptions(const string& inRelativePathFilename, const TRDescriptionList& inDescriptionList, const string& inHeader);
private:
static bool ReadDescription(strstream& infile, TRDescription& outDescription);
static bool WriteDescription(fstream& outfile, const TRDescription& inDescription);
static bool charIsWhiteSpace(char inChar);
static void trimWhitespace(string& inString);
static bool lineIsAComment(const string& inString);
static bool readAndTrimNextLine(istream& inStream, string& outLine);
static bool readStartBlockLine(const string& inString, TRDescription& outDescription);
static bool readEndBlockLine(const string& inString);
static bool readTagAndValueLine(const string& inString, TRDescription& outDescription);
};
#endif