-
Notifications
You must be signed in to change notification settings - Fork 461
Open
Labels
NotIDDChangeCode does not impact IDD (can be merged after IO freeze)Code does not impact IDD (can be merged after IO freeze)RefactoringIncludes code changes that don't change the functionality of the program, just perform refactoringIncludes code changes that don't change the functionality of the program, just perform refactoring
Description
SameString, currently a pass-through to ObjexxFCL::equali performs a case-insensitive string comparison. There are currently 2400 calls to SameString in EnergyPlus. A quick scan of these calls shows that there are three primary idioms:
- Use of
SameStringin anif-thenladder to essentially convert a string to an enumeration (overlaps with issue #9181). This idiom should be converted to usegetEnumerationValuewhose arguments are astd::arrayof upper-casedstring_viewscorresponding to the names of the enumeration values and an upper-cased (viaMakeUpperCase) version of the search string. (Search the code forgetEnumerationValueto see some examples). In this implementation, the search string is upper-cased only once rather than once per comparison and the list of valid strings is not explicitly upper-cased at all. - Use of
SameStringinstead of an existing enumeration in simulation logic. These should be converted toswitch-caseidioms using enumerations. - Use of
SameStringto match object names. A good general rule is that every string in a program should be upper-cased at most once. This means that lists of objects names that are to be searched should be stored in upper-case and searches should be case-sensitive, i.e., using==.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
NotIDDChangeCode does not impact IDD (can be merged after IO freeze)Code does not impact IDD (can be merged after IO freeze)RefactoringIncludes code changes that don't change the functionality of the program, just perform refactoringIncludes code changes that don't change the functionality of the program, just perform refactoring