~pac72/ubuntu/lucid/ddd/devel

« back to all changes in this revision

Viewing changes to ddd/MString.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Schepler
  • Date: 2004-07-22 03:49:37 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040722034937-cysl08t1jvba4jrx
Tags: 1:3.3.9-3
USERINFO has been renamed to USERINFO.txt; adjust debian/rules code
to match, to get correct information on the About DDD dialog.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// $Id: MString.h,v 1.29 2001/02/23 16:01:07 zeller Exp $
 
1
// $Id$
2
2
// Simple interface to Motif composite strings
3
3
 
4
4
// Copyright (C) 1995-1998 Technische Universitaet Braunschweig, Germany.
30
30
#ifndef _DDD_MString_h
31
31
#define _DDD_MString_h
32
32
 
33
 
#ifdef __GNUG__
34
 
#pragma interface
35
 
#endif
36
 
 
37
 
 
38
33
// An "MString" is but a C++ wrapper around Motif composite strings.
39
34
 
40
35
#include <Xm/Xm.h>
55
50
public:
56
51
    // Constructors
57
52
    MString():
58
 
        _mstring(XmStringCreateLtoR(CONST_CAST(char *,""), MSTRING_DEFAULT_CHARSET))
 
53
        _mstring(XmStringCreateLtoR(XMST(""), MSTRING_DEFAULT_CHARSET))
59
54
    {
60
55
        assert(OK());
61
56
    }
62
57
 
63
58
    MString(const char *text,
64
59
            XmStringCharSet charset = MSTRING_DEFAULT_CHARSET):
65
 
        _mstring(text ? XmStringCreateLtoR(CONST_CAST(char *,text), charset) : 0)
 
60
        _mstring(text ? XmStringCreateLtoR(XMST(text), charset) : 0)
66
61
    {
67
62
        assert(OK());
68
63
    }
69
64
 
70
65
    MString(const string& text,
71
66
            XmStringCharSet charset = MSTRING_DEFAULT_CHARSET):
72
 
        _mstring(XmStringCreateLtoR(CONST_CAST(char *,text.chars()), charset))
 
67
        _mstring(XmStringCreateLtoR(XMST(text.chars()), charset))
73
68
    {
74
69
        assert(OK());
75
70
    }
147
142
        assert(OK());
148
143
        assert(m.OK());
149
144
 
150
 
        // Make sure a = a works
151
 
        XmString tmp = XmStringCopy(m._mstring);
152
 
        XmStringFree(_mstring);
153
 
        _mstring = tmp;
 
145
        if ( this != &m ) { 
 
146
          // Make sure a = a works
 
147
          XmString tmp = XmStringCopy(m._mstring);
 
148
          XmStringFree(_mstring);
 
149
          _mstring = tmp;
 
150
        }
154
151
 
155
152
        return *this;
156
153
    }
202
199
    }
203
200
 
204
201
    // Conversions
205
 
#if 0
206
 
    // TODO remove
207
 
 private:
208
 
    operator XmString() const { return _mstring; }
209
 
    operator XmString()       { return _mstring; }
210
 
 public:
211
 
#endif
212
202
    XmString xmstring() const { return _mstring; }
213
203
 
214
204
    // Substrings