mirror of
https://github.com/unknownworlds/NS.git
synced 2024-11-30 00:10:59 +00:00
f3b0864612
git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@226 67975925-1194-0748-b3d5-c16f83f1a3a1
49 lines
2.2 KiB
C++
49 lines
2.2 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 ReadDescriptionsFromStream(strstream& trstream, TRDescriptionList& outDescriptionList);
|
|
static bool ReadDescriptionsFromFile(const string& inRelativePathFilename, TRDescriptionList& outDescriptionList);
|
|
static bool WriteDescriptions(const string& inRelativePathFilename, const TRDescriptionList& inDescriptionList, const string& inHeader);
|
|
|
|
private:
|
|
static bool ReadDescription(istream& 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
|