Logo Search packages:      
Sourcecode: djvulibre version File versions  Download package

GP< GIFFChunk > GIFFManager::get_chunk ( GUTF8String  name,
int *  position = 0 

Returns the chunk with name {name}. The {name} may contain dots colons and slashes. If {position} is not zero, #*position# will be assigned the position of the found chunk in the parent chunk.

{ Examples:} {verbatim} ;; To get the directory chunk of DjVm document m.getChunk(".DJVM.DIR0"); ;; To get chunk corresponding to 2nd DJVU form m.getChunk(".DJVU[1]"); {verbatim}

Definition at line 514 of file GIFFManager.cpp.

References GBaseString::length(), GBaseString::search(), and GUTF8String::substr().

Referenced by get_chunks_number().

  DEBUG_MSG("GIFFManager::get_chunk(): Returning chunk '" << name << "'\n");
  if (!name.length())
    G_THROW( ERR_MSG("GIFFManager.get_empty") );

  if (name[0]=='.')
    const int next_dot=name.search('.',1);
    if (next_dot < 0)
      if (top_level->check_name(name.substr(1,(unsigned int)-1)))
        DEBUG_MSG("Removing top level chunk..\n");
        return top_level;
      G_THROW( ERR_MSG("GIFFManager.wrong_name2") "\t"+name.substr(1,(unsigned int)-1));
    const GUTF8String top_name=name.substr(1,next_dot-1);
    if (!top_level->check_name(top_name))
      G_THROW( ERR_MSG("GIFFManager.wrong_name2") "\t"+top_name);
    name=name.substr(next_dot+1,(unsigned int)-1);
  GP<GIFFChunk> cur_sec=top_level;
  const char * start, * end=(const char *) name-1;
    if (end>start)
      cur_sec=cur_sec->get_chunk(GUTF8String(start, end-start), pos_num);
    if (!cur_sec)
  } while(*end);
  return cur_sec;

Here is the call graph for this function:

Here is the caller graph for this function:

Generated by  Doxygen 1.6.0   Back to index