~ubuntu-branches/ubuntu/quantal/qgis/quantal

« back to all changes in this revision

Viewing changes to src/qgsexception.h

  • Committer: Bazaar Package Importer
  • Author(s): William Grant
  • Date: 2007-05-06 13:42:32 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070506134232-pyli6t388w5asd8x
Tags: 0.8.0-3ubuntu1
* Merge from Debian unstable. Remaining Ubuntu changes:
  - debian/rules, debian/qgis.install, debian/qgis.dirs debian/qgis.desktop:
    Add and install .desktop.
* debian/qgis.desktop: Remove Applications category; it's not real.
* Modify Maintainer value to match Debian-Maintainer-Field Spec

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
                          qgsproject.cpp -  description
3
 
                             -------------------
4
 
  begin                : August 31, 2004
5
 
  copyright            : (C) 2004 by Mark Coletti
6
 
  email                : mcoletti at gmail.com
7
 
***************************************************************************/
8
 
 
9
 
/***************************************************************************
10
 
 *                                                                         *
11
 
 *   This program is free software; you can redistribute it and/or modify  *
12
 
 *   it under the terms of the GNU General Public License as published by  *
13
 
 *   the Free Software Foundation; either version 2 of the License, or     *
14
 
 *   (at your option) any later version.                                   *
15
 
 *                                                                         *
16
 
 ***************************************************************************/
17
 
/* $Id: qgsexception.h,v 1.4.2.1 2005/07/09 23:51:18 timlinux Exp $ */
18
 
#ifndef QGSEXCEPTION_H
19
 
#define QGSEXCEPTION_H
20
 
 
21
 
#include <exception>
22
 
#include <string>
23
 
#include <list>
24
 
 
25
 
#include <qdom.h> 
26
 
#include <qstring.h>
27
 
 
28
 
/**
29
 
   Defines a qgis exception class
30
 
 */
31
 
class QgsException : public std::exception
32
 
{
33
 
public:
34
 
 
35
 
    QgsException( std::string const & what )
36
 
        : what_( what )
37
 
    {}
38
 
 
39
 
    QgsException( QString const & what )
40
 
        : what_( (const char *)what.local8Bit() )
41
 
    {}
42
 
 
43
 
    virtual ~QgsException() throw()
44
 
    {}
45
 
 
46
 
    const char* what() const throw()
47
 
    {
48
 
        return what_.c_str();
49
 
    }
50
 
    
51
 
private:
52
 
 
53
 
    /// description of exception
54
 
    std::string what_;
55
 
 
56
 
}; // class QgsException
57
 
 
58
 
 
59
 
/** for Qgis I/O related exceptions 
60
 
 
61
 
  @note usually thrown for opening file's that don't exist, and the like.
62
 
 
63
 
*/
64
 
class QgsIOException : public QgsException
65
 
{
66
 
public:
67
 
 
68
 
    QgsIOException( std::string const & what )
69
 
        : QgsException( what )
70
 
        {}
71
 
 
72
 
    QgsIOException( QString const & what )
73
 
        : QgsException( what )
74
 
        {}
75
 
 
76
 
}; // class QgsIOException
77
 
 
78
 
 
79
 
 
80
 
/** for files missing from layers while reading project files
81
 
 
82
 
*/
83
 
class QgsProjectBadLayerException : public QgsException
84
 
{
85
 
public:
86
 
 
87
 
    QgsProjectBadLayerException( std::list<QDomNode> const & layers )
88
 
        : QgsException(std::string(msg_)),
89
 
          mBrokenLayers( layers )
90
 
    {}
91
 
    
92
 
    ~QgsProjectBadLayerException() throw()
93
 
    {}
94
 
    
95
 
    std::list<QDomNode> const & layers() const
96
 
    {
97
 
        return mBrokenLayers;
98
 
    }
99
 
 
100
 
private:
101
 
 
102
 
    /** QDomNodes representing the state of a layer that couldn't be loaded
103
 
 
104
 
    The layer data was either relocated or deleted.  The DOM node also
105
 
    contains ancillary data such as line widths and the like.
106
 
 
107
 
     */
108
 
    std::list<QDomNode> mBrokenLayers;
109
 
 
110
 
    static const char * msg_;
111
 
 
112
 
}; // class QgsProjectBadLayerException
113
 
 
114
 
 
115
 
 
116
 
#endif