~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/plugins/ogr_converter/format.h

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// $Id$
 
2
//////////////////////////////////////////////////////////////////////////////
 
3
//
 
4
// Copyright (C) 2008 by Mateusz Loskot <mateusz@loskot.net>
 
5
//
 
6
// This program is free software; you can redistribute it and/or modify
 
7
// it under the terms of the GNU General Public License as published by
 
8
// the Free Software Foundation; either version 2 of the License,
 
9
// or (at your option) any later version.
 
10
//
 
11
//////////////////////////////////////////////////////////////////////////////
 
12
#ifndef QGIS_PLUGIN_OGRCONV_FORMATS_H_INCLUDED
 
13
#define QGIS_PLUGIN_OGRCONV_FORMATS_H_INCLUDED
 
14
 
 
15
// Qt4
 
16
#include <QMap>
 
17
#include <QString>
 
18
 
 
19
class Format
 
20
{
 
21
  public:
 
22
 
 
23
    enum Type
 
24
    {
 
25
      eUnknown = 0,
 
26
      eFile = 1,
 
27
      eDirectory = 2,
 
28
      eProtocol = 4
 
29
    };
 
30
 
 
31
    Format();
 
32
    Format( QString const& c, QString const& n );
 
33
    Format( QString const& c, QString const& n, unsigned char const& t );
 
34
    Format( QString const& c, QString const& n, QString const& p, unsigned char const& t );
 
35
 
 
36
    QString const& code() const;
 
37
    QString const& name() const;
 
38
    QString const& protocol() const;
 
39
    unsigned char const& type() const;
 
40
 
 
41
  private:
 
42
 
 
43
    QString mCode;
 
44
    QString mName;
 
45
    QString mProtocol;
 
46
    unsigned char mTypeFlags;
 
47
};
 
48
 
 
49
inline bool isFormatType( unsigned char const& frmt, Format::Type const& type )
 
50
{
 
51
  return (( frmt & type ) == type );
 
52
}
 
53
 
 
54
class FormatsRegistry
 
55
{
 
56
  public:
 
57
 
 
58
    FormatsRegistry();
 
59
 
 
60
    void add( Format const& frmt );
 
61
    Format const&  find( QString const& code );
 
62
 
 
63
  private:
 
64
 
 
65
    void init();
 
66
 
 
67
    QMap<QString, Format> mFrmts;
 
68
    Format mCache;
 
69
};
 
70
 
 
71
#endif // QGIS_PLUGIN_OGRCONV_FORMATS_H_INCLUDED