MCPcopy Create free account
hub / github.com/Kitware/VTK / PROJStringSyntaxParser

Function PROJStringSyntaxParser

ThirdParty/libproj/vtklibproj/src/iso19111/io.cpp:8002–8166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8000// ---------------------------------------------------------------------------
8001
8002static void
8003PROJStringSyntaxParser(const std::string &projString, std::vector<Step> &steps,
8004 std::vector<Step::KeyValue> &globalParamValues,
8005 std::string &title) {
8006 const char *c_str = projString.c_str();
8007 std::vector<std::string> tokens;
8008
8009 bool hasProj = false;
8010 bool hasInit = false;
8011 bool hasPipeline = false;
8012 {
8013 size_t i = 0;
8014 while (true) {
8015 for (; isspace(static_cast<unsigned char>(c_str[i])); i++) {
8016 }
8017 std::string token;
8018 bool in_string = false;
8019 for (; c_str[i]; i++) {
8020 if (in_string) {
8021 if (c_str[i] == '"' && c_str[i + 1] == '"') {
8022 i++;
8023 } else if (c_str[i] == '"') {
8024 in_string = false;
8025 continue;
8026 }
8027 } else if (c_str[i] == '=' && c_str[i + 1] == '"') {
8028 in_string = true;
8029 token += c_str[i];
8030 i++;
8031 continue;
8032 } else if (isspace(static_cast<unsigned char>(c_str[i]))) {
8033 break;
8034 }
8035 token += c_str[i];
8036 }
8037 if (in_string) {
8038 throw ParsingException("Unbalanced double quote");
8039 }
8040 if (token.empty()) {
8041 break;
8042 }
8043 if (!hasPipeline &&
8044 (token == "proj=pipeline" || token == "+proj=pipeline")) {
8045 hasPipeline = true;
8046 } else if (!hasProj && (starts_with(token, "proj=") ||
8047 starts_with(token, "+proj="))) {
8048 hasProj = true;
8049 } else if (!hasInit && (starts_with(token, "init=") ||
8050 starts_with(token, "+init="))) {
8051 hasInit = true;
8052 }
8053 tokens.emplace_back(token);
8054 }
8055 }
8056
8057 bool prevWasTitle = false;
8058
8059 if (!hasPipeline) {

Callers 2

ingestPROJStringMethod · 0.85
createFromPROJStringMethod · 0.85

Calls 14

KeyValueClass · 0.85
backMethod · 0.80
StepClass · 0.70
ParsingExceptionClass · 0.50
starts_withFunction · 0.50
assertFunction · 0.50
reverseFunction · 0.50
c_strMethod · 0.45
emptyMethod · 0.45
emplace_backMethod · 0.45
push_backMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected