~ubuntu-branches/ubuntu/gutsy/soprano/gutsy

« back to all changes in this revision

Viewing changes to index/tstring.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2007-10-12 14:43:48 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20071012144348-yajzi51v4k23ahxf
Tags: 1.95.0~beta2-1ubuntu1
* Sync with Debian
* Add versioned build-dep on raptor

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This file is part of Soprano Project.
 
3
 *
 
4
 * Copyright (C) 2007 Sebastian Trueg <trueg@kde.org>
 
5
 *
 
6
 * This library is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the GNU Library General Public
 
8
 * License as published by the Free Software Foundation; either
 
9
 * version 2 of the License, or (at your option) any later version.
 
10
 *
 
11
 * This library is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
 * Library General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU Library General Public License
 
17
 * along with this library; see the file COPYING.LIB.  If not, write to
 
18
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
19
 * Boston, MA 02110-1301, USA.
 
20
 */
 
21
 
 
22
#ifndef _W_STRING_H_
 
23
#define _W_STRING_H_
 
24
 
 
25
#include <QtCore/QString>
 
26
#include <QtCore/QSharedDataPointer>
 
27
 
 
28
#include <CLucene.h>
 
29
 
 
30
/**
 
31
 * TString is a simple string class which works on wchar_t
 
32
 * data. Its main purpose it to provide conversion from and to
 
33
 * QString.
 
34
 */
 
35
class TString
 
36
{
 
37
public:
 
38
    /**
 
39
     * Create an empty TString
 
40
     */
 
41
    TString();
 
42
 
 
43
    /**
 
44
     * Create a copy of another TString
 
45
     */
 
46
    TString( const TString& );
 
47
 
 
48
    /**
 
49
     * Create a new TString instance.
 
50
     * \param data The string data to be used.
 
51
     * \param wrap If false the data will be copied for the new
 
52
     * string instance. If true the new TString will act as a wrapper
 
53
     * around data.
 
54
     */
 
55
    TString( const TCHAR* data, bool wrap = false );
 
56
 
 
57
    /**
 
58
     * Create a new TString instance as a copy of a QString
 
59
     */
 
60
    TString( const QString& );
 
61
 
 
62
    ~TString();
 
63
 
 
64
    TString& operator=( const TString& );
 
65
    TString& operator=( const TCHAR* );
 
66
    TString& operator=( const QString& );
 
67
 
 
68
    bool isEmpty() const;
 
69
    int length() const;
 
70
 
 
71
    bool operator==( const TString& ) const;
 
72
    bool operator==( const QString& ) const;
 
73
    bool operator!=( const TString& ) const;
 
74
    bool operator!=( const QString& ) const;
 
75
 
 
76
    /**
 
77
     * The raw string data. It remains valid until the
 
78
     * string is modified or deleted.
 
79
     *
 
80
     * \return the raw string data or 0 if the string is empty.
 
81
     */
 
82
    const TCHAR* data() const;
 
83
 
 
84
    operator QString() const;
 
85
 
 
86
    QString toQString() const;
 
87
 
 
88
    static TString fromUtf8( const char* data );
 
89
        
 
90
private:
 
91
    class Private;
 
92
    QSharedDataPointer<Private> d;
 
93
};
 
94
 
 
95
#endif