MCPcopy Create free account
hub / github.com/catboost/catboost / GetNamespace

Function GetNamespace

contrib/libs/flatbuffers/src/idl_parser.cpp:319–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317}
318
319static Namespace *GetNamespace(
320 const std::string &qualified_name, std::vector<Namespace *> &namespaces,
321 std::map<std::string, Namespace *> &namespaces_index) {
322 size_t dot = qualified_name.find_last_of('.');
323 std::string namespace_name = (dot != std::string::npos)
324 ? std::string(qualified_name.c_str(), dot)
325 : "";
326 Namespace *&ns = namespaces_index[namespace_name];
327
328 if (!ns) {
329 ns = new Namespace();
330 namespaces.push_back(ns);
331
332 size_t pos = 0;
333
334 for (;;) {
335 dot = qualified_name.find('.', pos);
336 if (dot == std::string::npos) { break; }
337 ns->components.push_back(qualified_name.substr(pos, dot - pos));
338 pos = dot + 1;
339 }
340 }
341
342 return ns;
343}
344
345// Generate a unique hash for a file based on its name and contents (if any).
346static uint64_t HashFile(const char *source_filename, const char *source) {

Callers 1

DeserializeMethod · 0.85

Calls 6

stringClass · 0.50
find_last_ofMethod · 0.45
c_strMethod · 0.45
push_backMethod · 0.45
findMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected