Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parseTypeName method to CommandParser #321

Merged

Conversation

m-meingast
Copy link
Member

Use parseTypeName to parse the CreateFB request instead of parseIdentifier

return -1;
}
std::string result = paTypeName.substr(0, endIndex);
if(!paIdentifier.pushBack(CStringDictionary::getInstance().insert(result.c_str()))){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest using

TStringId insert(const char *paStr, size_t paStrSize);
, so you can avoid having to create an intermediary string.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also useful with the string_views, to set the correct string length

@@ -338,6 +338,18 @@ int CommandParser::parseIdentifier(char *paIdentifierStart, forte::core::TNameId
return -1;
}

int CommandParser::parseTypeName(std::string paTypeName, forte::core::TNameIdentifier &paIdentifier){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that this will allocate and copy the entire buffer until the end each time this is called. Maybe you could use a std::string_view instead?

Copy link
Member Author

@m-meingast m-meingast Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that makes sense. I replaced the strings with string_view objects. Thanks for pointing that out.

@m-meingast m-meingast force-pushed the #2287-configuredStructs_parser branch from 745f3f6 to bce68f3 Compare February 20, 2025 14:41
@m-meingast m-meingast requested a review from azoitl February 20, 2025 15:24
@azoitl azoitl merged commit e8b3291 into eclipse-4diac:develop Feb 20, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants