MCPcopy Create free account
hub / github.com/USCiLab/cereal / search

Method search

include/cereal/archives/json.hpp:531–547  ·  view source on GitHub ↗

Adjust our position such that we are at the node with the given name ! @throws Exception if no such named node exists */

Source from the content-addressed store, hash-verified

529 //! Adjust our position such that we are at the node with the given name
530 /*! @throws Exception if no such named node exists */
531 inline void search( const char * searchName )
532 {
533 const auto len = std::strlen( searchName );
534 size_t index = 0;
535 for( auto it = itsMemberItBegin; it != itsMemberItEnd; ++it, ++index )
536 {
537 const auto currentName = it->name.GetString();
538 if( ( std::strncmp( searchName, currentName, len ) == 0 ) &&
539 ( std::strlen( currentName ) == len ) )
540 {
541 itsIndex = index;
542 return;
543 }
544 }
545
546 throw Exception("JSON Parsing failed - provided NVP (" + std::string(searchName) + ") not found");
547 }
548
549 private:
550 MemberIterator itsMemberItBegin, itsMemberItEnd; //!< The member iterator (object)

Callers

nothing calls this directly

Calls 1

ExceptionClass · 0.85

Tested by

no test coverage detected