~ubuntu-branches/ubuntu/vivid/fbreader/vivid-proposed

« back to all changes in this revision

Viewing changes to fbreader/src/formats/util/MiscUtil.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Joey Hess
  • Date: 2008-01-23 16:51:07 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080123165107-5q19etahzd72c33a
Tags: 0.8.12-3
* Add libzlui-maemo which allows using fbreader on the maemo platform, on
  Debian. Thanks, Riku Voipio. Closes: #462299
* makefiles/arch/maemo.mk: Don't build with -thumb. (Riku)
* Loosen dependency versions some more, so it only depends on the current
  upstream version or higher, ignoring the Debian revision.
* Use binary:Version instead of deprecated Source-Version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * FBReader -- electronic book reader
3
 
 * Copyright (C) 2004-2007 Nikolay Pultsin <geometer@mawhrin.net>
4
 
 * Copyright (C) 2005 Mikhail Sobolev <mss@mawhrin.net>
 
2
 * Copyright (C) 2004-2008 Geometer Plus <contact@geometerplus.com>
5
3
 *
6
4
 * This program is free software; you can redistribute it and/or modify
7
5
 * it under the terms of the GNU General Public License as published by
23
21
 
24
22
#include <ZLApplication.h>
25
23
#include <ZLFile.h>
 
24
#include <ZLStringUtil.h>
26
25
 
27
26
#include "MiscUtil.h"
28
27
 
29
 
static bool hasPrefix(const std::string &text, const std::string &prefix) {
30
 
        return (text.length() >= prefix.length()) && (text.substr(0, prefix.length()) == prefix);
31
 
}
32
 
 
33
28
bool MiscUtil::isReference(const std::string &text) {
34
29
        return
35
 
                hasPrefix(text, "http://") ||
36
 
                hasPrefix(text, "https://") ||
37
 
                hasPrefix(text, "mailto:") ||
38
 
                hasPrefix(text, "ftp://");
 
30
                ZLStringUtil::stringStartsWith(text, "http://") ||
 
31
                ZLStringUtil::stringStartsWith(text, "https://") ||
 
32
                ZLStringUtil::stringStartsWith(text, "mailto:") ||
 
33
                ZLStringUtil::stringStartsWith(text, "ftp://");
39
34
}
40
35
 
41
36
std::string MiscUtil::htmlDirectoryPrefix(const std::string &fileName) {
81
76
        }
82
77
        return decoded;
83
78
}
84