MCPcopy Create free account
hub / github.com/OpenArkStudio/ARK / FromString

Method FromString

src/base/AFGUID128.hpp:106–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104 }
105
106 bool FromString(const std::string& strID)
107 {
108 size_t nStrLength = strID.length();
109 size_t nPos = strID.find('-');
110
111 if (nPos == std::string::npos)
112 {
113 return false;
114 }
115
116 std::string strHigh = strID.substr(0, nPos);
117 std::string strLow = "";
118
119 if ((nPos + 1) < nStrLength)
120 {
121 strLow = strID.substr(nPos + 1, nStrLength - nPos);
122 }
123
124 try
125 {
126 nHigh = ARK_LEXICAL_CAST<uint64_t>(strHigh);
127 nLow = ARK_LEXICAL_CAST<uint64_t>(strLow);
128
129 return true;
130 }
131 catch (std::system_error& ex)
132 {
133 CONSOLE_LOG_NO_FILE << "AFGUID from string failed, code = " << ex.code().message() << " msg = " << ex.what()
134 << std::endl;
135 ARK_ASSERT_NO_EFFECT(0);
136 return false;
137 }
138 }
139};
140
141} // namespace ark

Callers

nothing calls this directly

Calls 5

lengthMethod · 0.80
messageMethod · 0.80
findMethod · 0.45
substrMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected