| 34 | } |
| 35 | |
| 36 | std::string toUnderscoreCase(const std::string& s) { |
| 37 | // DLM: previous implementation |
| 38 | //std::string result = toLowerCamelCase(s); |
| 39 | //result = boost::regex_replace(result,boost::regex("(.)([A-Z])"),"$1_\\l$2"); |
| 40 | |
| 41 | std::string result = boost::replace_all_copy(s, "OpenStudio", "Openstudio"); |
| 42 | boost::replace_all(result, "EnergyPlus", "Energyplus"); |
| 43 | |
| 44 | //http://stackoverflow.com/questions/1509915/converting-camel-case-to-underscore-case-in-ruby |
| 45 | // DLM: there is a to_underscore method in the BCL gem, this should be synchronized |
| 46 | result = boost::regex_replace(result, boost::regex("[^a-zA-Z0-9]"), " "); |
| 47 | result = boost::regex_replace(result, boost::regex("([\\-]+)"), "_"); |
| 48 | result = boost::regex_replace(result, boost::regex("([\\s]+)"), "_"); |
| 49 | result = boost::regex_replace(result, boost::regex("([A-Za-z])([0-9])"), "$1_$2"); |
| 50 | result = boost::regex_replace(result, boost::regex("([0-9]+)([A-Za-z])"), "$1_$2"); |
| 51 | result = boost::regex_replace(result, boost::regex("([A-Z]+)([A-Z][a-z])"), "$1_$2"); |
| 52 | result = boost::regex_replace(result, boost::regex("([a-z])([A-Z])"), "$1_$2"); |
| 53 | result = boost::regex_replace(result, boost::regex("([A-Z])"), "\\l$1"); |
| 54 | return result; |
| 55 | } |
| 56 | |
| 57 | // ETH@20110614 Implementation copied from IddFileFactoryData.cpp for use in Ruby script. |
| 58 | std::string convertIddName(const std::string& s) { |
no outgoing calls