OpenStudio:utilities
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
List of all members
openstudio::BCLXML Class Reference

#include <BCLXML.hpp>

Public Member Functions

Destructor
virtual ~BCLXML ()
 Virtual destructor. More...
 
Getters
openstudio::path path () const
 Returns path to XML file. More...
 
openstudio::path directory () const
 Returns parent path of XML file. More...
 
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. More...
 
std::vector< Attributeattributes () const
 
std::vector< AttributegetAttributes (const std::string &name) const
 get attributes by name More...
 
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 More...
 
bool hasFile (const openstudio::path &path) const
 check if has file reference by full path, returns true if file was found More...
 
bool removeFile (const openstudio::path &path)
 remove file reference by full path, returns true if file was found and removed More...
 
void clearFiles ()
 clear all files More...
 
void addAttribute (const Attribute &attribute)
 adds attribute to attribute list More...
 
bool removeAttributes (const std::string &name)
 removes all attributes with name, returns true if attributes were found and removed More...
 
void clearAttributes ()
 removes all attributes More...
 
void addTag (const std::string &tagName)
 adds a tag, existing tag with same name will be removed More...
 
bool removeTag (const std::string &tagName)
 removes tag by name, returns true if tag was found and removed More...
 
void clearTags ()
 removes all tags More...
 
Operators
bool save () const
 Save the XML back to the original path, always increments version id. More...
 
bool saveAs (const openstudio::path &xmlPath)
 Save the XML to a new path, always increments version id. More...
 
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. More...
 

Constructors

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

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