OpenStudio:utilities
Loading...
Searching...
No Matches
openstudio::BCLXML Class Reference

#include <BCLXML.hpp>

Public Member Functions

Destructor
virtual ~BCLXML ()=default
 Virtual destructor.
 
Getters
openstudio::path path () const
 Returns path to XML file.
 
openstudio::path directory () const
 Returns parent path of XML file.
 
boost::optional< std::string > error () const
 
std::string uid () const
 
std::string versionId () const
 
boost::optional< DateTimeversionModified () const
 
std::string xmlChecksum () const
 
std::string name () const
 
std::string displayName () const
 
std::string className () const
 
std::string description () const
 
std::string modelerDescription () const
 
std::vector< BCLMeasureArgumentarguments () const
 
std::vector< BCLMeasureOutputoutputs () const
 
std::vector< BCLFileReferencefiles () const
 
std::vector< BCLFileReferencefiles (const std::string &filetype) const
 Returns references to all files of given type.
 
std::vector< Attributeattributes () const
 
std::vector< AttributegetAttributes (const std::string &name) const
 get attributes by name
 
std::vector< std::string > tags () const
 
Setters
void resetXMLChecksum ()
 
void setError (const std::string &error)
 
void resetError ()
 
void setName (const std::string &name)
 
void setDisplayName (const std::string &displayName)
 
void setClassName (const std::string &className)
 
void setDescription (const std::string &description)
 
void setModelerDescription (const std::string &modelerDescription)
 
void setArguments (const std::vector< BCLMeasureArgument > &arguments)
 
void setOutputs (const std::vector< BCLMeasureOutput > &outputs)
 
void addFile (const BCLFileReference &file)
 adds file to list, file with same full path will be removed
 
bool hasFile (const openstudio::path &path) const
 check if has file reference by full path, returns true if file was found
 
bool removeFile (const openstudio::path &path)
 remove file reference by full path, returns true if file was found and removed
 
void clearFiles ()
 clear all files
 
void addAttribute (const Attribute &attribute)
 adds attribute to attribute list
 
bool removeAttributes (const std::string &name)
 removes all attributes with name, returns true if attributes were found and removed
 
void clearAttributes ()
 removes all attributes
 
void addTag (const std::string &tagName)
 adds a tag, existing tag with same name will be removed
 
bool removeTag (const std::string &tagName)
 removes tag by name, returns true if tag was found and removed
 
void clearTags ()
 removes all tags
 

Operators

bool save () const
 Save the XML back to the original path, always increments version id.
 
bool saveAs (const openstudio::path &xmlPath)
 Save the XML to a new path, always increments version id.
 
std::string toString () const
 Returns a string representation of the XML.
 
void changeUID ()
 
void incrementVersionId ()
 
bool checkForUpdatesXML ()
 Check for updates to the xml, will increment versionID and xmlChecksum then return true if any xml fields (other than uid, version id, or xml checksum) have changed The xml file must still be saved to disk to preserve the new versionID.
 
Json::Value toJSON () const
 
std::string toJSONString () const
 

Constructors

 BCLXML (const BCLXMLType &bclXMLType)
 Constructor for a new XML.
 
 BCLXML (const openstudio::path &xmlPath)
 Constructor from file path, will throw exception if file does not exist or is incorrect.
 
static boost::optional< BCLXMLload (const openstudio::path &xmlPath)
 Try to load a BCLXML from disk.
 
static std::string escapeString (const std::string &txt)
 Escape a string to write to xml.
 
static std::string decodeString (const std::string &txt)
 Decode a string written in xml.
 
static VersionString currentSchemaVersion ()
 

Detailed Description

BCLXML is a class for accessing the common XML structures of BCLComponent and BCLMeasure.

Constructor & Destructor Documentation

◆ BCLXML() [1/2]

openstudio::BCLXML::BCLXML ( const BCLXMLType & bclXMLType)
explicit

Constructor for a new XML.

◆ BCLXML() [2/2]

openstudio::BCLXML::BCLXML ( const openstudio::path & xmlPath)
explicit

Constructor from file path, will throw exception if file does not exist or is incorrect.

◆ ~BCLXML()

virtual openstudio::BCLXML::~BCLXML ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ addAttribute()

void openstudio::BCLXML::addAttribute ( const Attribute & attribute)

adds attribute to attribute list

◆ addFile()

void openstudio::BCLXML::addFile ( const BCLFileReference & file)

adds file to list, file with same full path will be removed

◆ addTag()

void openstudio::BCLXML::addTag ( const std::string & tagName)

adds a tag, existing tag with same name will be removed

◆ arguments()

std::vector< BCLMeasureArgument > openstudio::BCLXML::arguments ( ) const

◆ attributes()

std::vector< Attribute > openstudio::BCLXML::attributes ( ) const

◆ changeUID()

void openstudio::BCLXML::changeUID ( )

◆ checkForUpdatesXML()

