-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented Quoting and Correct Order for JARs
1. Use std::vector for collecting JARs in converter v2 2. Implemented StringOps::removeQuotesSafely() + tests 3. Use StringOps::removeQuotesSafely() for JARs
- Loading branch information
Showing
17 changed files
with
166 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
exaudfclient/base/javacontainer/script_options/string_ops.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,42 @@ | ||
#include "base/javacontainer/script_options/string_ops.h" | ||
#include <iostream> | ||
|
||
namespace SWIGVMContainers { | ||
|
||
namespace JavaScriptOptions { | ||
|
||
namespace StringOps { | ||
|
||
void removeQuotesSafely(std::string & s, const std::string & whitespaces) { | ||
const size_t startQuoteIdx = s.find_first_of("\"'"); | ||
const size_t endQuoteIdx = s.find_last_of("\"'"); | ||
|
||
if (startQuoteIdx != std::string::npos && endQuoteIdx != std::string::npos && startQuoteIdx < endQuoteIdx && | ||
s[startQuoteIdx] == s[endQuoteIdx]) { | ||
//Search backwards if there any none whitespace characters in front of quote. If yes, we ignore the quote. | ||
if (startQuoteIdx > 0) { | ||
const size_t startingNotWhitespace = s.find_last_not_of(whitespaces, startQuoteIdx-1); | ||
if (startingNotWhitespace != std::string::npos) { | ||
return; | ||
} | ||
} | ||
|
||
//Search forward if there any none whitespace characters after ending quote. If yes, we ignore the quote. | ||
if (endQuoteIdx < s.size() -1 ) { | ||
const size_t trailingNotWhitespace = s.find_first_not_of(whitespaces, endQuoteIdx+1); | ||
if (trailingNotWhitespace != std::string::npos) { | ||
return; | ||
} | ||
} | ||
s = s.substr(startQuoteIdx+1, endQuoteIdx-startQuoteIdx-1); | ||
std::cerr << "DEBUG0 :" << startQuoteIdx << "-" << endQuoteIdx << std::endl; | ||
std::cerr << "DEBUG1 :" << s << std::endl; | ||
} | ||
} | ||
|
||
} //namespace StringOps | ||
|
||
|
||
} //namespace JavaScriptOptions | ||
|
||
} //namespace SWIGVMContainers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.