Logo Search packages:      
Sourcecode: djvulibre version File versions

GURL GURL::base ( void   )  const

Returns the URL corresponding to the directory containing the document with this URL. The function basically takes the URL and clears everything after the last slash.

Definition at line 930 of file GURL.cpp.

References get_string(), GBaseString::length(), and protocol().

Referenced by follow_symlinks(), DjVuDocument::id_to_url(), listdir(), mkdir(), DjVuDocument::page_to_url(), DjVmDoc::read(), DjVuErrorList::request_data(), DjVuDocument::request_data(), DjVuDocument::save_as(), DjVuDocEditor::save_as(), DjVuFile::set_name(), DjVuFile::unlink_file(), and DjVuDocument::url_to_page().

{
   const GUTF8String xurl(get_string());
   const int protocol_length=protocol(xurl).length();
   const char * const url_ptr=xurl;
   const char * ptr, * xslash;
   ptr=xslash=url_ptr+protocol_length+1;
   if(xslash[0] == '/')
   {
     xslash++;
     if(xslash[0] == '/')
       xslash++;
     for(ptr=xslash;ptr[0] && !is_argument(ptr);ptr++)
     {
       if ((ptr[0]==slash)&&ptr[1]&&!is_argument(ptr+1))
        xslash=ptr;
     }
     if(xslash[0] != '/')
     {
       xslash=ptr;
     }
   }
   return GURL::UTF8(GUTF8String(xurl,(int)(xslash-url_ptr))+"/"+ptr);
}


Generated by  Doxygen 1.6.0   Back to index