#include <IddFile.hpp>
Public Member Functions | |
Getters | |
std::string | version () const |
Returns the file version (as specified in the header). More... | |
std::string | build () const |
Returns the file build (as specified in the header). More... | |
std::string | header () const |
Returns the file header. More... | |
std::vector< IddObject > | objects () const |
Returns all the objects in the file. More... | |
std::vector< std::string > | groups () const |
Returns all groups in the file (e.g. More... | |
std::vector< IddObject > | getObjectsInGroup (const std::string &group) const |
Returns all objects in group (e.g. More... | |
std::vector< IddObject > | getObjects (const boost::regex &objectRegex) const |
Returns the objects whose names match objectRegex. More... | |
boost::optional< IddObject > | versionObject () const |
Returns the version IddObject for this file, if possible. More... | |
boost::optional< IddObject > | getObject (const std::string &objectName) const |
Returns the object named objectName (case-insensitive). More... | |
boost::optional< IddObject > | getObject (IddObjectType objectType) const |
Returns the object of type objectType, if possible. More... | |
std::vector< IddObject > | requiredObjects () const |
Returns all objects in the file that are required. More... | |
std::vector< IddObject > | uniqueObjects () const |
Returns all objects in the file that are marked as unique. More... | |
Protected Member Functions | |
void | addObject (const IddObject &object) |
add an object More... | |
void | setBuild (const std::string &build) |
set build More... | |
void | setHeader (const std::string &header) |
set header More... | |
void | setVersion (const std::string &version) |
set version More... | |
Related Functions | |
(Note that these are not member functions.) | |
typedef std::vector< IddFile > | IddFileVector |
std::ostream & | operator<< (std::ostream &os, const IddFile &iddFile) |
typedef boost::optional< IddFile > | OptionalIddFile |
Constructors | |
IddFile () | |
Default constructor returns an IddFile with no version, no header, and no objects. More... | |
IddFile (const IddFile &other) | |
Copy constructor returns an IddFile that shares its data with other. More... | |
static IddFile | catchallIddFile () |
Returns an IddFile containing a single, default constructed IddObject of Catchall type. More... | |
Serialization | |
std::ostream & | print (std::ostream &os) const |
Prints this file to std::ostream os. More... | |
bool | save (const openstudio::path &p, bool overwrite=false) |
Saves file to path p. More... | |
static boost::optional< IddFile > | load (std::istream &is) |
Load an IddFile from std::istream, if possible. More... | |
static boost::optional< IddFile > | load (const openstudio::path &p) |
Load an IddFile from path p, if possible. More... | |
static std::pair < VersionString, std::string > | parseVersionBuild (const openstudio::path &p) |
Returns the version and build SHA from the given Idd. More... | |
IddFile provides parsing and printing of text files in Input Data Definition (IDD) format.
IDD is a schema definition format defined by the EnergyPlus team, adopted with slight modifications for the OpenStudio project. IddFile is a shared object.
openstudio::IddFile::IddFile | ( | ) |
Default constructor returns an IddFile with no version, no header, and no objects.
openstudio::IddFile::IddFile | ( | const IddFile & | other | ) |
Copy constructor returns an IddFile that shares its data with other.
|
protected |
add an object
std::string openstudio::IddFile::build | ( | ) | const |
Returns the file build (as specified in the header).
|
static |
boost::optional<IddObject> openstudio::IddFile::getObject | ( | const std::string & | objectName | ) | const |
Returns the object named objectName (case-insensitive).
Return value will evaluate to false if there is no such object in the IddFile.
boost::optional<IddObject> openstudio::IddFile::getObject | ( | IddObjectType | objectType | ) | const |
Returns the object of type objectType, if possible.
Return value will evaluate to false if there is no such object in the IddFile, or if IddObjectType == IddObjectType::UserCustom.
std::vector<IddObject> openstudio::IddFile::getObjects | ( | const boost::regex & | objectRegex | ) | const |
Returns the objects whose names match objectRegex.
std::vector<IddObject> openstudio::IddFile::getObjectsInGroup | ( | const std::string & | group | ) | const |
Returns all objects in group (e.g.
"Simulation Parameters").
std::vector<std::string> openstudio::IddFile::groups | ( | ) | const |
Returns all groups in the file (e.g.
"" and "Simulation Parameters").
std::string openstudio::IddFile::header | ( | ) | const |
Returns the file header.
|
static |
Load an IddFile from std::istream, if possible.
|
static |
Load an IddFile from path p, if possible.
std::vector<IddObject> openstudio::IddFile::objects | ( | ) | const |
Returns all the objects in the file.
|
static |
Returns the version and build SHA from the given Idd.
If build SHA is not present .second will be empty.
an | exception with a meaningful error message if something goes wrong |
std::ostream& openstudio::IddFile::print | ( | std::ostream & | os | ) | const |
Prints this file to std::ostream os.
std::vector<IddObject> openstudio::IddFile::requiredObjects | ( | ) | const |
Returns all objects in the file that are required.
An IdfFile or Workspace conforming to this IddFile must contain at least one object of each of these types to be valid at StrictnessLevel::Final.
bool openstudio::IddFile::save | ( | const openstudio::path & | p, |
bool | overwrite = false |
||
) |
Saves file to path p.
Will construct the parent folder if necessary and if its parent folder already exists. Will only overwrite an existing file if overwrite==true. If no extension is provided will use 'idd'.
|
protected |
set build
|
protected |
set header
|
protected |
set version
std::vector<IddObject> openstudio::IddFile::uniqueObjects | ( | ) | const |
Returns all objects in the file that are marked as unique.
An IdfFile or Workspace conforming to this IddFile must contain at most one object of each of these types to be valid at StrictnessLevel::Final.
std::string openstudio::IddFile::version | ( | ) | const |
Returns the file version (as specified in the header).
boost::optional<IddObject> openstudio::IddFile::versionObject | ( | ) | const |
Returns the version IddObject for this file, if possible.
|
related |
|
related |
|
related |