-
Notifications
You must be signed in to change notification settings - Fork 95
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 split/join for separating the link name from it's fully qualified name #457
Conversation
d07a06b
to
b62f7af
Compare
cc42b34
to
dc2fb5b
Compare
src/Types.cc
Outdated
return false; | ||
|
||
const size_t findStartPosition = _s.size() - kSdfScopeDelimiter.size(); | ||
return _s.substr(findStartPosition) == kSdfScopeDelimiter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should actually just use std::string::compare(). Same in line 123
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -228,6 +231,14 @@ namespace sdf | |||
/// \param[in] _in String to convert to lowercase | |||
/// \return Lowercase equilvalent of _in. | |||
std::string SDFORMAT_VISIBLE lowercase(const std::string &_in); | |||
|
|||
SDFORMAT_VISIBLE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add docs here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
src/Types.cc
Outdated
return false; | ||
|
||
const size_t findStartPosition = _s.size() - kSdfScopeDelimiter.size(); | ||
return _s.substr(findStartPosition) == kSdfScopeDelimiter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Probably more efficient to do _s.find(kSdfScopeDelimiter, findStartPosition) == findStartPosition
as it avoids constructing a new string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally, switched to std::string::compare
Codecov Report
@@ Coverage Diff @@
## master #457 +/- ##
==========================================
+ Coverage 88.10% 88.14% +0.03%
==========================================
Files 66 66
Lines 9940 9969 +29
==========================================
+ Hits 8758 8787 +29
Misses 1182 1182
Continue to review full report at Codecov.
|
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
Signed-off-by: Stephen Brawner <brawner@gmail.com>
Signed-off-by: Stephen Brawner <brawner@gmail.com>
15dd27b
to
023f9a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great! just one nit that I'll fix right now
src/Types.cc
Outdated
return _s.compare(0, kSdfScopeDelimiter.size(), kSdfScopeDelimiter) == 0; | ||
} | ||
|
||
// Join an scope name prefix with a local name using the scope delimeter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: an
-> a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Thanks Steve for fixing the nit! |
This PR adds small functionality for splitting and joining a name based on the '::' separator. It's necessary for gazebosim/gz-sim#542