uox3/source/scriptc.h
Charles Kerr 76aa0e3abf
Develop (#92)
* updated STARTLOCATIONDATA to use std::string, removed typedef

* removed __STARTLOCATIONDATA_ from typedef

* cleanup

* Update Prerequisites.h

* cleanup, no functional code change

* Update cdice.h

* Pull2 (#89) (#1)

* updated STARTLOCATIONDATA to use std::string, removed typedef

* removed __STARTLOCATIONDATA_ from typedef

* cleanup

* Update Prerequisites.h

* cleanup, no functional code change

* Update cdice.h

* Modernized iterator usage for Network connection iteration.  Should result in a speed increase (measurable or not)

* exposed data
2022-06-07 14:22:26 -04:00

47 lines
1.1 KiB
C++

#ifndef __SCRIPTC_H__
#define __SCRIPTC_H__
#include <unordered_map>
typedef std::unordered_map< std::string, ScriptSection * > SSMAP;
class Script
{
public:
UI32 lastModTime;
Script( const std::string& _filename, DEFINITIONCATEGORIES d, bool disp = true );
~Script();
ScriptSection * FindEntry( const std::string& section );
ScriptSection * FindEntrySubStr( const std::string& section );
ScriptSection * FirstEntry( void );
ScriptSection * NextEntry( void );
auto collection() const -> const SSMAP & ;
auto collection() -> SSMAP& ;
bool isin( const std::string& section );
std::string EntryName( void );
size_t NumEntries( void ) const
{
return defEntries.size();
}
bool IsErrored( void ) const
{
return errorState;
}
private:
void deleteMap( void );
void reload( bool disp = true );
bool createSection( std::string& name );
SSMAP defEntries; // string is the name of section
SSMAP::iterator iSearch;
time_t last_modification;
std::string filename;
bool errorState;
DEFINITIONCATEGORIES dfnCat;
std::fstream input;
};
#endif