OpenStudio:utilities
 AllClasses Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages

#include "BCLXML.hpp"

Public Member Functions

virtual ~BCLXML ()
openstudio::path path () const
openstudio::path directory () const
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
std::vector< Attributeattributes () const
std::vector< AttributegetAttributes (const std::string &name) const
std::vector< std::string > tags () const
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)
bool hasFile (const openstudio::path &path) const
bool removeFile (const openstudio::path &path)
void clearFiles ()
void addAttribute (const Attribute &attribute)
bool removeAttributes (const std::string &name)
void clearAttributes ()
void addTag (const std::string &tagName)
bool removeTag (const std::string &tagName)
void clearTags ()
bool save () const
bool saveAs (const openstudio::path &xmlPath)
void changeUID ()
void incrementVersionId ()
bool checkForUpdatesXML ()

Constructors

 BCLXML (const BCLXMLType &bclXMLType)
 BCLXML (const openstudio::path &xmlPath)
static boost::optional< BCLXMLload (const openstudio::path &xmlPath)
static std::string escapeString (const std::string &txt)
static std::string decodeString (const std::string &txt)

Detailed Description

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

Constructor & Destructor Documentation

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

Constructor for a new XML.

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

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

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

Virtual destructor.

Member Function Documentation

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

adds attribute to attribute list

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

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

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

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

std::vector<BCLMeasureArgument> openstudio::BCLXML::arguments ( ) const
std::vector<Attribute> openstudio::BCLXML::attributes ( ) const
void openstudio::BCLXML::changeUID ( )
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.

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

removes all attributes

void openstudio::BCLXML::clearFiles ( )

clear all files

void openstudio::BCLXML::clearTags ( )

removes all tags

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

Decode a string written in xml.

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

Returns parent path of XML file.

std::string openstudio::BCLXML::displayName ( ) const
boost::optional<std::string> openstudio::BCLXML::error ( ) const
static std::string openstudio::BCLXML::escapeString ( const std::string &  txt)
static

Escape a string to write to xml.

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

Returns references to all files of given type.

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

get attributes by name

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

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

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

Try to load a BCLXML from disk.

std::string openstudio::BCLXML::modelerDescription ( ) const
std::string openstudio::BCLXML::name ( ) const
std::vector<BCLMeasureOutput> openstudio::BCLXML::outputs ( ) const
openstudio::path openstudio::BCLXML::path ( ) const

Returns path to XML file.

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

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

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

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

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

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

void openstudio::BCLXML::resetError ( )
void openstudio::BCLXML::resetXMLChecksum ( )
bool openstudio::BCLXML::save ( ) const

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

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

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

void openstudio::BCLXML::setArguments ( const std::vector< BCLMeasureArgument > &  arguments)
void openstudio::BCLXML::setClassName ( const std::string &  className)
void openstudio::BCLXML::setDescription ( const std::string &  description)
void openstudio::BCLXML::setDisplayName ( const std::string &  displayName)
void openstudio::BCLXML::setError ( const std::string &  error)
void openstudio::BCLXML::setModelerDescription ( const std::string &  modelerDescription)
void openstudio::BCLXML::setName ( const std::string &  name)
void openstudio::BCLXML::setOutputs ( const std::vector< BCLMeasureOutput > &  outputs)
std::vector<std::string> openstudio::BCLXML::tags ( ) const
std::string openstudio::BCLXML::uid ( ) const
std::string openstudio::BCLXML::versionId ( ) const
boost::optional<DateTime> openstudio::BCLXML::versionModified ( ) const
std::string openstudio::BCLXML::xmlChecksum ( ) const