bool openstudio::BCLXML::checkForUpdatesXML ( )

Check for updates to the xml, will increment versionID and xmlChecksum then return true if any xml fields (other than uid, version id, or xml checksum) have changed The xml file must still be saved to disk to preserve the new versionID.

◆ className()

std::string openstudio::BCLXML::className ( ) const

◆ clearAttributes()

void openstudio::BCLXML::clearAttributes ( )

removes all attributes

◆ clearFiles()

void openstudio::BCLXML::clearFiles ( )

clear all files

◆ clearTags()

void openstudio::BCLXML::clearTags ( )

removes all tags

◆ currentSchemaVersion()

static VersionString openstudio::BCLXML::currentSchemaVersion ( )
static

◆ decodeString()

static std::string openstudio::BCLXML::decodeString ( const std::string & txt)
static

Decode a string written in xml.

◆ description()

std::string openstudio::BCLXML::description ( ) const

◆ directory()

openstudio::path openstudio::BCLXML::directory ( ) const

Returns parent path of XML file.

◆ displayName()

std::string openstudio::BCLXML::displayName ( ) const

◆ error()

boost::optional< std::string > openstudio::BCLXML::error ( ) const

◆ escapeString()

static std::string openstudio::BCLXML::escapeString ( const std::string & txt)
static

Escape a string to write to xml.

◆ files() [1/2]

std::vector< BCLFileReference > openstudio::BCLXML::files ( ) const

◆ files() [2/2]

std::vector< BCLFileReference > openstudio::BCLXML::files ( const std::string & filetype) const

Returns references to all files of given type.

◆ getAttributes()

std::vector< Attribute > openstudio::BCLXML::getAttributes ( const std::string & name) const

get attributes by name

◆ hasFile()

bool openstudio::BCLXML::hasFile ( const openstudio::path & path) const

check if has file reference by full path, returns true if file was found

◆ incrementVersionId()

void openstudio::BCLXML::incrementVersionId ( )

◆ load()

static boost::optional< BCLXML > openstudio::BCLXML::load ( const openstudio::path & xmlPath)
static

Try to load a BCLXML from disk.

◆ modelerDescription()

std::string openstudio::BCLXML::modelerDescription ( ) const

◆ name()

std::string openstudio::BCLXML::name ( ) const

◆ outputs()

std::vector< BCLMeasureOutput > openstudio::BCLXML::outputs ( ) const

◆ path()

openstudio::path openstudio::BCLXML::path ( ) const

Returns path to XML file.

◆ removeAttributes()

bool openstudio::BCLXML::removeAttributes ( const std::string & name)

removes all attributes with name, returns true if attributes were found and removed

◆ removeFile()

bool openstudio::BCLXML::removeFile ( const openstudio::path & path)

remove file reference by full path, returns true if file was found and removed

◆ removeTag()

bool openstudio::BCLXML::removeTag ( const std::string & tagName)

removes tag by name, returns true if tag was found and removed

◆ resetError()

void openstudio::BCLXML::resetError ( )

◆ resetXMLChecksum()

void openstudio::BCLXML::resetXMLChecksum ( )

◆ save()

bool openstudio::BCLXML::save ( ) const

Save the XML back to the original path, always increments version id.

TODO: does it? it wouldn't be const if it did

◆ saveAs()

bool openstudio::BCLXML::saveAs ( const openstudio::path & xmlPath)

Save the XML to a new path, always increments version id.

◆ setArguments()

void openstudio::BCLXML::setArguments ( const std::vector< BCLMeasureArgument > & arguments)

◆ setClassName()

void openstudio::BCLXML::setClassName ( const std::string & className)

◆ setDescription()

void openstudio::BCLXML::setDescription ( const std::string & description)

◆ setDisplayName()

void openstudio::BCLXML::setDisplayName ( const std::string & displayName)

◆ setError()

void openstudio::BCLXML::setError ( const std::string & error)

◆ setModelerDescription()

void openstudio::BCLXML::setModelerDescription ( const std::string & modelerDescription)

◆ setName()

void openstudio::BCLXML::setName ( const std::string & name)

◆ setOutputs()

void openstudio::BCLXML::setOutputs ( const std::vector< BCLMeasureOutput > & outputs)

◆ tags()

std::vector< std::string > openstudio::BCLXML::tags ( ) const

◆ toJSON()

Json::Value openstudio::BCLXML::toJSON ( ) const

◆ toJSONString()

std::string openstudio::BCLXML::toJSONString ( ) const

◆ toString()

std::string openstudio::BCLXML::toString ( ) const

Returns a string representation of the XML.

◆ uid()

std::string openstudio::BCLXML::uid ( ) const

◆ versionId()

std::string openstudio::BCLXML::versionId ( ) const

◆ versionModified()

boost::optional< DateTime > openstudio::BCLXML::versionModified ( ) const

◆ xmlChecksum()

std::string openstudio::BCLXML::xmlChecksum ( ) const