~ubuntu-branches/ubuntu/trusty/kdepimlibs/trusty

« back to all changes in this revision

Viewing changes to akonadi/xml/xmldocument.h

  • Committer: Package Import Robot
  • Author(s): Rohan Garg, Rohan Garg, Philip Muškovac
  • Date: 2013-11-23 17:36:44 UTC
  • mfrom: (1.1.102)
  • Revision ID: package-import@ubuntu.com-20131123173644-p5ow94192ezsny8g
Tags: 4:4.11.80-0ubuntu1
[ Rohan Garg ]
* New upstream beta release
  - Bump akonadi requirement to 1.10.45
  - Update install files
  - Update symbols

[ Philip Muškovac ]
* kdepimlibs-dev/-dbg breaks/replaces kdepim-runtime/-dbg (<< 4:4.11.80)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright (c) 2009 Volker Krause <vkrause@kde.org>
 
3
 
 
4
    This library is free software; you can redistribute it and/or modify it
 
5
    under the terms of the GNU Library General Public License as published by
 
6
    the Free Software Foundation; either version 2 of the License, or (at your
 
7
    option) any later version.
 
8
 
 
9
    This library is distributed in the hope that it will be useful, but WITHOUT
 
10
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
11
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
 
12
    License for more details.
 
13
 
 
14
    You should have received a copy of the GNU Library General Public License
 
15
    along with this library; see the file COPYING.LIB.  If not, write to the
 
16
    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 
17
    02110-1301, USA.
 
18
*/
 
19
 
 
20
#ifndef AKONADI_XMLDOCUMENT_H
 
21
#define AKONADI_XMLDOCUMENT_H
 
22
 
 
23
#include "akonadi-xml_export.h"
 
24
 
 
25
#include <akonadi/collection.h>
 
26
#include <akonadi/item.h>
 
27
 
 
28
#include <QtXml/QDomDocument>
 
29
 
 
30
namespace Akonadi {
 
31
 
 
32
class XmlDocumentPrivate;
 
33
 
 
34
/**
 
35
  Represents a document of the KNUT XML serialization format for Akonadi objects.
 
36
*/
 
37
class AKONADI_XML_EXPORT XmlDocument
 
38
{
 
39
  public:
 
40
    /**
 
41
      Creates an empty document.
 
42
    */
 
43
    XmlDocument();
 
44
 
 
45
    /**
 
46
      Creates a new XmlDocument object and calls loadFile().
 
47
 
 
48
      @see loadFile()
 
49
    */
 
50
    XmlDocument( const QString &fileName );
 
51
    ~XmlDocument();
 
52
 
 
53
    /**
 
54
      Parses the given XML file and validates it.
 
55
      In case of an error, isValid() will return @c false and
 
56
      lastError() will return an error message.
 
57
 
 
58
       @see isValid(), lastError()
 
59
    */
 
60
    bool loadFile( const QString &fileName );
 
61
 
 
62
    /**
 
63
      Writes the current document into the given file.
 
64
    */
 
65
    bool writeToFile( const QString &fileName ) const;
 
66
 
 
67
    /**
 
68
      Returns true if the document could be parsed successfully.
 
69
      @see lastError()
 
70
    */
 
71
    bool isValid() const;
 
72
 
 
73
    /**
 
74
      Returns the last error occurred during file loading/parsing.
 
75
      Empty if isValid() returns @c true.
 
76
      @see isValid()
 
77
    */
 
78
    QString lastError() const;
 
79
 
 
80
    /**
 
81
      Returns the DOM document for this XML document.
 
82
    */
 
83
    QDomDocument& document() const;
 
84
 
 
85
    /**
 
86
      Returns the DOM element representing the collection with the given remote id
 
87
      @deprecated Not HRID aware, use collectionElement() instead
 
88
    */
 
89
    KDE_DEPRECATED QDomElement collectionElementByRemoteId( const QString &rid ) const;
 
90
 
 
91
    /**
 
92
      Returns the DOM element representing @p collection.
 
93
    */
 
94
    QDomElement collectionElement( const Collection &collection ) const;
 
95
 
 
96
    /**
 
97
      Returns the DOM element representing the item with the given remote id
 
98
    */
 
99
    QDomElement itemElementByRemoteId( const QString &rid ) const;
 
100
 
 
101
    /**
 
102
      Returns the collection with the given remote id.
 
103
    */
 
104
    Collection collectionByRemoteId( const QString &rid ) const;
 
105
 
 
106
    /**
 
107
      Returns the item with the given remote id.
 
108
    */
 
109
    Item itemByRemoteId( const QString& rid, bool includePayload = true ) const;
 
110
 
 
111
    /**
 
112
      Returns the collections defined in this document.
 
113
    */
 
114
    Collection::List collections() const;
 
115
 
 
116
    /**
 
117
      Returns immediate child collections of the specified parent collection.
 
118
      @deprecated Not HRID aware, use childCollections( Akonadi::Collection ) instead
 
119
    */
 
120
    KDE_DEPRECATED Collection::List childCollections( const QString &parentCollectionRid ) const;
 
121
 
 
122
    /**
 
123
      Returns the immediate child collections of @p parentCollection.
 
124
    */
 
125
    Collection::List childCollections( const Collection &parentCollection ) const;
 
126
 
 
127
    /**
 
128
      Returns the items in the given collection.
 
129
    */
 
130
    Item::List items( const Collection& collection, bool includePayload = true ) const;
 
131
 
 
132
  private:
 
133
    XmlDocumentPrivate * const d;
 
134
};
 
135
 
 
136
}
 
137
 
 
138
#endif